From c1a15d08f497150a91ba4e61bab54b8f5c8b49b9 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Wed, 17 Apr 2013 20:18:55 +0200 Subject: [PATCH 001/913] xen-blkback: print stats about persistent grants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Cc: xen-devel@lists.xen.org Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/block/xen-blkback/blkback.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index dd5b2fed97e9..f7526dbb204d 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -382,10 +382,12 @@ irqreturn_t xen_blkif_be_int(int irq, void *dev_id) static void print_stats(struct xen_blkif *blkif) { pr_info("xen-blkback (%s): oo %3llu | rd %4llu | wr %4llu | f %4llu" - " | ds %4llu\n", + " | ds %4llu | pg: %4u/%4u\n", current->comm, blkif->st_oo_req, blkif->st_rd_req, blkif->st_wr_req, - blkif->st_f_req, blkif->st_ds_req); + blkif->st_f_req, blkif->st_ds_req, + blkif->persistent_gnt_c, + max_mapped_grant_pages(blkif->blk_protocol)); blkif->st_print = jiffies + msecs_to_jiffies(10 * 1000); blkif->st_rd_req = 0; blkif->st_wr_req = 0; From c6cc142dac52e62e1e8a2aff5de1300202b96c66 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Wed, 17 Apr 2013 20:18:56 +0200 Subject: [PATCH 002/913] xen-blkback: use balloon pages for all mappings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using balloon pages for all granted pages allows us to simplify the logic in blkback, especially in the xen_blkbk_map function, since now we can decide if we want to map a grant persistently or not after we have actually mapped it. This could not be done before because persistent grants used ballooned pages, whereas non-persistent grants used pages from the kernel. This patch also introduces several changes, the first one is that the list of free pages is no longer global, now each blkback instance has it's own list of free pages that can be used to map grants. Also, a run time parameter (max_buffer_pages) has been added in order to tune the maximum number of free pages each blkback instance will keep in it's buffer. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Cc: xen-devel@lists.xen.org Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- .../ABI/stable/sysfs-bus-xen-backend | 8 + drivers/block/xen-blkback/blkback.c | 290 ++++++++++-------- drivers/block/xen-blkback/common.h | 5 + drivers/block/xen-blkback/xenbus.c | 3 + 4 files changed, 183 insertions(+), 123 deletions(-) diff --git a/Documentation/ABI/stable/sysfs-bus-xen-backend b/Documentation/ABI/stable/sysfs-bus-xen-backend index 3d5951c8bf5f..e04afe0cca99 100644 --- a/Documentation/ABI/stable/sysfs-bus-xen-backend +++ b/Documentation/ABI/stable/sysfs-bus-xen-backend @@ -73,3 +73,11 @@ KernelVersion: 3.0 Contact: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Description: Number of sectors written by the frontend. + +What: /sys/module/xen_blkback/parameters/max_buffer_pages +Date: March 2013 +KernelVersion: 3.10 +Contact: Roger Pau Monné <roger.pau@citrix.com> +Description: + Maximum number of free pages to keep in each block + backend buffer. diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index f7526dbb204d..8245c6bb9539 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -63,6 +63,21 @@ static int xen_blkif_reqs = 64; module_param_named(reqs, xen_blkif_reqs, int, 0); MODULE_PARM_DESC(reqs, "Number of blkback requests to allocate"); +/* + * Maximum number of unused free pages to keep in the internal buffer. + * Setting this to a value too low will reduce memory used in each backend, + * but can have a performance penalty. + * + * A sane value is xen_blkif_reqs * BLKIF_MAX_SEGMENTS_PER_REQUEST, but can + * be set to a lower value that might degrade performance on some intensive + * IO workloads. + */ + +static int xen_blkif_max_buffer_pages = 704; +module_param_named(max_buffer_pages, xen_blkif_max_buffer_pages, int, 0644); +MODULE_PARM_DESC(max_buffer_pages, +"Maximum number of free pages to keep in each block backend buffer"); + /* Run-time switchable: /sys/module/blkback/parameters/ */ static unsigned int log_stats; module_param(log_stats, int, 0644); @@ -82,10 +97,14 @@ struct pending_req { int status; struct list_head free_list; DECLARE_BITMAP(unmap_seg, BLKIF_MAX_SEGMENTS_PER_REQUEST); + struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; }; #define BLKBACK_INVALID_HANDLE (~0) +/* Number of free pages to remove on each call to free_xenballooned_pages */ +#define NUM_BATCH_FREE_PAGES 10 + struct xen_blkbk { struct pending_req *pending_reqs; /* List of all 'pending_req' available */ @@ -93,8 +112,6 @@ struct xen_blkbk { /* And its spinlock. */ spinlock_t pending_free_lock; wait_queue_head_t pending_free_wq; - /* The list of all pages that are available. */ - struct page **pending_pages; /* And the grant handles that are available. */ grant_handle_t *pending_grant_handles; }; @@ -143,14 +160,66 @@ static inline int vaddr_pagenr(struct pending_req *req, int seg) BLKIF_MAX_SEGMENTS_PER_REQUEST + seg; } -#define pending_page(req, seg) pending_pages[vaddr_pagenr(req, seg)] - -static inline unsigned long vaddr(struct pending_req *req, int seg) +static inline int get_free_page(struct xen_blkif *blkif, struct page **page) { - unsigned long pfn = page_to_pfn(blkbk->pending_page(req, seg)); - return (unsigned long)pfn_to_kaddr(pfn); + unsigned long flags; + + spin_lock_irqsave(&blkif->free_pages_lock, flags); + if (list_empty(&blkif->free_pages)) { + BUG_ON(blkif->free_pages_num != 0); + spin_unlock_irqrestore(&blkif->free_pages_lock, flags); + return alloc_xenballooned_pages(1, page, false); + } + BUG_ON(blkif->free_pages_num == 0); + page[0] = list_first_entry(&blkif->free_pages, struct page, lru); + list_del(&page[0]->lru); + blkif->free_pages_num--; + spin_unlock_irqrestore(&blkif->free_pages_lock, flags); + + return 0; } +static inline void put_free_pages(struct xen_blkif *blkif, struct page **page, + int num) +{ + unsigned long flags; + int i; + + spin_lock_irqsave(&blkif->free_pages_lock, flags); + for (i = 0; i < num; i++) + list_add(&page[i]->lru, &blkif->free_pages); + blkif->free_pages_num += num; + spin_unlock_irqrestore(&blkif->free_pages_lock, flags); +} + +static inline void shrink_free_pagepool(struct xen_blkif *blkif, int num) +{ + /* Remove requested pages in batches of NUM_BATCH_FREE_PAGES */ + struct page *page[NUM_BATCH_FREE_PAGES]; + unsigned int num_pages = 0; + unsigned long flags; + + spin_lock_irqsave(&blkif->free_pages_lock, flags); + while (blkif->free_pages_num > num) { + BUG_ON(list_empty(&blkif->free_pages)); + page[num_pages] = list_first_entry(&blkif->free_pages, + struct page, lru); + list_del(&page[num_pages]->lru); + blkif->free_pages_num--; + if (++num_pages == NUM_BATCH_FREE_PAGES) { + spin_unlock_irqrestore(&blkif->free_pages_lock, flags); + free_xenballooned_pages(num_pages, page); + spin_lock_irqsave(&blkif->free_pages_lock, flags); + num_pages = 0; + } + } + spin_unlock_irqrestore(&blkif->free_pages_lock, flags); + if (num_pages != 0) + free_xenballooned_pages(num_pages, page); +} + +#define vaddr(page) ((unsigned long)pfn_to_kaddr(page_to_pfn(page))) + #define pending_handle(_req, _seg) \ (blkbk->pending_grant_handles[vaddr_pagenr(_req, _seg)]) @@ -170,7 +239,7 @@ static void make_response(struct xen_blkif *blkif, u64 id, (n) = (&(pos)->node != NULL) ? rb_next(&(pos)->node) : NULL) -static void add_persistent_gnt(struct rb_root *root, +static int add_persistent_gnt(struct rb_root *root, struct persistent_gnt *persistent_gnt) { struct rb_node **new = &(root->rb_node), *parent = NULL; @@ -186,14 +255,15 @@ static void add_persistent_gnt(struct rb_root *root, else if (persistent_gnt->gnt > this->gnt) new = &((*new)->rb_right); else { - pr_alert(DRV_PFX " trying to add a gref that's already in the tree\n"); - BUG(); + pr_alert_ratelimited(DRV_PFX " trying to add a gref that's already in the tree\n"); + return -EINVAL; } } /* Add new node and rebalance tree. */ rb_link_node(&(persistent_gnt->node), parent, new); rb_insert_color(&(persistent_gnt->node), root); + return 0; } static struct persistent_gnt *get_persistent_gnt(struct rb_root *root, @@ -215,7 +285,8 @@ static struct persistent_gnt *get_persistent_gnt(struct rb_root *root, return NULL; } -static void free_persistent_gnts(struct rb_root *root, unsigned int num) +static void free_persistent_gnts(struct xen_blkif *blkif, struct rb_root *root, + unsigned int num) { struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; @@ -240,7 +311,7 @@ static void free_persistent_gnts(struct rb_root *root, unsigned int num) ret = gnttab_unmap_refs(unmap, NULL, pages, segs_to_unmap); BUG_ON(ret); - free_xenballooned_pages(segs_to_unmap, pages); + put_free_pages(blkif, pages, segs_to_unmap); segs_to_unmap = 0; } @@ -422,13 +493,19 @@ int xen_blkif_schedule(void *arg) if (do_block_io_op(blkif)) blkif->waiting_reqs = 1; + /* Shrink if we have more than xen_blkif_max_buffer_pages */ + shrink_free_pagepool(blkif, xen_blkif_max_buffer_pages); + if (log_stats && time_after(jiffies, blkif->st_print)) print_stats(blkif); } + /* Since we are shutting down remove all pages from the buffer */ + shrink_free_pagepool(blkif, 0 /* All */); + /* Free all persistent grant pages */ if (!RB_EMPTY_ROOT(&blkif->persistent_gnts)) - free_persistent_gnts(&blkif->persistent_gnts, + free_persistent_gnts(blkif, &blkif->persistent_gnts, blkif->persistent_gnt_c); BUG_ON(!RB_EMPTY_ROOT(&blkif->persistent_gnts)); @@ -457,23 +534,25 @@ static void xen_blkbk_unmap(struct pending_req *req) struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; unsigned int i, invcount = 0; grant_handle_t handle; + struct xen_blkif *blkif = req->blkif; int ret; for (i = 0; i < req->nr_pages; i++) { if (!test_bit(i, req->unmap_seg)) continue; handle = pending_handle(req, i); + pages[invcount] = req->pages[i]; if (handle == BLKBACK_INVALID_HANDLE) continue; - gnttab_set_unmap_op(&unmap[invcount], vaddr(req, i), + gnttab_set_unmap_op(&unmap[invcount], vaddr(pages[invcount]), GNTMAP_host_map, handle); pending_handle(req, i) = BLKBACK_INVALID_HANDLE; - pages[invcount] = virt_to_page(vaddr(req, i)); invcount++; } ret = gnttab_unmap_refs(unmap, NULL, pages, invcount); BUG_ON(ret); + put_free_pages(blkif, pages, invcount); } static int xen_blkbk_map(struct blkif_request *req, @@ -487,8 +566,7 @@ static int xen_blkbk_map(struct blkif_request *req, struct persistent_gnt *persistent_gnt = NULL; struct xen_blkif *blkif = pending_req->blkif; phys_addr_t addr = 0; - int i, j; - bool new_map; + int i, seg_idx, new_map_idx; int nseg = req->u.rw.nr_segments; int segs_to_map = 0; int ret = 0; @@ -517,68 +595,16 @@ static int xen_blkbk_map(struct blkif_request *req, * We are using persistent grants and * the grant is already mapped */ - new_map = false; - } else if (use_persistent_gnts && - blkif->persistent_gnt_c < - max_mapped_grant_pages(blkif->blk_protocol)) { - /* - * We are using persistent grants, the grant is - * not mapped but we have room for it - */ - new_map = true; - persistent_gnt = kmalloc( - sizeof(struct persistent_gnt), - GFP_KERNEL); - if (!persistent_gnt) - return -ENOMEM; - if (alloc_xenballooned_pages(1, &persistent_gnt->page, - false)) { - kfree(persistent_gnt); - return -ENOMEM; - } - persistent_gnt->gnt = req->u.rw.seg[i].gref; - persistent_gnt->handle = BLKBACK_INVALID_HANDLE; - - pages_to_gnt[segs_to_map] = - persistent_gnt->page; - addr = (unsigned long) pfn_to_kaddr( - page_to_pfn(persistent_gnt->page)); - - add_persistent_gnt(&blkif->persistent_gnts, - persistent_gnt); - blkif->persistent_gnt_c++; - pr_debug(DRV_PFX " grant %u added to the tree of persistent grants, using %u/%u\n", - persistent_gnt->gnt, blkif->persistent_gnt_c, - max_mapped_grant_pages(blkif->blk_protocol)); - } else { - /* - * We are either using persistent grants and - * hit the maximum limit of grants mapped, - * or we are not using persistent grants. - */ - if (use_persistent_gnts && - !blkif->vbd.overflow_max_grants) { - blkif->vbd.overflow_max_grants = 1; - pr_alert(DRV_PFX " domain %u, device %#x is using maximum number of persistent grants\n", - blkif->domid, blkif->vbd.handle); - } - new_map = true; - pages[i] = blkbk->pending_page(pending_req, i); - addr = vaddr(pending_req, i); - pages_to_gnt[segs_to_map] = - blkbk->pending_page(pending_req, i); - } - - if (persistent_gnt) { pages[i] = persistent_gnt->page; persistent_gnts[i] = persistent_gnt; } else { + if (get_free_page(blkif, &pages[i])) + goto out_of_memory; + addr = vaddr(pages[i]); + pages_to_gnt[segs_to_map] = pages[i]; persistent_gnts[i] = NULL; - } - - if (new_map) { flags = GNTMAP_host_map; - if (!persistent_gnt && + if (!use_persistent_gnts && (pending_req->operation != BLKIF_OP_READ)) flags |= GNTMAP_readonly; gnttab_set_map_op(&map[segs_to_map++], addr, @@ -598,48 +624,81 @@ static int xen_blkbk_map(struct blkif_request *req, * the page from the other domain. */ bitmap_zero(pending_req->unmap_seg, BLKIF_MAX_SEGMENTS_PER_REQUEST); - for (i = 0, j = 0; i < nseg; i++) { - if (!persistent_gnts[i] || - persistent_gnts[i]->handle == BLKBACK_INVALID_HANDLE) { + for (seg_idx = 0, new_map_idx = 0; seg_idx < nseg; seg_idx++) { + if (!persistent_gnts[seg_idx]) { /* This is a newly mapped grant */ - BUG_ON(j >= segs_to_map); - if (unlikely(map[j].status != 0)) { + BUG_ON(new_map_idx >= segs_to_map); + if (unlikely(map[new_map_idx].status != 0)) { pr_debug(DRV_PFX "invalid buffer -- could not remap it\n"); - map[j].handle = BLKBACK_INVALID_HANDLE; + pending_handle(pending_req, seg_idx) = BLKBACK_INVALID_HANDLE; ret |= 1; - if (persistent_gnts[i]) { - rb_erase(&persistent_gnts[i]->node, - &blkif->persistent_gnts); - blkif->persistent_gnt_c--; - kfree(persistent_gnts[i]); - persistent_gnts[i] = NULL; - } - } - } - if (persistent_gnts[i]) { - if (persistent_gnts[i]->handle == - BLKBACK_INVALID_HANDLE) { + new_map_idx++; /* - * If this is a new persistent grant - * save the handler + * No need to set unmap_seg bit, since + * we can not unmap this grant because + * the handle is invalid. */ - persistent_gnts[i]->handle = map[j++].handle; + continue; } - pending_handle(pending_req, i) = - persistent_gnts[i]->handle; - - if (ret) - continue; + pending_handle(pending_req, seg_idx) = map[new_map_idx].handle; } else { - pending_handle(pending_req, i) = map[j++].handle; - bitmap_set(pending_req->unmap_seg, i, 1); - - if (ret) - continue; + /* This grant is persistent and already mapped */ + goto next; } - seg[i].offset = (req->u.rw.seg[i].first_sect << 9); + if (use_persistent_gnts && + blkif->persistent_gnt_c < + max_mapped_grant_pages(blkif->blk_protocol)) { + /* + * We are using persistent grants, the grant is + * not mapped but we have room for it + */ + persistent_gnt = kmalloc(sizeof(struct persistent_gnt), + GFP_KERNEL); + if (!persistent_gnt) { + /* + * If we don't have enough memory to + * allocate the persistent_gnt struct + * map this grant non-persistenly + */ + goto next_unmap; + } + persistent_gnt->gnt = map[new_map_idx].ref; + persistent_gnt->handle = map[new_map_idx].handle; + persistent_gnt->page = pages[seg_idx]; + if (add_persistent_gnt(&blkif->persistent_gnts, + persistent_gnt)) { + kfree(persistent_gnt); + persistent_gnt = NULL; + goto next_unmap; + } + blkif->persistent_gnt_c++; + pr_debug(DRV_PFX " grant %u added to the tree of persistent grants, using %u/%u\n", + persistent_gnt->gnt, blkif->persistent_gnt_c, + max_mapped_grant_pages(blkif->blk_protocol)); + new_map_idx++; + goto next; + } + if (use_persistent_gnts && !blkif->vbd.overflow_max_grants) { + blkif->vbd.overflow_max_grants = 1; + pr_debug(DRV_PFX " domain %u, device %#x is using maximum number of persistent grants\n", + blkif->domid, blkif->vbd.handle); + } +next_unmap: + /* + * We could not map this grant persistently, so use it as + * a non-persistent grant. + */ + bitmap_set(pending_req->unmap_seg, seg_idx, 1); + new_map_idx++; +next: + seg[seg_idx].offset = (req->u.rw.seg[seg_idx].first_sect << 9); } return ret; + +out_of_memory: + pr_alert(DRV_PFX "%s: out of memory\n", __func__); + put_free_pages(blkif, pages_to_gnt, segs_to_map); + return -ENOMEM; } static int dispatch_discard_io(struct xen_blkif *blkif, @@ -863,7 +922,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, int operation; struct blk_plug plug; bool drain = false; - struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + struct page **pages = pending_req->pages; switch (req->operation) { case BLKIF_OP_READ: @@ -1090,22 +1149,14 @@ static int __init xen_blkif_init(void) xen_blkif_reqs, GFP_KERNEL); blkbk->pending_grant_handles = kmalloc(sizeof(blkbk->pending_grant_handles[0]) * mmap_pages, GFP_KERNEL); - blkbk->pending_pages = kzalloc(sizeof(blkbk->pending_pages[0]) * - mmap_pages, GFP_KERNEL); - if (!blkbk->pending_reqs || !blkbk->pending_grant_handles || - !blkbk->pending_pages) { + if (!blkbk->pending_reqs || !blkbk->pending_grant_handles) { rc = -ENOMEM; goto out_of_memory; } for (i = 0; i < mmap_pages; i++) { blkbk->pending_grant_handles[i] = BLKBACK_INVALID_HANDLE; - blkbk->pending_pages[i] = alloc_page(GFP_KERNEL); - if (blkbk->pending_pages[i] == NULL) { - rc = -ENOMEM; - goto out_of_memory; - } } rc = xen_blkif_interface_init(); if (rc) @@ -1130,13 +1181,6 @@ static int __init xen_blkif_init(void) failed_init: kfree(blkbk->pending_reqs); kfree(blkbk->pending_grant_handles); - if (blkbk->pending_pages) { - for (i = 0; i < mmap_pages; i++) { - if (blkbk->pending_pages[i]) - __free_page(blkbk->pending_pages[i]); - } - kfree(blkbk->pending_pages); - } kfree(blkbk); blkbk = NULL; return rc; diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 60103e2517ba..6c73c3855e65 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -220,6 +220,11 @@ struct xen_blkif { struct rb_root persistent_gnts; unsigned int persistent_gnt_c; + /* buffer of free pages to map grant refs */ + spinlock_t free_pages_lock; + int free_pages_num; + struct list_head free_pages; + /* statistics */ unsigned long st_print; unsigned long long st_rd_req; diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 8bfd1bcf95ec..24f7f6d87717 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -118,6 +118,9 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) blkif->st_print = jiffies; init_waitqueue_head(&blkif->waiting_to_free); blkif->persistent_gnts.rb_node = NULL; + spin_lock_init(&blkif->free_pages_lock); + INIT_LIST_HEAD(&blkif->free_pages); + blkif->free_pages_num = 0; return blkif; } From 3f3aad5e6686ed49242bbf86de378b39f119ec9d Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Wed, 17 Apr 2013 20:18:57 +0200 Subject: [PATCH 003/913] xen-blkback: implement LRU mechanism for persistent grants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This mechanism allows blkback to change the number of grants persistently mapped at run time. The algorithm uses a simple LRU mechanism that removes (if needed) the persistent grants that have not been used since the last LRU run, or if all grants have been used it removes the first grants in the list (that are not in use). The algorithm allows the user to change the maximum number of persistent grants, by changing max_persistent_grants in sysfs. Since we are storing the persistent grants used inside the request struct (to be able to mark them as "unused" when unmapping), we no longer need the bitmap (unmap_seg). Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: xen-devel@lists.xen.org Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- .../ABI/stable/sysfs-bus-xen-backend | 10 + drivers/block/xen-blkback/blkback.c | 287 ++++++++++++++---- drivers/block/xen-blkback/common.h | 18 ++ drivers/block/xen-blkback/xenbus.c | 2 + 4 files changed, 260 insertions(+), 57 deletions(-) diff --git a/Documentation/ABI/stable/sysfs-bus-xen-backend b/Documentation/ABI/stable/sysfs-bus-xen-backend index e04afe0cca99..947db11350bc 100644 --- a/Documentation/ABI/stable/sysfs-bus-xen-backend +++ b/Documentation/ABI/stable/sysfs-bus-xen-backend @@ -81,3 +81,13 @@ Contact: Roger Pau Monné <roger.pau@citrix.com> Description: Maximum number of free pages to keep in each block backend buffer. + +What: /sys/module/xen_blkback/parameters/max_persistent_grants +Date: March 2013 +KernelVersion: 3.10 +Contact: Roger Pau Monné <roger.pau@citrix.com> +Description: + Maximum number of grants to map persistently in + blkback. If the frontend tries to use more than + max_persistent_grants, the LRU kicks in and starts + removing 5% of max_persistent_grants every 100ms. diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 8245c6bb9539..17052f74ebe5 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -78,6 +78,36 @@ module_param_named(max_buffer_pages, xen_blkif_max_buffer_pages, int, 0644); MODULE_PARM_DESC(max_buffer_pages, "Maximum number of free pages to keep in each block backend buffer"); +/* + * Maximum number of grants to map persistently in blkback. For maximum + * performance this should be the total numbers of grants that can be used + * to fill the ring, but since this might become too high, specially with + * the use of indirect descriptors, we set it to a value that provides good + * performance without using too much memory. + * + * When the list of persistent grants is full we clean it up using a LRU + * algorithm. + */ + +static int xen_blkif_max_pgrants = 352; +module_param_named(max_persistent_grants, xen_blkif_max_pgrants, int, 0644); +MODULE_PARM_DESC(max_persistent_grants, + "Maximum number of grants to map persistently"); + +/* + * The LRU mechanism to clean the lists of persistent grants needs to + * be executed periodically. The time interval between consecutive executions + * of the purge mechanism is set in ms. + */ +#define LRU_INTERVAL 100 + +/* + * When the persistent grants list is full we will remove unused grants + * from the list. The percent number of grants to be removed at each LRU + * execution. + */ +#define LRU_PERCENT_CLEAN 5 + /* Run-time switchable: /sys/module/blkback/parameters/ */ static unsigned int log_stats; module_param(log_stats, int, 0644); @@ -96,8 +126,8 @@ struct pending_req { unsigned short operation; int status; struct list_head free_list; - DECLARE_BITMAP(unmap_seg, BLKIF_MAX_SEGMENTS_PER_REQUEST); struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + struct persistent_gnt *persistent_gnts[BLKIF_MAX_SEGMENTS_PER_REQUEST]; }; #define BLKBACK_INVALID_HANDLE (~0) @@ -118,36 +148,6 @@ struct xen_blkbk { static struct xen_blkbk *blkbk; -/* - * Maximum number of grant pages that can be mapped in blkback. - * BLKIF_MAX_SEGMENTS_PER_REQUEST * RING_SIZE is the maximum number of - * pages that blkback will persistently map. - * Currently, this is: - * RING_SIZE = 32 (for all known ring types) - * BLKIF_MAX_SEGMENTS_PER_REQUEST = 11 - * sizeof(struct persistent_gnt) = 48 - * So the maximum memory used to store the grants is: - * 32 * 11 * 48 = 16896 bytes - */ -static inline unsigned int max_mapped_grant_pages(enum blkif_protocol protocol) -{ - switch (protocol) { - case BLKIF_PROTOCOL_NATIVE: - return __CONST_RING_SIZE(blkif, PAGE_SIZE) * - BLKIF_MAX_SEGMENTS_PER_REQUEST; - case BLKIF_PROTOCOL_X86_32: - return __CONST_RING_SIZE(blkif_x86_32, PAGE_SIZE) * - BLKIF_MAX_SEGMENTS_PER_REQUEST; - case BLKIF_PROTOCOL_X86_64: - return __CONST_RING_SIZE(blkif_x86_64, PAGE_SIZE) * - BLKIF_MAX_SEGMENTS_PER_REQUEST; - default: - BUG(); - } - return 0; -} - - /* * Little helpful macro to figure out the index and virtual address of the * pending_pages[..]. For each 'pending_req' we have have up to @@ -239,13 +239,29 @@ static void make_response(struct xen_blkif *blkif, u64 id, (n) = (&(pos)->node != NULL) ? rb_next(&(pos)->node) : NULL) -static int add_persistent_gnt(struct rb_root *root, +/* + * We don't need locking around the persistent grant helpers + * because blkback uses a single-thread for each backed, so we + * can be sure that this functions will never be called recursively. + * + * The only exception to that is put_persistent_grant, that can be called + * from interrupt context (by xen_blkbk_unmap), so we have to use atomic + * bit operations to modify the flags of a persistent grant and to count + * the number of used grants. + */ +static int add_persistent_gnt(struct xen_blkif *blkif, struct persistent_gnt *persistent_gnt) { - struct rb_node **new = &(root->rb_node), *parent = NULL; + struct rb_node **new = NULL, *parent = NULL; struct persistent_gnt *this; + if (blkif->persistent_gnt_c >= xen_blkif_max_pgrants) { + if (!blkif->vbd.overflow_max_grants) + blkif->vbd.overflow_max_grants = 1; + return -EBUSY; + } /* Figure out where to put new node */ + new = &blkif->persistent_gnts.rb_node; while (*new) { this = container_of(*new, struct persistent_gnt, node); @@ -260,18 +276,23 @@ static int add_persistent_gnt(struct rb_root *root, } } + bitmap_zero(persistent_gnt->flags, PERSISTENT_GNT_FLAGS_SIZE); + set_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags); /* Add new node and rebalance tree. */ rb_link_node(&(persistent_gnt->node), parent, new); - rb_insert_color(&(persistent_gnt->node), root); + rb_insert_color(&(persistent_gnt->node), &blkif->persistent_gnts); + blkif->persistent_gnt_c++; + atomic_inc(&blkif->persistent_gnt_in_use); return 0; } -static struct persistent_gnt *get_persistent_gnt(struct rb_root *root, +static struct persistent_gnt *get_persistent_gnt(struct xen_blkif *blkif, grant_ref_t gref) { struct persistent_gnt *data; - struct rb_node *node = root->rb_node; + struct rb_node *node = NULL; + node = blkif->persistent_gnts.rb_node; while (node) { data = container_of(node, struct persistent_gnt, node); @@ -279,12 +300,29 @@ static struct persistent_gnt *get_persistent_gnt(struct rb_root *root, node = node->rb_left; else if (gref > data->gnt) node = node->rb_right; - else + else { + if(test_bit(PERSISTENT_GNT_ACTIVE, data->flags)) { + pr_alert_ratelimited(DRV_PFX " requesting a grant already in use\n"); + return NULL; + } + set_bit(PERSISTENT_GNT_ACTIVE, data->flags); + atomic_inc(&blkif->persistent_gnt_in_use); return data; + } } return NULL; } +static void put_persistent_gnt(struct xen_blkif *blkif, + struct persistent_gnt *persistent_gnt) +{ + if(!test_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags)) + pr_alert_ratelimited(DRV_PFX " freeing a grant already unused"); + set_bit(PERSISTENT_GNT_WAS_ACTIVE, persistent_gnt->flags); + clear_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags); + atomic_dec(&blkif->persistent_gnt_in_use); +} + static void free_persistent_gnts(struct xen_blkif *blkif, struct rb_root *root, unsigned int num) { @@ -322,6 +360,129 @@ static void free_persistent_gnts(struct xen_blkif *blkif, struct rb_root *root, BUG_ON(num != 0); } +static void unmap_purged_grants(struct work_struct *work) +{ + struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + struct persistent_gnt *persistent_gnt; + int ret, segs_to_unmap = 0; + struct xen_blkif *blkif = container_of(work, typeof(*blkif), persistent_purge_work); + + while(!list_empty(&blkif->persistent_purge_list)) { + persistent_gnt = list_first_entry(&blkif->persistent_purge_list, + struct persistent_gnt, + remove_node); + list_del(&persistent_gnt->remove_node); + + gnttab_set_unmap_op(&unmap[segs_to_unmap], + vaddr(persistent_gnt->page), + GNTMAP_host_map, + persistent_gnt->handle); + + pages[segs_to_unmap] = persistent_gnt->page; + + if (++segs_to_unmap == BLKIF_MAX_SEGMENTS_PER_REQUEST) { + ret = gnttab_unmap_refs(unmap, NULL, pages, + segs_to_unmap); + BUG_ON(ret); + put_free_pages(blkif, pages, segs_to_unmap); + segs_to_unmap = 0; + } + kfree(persistent_gnt); + } + if (segs_to_unmap > 0) { + ret = gnttab_unmap_refs(unmap, NULL, pages, segs_to_unmap); + BUG_ON(ret); + put_free_pages(blkif, pages, segs_to_unmap); + } +} + +static void purge_persistent_gnt(struct xen_blkif *blkif) +{ + struct persistent_gnt *persistent_gnt; + struct rb_node *n; + unsigned int num_clean, total; + bool scan_used = false; + struct rb_root *root; + + if (blkif->persistent_gnt_c < xen_blkif_max_pgrants || + (blkif->persistent_gnt_c == xen_blkif_max_pgrants && + !blkif->vbd.overflow_max_grants)) { + return; + } + + if (work_pending(&blkif->persistent_purge_work)) { + pr_alert_ratelimited(DRV_PFX "Scheduled work from previous purge is still pending, cannot purge list\n"); + return; + } + + num_clean = (xen_blkif_max_pgrants / 100) * LRU_PERCENT_CLEAN; + num_clean = blkif->persistent_gnt_c - xen_blkif_max_pgrants + num_clean; + num_clean = min(blkif->persistent_gnt_c, num_clean); + if (num_clean > + (blkif->persistent_gnt_c - + atomic_read(&blkif->persistent_gnt_in_use))) + return; + + /* + * At this point, we can assure that there will be no calls + * to get_persistent_grant (because we are executing this code from + * xen_blkif_schedule), there can only be calls to put_persistent_gnt, + * which means that the number of currently used grants will go down, + * but never up, so we will always be able to remove the requested + * number of grants. + */ + + total = num_clean; + + pr_debug(DRV_PFX "Going to purge %u persistent grants\n", num_clean); + + INIT_LIST_HEAD(&blkif->persistent_purge_list); + root = &blkif->persistent_gnts; +purge_list: + foreach_grant_safe(persistent_gnt, n, root, node) { + BUG_ON(persistent_gnt->handle == + BLKBACK_INVALID_HANDLE); + + if (test_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags)) + continue; + if (!scan_used && + (test_bit(PERSISTENT_GNT_WAS_ACTIVE, persistent_gnt->flags))) + continue; + + rb_erase(&persistent_gnt->node, root); + list_add(&persistent_gnt->remove_node, + &blkif->persistent_purge_list); + if (--num_clean == 0) + goto finished; + } + /* + * If we get here it means we also need to start cleaning + * grants that were used since last purge in order to cope + * with the requested num + */ + if (!scan_used) { + pr_debug(DRV_PFX "Still missing %u purged frames\n", num_clean); + scan_used = true; + goto purge_list; + } +finished: + /* Remove the "used" flag from all the persistent grants */ + foreach_grant_safe(persistent_gnt, n, root, node) { + BUG_ON(persistent_gnt->handle == + BLKBACK_INVALID_HANDLE); + clear_bit(PERSISTENT_GNT_WAS_ACTIVE, persistent_gnt->flags); + } + blkif->persistent_gnt_c -= (total - num_clean); + blkif->vbd.overflow_max_grants = 0; + + /* We can defer this work */ + INIT_WORK(&blkif->persistent_purge_work, unmap_purged_grants); + schedule_work(&blkif->persistent_purge_work); + pr_debug(DRV_PFX "Purged %u/%u\n", (total - num_clean), total); + return; +} + /* * Retrieve from the 'pending_reqs' a free pending_req structure to be used. */ @@ -453,12 +614,12 @@ irqreturn_t xen_blkif_be_int(int irq, void *dev_id) static void print_stats(struct xen_blkif *blkif) { pr_info("xen-blkback (%s): oo %3llu | rd %4llu | wr %4llu | f %4llu" - " | ds %4llu | pg: %4u/%4u\n", + " | ds %4llu | pg: %4u/%4d\n", current->comm, blkif->st_oo_req, blkif->st_rd_req, blkif->st_wr_req, blkif->st_f_req, blkif->st_ds_req, blkif->persistent_gnt_c, - max_mapped_grant_pages(blkif->blk_protocol)); + xen_blkif_max_pgrants); blkif->st_print = jiffies + msecs_to_jiffies(10 * 1000); blkif->st_rd_req = 0; blkif->st_wr_req = 0; @@ -470,6 +631,7 @@ int xen_blkif_schedule(void *arg) { struct xen_blkif *blkif = arg; struct xen_vbd *vbd = &blkif->vbd; + unsigned long timeout; xen_blkif_get(blkif); @@ -479,13 +641,21 @@ int xen_blkif_schedule(void *arg) if (unlikely(vbd->size != vbd_sz(vbd))) xen_vbd_resize(blkif); - wait_event_interruptible( + timeout = msecs_to_jiffies(LRU_INTERVAL); + + timeout = wait_event_interruptible_timeout( blkif->wq, - blkif->waiting_reqs || kthread_should_stop()); - wait_event_interruptible( + blkif->waiting_reqs || kthread_should_stop(), + timeout); + if (timeout == 0) + goto purge_gnt_list; + timeout = wait_event_interruptible_timeout( blkbk->pending_free_wq, !list_empty(&blkbk->pending_free) || - kthread_should_stop()); + kthread_should_stop(), + timeout); + if (timeout == 0) + goto purge_gnt_list; blkif->waiting_reqs = 0; smp_mb(); /* clear flag *before* checking for work */ @@ -493,6 +663,13 @@ int xen_blkif_schedule(void *arg) if (do_block_io_op(blkif)) blkif->waiting_reqs = 1; +purge_gnt_list: + if (blkif->vbd.feature_gnt_persistent && + time_after(jiffies, blkif->next_lru)) { + purge_persistent_gnt(blkif); + blkif->next_lru = jiffies + msecs_to_jiffies(LRU_INTERVAL); + } + /* Shrink if we have more than xen_blkif_max_buffer_pages */ shrink_free_pagepool(blkif, xen_blkif_max_buffer_pages); @@ -538,8 +715,10 @@ static void xen_blkbk_unmap(struct pending_req *req) int ret; for (i = 0; i < req->nr_pages; i++) { - if (!test_bit(i, req->unmap_seg)) + if (req->persistent_gnts[i] != NULL) { + put_persistent_gnt(blkif, req->persistent_gnts[i]); continue; + } handle = pending_handle(req, i); pages[invcount] = req->pages[i]; if (handle == BLKBACK_INVALID_HANDLE) @@ -561,8 +740,8 @@ static int xen_blkbk_map(struct blkif_request *req, struct page *pages[]) { struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST]; - struct persistent_gnt *persistent_gnts[BLKIF_MAX_SEGMENTS_PER_REQUEST]; struct page *pages_to_gnt[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + struct persistent_gnt **persistent_gnts = pending_req->persistent_gnts; struct persistent_gnt *persistent_gnt = NULL; struct xen_blkif *blkif = pending_req->blkif; phys_addr_t addr = 0; @@ -574,9 +753,6 @@ static int xen_blkbk_map(struct blkif_request *req, use_persistent_gnts = (blkif->vbd.feature_gnt_persistent); - BUG_ON(blkif->persistent_gnt_c > - max_mapped_grant_pages(pending_req->blkif->blk_protocol)); - /* * Fill out preq.nr_sects with proper amount of sectors, and setup * assign map[..] with the PFN of the page in our domain with the @@ -587,7 +763,7 @@ static int xen_blkbk_map(struct blkif_request *req, if (use_persistent_gnts) persistent_gnt = get_persistent_gnt( - &blkif->persistent_gnts, + blkif, req->u.rw.seg[i].gref); if (persistent_gnt) { @@ -623,7 +799,6 @@ static int xen_blkbk_map(struct blkif_request *req, * so that when we access vaddr(pending_req,i) it has the contents of * the page from the other domain. */ - bitmap_zero(pending_req->unmap_seg, BLKIF_MAX_SEGMENTS_PER_REQUEST); for (seg_idx = 0, new_map_idx = 0; seg_idx < nseg; seg_idx++) { if (!persistent_gnts[seg_idx]) { /* This is a newly mapped grant */ @@ -646,11 +821,10 @@ static int xen_blkbk_map(struct blkif_request *req, goto next; } if (use_persistent_gnts && - blkif->persistent_gnt_c < - max_mapped_grant_pages(blkif->blk_protocol)) { + blkif->persistent_gnt_c < xen_blkif_max_pgrants) { /* * We are using persistent grants, the grant is - * not mapped but we have room for it + * not mapped but we might have room for it. */ persistent_gnt = kmalloc(sizeof(struct persistent_gnt), GFP_KERNEL); @@ -665,16 +839,16 @@ static int xen_blkbk_map(struct blkif_request *req, persistent_gnt->gnt = map[new_map_idx].ref; persistent_gnt->handle = map[new_map_idx].handle; persistent_gnt->page = pages[seg_idx]; - if (add_persistent_gnt(&blkif->persistent_gnts, + if (add_persistent_gnt(blkif, persistent_gnt)) { kfree(persistent_gnt); persistent_gnt = NULL; goto next_unmap; } - blkif->persistent_gnt_c++; + persistent_gnts[seg_idx] = persistent_gnt; pr_debug(DRV_PFX " grant %u added to the tree of persistent grants, using %u/%u\n", persistent_gnt->gnt, blkif->persistent_gnt_c, - max_mapped_grant_pages(blkif->blk_protocol)); + xen_blkif_max_pgrants); new_map_idx++; goto next; } @@ -688,7 +862,6 @@ next_unmap: * We could not map this grant persistently, so use it as * a non-persistent grant. */ - bitmap_set(pending_req->unmap_seg, seg_idx, 1); new_map_idx++; next: seg[seg_idx].offset = (req->u.rw.seg[seg_idx].first_sect << 9); diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 6c73c3855e65..af9bed48f773 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -182,12 +182,23 @@ struct xen_vbd { struct backend_info; +/* Number of available flags */ +#define PERSISTENT_GNT_FLAGS_SIZE 2 +/* This persistent grant is currently in use */ +#define PERSISTENT_GNT_ACTIVE 0 +/* + * This persistent grant has been used, this flag is set when we remove the + * PERSISTENT_GNT_ACTIVE, to know that this grant has been used recently. + */ +#define PERSISTENT_GNT_WAS_ACTIVE 1 struct persistent_gnt { struct page *page; grant_ref_t gnt; grant_handle_t handle; + DECLARE_BITMAP(flags, PERSISTENT_GNT_FLAGS_SIZE); struct rb_node node; + struct list_head remove_node; }; struct xen_blkif { @@ -219,6 +230,12 @@ struct xen_blkif { /* tree to store persistent grants */ struct rb_root persistent_gnts; unsigned int persistent_gnt_c; + atomic_t persistent_gnt_in_use; + unsigned long next_lru; + + /* used by the kworker that offload work from the persistent purge */ + struct list_head persistent_purge_list; + struct work_struct persistent_purge_work; /* buffer of free pages to map grant refs */ spinlock_t free_pages_lock; @@ -262,6 +279,7 @@ int xen_blkif_xenbus_init(void); irqreturn_t xen_blkif_be_int(int irq, void *dev_id); int xen_blkif_schedule(void *arg); +int xen_blkif_purge_persistent(void *arg); int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt, struct backend_info *be, int state); diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 24f7f6d87717..e0fd92a2a4cd 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -98,6 +98,7 @@ static void xen_update_blkif_status(struct xen_blkif *blkif) err = PTR_ERR(blkif->xenblkd); blkif->xenblkd = NULL; xenbus_dev_error(blkif->be->dev, err, "start xenblkd"); + return; } } @@ -121,6 +122,7 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) spin_lock_init(&blkif->free_pages_lock); INIT_LIST_HEAD(&blkif->free_pages); blkif->free_pages_num = 0; + atomic_set(&blkif->persistent_gnt_in_use, 0); return blkif; } From bb6acb289fbaac0e99eb552abdefc80a2186ef3f Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Wed, 17 Apr 2013 20:18:58 +0200 Subject: [PATCH 004/913] xen-blkback: move pending handles list from blkbk to pending_req MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moving grant ref handles from blkbk to pending_req will allow us to get rid of the shared blkbk structure. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: xen-devel@lists.xen.org Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/block/xen-blkback/blkback.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 17052f74ebe5..ae7dc92ad3cf 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -128,6 +128,7 @@ struct pending_req { struct list_head free_list; struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; struct persistent_gnt *persistent_gnts[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + grant_handle_t grant_handles[BLKIF_MAX_SEGMENTS_PER_REQUEST]; }; #define BLKBACK_INVALID_HANDLE (~0) @@ -142,8 +143,6 @@ struct xen_blkbk { /* And its spinlock. */ spinlock_t pending_free_lock; wait_queue_head_t pending_free_wq; - /* And the grant handles that are available. */ - grant_handle_t *pending_grant_handles; }; static struct xen_blkbk *blkbk; @@ -221,7 +220,7 @@ static inline void shrink_free_pagepool(struct xen_blkif *blkif, int num) #define vaddr(page) ((unsigned long)pfn_to_kaddr(page_to_pfn(page))) #define pending_handle(_req, _seg) \ - (blkbk->pending_grant_handles[vaddr_pagenr(_req, _seg)]) + (_req->grant_handles[_seg]) static int do_block_io_op(struct xen_blkif *blkif); @@ -1304,7 +1303,7 @@ static void make_response(struct xen_blkif *blkif, u64 id, static int __init xen_blkif_init(void) { - int i, mmap_pages; + int i; int rc = 0; if (!xen_domain()) @@ -1316,21 +1315,15 @@ static int __init xen_blkif_init(void) return -ENOMEM; } - mmap_pages = xen_blkif_reqs * BLKIF_MAX_SEGMENTS_PER_REQUEST; blkbk->pending_reqs = kzalloc(sizeof(blkbk->pending_reqs[0]) * xen_blkif_reqs, GFP_KERNEL); - blkbk->pending_grant_handles = kmalloc(sizeof(blkbk->pending_grant_handles[0]) * - mmap_pages, GFP_KERNEL); - if (!blkbk->pending_reqs || !blkbk->pending_grant_handles) { + if (!blkbk->pending_reqs) { rc = -ENOMEM; goto out_of_memory; } - for (i = 0; i < mmap_pages; i++) { - blkbk->pending_grant_handles[i] = BLKBACK_INVALID_HANDLE; - } rc = xen_blkif_interface_init(); if (rc) goto failed_init; @@ -1353,7 +1346,6 @@ static int __init xen_blkif_init(void) pr_alert(DRV_PFX "%s: out of memory\n", __func__); failed_init: kfree(blkbk->pending_reqs); - kfree(blkbk->pending_grant_handles); kfree(blkbk); blkbk = NULL; return rc; From bf0720c48c7cefd127ed2329e6d0e40b39fa4d0e Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Wed, 17 Apr 2013 20:18:59 +0200 Subject: [PATCH 005/913] xen-blkback: make the queue of free requests per backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the last dependency from blkbk by moving the list of free requests to blkif. This change reduces the contention on the list of available requests. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: xen-devel@lists.xen.org Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/block/xen-blkback/blkback.c | 123 ++++------------------------ drivers/block/xen-blkback/common.h | 30 +++++++ drivers/block/xen-blkback/xenbus.c | 26 ++++++ 3 files changed, 74 insertions(+), 105 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index ae7dc92ad3cf..90a57552f4b7 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -49,20 +49,6 @@ #include <xen/balloon.h> #include "common.h" -/* - * These are rather arbitrary. They are fairly large because adjacent requests - * pulled from a communication ring are quite likely to end up being part of - * the same scatter/gather request at the disc. - * - * ** TRY INCREASING 'xen_blkif_reqs' IF WRITE SPEEDS SEEM TOO LOW ** - * - * This will increase the chances of being able to write whole tracks. - * 64 should be enough to keep us competitive with Linux. - */ -static int xen_blkif_reqs = 64; -module_param_named(reqs, xen_blkif_reqs, int, 0); -MODULE_PARM_DESC(reqs, "Number of blkback requests to allocate"); - /* * Maximum number of unused free pages to keep in the internal buffer. * Setting this to a value too low will reduce memory used in each backend, @@ -112,53 +98,11 @@ MODULE_PARM_DESC(max_persistent_grants, static unsigned int log_stats; module_param(log_stats, int, 0644); -/* - * Each outstanding request that we've passed to the lower device layers has a - * 'pending_req' allocated to it. Each buffer_head that completes decrements - * the pendcnt towards zero. When it hits zero, the specified domain has a - * response queued for it, with the saved 'id' passed back. - */ -struct pending_req { - struct xen_blkif *blkif; - u64 id; - int nr_pages; - atomic_t pendcnt; - unsigned short operation; - int status; - struct list_head free_list; - struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; - struct persistent_gnt *persistent_gnts[BLKIF_MAX_SEGMENTS_PER_REQUEST]; - grant_handle_t grant_handles[BLKIF_MAX_SEGMENTS_PER_REQUEST]; -}; - #define BLKBACK_INVALID_HANDLE (~0) /* Number of free pages to remove on each call to free_xenballooned_pages */ #define NUM_BATCH_FREE_PAGES 10 -struct xen_blkbk { - struct pending_req *pending_reqs; - /* List of all 'pending_req' available */ - struct list_head pending_free; - /* And its spinlock. */ - spinlock_t pending_free_lock; - wait_queue_head_t pending_free_wq; -}; - -static struct xen_blkbk *blkbk; - -/* - * Little helpful macro to figure out the index and virtual address of the - * pending_pages[..]. For each 'pending_req' we have have up to - * BLKIF_MAX_SEGMENTS_PER_REQUEST (11) pages. The seg would be from 0 through - * 10 and would index in the pending_pages[..]. - */ -static inline int vaddr_pagenr(struct pending_req *req, int seg) -{ - return (req - blkbk->pending_reqs) * - BLKIF_MAX_SEGMENTS_PER_REQUEST + seg; -} - static inline int get_free_page(struct xen_blkif *blkif, struct page **page) { unsigned long flags; @@ -485,18 +429,18 @@ finished: /* * Retrieve from the 'pending_reqs' a free pending_req structure to be used. */ -static struct pending_req *alloc_req(void) +static struct pending_req *alloc_req(struct xen_blkif *blkif) { struct pending_req *req = NULL; unsigned long flags; - spin_lock_irqsave(&blkbk->pending_free_lock, flags); - if (!list_empty(&blkbk->pending_free)) { - req = list_entry(blkbk->pending_free.next, struct pending_req, + spin_lock_irqsave(&blkif->pending_free_lock, flags); + if (!list_empty(&blkif->pending_free)) { + req = list_entry(blkif->pending_free.next, struct pending_req, free_list); list_del(&req->free_list); } - spin_unlock_irqrestore(&blkbk->pending_free_lock, flags); + spin_unlock_irqrestore(&blkif->pending_free_lock, flags); return req; } @@ -504,17 +448,17 @@ static struct pending_req *alloc_req(void) * Return the 'pending_req' structure back to the freepool. We also * wake up the thread if it was waiting for a free page. */ -static void free_req(struct pending_req *req) +static void free_req(struct xen_blkif *blkif, struct pending_req *req) { unsigned long flags; int was_empty; - spin_lock_irqsave(&blkbk->pending_free_lock, flags); - was_empty = list_empty(&blkbk->pending_free); - list_add(&req->free_list, &blkbk->pending_free); - spin_unlock_irqrestore(&blkbk->pending_free_lock, flags); + spin_lock_irqsave(&blkif->pending_free_lock, flags); + was_empty = list_empty(&blkif->pending_free); + list_add(&req->free_list, &blkif->pending_free); + spin_unlock_irqrestore(&blkif->pending_free_lock, flags); if (was_empty) - wake_up(&blkbk->pending_free_wq); + wake_up(&blkif->pending_free_wq); } /* @@ -649,8 +593,8 @@ int xen_blkif_schedule(void *arg) if (timeout == 0) goto purge_gnt_list; timeout = wait_event_interruptible_timeout( - blkbk->pending_free_wq, - !list_empty(&blkbk->pending_free) || + blkif->pending_free_wq, + !list_empty(&blkif->pending_free) || kthread_should_stop(), timeout); if (timeout == 0) @@ -907,7 +851,7 @@ static int dispatch_other_io(struct xen_blkif *blkif, struct blkif_request *req, struct pending_req *pending_req) { - free_req(pending_req); + free_req(blkif, pending_req); make_response(blkif, req->u.other.id, req->operation, BLKIF_RSP_EOPNOTSUPP); return -EIO; @@ -967,7 +911,7 @@ static void __end_block_io_op(struct pending_req *pending_req, int error) if (atomic_read(&pending_req->blkif->drain)) complete(&pending_req->blkif->drain_complete); } - free_req(pending_req); + free_req(pending_req->blkif, pending_req); } } @@ -1010,7 +954,7 @@ __do_block_io_op(struct xen_blkif *blkif) break; } - pending_req = alloc_req(); + pending_req = alloc_req(blkif); if (NULL == pending_req) { blkif->st_oo_req++; more_to_do = 1; @@ -1044,7 +988,7 @@ __do_block_io_op(struct xen_blkif *blkif) goto done; break; case BLKIF_OP_DISCARD: - free_req(pending_req); + free_req(blkif, pending_req); if (dispatch_discard_io(blkif, &req)) goto done; break; @@ -1246,7 +1190,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, fail_response: /* Haven't submitted any bio's yet. */ make_response(blkif, req->u.rw.id, req->operation, BLKIF_RSP_ERROR); - free_req(pending_req); + free_req(blkif, pending_req); msleep(1); /* back off a bit */ return -EIO; @@ -1303,51 +1247,20 @@ static void make_response(struct xen_blkif *blkif, u64 id, static int __init xen_blkif_init(void) { - int i; int rc = 0; if (!xen_domain()) return -ENODEV; - blkbk = kzalloc(sizeof(struct xen_blkbk), GFP_KERNEL); - if (!blkbk) { - pr_alert(DRV_PFX "%s: out of memory!\n", __func__); - return -ENOMEM; - } - - - blkbk->pending_reqs = kzalloc(sizeof(blkbk->pending_reqs[0]) * - xen_blkif_reqs, GFP_KERNEL); - - if (!blkbk->pending_reqs) { - rc = -ENOMEM; - goto out_of_memory; - } - rc = xen_blkif_interface_init(); if (rc) goto failed_init; - INIT_LIST_HEAD(&blkbk->pending_free); - spin_lock_init(&blkbk->pending_free_lock); - init_waitqueue_head(&blkbk->pending_free_wq); - - for (i = 0; i < xen_blkif_reqs; i++) - list_add_tail(&blkbk->pending_reqs[i].free_list, - &blkbk->pending_free); - rc = xen_blkif_xenbus_init(); if (rc) goto failed_init; - return 0; - - out_of_memory: - pr_alert(DRV_PFX "%s: out of memory\n", __func__); failed_init: - kfree(blkbk->pending_reqs); - kfree(blkbk); - blkbk = NULL; return rc; } diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index af9bed48f773..e33fafa0facd 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -192,6 +192,9 @@ struct backend_info; */ #define PERSISTENT_GNT_WAS_ACTIVE 1 +/* Number of requests that we can fit in a ring */ +#define XEN_BLKIF_REQS 32 + struct persistent_gnt { struct page *page; grant_ref_t gnt; @@ -242,6 +245,14 @@ struct xen_blkif { int free_pages_num; struct list_head free_pages; + /* Allocation of pending_reqs */ + struct pending_req *pending_reqs; + /* List of all 'pending_req' available */ + struct list_head pending_free; + /* And its spinlock. */ + spinlock_t pending_free_lock; + wait_queue_head_t pending_free_wq; + /* statistics */ unsigned long st_print; unsigned long long st_rd_req; @@ -255,6 +266,25 @@ struct xen_blkif { wait_queue_head_t waiting_to_free; }; +/* + * Each outstanding request that we've passed to the lower device layers has a + * 'pending_req' allocated to it. Each buffer_head that completes decrements + * the pendcnt towards zero. When it hits zero, the specified domain has a + * response queued for it, with the saved 'id' passed back. + */ +struct pending_req { + struct xen_blkif *blkif; + u64 id; + int nr_pages; + atomic_t pendcnt; + unsigned short operation; + int status; + struct list_head free_list; + struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + struct persistent_gnt *persistent_gnts[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + grant_handle_t grant_handles[BLKIF_MAX_SEGMENTS_PER_REQUEST]; +}; + #define vbd_sz(_v) ((_v)->bdev->bd_part ? \ (_v)->bdev->bd_part->nr_sects : \ diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index e0fd92a2a4cd..1f1ade6d6e09 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -105,6 +105,7 @@ static void xen_update_blkif_status(struct xen_blkif *blkif) static struct xen_blkif *xen_blkif_alloc(domid_t domid) { struct xen_blkif *blkif; + int i; blkif = kmem_cache_zalloc(xen_blkif_cachep, GFP_KERNEL); if (!blkif) @@ -124,6 +125,21 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) blkif->free_pages_num = 0; atomic_set(&blkif->persistent_gnt_in_use, 0); + blkif->pending_reqs = kcalloc(XEN_BLKIF_REQS, + sizeof(blkif->pending_reqs[0]), + GFP_KERNEL); + if (!blkif->pending_reqs) { + kmem_cache_free(xen_blkif_cachep, blkif); + return ERR_PTR(-ENOMEM); + } + INIT_LIST_HEAD(&blkif->pending_free); + spin_lock_init(&blkif->pending_free_lock); + init_waitqueue_head(&blkif->pending_free_wq); + + for (i = 0; i < XEN_BLKIF_REQS; i++) + list_add_tail(&blkif->pending_reqs[i].free_list, + &blkif->pending_free); + return blkif; } @@ -203,8 +219,18 @@ static void xen_blkif_disconnect(struct xen_blkif *blkif) static void xen_blkif_free(struct xen_blkif *blkif) { + struct pending_req *req; + int i = 0; + if (!atomic_dec_and_test(&blkif->refcnt)) BUG(); + + /* Check that there is no request in use */ + list_for_each_entry(req, &blkif->pending_free, free_list) + i++; + BUG_ON(i != XEN_BLKIF_REQS); + + kfree(blkif->pending_reqs); kmem_cache_free(xen_blkif_cachep, blkif); } From 31552ee32df89f97a61766cee51b8dabb1ae3f4f Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Wed, 17 Apr 2013 20:19:00 +0200 Subject: [PATCH 006/913] xen-blkback: expand map/unmap functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Preparatory change for implementing indirect descriptors. Change xen_blkbk_{map/unmap} in order to be able to map/unmap a random amount of grants (previously it was limited to BLKIF_MAX_SEGMENTS_PER_REQUEST). Also, remove the usage of pending_req in the map/unmap functions, so we can map/unmap grants without needing to pass a pending_req. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: xen-devel@lists.xen.org Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/block/xen-blkback/blkback.c | 141 +++++++++++++++++----------- 1 file changed, 86 insertions(+), 55 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 90a57552f4b7..356722f65f88 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -163,10 +163,6 @@ static inline void shrink_free_pagepool(struct xen_blkif *blkif, int num) #define vaddr(page) ((unsigned long)pfn_to_kaddr(page_to_pfn(page))) -#define pending_handle(_req, _seg) \ - (_req->grant_handles[_seg]) - - static int do_block_io_op(struct xen_blkif *blkif); static int dispatch_rw_block_io(struct xen_blkif *blkif, struct blkif_request *req, @@ -648,50 +644,57 @@ struct seg_buf { * Unmap the grant references, and also remove the M2P over-rides * used in the 'pending_req'. */ -static void xen_blkbk_unmap(struct pending_req *req) +static void xen_blkbk_unmap(struct xen_blkif *blkif, + grant_handle_t handles[], + struct page *pages[], + struct persistent_gnt *persistent_gnts[], + int num) { struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; - struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + struct page *unmap_pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; unsigned int i, invcount = 0; - grant_handle_t handle; - struct xen_blkif *blkif = req->blkif; int ret; - for (i = 0; i < req->nr_pages; i++) { - if (req->persistent_gnts[i] != NULL) { - put_persistent_gnt(blkif, req->persistent_gnts[i]); + for (i = 0; i < num; i++) { + if (persistent_gnts[i] != NULL) { + put_persistent_gnt(blkif, persistent_gnts[i]); continue; } - handle = pending_handle(req, i); - pages[invcount] = req->pages[i]; - if (handle == BLKBACK_INVALID_HANDLE) + if (handles[i] == BLKBACK_INVALID_HANDLE) continue; - gnttab_set_unmap_op(&unmap[invcount], vaddr(pages[invcount]), - GNTMAP_host_map, handle); - pending_handle(req, i) = BLKBACK_INVALID_HANDLE; - invcount++; + unmap_pages[invcount] = pages[i]; + gnttab_set_unmap_op(&unmap[invcount], vaddr(pages[i]), + GNTMAP_host_map, handles[i]); + handles[i] = BLKBACK_INVALID_HANDLE; + if (++invcount == BLKIF_MAX_SEGMENTS_PER_REQUEST) { + ret = gnttab_unmap_refs(unmap, NULL, unmap_pages, + invcount); + BUG_ON(ret); + put_free_pages(blkif, unmap_pages, invcount); + invcount = 0; + } + } + if (invcount) { + ret = gnttab_unmap_refs(unmap, NULL, unmap_pages, invcount); + BUG_ON(ret); + put_free_pages(blkif, unmap_pages, invcount); } - - ret = gnttab_unmap_refs(unmap, NULL, pages, invcount); - BUG_ON(ret); - put_free_pages(blkif, pages, invcount); } -static int xen_blkbk_map(struct blkif_request *req, - struct pending_req *pending_req, - struct seg_buf seg[], - struct page *pages[]) +static int xen_blkbk_map(struct xen_blkif *blkif, grant_ref_t grefs[], + struct persistent_gnt *persistent_gnts[], + grant_handle_t handles[], + struct page *pages[], + int num, bool ro) { struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST]; struct page *pages_to_gnt[BLKIF_MAX_SEGMENTS_PER_REQUEST]; - struct persistent_gnt **persistent_gnts = pending_req->persistent_gnts; struct persistent_gnt *persistent_gnt = NULL; - struct xen_blkif *blkif = pending_req->blkif; phys_addr_t addr = 0; int i, seg_idx, new_map_idx; - int nseg = req->u.rw.nr_segments; int segs_to_map = 0; int ret = 0; + int last_map = 0, map_until = 0; int use_persistent_gnts; use_persistent_gnts = (blkif->vbd.feature_gnt_persistent); @@ -701,13 +704,14 @@ static int xen_blkbk_map(struct blkif_request *req, * assign map[..] with the PFN of the page in our domain with the * corresponding grant reference for each page. */ - for (i = 0; i < nseg; i++) { +again: + for (i = map_until; i < num; i++) { uint32_t flags; if (use_persistent_gnts) persistent_gnt = get_persistent_gnt( blkif, - req->u.rw.seg[i].gref); + grefs[i]); if (persistent_gnt) { /* @@ -723,13 +727,15 @@ static int xen_blkbk_map(struct blkif_request *req, pages_to_gnt[segs_to_map] = pages[i]; persistent_gnts[i] = NULL; flags = GNTMAP_host_map; - if (!use_persistent_gnts && - (pending_req->operation != BLKIF_OP_READ)) + if (!use_persistent_gnts && ro) flags |= GNTMAP_readonly; gnttab_set_map_op(&map[segs_to_map++], addr, - flags, req->u.rw.seg[i].gref, + flags, grefs[i], blkif->domid); } + map_until = i + 1; + if (segs_to_map == BLKIF_MAX_SEGMENTS_PER_REQUEST) + break; } if (segs_to_map) { @@ -742,26 +748,19 @@ static int xen_blkbk_map(struct blkif_request *req, * so that when we access vaddr(pending_req,i) it has the contents of * the page from the other domain. */ - for (seg_idx = 0, new_map_idx = 0; seg_idx < nseg; seg_idx++) { + for (seg_idx = last_map, new_map_idx = 0; seg_idx < map_until; seg_idx++) { if (!persistent_gnts[seg_idx]) { /* This is a newly mapped grant */ BUG_ON(new_map_idx >= segs_to_map); if (unlikely(map[new_map_idx].status != 0)) { pr_debug(DRV_PFX "invalid buffer -- could not remap it\n"); - pending_handle(pending_req, seg_idx) = BLKBACK_INVALID_HANDLE; + handles[seg_idx] = BLKBACK_INVALID_HANDLE; ret |= 1; - new_map_idx++; - /* - * No need to set unmap_seg bit, since - * we can not unmap this grant because - * the handle is invalid. - */ - continue; + goto next; } - pending_handle(pending_req, seg_idx) = map[new_map_idx].handle; + handles[seg_idx] = map[new_map_idx].handle; } else { - /* This grant is persistent and already mapped */ - goto next; + continue; } if (use_persistent_gnts && blkif->persistent_gnt_c < xen_blkif_max_pgrants) { @@ -777,7 +776,7 @@ static int xen_blkbk_map(struct blkif_request *req, * allocate the persistent_gnt struct * map this grant non-persistenly */ - goto next_unmap; + goto next; } persistent_gnt->gnt = map[new_map_idx].ref; persistent_gnt->handle = map[new_map_idx].handle; @@ -786,13 +785,12 @@ static int xen_blkbk_map(struct blkif_request *req, persistent_gnt)) { kfree(persistent_gnt); persistent_gnt = NULL; - goto next_unmap; + goto next; } persistent_gnts[seg_idx] = persistent_gnt; pr_debug(DRV_PFX " grant %u added to the tree of persistent grants, using %u/%u\n", persistent_gnt->gnt, blkif->persistent_gnt_c, xen_blkif_max_pgrants); - new_map_idx++; goto next; } if (use_persistent_gnts && !blkif->vbd.overflow_max_grants) { @@ -800,15 +798,18 @@ static int xen_blkbk_map(struct blkif_request *req, pr_debug(DRV_PFX " domain %u, device %#x is using maximum number of persistent grants\n", blkif->domid, blkif->vbd.handle); } -next_unmap: /* * We could not map this grant persistently, so use it as * a non-persistent grant. */ - new_map_idx++; next: - seg[seg_idx].offset = (req->u.rw.seg[seg_idx].first_sect << 9); + new_map_idx++; } + segs_to_map = 0; + last_map = map_until; + if (map_until != num) + goto again; + return ret; out_of_memory: @@ -817,6 +818,31 @@ out_of_memory: return -ENOMEM; } +static int xen_blkbk_map_seg(struct blkif_request *req, + struct pending_req *pending_req, + struct seg_buf seg[], + struct page *pages[]) +{ + int i, rc; + grant_ref_t grefs[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + + for (i = 0; i < req->u.rw.nr_segments; i++) + grefs[i] = req->u.rw.seg[i].gref; + + rc = xen_blkbk_map(pending_req->blkif, grefs, + pending_req->persistent_gnts, + pending_req->grant_handles, pending_req->pages, + req->u.rw.nr_segments, + (pending_req->operation != BLKIF_OP_READ)); + if (rc) + return rc; + + for (i = 0; i < req->u.rw.nr_segments; i++) + seg[i].offset = (req->u.rw.seg[i].first_sect << 9); + + return 0; +} + static int dispatch_discard_io(struct xen_blkif *blkif, struct blkif_request *req) { @@ -903,7 +929,10 @@ static void __end_block_io_op(struct pending_req *pending_req, int error) * the proper response on the ring. */ if (atomic_dec_and_test(&pending_req->pendcnt)) { - xen_blkbk_unmap(pending_req); + xen_blkbk_unmap(pending_req->blkif, pending_req->grant_handles, + pending_req->pages, + pending_req->persistent_gnts, + pending_req->nr_pages); make_response(pending_req->blkif, pending_req->id, pending_req->operation, pending_req->status); xen_blkif_put(pending_req->blkif); @@ -1125,7 +1154,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, * the hypercall to unmap the grants - that is all done in * xen_blkbk_unmap. */ - if (xen_blkbk_map(req, pending_req, seg, pages)) + if (xen_blkbk_map_seg(req, pending_req, seg, pages)) goto fail_flush; /* @@ -1186,7 +1215,9 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, return 0; fail_flush: - xen_blkbk_unmap(pending_req); + xen_blkbk_unmap(blkif, pending_req->grant_handles, + pending_req->pages, pending_req->persistent_gnts, + pending_req->nr_pages); fail_response: /* Haven't submitted any bio's yet. */ make_response(blkif, req->u.rw.id, req->operation, BLKIF_RSP_ERROR); From 402b27f9f2c22309d5bb285628765bc27b82fcf5 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Thu, 18 Apr 2013 16:06:54 +0200 Subject: [PATCH 007/913] xen-block: implement indirect descriptors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Indirect descriptors introduce a new block operation (BLKIF_OP_INDIRECT) that passes grant references instead of segments in the request. This grant references are filled with arrays of blkif_request_segment_aligned, this way we can send more segments in a request. The proposed implementation sets the maximum number of indirect grefs (frames filled with blkif_request_segment_aligned) to 256 in the backend and 32 in the frontend. The value in the frontend has been chosen experimentally, and the backend value has been set to a sane value that allows expanding the maximum number of indirect descriptors in the frontend if needed. The migration code has changed from the previous implementation, in which we simply remapped the segments on the shared ring. Now the maximum number of segments allowed in a request can change depending on the backend, so we have to requeue all the requests in the ring and in the queue and split the bios in them if they are bigger than the new maximum number of segments. [v2: Fixed minor comments by Konrad. [v1: Added padding to make the indirect request 64bit aligned. Added some BUGs, comments; fixed number of indirect pages in blkif_get_x86_{32/64}_req. Added description about the indirect operation in blkif.h] Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> [v3: Fixed spaces and tabs mix ups] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/block/xen-blkback/blkback.c | 132 ++++++-- drivers/block/xen-blkback/common.h | 98 +++++- drivers/block/xen-blkback/xenbus.c | 7 + drivers/block/xen-blkfront.c | 490 +++++++++++++++++++++++----- include/xen/interface/io/blkif.h | 53 +++ 5 files changed, 656 insertions(+), 124 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 356722f65f88..1ebc0aa0f0e4 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -59,7 +59,7 @@ * IO workloads. */ -static int xen_blkif_max_buffer_pages = 704; +static int xen_blkif_max_buffer_pages = 1024; module_param_named(max_buffer_pages, xen_blkif_max_buffer_pages, int, 0644); MODULE_PARM_DESC(max_buffer_pages, "Maximum number of free pages to keep in each block backend buffer"); @@ -75,7 +75,7 @@ MODULE_PARM_DESC(max_buffer_pages, * algorithm. */ -static int xen_blkif_max_pgrants = 352; +static int xen_blkif_max_pgrants = 1056; module_param_named(max_persistent_grants, xen_blkif_max_pgrants, int, 0644); MODULE_PARM_DESC(max_persistent_grants, "Maximum number of grants to map persistently"); @@ -636,10 +636,6 @@ purge_gnt_list: return 0; } -struct seg_buf { - unsigned int offset; - unsigned int nsec; -}; /* * Unmap the grant references, and also remove the M2P over-rides * used in the 'pending_req'. @@ -818,29 +814,69 @@ out_of_memory: return -ENOMEM; } -static int xen_blkbk_map_seg(struct blkif_request *req, - struct pending_req *pending_req, +static int xen_blkbk_map_seg(struct pending_req *pending_req, struct seg_buf seg[], struct page *pages[]) { - int i, rc; - grant_ref_t grefs[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + int rc; - for (i = 0; i < req->u.rw.nr_segments; i++) - grefs[i] = req->u.rw.seg[i].gref; - - rc = xen_blkbk_map(pending_req->blkif, grefs, + rc = xen_blkbk_map(pending_req->blkif, pending_req->grefs, pending_req->persistent_gnts, pending_req->grant_handles, pending_req->pages, - req->u.rw.nr_segments, + pending_req->nr_pages, (pending_req->operation != BLKIF_OP_READ)); + + return rc; +} + +static int xen_blkbk_parse_indirect(struct blkif_request *req, + struct pending_req *pending_req, + struct seg_buf seg[], + struct phys_req *preq) +{ + struct persistent_gnt **persistent = + pending_req->indirect_persistent_gnts; + struct page **pages = pending_req->indirect_pages; + struct xen_blkif *blkif = pending_req->blkif; + int indirect_grefs, rc, n, nseg, i; + struct blkif_request_segment_aligned *segments = NULL; + + nseg = pending_req->nr_pages; + indirect_grefs = INDIRECT_PAGES(nseg); + BUG_ON(indirect_grefs > BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST); + + rc = xen_blkbk_map(blkif, req->u.indirect.indirect_grefs, + persistent, pending_req->indirect_handles, + pages, indirect_grefs, true); if (rc) - return rc; + goto unmap; - for (i = 0; i < req->u.rw.nr_segments; i++) - seg[i].offset = (req->u.rw.seg[i].first_sect << 9); + for (n = 0, i = 0; n < nseg; n++) { + if ((n % SEGS_PER_INDIRECT_FRAME) == 0) { + /* Map indirect segments */ + if (segments) + kunmap_atomic(segments); + segments = kmap_atomic(pages[n/SEGS_PER_INDIRECT_FRAME]); + } + i = n % SEGS_PER_INDIRECT_FRAME; + pending_req->grefs[n] = segments[i].gref; + seg[n].nsec = segments[i].last_sect - + segments[i].first_sect + 1; + seg[n].offset = (segments[i].first_sect << 9); + if ((segments[i].last_sect >= (PAGE_SIZE >> 9)) || + (segments[i].last_sect < segments[i].first_sect)) { + rc = -EINVAL; + goto unmap; + } + preq->nr_sects += seg[n].nsec; + } - return 0; +unmap: + if (segments) + kunmap_atomic(segments); + xen_blkbk_unmap(blkif, pending_req->indirect_handles, + pages, persistent, indirect_grefs); + return rc; } static int dispatch_discard_io(struct xen_blkif *blkif, @@ -1013,6 +1049,7 @@ __do_block_io_op(struct xen_blkif *blkif) case BLKIF_OP_WRITE: case BLKIF_OP_WRITE_BARRIER: case BLKIF_OP_FLUSH_DISKCACHE: + case BLKIF_OP_INDIRECT: if (dispatch_rw_block_io(blkif, &req, pending_req)) goto done; break; @@ -1059,17 +1096,28 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, struct pending_req *pending_req) { struct phys_req preq; - struct seg_buf seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + struct seg_buf *seg = pending_req->seg; unsigned int nseg; struct bio *bio = NULL; - struct bio *biolist[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + struct bio **biolist = pending_req->biolist; int i, nbio = 0; int operation; struct blk_plug plug; bool drain = false; struct page **pages = pending_req->pages; + unsigned short req_operation; - switch (req->operation) { + req_operation = req->operation == BLKIF_OP_INDIRECT ? + req->u.indirect.indirect_op : req->operation; + if ((req->operation == BLKIF_OP_INDIRECT) && + (req_operation != BLKIF_OP_READ) && + (req_operation != BLKIF_OP_WRITE)) { + pr_debug(DRV_PFX "Invalid indirect operation (%u)\n", + req_operation); + goto fail_response; + } + + switch (req_operation) { case BLKIF_OP_READ: blkif->st_rd_req++; operation = READ; @@ -1091,33 +1139,47 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, } /* Check that the number of segments is sane. */ - nseg = req->u.rw.nr_segments; + nseg = req->operation == BLKIF_OP_INDIRECT ? + req->u.indirect.nr_segments : req->u.rw.nr_segments; if (unlikely(nseg == 0 && operation != WRITE_FLUSH) || - unlikely(nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST)) { + unlikely((req->operation != BLKIF_OP_INDIRECT) && + (nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST)) || + unlikely((req->operation == BLKIF_OP_INDIRECT) && + (nseg > MAX_INDIRECT_SEGMENTS))) { pr_debug(DRV_PFX "Bad number of segments in request (%d)\n", nseg); /* Haven't submitted any bio's yet. */ goto fail_response; } - preq.sector_number = req->u.rw.sector_number; preq.nr_sects = 0; pending_req->blkif = blkif; pending_req->id = req->u.rw.id; - pending_req->operation = req->operation; + pending_req->operation = req_operation; pending_req->status = BLKIF_RSP_OKAY; pending_req->nr_pages = nseg; - for (i = 0; i < nseg; i++) { - seg[i].nsec = req->u.rw.seg[i].last_sect - - req->u.rw.seg[i].first_sect + 1; - if ((req->u.rw.seg[i].last_sect >= (PAGE_SIZE >> 9)) || - (req->u.rw.seg[i].last_sect < req->u.rw.seg[i].first_sect)) + if (req->operation != BLKIF_OP_INDIRECT) { + preq.dev = req->u.rw.handle; + preq.sector_number = req->u.rw.sector_number; + for (i = 0; i < nseg; i++) { + pending_req->grefs[i] = req->u.rw.seg[i].gref; + seg[i].nsec = req->u.rw.seg[i].last_sect - + req->u.rw.seg[i].first_sect + 1; + seg[i].offset = (req->u.rw.seg[i].first_sect << 9); + if ((req->u.rw.seg[i].last_sect >= (PAGE_SIZE >> 9)) || + (req->u.rw.seg[i].last_sect < + req->u.rw.seg[i].first_sect)) + goto fail_response; + preq.nr_sects += seg[i].nsec; + } + } else { + preq.dev = req->u.indirect.handle; + preq.sector_number = req->u.indirect.sector_number; + if (xen_blkbk_parse_indirect(req, pending_req, seg, &preq)) goto fail_response; - preq.nr_sects += seg[i].nsec; - } if (xen_vbd_translate(&preq, blkif, operation) != 0) { @@ -1154,7 +1216,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, * the hypercall to unmap the grants - that is all done in * xen_blkbk_unmap. */ - if (xen_blkbk_map_seg(req, pending_req, seg, pages)) + if (xen_blkbk_map_seg(pending_req, seg, pages)) goto fail_flush; /* @@ -1220,7 +1282,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, pending_req->nr_pages); fail_response: /* Haven't submitted any bio's yet. */ - make_response(blkif, req->u.rw.id, req->operation, BLKIF_RSP_ERROR); + make_response(blkif, req->u.rw.id, req_operation, BLKIF_RSP_ERROR); free_req(blkif, pending_req); msleep(1); /* back off a bit */ return -EIO; diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index e33fafa0facd..1ac53da8410f 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -50,6 +50,19 @@ __func__, __LINE__, ##args) +/* + * This is the maximum number of segments that would be allowed in indirect + * requests. This value will also be passed to the frontend. + */ +#define MAX_INDIRECT_SEGMENTS 256 + +#define SEGS_PER_INDIRECT_FRAME \ + (PAGE_SIZE/sizeof(struct blkif_request_segment_aligned)) +#define MAX_INDIRECT_PAGES \ + ((MAX_INDIRECT_SEGMENTS + SEGS_PER_INDIRECT_FRAME - 1)/SEGS_PER_INDIRECT_FRAME) +#define INDIRECT_PAGES(_segs) \ + ((_segs + SEGS_PER_INDIRECT_FRAME - 1)/SEGS_PER_INDIRECT_FRAME) + /* Not a real protocol. Used to generate ring structs which contain * the elements common to all protocols only. This way we get a * compiler-checkable way to use common struct elements, so we can @@ -83,12 +96,31 @@ struct blkif_x86_32_request_other { uint64_t id; /* private guest value, echoed in resp */ } __attribute__((__packed__)); +struct blkif_x86_32_request_indirect { + uint8_t indirect_op; + uint16_t nr_segments; + uint64_t id; + blkif_sector_t sector_number; + blkif_vdev_t handle; + uint16_t _pad1; + grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST]; + /* + * The maximum number of indirect segments (and pages) that will + * be used is determined by MAX_INDIRECT_SEGMENTS, this value + * is also exported to the guest (via xenstore + * feature-max-indirect-segments entry), so the frontend knows how + * many indirect segments the backend supports. + */ + uint64_t _pad2; /* make it 64 byte aligned */ +} __attribute__((__packed__)); + struct blkif_x86_32_request { uint8_t operation; /* BLKIF_OP_??? */ union { struct blkif_x86_32_request_rw rw; struct blkif_x86_32_request_discard discard; struct blkif_x86_32_request_other other; + struct blkif_x86_32_request_indirect indirect; } u; } __attribute__((__packed__)); @@ -127,12 +159,32 @@ struct blkif_x86_64_request_other { uint64_t id; /* private guest value, echoed in resp */ } __attribute__((__packed__)); +struct blkif_x86_64_request_indirect { + uint8_t indirect_op; + uint16_t nr_segments; + uint32_t _pad1; /* offsetof(blkif_..,u.indirect.id)==8 */ + uint64_t id; + blkif_sector_t sector_number; + blkif_vdev_t handle; + uint16_t _pad2; + grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST]; + /* + * The maximum number of indirect segments (and pages) that will + * be used is determined by MAX_INDIRECT_SEGMENTS, this value + * is also exported to the guest (via xenstore + * feature-max-indirect-segments entry), so the frontend knows how + * many indirect segments the backend supports. + */ + uint32_t _pad3; /* make it 64 byte aligned */ +} __attribute__((__packed__)); + struct blkif_x86_64_request { uint8_t operation; /* BLKIF_OP_??? */ union { struct blkif_x86_64_request_rw rw; struct blkif_x86_64_request_discard discard; struct blkif_x86_64_request_other other; + struct blkif_x86_64_request_indirect indirect; } u; } __attribute__((__packed__)); @@ -266,6 +318,11 @@ struct xen_blkif { wait_queue_head_t waiting_to_free; }; +struct seg_buf { + unsigned long offset; + unsigned int nsec; +}; + /* * Each outstanding request that we've passed to the lower device layers has a * 'pending_req' allocated to it. Each buffer_head that completes decrements @@ -280,9 +337,16 @@ struct pending_req { unsigned short operation; int status; struct list_head free_list; - struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; - struct persistent_gnt *persistent_gnts[BLKIF_MAX_SEGMENTS_PER_REQUEST]; - grant_handle_t grant_handles[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + struct page *pages[MAX_INDIRECT_SEGMENTS]; + struct persistent_gnt *persistent_gnts[MAX_INDIRECT_SEGMENTS]; + grant_handle_t grant_handles[MAX_INDIRECT_SEGMENTS]; + grant_ref_t grefs[MAX_INDIRECT_SEGMENTS]; + /* Indirect descriptors */ + struct persistent_gnt *indirect_persistent_gnts[MAX_INDIRECT_PAGES]; + struct page *indirect_pages[MAX_INDIRECT_PAGES]; + grant_handle_t indirect_handles[MAX_INDIRECT_PAGES]; + struct seg_buf seg[MAX_INDIRECT_SEGMENTS]; + struct bio *biolist[MAX_INDIRECT_SEGMENTS]; }; @@ -321,7 +385,7 @@ struct xenbus_device *xen_blkbk_xenbus(struct backend_info *be); static inline void blkif_get_x86_32_req(struct blkif_request *dst, struct blkif_x86_32_request *src) { - int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST; + int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST, j; dst->operation = src->operation; switch (src->operation) { case BLKIF_OP_READ: @@ -344,6 +408,18 @@ static inline void blkif_get_x86_32_req(struct blkif_request *dst, dst->u.discard.sector_number = src->u.discard.sector_number; dst->u.discard.nr_sectors = src->u.discard.nr_sectors; break; + case BLKIF_OP_INDIRECT: + dst->u.indirect.indirect_op = src->u.indirect.indirect_op; + dst->u.indirect.nr_segments = src->u.indirect.nr_segments; + dst->u.indirect.handle = src->u.indirect.handle; + dst->u.indirect.id = src->u.indirect.id; + dst->u.indirect.sector_number = src->u.indirect.sector_number; + barrier(); + j = min(MAX_INDIRECT_PAGES, INDIRECT_PAGES(dst->u.indirect.nr_segments)); + for (i = 0; i < j; i++) + dst->u.indirect.indirect_grefs[i] = + src->u.indirect.indirect_grefs[i]; + break; default: /* * Don't know how to translate this op. Only get the @@ -357,7 +433,7 @@ static inline void blkif_get_x86_32_req(struct blkif_request *dst, static inline void blkif_get_x86_64_req(struct blkif_request *dst, struct blkif_x86_64_request *src) { - int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST; + int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST, j; dst->operation = src->operation; switch (src->operation) { case BLKIF_OP_READ: @@ -380,6 +456,18 @@ static inline void blkif_get_x86_64_req(struct blkif_request *dst, dst->u.discard.sector_number = src->u.discard.sector_number; dst->u.discard.nr_sectors = src->u.discard.nr_sectors; break; + case BLKIF_OP_INDIRECT: + dst->u.indirect.indirect_op = src->u.indirect.indirect_op; + dst->u.indirect.nr_segments = src->u.indirect.nr_segments; + dst->u.indirect.handle = src->u.indirect.handle; + dst->u.indirect.id = src->u.indirect.id; + dst->u.indirect.sector_number = src->u.indirect.sector_number; + barrier(); + j = min(MAX_INDIRECT_PAGES, INDIRECT_PAGES(dst->u.indirect.nr_segments)); + for (i = 0; i < j; i++) + dst->u.indirect.indirect_grefs[i] = + src->u.indirect.indirect_grefs[i]; + break; default: /* * Don't know how to translate this op. Only get the diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 1f1ade6d6e09..afab208c54e3 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -107,6 +107,8 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) struct xen_blkif *blkif; int i; + BUILD_BUG_ON(MAX_INDIRECT_PAGES > BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST); + blkif = kmem_cache_zalloc(xen_blkif_cachep, GFP_KERNEL); if (!blkif) return ERR_PTR(-ENOMEM); @@ -709,6 +711,11 @@ again: dev->nodename); goto abort; } + err = xenbus_printf(xbt, dev->nodename, "feature-max-indirect-segments", "%u", + MAX_INDIRECT_SEGMENTS); + if (err) + dev_warn(&dev->dev, "writing %s/feature-max-indirect-segments (%d)", + dev->nodename, err); err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu", (unsigned long long)vbd_sz(&be->blkif->vbd)); diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index a894f88762d8..82d63d5b1750 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -74,12 +74,27 @@ struct grant { struct blk_shadow { struct blkif_request req; struct request *request; - struct grant *grants_used[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + struct grant **grants_used; + struct grant **indirect_grants; +}; + +struct split_bio { + struct bio *bio; + atomic_t pending; + int err; }; static DEFINE_MUTEX(blkfront_mutex); static const struct block_device_operations xlvbd_block_fops; +/* + * Maximum number of segments in indirect requests, the actual value used by + * the frontend driver is the minimum of this value and the value provided + * by the backend driver. + */ + +static unsigned int xen_blkif_max_segments = 32; + #define BLK_RING_SIZE __CONST_RING_SIZE(blkif, PAGE_SIZE) /* @@ -98,7 +113,7 @@ struct blkfront_info enum blkif_state connected; int ring_ref; struct blkif_front_ring ring; - struct scatterlist sg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; + struct scatterlist *sg; unsigned int evtchn, irq; struct request_queue *rq; struct work_struct work; @@ -114,6 +129,7 @@ struct blkfront_info unsigned int discard_granularity; unsigned int discard_alignment; unsigned int feature_persistent:1; + unsigned int max_indirect_segments; int is_ready; }; @@ -142,6 +158,13 @@ static DEFINE_SPINLOCK(minor_lock); #define DEV_NAME "xvd" /* name in /dev */ +#define SEGS_PER_INDIRECT_FRAME \ + (PAGE_SIZE/sizeof(struct blkif_request_segment_aligned)) +#define INDIRECT_GREFS(_segs) \ + ((_segs + SEGS_PER_INDIRECT_FRAME - 1)/SEGS_PER_INDIRECT_FRAME) + +static int blkfront_setup_indirect(struct blkfront_info *info); + static int get_id_from_freelist(struct blkfront_info *info) { unsigned long free = info->shadow_free; @@ -358,7 +381,8 @@ static int blkif_queue_request(struct request *req) struct blkif_request *ring_req; unsigned long id; unsigned int fsect, lsect; - int i, ref; + int i, ref, n; + struct blkif_request_segment_aligned *segments = NULL; /* * Used to store if we are able to queue the request by just using @@ -369,21 +393,27 @@ static int blkif_queue_request(struct request *req) grant_ref_t gref_head; struct grant *gnt_list_entry = NULL; struct scatterlist *sg; + int nseg, max_grefs; if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) return 1; - /* Check if we have enought grants to allocate a requests */ - if (info->persistent_gnts_c < BLKIF_MAX_SEGMENTS_PER_REQUEST) { + max_grefs = info->max_indirect_segments ? + info->max_indirect_segments + + INDIRECT_GREFS(info->max_indirect_segments) : + BLKIF_MAX_SEGMENTS_PER_REQUEST; + + /* Check if we have enough grants to allocate a requests */ + if (info->persistent_gnts_c < max_grefs) { new_persistent_gnts = 1; if (gnttab_alloc_grant_references( - BLKIF_MAX_SEGMENTS_PER_REQUEST - info->persistent_gnts_c, + max_grefs - info->persistent_gnts_c, &gref_head) < 0) { gnttab_request_free_callback( &info->callback, blkif_restart_queue_callback, info, - BLKIF_MAX_SEGMENTS_PER_REQUEST); + max_grefs); return 1; } } else @@ -394,42 +424,67 @@ static int blkif_queue_request(struct request *req) id = get_id_from_freelist(info); info->shadow[id].request = req; - ring_req->u.rw.id = id; - ring_req->u.rw.sector_number = (blkif_sector_t)blk_rq_pos(req); - ring_req->u.rw.handle = info->handle; - - ring_req->operation = rq_data_dir(req) ? - BLKIF_OP_WRITE : BLKIF_OP_READ; - - if (req->cmd_flags & (REQ_FLUSH | REQ_FUA)) { - /* - * Ideally we can do an unordered flush-to-disk. In case the - * backend onlysupports barriers, use that. A barrier request - * a superset of FUA, so we can implement it the same - * way. (It's also a FLUSH+FUA, since it is - * guaranteed ordered WRT previous writes.) - */ - ring_req->operation = info->flush_op; - } - if (unlikely(req->cmd_flags & (REQ_DISCARD | REQ_SECURE))) { - /* id, sector_number and handle are set above. */ ring_req->operation = BLKIF_OP_DISCARD; ring_req->u.discard.nr_sectors = blk_rq_sectors(req); + ring_req->u.discard.id = id; + ring_req->u.discard.sector_number = (blkif_sector_t)blk_rq_pos(req); if ((req->cmd_flags & REQ_SECURE) && info->feature_secdiscard) ring_req->u.discard.flag = BLKIF_DISCARD_SECURE; else ring_req->u.discard.flag = 0; } else { - ring_req->u.rw.nr_segments = blk_rq_map_sg(req->q, req, - info->sg); - BUG_ON(ring_req->u.rw.nr_segments > - BLKIF_MAX_SEGMENTS_PER_REQUEST); - - for_each_sg(info->sg, sg, ring_req->u.rw.nr_segments, i) { + BUG_ON(info->max_indirect_segments == 0 && + req->nr_phys_segments > BLKIF_MAX_SEGMENTS_PER_REQUEST); + BUG_ON(info->max_indirect_segments && + req->nr_phys_segments > info->max_indirect_segments); + nseg = blk_rq_map_sg(req->q, req, info->sg); + ring_req->u.rw.id = id; + if (nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST) { + /* + * The indirect operation can only be a BLKIF_OP_READ or + * BLKIF_OP_WRITE + */ + BUG_ON(req->cmd_flags & (REQ_FLUSH | REQ_FUA)); + ring_req->operation = BLKIF_OP_INDIRECT; + ring_req->u.indirect.indirect_op = rq_data_dir(req) ? + BLKIF_OP_WRITE : BLKIF_OP_READ; + ring_req->u.indirect.sector_number = (blkif_sector_t)blk_rq_pos(req); + ring_req->u.indirect.handle = info->handle; + ring_req->u.indirect.nr_segments = nseg; + } else { + ring_req->u.rw.sector_number = (blkif_sector_t)blk_rq_pos(req); + ring_req->u.rw.handle = info->handle; + ring_req->operation = rq_data_dir(req) ? + BLKIF_OP_WRITE : BLKIF_OP_READ; + if (req->cmd_flags & (REQ_FLUSH | REQ_FUA)) { + /* + * Ideally we can do an unordered flush-to-disk. In case the + * backend onlysupports barriers, use that. A barrier request + * a superset of FUA, so we can implement it the same + * way. (It's also a FLUSH+FUA, since it is + * guaranteed ordered WRT previous writes.) + */ + ring_req->operation = info->flush_op; + } + ring_req->u.rw.nr_segments = nseg; + } + for_each_sg(info->sg, sg, nseg, i) { fsect = sg->offset >> 9; lsect = fsect + (sg->length >> 9) - 1; + if ((ring_req->operation == BLKIF_OP_INDIRECT) && + (i % SEGS_PER_INDIRECT_FRAME == 0)) { + if (segments) + kunmap_atomic(segments); + + n = i / SEGS_PER_INDIRECT_FRAME; + gnt_list_entry = get_grant(&gref_head, info); + info->shadow[id].indirect_grants[n] = gnt_list_entry; + segments = kmap_atomic(pfn_to_page(gnt_list_entry->pfn)); + ring_req->u.indirect.indirect_grefs[n] = gnt_list_entry->gref; + } + gnt_list_entry = get_grant(&gref_head, info); ref = gnt_list_entry->gref; @@ -441,8 +496,7 @@ static int blkif_queue_request(struct request *req) BUG_ON(sg->offset + sg->length > PAGE_SIZE); - shared_data = kmap_atomic( - pfn_to_page(gnt_list_entry->pfn)); + shared_data = kmap_atomic(pfn_to_page(gnt_list_entry->pfn)); bvec_data = kmap_atomic(sg_page(sg)); /* @@ -461,13 +515,23 @@ static int blkif_queue_request(struct request *req) kunmap_atomic(bvec_data); kunmap_atomic(shared_data); } - - ring_req->u.rw.seg[i] = - (struct blkif_request_segment) { - .gref = ref, - .first_sect = fsect, - .last_sect = lsect }; + if (ring_req->operation != BLKIF_OP_INDIRECT) { + ring_req->u.rw.seg[i] = + (struct blkif_request_segment) { + .gref = ref, + .first_sect = fsect, + .last_sect = lsect }; + } else { + n = i % SEGS_PER_INDIRECT_FRAME; + segments[n] = + (struct blkif_request_segment_aligned) { + .gref = ref, + .first_sect = fsect, + .last_sect = lsect }; + } } + if (segments) + kunmap_atomic(segments); } info->ring.req_prod_pvt++; @@ -542,7 +606,8 @@ wait: flush_requests(info); } -static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) +static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size, + unsigned int segments) { struct request_queue *rq; struct blkfront_info *info = gd->private_data; @@ -571,7 +636,7 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) blk_queue_max_segment_size(rq, PAGE_SIZE); /* Ensure a merged request will fit in a single I/O ring slot. */ - blk_queue_max_segments(rq, BLKIF_MAX_SEGMENTS_PER_REQUEST); + blk_queue_max_segments(rq, segments); /* Make sure buffer addresses are sector-aligned. */ blk_queue_dma_alignment(rq, 511); @@ -588,13 +653,16 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) static void xlvbd_flush(struct blkfront_info *info) { blk_queue_flush(info->rq, info->feature_flush); - printk(KERN_INFO "blkfront: %s: %s: %s %s\n", + printk(KERN_INFO "blkfront: %s: %s: %s %s %s %s %s\n", info->gd->disk_name, info->flush_op == BLKIF_OP_WRITE_BARRIER ? "barrier" : (info->flush_op == BLKIF_OP_FLUSH_DISKCACHE ? "flush diskcache" : "barrier or flush"), - info->feature_flush ? "enabled" : "disabled", - info->feature_persistent ? "using persistent grants" : ""); + info->feature_flush ? "enabled;" : "disabled;", + "persistent grants:", + info->feature_persistent ? "enabled;" : "disabled;", + "indirect descriptors:", + info->max_indirect_segments ? "enabled;" : "disabled;"); } static int xen_translate_vdev(int vdevice, int *minor, unsigned int *offset) @@ -734,7 +802,9 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity, gd->driverfs_dev = &(info->xbdev->dev); set_capacity(gd, capacity); - if (xlvbd_init_blk_queue(gd, sector_size)) { + if (xlvbd_init_blk_queue(gd, sector_size, + info->max_indirect_segments ? : + BLKIF_MAX_SEGMENTS_PER_REQUEST)) { del_gendisk(gd); goto release; } @@ -818,6 +888,7 @@ static void blkif_free(struct blkfront_info *info, int suspend) { struct grant *persistent_gnt; struct grant *n; + int i, j, segs; /* Prevent new requests being issued until we fix things up. */ spin_lock_irq(&info->io_lock); @@ -843,6 +914,47 @@ static void blkif_free(struct blkfront_info *info, int suspend) } BUG_ON(info->persistent_gnts_c != 0); + kfree(info->sg); + info->sg = NULL; + for (i = 0; i < BLK_RING_SIZE; i++) { + /* + * Clear persistent grants present in requests already + * on the shared ring + */ + if (!info->shadow[i].request) + goto free_shadow; + + segs = info->shadow[i].req.operation == BLKIF_OP_INDIRECT ? + info->shadow[i].req.u.indirect.nr_segments : + info->shadow[i].req.u.rw.nr_segments; + for (j = 0; j < segs; j++) { + persistent_gnt = info->shadow[i].grants_used[j]; + gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL); + __free_page(pfn_to_page(persistent_gnt->pfn)); + kfree(persistent_gnt); + } + + if (info->shadow[i].req.operation != BLKIF_OP_INDIRECT) + /* + * If this is not an indirect operation don't try to + * free indirect segments + */ + goto free_shadow; + + for (j = 0; j < INDIRECT_GREFS(segs); j++) { + persistent_gnt = info->shadow[i].indirect_grants[j]; + gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL); + __free_page(pfn_to_page(persistent_gnt->pfn)); + kfree(persistent_gnt); + } + +free_shadow: + kfree(info->shadow[i].grants_used); + info->shadow[i].grants_used = NULL; + kfree(info->shadow[i].indirect_grants); + info->shadow[i].indirect_grants = NULL; + } + /* No more gnttab callback work. */ gnttab_cancel_free_callback(&info->callback); spin_unlock_irq(&info->io_lock); @@ -873,6 +985,10 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, char *bvec_data; void *shared_data; unsigned int offset = 0; + int nseg; + + nseg = s->req.operation == BLKIF_OP_INDIRECT ? + s->req.u.indirect.nr_segments : s->req.u.rw.nr_segments; if (bret->operation == BLKIF_OP_READ) { /* @@ -885,7 +1001,7 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, BUG_ON((bvec->bv_offset + bvec->bv_len) > PAGE_SIZE); if (bvec->bv_offset < offset) i++; - BUG_ON(i >= s->req.u.rw.nr_segments); + BUG_ON(i >= nseg); shared_data = kmap_atomic( pfn_to_page(s->grants_used[i]->pfn)); bvec_data = bvec_kmap_irq(bvec, &flags); @@ -897,10 +1013,16 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } /* Add the persistent grant into the list of free grants */ - for (i = 0; i < s->req.u.rw.nr_segments; i++) { + for (i = 0; i < nseg; i++) { list_add(&s->grants_used[i]->node, &info->persistent_gnts); info->persistent_gnts_c++; } + if (s->req.operation == BLKIF_OP_INDIRECT) { + for (i = 0; i < INDIRECT_GREFS(nseg); i++) { + list_add(&s->indirect_grants[i]->node, &info->persistent_gnts); + info->persistent_gnts_c++; + } + } } static irqreturn_t blkif_interrupt(int irq, void *dev_id) @@ -1034,14 +1156,6 @@ static int setup_blkring(struct xenbus_device *dev, SHARED_RING_INIT(sring); FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE); - sg_init_table(info->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST); - - /* Allocate memory for grants */ - err = fill_grant_buffer(info, BLK_RING_SIZE * - BLKIF_MAX_SEGMENTS_PER_REQUEST); - if (err) - goto fail; - err = xenbus_grant_ring(dev, virt_to_mfn(info->ring.sring)); if (err < 0) { free_page((unsigned long)sring); @@ -1223,13 +1337,84 @@ static int blkfront_probe(struct xenbus_device *dev, return 0; } +/* + * This is a clone of md_trim_bio, used to split a bio into smaller ones + */ +static void trim_bio(struct bio *bio, int offset, int size) +{ + /* 'bio' is a cloned bio which we need to trim to match + * the given offset and size. + * This requires adjusting bi_sector, bi_size, and bi_io_vec + */ + int i; + struct bio_vec *bvec; + int sofar = 0; + + size <<= 9; + if (offset == 0 && size == bio->bi_size) + return; + + bio->bi_sector += offset; + bio->bi_size = size; + offset <<= 9; + clear_bit(BIO_SEG_VALID, &bio->bi_flags); + + while (bio->bi_idx < bio->bi_vcnt && + bio->bi_io_vec[bio->bi_idx].bv_len <= offset) { + /* remove this whole bio_vec */ + offset -= bio->bi_io_vec[bio->bi_idx].bv_len; + bio->bi_idx++; + } + if (bio->bi_idx < bio->bi_vcnt) { + bio->bi_io_vec[bio->bi_idx].bv_offset += offset; + bio->bi_io_vec[bio->bi_idx].bv_len -= offset; + } + /* avoid any complications with bi_idx being non-zero*/ + if (bio->bi_idx) { + memmove(bio->bi_io_vec, bio->bi_io_vec+bio->bi_idx, + (bio->bi_vcnt - bio->bi_idx) * sizeof(struct bio_vec)); + bio->bi_vcnt -= bio->bi_idx; + bio->bi_idx = 0; + } + /* Make sure vcnt and last bv are not too big */ + bio_for_each_segment(bvec, bio, i) { + if (sofar + bvec->bv_len > size) + bvec->bv_len = size - sofar; + if (bvec->bv_len == 0) { + bio->bi_vcnt = i; + break; + } + sofar += bvec->bv_len; + } +} + +static void split_bio_end(struct bio *bio, int error) +{ + struct split_bio *split_bio = bio->bi_private; + + if (error) + split_bio->err = error; + + if (atomic_dec_and_test(&split_bio->pending)) { + split_bio->bio->bi_phys_segments = 0; + bio_endio(split_bio->bio, split_bio->err); + kfree(split_bio); + } + bio_put(bio); +} static int blkif_recover(struct blkfront_info *info) { int i; - struct blkif_request *req; + struct request *req, *n; struct blk_shadow *copy; - int j; + int rc; + struct bio *bio, *cloned_bio; + struct bio_list bio_list, merge_bio; + unsigned int segs, offset; + int pending, size; + struct split_bio *split_bio; + struct list_head requests; /* Stage 1: Make a safe copy of the shadow state. */ copy = kmemdup(info->shadow, sizeof(info->shadow), @@ -1244,36 +1429,64 @@ static int blkif_recover(struct blkfront_info *info) info->shadow_free = info->ring.req_prod_pvt; info->shadow[BLK_RING_SIZE-1].req.u.rw.id = 0x0fffffff; - /* Stage 3: Find pending requests and requeue them. */ + rc = blkfront_setup_indirect(info); + if (rc) { + kfree(copy); + return rc; + } + + segs = info->max_indirect_segments ? : BLKIF_MAX_SEGMENTS_PER_REQUEST; + blk_queue_max_segments(info->rq, segs); + bio_list_init(&bio_list); + INIT_LIST_HEAD(&requests); for (i = 0; i < BLK_RING_SIZE; i++) { /* Not in use? */ if (!copy[i].request) continue; - /* Grab a request slot and copy shadow state into it. */ - req = RING_GET_REQUEST(&info->ring, info->ring.req_prod_pvt); - *req = copy[i].req; - - /* We get a new request id, and must reset the shadow state. */ - req->u.rw.id = get_id_from_freelist(info); - memcpy(&info->shadow[req->u.rw.id], ©[i], sizeof(copy[i])); - - if (req->operation != BLKIF_OP_DISCARD) { - /* Rewrite any grant references invalidated by susp/resume. */ - for (j = 0; j < req->u.rw.nr_segments; j++) - gnttab_grant_foreign_access_ref( - req->u.rw.seg[j].gref, - info->xbdev->otherend_id, - pfn_to_mfn(copy[i].grants_used[j]->pfn), - 0); + /* + * Get the bios in the request so we can re-queue them. + */ + if (copy[i].request->cmd_flags & + (REQ_FLUSH | REQ_FUA | REQ_DISCARD | REQ_SECURE)) { + /* + * Flush operations don't contain bios, so + * we need to requeue the whole request + */ + list_add(©[i].request->queuelist, &requests); + continue; } - info->shadow[req->u.rw.id].req = *req; - - info->ring.req_prod_pvt++; + merge_bio.head = copy[i].request->bio; + merge_bio.tail = copy[i].request->biotail; + bio_list_merge(&bio_list, &merge_bio); + copy[i].request->bio = NULL; + blk_put_request(copy[i].request); } kfree(copy); + /* + * Empty the queue, this is important because we might have + * requests in the queue with more segments than what we + * can handle now. + */ + spin_lock_irq(&info->io_lock); + while ((req = blk_fetch_request(info->rq)) != NULL) { + if (req->cmd_flags & + (REQ_FLUSH | REQ_FUA | REQ_DISCARD | REQ_SECURE)) { + list_add(&req->queuelist, &requests); + continue; + } + merge_bio.head = req->bio; + merge_bio.tail = req->biotail; + bio_list_merge(&bio_list, &merge_bio); + req->bio = NULL; + if (req->cmd_flags & (REQ_FLUSH | REQ_FUA)) + pr_alert("diskcache flush request found!\n"); + __blk_put_request(info->rq, req); + } + spin_unlock_irq(&info->io_lock); + xenbus_switch_state(info->xbdev, XenbusStateConnected); spin_lock_irq(&info->io_lock); @@ -1281,14 +1494,50 @@ static int blkif_recover(struct blkfront_info *info) /* Now safe for us to use the shared ring */ info->connected = BLKIF_STATE_CONNECTED; - /* Send off requeued requests */ - flush_requests(info); - /* Kick any other new requests queued since we resumed */ kick_pending_request_queues(info); + list_for_each_entry_safe(req, n, &requests, queuelist) { + /* Requeue pending requests (flush or discard) */ + list_del_init(&req->queuelist); + BUG_ON(req->nr_phys_segments > segs); + blk_requeue_request(info->rq, req); + } spin_unlock_irq(&info->io_lock); + while ((bio = bio_list_pop(&bio_list)) != NULL) { + /* Traverse the list of pending bios and re-queue them */ + if (bio_segments(bio) > segs) { + /* + * This bio has more segments than what we can + * handle, we have to split it. + */ + pending = (bio_segments(bio) + segs - 1) / segs; + split_bio = kzalloc(sizeof(*split_bio), GFP_NOIO); + BUG_ON(split_bio == NULL); + atomic_set(&split_bio->pending, pending); + split_bio->bio = bio; + for (i = 0; i < pending; i++) { + offset = (i * segs * PAGE_SIZE) >> 9; + size = min((unsigned int)(segs * PAGE_SIZE) >> 9, + (unsigned int)(bio->bi_size >> 9) - offset); + cloned_bio = bio_clone(bio, GFP_NOIO); + BUG_ON(cloned_bio == NULL); + trim_bio(cloned_bio, offset, size); + cloned_bio->bi_private = split_bio; + cloned_bio->bi_end_io = split_bio_end; + submit_bio(cloned_bio->bi_rw, cloned_bio); + } + /* + * Now we have to wait for all those smaller bios to + * end, so we can also end the "parent" bio. + */ + continue; + } + /* We don't need to split this bio */ + submit_bio(bio->bi_rw, bio); + } + return 0; } @@ -1308,8 +1557,12 @@ static int blkfront_resume(struct xenbus_device *dev) blkif_free(info, info->connected == BLKIF_STATE_CONNECTED); err = talk_to_blkback(dev, info); - if (info->connected == BLKIF_STATE_SUSPENDED && !err) - err = blkif_recover(info); + + /* + * We have to wait for the backend to switch to + * connected state, since we want to read which + * features it supports. + */ return err; } @@ -1387,6 +1640,61 @@ static void blkfront_setup_discard(struct blkfront_info *info) kfree(type); } +static int blkfront_setup_indirect(struct blkfront_info *info) +{ + unsigned int indirect_segments, segs; + int err, i; + + err = xenbus_gather(XBT_NIL, info->xbdev->otherend, + "feature-max-indirect-segments", "%u", &indirect_segments, + NULL); + if (err) { + info->max_indirect_segments = 0; + segs = BLKIF_MAX_SEGMENTS_PER_REQUEST; + } else { + info->max_indirect_segments = min(indirect_segments, + xen_blkif_max_segments); + segs = info->max_indirect_segments; + } + info->sg = kzalloc(sizeof(info->sg[0]) * segs, GFP_KERNEL); + if (info->sg == NULL) + goto out_of_memory; + sg_init_table(info->sg, segs); + + err = fill_grant_buffer(info, (segs + INDIRECT_GREFS(segs)) * BLK_RING_SIZE); + if (err) + goto out_of_memory; + + for (i = 0; i < BLK_RING_SIZE; i++) { + info->shadow[i].grants_used = kzalloc( + sizeof(info->shadow[i].grants_used[0]) * segs, + GFP_NOIO); + if (info->max_indirect_segments) + info->shadow[i].indirect_grants = kzalloc( + sizeof(info->shadow[i].indirect_grants[0]) * + INDIRECT_GREFS(segs), + GFP_NOIO); + if ((info->shadow[i].grants_used == NULL) || + (info->max_indirect_segments && + (info->shadow[i].indirect_grants == NULL))) + goto out_of_memory; + } + + + return 0; + +out_of_memory: + kfree(info->sg); + info->sg = NULL; + for (i = 0; i < BLK_RING_SIZE; i++) { + kfree(info->shadow[i].grants_used); + info->shadow[i].grants_used = NULL; + kfree(info->shadow[i].indirect_grants); + info->shadow[i].indirect_grants = NULL; + } + return -ENOMEM; +} + /* * Invoked when the backend is finally 'ready' (and has told produced * the details about the physical device - #sectors, size, etc). @@ -1414,8 +1722,15 @@ static void blkfront_connect(struct blkfront_info *info) set_capacity(info->gd, sectors); revalidate_disk(info->gd); - /* fall through */ + return; case BLKIF_STATE_SUSPENDED: + /* + * If we are recovering from suspension, we need to wait + * for the backend to announce it's features before + * reconnecting, at least we need to know if the backend + * supports indirect descriptors, and how many. + */ + blkif_recover(info); return; default: @@ -1483,6 +1798,13 @@ static void blkfront_connect(struct blkfront_info *info) else info->feature_persistent = persistent; + err = blkfront_setup_indirect(info); + if (err) { + xenbus_dev_fatal(info->xbdev, err, "setup_indirect at %s", + info->xbdev->otherend); + return; + } + err = xlvbd_alloc_gendisk(sectors, info, binfo, sector_size); if (err) { xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s", diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h index ffd4652de91c..65e12099ef89 100644 --- a/include/xen/interface/io/blkif.h +++ b/include/xen/interface/io/blkif.h @@ -102,6 +102,30 @@ typedef uint64_t blkif_sector_t; */ #define BLKIF_OP_DISCARD 5 +/* + * Recognized if "feature-max-indirect-segments" in present in the backend + * xenbus info. The "feature-max-indirect-segments" node contains the maximum + * number of segments allowed by the backend per request. If the node is + * present, the frontend might use blkif_request_indirect structs in order to + * issue requests with more than BLKIF_MAX_SEGMENTS_PER_REQUEST (11). The + * maximum number of indirect segments is fixed by the backend, but the + * frontend can issue requests with any number of indirect segments as long as + * it's less than the number provided by the backend. The indirect_grefs field + * in blkif_request_indirect should be filled by the frontend with the + * grant references of the pages that are holding the indirect segments. + * This pages are filled with an array of blkif_request_segment_aligned + * that hold the information about the segments. The number of indirect + * pages to use is determined by the maximum number of segments + * a indirect request contains. Every indirect page can contain a maximum + * of 512 segments (PAGE_SIZE/sizeof(blkif_request_segment_aligned)), + * so to calculate the number of indirect pages to use we have to do + * ceil(indirect_segments/512). + * + * If a backend does not recognize BLKIF_OP_INDIRECT, it should *not* + * create the "feature-max-indirect-segments" node! + */ +#define BLKIF_OP_INDIRECT 6 + /* * Maximum scatter/gather segments per request. * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE. @@ -109,6 +133,16 @@ typedef uint64_t blkif_sector_t; */ #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 +#define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8 + +struct blkif_request_segment_aligned { + grant_ref_t gref; /* reference to I/O buffer frame */ + /* @first_sect: first sector in frame to transfer (inclusive). */ + /* @last_sect: last sector in frame to transfer (inclusive). */ + uint8_t first_sect, last_sect; + uint16_t _pad; /* padding to make it 8 bytes, so it's cache-aligned */ +} __attribute__((__packed__)); + struct blkif_request_rw { uint8_t nr_segments; /* number of segments */ blkif_vdev_t handle; /* only for read/write requests */ @@ -147,12 +181,31 @@ struct blkif_request_other { uint64_t id; /* private guest value, echoed in resp */ } __attribute__((__packed__)); +struct blkif_request_indirect { + uint8_t indirect_op; + uint16_t nr_segments; +#ifdef CONFIG_X86_64 + uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */ +#endif + uint64_t id; + blkif_sector_t sector_number; + blkif_vdev_t handle; + uint16_t _pad2; + grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST]; +#ifdef CONFIG_X86_64 + uint32_t _pad3; /* make it 64 byte aligned */ +#else + uint64_t _pad3; /* make it 64 byte aligned */ +#endif +} __attribute__((__packed__)); + struct blkif_request { uint8_t operation; /* BLKIF_OP_??? */ union { struct blkif_request_rw rw; struct blkif_request_discard discard; struct blkif_request_other other; + struct blkif_request_indirect indirect; } u; } __attribute__((__packed__)); From bb642e8315fd573795e8b6fa9b9629064d73add1 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Thu, 2 May 2013 10:21:17 +0200 Subject: [PATCH 008/913] xen-blkback: allocate list of pending reqs in small chunks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allocate pending requests in smaller chunks instead of allocating them all at the same time. This change also removes the global array of pending_reqs, it is no longer necessay. Variables related to the grant mapping have been grouped into a struct called "grant_page", this allows to allocate them in smaller chunks, and also improves memory locality. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reported-by: Sander Eikelenboom <linux@eikelenboom.it> Tested-by: Sander Eikelenboom <linux@eikelenboom.it> Reviewed-by: David Vrabel <david.vrabel@citrix.com> Cc: David Vrabel <david.vrabel@citrix.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/block/xen-blkback/blkback.c | 92 +++++++++++++---------------- drivers/block/xen-blkback/common.h | 18 +++--- drivers/block/xen-blkback/xenbus.c | 76 ++++++++++++++++++------ 3 files changed, 107 insertions(+), 79 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 1ebc0aa0f0e4..e79ab4559233 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -641,9 +641,7 @@ purge_gnt_list: * used in the 'pending_req'. */ static void xen_blkbk_unmap(struct xen_blkif *blkif, - grant_handle_t handles[], - struct page *pages[], - struct persistent_gnt *persistent_gnts[], + struct grant_page *pages[], int num) { struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; @@ -652,16 +650,16 @@ static void xen_blkbk_unmap(struct xen_blkif *blkif, int ret; for (i = 0; i < num; i++) { - if (persistent_gnts[i] != NULL) { - put_persistent_gnt(blkif, persistent_gnts[i]); + if (pages[i]->persistent_gnt != NULL) { + put_persistent_gnt(blkif, pages[i]->persistent_gnt); continue; } - if (handles[i] == BLKBACK_INVALID_HANDLE) + if (pages[i]->handle == BLKBACK_INVALID_HANDLE) continue; - unmap_pages[invcount] = pages[i]; - gnttab_set_unmap_op(&unmap[invcount], vaddr(pages[i]), - GNTMAP_host_map, handles[i]); - handles[i] = BLKBACK_INVALID_HANDLE; + unmap_pages[invcount] = pages[i]->page; + gnttab_set_unmap_op(&unmap[invcount], vaddr(pages[i]->page), + GNTMAP_host_map, pages[i]->handle); + pages[i]->handle = BLKBACK_INVALID_HANDLE; if (++invcount == BLKIF_MAX_SEGMENTS_PER_REQUEST) { ret = gnttab_unmap_refs(unmap, NULL, unmap_pages, invcount); @@ -677,10 +675,8 @@ static void xen_blkbk_unmap(struct xen_blkif *blkif, } } -static int xen_blkbk_map(struct xen_blkif *blkif, grant_ref_t grefs[], - struct persistent_gnt *persistent_gnts[], - grant_handle_t handles[], - struct page *pages[], +static int xen_blkbk_map(struct xen_blkif *blkif, + struct grant_page *pages[], int num, bool ro) { struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST]; @@ -707,26 +703,26 @@ again: if (use_persistent_gnts) persistent_gnt = get_persistent_gnt( blkif, - grefs[i]); + pages[i]->gref); if (persistent_gnt) { /* * We are using persistent grants and * the grant is already mapped */ - pages[i] = persistent_gnt->page; - persistent_gnts[i] = persistent_gnt; + pages[i]->page = persistent_gnt->page; + pages[i]->persistent_gnt = persistent_gnt; } else { - if (get_free_page(blkif, &pages[i])) + if (get_free_page(blkif, &pages[i]->page)) goto out_of_memory; - addr = vaddr(pages[i]); - pages_to_gnt[segs_to_map] = pages[i]; - persistent_gnts[i] = NULL; + addr = vaddr(pages[i]->page); + pages_to_gnt[segs_to_map] = pages[i]->page; + pages[i]->persistent_gnt = NULL; flags = GNTMAP_host_map; if (!use_persistent_gnts && ro) flags |= GNTMAP_readonly; gnttab_set_map_op(&map[segs_to_map++], addr, - flags, grefs[i], + flags, pages[i]->gref, blkif->domid); } map_until = i + 1; @@ -745,16 +741,16 @@ again: * the page from the other domain. */ for (seg_idx = last_map, new_map_idx = 0; seg_idx < map_until; seg_idx++) { - if (!persistent_gnts[seg_idx]) { + if (!pages[seg_idx]->persistent_gnt) { /* This is a newly mapped grant */ BUG_ON(new_map_idx >= segs_to_map); if (unlikely(map[new_map_idx].status != 0)) { pr_debug(DRV_PFX "invalid buffer -- could not remap it\n"); - handles[seg_idx] = BLKBACK_INVALID_HANDLE; + pages[seg_idx]->handle = BLKBACK_INVALID_HANDLE; ret |= 1; goto next; } - handles[seg_idx] = map[new_map_idx].handle; + pages[seg_idx]->handle = map[new_map_idx].handle; } else { continue; } @@ -776,14 +772,14 @@ again: } persistent_gnt->gnt = map[new_map_idx].ref; persistent_gnt->handle = map[new_map_idx].handle; - persistent_gnt->page = pages[seg_idx]; + persistent_gnt->page = pages[seg_idx]->page; if (add_persistent_gnt(blkif, persistent_gnt)) { kfree(persistent_gnt); persistent_gnt = NULL; goto next; } - persistent_gnts[seg_idx] = persistent_gnt; + pages[seg_idx]->persistent_gnt = persistent_gnt; pr_debug(DRV_PFX " grant %u added to the tree of persistent grants, using %u/%u\n", persistent_gnt->gnt, blkif->persistent_gnt_c, xen_blkif_max_pgrants); @@ -814,15 +810,11 @@ out_of_memory: return -ENOMEM; } -static int xen_blkbk_map_seg(struct pending_req *pending_req, - struct seg_buf seg[], - struct page *pages[]) +static int xen_blkbk_map_seg(struct pending_req *pending_req) { int rc; - rc = xen_blkbk_map(pending_req->blkif, pending_req->grefs, - pending_req->persistent_gnts, - pending_req->grant_handles, pending_req->pages, + rc = xen_blkbk_map(pending_req->blkif, pending_req->segments, pending_req->nr_pages, (pending_req->operation != BLKIF_OP_READ)); @@ -834,9 +826,7 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req, struct seg_buf seg[], struct phys_req *preq) { - struct persistent_gnt **persistent = - pending_req->indirect_persistent_gnts; - struct page **pages = pending_req->indirect_pages; + struct grant_page **pages = pending_req->indirect_pages; struct xen_blkif *blkif = pending_req->blkif; int indirect_grefs, rc, n, nseg, i; struct blkif_request_segment_aligned *segments = NULL; @@ -845,9 +835,10 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req, indirect_grefs = INDIRECT_PAGES(nseg); BUG_ON(indirect_grefs > BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST); - rc = xen_blkbk_map(blkif, req->u.indirect.indirect_grefs, - persistent, pending_req->indirect_handles, - pages, indirect_grefs, true); + for (i = 0; i < indirect_grefs; i++) + pages[i]->gref = req->u.indirect.indirect_grefs[i]; + + rc = xen_blkbk_map(blkif, pages, indirect_grefs, true); if (rc) goto unmap; @@ -856,10 +847,10 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req, /* Map indirect segments */ if (segments) kunmap_atomic(segments); - segments = kmap_atomic(pages[n/SEGS_PER_INDIRECT_FRAME]); + segments = kmap_atomic(pages[n/SEGS_PER_INDIRECT_FRAME]->page); } i = n % SEGS_PER_INDIRECT_FRAME; - pending_req->grefs[n] = segments[i].gref; + pending_req->segments[n]->gref = segments[i].gref; seg[n].nsec = segments[i].last_sect - segments[i].first_sect + 1; seg[n].offset = (segments[i].first_sect << 9); @@ -874,8 +865,7 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req, unmap: if (segments) kunmap_atomic(segments); - xen_blkbk_unmap(blkif, pending_req->indirect_handles, - pages, persistent, indirect_grefs); + xen_blkbk_unmap(blkif, pages, indirect_grefs); return rc; } @@ -965,9 +955,8 @@ static void __end_block_io_op(struct pending_req *pending_req, int error) * the proper response on the ring. */ if (atomic_dec_and_test(&pending_req->pendcnt)) { - xen_blkbk_unmap(pending_req->blkif, pending_req->grant_handles, - pending_req->pages, - pending_req->persistent_gnts, + xen_blkbk_unmap(pending_req->blkif, + pending_req->segments, pending_req->nr_pages); make_response(pending_req->blkif, pending_req->id, pending_req->operation, pending_req->status); @@ -1104,7 +1093,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, int operation; struct blk_plug plug; bool drain = false; - struct page **pages = pending_req->pages; + struct grant_page **pages = pending_req->segments; unsigned short req_operation; req_operation = req->operation == BLKIF_OP_INDIRECT ? @@ -1165,7 +1154,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, preq.dev = req->u.rw.handle; preq.sector_number = req->u.rw.sector_number; for (i = 0; i < nseg; i++) { - pending_req->grefs[i] = req->u.rw.seg[i].gref; + pages[i]->gref = req->u.rw.seg[i].gref; seg[i].nsec = req->u.rw.seg[i].last_sect - req->u.rw.seg[i].first_sect + 1; seg[i].offset = (req->u.rw.seg[i].first_sect << 9); @@ -1216,7 +1205,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, * the hypercall to unmap the grants - that is all done in * xen_blkbk_unmap. */ - if (xen_blkbk_map_seg(pending_req, seg, pages)) + if (xen_blkbk_map_seg(pending_req)) goto fail_flush; /* @@ -1228,7 +1217,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, for (i = 0; i < nseg; i++) { while ((bio == NULL) || (bio_add_page(bio, - pages[i], + pages[i]->page, seg[i].nsec << 9, seg[i].offset) == 0)) { @@ -1277,8 +1266,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, return 0; fail_flush: - xen_blkbk_unmap(blkif, pending_req->grant_handles, - pending_req->pages, pending_req->persistent_gnts, + xen_blkbk_unmap(blkif, pending_req->segments, pending_req->nr_pages); fail_response: /* Haven't submitted any bio's yet. */ diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 1ac53da8410f..c6b4cb9af6c2 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -297,8 +297,6 @@ struct xen_blkif { int free_pages_num; struct list_head free_pages; - /* Allocation of pending_reqs */ - struct pending_req *pending_reqs; /* List of all 'pending_req' available */ struct list_head pending_free; /* And its spinlock. */ @@ -323,6 +321,13 @@ struct seg_buf { unsigned int nsec; }; +struct grant_page { + struct page *page; + struct persistent_gnt *persistent_gnt; + grant_handle_t handle; + grant_ref_t gref; +}; + /* * Each outstanding request that we've passed to the lower device layers has a * 'pending_req' allocated to it. Each buffer_head that completes decrements @@ -337,14 +342,9 @@ struct pending_req { unsigned short operation; int status; struct list_head free_list; - struct page *pages[MAX_INDIRECT_SEGMENTS]; - struct persistent_gnt *persistent_gnts[MAX_INDIRECT_SEGMENTS]; - grant_handle_t grant_handles[MAX_INDIRECT_SEGMENTS]; - grant_ref_t grefs[MAX_INDIRECT_SEGMENTS]; + struct grant_page *segments[MAX_INDIRECT_SEGMENTS]; /* Indirect descriptors */ - struct persistent_gnt *indirect_persistent_gnts[MAX_INDIRECT_PAGES]; - struct page *indirect_pages[MAX_INDIRECT_PAGES]; - grant_handle_t indirect_handles[MAX_INDIRECT_PAGES]; + struct grant_page *indirect_pages[MAX_INDIRECT_PAGES]; struct seg_buf seg[MAX_INDIRECT_SEGMENTS]; struct bio *biolist[MAX_INDIRECT_SEGMENTS]; }; diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index afab208c54e3..4a4749c78942 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -105,7 +105,8 @@ static void xen_update_blkif_status(struct xen_blkif *blkif) static struct xen_blkif *xen_blkif_alloc(domid_t domid) { struct xen_blkif *blkif; - int i; + struct pending_req *req, *n; + int i, j; BUILD_BUG_ON(MAX_INDIRECT_PAGES > BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST); @@ -127,22 +128,51 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) blkif->free_pages_num = 0; atomic_set(&blkif->persistent_gnt_in_use, 0); - blkif->pending_reqs = kcalloc(XEN_BLKIF_REQS, - sizeof(blkif->pending_reqs[0]), - GFP_KERNEL); - if (!blkif->pending_reqs) { - kmem_cache_free(xen_blkif_cachep, blkif); - return ERR_PTR(-ENOMEM); - } INIT_LIST_HEAD(&blkif->pending_free); + + for (i = 0; i < XEN_BLKIF_REQS; i++) { + req = kzalloc(sizeof(*req), GFP_KERNEL); + if (!req) + goto fail; + list_add_tail(&req->free_list, + &blkif->pending_free); + for (j = 0; j < MAX_INDIRECT_SEGMENTS; j++) { + req->segments[j] = kzalloc(sizeof(*req->segments[0]), + GFP_KERNEL); + if (!req->segments[j]) + goto fail; + } + for (j = 0; j < MAX_INDIRECT_PAGES; j++) { + req->indirect_pages[j] = kzalloc(sizeof(*req->indirect_pages[0]), + GFP_KERNEL); + if (!req->indirect_pages[j]) + goto fail; + } + } spin_lock_init(&blkif->pending_free_lock); init_waitqueue_head(&blkif->pending_free_wq); - for (i = 0; i < XEN_BLKIF_REQS; i++) - list_add_tail(&blkif->pending_reqs[i].free_list, - &blkif->pending_free); - return blkif; + +fail: + list_for_each_entry_safe(req, n, &blkif->pending_free, free_list) { + list_del(&req->free_list); + for (j = 0; j < MAX_INDIRECT_SEGMENTS; j++) { + if (!req->segments[j]) + break; + kfree(req->segments[j]); + } + for (j = 0; j < MAX_INDIRECT_PAGES; j++) { + if (!req->indirect_pages[j]) + break; + kfree(req->indirect_pages[j]); + } + kfree(req); + } + + kmem_cache_free(xen_blkif_cachep, blkif); + + return ERR_PTR(-ENOMEM); } static int xen_blkif_map(struct xen_blkif *blkif, unsigned long shared_page, @@ -221,18 +251,28 @@ static void xen_blkif_disconnect(struct xen_blkif *blkif) static void xen_blkif_free(struct xen_blkif *blkif) { - struct pending_req *req; - int i = 0; + struct pending_req *req, *n; + int i = 0, j; if (!atomic_dec_and_test(&blkif->refcnt)) BUG(); /* Check that there is no request in use */ - list_for_each_entry(req, &blkif->pending_free, free_list) - i++; - BUG_ON(i != XEN_BLKIF_REQS); + list_for_each_entry_safe(req, n, &blkif->pending_free, free_list) { + list_del(&req->free_list); + + for (j = 0; j < MAX_INDIRECT_SEGMENTS; j++) + kfree(req->segments[j]); + + for (j = 0; j < MAX_INDIRECT_PAGES; j++) + kfree(req->indirect_pages[j]); + + kfree(req); + i++; + } + + WARN_ON(i != XEN_BLKIF_REQS); - kfree(blkif->pending_reqs); kmem_cache_free(xen_blkif_cachep, blkif); } From b7649158a0d241f8d53d13ff7441858539e16656 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Thu, 2 May 2013 10:58:50 +0200 Subject: [PATCH 009/913] xen-blkfront: use a different scatterlist for each request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In blkif_queue_request blkfront iterates over the scatterlist in order to set the segments of the request, and in blkif_completion blkfront iterates over the raw request, which makes it hard to know the exact position of the source and destination memory positions. This can be solved by allocating a scatterlist for each request, that will be keep until the request is finished, allowing us to copy the data back to the original memory without having to iterate over the raw request. Oracle-Bug: 16660413 - LARGE ASYNCHRONOUS READS APPEAR BROKEN ON 2.6.39-400 CC: stable@vger.kernel.org Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reported-and-Tested-by: Anne Milicia <anne.milicia@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/block/xen-blkfront.c | 43 +++++++++++++++--------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 82d63d5b1750..bac8cf31319b 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -76,6 +76,7 @@ struct blk_shadow { struct request *request; struct grant **grants_used; struct grant **indirect_grants; + struct scatterlist *sg; }; struct split_bio { @@ -113,7 +114,6 @@ struct blkfront_info enum blkif_state connected; int ring_ref; struct blkif_front_ring ring; - struct scatterlist *sg; unsigned int evtchn, irq; struct request_queue *rq; struct work_struct work; @@ -438,7 +438,7 @@ static int blkif_queue_request(struct request *req) req->nr_phys_segments > BLKIF_MAX_SEGMENTS_PER_REQUEST); BUG_ON(info->max_indirect_segments && req->nr_phys_segments > info->max_indirect_segments); - nseg = blk_rq_map_sg(req->q, req, info->sg); + nseg = blk_rq_map_sg(req->q, req, info->shadow[id].sg); ring_req->u.rw.id = id; if (nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST) { /* @@ -469,7 +469,7 @@ static int blkif_queue_request(struct request *req) } ring_req->u.rw.nr_segments = nseg; } - for_each_sg(info->sg, sg, nseg, i) { + for_each_sg(info->shadow[id].sg, sg, nseg, i) { fsect = sg->offset >> 9; lsect = fsect + (sg->length >> 9) - 1; @@ -914,8 +914,6 @@ static void blkif_free(struct blkfront_info *info, int suspend) } BUG_ON(info->persistent_gnts_c != 0); - kfree(info->sg); - info->sg = NULL; for (i = 0; i < BLK_RING_SIZE; i++) { /* * Clear persistent grants present in requests already @@ -953,6 +951,8 @@ free_shadow: info->shadow[i].grants_used = NULL; kfree(info->shadow[i].indirect_grants); info->shadow[i].indirect_grants = NULL; + kfree(info->shadow[i].sg); + info->shadow[i].sg = NULL; } /* No more gnttab callback work. */ @@ -979,12 +979,9 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, struct blkif_response *bret) { int i = 0; - struct bio_vec *bvec; - struct req_iterator iter; - unsigned long flags; + struct scatterlist *sg; char *bvec_data; void *shared_data; - unsigned int offset = 0; int nseg; nseg = s->req.operation == BLKIF_OP_INDIRECT ? @@ -997,19 +994,16 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, * than PAGE_SIZE, we have to keep track of the current offset, * to be sure we are copying the data from the right shared page. */ - rq_for_each_segment(bvec, s->request, iter) { - BUG_ON((bvec->bv_offset + bvec->bv_len) > PAGE_SIZE); - if (bvec->bv_offset < offset) - i++; - BUG_ON(i >= nseg); + for_each_sg(s->sg, sg, nseg, i) { + BUG_ON(sg->offset + sg->length > PAGE_SIZE); shared_data = kmap_atomic( pfn_to_page(s->grants_used[i]->pfn)); - bvec_data = bvec_kmap_irq(bvec, &flags); - memcpy(bvec_data, shared_data + bvec->bv_offset, - bvec->bv_len); - bvec_kunmap_irq(bvec_data, &flags); + bvec_data = kmap_atomic(sg_page(sg)); + memcpy(bvec_data + sg->offset, + shared_data + sg->offset, + sg->length); + kunmap_atomic(bvec_data); kunmap_atomic(shared_data); - offset = bvec->bv_offset + bvec->bv_len; } } /* Add the persistent grant into the list of free grants */ @@ -1656,10 +1650,6 @@ static int blkfront_setup_indirect(struct blkfront_info *info) xen_blkif_max_segments); segs = info->max_indirect_segments; } - info->sg = kzalloc(sizeof(info->sg[0]) * segs, GFP_KERNEL); - if (info->sg == NULL) - goto out_of_memory; - sg_init_table(info->sg, segs); err = fill_grant_buffer(info, (segs + INDIRECT_GREFS(segs)) * BLK_RING_SIZE); if (err) @@ -1669,26 +1659,29 @@ static int blkfront_setup_indirect(struct blkfront_info *info) info->shadow[i].grants_used = kzalloc( sizeof(info->shadow[i].grants_used[0]) * segs, GFP_NOIO); + info->shadow[i].sg = kzalloc(sizeof(info->shadow[i].sg[0]) * segs, GFP_NOIO); if (info->max_indirect_segments) info->shadow[i].indirect_grants = kzalloc( sizeof(info->shadow[i].indirect_grants[0]) * INDIRECT_GREFS(segs), GFP_NOIO); if ((info->shadow[i].grants_used == NULL) || + (info->shadow[i].sg == NULL) || (info->max_indirect_segments && (info->shadow[i].indirect_grants == NULL))) goto out_of_memory; + sg_init_table(info->shadow[i].sg, segs); } return 0; out_of_memory: - kfree(info->sg); - info->sg = NULL; for (i = 0; i < BLK_RING_SIZE; i++) { kfree(info->shadow[i].grants_used); info->shadow[i].grants_used = NULL; + kfree(info->shadow[i].sg); + info->shadow[i].sg = NULL; kfree(info->shadow[i].indirect_grants); info->shadow[i].indirect_grants = NULL; } From 2d5dc3ba853344f39a41ae5bdb0a337b2ecaafa6 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Date: Wed, 15 May 2013 10:39:34 -0400 Subject: [PATCH 010/913] xen-blkfront: Introduce a 'max' module parameter to alter the amount of indirect segments. The max module parameter (by default 32) is the maximum number of segments that the frontend will negotiate with the backend for indirect descriptors. Higher value means more potential throughput but more memory usage. The backend picks the minimum of the frontend and its default backend value. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- Documentation/ABI/testing/sysfs-driver-xen-blkfront | 10 ++++++++++ drivers/block/xen-blkfront.c | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-xen-blkfront diff --git a/Documentation/ABI/testing/sysfs-driver-xen-blkfront b/Documentation/ABI/testing/sysfs-driver-xen-blkfront new file mode 100644 index 000000000000..c0a6cb7eb314 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-driver-xen-blkfront @@ -0,0 +1,10 @@ +What: /sys/module/xen_blkfront/parameters/max +Date: June 2013 +KernelVersion: 3.11 +Contact: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> +Description: + Maximum number of segments that the frontend will negotiate + with the backend for indirect descriptors. The default value + is 32 - higher value means more potential throughput but more + memory usage. The backend picks the minimum of the frontend + and its default backend value. diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index bac8cf31319b..08bdfc3b2de2 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -95,6 +95,8 @@ static const struct block_device_operations xlvbd_block_fops; */ static unsigned int xen_blkif_max_segments = 32; +module_param_named(max, xen_blkif_max_segments, int, S_IRUGO); +MODULE_PARM_DESC(max, "Maximum amount of segments in indirect requests (default is 32)"); #define BLK_RING_SIZE __CONST_RING_SIZE(blkif, PAGE_SIZE) From 1d1996509cd3f90551f4460a68aaf3dc940a05e3 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Date: Tue, 4 Jun 2013 09:32:41 -0400 Subject: [PATCH 011/913] xen-blkback/sysfs: Move the parameters for the persistent grant features to a testing subdirectory (as this value should not be baked for the life-time) and also in an appropiate file. Also modified the introduction Linux version from 3.10 to 3.11. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- Documentation/ABI/stable/sysfs-bus-xen-backend | 18 ------------------ .../ABI/testing/sysfs-driver-xen-blkback | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 18 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-xen-blkback diff --git a/Documentation/ABI/stable/sysfs-bus-xen-backend b/Documentation/ABI/stable/sysfs-bus-xen-backend index 947db11350bc..3d5951c8bf5f 100644 --- a/Documentation/ABI/stable/sysfs-bus-xen-backend +++ b/Documentation/ABI/stable/sysfs-bus-xen-backend @@ -73,21 +73,3 @@ KernelVersion: 3.0 Contact: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Description: Number of sectors written by the frontend. - -What: /sys/module/xen_blkback/parameters/max_buffer_pages -Date: March 2013 -KernelVersion: 3.10 -Contact: Roger Pau Monné <roger.pau@citrix.com> -Description: - Maximum number of free pages to keep in each block - backend buffer. - -What: /sys/module/xen_blkback/parameters/max_persistent_grants -Date: March 2013 -KernelVersion: 3.10 -Contact: Roger Pau Monné <roger.pau@citrix.com> -Description: - Maximum number of grants to map persistently in - blkback. If the frontend tries to use more than - max_persistent_grants, the LRU kicks in and starts - removing 5% of max_persistent_grants every 100ms. diff --git a/Documentation/ABI/testing/sysfs-driver-xen-blkback b/Documentation/ABI/testing/sysfs-driver-xen-blkback new file mode 100644 index 000000000000..8bb43b66eb55 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-driver-xen-blkback @@ -0,0 +1,17 @@ +What: /sys/module/xen_blkback/parameters/max_buffer_pages +Date: March 2013 +KernelVersion: 3.11 +Contact: Roger Pau Monné <roger.pau@citrix.com> +Description: + Maximum number of free pages to keep in each block + backend buffer. + +What: /sys/module/xen_blkback/parameters/max_persistent_grants +Date: March 2013 +KernelVersion: 3.11 +Contact: Roger Pau Monné <roger.pau@citrix.com> +Description: + Maximum number of grants to map persistently in + blkback. If the frontend tries to use more than + max_persistent_grants, the LRU kicks in and starts + removing 5% of max_persistent_grants every 100ms. From 7c4d7d710f7eb499ec483f25acc28b53adaa3260 Mon Sep 17 00:00:00 2001 From: Stefan Bader <stefan.bader@canonical.com> Date: Mon, 13 May 2013 16:28:15 +0200 Subject: [PATCH 012/913] xen/blkback: Use physical sector size for setup Currently xen-blkback passes the logical sector size over xenbus and xen-blkfront sets up the paravirt disk with that logical block size. But newer drives usually have the logical sector size set to 512 for compatibility reasons and would show the actual sector size only in physical sector size. This results in the device being partitioned and accessed in dom0 with the correct sector size, but the guest thinks 512 bytes is the correct block size. And that results in poor performance. To fix this, blkback gets modified to pass also physical-sector-size over xenbus and blkfront to use both values to set up the paravirt disk. I did not just change the passed in sector-size because I am not sure having a bigger logical sector size than the physical one is valid (and that would happen if a newer dom0 kernel hits an older domU kernel). Also this way a domU set up before should still be accessible (just some tools might detect the unaligned setup). [v2: Make xenbus write failure non-fatal] [v3: Use xenbus_scanf instead of xenbus_gather] [v4: Rebased against segment changes] Signed-off-by: Stefan Bader <stefan.bader@canonical.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/block/xen-blkback/xenbus.c | 5 +++++ drivers/block/xen-blkfront.c | 21 ++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 4a4749c78942..7b06f943371c 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -782,6 +782,11 @@ again: dev->nodename); goto abort; } + err = xenbus_printf(xbt, dev->nodename, "physical-sector-size", "%u", + bdev_physical_block_size(be->blkif->vbd.bdev)); + if (err) + xenbus_dev_error(dev, err, "writing %s/physical-sector-size", + dev->nodename); err = xenbus_transaction_end(xbt, 0); if (err == -EAGAIN) diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 08bdfc3b2de2..1a0f67c10ec7 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -609,6 +609,7 @@ wait: } static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size, + unsigned int physical_sector_size, unsigned int segments) { struct request_queue *rq; @@ -631,6 +632,7 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size, /* Hard sector size and max sectors impersonate the equiv. hardware. */ blk_queue_logical_block_size(rq, sector_size); + blk_queue_physical_block_size(rq, physical_sector_size); blk_queue_max_hw_sectors(rq, 512); /* Each segment in a request is up to an aligned page in size. */ @@ -737,7 +739,8 @@ static char *encode_disk_name(char *ptr, unsigned int n) static int xlvbd_alloc_gendisk(blkif_sector_t capacity, struct blkfront_info *info, - u16 vdisk_info, u16 sector_size) + u16 vdisk_info, u16 sector_size, + unsigned int physical_sector_size) { struct gendisk *gd; int nr_minors = 1; @@ -804,7 +807,7 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity, gd->driverfs_dev = &(info->xbdev->dev); set_capacity(gd, capacity); - if (xlvbd_init_blk_queue(gd, sector_size, + if (xlvbd_init_blk_queue(gd, sector_size, physical_sector_size, info->max_indirect_segments ? : BLKIF_MAX_SEGMENTS_PER_REQUEST)) { del_gendisk(gd); @@ -1698,6 +1701,7 @@ static void blkfront_connect(struct blkfront_info *info) { unsigned long long sectors; unsigned long sector_size; + unsigned int physical_sector_size; unsigned int binfo; int err; int barrier, flush, discard, persistent; @@ -1747,6 +1751,16 @@ static void blkfront_connect(struct blkfront_info *info) return; } + /* + * physcial-sector-size is a newer field, so old backends may not + * provide this. Assume physical sector size to be the same as + * sector_size in that case. + */ + err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, + "physical-sector-size", "%u", &physical_sector_size); + if (err != 1) + physical_sector_size = sector_size; + info->feature_flush = 0; info->flush_op = 0; @@ -1800,7 +1814,8 @@ static void blkfront_connect(struct blkfront_info *info) return; } - err = xlvbd_alloc_gendisk(sectors, info, binfo, sector_size); + err = xlvbd_alloc_gendisk(sectors, info, binfo, sector_size, + physical_sector_size); if (err) { xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s", info->xbdev->otherend); From 604c499cbbcc3d5fe5fb8d53306aa0fae1990109 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Date: Wed, 16 Jan 2013 11:33:52 -0500 Subject: [PATCH 013/913] xen/blkback: Check device permissions before allowing OP_DISCARD We need to make sure that the device is not RO or that the request is not past the number of sectors we want to issue the DISCARD operation for. This fixes CVE-2013-2140. Cc: stable@vger.kernel.org Acked-by: Jan Beulich <JBeulich@suse.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> [v1: Made it pr_warn instead of pr_debug] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/block/xen-blkback/blkback.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index e79ab4559233..4119bcdefd1a 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -876,7 +876,18 @@ static int dispatch_discard_io(struct xen_blkif *blkif, int status = BLKIF_RSP_OKAY; struct block_device *bdev = blkif->vbd.bdev; unsigned long secure; + struct phys_req preq; + preq.sector_number = req->u.discard.sector_number; + preq.nr_sects = req->u.discard.nr_sectors; + + err = xen_vbd_translate(&preq, blkif, WRITE); + if (err) { + pr_warn(DRV_PFX "access denied: DISCARD [%llu->%llu] on dev=%04x\n", + preq.sector_number, + preq.sector_number + preq.nr_sects, blkif->vbd.pdevice); + goto fail_response; + } blkif->st_ds_req++; xen_blkif_get(blkif); @@ -887,7 +898,7 @@ static int dispatch_discard_io(struct xen_blkif *blkif, err = blkdev_issue_discard(bdev, req->u.discard.sector_number, req->u.discard.nr_sectors, GFP_KERNEL, secure); - +fail_response: if (err == -EOPNOTSUPP) { pr_debug(DRV_PFX "discard op failed, not supported\n"); status = BLKIF_RSP_EOPNOTSUPP; From 8d9256906a97c24e97e016482b9be06ea2532b05 Mon Sep 17 00:00:00 2001 From: Jan Beulich <jbeulich@suse.com> Date: Mon, 17 Jun 2013 15:16:33 -0400 Subject: [PATCH 014/913] xen/io/ring.h: new macro to detect whether there are too many requests on the ring Backends may need to protect themselves against an insane number of produced requests stored by a frontend, in case they iterate over requests until reaching the req_prod value. There can't be more requests on the ring than the difference between produced requests and produced (but possibly not yet published) responses. This is a more strict alternative to a patch previously posted by Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>. Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- include/xen/interface/io/ring.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h index 75271b9a8f61..7d28aff605c7 100644 --- a/include/xen/interface/io/ring.h +++ b/include/xen/interface/io/ring.h @@ -188,6 +188,11 @@ struct __name##_back_ring { \ #define RING_REQUEST_CONS_OVERFLOW(_r, _cons) \ (((_cons) - (_r)->rsp_prod_pvt) >= RING_SIZE(_r)) +/* Ill-behaved frontend determination: Can there be this many requests? */ +#define RING_REQUEST_PROD_OVERFLOW(_r, _prod) \ + (((_prod) - (_r)->rsp_prod_pvt) > RING_SIZE(_r)) + + #define RING_PUSH_REQUESTS(_r) do { \ wmb(); /* back sees requests /before/ updated producer index */ \ (_r)->sring->req_prod = (_r)->req_prod_pvt; \ From 8e3f8755545cc4a7f4da8e9ef76d6d32e0dca576 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Date: Wed, 23 Jan 2013 16:54:32 -0500 Subject: [PATCH 015/913] xen/blkback: Check for insane amounts of request on the ring (v6). Check that the ring does not have an insane amount of requests (more than there could fit on the ring). If we detect this case we will stop processing the requests and wait until the XenBus disconnects the ring. The existing check RING_REQUEST_CONS_OVERFLOW which checks for how many responses we have created in the past (rsp_prod_pvt) vs requests consumed (req_cons) and whether said difference is greater or equal to the size of the ring, does not catch this case. Wha the condition does check if there is a need to process more as we still have a backlog of responses to finish. Note that both of those values (rsp_prod_pvt and req_cons) are not exposed on the shared ring. To understand this problem a mini crash course in ring protocol response/request updates is in place. There are four entries: req_prod and rsp_prod; req_event and rsp_event to track the ring entries. We are only concerned about the first two - which set the tone of this bug. The req_prod is a value incremented by frontend for each request put on the ring. Conversely the rsp_prod is a value incremented by the backend for each response put on the ring (rsp_prod gets set by rsp_prod_pvt when pushing the responses on the ring). Both values can wrap and are modulo the size of the ring (in block case that is 32). Please see RING_GET_REQUEST and RING_GET_RESPONSE for the more details. The culprit here is that if the difference between the req_prod and req_cons is greater than the ring size we have a problem. Fortunately for us, the '__do_block_io_op' loop: rc = blk_rings->common.req_cons; rp = blk_rings->common.sring->req_prod; while (rc != rp) { .. blk_rings->common.req_cons = ++rc; /* before make_response() */ } will loop up to the point when rc == rp. The macros inside of the loop (RING_GET_REQUEST) is smart and is indexing based on the modulo of the ring size. If the frontend has provided a bogus req_prod value we will loop until the 'rc == rp' - which means we could be processing already processed requests (or responses) often. The reason the RING_REQUEST_CONS_OVERFLOW is not helping here is b/c it only tracks how many responses we have internally produced and whether we would should process more. The astute reader will notice that the macro RING_REQUEST_CONS_OVERFLOW provides two arguments - more on this later. For example, if we were to enter this function with these values: blk_rings->common.sring->req_prod = X+31415 (X is the value from the last time __do_block_io_op was called). blk_rings->common.req_cons = X blk_rings->common.rsp_prod_pvt = X The RING_REQUEST_CONS_OVERFLOW(&blk_rings->common, blk_rings->common.req_cons) is doing: req_cons - rsp_prod_pvt >= 32 Which is, X - X >= 32 or 0 >= 32 And that is false, so we continue on looping (this bug). If we re-use said macro RING_REQUEST_CONS_OVERFLOW and pass in the rp instead (sring->req_prod) of rc, the this macro can do the check: req_prod - rsp_prov_pvt >= 32 Which is, X + 31415 - X >= 32 , or 31415 >= 32 which is true, so we can error out and break out of the function. Unfortunatly the difference between rsp_prov_pvt and req_prod can be at 32 (which would error out in the macro). This condition exists when the backend is lagging behind with the responses and still has not finished responding to all of them (so make_response has not been called), and the rsp_prov_pvt + 32 == req_cons. This ends up with us not being able to use said macro. Hence introducing a new macro called RING_REQUEST_PROD_OVERFLOW which does a simple check of: req_prod - rsp_prod_pvt > RING_SIZE And with the X values from above: X + 31415 - X > 32 Returns true. Also not that if the ring is full (which is where the RING_REQUEST_CONS_OVERFLOW triggered), we would not hit the same condition: X + 32 - X > 32 Which is false. Lets use that macro. Note that in v5 of this patchset the macro was different - we used an earlier version. Cc: stable@vger.kernel.org [v1: Move the check outside the loop] [v2: Add a pr_warn as suggested by David] [v3: Use RING_REQUEST_CONS_OVERFLOW as suggested by Jan] [v4: Move wake_up after kthread_stop as suggested by Jan] [v5: Use RING_REQUEST_PROD_OVERFLOW instead] [v6: Use RING_REQUEST_PROD_OVERFLOW - Jan's version] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> gadsa --- drivers/block/xen-blkback/blkback.c | 13 ++++++++++++- drivers/block/xen-blkback/common.h | 2 ++ drivers/block/xen-blkback/xenbus.c | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 4119bcdefd1a..ea158fe0c9a4 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -571,6 +571,7 @@ int xen_blkif_schedule(void *arg) struct xen_blkif *blkif = arg; struct xen_vbd *vbd = &blkif->vbd; unsigned long timeout; + int ret; xen_blkif_get(blkif); @@ -599,8 +600,12 @@ int xen_blkif_schedule(void *arg) blkif->waiting_reqs = 0; smp_mb(); /* clear flag *before* checking for work */ - if (do_block_io_op(blkif)) + ret = do_block_io_op(blkif); + if (ret > 0) blkif->waiting_reqs = 1; + if (ret == -EACCES) + wait_event_interruptible(blkif->shutdown_wq, + kthread_should_stop()); purge_gnt_list: if (blkif->vbd.feature_gnt_persistent && @@ -1009,6 +1014,12 @@ __do_block_io_op(struct xen_blkif *blkif) rp = blk_rings->common.sring->req_prod; rmb(); /* Ensure we see queued requests up to 'rp'. */ + if (RING_REQUEST_PROD_OVERFLOW(&blk_rings->common, rp)) { + rc = blk_rings->common.rsp_prod_pvt; + pr_warn(DRV_PFX "Frontend provided bogus ring requests (%d - %d = %d). Halting ring processing on dev=%04x\n", + rp, rc, rp - rc, blkif->vbd.pdevice); + return -EACCES; + } while (rc != rp) { if (RING_REQUEST_CONS_OVERFLOW(&blk_rings->common, rc)) diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index c6b4cb9af6c2..8d8807563d99 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -314,6 +314,8 @@ struct xen_blkif { unsigned long long st_wr_sect; wait_queue_head_t waiting_to_free; + /* Thread shutdown wait queue. */ + wait_queue_head_t shutdown_wq; }; struct seg_buf { diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 7b06f943371c..2e5b69d612ac 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -151,6 +151,7 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) } spin_lock_init(&blkif->pending_free_lock); init_waitqueue_head(&blkif->pending_free_wq); + init_waitqueue_head(&blkif->shutdown_wq); return blkif; @@ -231,6 +232,7 @@ static void xen_blkif_disconnect(struct xen_blkif *blkif) { if (blkif->xenblkd) { kthread_stop(blkif->xenblkd); + wake_up(&blkif->shutdown_wq); blkif->xenblkd = NULL; } From a3299ab18591d36ad5622f5064619123c439b779 Mon Sep 17 00:00:00 2001 From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Date: Tue, 18 Jun 2013 14:34:54 -0500 Subject: [PATCH 016/913] rsxx: Individual workqueues for interruptible events. Giving all interrupt based events their own workqueue to complete tasks on. This fixes a bug that would cause creg commands to timeout if too many are issued at once. Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/rsxx/core.c | 23 ++++++++++++++++++++--- drivers/block/rsxx/cregs.c | 5 +++++ drivers/block/rsxx/rsxx_priv.h | 2 ++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index 5af21f2db29c..774f810c6a9c 100644 --- a/drivers/block/rsxx/core.c +++ b/drivers/block/rsxx/core.c @@ -163,12 +163,13 @@ static irqreturn_t rsxx_isr(int irq, void *pdata) } if (isr & CR_INTR_CREG) { - schedule_work(&card->creg_ctrl.done_work); + queue_work(card->creg_ctrl.creg_wq, + &card->creg_ctrl.done_work); handled++; } if (isr & CR_INTR_EVENT) { - schedule_work(&card->event_work); + queue_work(card->event_wq, &card->event_work); rsxx_disable_ier_and_isr(card, CR_INTR_EVENT); handled++; } @@ -610,7 +611,11 @@ static int rsxx_pci_probe(struct pci_dev *dev, } /************* Setup Processor Command Interface *************/ - rsxx_creg_setup(card); + st = rsxx_creg_setup(card); + if (st) { + dev_err(CARD_TO_DEV(card), "Failed to setup creg interface.\n"); + goto failed_creg_setup; + } spin_lock_irq(&card->irq_lock); rsxx_enable_ier_and_isr(card, CR_INTR_CREG); @@ -650,6 +655,12 @@ static int rsxx_pci_probe(struct pci_dev *dev, } /************* Setup Card Event Handler *************/ + card->event_wq = create_singlethread_workqueue(DRIVER_NAME"_event"); + if (!card->event_wq) { + dev_err(CARD_TO_DEV(card), "Failed card event setup.\n"); + goto failed_event_handler; + } + INIT_WORK(&card->event_work, card_event_handler); st = rsxx_setup_dev(card); @@ -688,9 +699,15 @@ static int rsxx_pci_probe(struct pci_dev *dev, return 0; failed_create_dev: + destroy_workqueue(card->event_wq); + card->event_wq = NULL; +failed_event_handler: rsxx_dma_destroy(card); failed_dma_setup: failed_compatiblity_check: + destroy_workqueue(card->creg_ctrl.creg_wq); + card->creg_ctrl.creg_wq = NULL; +failed_creg_setup: spin_lock_irq(&card->irq_lock); rsxx_disable_ier_and_isr(card, CR_INTR_ALL); spin_unlock_irq(&card->irq_lock); diff --git a/drivers/block/rsxx/cregs.c b/drivers/block/rsxx/cregs.c index 4b5c020a0a65..4914464c19fc 100644 --- a/drivers/block/rsxx/cregs.c +++ b/drivers/block/rsxx/cregs.c @@ -727,6 +727,11 @@ int rsxx_creg_setup(struct rsxx_cardinfo *card) { card->creg_ctrl.active_cmd = NULL; + card->creg_ctrl.creg_wq = + create_singlethread_workqueue(DRIVER_NAME"_creg"); + if (!card->creg_ctrl.creg_wq) + return -ENOMEM; + INIT_WORK(&card->creg_ctrl.done_work, creg_cmd_done); mutex_init(&card->creg_ctrl.reset_lock); INIT_LIST_HEAD(&card->creg_ctrl.queue); diff --git a/drivers/block/rsxx/rsxx_priv.h b/drivers/block/rsxx/rsxx_priv.h index 382e8bf5c03b..0dd62d966772 100644 --- a/drivers/block/rsxx/rsxx_priv.h +++ b/drivers/block/rsxx/rsxx_priv.h @@ -134,6 +134,7 @@ struct rsxx_cardinfo { spinlock_t lock; bool active; struct creg_cmd *active_cmd; + struct workqueue_struct *creg_wq; struct work_struct done_work; struct list_head queue; unsigned int q_depth; @@ -154,6 +155,7 @@ struct rsxx_cardinfo { int buf_len; } log; + struct workqueue_struct *event_wq; struct work_struct event_work; unsigned int state; u64 size8; From 0ab4743ebc18c23bddf3e288cfc6221ec71533ac Mon Sep 17 00:00:00 2001 From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Date: Tue, 18 Jun 2013 14:36:26 -0500 Subject: [PATCH 017/913] rsxx: Restructured DMA cancel scheme. Before, DMAs would never be cancelled if there was a data stall or an EEH Permenant failure which would cause an unrecoverable I/O hang. The DMA cancellation mechanism has been modified to fix these issues and allows DMAs to be cancelled during the above mentioned events. Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/rsxx/core.c | 17 +++- drivers/block/rsxx/dev.c | 6 +- drivers/block/rsxx/dma.c | 161 +++++++++++++++------------------ drivers/block/rsxx/rsxx_priv.h | 4 +- 4 files changed, 95 insertions(+), 93 deletions(-) diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index 774f810c6a9c..aca3f198e5cd 100644 --- a/drivers/block/rsxx/core.c +++ b/drivers/block/rsxx/core.c @@ -368,15 +368,26 @@ static void rsxx_eeh_failure(struct pci_dev *dev) { struct rsxx_cardinfo *card = pci_get_drvdata(dev); int i; + int cnt = 0; dev_err(&dev->dev, "IBM FlashSystem PCI: disabling failed card.\n"); card->eeh_state = 1; + card->halt = 1; - for (i = 0; i < card->n_targets; i++) - del_timer_sync(&card->ctrl[i].activity_timer); + for (i = 0; i < card->n_targets; i++) { + spin_lock_bh(&card->ctrl[i].queue_lock); + cnt = rsxx_cleanup_dma_queue(&card->ctrl[i], + &card->ctrl[i].queue); + spin_unlock_bh(&card->ctrl[i].queue_lock); - rsxx_eeh_cancel_dmas(card); + cnt += rsxx_dma_cancel(&card->ctrl[i]); + + if (cnt) + dev_info(CARD_TO_DEV(card), + "Freed %d queued DMAs on channel %d\n", + cnt, card->ctrl[i].id); + } } static int rsxx_eeh_fifo_flush_poll(struct rsxx_cardinfo *card) diff --git a/drivers/block/rsxx/dev.c b/drivers/block/rsxx/dev.c index 4346d17d2949..604ad2dafa43 100644 --- a/drivers/block/rsxx/dev.c +++ b/drivers/block/rsxx/dev.c @@ -155,7 +155,8 @@ static void bio_dma_done_cb(struct rsxx_cardinfo *card, atomic_set(&meta->error, 1); if (atomic_dec_and_test(&meta->pending_dmas)) { - disk_stats_complete(card, meta->bio, meta->start_time); + if (!card->eeh_state && card->gendisk) + disk_stats_complete(card, meta->bio, meta->start_time); bio_endio(meta->bio, atomic_read(&meta->error) ? -EIO : 0); kmem_cache_free(bio_meta_pool, meta); @@ -196,7 +197,8 @@ static void rsxx_make_request(struct request_queue *q, struct bio *bio) atomic_set(&bio_meta->pending_dmas, 0); bio_meta->start_time = jiffies; - disk_stats_start(card, bio); + if (!unlikely(card->halt)) + disk_stats_start(card, bio); dev_dbg(CARD_TO_DEV(card), "BIO[%c]: meta: %p addr8: x%llx size: %d\n", bio_data_dir(bio) ? 'W' : 'R', bio_meta, diff --git a/drivers/block/rsxx/dma.c b/drivers/block/rsxx/dma.c index 0607513cfb41..213e40e4bd92 100644 --- a/drivers/block/rsxx/dma.c +++ b/drivers/block/rsxx/dma.c @@ -245,6 +245,22 @@ static void rsxx_complete_dma(struct rsxx_dma_ctrl *ctrl, kmem_cache_free(rsxx_dma_pool, dma); } +int rsxx_cleanup_dma_queue(struct rsxx_dma_ctrl *ctrl, + struct list_head *q) +{ + struct rsxx_dma *dma; + struct rsxx_dma *tmp; + int cnt = 0; + + list_for_each_entry_safe(dma, tmp, q, list) { + list_del(&dma->list); + rsxx_complete_dma(ctrl, dma, DMA_CANCELLED); + cnt++; + } + + return cnt; +} + static void rsxx_requeue_dma(struct rsxx_dma_ctrl *ctrl, struct rsxx_dma *dma) { @@ -252,9 +268,9 @@ static void rsxx_requeue_dma(struct rsxx_dma_ctrl *ctrl, * Requeued DMAs go to the front of the queue so they are issued * first. */ - spin_lock(&ctrl->queue_lock); + spin_lock_bh(&ctrl->queue_lock); list_add(&dma->list, &ctrl->queue); - spin_unlock(&ctrl->queue_lock); + spin_unlock_bh(&ctrl->queue_lock); } static void rsxx_handle_dma_error(struct rsxx_dma_ctrl *ctrl, @@ -329,6 +345,7 @@ static void rsxx_handle_dma_error(struct rsxx_dma_ctrl *ctrl, static void dma_engine_stalled(unsigned long data) { struct rsxx_dma_ctrl *ctrl = (struct rsxx_dma_ctrl *)data; + int cnt; if (atomic_read(&ctrl->stats.hw_q_depth) == 0 || unlikely(ctrl->card->eeh_state)) @@ -349,6 +366,18 @@ static void dma_engine_stalled(unsigned long data) "DMA channel %d has stalled, faulting interface.\n", ctrl->id); ctrl->card->dma_fault = 1; + + /* Clean up the DMA queue */ + spin_lock(&ctrl->queue_lock); + cnt = rsxx_cleanup_dma_queue(ctrl, &ctrl->queue); + spin_unlock(&ctrl->queue_lock); + + cnt += rsxx_dma_cancel(ctrl); + + if (cnt) + dev_info(CARD_TO_DEV(ctrl->card), + "Freed %d queued DMAs on channel %d\n", + cnt, ctrl->id); } } @@ -368,22 +397,22 @@ static void rsxx_issue_dmas(struct work_struct *work) return; while (1) { - spin_lock(&ctrl->queue_lock); + spin_lock_bh(&ctrl->queue_lock); if (list_empty(&ctrl->queue)) { - spin_unlock(&ctrl->queue_lock); + spin_unlock_bh(&ctrl->queue_lock); break; } - spin_unlock(&ctrl->queue_lock); + spin_unlock_bh(&ctrl->queue_lock); tag = pop_tracker(ctrl->trackers); if (tag == -1) break; - spin_lock(&ctrl->queue_lock); + spin_lock_bh(&ctrl->queue_lock); dma = list_entry(ctrl->queue.next, struct rsxx_dma, list); list_del(&dma->list); ctrl->stats.sw_q_depth--; - spin_unlock(&ctrl->queue_lock); + spin_unlock_bh(&ctrl->queue_lock); /* * This will catch any DMAs that slipped in right before the @@ -520,33 +549,10 @@ static void rsxx_dma_done(struct work_struct *work) rsxx_enable_ier(ctrl->card, CR_INTR_DMA(ctrl->id)); spin_unlock_irqrestore(&ctrl->card->irq_lock, flags); - spin_lock(&ctrl->queue_lock); + spin_lock_bh(&ctrl->queue_lock); if (ctrl->stats.sw_q_depth) queue_work(ctrl->issue_wq, &ctrl->issue_dma_work); - spin_unlock(&ctrl->queue_lock); -} - -static int rsxx_cleanup_dma_queue(struct rsxx_cardinfo *card, - struct list_head *q) -{ - struct rsxx_dma *dma; - struct rsxx_dma *tmp; - int cnt = 0; - - list_for_each_entry_safe(dma, tmp, q, list) { - list_del(&dma->list); - - if (dma->dma_addr) - pci_unmap_page(card->dev, dma->dma_addr, - get_dma_size(dma), - (dma->cmd == HW_CMD_BLK_WRITE) ? - PCI_DMA_TODEVICE : - PCI_DMA_FROMDEVICE); - kmem_cache_free(rsxx_dma_pool, dma); - cnt++; - } - - return cnt; + spin_unlock_bh(&ctrl->queue_lock); } static int rsxx_queue_discard(struct rsxx_cardinfo *card, @@ -698,10 +704,10 @@ int rsxx_dma_queue_bio(struct rsxx_cardinfo *card, for (i = 0; i < card->n_targets; i++) { if (!list_empty(&dma_list[i])) { - spin_lock(&card->ctrl[i].queue_lock); + spin_lock_bh(&card->ctrl[i].queue_lock); card->ctrl[i].stats.sw_q_depth += dma_cnt[i]; list_splice_tail(&dma_list[i], &card->ctrl[i].queue); - spin_unlock(&card->ctrl[i].queue_lock); + spin_unlock_bh(&card->ctrl[i].queue_lock); queue_work(card->ctrl[i].issue_wq, &card->ctrl[i].issue_dma_work); @@ -711,8 +717,11 @@ int rsxx_dma_queue_bio(struct rsxx_cardinfo *card, return 0; bvec_err: - for (i = 0; i < card->n_targets; i++) - rsxx_cleanup_dma_queue(card, &dma_list[i]); + for (i = 0; i < card->n_targets; i++) { + spin_lock_bh(&card->ctrl[i].queue_lock); + rsxx_cleanup_dma_queue(&card->ctrl[i], &dma_list[i]); + spin_unlock_bh(&card->ctrl[i].queue_lock); + } return st; } @@ -918,13 +927,30 @@ failed_dma_setup: return st; } +int rsxx_dma_cancel(struct rsxx_dma_ctrl *ctrl) +{ + struct rsxx_dma *dma; + int i; + int cnt = 0; + + /* Clean up issued DMAs */ + for (i = 0; i < RSXX_MAX_OUTSTANDING_CMDS; i++) { + dma = get_tracker_dma(ctrl->trackers, i); + if (dma) { + atomic_dec(&ctrl->stats.hw_q_depth); + rsxx_complete_dma(ctrl, dma, DMA_CANCELLED); + push_tracker(ctrl->trackers, i); + cnt++; + } + } + + return cnt; +} void rsxx_dma_destroy(struct rsxx_cardinfo *card) { struct rsxx_dma_ctrl *ctrl; - struct rsxx_dma *dma; - int i, j; - int cnt = 0; + int i; for (i = 0; i < card->n_targets; i++) { ctrl = &card->ctrl[i]; @@ -943,33 +969,11 @@ void rsxx_dma_destroy(struct rsxx_cardinfo *card) del_timer_sync(&ctrl->activity_timer); /* Clean up the DMA queue */ - spin_lock(&ctrl->queue_lock); - cnt = rsxx_cleanup_dma_queue(card, &ctrl->queue); - spin_unlock(&ctrl->queue_lock); + spin_lock_bh(&ctrl->queue_lock); + rsxx_cleanup_dma_queue(ctrl, &ctrl->queue); + spin_unlock_bh(&ctrl->queue_lock); - if (cnt) - dev_info(CARD_TO_DEV(card), - "Freed %d queued DMAs on channel %d\n", - cnt, i); - - /* Clean up issued DMAs */ - for (j = 0; j < RSXX_MAX_OUTSTANDING_CMDS; j++) { - dma = get_tracker_dma(ctrl->trackers, j); - if (dma) { - pci_unmap_page(card->dev, dma->dma_addr, - get_dma_size(dma), - (dma->cmd == HW_CMD_BLK_WRITE) ? - PCI_DMA_TODEVICE : - PCI_DMA_FROMDEVICE); - kmem_cache_free(rsxx_dma_pool, dma); - cnt++; - } - } - - if (cnt) - dev_info(CARD_TO_DEV(card), - "Freed %d pending DMAs on channel %d\n", - cnt, i); + rsxx_dma_cancel(ctrl); vfree(ctrl->trackers); @@ -1013,7 +1017,7 @@ int rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card) cnt++; } - spin_lock(&card->ctrl[i].queue_lock); + spin_lock_bh(&card->ctrl[i].queue_lock); list_splice(&issued_dmas[i], &card->ctrl[i].queue); atomic_sub(cnt, &card->ctrl[i].stats.hw_q_depth); @@ -1028,7 +1032,7 @@ int rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card) PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); } - spin_unlock(&card->ctrl[i].queue_lock); + spin_unlock_bh(&card->ctrl[i].queue_lock); } kfree(issued_dmas); @@ -1036,30 +1040,13 @@ int rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card) return 0; } -void rsxx_eeh_cancel_dmas(struct rsxx_cardinfo *card) -{ - struct rsxx_dma *dma; - struct rsxx_dma *tmp; - int i; - - for (i = 0; i < card->n_targets; i++) { - spin_lock(&card->ctrl[i].queue_lock); - list_for_each_entry_safe(dma, tmp, &card->ctrl[i].queue, list) { - list_del(&dma->list); - - rsxx_complete_dma(&card->ctrl[i], dma, DMA_CANCELLED); - } - spin_unlock(&card->ctrl[i].queue_lock); - } -} - int rsxx_eeh_remap_dmas(struct rsxx_cardinfo *card) { struct rsxx_dma *dma; int i; for (i = 0; i < card->n_targets; i++) { - spin_lock(&card->ctrl[i].queue_lock); + spin_lock_bh(&card->ctrl[i].queue_lock); list_for_each_entry(dma, &card->ctrl[i].queue, list) { dma->dma_addr = pci_map_page(card->dev, dma->page, dma->pg_off, get_dma_size(dma), @@ -1067,12 +1054,12 @@ int rsxx_eeh_remap_dmas(struct rsxx_cardinfo *card) PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); if (!dma->dma_addr) { - spin_unlock(&card->ctrl[i].queue_lock); + spin_unlock_bh(&card->ctrl[i].queue_lock); kmem_cache_free(rsxx_dma_pool, dma); return -ENOMEM; } } - spin_unlock(&card->ctrl[i].queue_lock); + spin_unlock_bh(&card->ctrl[i].queue_lock); } return 0; diff --git a/drivers/block/rsxx/rsxx_priv.h b/drivers/block/rsxx/rsxx_priv.h index 0dd62d966772..60b6ed6779ac 100644 --- a/drivers/block/rsxx/rsxx_priv.h +++ b/drivers/block/rsxx/rsxx_priv.h @@ -39,6 +39,7 @@ #include <linux/vmalloc.h> #include <linux/timer.h> #include <linux/ioctl.h> +#include <linux/delay.h> #include "rsxx.h" #include "rsxx_cfg.h" @@ -374,6 +375,8 @@ typedef void (*rsxx_dma_cb)(struct rsxx_cardinfo *card, int rsxx_dma_setup(struct rsxx_cardinfo *card); void rsxx_dma_destroy(struct rsxx_cardinfo *card); int rsxx_dma_init(void); +int rsxx_cleanup_dma_queue(struct rsxx_dma_ctrl *ctrl, struct list_head *q); +int rsxx_dma_cancel(struct rsxx_dma_ctrl *ctrl); void rsxx_dma_cleanup(void); void rsxx_dma_queue_reset(struct rsxx_cardinfo *card); int rsxx_dma_configure(struct rsxx_cardinfo *card); @@ -384,7 +387,6 @@ int rsxx_dma_queue_bio(struct rsxx_cardinfo *card, void *cb_data); int rsxx_hw_buffers_init(struct pci_dev *dev, struct rsxx_dma_ctrl *ctrl); int rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card); -void rsxx_eeh_cancel_dmas(struct rsxx_cardinfo *card); int rsxx_eeh_remap_dmas(struct rsxx_cardinfo *card); /***** cregs.c *****/ From 31a70bb4440c963e69ce210389d8119c70b5c39d Mon Sep 17 00:00:00 2001 From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Date: Tue, 18 Jun 2013 14:38:26 -0500 Subject: [PATCH 018/913] rsxx: Fixes soft-lockup issues during DMAs. The workqueue mechanism has been reworked to prevent soft lockup issues from occuring by adding in mutex sychronization. Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/rsxx/dma.c | 35 ++++++++++++++++++++++++++-------- drivers/block/rsxx/rsxx_priv.h | 1 + 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/drivers/block/rsxx/dma.c b/drivers/block/rsxx/dma.c index 213e40e4bd92..b485a65b8de1 100644 --- a/drivers/block/rsxx/dma.c +++ b/drivers/block/rsxx/dma.c @@ -381,15 +381,13 @@ static void dma_engine_stalled(unsigned long data) } } -static void rsxx_issue_dmas(struct work_struct *work) +static void rsxx_issue_dmas(struct rsxx_dma_ctrl *ctrl) { - struct rsxx_dma_ctrl *ctrl; struct rsxx_dma *dma; int tag; int cmds_pending = 0; struct hw_cmd *hw_cmd_buf; - ctrl = container_of(work, struct rsxx_dma_ctrl, issue_dma_work); hw_cmd_buf = ctrl->cmd.buf; if (unlikely(ctrl->card->halt) || @@ -469,9 +467,8 @@ static void rsxx_issue_dmas(struct work_struct *work) } } -static void rsxx_dma_done(struct work_struct *work) +static void rsxx_dma_done(struct rsxx_dma_ctrl *ctrl) { - struct rsxx_dma_ctrl *ctrl; struct rsxx_dma *dma; unsigned long flags; u16 count; @@ -479,7 +476,6 @@ static void rsxx_dma_done(struct work_struct *work) u8 tag; struct hw_status *hw_st_buf; - ctrl = container_of(work, struct rsxx_dma_ctrl, dma_done_work); hw_st_buf = ctrl->status.buf; if (unlikely(ctrl->card->halt) || @@ -555,6 +551,28 @@ static void rsxx_dma_done(struct work_struct *work) spin_unlock_bh(&ctrl->queue_lock); } +static void rsxx_schedule_issue(struct work_struct *work) +{ + struct rsxx_dma_ctrl *ctrl; + + ctrl = container_of(work, struct rsxx_dma_ctrl, issue_dma_work); + + mutex_lock(&ctrl->work_lock); + rsxx_issue_dmas(ctrl); + mutex_unlock(&ctrl->work_lock); +} + +static void rsxx_schedule_done(struct work_struct *work) +{ + struct rsxx_dma_ctrl *ctrl; + + ctrl = container_of(work, struct rsxx_dma_ctrl, dma_done_work); + + mutex_lock(&ctrl->work_lock); + rsxx_dma_done(ctrl); + mutex_unlock(&ctrl->work_lock); +} + static int rsxx_queue_discard(struct rsxx_cardinfo *card, struct list_head *q, unsigned int laddr, @@ -789,6 +807,7 @@ static int rsxx_dma_ctrl_init(struct pci_dev *dev, spin_lock_init(&ctrl->trackers->lock); spin_lock_init(&ctrl->queue_lock); + mutex_init(&ctrl->work_lock); INIT_LIST_HEAD(&ctrl->queue); setup_timer(&ctrl->activity_timer, dma_engine_stalled, @@ -802,8 +821,8 @@ static int rsxx_dma_ctrl_init(struct pci_dev *dev, if (!ctrl->done_wq) return -ENOMEM; - INIT_WORK(&ctrl->issue_dma_work, rsxx_issue_dmas); - INIT_WORK(&ctrl->dma_done_work, rsxx_dma_done); + INIT_WORK(&ctrl->issue_dma_work, rsxx_schedule_issue); + INIT_WORK(&ctrl->dma_done_work, rsxx_schedule_done); st = rsxx_hw_buffers_init(dev, ctrl); if (st) diff --git a/drivers/block/rsxx/rsxx_priv.h b/drivers/block/rsxx/rsxx_priv.h index 60b6ed6779ac..c968a6918b6e 100644 --- a/drivers/block/rsxx/rsxx_priv.h +++ b/drivers/block/rsxx/rsxx_priv.h @@ -115,6 +115,7 @@ struct rsxx_dma_ctrl { struct timer_list activity_timer; struct dma_tracker_list *trackers; struct rsxx_dma_stats stats; + struct mutex work_lock; }; struct rsxx_cardinfo { From 7b379cc3785bfa827249a265548a055e934eaaea Mon Sep 17 00:00:00 2001 From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Date: Tue, 18 Jun 2013 14:39:44 -0500 Subject: [PATCH 019/913] rsxx: Allow block size to be determined by configuration. Previously, the block size was determined by whether or not our Hardware could handle 512 byte accesses. Now, all of our Hardware can handle 512 and 4096 block sizes. This fix allows it to be user configurable. Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/rsxx/dev.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/block/rsxx/dev.c b/drivers/block/rsxx/dev.c index 604ad2dafa43..1fa7cccd6866 100644 --- a/drivers/block/rsxx/dev.c +++ b/drivers/block/rsxx/dev.c @@ -227,24 +227,6 @@ static bool rsxx_discard_supported(struct rsxx_cardinfo *card) return (pci_rev >= RSXX_DISCARD_SUPPORT); } -static unsigned short rsxx_get_logical_block_size( - struct rsxx_cardinfo *card) -{ - u32 capabilities = 0; - int st; - - st = rsxx_get_card_capabilities(card, &capabilities); - if (st) - dev_warn(CARD_TO_DEV(card), - "Failed reading card capabilities register\n"); - - /* Earlier firmware did not have support for 512 byte accesses */ - if (capabilities & CARD_CAP_SUBPAGE_WRITES) - return 512; - else - return RSXX_HW_BLK_SIZE; -} - int rsxx_attach_dev(struct rsxx_cardinfo *card) { mutex_lock(&card->dev_lock); @@ -307,7 +289,7 @@ int rsxx_setup_dev(struct rsxx_cardinfo *card) return -ENOMEM; } - blk_size = rsxx_get_logical_block_size(card); + blk_size = card->config.data.block_size; blk_queue_make_request(card->queue, rsxx_make_request); blk_queue_bounce_limit(card->queue, BLK_BOUNCE_ANY); From fb065cd9e0058551b08d6d32ff0494848c9e213d Mon Sep 17 00:00:00 2001 From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Date: Tue, 18 Jun 2013 14:42:36 -0500 Subject: [PATCH 020/913] rsxx: Adding in sync_start module paramenter. Before, the partition table would have to be reread because our card was attached before it transistioned out of it's 'starting' state. This change will cause the driver to wait to attach the device until the adapter is ready. Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/rsxx/core.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index aca3f198e5cd..0f1be41ccfa8 100644 --- a/drivers/block/rsxx/core.c +++ b/drivers/block/rsxx/core.c @@ -39,6 +39,7 @@ #include "rsxx_cfg.h" #define NO_LEGACY 0 +#define SYNC_START_TIMEOUT (10 * 60) /* 10 minutes */ MODULE_DESCRIPTION("IBM FlashSystem 70/80 PCIe SSD Device Driver"); MODULE_AUTHOR("Joshua Morris/Philip Kelleher, IBM"); @@ -49,6 +50,11 @@ static unsigned int force_legacy = NO_LEGACY; module_param(force_legacy, uint, 0444); MODULE_PARM_DESC(force_legacy, "Force the use of legacy type PCI interrupts"); +static unsigned int sync_start = 1; +module_param(sync_start, uint, 0444); +MODULE_PARM_DESC(sync_start, "On by Default: Driver load will not complete " + "until the card startup has completed."); + static DEFINE_IDA(rsxx_disk_ida); static DEFINE_SPINLOCK(rsxx_ida_lock); @@ -540,6 +546,7 @@ static int rsxx_pci_probe(struct pci_dev *dev, { struct rsxx_cardinfo *card; int st; + unsigned int sync_timeout; dev_info(&dev->dev, "PCI-Flash SSD discovered\n"); @@ -698,6 +705,33 @@ static int rsxx_pci_probe(struct pci_dev *dev, if (st) dev_crit(CARD_TO_DEV(card), "Failed issuing card startup\n"); + if (sync_start) { + sync_timeout = SYNC_START_TIMEOUT; + + dev_info(CARD_TO_DEV(card), + "Waiting for card to startup\n"); + + do { + ssleep(1); + sync_timeout--; + + rsxx_get_card_state(card, &card->state); + } while (sync_timeout && + (card->state == CARD_STATE_STARTING)); + + if (card->state == CARD_STATE_STARTING) { + dev_warn(CARD_TO_DEV(card), + "Card startup timed out\n"); + card->size8 = 0; + } else { + dev_info(CARD_TO_DEV(card), + "card state: %s\n", + rsxx_card_state_to_str(card->state)); + st = rsxx_get_card_size8(card, &card->size8); + if (st) + card->size8 = 0; + } + } } else if (card->state == CARD_STATE_GOOD || card->state == CARD_STATE_RD_ONLY_FAULT) { st = rsxx_get_card_size8(card, &card->size8); From f730e3dc6dc4698d55fd9bf6de33a5436900e9bd Mon Sep 17 00:00:00 2001 From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Date: Tue, 18 Jun 2013 14:43:58 -0500 Subject: [PATCH 021/913] rsxx: Changing the adapter name to the official name. Changing the adapter name from FlashSystem-80 to the official name: Flash Adapter 900GB Full Height. Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- MAINTAINERS | 2 +- drivers/block/Kconfig | 4 ++-- drivers/block/rsxx/core.c | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 3d7782b9f90d..75e52e341a67 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3297,7 +3297,7 @@ F: Documentation/firmware_class/ F: drivers/base/firmware*.c F: include/linux/firmware.h -FLASHSYSTEM DRIVER (IBM FlashSystem 70/80 PCI SSD Flash Card) +FLASH ADAPTER DRIVER (IBM Flash Adapter 900GB Full Height PCI Flash Card) M: Joshua Morris <josh.h.morris@us.ibm.com> M: Philip Kelleher <pjk1939@linux.vnet.ibm.com> S: Maintained diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index b81ddfea1da0..e07a5fd58ad7 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -532,11 +532,11 @@ config BLK_DEV_RBD If unsure, say N. config BLK_DEV_RSXX - tristate "IBM FlashSystem 70/80 PCIe SSD Device Driver" + tristate "IBM Flash Adapter 900GB Full Height PCIe Device Driver" depends on PCI help Device driver for IBM's high speed PCIe SSD - storage devices: FlashSystem-70 and FlashSystem-80. + storage device: Flash Adapter 900GB Full Height. To compile this driver as a module, choose M here: the module will be called rsxx. diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index 0f1be41ccfa8..bd763f426774 100644 --- a/drivers/block/rsxx/core.c +++ b/drivers/block/rsxx/core.c @@ -41,7 +41,7 @@ #define NO_LEGACY 0 #define SYNC_START_TIMEOUT (10 * 60) /* 10 minutes */ -MODULE_DESCRIPTION("IBM FlashSystem 70/80 PCIe SSD Device Driver"); +MODULE_DESCRIPTION("IBM Flash Adapter 900GB Full Height Device Driver"); MODULE_AUTHOR("Joshua Morris/Philip Kelleher, IBM"); MODULE_LICENSE("GPL"); MODULE_VERSION(DRIVER_VERSION); @@ -336,7 +336,7 @@ static int rsxx_eeh_frozen(struct pci_dev *dev) int i; int st; - dev_warn(&dev->dev, "IBM FlashSystem PCI: preparing for slot reset.\n"); + dev_warn(&dev->dev, "IBM Flash Adapter PCI: preparing for slot reset.\n"); card->eeh_state = 1; rsxx_mask_interrupts(card); @@ -376,7 +376,7 @@ static void rsxx_eeh_failure(struct pci_dev *dev) int i; int cnt = 0; - dev_err(&dev->dev, "IBM FlashSystem PCI: disabling failed card.\n"); + dev_err(&dev->dev, "IBM Flash Adapter PCI: disabling failed card.\n"); card->eeh_state = 1; card->halt = 1; @@ -450,7 +450,7 @@ static pci_ers_result_t rsxx_slot_reset(struct pci_dev *dev) int st; dev_warn(&dev->dev, - "IBM FlashSystem PCI: recovering from slot reset.\n"); + "IBM Flash Adapter PCI: recovering from slot reset.\n"); st = pci_enable_device(dev); if (st) @@ -503,7 +503,7 @@ static pci_ers_result_t rsxx_slot_reset(struct pci_dev *dev) &card->ctrl[i].issue_dma_work); } - dev_info(&dev->dev, "IBM FlashSystem PCI: recovery complete.\n"); + dev_info(&dev->dev, "IBM Flash Adapter PCI: recovery complete.\n"); return PCI_ERS_RESULT_RECOVERED; From 66bc600363acd0acae84e878e5a06e7b7a38c014 Mon Sep 17 00:00:00 2001 From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Date: Tue, 18 Jun 2013 14:46:04 -0500 Subject: [PATCH 022/913] rsxx: Fixes DLPAR add kernel panic if partition still mounted. A kernel panic would occur on a DLPAR add if there was a partition still mounted during the DLPAR remove. This bug fix will allow the user to unmount the partition and bring the driver back into a good state after the DLPAR add. Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/rsxx/dev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/block/rsxx/dev.c b/drivers/block/rsxx/dev.c index 1fa7cccd6866..a092f58db212 100644 --- a/drivers/block/rsxx/dev.c +++ b/drivers/block/rsxx/dev.c @@ -171,6 +171,9 @@ static void rsxx_make_request(struct request_queue *q, struct bio *bio) might_sleep(); + if (!card) + goto req_err; + if (unlikely(card->halt)) { st = -EFAULT; goto req_err; @@ -331,6 +334,7 @@ void rsxx_destroy_dev(struct rsxx_cardinfo *card) card->gendisk = NULL; blk_cleanup_queue(card->queue); + card->queue->queuedata = NULL; unregister_blkdev(card->major, DRIVER_NAME); } From 3eb8dcafb5a73041e2f3b4a39c057a58e4354d83 Mon Sep 17 00:00:00 2001 From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Date: Tue, 18 Jun 2013 14:48:38 -0500 Subject: [PATCH 023/913] rsxx: Adapter address space sanity check. Adding a sanity check to guarentee that DMAs outside of the device's address space will be errored out right away. Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/rsxx/dev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/block/rsxx/dev.c b/drivers/block/rsxx/dev.c index a092f58db212..d7af441880be 100644 --- a/drivers/block/rsxx/dev.c +++ b/drivers/block/rsxx/dev.c @@ -174,6 +174,9 @@ static void rsxx_make_request(struct request_queue *q, struct bio *bio) if (!card) goto req_err; + if (bio->bi_sector + (bio->bi_size >> 9) > get_capacity(card->gendisk)) + goto req_err; + if (unlikely(card->halt)) { st = -EFAULT; goto req_err; From b8b225da139f5770d7689b189fd5debc58f4b35d Mon Sep 17 00:00:00 2001 From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Date: Tue, 18 Jun 2013 14:49:48 -0500 Subject: [PATCH 024/913] rsxx: Adding EEH check inside cregs timeout. Unfortunaly, our CPU register path does not do any kind of EEH error checking. So to fix this issue, an ioread32 was added to the CPU register timeout code. This way, the driver can check to see if the timeout was caused by an EEH error or not. This is a dummy read. Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/rsxx/cregs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/block/rsxx/cregs.c b/drivers/block/rsxx/cregs.c index 4914464c19fc..926dce9c452f 100644 --- a/drivers/block/rsxx/cregs.c +++ b/drivers/block/rsxx/cregs.c @@ -431,6 +431,15 @@ static int __issue_creg_rw(struct rsxx_cardinfo *card, *hw_stat = completion.creg_status; if (completion.st) { + /* + * This read is needed to verify that there has not been any + * extreme errors that might have occurred, i.e. EEH. The + * function iowrite32 will not detect EEH errors, so it is + * necessary that we recover if such an error is the reason + * for the timeout. This is a dummy read. + */ + ioread32(card->regmap + SCRATCH); + dev_warn(CARD_TO_DEV(card), "creg command failed(%d x%08x)\n", completion.st, addr); From 62302508f2986720ad73494dd8037dff1c4f77d1 Mon Sep 17 00:00:00 2001 From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Date: Tue, 18 Jun 2013 14:50:48 -0500 Subject: [PATCH 025/913] rsxx: Fixes incorrect stats calculation. Fixing incorrect stats calculation during read retries. Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/rsxx/dma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/rsxx/dma.c b/drivers/block/rsxx/dma.c index b485a65b8de1..bed32f16b084 100644 --- a/drivers/block/rsxx/dma.c +++ b/drivers/block/rsxx/dma.c @@ -269,6 +269,7 @@ static void rsxx_requeue_dma(struct rsxx_dma_ctrl *ctrl, * first. */ spin_lock_bh(&ctrl->queue_lock); + ctrl->stats.sw_q_depth++; list_add(&dma->list, &ctrl->queue); spin_unlock_bh(&ctrl->queue_lock); } From 36f988e978f81ffa415df4d77bbcd8887917f25c Mon Sep 17 00:00:00 2001 From: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Date: Tue, 18 Jun 2013 14:52:21 -0500 Subject: [PATCH 026/913] rsxx: Adding in debugfs entries. Adding debugfs entries to help with debugging and testing and testing code. pci_regs: This entry will spit out all of the data stored on the BAR. stats: This entry will display all of the driver stats for each DMA channel. cram: This will allow read/write ability to the CRAM address space on our adapter's CPU. Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/rsxx/core.c | 275 +++++++++++++++++++++++++++++++++ drivers/block/rsxx/rsxx_priv.h | 3 + 2 files changed, 278 insertions(+) diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index bd763f426774..6e85e21445eb 100644 --- a/drivers/block/rsxx/core.c +++ b/drivers/block/rsxx/core.c @@ -31,6 +31,8 @@ #include <linux/slab.h> #include <linux/bitops.h> #include <linux/delay.h> +#include <linux/debugfs.h> +#include <linux/seq_file.h> #include <linux/genhd.h> #include <linux/idr.h> @@ -58,6 +60,274 @@ MODULE_PARM_DESC(sync_start, "On by Default: Driver load will not complete " static DEFINE_IDA(rsxx_disk_ida); static DEFINE_SPINLOCK(rsxx_ida_lock); +/* --------------------Debugfs Setup ------------------- */ + +struct rsxx_cram { + u32 f_pos; + u32 offset; + void *i_private; +}; + +static int rsxx_attr_pci_regs_show(struct seq_file *m, void *p) +{ + struct rsxx_cardinfo *card = m->private; + + seq_printf(m, "HWID 0x%08x\n", + ioread32(card->regmap + HWID)); + seq_printf(m, "SCRATCH 0x%08x\n", + ioread32(card->regmap + SCRATCH)); + seq_printf(m, "IER 0x%08x\n", + ioread32(card->regmap + IER)); + seq_printf(m, "IPR 0x%08x\n", + ioread32(card->regmap + IPR)); + seq_printf(m, "CREG_CMD 0x%08x\n", + ioread32(card->regmap + CREG_CMD)); + seq_printf(m, "CREG_ADD 0x%08x\n", + ioread32(card->regmap + CREG_ADD)); + seq_printf(m, "CREG_CNT 0x%08x\n", + ioread32(card->regmap + CREG_CNT)); + seq_printf(m, "CREG_STAT 0x%08x\n", + ioread32(card->regmap + CREG_STAT)); + seq_printf(m, "CREG_DATA0 0x%08x\n", + ioread32(card->regmap + CREG_DATA0)); + seq_printf(m, "CREG_DATA1 0x%08x\n", + ioread32(card->regmap + CREG_DATA1)); + seq_printf(m, "CREG_DATA2 0x%08x\n", + ioread32(card->regmap + CREG_DATA2)); + seq_printf(m, "CREG_DATA3 0x%08x\n", + ioread32(card->regmap + CREG_DATA3)); + seq_printf(m, "CREG_DATA4 0x%08x\n", + ioread32(card->regmap + CREG_DATA4)); + seq_printf(m, "CREG_DATA5 0x%08x\n", + ioread32(card->regmap + CREG_DATA5)); + seq_printf(m, "CREG_DATA6 0x%08x\n", + ioread32(card->regmap + CREG_DATA6)); + seq_printf(m, "CREG_DATA7 0x%08x\n", + ioread32(card->regmap + CREG_DATA7)); + seq_printf(m, "INTR_COAL 0x%08x\n", + ioread32(card->regmap + INTR_COAL)); + seq_printf(m, "HW_ERROR 0x%08x\n", + ioread32(card->regmap + HW_ERROR)); + seq_printf(m, "DEBUG0 0x%08x\n", + ioread32(card->regmap + PCI_DEBUG0)); + seq_printf(m, "DEBUG1 0x%08x\n", + ioread32(card->regmap + PCI_DEBUG1)); + seq_printf(m, "DEBUG2 0x%08x\n", + ioread32(card->regmap + PCI_DEBUG2)); + seq_printf(m, "DEBUG3 0x%08x\n", + ioread32(card->regmap + PCI_DEBUG3)); + seq_printf(m, "DEBUG4 0x%08x\n", + ioread32(card->regmap + PCI_DEBUG4)); + seq_printf(m, "DEBUG5 0x%08x\n", + ioread32(card->regmap + PCI_DEBUG5)); + seq_printf(m, "DEBUG6 0x%08x\n", + ioread32(card->regmap + PCI_DEBUG6)); + seq_printf(m, "DEBUG7 0x%08x\n", + ioread32(card->regmap + PCI_DEBUG7)); + seq_printf(m, "RECONFIG 0x%08x\n", + ioread32(card->regmap + PCI_RECONFIG)); + + return 0; +} + +static int rsxx_attr_stats_show(struct seq_file *m, void *p) +{ + struct rsxx_cardinfo *card = m->private; + int i; + + for (i = 0; i < card->n_targets; i++) { + seq_printf(m, "Ctrl %d CRC Errors = %d\n", + i, card->ctrl[i].stats.crc_errors); + seq_printf(m, "Ctrl %d Hard Errors = %d\n", + i, card->ctrl[i].stats.hard_errors); + seq_printf(m, "Ctrl %d Soft Errors = %d\n", + i, card->ctrl[i].stats.soft_errors); + seq_printf(m, "Ctrl %d Writes Issued = %d\n", + i, card->ctrl[i].stats.writes_issued); + seq_printf(m, "Ctrl %d Writes Failed = %d\n", + i, card->ctrl[i].stats.writes_failed); + seq_printf(m, "Ctrl %d Reads Issued = %d\n", + i, card->ctrl[i].stats.reads_issued); + seq_printf(m, "Ctrl %d Reads Failed = %d\n", + i, card->ctrl[i].stats.reads_failed); + seq_printf(m, "Ctrl %d Reads Retried = %d\n", + i, card->ctrl[i].stats.reads_retried); + seq_printf(m, "Ctrl %d Discards Issued = %d\n", + i, card->ctrl[i].stats.discards_issued); + seq_printf(m, "Ctrl %d Discards Failed = %d\n", + i, card->ctrl[i].stats.discards_failed); + seq_printf(m, "Ctrl %d DMA SW Errors = %d\n", + i, card->ctrl[i].stats.dma_sw_err); + seq_printf(m, "Ctrl %d DMA HW Faults = %d\n", + i, card->ctrl[i].stats.dma_hw_fault); + seq_printf(m, "Ctrl %d DMAs Cancelled = %d\n", + i, card->ctrl[i].stats.dma_cancelled); + seq_printf(m, "Ctrl %d SW Queue Depth = %d\n", + i, card->ctrl[i].stats.sw_q_depth); + seq_printf(m, "Ctrl %d HW Queue Depth = %d\n", + i, atomic_read(&card->ctrl[i].stats.hw_q_depth)); + } + + return 0; +} + +static int rsxx_attr_stats_open(struct inode *inode, struct file *file) +{ + return single_open(file, rsxx_attr_stats_show, inode->i_private); +} + +static int rsxx_attr_pci_regs_open(struct inode *inode, struct file *file) +{ + return single_open(file, rsxx_attr_pci_regs_show, inode->i_private); +} + +static ssize_t rsxx_cram_read(struct file *fp, char __user *ubuf, + size_t cnt, loff_t *ppos) +{ + struct rsxx_cram *info = fp->private_data; + struct rsxx_cardinfo *card = info->i_private; + char *buf; + int st; + + buf = kzalloc(sizeof(*buf) * cnt, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + info->f_pos = (u32)*ppos + info->offset; + + st = rsxx_creg_read(card, CREG_ADD_CRAM + info->f_pos, cnt, buf, 1); + if (st) + return st; + + st = copy_to_user(ubuf, buf, cnt); + if (st) + return st; + + info->offset += cnt; + + kfree(buf); + + return cnt; +} + +static ssize_t rsxx_cram_write(struct file *fp, const char __user *ubuf, + size_t cnt, loff_t *ppos) +{ + struct rsxx_cram *info = fp->private_data; + struct rsxx_cardinfo *card = info->i_private; + char *buf; + int st; + + buf = kzalloc(sizeof(*buf) * cnt, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + st = copy_from_user(buf, ubuf, cnt); + if (st) + return st; + + info->f_pos = (u32)*ppos + info->offset; + + st = rsxx_creg_write(card, CREG_ADD_CRAM + info->f_pos, cnt, buf, 1); + if (st) + return st; + + info->offset += cnt; + + kfree(buf); + + return cnt; +} + +static int rsxx_cram_open(struct inode *inode, struct file *file) +{ + struct rsxx_cram *info = kzalloc(sizeof(*info), GFP_KERNEL); + if (!info) + return -ENOMEM; + + info->i_private = inode->i_private; + info->f_pos = file->f_pos; + file->private_data = info; + + return 0; +} + +static int rsxx_cram_release(struct inode *inode, struct file *file) +{ + struct rsxx_cram *info = file->private_data; + + if (!info) + return 0; + + kfree(info); + file->private_data = NULL; + + return 0; +} + +static const struct file_operations debugfs_cram_fops = { + .owner = THIS_MODULE, + .open = rsxx_cram_open, + .read = rsxx_cram_read, + .write = rsxx_cram_write, + .release = rsxx_cram_release, +}; + +static const struct file_operations debugfs_stats_fops = { + .owner = THIS_MODULE, + .open = rsxx_attr_stats_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations debugfs_pci_regs_fops = { + .owner = THIS_MODULE, + .open = rsxx_attr_pci_regs_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static void rsxx_debugfs_dev_new(struct rsxx_cardinfo *card) +{ + struct dentry *debugfs_stats; + struct dentry *debugfs_pci_regs; + struct dentry *debugfs_cram; + + card->debugfs_dir = debugfs_create_dir(card->gendisk->disk_name, NULL); + if (IS_ERR_OR_NULL(card->debugfs_dir)) + goto failed_debugfs_dir; + + debugfs_stats = debugfs_create_file("stats", S_IRUGO, + card->debugfs_dir, card, + &debugfs_stats_fops); + if (IS_ERR_OR_NULL(debugfs_stats)) + goto failed_debugfs_stats; + + debugfs_pci_regs = debugfs_create_file("pci_regs", S_IRUGO, + card->debugfs_dir, card, + &debugfs_pci_regs_fops); + if (IS_ERR_OR_NULL(debugfs_pci_regs)) + goto failed_debugfs_pci_regs; + + debugfs_cram = debugfs_create_file("cram", S_IRUGO | S_IWUSR, + card->debugfs_dir, card, + &debugfs_cram_fops); + if (IS_ERR_OR_NULL(debugfs_cram)) + goto failed_debugfs_cram; + + return; +failed_debugfs_cram: + debugfs_remove(debugfs_pci_regs); +failed_debugfs_pci_regs: + debugfs_remove(debugfs_stats); +failed_debugfs_stats: + debugfs_remove(card->debugfs_dir); +failed_debugfs_dir: + card->debugfs_dir = NULL; +} + /*----------------- Interrupt Control & Handling -------------------*/ static void rsxx_mask_interrupts(struct rsxx_cardinfo *card) @@ -741,6 +1011,9 @@ static int rsxx_pci_probe(struct pci_dev *dev, rsxx_attach_dev(card); + /************* Setup Debugfs *************/ + rsxx_debugfs_dev_new(card); + return 0; failed_create_dev: @@ -818,6 +1091,8 @@ static void rsxx_pci_remove(struct pci_dev *dev) /* Prevent work_structs from re-queuing themselves. */ card->halt = 1; + debugfs_remove_recursive(card->debugfs_dir); + free_irq(dev->irq, card); if (!force_legacy) diff --git a/drivers/block/rsxx/rsxx_priv.h b/drivers/block/rsxx/rsxx_priv.h index c968a6918b6e..5ad5055a4104 100644 --- a/drivers/block/rsxx/rsxx_priv.h +++ b/drivers/block/rsxx/rsxx_priv.h @@ -185,6 +185,8 @@ struct rsxx_cardinfo { int n_targets; struct rsxx_dma_ctrl *ctrl; + + struct dentry *debugfs_dir; }; enum rsxx_pci_regmap { @@ -287,6 +289,7 @@ enum rsxx_creg_addr { CREG_ADD_CAPABILITIES = 0x80001050, CREG_ADD_LOG = 0x80002000, CREG_ADD_NUM_TARGETS = 0x80003000, + CREG_ADD_CRAM = 0xA0000000, CREG_ADD_CONFIG = 0xB0000000, }; From 2d9105433ff471d2c688817e98804029c074a623 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Fri, 21 Jun 2013 12:56:53 +0200 Subject: [PATCH 027/913] xen-blkback: workaround compiler bug in gcc 4.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code generat with gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54) creates an unbound loop for the second foreach_grant_safe loop in purge_persistent_gnt. The workaround is to avoid having this second loop and instead perform all the work inside the first loop by adding a new variable, clean_used, that will be set when all the desired persistent grants have been removed and we need to iterate over the remaining ones to remove the WAS_ACTIVE flag. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reported-by: Tom O'Neill <toneill@vmem.com> Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/block/xen-blkback/blkback.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index ea158fe0c9a4..4662217c61be 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -341,7 +341,7 @@ static void purge_persistent_gnt(struct xen_blkif *blkif) struct persistent_gnt *persistent_gnt; struct rb_node *n; unsigned int num_clean, total; - bool scan_used = false; + bool scan_used = false, clean_used = false; struct rb_root *root; if (blkif->persistent_gnt_c < xen_blkif_max_pgrants || @@ -358,9 +358,8 @@ static void purge_persistent_gnt(struct xen_blkif *blkif) num_clean = (xen_blkif_max_pgrants / 100) * LRU_PERCENT_CLEAN; num_clean = blkif->persistent_gnt_c - xen_blkif_max_pgrants + num_clean; num_clean = min(blkif->persistent_gnt_c, num_clean); - if (num_clean > - (blkif->persistent_gnt_c - - atomic_read(&blkif->persistent_gnt_in_use))) + if ((num_clean == 0) || + (num_clean > (blkif->persistent_gnt_c - atomic_read(&blkif->persistent_gnt_in_use)))) return; /* @@ -383,6 +382,11 @@ purge_list: BUG_ON(persistent_gnt->handle == BLKBACK_INVALID_HANDLE); + if (clean_used) { + clear_bit(PERSISTENT_GNT_WAS_ACTIVE, persistent_gnt->flags); + continue; + } + if (test_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags)) continue; if (!scan_used && @@ -400,18 +404,18 @@ purge_list: * grants that were used since last purge in order to cope * with the requested num */ - if (!scan_used) { + if (!scan_used && !clean_used) { pr_debug(DRV_PFX "Still missing %u purged frames\n", num_clean); scan_used = true; goto purge_list; } finished: - /* Remove the "used" flag from all the persistent grants */ - foreach_grant_safe(persistent_gnt, n, root, node) { - BUG_ON(persistent_gnt->handle == - BLKBACK_INVALID_HANDLE); - clear_bit(PERSISTENT_GNT_WAS_ACTIVE, persistent_gnt->flags); + if (!clean_used) { + pr_debug(DRV_PFX "Finished scanning for grants to clean, removing used flag\n"); + clean_used = true; + goto purge_list; } + blkif->persistent_gnt_c -= (total - num_clean); blkif->vbd.overflow_max_grants = 0; From 294caaf29c26cfed3b446fb46393b8b39ea1c0d3 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Fri, 21 Jun 2013 12:56:54 +0200 Subject: [PATCH 028/913] xen-blkfront: set blk_queue_max_hw_sectors correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that indirect segments are enabled blk_queue_max_hw_sectors must be set to match the maximum number of sectors we can handle in a request. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reported-by: Felipe Franciosi <felipe.franciosi@citrix.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/block/xen-blkfront.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 1a0f67c10ec7..2e1ee348ffe1 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -633,7 +633,7 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size, /* Hard sector size and max sectors impersonate the equiv. hardware. */ blk_queue_logical_block_size(rq, sector_size); blk_queue_physical_block_size(rq, physical_sector_size); - blk_queue_max_hw_sectors(rq, 512); + blk_queue_max_hw_sectors(rq, (segments * PAGE_SIZE) / 512); /* Each segment in a request is up to an aligned page in size. */ blk_queue_segment_boundary(rq, PAGE_SIZE - 1); From 1e0f7a21b2fffc70f27cc4a454c60321501045b1 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Sat, 22 Jun 2013 09:59:17 +0200 Subject: [PATCH 029/913] xen-blkback: check the number of iovecs before allocating a bios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the introduction of indirect segments we can receive requests with a number of segments bigger than the maximum number of allowed iovecs in a bios, so make sure that blkback doesn't try to allocate a bios with more iovecs than BIO_MAX_PAGES Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/block/xen-blkback/blkback.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 4662217c61be..bf4b9d282c04 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -1247,7 +1247,8 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, seg[i].nsec << 9, seg[i].offset) == 0)) { - bio = bio_alloc(GFP_KERNEL, nseg-i); + int nr_iovecs = min_t(int, (nseg-i), BIO_MAX_PAGES); + bio = bio_alloc(GFP_KERNEL, nr_iovecs); if (unlikely(bio == NULL)) goto fail_put_bio; From 5c694129c8db6d89c9be109049a16510b2f70f6d Mon Sep 17 00:00:00 2001 From: Kumar Amit Mehta <gmate.amit@gmail.com> Date: Tue, 28 May 2013 00:31:15 -0700 Subject: [PATCH 030/913] md: bcache: io.c: fix a potential NULL pointer dereference bio_alloc_bioset returns NULL on failure. This fix adds a missing check for potential NULL pointer dereferencing. Signed-off-by: Kumar Amit Mehta <gmate.amit@gmail.com> Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c index 48efd4dea645..d285cd49104c 100644 --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c @@ -97,6 +97,8 @@ struct bio *bch_bio_split(struct bio *bio, int sectors, if (bio->bi_rw & REQ_DISCARD) { ret = bio_alloc_bioset(gfp, 1, bs); + if (!ret) + return NULL; idx = 0; goto out; } From bbc77aa7fb72e616edcb1b165c293e47c6d4d0cf Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Tue, 28 May 2013 21:53:19 -0700 Subject: [PATCH 031/913] bcache: fix a spurious gcc complaint, use scnprintf An old version of gcc was complaining about using a const int as the size of a stack allocated array. Which should be fine - but using ARRAY_SIZE() is better, anyways. Also, refactor the code to use scnprintf(). Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/sysfs.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index 4d9cca47e4c6..29228b8a6ffe 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -665,12 +665,10 @@ SHOW(__bch_cache) int cmp(const void *l, const void *r) { return *((uint16_t *) r) - *((uint16_t *) l); } - /* Number of quantiles we compute */ - const unsigned nq = 31; - size_t n = ca->sb.nbuckets, i, unused, btree; uint64_t sum = 0; - uint16_t q[nq], *p, *cached; + /* Compute 31 quantiles */ + uint16_t q[31], *p, *cached; ssize_t ret; cached = p = vmalloc(ca->sb.nbuckets * sizeof(uint16_t)); @@ -703,26 +701,29 @@ SHOW(__bch_cache) if (n) do_div(sum, n); - for (i = 0; i < nq; i++) - q[i] = INITIAL_PRIO - cached[n * (i + 1) / (nq + 1)]; + for (i = 0; i < ARRAY_SIZE(q); i++) + q[i] = INITIAL_PRIO - cached[n * (i + 1) / + (ARRAY_SIZE(q) + 1)]; vfree(p); - ret = snprintf(buf, PAGE_SIZE, - "Unused: %zu%%\n" - "Metadata: %zu%%\n" - "Average: %llu\n" - "Sectors per Q: %zu\n" - "Quantiles: [", - unused * 100 / (size_t) ca->sb.nbuckets, - btree * 100 / (size_t) ca->sb.nbuckets, sum, - n * ca->sb.bucket_size / (nq + 1)); + ret = scnprintf(buf, PAGE_SIZE, + "Unused: %zu%%\n" + "Metadata: %zu%%\n" + "Average: %llu\n" + "Sectors per Q: %zu\n" + "Quantiles: [", + unused * 100 / (size_t) ca->sb.nbuckets, + btree * 100 / (size_t) ca->sb.nbuckets, sum, + n * ca->sb.bucket_size / (ARRAY_SIZE(q) + 1)); - for (i = 0; i < nq && ret < (ssize_t) PAGE_SIZE; i++) - ret += snprintf(buf + ret, PAGE_SIZE - ret, - i < nq - 1 ? "%u " : "%u]\n", q[i]); + for (i = 0; i < ARRAY_SIZE(q); i++) + ret += scnprintf(buf + ret, PAGE_SIZE - ret, + "%u ", q[i]); + ret--; + + ret += scnprintf(buf + ret, PAGE_SIZE - ret, "]\n"); - buf[PAGE_SIZE - 1] = '\0'; return ret; } From a9dd53adbb84c12f769a862ba2c80404873c2c99 Mon Sep 17 00:00:00 2001 From: Gabriel de Perthuis <g2p.code@gmail.com> Date: Sat, 4 May 2013 12:19:41 +0200 Subject: [PATCH 032/913] bcache: Warn when a device is already registered. Signed-off-by: Gabriel de Perthuis <g2p.code+bcache@gmail.com> Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/super.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index f88e2b653a3f..3de5626919ef 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1786,6 +1786,36 @@ static ssize_t register_bcache(struct kobject *, struct kobj_attribute *, kobj_attribute_write(register, register_bcache); kobj_attribute_write(register_quiet, register_bcache); +static bool bch_is_open_backing(struct block_device *bdev) { + struct cache_set *c, *tc; + struct cached_dev *dc, *t; + + list_for_each_entry_safe(c, tc, &bch_cache_sets, list) + list_for_each_entry_safe(dc, t, &c->cached_devs, list) + if (dc->bdev == bdev) + return true; + list_for_each_entry_safe(dc, t, &uncached_devices, list) + if (dc->bdev == bdev) + return true; + return false; +} + +static bool bch_is_open_cache(struct block_device *bdev) { + struct cache_set *c, *tc; + struct cache *ca; + unsigned i; + + list_for_each_entry_safe(c, tc, &bch_cache_sets, list) + for_each_cache(ca, c, i) + if (ca->bdev == bdev) + return true; + return false; +} + +static bool bch_is_open(struct block_device *bdev) { + return bch_is_open_cache(bdev) || bch_is_open_backing(bdev); +} + static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, const char *buffer, size_t size) { @@ -1810,8 +1840,13 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, FMODE_READ|FMODE_WRITE|FMODE_EXCL, sb); if (IS_ERR(bdev)) { - if (bdev == ERR_PTR(-EBUSY)) - err = "device busy"; + if (bdev == ERR_PTR(-EBUSY)) { + bdev = lookup_bdev(strim(path)); + if (!IS_ERR(bdev) && bch_is_open(bdev)) + err = "device already registered"; + else + err = "device busy"; + } goto err; } From 119ba0f82839cd80eaef3e6991988f1403965d5b Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Wed, 24 Apr 2013 19:01:12 -0700 Subject: [PATCH 033/913] bcache: Convert allocator thread to kthread Using a workqueue when we just want a single thread is a bit silly. Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/alloc.c | 34 ++++++++++++++++++++++------------ drivers/md/bcache/bcache.h | 17 +++++++++++------ drivers/md/bcache/btree.c | 6 +++--- drivers/md/bcache/super.c | 19 +++++++------------ 4 files changed, 43 insertions(+), 33 deletions(-) diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c index 048f2947e08b..38428f46ea74 100644 --- a/drivers/md/bcache/alloc.c +++ b/drivers/md/bcache/alloc.c @@ -63,6 +63,7 @@ #include "bcache.h" #include "btree.h" +#include <linux/kthread.h> #include <linux/random.h> #define MAX_IN_FLIGHT_DISCARDS 8U @@ -151,7 +152,7 @@ static void discard_finish(struct work_struct *w) mutex_unlock(&ca->set->bucket_lock); closure_wake_up(&ca->set->bucket_wait); - wake_up(&ca->set->alloc_wait); + wake_up_process(ca->alloc_thread); closure_put(&ca->set->cl); } @@ -358,30 +359,26 @@ static void invalidate_buckets(struct cache *ca) #define allocator_wait(ca, cond) \ do { \ - DEFINE_WAIT(__wait); \ - \ while (1) { \ - prepare_to_wait(&ca->set->alloc_wait, \ - &__wait, TASK_INTERRUPTIBLE); \ + set_current_state(TASK_INTERRUPTIBLE); \ if (cond) \ break; \ \ mutex_unlock(&(ca)->set->bucket_lock); \ if (test_bit(CACHE_SET_STOPPING_2, &ca->set->flags)) { \ - finish_wait(&ca->set->alloc_wait, &__wait); \ - closure_return(cl); \ + closure_put(&ca->set->cl); \ + return 0; \ } \ \ schedule(); \ mutex_lock(&(ca)->set->bucket_lock); \ } \ - \ - finish_wait(&ca->set->alloc_wait, &__wait); \ + __set_current_state(TASK_RUNNING); \ } while (0) -void bch_allocator_thread(struct closure *cl) +static int bch_allocator_thread(void *arg) { - struct cache *ca = container_of(cl, struct cache, alloc); + struct cache *ca = arg; mutex_lock(&ca->set->bucket_lock); @@ -442,7 +439,7 @@ long bch_bucket_alloc(struct cache *ca, unsigned watermark, struct closure *cl) { long r = -1; again: - wake_up(&ca->set->alloc_wait); + wake_up_process(ca->alloc_thread); if (fifo_used(&ca->free) > ca->watermark[watermark] && fifo_pop(&ca->free, r)) { @@ -552,6 +549,19 @@ int bch_bucket_alloc_set(struct cache_set *c, unsigned watermark, /* Init */ +int bch_cache_allocator_start(struct cache *ca) +{ + ca->alloc_thread = kthread_create(bch_allocator_thread, + ca, "bcache_allocator"); + if (IS_ERR(ca->alloc_thread)) + return PTR_ERR(ca->alloc_thread); + + closure_get(&ca->set->cl); + wake_up_process(ca->alloc_thread); + + return 0; +} + void bch_cache_allocator_exit(struct cache *ca) { struct discard *d; diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index d3e15b42a4ab..166c8ddc0be4 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -565,8 +565,7 @@ struct cache { unsigned watermark[WATERMARK_MAX]; - struct closure alloc; - struct workqueue_struct *alloc_workqueue; + struct task_struct *alloc_thread; struct closure prio; struct prio_set *disk_buckets; @@ -703,9 +702,6 @@ struct cache_set { /* For the btree cache */ struct shrinker shrink; - /* For the allocator itself */ - wait_queue_head_t alloc_wait; - /* For the btree cache and anything allocation related */ struct mutex bucket_lock; @@ -1173,6 +1169,15 @@ static inline uint8_t bucket_disk_gen(struct bucket *b) static struct kobj_attribute ksysfs_##n = \ __ATTR(n, S_IWUSR|S_IRUSR, show, store) +static inline void wake_up_allocators(struct cache_set *c) +{ + struct cache *ca; + unsigned i; + + for_each_cache(ca, c, i) + wake_up_process(ca->alloc_thread); +} + /* Forward declarations */ void bch_writeback_queue(struct cached_dev *); @@ -1193,7 +1198,6 @@ void bch_submit_bbio(struct bio *, struct cache_set *, struct bkey *, unsigned); uint8_t bch_inc_gen(struct cache *, struct bucket *); void bch_rescale_priorities(struct cache_set *, int); bool bch_bucket_add_unused(struct cache *, struct bucket *); -void bch_allocator_thread(struct closure *); long bch_bucket_alloc(struct cache *, unsigned, struct closure *); void bch_bucket_free(struct cache_set *, struct bkey *); @@ -1244,6 +1248,7 @@ int bch_btree_cache_alloc(struct cache_set *); void bch_cached_dev_writeback_init(struct cached_dev *); void bch_moving_init_cache_set(struct cache_set *); +int bch_cache_allocator_start(struct cache *ca); void bch_cache_allocator_exit(struct cache *ca); int bch_cache_allocator_init(struct cache *ca); diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 7a5658f04e62..45b88fbffbe0 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -273,7 +273,7 @@ static void btree_complete_write(struct btree *b, struct btree_write *w) { if (w->prio_blocked && !atomic_sub_return(w->prio_blocked, &b->c->prio_blocked)) - wake_up(&b->c->alloc_wait); + wake_up_allocators(b->c); if (w->journal) { atomic_dec_bug(w->journal); @@ -984,7 +984,7 @@ static void btree_node_free(struct btree *b, struct btree_op *op) if (b->prio_blocked && !atomic_sub_return(b->prio_blocked, &b->c->prio_blocked)) - wake_up(&b->c->alloc_wait); + wake_up_allocators(b->c); b->prio_blocked = 0; @@ -1547,7 +1547,7 @@ static void bch_btree_gc(struct closure *cl) blktrace_msg_all(c, "Finished gc"); trace_bcache_gc_end(c->sb.set_uuid); - wake_up(&c->alloc_wait); + wake_up_allocators(c); continue_at(cl, bch_moving_gc, bch_gc_wq); } diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 3de5626919ef..aaeda235fc75 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1282,7 +1282,7 @@ static void cache_set_flush(struct closure *cl) /* Shut down allocator threads */ set_bit(CACHE_SET_STOPPING_2, &c->flags); - wake_up(&c->alloc_wait); + wake_up_allocators(c); bch_cache_accounting_destroy(&c->accounting); @@ -1373,7 +1373,6 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) c->btree_pages = max_t(int, c->btree_pages / 4, BTREE_MAX_PAGES); - init_waitqueue_head(&c->alloc_wait); mutex_init(&c->bucket_lock); mutex_init(&c->fill_lock); mutex_init(&c->sort_lock); @@ -1496,9 +1495,10 @@ static void run_cache_set(struct cache_set *c) */ bch_journal_next(&c->journal); + err = "error starting allocator thread"; for_each_cache(ca, c, i) - closure_call(&ca->alloc, bch_allocator_thread, - system_wq, &c->cl); + if (bch_cache_allocator_start(ca)) + goto err; /* * First place it's safe to allocate: btree_check() and @@ -1531,17 +1531,16 @@ static void run_cache_set(struct cache_set *c) bch_btree_gc_finish(c); + err = "error starting allocator thread"; for_each_cache(ca, c, i) - closure_call(&ca->alloc, bch_allocator_thread, - ca->alloc_workqueue, &c->cl); + if (bch_cache_allocator_start(ca)) + goto err; mutex_lock(&c->bucket_lock); for_each_cache(ca, c, i) bch_prio_write(ca); mutex_unlock(&c->bucket_lock); - wake_up(&c->alloc_wait); - err = "cannot allocate new UUID bucket"; if (__uuid_write(c)) goto err_unlock_gc; @@ -1673,9 +1672,6 @@ void bch_cache_release(struct kobject *kobj) bio_split_pool_free(&ca->bio_split_hook); - if (ca->alloc_workqueue) - destroy_workqueue(ca->alloc_workqueue); - free_pages((unsigned long) ca->disk_buckets, ilog2(bucket_pages(ca))); kfree(ca->prio_buckets); vfree(ca->buckets); @@ -1723,7 +1719,6 @@ static int cache_alloc(struct cache_sb *sb, struct cache *ca) !(ca->prio_buckets = kzalloc(sizeof(uint64_t) * prio_buckets(ca) * 2, GFP_KERNEL)) || !(ca->disk_buckets = alloc_bucket_pages(GFP_KERNEL, ca)) || - !(ca->alloc_workqueue = alloc_workqueue("bch_allocator", 0, 1)) || bio_split_pool_init(&ca->bio_split_hook)) return -ENOMEM; From 5794351146199b9ac67a5ab1beab82be8bfd7b5d Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Thu, 25 Apr 2013 13:58:35 -0700 Subject: [PATCH 034/913] bcache: Refactor btree io The most significant change is that btree reads are now done synchronously, instead of asynchronously and doing the post read stuff from a workqueue. This was originally done because we can't block on IO under generic_make_request(). But - we already have a mechanism to punt cache lookups to workqueue if needed, so if we just use that we don't have to deal with the complexity of doing things asynchronously. The main benefit is this makes the locking situation saner; we can hold our write lock on the btree node until we're finished reading it, and we don't need that btree_node_read_done() flag anymore. Also, for writes, btree_write() was broken out into btree_node_write() and btree_leaf_dirty() - the old code with the boolean argument was dumb and confusing. The prio_blocked mechanism was improved a bit too, now the only counter is in struct btree_write, we don't mess with transfering a count from struct btree anymore. This required changing garbage collection to block prios at the start and unblock when it finishes, which is cleaner than what it was doing anyways (the old code had mostly the same effect, but was doing it in a convoluted way) And the btree iter btree_node_read_done() uses was converted to a real mempool. Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/bcache.h | 5 +- drivers/md/bcache/btree.c | 278 ++++++++++++++++-------------------- drivers/md/bcache/btree.h | 19 +-- drivers/md/bcache/debug.c | 4 +- drivers/md/bcache/journal.c | 2 +- drivers/md/bcache/super.c | 12 +- 6 files changed, 142 insertions(+), 178 deletions(-) diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 166c8ddc0be4..ad4957b52f10 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -819,10 +819,9 @@ struct cache_set { /* * A btree node on disk could have too many bsets for an iterator to fit - * on the stack - this is a single element mempool for btree_read_work() + * on the stack - have to dynamically allocate them */ - struct mutex fill_lock; - struct btree_iter *fill_iter; + mempool_t *fill_iter; /* * btree_sort() is a merge sort and requires temporary space - single diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 45b88fbffbe0..aaec186f7ba6 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -134,44 +134,17 @@ static uint64_t btree_csum_set(struct btree *b, struct bset *i) return crc ^ 0xffffffffffffffffULL; } -static void btree_bio_endio(struct bio *bio, int error) +void bch_btree_node_read_done(struct btree *b) { - struct closure *cl = bio->bi_private; - struct btree *b = container_of(cl, struct btree, io.cl); - - if (error) - set_btree_node_io_error(b); - - bch_bbio_count_io_errors(b->c, bio, error, (bio->bi_rw & WRITE) - ? "writing btree" : "reading btree"); - closure_put(cl); -} - -static void btree_bio_init(struct btree *b) -{ - BUG_ON(b->bio); - b->bio = bch_bbio_alloc(b->c); - - b->bio->bi_end_io = btree_bio_endio; - b->bio->bi_private = &b->io.cl; -} - -void bch_btree_read_done(struct closure *cl) -{ - struct btree *b = container_of(cl, struct btree, io.cl); - struct bset *i = b->sets[0].data; - struct btree_iter *iter = b->c->fill_iter; const char *err = "bad btree header"; - BUG_ON(b->nsets || b->written); + struct bset *i = b->sets[0].data; + struct btree_iter *iter; - bch_bbio_free(b->bio, b->c); - b->bio = NULL; - - mutex_lock(&b->c->fill_lock); + iter = mempool_alloc(b->c->fill_iter, GFP_NOWAIT); + iter->size = b->c->sb.bucket_size / b->c->sb.block_size; iter->used = 0; - if (btree_node_io_error(b) || - !i->seq) + if (!i->seq) goto err; for (; @@ -228,17 +201,8 @@ void bch_btree_read_done(struct closure *cl) if (b->written < btree_blocks(b)) bch_bset_init_next(b); out: - - mutex_unlock(&b->c->fill_lock); - - spin_lock(&b->c->btree_read_time_lock); - bch_time_stats_update(&b->c->btree_read_time, b->io_start_time); - spin_unlock(&b->c->btree_read_time_lock); - - smp_wmb(); /* read_done is our write lock */ - set_btree_node_read_done(b); - - closure_return(cl); + mempool_free(iter, b->c->fill_iter); + return; err: set_btree_node_io_error(b); bch_cache_set_error(b->c, "%s at bucket %zu, block %zu, %u keys", @@ -247,26 +211,51 @@ err: goto out; } -void bch_btree_read(struct btree *b) +static void btree_node_read_endio(struct bio *bio, int error) { - BUG_ON(b->nsets || b->written); + struct closure *cl = bio->bi_private; + closure_put(cl); +} - if (!closure_trylock(&b->io.cl, &b->c->cl)) - BUG(); - - b->io_start_time = local_clock(); - - btree_bio_init(b); - b->bio->bi_rw = REQ_META|READ_SYNC; - b->bio->bi_size = KEY_SIZE(&b->key) << 9; - - bch_bio_map(b->bio, b->sets[0].data); +void bch_btree_node_read(struct btree *b) +{ + uint64_t start_time = local_clock(); + struct closure cl; + struct bio *bio; + closure_init_stack(&cl); pr_debug("%s", pbtree(b)); - trace_bcache_btree_read(b->bio); - bch_submit_bbio(b->bio, b->c, &b->key, 0); - continue_at(&b->io.cl, bch_btree_read_done, system_wq); + bio = bch_bbio_alloc(b->c); + bio->bi_rw = REQ_META|READ_SYNC; + bio->bi_size = KEY_SIZE(&b->key) << 9; + bio->bi_end_io = btree_node_read_endio; + bio->bi_private = &cl; + + bch_bio_map(bio, b->sets[0].data); + + trace_bcache_btree_read(bio); + bch_submit_bbio(bio, b->c, &b->key, 0); + closure_sync(&cl); + + if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) + set_btree_node_io_error(b); + + bch_bbio_free(bio, b->c); + + if (btree_node_io_error(b)) + goto err; + + bch_btree_node_read_done(b); + + spin_lock(&b->c->btree_read_time_lock); + bch_time_stats_update(&b->c->btree_read_time, start_time); + spin_unlock(&b->c->btree_read_time_lock); + + return; +err: + bch_cache_set_error(b->c, "io error reading bucket %lu", + PTR_BUCKET_NR(b->c, &b->key, 0)); } static void btree_complete_write(struct btree *b, struct btree_write *w) @@ -280,15 +269,11 @@ static void btree_complete_write(struct btree *b, struct btree_write *w) __closure_wake_up(&b->c->journal.wait); } - if (w->owner) - closure_put(w->owner); - w->prio_blocked = 0; w->journal = NULL; - w->owner = NULL; } -static void __btree_write_done(struct closure *cl) +static void __btree_node_write_done(struct closure *cl) { struct btree *b = container_of(cl, struct btree, io.cl); struct btree_write *w = btree_prev_write(b); @@ -304,7 +289,7 @@ static void __btree_write_done(struct closure *cl) closure_return(cl); } -static void btree_write_done(struct closure *cl) +static void btree_node_write_done(struct closure *cl) { struct btree *b = container_of(cl, struct btree, io.cl); struct bio_vec *bv; @@ -313,10 +298,22 @@ static void btree_write_done(struct closure *cl) __bio_for_each_segment(bv, b->bio, n, 0) __free_page(bv->bv_page); - __btree_write_done(cl); + __btree_node_write_done(cl); } -static void do_btree_write(struct btree *b) +static void btree_node_write_endio(struct bio *bio, int error) +{ + struct closure *cl = bio->bi_private; + struct btree *b = container_of(cl, struct btree, io.cl); + + if (error) + set_btree_node_io_error(b); + + bch_bbio_count_io_errors(b->c, bio, error, "writing btree"); + closure_put(cl); +} + +static void do_btree_node_write(struct btree *b) { struct closure *cl = &b->io.cl; struct bset *i = b->sets[b->nsets].data; @@ -325,7 +322,11 @@ static void do_btree_write(struct btree *b) i->version = BCACHE_BSET_VERSION; i->csum = btree_csum_set(b, i); - btree_bio_init(b); + BUG_ON(b->bio); + b->bio = bch_bbio_alloc(b->c); + + b->bio->bi_end_io = btree_node_write_endio; + b->bio->bi_private = &b->io.cl; b->bio->bi_rw = REQ_META|WRITE_SYNC; b->bio->bi_size = set_blocks(i, b->c) * block_bytes(b->c); bch_bio_map(b->bio, i); @@ -345,7 +346,7 @@ static void do_btree_write(struct btree *b) trace_bcache_btree_write(b->bio); bch_submit_bbio(b->bio, b->c, &k.key, 0); - continue_at(cl, btree_write_done, NULL); + continue_at(cl, btree_node_write_done, NULL); } else { b->bio->bi_vcnt = 0; bch_bio_map(b->bio, i); @@ -354,26 +355,30 @@ static void do_btree_write(struct btree *b) bch_submit_bbio(b->bio, b->c, &k.key, 0); closure_sync(cl); - __btree_write_done(cl); + __btree_node_write_done(cl); } } -static void __btree_write(struct btree *b) +void bch_btree_node_write(struct btree *b, struct closure *parent) { struct bset *i = b->sets[b->nsets].data; BUG_ON(current->bio_list); + BUG_ON(b->written >= btree_blocks(b)); + BUG_ON(b->written && !i->keys); + BUG_ON(b->sets->data->seq != i->seq); - closure_lock(&b->io, &b->c->cl); cancel_delayed_work(&b->work); + /* If caller isn't waiting for write, parent refcount is cache set */ + closure_lock(&b->io, parent ?: &b->c->cl); + clear_bit(BTREE_NODE_dirty, &b->flags); change_bit(BTREE_NODE_write_idx, &b->flags); bch_check_key_order(b, i); - BUG_ON(b->written && !i->keys); - do_btree_write(b); + do_btree_node_write(b); pr_debug("%s block %i keys %i", pbtree(b), b->written, i->keys); @@ -387,37 +392,31 @@ static void __btree_write(struct btree *b) bch_bset_init_next(b); } -static void btree_write_work(struct work_struct *w) +static void btree_node_write_work(struct work_struct *w) { struct btree *b = container_of(to_delayed_work(w), struct btree, work); - down_write(&b->lock); + rw_lock(true, b, b->level); if (btree_node_dirty(b)) - __btree_write(b); - up_write(&b->lock); + bch_btree_node_write(b, NULL); + rw_unlock(true, b); } -void bch_btree_write(struct btree *b, bool now, struct btree_op *op) +static void bch_btree_leaf_dirty(struct btree *b, struct btree_op *op) { struct bset *i = b->sets[b->nsets].data; struct btree_write *w = btree_current_write(b); - BUG_ON(b->written && - (b->written >= btree_blocks(b) || - i->seq != b->sets[0].data->seq || - !i->keys)); + BUG_ON(!b->written); + BUG_ON(!i->keys); - if (!btree_node_dirty(b)) { - set_btree_node_dirty(b); - queue_delayed_work(btree_io_wq, &b->work, - msecs_to_jiffies(30000)); - } + if (!btree_node_dirty(b)) + queue_delayed_work(btree_io_wq, &b->work, 30 * HZ); - w->prio_blocked += b->prio_blocked; - b->prio_blocked = 0; + set_btree_node_dirty(b); - if (op && op->journal && !b->level) { + if (op && op->journal) { if (w->journal && journal_pin_cmp(b->c, w, op)) { atomic_dec_bug(w->journal); @@ -430,23 +429,10 @@ void bch_btree_write(struct btree *b, bool now, struct btree_op *op) } } - if (current->bio_list) - return; - /* Force write if set is too big */ - if (now || - b->level || - set_bytes(i) > PAGE_SIZE - 48) { - if (op && now) { - /* Must wait on multiple writes */ - BUG_ON(w->owner); - w->owner = &op->cl; - closure_get(&op->cl); - } - - __btree_write(b); - } - BUG_ON(!b->written); + if (set_bytes(i) > PAGE_SIZE - 48 && + !current->bio_list) + bch_btree_node_write(b, NULL); } /* @@ -559,7 +545,7 @@ static struct btree *mca_bucket_alloc(struct cache_set *c, init_rwsem(&b->lock); lockdep_set_novalidate_class(&b->lock); INIT_LIST_HEAD(&b->list); - INIT_DELAYED_WORK(&b->work, btree_write_work); + INIT_DELAYED_WORK(&b->work, btree_node_write_work); b->c = c; closure_init_unlocked(&b->io); @@ -582,7 +568,7 @@ static int mca_reap(struct btree *b, struct closure *cl, unsigned min_order) BUG_ON(btree_node_dirty(b) && !b->sets[0].data); if (cl && btree_node_dirty(b)) - bch_btree_write(b, true, NULL); + bch_btree_node_write(b, NULL); if (cl) closure_wait_event_async(&b->io.wait, cl, @@ -905,6 +891,9 @@ retry: b = mca_find(c, k); if (!b) { + if (current->bio_list) + return ERR_PTR(-EAGAIN); + mutex_lock(&c->bucket_lock); b = mca_alloc(c, k, level, &op->cl); mutex_unlock(&c->bucket_lock); @@ -914,7 +903,7 @@ retry: if (IS_ERR(b)) return b; - bch_btree_read(b); + bch_btree_node_read(b); if (!write) downgrade_write(&b->lock); @@ -937,15 +926,12 @@ retry: for (; i <= b->nsets; i++) prefetch(b->sets[i].data); - if (!closure_wait_event(&b->io.wait, &op->cl, - btree_node_read_done(b))) { + if (btree_node_io_error(b)) { rw_unlock(write, b); - b = ERR_PTR(-EAGAIN); - } else if (btree_node_io_error(b)) { - rw_unlock(write, b); - b = ERR_PTR(-EIO); - } else - BUG_ON(!b->written); + return ERR_PTR(-EIO); + } + + BUG_ON(!b->written); return b; } @@ -959,7 +945,7 @@ static void btree_node_prefetch(struct cache_set *c, struct bkey *k, int level) mutex_unlock(&c->bucket_lock); if (!IS_ERR_OR_NULL(b)) { - bch_btree_read(b); + bch_btree_node_read(b); rw_unlock(true, b); } } @@ -982,12 +968,6 @@ static void btree_node_free(struct btree *b, struct btree_op *op) btree_complete_write(b, btree_current_write(b)); clear_bit(BTREE_NODE_dirty, &b->flags); - if (b->prio_blocked && - !atomic_sub_return(b->prio_blocked, &b->c->prio_blocked)) - wake_up_allocators(b->c); - - b->prio_blocked = 0; - cancel_delayed_work(&b->work); mutex_lock(&b->c->bucket_lock); @@ -1028,7 +1008,6 @@ retry: goto retry; } - set_btree_node_read_done(b); b->accessed = 1; bch_bset_init_next(b); @@ -1166,14 +1145,11 @@ static struct btree *btree_gc_alloc(struct btree *b, struct bkey *k, if (!IS_ERR_OR_NULL(n)) { swap(b, n); + __bkey_put(b->c, &b->key); memcpy(k->ptr, b->key.ptr, sizeof(uint64_t) * KEY_PTRS(&b->key)); - __bkey_put(b->c, &b->key); - atomic_inc(&b->c->prio_blocked); - b->prio_blocked++; - btree_node_free(n, op); up_write(&n->lock); } @@ -1293,14 +1269,9 @@ static int btree_gc_recurse(struct btree *b, struct btree_op *op, void write(struct btree *r) { if (!r->written) - bch_btree_write(r, true, op); - else if (btree_node_dirty(r)) { - BUG_ON(btree_current_write(r)->owner); - btree_current_write(r)->owner = writes; - closure_get(writes); - - bch_btree_write(r, true, NULL); - } + bch_btree_node_write(r, &op->cl); + else if (btree_node_dirty(r)) + bch_btree_node_write(r, writes); up_write(&r->lock); } @@ -1386,9 +1357,7 @@ static int bch_btree_gc_root(struct btree *b, struct btree_op *op, ret = btree_gc_recurse(b, op, writes, gc); if (!b->written || btree_node_dirty(b)) { - atomic_inc(&b->c->prio_blocked); - b->prio_blocked++; - bch_btree_write(b, true, n ? op : NULL); + bch_btree_node_write(b, n ? &op->cl : NULL); } if (!IS_ERR_OR_NULL(n)) { @@ -1508,8 +1477,8 @@ static void bch_btree_gc(struct closure *cl) struct gc_stat stats; struct closure writes; struct btree_op op; - uint64_t start_time = local_clock(); + trace_bcache_gc_start(c->sb.set_uuid); blktrace_msg_all(c, "Starting gc"); @@ -1520,6 +1489,8 @@ static void bch_btree_gc(struct closure *cl) btree_gc_start(c); + atomic_inc(&c->prio_blocked); + ret = btree_root(gc_root, c, &op, &writes, &stats); closure_sync(&op.cl); closure_sync(&writes); @@ -1537,6 +1508,9 @@ static void bch_btree_gc(struct closure *cl) available = bch_btree_gc_finish(c); + atomic_dec(&c->prio_blocked); + wake_up_allocators(c); + bch_time_stats_update(&c->btree_gc_time, start_time); stats.key_bytes *= sizeof(uint64_t); @@ -1544,10 +1518,9 @@ static void bch_btree_gc(struct closure *cl) stats.data <<= 9; stats.in_use = (c->nbuckets - available) * 100 / c->nbuckets; memcpy(&c->gc_stats, &stats, sizeof(struct gc_stat)); - blktrace_msg_all(c, "Finished gc"); + blktrace_msg_all(c, "Finished gc"); trace_bcache_gc_end(c->sb.set_uuid); - wake_up_allocators(c); continue_at(cl, bch_moving_gc, bch_gc_wq); } @@ -1857,7 +1830,7 @@ merged: op_type(op), pbtree(b), pkey(k)); if (b->level && !KEY_OFFSET(k)) - b->prio_blocked++; + btree_current_write(b)->prio_blocked++; pr_debug("%s for %s at %s: %s", status, op_type(op), pbtree(b), pkey(k)); @@ -1907,7 +1880,6 @@ bool bch_btree_insert_check_key(struct btree *b, struct btree_op *op, BUG_ON(op->type != BTREE_INSERT); BUG_ON(!btree_insert_key(b, op, &tmp.k)); - bch_btree_write(b, false, NULL); ret = true; out: downgrade_write(&b->lock); @@ -1967,18 +1939,18 @@ static int btree_split(struct btree *b, struct btree_op *op) bkey_copy_key(&n2->key, &b->key); bch_keylist_add(&op->keys, &n2->key); - bch_btree_write(n2, true, op); + bch_btree_node_write(n2, &op->cl); rw_unlock(true, n2); } else bch_btree_insert_keys(n1, op); bch_keylist_add(&op->keys, &n1->key); - bch_btree_write(n1, true, op); + bch_btree_node_write(n1, &op->cl); if (n3) { bkey_copy_key(&n3->key, &MAX_KEY); bch_btree_insert_keys(n3, op); - bch_btree_write(n3, true, op); + bch_btree_node_write(n3, &op->cl); closure_sync(&op->cl); bch_btree_set_root(n3); @@ -2082,8 +2054,12 @@ static int bch_btree_insert_recurse(struct btree *b, struct btree_op *op, BUG_ON(write_block(b) != b->sets[b->nsets].data); - if (bch_btree_insert_keys(b, op)) - bch_btree_write(b, false, op); + if (bch_btree_insert_keys(b, op)) { + if (!b->level) + bch_btree_leaf_dirty(b, op); + else + bch_btree_node_write(b, &op->cl); + } } return 0; diff --git a/drivers/md/bcache/btree.h b/drivers/md/bcache/btree.h index af4a7092a28c..809bd77847a2 100644 --- a/drivers/md/bcache/btree.h +++ b/drivers/md/bcache/btree.h @@ -102,7 +102,6 @@ #include "debug.h" struct btree_write { - struct closure *owner; atomic_t *journal; /* If btree_split() frees a btree node, it writes a new pointer to that @@ -142,16 +141,12 @@ struct btree { */ struct bset_tree sets[MAX_BSETS]; - /* Used to refcount bio splits, also protects b->bio */ + /* For outstanding btree writes, used as a lock - protects write_idx */ struct closure_with_waitlist io; - /* Gets transferred to w->prio_blocked - see the comment there */ - int prio_blocked; - struct list_head list; struct delayed_work work; - uint64_t io_start_time; struct btree_write writes[2]; struct bio *bio; }; @@ -164,13 +159,11 @@ static inline void set_btree_node_ ## flag(struct btree *b) \ { set_bit(BTREE_NODE_ ## flag, &b->flags); } \ enum btree_flags { - BTREE_NODE_read_done, BTREE_NODE_io_error, BTREE_NODE_dirty, BTREE_NODE_write_idx, }; -BTREE_FLAG(read_done); BTREE_FLAG(io_error); BTREE_FLAG(dirty); BTREE_FLAG(write_idx); @@ -293,9 +286,7 @@ static inline void rw_unlock(bool w, struct btree *b) #ifdef CONFIG_BCACHE_EDEBUG unsigned i; - if (w && - b->key.ptr[0] && - btree_node_read_done(b)) + if (w && b->key.ptr[0]) for (i = 0; i <= b->nsets; i++) bch_check_key_order(b, b->sets[i].data); #endif @@ -370,9 +361,9 @@ static inline bool should_split(struct btree *b) > btree_blocks(b)); } -void bch_btree_read_done(struct closure *); -void bch_btree_read(struct btree *); -void bch_btree_write(struct btree *b, bool now, struct btree_op *op); +void bch_btree_node_read(struct btree *); +void bch_btree_node_read_done(struct btree *); +void bch_btree_node_write(struct btree *, struct closure *); void bch_cannibalize_unlock(struct cache_set *, struct closure *); void bch_btree_set_root(struct btree *); diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index 89fd5204924e..ae6096c6845d 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c @@ -144,7 +144,7 @@ void bch_btree_verify(struct btree *b, struct bset *new) v->written = 0; v->level = b->level; - bch_btree_read(v); + bch_btree_node_read(v); closure_wait_event(&v->io.wait, &cl, atomic_read(&b->io.cl.remaining) == -1); @@ -512,7 +512,7 @@ static ssize_t btree_fuzz(struct kobject *k, struct kobj_attribute *a, bch_btree_sort(b); fill->written = 0; - bch_btree_read_done(&fill->io.cl); + bch_btree_node_read_done(fill); if (b->sets[0].data->keys != fill->sets[0].data->keys || memcmp(b->sets[0].data->start, diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 8c8dfdcd9d4c..970d819d4350 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -384,7 +384,7 @@ out: return; found: if (btree_node_dirty(best)) - bch_btree_write(best, true, NULL); + bch_btree_node_write(best, NULL); rw_unlock(true, best); } diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index aaeda235fc75..e53f89988b08 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1255,9 +1255,10 @@ static void cache_set_free(struct closure *cl) free_pages((unsigned long) c->uuids, ilog2(bucket_pages(c))); free_pages((unsigned long) c->sort, ilog2(bucket_pages(c))); - kfree(c->fill_iter); if (c->bio_split) bioset_free(c->bio_split); + if (c->fill_iter) + mempool_destroy(c->fill_iter); if (c->bio_meta) mempool_destroy(c->bio_meta); if (c->search) @@ -1295,7 +1296,7 @@ static void cache_set_flush(struct closure *cl) /* Should skip this if we're unregistering because of an error */ list_for_each_entry(b, &c->btree_cache, list) if (btree_node_dirty(b)) - bch_btree_write(b, true, NULL); + bch_btree_node_write(b, NULL); closure_return(cl); } @@ -1374,7 +1375,6 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) BTREE_MAX_PAGES); mutex_init(&c->bucket_lock); - mutex_init(&c->fill_lock); mutex_init(&c->sort_lock); spin_lock_init(&c->sort_time_lock); closure_init_unlocked(&c->sb_write); @@ -1400,8 +1400,8 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) !(c->bio_meta = mempool_create_kmalloc_pool(2, sizeof(struct bbio) + sizeof(struct bio_vec) * bucket_pages(c))) || + !(c->fill_iter = mempool_create_kmalloc_pool(1, iter_size)) || !(c->bio_split = bioset_create(4, offsetof(struct bbio, bio))) || - !(c->fill_iter = kmalloc(iter_size, GFP_KERNEL)) || !(c->sort = alloc_bucket_pages(GFP_KERNEL, c)) || !(c->uuids = alloc_bucket_pages(GFP_KERNEL, c)) || bch_journal_alloc(c) || @@ -1409,8 +1409,6 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) bch_open_buckets_alloc(c)) goto err; - c->fill_iter->size = sb->bucket_size / sb->block_size; - c->congested_read_threshold_us = 2000; c->congested_write_threshold_us = 20000; c->error_limit = 8 << IO_ERROR_SHIFT; @@ -1551,7 +1549,7 @@ static void run_cache_set(struct cache_set *c) goto err_unlock_gc; bkey_copy_key(&c->root->key, &MAX_KEY); - bch_btree_write(c->root, true, &op); + bch_btree_node_write(c->root, &op.cl); bch_btree_set_root(c->root); rw_unlock(true, c->root); From c37511b863f36c1cc6e18440717fd4cc0e881b8a Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Fri, 26 Apr 2013 15:39:55 -0700 Subject: [PATCH 035/913] bcache: Fix/revamp tracepoints The tracepoints were reworked to be more sensible, and fixed a null pointer deref in one of the tracepoints. Converted some of the pr_debug()s to tracepoints - this is partly a performance optimization; it used to be that with DEBUG or CONFIG_DYNAMIC_DEBUG pr_debug() was an empty macro; but at some point it was changed to an empty inline function. Some of the pr_debug() statements had rather expensive function calls as part of the arguments, so this code was getting run unnecessarily even on non debug kernels - in some fast paths, too. Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/alloc.c | 10 +- drivers/md/bcache/bcache.h | 20 -- drivers/md/bcache/bset.h | 4 + drivers/md/bcache/btree.c | 47 ++-- drivers/md/bcache/io.c | 2 + drivers/md/bcache/journal.c | 14 +- drivers/md/bcache/movinggc.c | 12 +- drivers/md/bcache/request.c | 65 ++--- drivers/md/bcache/request.h | 2 +- drivers/md/bcache/super.c | 2 +- drivers/md/bcache/sysfs.c | 1 + drivers/md/bcache/trace.c | 45 +++- drivers/md/bcache/util.h | 2 - drivers/md/bcache/writeback.c | 10 +- include/trace/events/bcache.h | 444 ++++++++++++++++++++++------------ 15 files changed, 413 insertions(+), 267 deletions(-) diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c index 38428f46ea74..b54b73b9b2b7 100644 --- a/drivers/md/bcache/alloc.c +++ b/drivers/md/bcache/alloc.c @@ -65,6 +65,7 @@ #include <linux/kthread.h> #include <linux/random.h> +#include <trace/events/bcache.h> #define MAX_IN_FLIGHT_DISCARDS 8U @@ -351,10 +352,7 @@ static void invalidate_buckets(struct cache *ca) break; } - pr_debug("free %zu/%zu free_inc %zu/%zu unused %zu/%zu", - fifo_used(&ca->free), ca->free.size, - fifo_used(&ca->free_inc), ca->free_inc.size, - fifo_used(&ca->unused), ca->unused.size); + trace_bcache_alloc_invalidate(ca); } #define allocator_wait(ca, cond) \ @@ -473,9 +471,7 @@ again: return r; } - pr_debug("alloc failure: blocked %i free %zu free_inc %zu unused %zu", - atomic_read(&ca->set->prio_blocked), fifo_used(&ca->free), - fifo_used(&ca->free_inc), fifo_used(&ca->unused)); + trace_bcache_alloc_fail(ca); if (cl) { closure_wait(&ca->set->bucket_wait, cl); diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index ad4957b52f10..59c15e09e4dd 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -178,7 +178,6 @@ #define pr_fmt(fmt) "bcache: %s() " fmt "\n", __func__ #include <linux/bio.h> -#include <linux/blktrace_api.h> #include <linux/kobject.h> #include <linux/list.h> #include <linux/mutex.h> @@ -901,8 +900,6 @@ static inline unsigned local_clock_us(void) return local_clock() >> 10; } -#define MAX_BSETS 4U - #define BTREE_PRIO USHRT_MAX #define INITIAL_PRIO 32768 @@ -1107,23 +1104,6 @@ static inline void __bkey_put(struct cache_set *c, struct bkey *k) atomic_dec_bug(&PTR_BUCKET(c, k, i)->pin); } -/* Blktrace macros */ - -#define blktrace_msg(c, fmt, ...) \ -do { \ - struct request_queue *q = bdev_get_queue(c->bdev); \ - if (q) \ - blk_add_trace_msg(q, fmt, ##__VA_ARGS__); \ -} while (0) - -#define blktrace_msg_all(s, fmt, ...) \ -do { \ - struct cache *_c; \ - unsigned i; \ - for_each_cache(_c, (s), i) \ - blktrace_msg(_c, fmt, ##__VA_ARGS__); \ -} while (0) - static inline void cached_dev_put(struct cached_dev *dc) { if (atomic_dec_and_test(&dc->count)) diff --git a/drivers/md/bcache/bset.h b/drivers/md/bcache/bset.h index 57a9cff41546..ae115a253d73 100644 --- a/drivers/md/bcache/bset.h +++ b/drivers/md/bcache/bset.h @@ -1,6 +1,8 @@ #ifndef _BCACHE_BSET_H #define _BCACHE_BSET_H +#include <linux/slab.h> + /* * BKEYS: * @@ -142,6 +144,8 @@ /* Btree key comparison/iteration */ +#define MAX_BSETS 4U + struct btree_iter { size_t size, used; struct btree_iter_set { diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index aaec186f7ba6..218d486259a3 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -223,8 +223,9 @@ void bch_btree_node_read(struct btree *b) struct closure cl; struct bio *bio; + trace_bcache_btree_read(b); + closure_init_stack(&cl); - pr_debug("%s", pbtree(b)); bio = bch_bbio_alloc(b->c); bio->bi_rw = REQ_META|READ_SYNC; @@ -234,7 +235,6 @@ void bch_btree_node_read(struct btree *b) bch_bio_map(bio, b->sets[0].data); - trace_bcache_btree_read(bio); bch_submit_bbio(bio, b->c, &b->key, 0); closure_sync(&cl); @@ -343,7 +343,6 @@ static void do_btree_node_write(struct btree *b) memcpy(page_address(bv->bv_page), base + j * PAGE_SIZE, PAGE_SIZE); - trace_bcache_btree_write(b->bio); bch_submit_bbio(b->bio, b->c, &k.key, 0); continue_at(cl, btree_node_write_done, NULL); @@ -351,7 +350,6 @@ static void do_btree_node_write(struct btree *b) b->bio->bi_vcnt = 0; bch_bio_map(b->bio, i); - trace_bcache_btree_write(b->bio); bch_submit_bbio(b->bio, b->c, &k.key, 0); closure_sync(cl); @@ -363,10 +361,13 @@ void bch_btree_node_write(struct btree *b, struct closure *parent) { struct bset *i = b->sets[b->nsets].data; + trace_bcache_btree_write(b); + BUG_ON(current->bio_list); BUG_ON(b->written >= btree_blocks(b)); BUG_ON(b->written && !i->keys); BUG_ON(b->sets->data->seq != i->seq); + bch_check_key_order(b, i); cancel_delayed_work(&b->work); @@ -376,12 +377,8 @@ void bch_btree_node_write(struct btree *b, struct closure *parent) clear_bit(BTREE_NODE_dirty, &b->flags); change_bit(BTREE_NODE_write_idx, &b->flags); - bch_check_key_order(b, i); - do_btree_node_write(b); - pr_debug("%s block %i keys %i", pbtree(b), b->written, i->keys); - b->written += set_blocks(i, b->c); atomic_long_add(set_blocks(i, b->c) * b->c->sb.block_size, &PTR_CACHE(b->c, &b->key, 0)->btree_sectors_written); @@ -752,6 +749,8 @@ static struct btree *mca_cannibalize(struct cache_set *c, struct bkey *k, int ret = -ENOMEM; struct btree *i; + trace_bcache_btree_cache_cannibalize(c); + if (!cl) return ERR_PTR(-ENOMEM); @@ -770,7 +769,6 @@ static struct btree *mca_cannibalize(struct cache_set *c, struct bkey *k, return ERR_PTR(-EAGAIN); } - /* XXX: tracepoint */ c->try_harder = cl; c->try_harder_start = local_clock(); retry: @@ -956,13 +954,14 @@ static void btree_node_free(struct btree *b, struct btree_op *op) { unsigned i; + trace_bcache_btree_node_free(b); + /* * The BUG_ON() in btree_node_get() implies that we must have a write * lock on parent to free or even invalidate a node */ BUG_ON(op->lock <= b->level); BUG_ON(b == b->c->root); - pr_debug("bucket %s", pbtree(b)); if (btree_node_dirty(b)) btree_complete_write(b, btree_current_write(b)); @@ -1012,12 +1011,16 @@ retry: bch_bset_init_next(b); mutex_unlock(&c->bucket_lock); + + trace_bcache_btree_node_alloc(b); return b; err_free: bch_bucket_free(c, &k.key); __bkey_put(c, &k.key); err: mutex_unlock(&c->bucket_lock); + + trace_bcache_btree_node_alloc_fail(b); return b; } @@ -1254,7 +1257,7 @@ static void btree_gc_coalesce(struct btree *b, struct btree_op *op, btree_node_free(r->b, op); up_write(&r->b->lock); - pr_debug("coalesced %u nodes", nodes); + trace_bcache_btree_gc_coalesce(nodes); gc->nodes--; nodes--; @@ -1479,8 +1482,7 @@ static void bch_btree_gc(struct closure *cl) struct btree_op op; uint64_t start_time = local_clock(); - trace_bcache_gc_start(c->sb.set_uuid); - blktrace_msg_all(c, "Starting gc"); + trace_bcache_gc_start(c); memset(&stats, 0, sizeof(struct gc_stat)); closure_init_stack(&writes); @@ -1496,9 +1498,7 @@ static void bch_btree_gc(struct closure *cl) closure_sync(&writes); if (ret) { - blktrace_msg_all(c, "Stopped gc"); pr_warn("gc failed!"); - continue_at(cl, bch_btree_gc, bch_gc_wq); } @@ -1519,8 +1519,7 @@ static void bch_btree_gc(struct closure *cl) stats.in_use = (c->nbuckets - available) * 100 / c->nbuckets; memcpy(&c->gc_stats, &stats, sizeof(struct gc_stat)); - blktrace_msg_all(c, "Finished gc"); - trace_bcache_gc_end(c->sb.set_uuid); + trace_bcache_gc_end(c); continue_at(cl, bch_moving_gc, bch_gc_wq); } @@ -1901,12 +1900,11 @@ static int btree_split(struct btree *b, struct btree_op *op) split = set_blocks(n1->sets[0].data, n1->c) > (btree_blocks(b) * 4) / 5; - pr_debug("%ssplitting at %s keys %i", split ? "" : "not ", - pbtree(b), n1->sets[0].data->keys); - if (split) { unsigned keys = 0; + trace_bcache_btree_node_split(b, n1->sets[0].data->keys); + n2 = bch_btree_node_alloc(b->c, b->level, &op->cl); if (IS_ERR(n2)) goto err_free1; @@ -1941,8 +1939,11 @@ static int btree_split(struct btree *b, struct btree_op *op) bch_keylist_add(&op->keys, &n2->key); bch_btree_node_write(n2, &op->cl); rw_unlock(true, n2); - } else + } else { + trace_bcache_btree_node_compact(b, n1->sets[0].data->keys); + bch_btree_insert_keys(n1, op); + } bch_keylist_add(&op->keys, &n1->key); bch_btree_node_write(n1, &op->cl); @@ -2117,6 +2118,8 @@ void bch_btree_set_root(struct btree *b) { unsigned i; + trace_bcache_btree_set_root(b); + BUG_ON(!b->written); for (i = 0; i < KEY_PTRS(&b->key); i++) @@ -2130,7 +2133,6 @@ void bch_btree_set_root(struct btree *b) __bkey_put(b->c, &b->key); bch_journal_meta(b->c, NULL); - pr_debug("%s for %pf", pbtree(b), __builtin_return_address(0)); } /* Cache lookup */ @@ -2216,7 +2218,6 @@ static int submit_partial_cache_hit(struct btree *b, struct btree_op *op, n->bi_end_io = bch_cache_read_endio; n->bi_private = &s->cl; - trace_bcache_cache_hit(n); __bch_submit_bbio(n, b->c); } diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c index d285cd49104c..0f6d69658b61 100644 --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c @@ -9,6 +9,8 @@ #include "bset.h" #include "debug.h" +#include <linux/blkdev.h> + static void bch_bi_idx_hack_endio(struct bio *bio, int error) { struct bio *p = bio->bi_private; diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 970d819d4350..5ca22149b749 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -9,6 +9,8 @@ #include "debug.h" #include "request.h" +#include <trace/events/bcache.h> + /* * Journal replay/recovery: * @@ -300,7 +302,8 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list, for (k = i->j.start; k < end(&i->j); k = bkey_next(k)) { - pr_debug("%s", pkey(k)); + trace_bcache_journal_replay_key(k); + bkey_copy(op->keys.top, k); bch_keylist_push(&op->keys); @@ -712,7 +715,8 @@ void bch_journal(struct closure *cl) spin_lock(&c->journal.lock); if (journal_full(&c->journal)) { - /* XXX: tracepoint */ + trace_bcache_journal_full(c); + closure_wait(&c->journal.wait, cl); journal_reclaim(c); @@ -728,13 +732,15 @@ void bch_journal(struct closure *cl) if (b * c->sb.block_size > PAGE_SECTORS << JSET_BITS || b > c->journal.blocks_free) { - /* XXX: If we were inserting so many keys that they won't fit in + trace_bcache_journal_entry_full(c); + + /* + * XXX: If we were inserting so many keys that they won't fit in * an _empty_ journal write, we'll deadlock. For now, handle * this in bch_keylist_realloc() - but something to think about. */ BUG_ON(!w->data->keys); - /* XXX: tracepoint */ BUG_ON(!closure_wait(&w->wait, cl)); closure_flush(&c->journal.io); diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c index 8589512c972e..04f6b97ffda6 100644 --- a/drivers/md/bcache/movinggc.c +++ b/drivers/md/bcache/movinggc.c @@ -9,6 +9,8 @@ #include "debug.h" #include "request.h" +#include <trace/events/bcache.h> + struct moving_io { struct keybuf_key *w; struct search s; @@ -49,9 +51,8 @@ static void write_moving_finish(struct closure *cl) while (bv-- != bio->bi_io_vec) __free_page(bv->bv_page); - pr_debug("%s %s", io->s.op.insert_collision - ? "collision moving" : "moved", - pkey(&io->w->key)); + if (io->s.op.insert_collision) + trace_bcache_gc_copy_collision(&io->w->key); bch_keybuf_del(&io->s.op.c->moving_gc_keys, io->w); @@ -94,8 +95,6 @@ static void write_moving(struct closure *cl) struct moving_io *io = container_of(s, struct moving_io, s); if (!s->error) { - trace_bcache_write_moving(&io->bio.bio); - moving_init(io); io->bio.bio.bi_sector = KEY_START(&io->w->key); @@ -122,7 +121,6 @@ static void read_moving_submit(struct closure *cl) struct moving_io *io = container_of(s, struct moving_io, s); struct bio *bio = &io->bio.bio; - trace_bcache_read_moving(bio); bch_submit_bbio(bio, s->op.c, &io->w->key, 0); continue_at(cl, write_moving, bch_gc_wq); @@ -162,7 +160,7 @@ static void read_moving(struct closure *cl) if (bch_bio_alloc_pages(bio, GFP_KERNEL)) goto err; - pr_debug("%s", pkey(&w->key)); + trace_bcache_gc_copy(&w->key); closure_call(&io->s.cl, read_moving_submit, NULL, &c->gc.cl); diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index e5ff12e52d5b..695469958c1e 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -530,10 +530,9 @@ static void bch_insert_data_loop(struct closure *cl) if (KEY_CSUM(k)) bio_csum(n, k); - pr_debug("%s", pkey(k)); + trace_bcache_cache_insert(k); bch_keylist_push(&op->keys); - trace_bcache_cache_insert(n, n->bi_sector, n->bi_bdev); n->bi_rw |= REQ_WRITE; bch_submit_bbio(n, op->c, k, 0); } while (n != bio); @@ -784,11 +783,8 @@ static void request_read_error(struct closure *cl) int i; if (s->recoverable) { - /* The cache read failed, but we can retry from the backing - * device. - */ - pr_debug("recovering at sector %llu", - (uint64_t) s->orig_bio->bi_sector); + /* Retry from the backing device: */ + trace_bcache_read_retry(s->orig_bio); s->error = 0; bv = s->bio.bio.bi_io_vec; @@ -806,7 +802,6 @@ static void request_read_error(struct closure *cl) /* XXX: invalidate cache */ - trace_bcache_read_retry(&s->bio.bio); closure_bio_submit(&s->bio.bio, &s->cl, s->d); } @@ -899,6 +894,7 @@ static void request_read_done_bh(struct closure *cl) struct cached_dev *dc = container_of(s->d, struct cached_dev, disk); bch_mark_cache_accounting(s, !s->cache_miss, s->op.skip); + trace_bcache_read(s->orig_bio, !s->cache_miss, s->op.skip); if (s->error) continue_at_nobarrier(cl, request_read_error, bcache_wq); @@ -969,7 +965,6 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, s->cache_miss = miss; bio_get(s->op.cache_bio); - trace_bcache_cache_miss(s->orig_bio); closure_bio_submit(s->op.cache_bio, &s->cl, s->d); return ret; @@ -1040,15 +1035,15 @@ static void request_write(struct cached_dev *dc, struct search *s) if (should_writeback(dc, s->orig_bio)) s->writeback = true; + trace_bcache_write(s->orig_bio, s->writeback, s->op.skip); + if (!s->writeback) { s->op.cache_bio = bio_clone_bioset(bio, GFP_NOIO, dc->disk.bio_split); - trace_bcache_writethrough(s->orig_bio); closure_bio_submit(bio, cl, s->d); } else { s->op.cache_bio = bio; - trace_bcache_writeback(s->orig_bio); bch_writeback_add(dc, bio_sectors(bio)); } out: @@ -1058,7 +1053,6 @@ skip: s->op.skip = true; s->op.cache_bio = s->orig_bio; bio_get(s->op.cache_bio); - trace_bcache_write_skip(s->orig_bio); if ((bio->bi_rw & REQ_DISCARD) && !blk_queue_discard(bdev_get_queue(dc->bdev))) @@ -1088,9 +1082,10 @@ static void request_nodata(struct cached_dev *dc, struct search *s) /* Cached devices - read & write stuff */ -int bch_get_congested(struct cache_set *c) +unsigned bch_get_congested(struct cache_set *c) { int i; + long rand; if (!c->congested_read_threshold_us && !c->congested_write_threshold_us) @@ -1106,7 +1101,13 @@ int bch_get_congested(struct cache_set *c) i += CONGESTED_MAX; - return i <= 0 ? 1 : fract_exp_two(i, 6); + if (i > 0) + i = fract_exp_two(i, 6); + + rand = get_random_int(); + i -= bitmap_weight(&rand, BITS_PER_LONG); + + return i > 0 ? i : 1; } static void add_sequential(struct task_struct *t) @@ -1126,10 +1127,8 @@ static void check_should_skip(struct cached_dev *dc, struct search *s) { struct cache_set *c = s->op.c; struct bio *bio = &s->bio.bio; - - long rand; - int cutoff = bch_get_congested(c); unsigned mode = cache_mode(dc, bio); + unsigned sectors, congested = bch_get_congested(c); if (atomic_read(&dc->disk.detaching) || c->gc_stats.in_use > CUTOFF_CACHE_ADD || @@ -1147,17 +1146,14 @@ static void check_should_skip(struct cached_dev *dc, struct search *s) goto skip; } - if (!cutoff) { - cutoff = dc->sequential_cutoff >> 9; + if (!congested && !dc->sequential_cutoff) + goto rescale; - if (!cutoff) - goto rescale; - - if (mode == CACHE_MODE_WRITEBACK && - (bio->bi_rw & REQ_WRITE) && - (bio->bi_rw & REQ_SYNC)) - goto rescale; - } + if (!congested && + mode == CACHE_MODE_WRITEBACK && + (bio->bi_rw & REQ_WRITE) && + (bio->bi_rw & REQ_SYNC)) + goto rescale; if (dc->sequential_merge) { struct io *i; @@ -1192,12 +1188,19 @@ found: add_sequential(s->task); } - rand = get_random_int(); - cutoff -= bitmap_weight(&rand, BITS_PER_LONG); + sectors = max(s->task->sequential_io, + s->task->sequential_io_avg) >> 9; - if (cutoff <= (int) (max(s->task->sequential_io, - s->task->sequential_io_avg) >> 9)) + if (dc->sequential_cutoff && + sectors >= dc->sequential_cutoff >> 9) { + trace_bcache_bypass_sequential(s->orig_bio); goto skip; + } + + if (congested && sectors >= congested) { + trace_bcache_bypass_congested(s->orig_bio); + goto skip; + } rescale: bch_rescale_priorities(c, bio_sectors(bio)); diff --git a/drivers/md/bcache/request.h b/drivers/md/bcache/request.h index 254d9ab5707c..57dc4784f4f4 100644 --- a/drivers/md/bcache/request.h +++ b/drivers/md/bcache/request.h @@ -30,7 +30,7 @@ struct search { }; void bch_cache_read_endio(struct bio *, int); -int bch_get_congested(struct cache_set *); +unsigned bch_get_congested(struct cache_set *); void bch_insert_data(struct closure *cl); void bch_btree_insert_async(struct closure *); void bch_cache_read_endio(struct bio *, int); diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index e53f89988b08..47bc13745068 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -11,6 +11,7 @@ #include "debug.h" #include "request.h" +#include <linux/blkdev.h> #include <linux/buffer_head.h> #include <linux/debugfs.h> #include <linux/genhd.h> @@ -543,7 +544,6 @@ void bch_prio_write(struct cache *ca) pr_debug("free %zu, free_inc %zu, unused %zu", fifo_used(&ca->free), fifo_used(&ca->free_inc), fifo_used(&ca->unused)); - blktrace_msg(ca, "Starting priorities: " buckets_free(ca)); for (i = prio_buckets(ca) - 1; i >= 0; --i) { long bucket; diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index 29228b8a6ffe..f5c2d8695230 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -10,6 +10,7 @@ #include "btree.h" #include "request.h" +#include <linux/blkdev.h> #include <linux/sort.h> static const char * const cache_replacement_policies[] = { diff --git a/drivers/md/bcache/trace.c b/drivers/md/bcache/trace.c index 983f9bb411bc..7f4f38aa16ae 100644 --- a/drivers/md/bcache/trace.c +++ b/drivers/md/bcache/trace.c @@ -2,6 +2,7 @@ #include "btree.h" #include "request.h" +#include <linux/blktrace_api.h> #include <linux/module.h> #define CREATE_TRACE_POINTS @@ -9,18 +10,42 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_request_start); EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_request_end); -EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_passthrough); -EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_cache_hit); -EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_cache_miss); + +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_bypass_sequential); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_bypass_congested); + +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_read); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_write); EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_read_retry); -EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_writethrough); -EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_writeback); -EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_write_skip); + +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_cache_insert); + +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_journal_replay_key); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_journal_write); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_journal_full); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_journal_entry_full); + +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_cache_cannibalize); + EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_read); EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_write); -EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_write_dirty); -EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_read_dirty); -EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_journal_write); -EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_cache_insert); + +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_node_alloc); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_node_alloc_fail); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_node_free); + +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_gc_coalesce); EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_gc_start); EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_gc_end); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_gc_copy); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_gc_copy_collision); + +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_node_split); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_node_compact); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_set_root); + +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_alloc_invalidate); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_alloc_fail); + +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_writeback); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_writeback_collision); diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h index 577393e38c3a..e02780545f12 100644 --- a/drivers/md/bcache/util.h +++ b/drivers/md/bcache/util.h @@ -15,8 +15,6 @@ struct closure; -#include <trace/events/bcache.h> - #ifdef CONFIG_BCACHE_EDEBUG #define atomic_dec_bug(v) BUG_ON(atomic_dec_return(v) < 0) diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index 2714ed3991d1..82f6d4577be2 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -10,6 +10,8 @@ #include "btree.h" #include "debug.h" +#include <trace/events/bcache.h> + static struct workqueue_struct *dirty_wq; static void read_dirty(struct closure *); @@ -236,10 +238,12 @@ static void write_dirty_finish(struct closure *cl) for (i = 0; i < KEY_PTRS(&w->key); i++) atomic_inc(&PTR_BUCKET(dc->disk.c, &w->key, i)->pin); - pr_debug("clearing %s", pkey(&w->key)); bch_btree_insert(&op, dc->disk.c); closure_sync(&op.cl); + if (op.insert_collision) + trace_bcache_writeback_collision(&w->key); + atomic_long_inc(op.insert_collision ? &dc->disk.c->writeback_keys_failed : &dc->disk.c->writeback_keys_done); @@ -275,7 +279,6 @@ static void write_dirty(struct closure *cl) io->bio.bi_bdev = io->dc->bdev; io->bio.bi_end_io = dirty_endio; - trace_bcache_write_dirty(&io->bio); closure_bio_submit(&io->bio, cl, &io->dc->disk); continue_at(cl, write_dirty_finish, dirty_wq); @@ -296,7 +299,6 @@ static void read_dirty_submit(struct closure *cl) { struct dirty_io *io = container_of(cl, struct dirty_io, cl); - trace_bcache_read_dirty(&io->bio); closure_bio_submit(&io->bio, cl, &io->dc->disk); continue_at(cl, write_dirty, dirty_wq); @@ -352,7 +354,7 @@ static void read_dirty(struct closure *cl) if (bch_bio_alloc_pages(&io->bio, GFP_KERNEL)) goto err_free; - pr_debug("%s", pkey(&w->key)); + trace_bcache_writeback(&w->key); closure_call(&io->cl, read_dirty_submit, NULL, &dc->disk.cl); diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h index 3cc5a0b278c3..c9952b36fcea 100644 --- a/include/trace/events/bcache.h +++ b/include/trace/events/bcache.h @@ -9,9 +9,7 @@ struct search; DECLARE_EVENT_CLASS(bcache_request, - TP_PROTO(struct search *s, struct bio *bio), - TP_ARGS(s, bio), TP_STRUCT__entry( @@ -22,7 +20,6 @@ DECLARE_EVENT_CLASS(bcache_request, __field(dev_t, orig_sector ) __field(unsigned int, nr_sector ) __array(char, rwbs, 6 ) - __array(char, comm, TASK_COMM_LEN ) ), TP_fast_assign( @@ -33,36 +30,66 @@ DECLARE_EVENT_CLASS(bcache_request, __entry->orig_sector = bio->bi_sector - 16; __entry->nr_sector = bio->bi_size >> 9; blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); - memcpy(__entry->comm, current->comm, TASK_COMM_LEN); ), - TP_printk("%d,%d %s %llu + %u [%s] (from %d,%d @ %llu)", + TP_printk("%d,%d %s %llu + %u (from %d,%d @ %llu)", MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->rwbs, - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->comm, - __entry->orig_major, __entry->orig_minor, + __entry->rwbs, (unsigned long long)__entry->sector, + __entry->nr_sector, __entry->orig_major, __entry->orig_minor, (unsigned long long)__entry->orig_sector) ); +DECLARE_EVENT_CLASS(bkey, + TP_PROTO(struct bkey *k), + TP_ARGS(k), + + TP_STRUCT__entry( + __field(u32, size ) + __field(u32, inode ) + __field(u64, offset ) + __field(bool, dirty ) + ), + + TP_fast_assign( + __entry->inode = KEY_INODE(k); + __entry->offset = KEY_OFFSET(k); + __entry->size = KEY_SIZE(k); + __entry->dirty = KEY_DIRTY(k); + ), + + TP_printk("%u:%llu len %u dirty %u", __entry->inode, + __entry->offset, __entry->size, __entry->dirty) +); + +DECLARE_EVENT_CLASS(btree_node, + TP_PROTO(struct btree *b), + TP_ARGS(b), + + TP_STRUCT__entry( + __field(size_t, bucket ) + ), + + TP_fast_assign( + __entry->bucket = PTR_BUCKET_NR(b->c, &b->key, 0); + ), + + TP_printk("bucket %zu", __entry->bucket) +); + +/* request.c */ + DEFINE_EVENT(bcache_request, bcache_request_start, - TP_PROTO(struct search *s, struct bio *bio), - TP_ARGS(s, bio) ); DEFINE_EVENT(bcache_request, bcache_request_end, - TP_PROTO(struct search *s, struct bio *bio), - TP_ARGS(s, bio) ); DECLARE_EVENT_CLASS(bcache_bio, - TP_PROTO(struct bio *bio), - TP_ARGS(bio), TP_STRUCT__entry( @@ -70,7 +97,6 @@ DECLARE_EVENT_CLASS(bcache_bio, __field(sector_t, sector ) __field(unsigned int, nr_sector ) __array(char, rwbs, 6 ) - __array(char, comm, TASK_COMM_LEN ) ), TP_fast_assign( @@ -78,191 +104,295 @@ DECLARE_EVENT_CLASS(bcache_bio, __entry->sector = bio->bi_sector; __entry->nr_sector = bio->bi_size >> 9; blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); - memcpy(__entry->comm, current->comm, TASK_COMM_LEN); ), - TP_printk("%d,%d %s %llu + %u [%s]", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->rwbs, - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->comm) + TP_printk("%d,%d %s %llu + %u", + MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, + (unsigned long long)__entry->sector, __entry->nr_sector) ); - -DEFINE_EVENT(bcache_bio, bcache_passthrough, - +DEFINE_EVENT(bcache_bio, bcache_bypass_sequential, TP_PROTO(struct bio *bio), - TP_ARGS(bio) ); -DEFINE_EVENT(bcache_bio, bcache_cache_hit, - +DEFINE_EVENT(bcache_bio, bcache_bypass_congested, TP_PROTO(struct bio *bio), - TP_ARGS(bio) ); -DEFINE_EVENT(bcache_bio, bcache_cache_miss, - - TP_PROTO(struct bio *bio), - - TP_ARGS(bio) -); - -DEFINE_EVENT(bcache_bio, bcache_read_retry, - - TP_PROTO(struct bio *bio), - - TP_ARGS(bio) -); - -DEFINE_EVENT(bcache_bio, bcache_writethrough, - - TP_PROTO(struct bio *bio), - - TP_ARGS(bio) -); - -DEFINE_EVENT(bcache_bio, bcache_writeback, - - TP_PROTO(struct bio *bio), - - TP_ARGS(bio) -); - -DEFINE_EVENT(bcache_bio, bcache_write_skip, - - TP_PROTO(struct bio *bio), - - TP_ARGS(bio) -); - -DEFINE_EVENT(bcache_bio, bcache_btree_read, - - TP_PROTO(struct bio *bio), - - TP_ARGS(bio) -); - -DEFINE_EVENT(bcache_bio, bcache_btree_write, - - TP_PROTO(struct bio *bio), - - TP_ARGS(bio) -); - -DEFINE_EVENT(bcache_bio, bcache_write_dirty, - - TP_PROTO(struct bio *bio), - - TP_ARGS(bio) -); - -DEFINE_EVENT(bcache_bio, bcache_read_dirty, - - TP_PROTO(struct bio *bio), - - TP_ARGS(bio) -); - -DEFINE_EVENT(bcache_bio, bcache_write_moving, - - TP_PROTO(struct bio *bio), - - TP_ARGS(bio) -); - -DEFINE_EVENT(bcache_bio, bcache_read_moving, - - TP_PROTO(struct bio *bio), - - TP_ARGS(bio) -); - -DEFINE_EVENT(bcache_bio, bcache_journal_write, - - TP_PROTO(struct bio *bio), - - TP_ARGS(bio) -); - -DECLARE_EVENT_CLASS(bcache_cache_bio, - - TP_PROTO(struct bio *bio, - sector_t orig_sector, - struct block_device* orig_bdev), - - TP_ARGS(bio, orig_sector, orig_bdev), +TRACE_EVENT(bcache_read, + TP_PROTO(struct bio *bio, bool hit, bool bypass), + TP_ARGS(bio, hit, bypass), TP_STRUCT__entry( __field(dev_t, dev ) - __field(dev_t, orig_dev ) __field(sector_t, sector ) - __field(sector_t, orig_sector ) __field(unsigned int, nr_sector ) __array(char, rwbs, 6 ) - __array(char, comm, TASK_COMM_LEN ) + __field(bool, cache_hit ) + __field(bool, bypass ) ), TP_fast_assign( __entry->dev = bio->bi_bdev->bd_dev; - __entry->orig_dev = orig_bdev->bd_dev; __entry->sector = bio->bi_sector; - __entry->orig_sector = orig_sector; __entry->nr_sector = bio->bi_size >> 9; blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); - memcpy(__entry->comm, current->comm, TASK_COMM_LEN); + __entry->cache_hit = hit; + __entry->bypass = bypass; ), - TP_printk("%d,%d %s %llu + %u [%s] (from %d,%d %llu)", + TP_printk("%d,%d %s %llu + %u hit %u bypass %u", MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->rwbs, - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->comm, - MAJOR(__entry->orig_dev), MINOR(__entry->orig_dev), - (unsigned long long)__entry->orig_sector) + __entry->rwbs, (unsigned long long)__entry->sector, + __entry->nr_sector, __entry->cache_hit, __entry->bypass) ); -DEFINE_EVENT(bcache_cache_bio, bcache_cache_insert, - - TP_PROTO(struct bio *bio, - sector_t orig_sector, - struct block_device *orig_bdev), - - TP_ARGS(bio, orig_sector, orig_bdev) -); - -DECLARE_EVENT_CLASS(bcache_gc, - - TP_PROTO(uint8_t *uuid), - - TP_ARGS(uuid), +TRACE_EVENT(bcache_write, + TP_PROTO(struct bio *bio, bool writeback, bool bypass), + TP_ARGS(bio, writeback, bypass), TP_STRUCT__entry( - __field(uint8_t *, uuid) + __field(dev_t, dev ) + __field(sector_t, sector ) + __field(unsigned int, nr_sector ) + __array(char, rwbs, 6 ) + __field(bool, writeback ) + __field(bool, bypass ) ), TP_fast_assign( - __entry->uuid = uuid; + __entry->dev = bio->bi_bdev->bd_dev; + __entry->sector = bio->bi_sector; + __entry->nr_sector = bio->bi_size >> 9; + blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); + __entry->writeback = writeback; + __entry->bypass = bypass; + ), + + TP_printk("%d,%d %s %llu + %u hit %u bypass %u", + MAJOR(__entry->dev), MINOR(__entry->dev), + __entry->rwbs, (unsigned long long)__entry->sector, + __entry->nr_sector, __entry->writeback, __entry->bypass) +); + +DEFINE_EVENT(bcache_bio, bcache_read_retry, + TP_PROTO(struct bio *bio), + TP_ARGS(bio) +); + +DEFINE_EVENT(bkey, bcache_cache_insert, + TP_PROTO(struct bkey *k), + TP_ARGS(k) +); + +/* Journal */ + +DECLARE_EVENT_CLASS(cache_set, + TP_PROTO(struct cache_set *c), + TP_ARGS(c), + + TP_STRUCT__entry( + __array(char, uuid, 16 ) + ), + + TP_fast_assign( + memcpy(__entry->uuid, c->sb.set_uuid, 16); ), TP_printk("%pU", __entry->uuid) ); - -DEFINE_EVENT(bcache_gc, bcache_gc_start, - - TP_PROTO(uint8_t *uuid), - - TP_ARGS(uuid) +DEFINE_EVENT(bkey, bcache_journal_replay_key, + TP_PROTO(struct bkey *k), + TP_ARGS(k) ); -DEFINE_EVENT(bcache_gc, bcache_gc_end, +DEFINE_EVENT(cache_set, bcache_journal_full, + TP_PROTO(struct cache_set *c), + TP_ARGS(c) +); - TP_PROTO(uint8_t *uuid), +DEFINE_EVENT(cache_set, bcache_journal_entry_full, + TP_PROTO(struct cache_set *c), + TP_ARGS(c) +); - TP_ARGS(uuid) +DEFINE_EVENT(bcache_bio, bcache_journal_write, + TP_PROTO(struct bio *bio), + TP_ARGS(bio) +); + +/* Btree */ + +DEFINE_EVENT(cache_set, bcache_btree_cache_cannibalize, + TP_PROTO(struct cache_set *c), + TP_ARGS(c) +); + +DEFINE_EVENT(btree_node, bcache_btree_read, + TP_PROTO(struct btree *b), + TP_ARGS(b) +); + +TRACE_EVENT(bcache_btree_write, + TP_PROTO(struct btree *b), + TP_ARGS(b), + + TP_STRUCT__entry( + __field(size_t, bucket ) + __field(unsigned, block ) + __field(unsigned, keys ) + ), + + TP_fast_assign( + __entry->bucket = PTR_BUCKET_NR(b->c, &b->key, 0); + __entry->block = b->written; + __entry->keys = b->sets[b->nsets].data->keys; + ), + + TP_printk("bucket %zu", __entry->bucket) +); + +DEFINE_EVENT(btree_node, bcache_btree_node_alloc, + TP_PROTO(struct btree *b), + TP_ARGS(b) +); + +DEFINE_EVENT(btree_node, bcache_btree_node_alloc_fail, + TP_PROTO(struct btree *b), + TP_ARGS(b) +); + +DEFINE_EVENT(btree_node, bcache_btree_node_free, + TP_PROTO(struct btree *b), + TP_ARGS(b) +); + +TRACE_EVENT(bcache_btree_gc_coalesce, + TP_PROTO(unsigned nodes), + TP_ARGS(nodes), + + TP_STRUCT__entry( + __field(unsigned, nodes ) + ), + + TP_fast_assign( + __entry->nodes = nodes; + ), + + TP_printk("coalesced %u nodes", __entry->nodes) +); + +DEFINE_EVENT(cache_set, bcache_gc_start, + TP_PROTO(struct cache_set *c), + TP_ARGS(c) +); + +DEFINE_EVENT(cache_set, bcache_gc_end, + TP_PROTO(struct cache_set *c), + TP_ARGS(c) +); + +DEFINE_EVENT(bkey, bcache_gc_copy, + TP_PROTO(struct bkey *k), + TP_ARGS(k) +); + +DEFINE_EVENT(bkey, bcache_gc_copy_collision, + TP_PROTO(struct bkey *k), + TP_ARGS(k) +); + +DECLARE_EVENT_CLASS(btree_split, + TP_PROTO(struct btree *b, unsigned keys), + TP_ARGS(b, keys), + + TP_STRUCT__entry( + __field(size_t, bucket ) + __field(unsigned, keys ) + ), + + TP_fast_assign( + __entry->bucket = PTR_BUCKET_NR(b->c, &b->key, 0); + __entry->keys = keys; + ), + + TP_printk("bucket %zu keys %u", __entry->bucket, __entry->keys) +); + +DEFINE_EVENT(btree_split, bcache_btree_node_split, + TP_PROTO(struct btree *b, unsigned keys), + TP_ARGS(b, keys) +); + +DEFINE_EVENT(btree_split, bcache_btree_node_compact, + TP_PROTO(struct btree *b, unsigned keys), + TP_ARGS(b, keys) +); + +DEFINE_EVENT(btree_node, bcache_btree_set_root, + TP_PROTO(struct btree *b), + TP_ARGS(b) +); + +/* Allocator */ + +TRACE_EVENT(bcache_alloc_invalidate, + TP_PROTO(struct cache *ca), + TP_ARGS(ca), + + TP_STRUCT__entry( + __field(unsigned, free ) + __field(unsigned, free_inc ) + __field(unsigned, free_inc_size ) + __field(unsigned, unused ) + ), + + TP_fast_assign( + __entry->free = fifo_used(&ca->free); + __entry->free_inc = fifo_used(&ca->free_inc); + __entry->free_inc_size = ca->free_inc.size; + __entry->unused = fifo_used(&ca->unused); + ), + + TP_printk("free %u free_inc %u/%u unused %u", __entry->free, + __entry->free_inc, __entry->free_inc_size, __entry->unused) +); + +TRACE_EVENT(bcache_alloc_fail, + TP_PROTO(struct cache *ca), + TP_ARGS(ca), + + TP_STRUCT__entry( + __field(unsigned, free ) + __field(unsigned, free_inc ) + __field(unsigned, unused ) + __field(unsigned, blocked ) + ), + + TP_fast_assign( + __entry->free = fifo_used(&ca->free); + __entry->free_inc = fifo_used(&ca->free_inc); + __entry->unused = fifo_used(&ca->unused); + __entry->blocked = atomic_read(&ca->set->prio_blocked); + ), + + TP_printk("free %u free_inc %u unused %u blocked %u", __entry->free, + __entry->free_inc, __entry->unused, __entry->blocked) +); + +/* Background writeback */ + +DEFINE_EVENT(bkey, bcache_writeback, + TP_PROTO(struct bkey *k), + TP_ARGS(k) +); + +DEFINE_EVENT(bkey, bcache_writeback_collision, + TP_PROTO(struct bkey *k), + TP_ARGS(k) ); #endif /* _TRACE_BCACHE_H */ From 85b1492ee113486d871de7676a61f506a43ca475 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Tue, 14 May 2013 20:33:16 -0700 Subject: [PATCH 036/913] bcache: Rip out pkey()/pbtree() Old gcc doesnt like the struct hack, and it is kind of ugly. So finish off the work to convert pr_debug() statements to tracepoints, and delete pkey()/pbtree(). Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/bset.c | 16 ++++++++++---- drivers/md/bcache/btree.c | 21 ++++++------------ drivers/md/bcache/btree.h | 7 ++++++ drivers/md/bcache/debug.c | 40 ++++++++++++++++++++++------------- drivers/md/bcache/debug.h | 11 ++-------- drivers/md/bcache/super.c | 5 +++-- drivers/md/bcache/trace.c | 2 ++ include/trace/events/bcache.h | 33 +++++++++++++++++++++++++++++ 8 files changed, 90 insertions(+), 45 deletions(-) diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c index cb4578a327b9..e9399ed7f688 100644 --- a/drivers/md/bcache/bset.c +++ b/drivers/md/bcache/bset.c @@ -78,6 +78,7 @@ struct bkey *bch_keylist_pop(struct keylist *l) bool __bch_ptr_invalid(struct cache_set *c, int level, const struct bkey *k) { unsigned i; + char buf[80]; if (level && (!KEY_PTRS(k) || !KEY_SIZE(k) || KEY_DIRTY(k))) goto bad; @@ -102,7 +103,8 @@ bool __bch_ptr_invalid(struct cache_set *c, int level, const struct bkey *k) return false; bad: - cache_bug(c, "spotted bad key %s: %s", pkey(k), bch_ptr_status(c, k)); + bch_bkey_to_text(buf, sizeof(buf), k); + cache_bug(c, "spotted bad key %s: %s", buf, bch_ptr_status(c, k)); return true; } @@ -162,10 +164,16 @@ bool bch_ptr_bad(struct btree *b, const struct bkey *k) #ifdef CONFIG_BCACHE_EDEBUG bug: mutex_unlock(&b->c->bucket_lock); - btree_bug(b, + + { + char buf[80]; + + bch_bkey_to_text(buf, sizeof(buf), k); + btree_bug(b, "inconsistent pointer %s: bucket %zu pin %i prio %i gen %i last_gc %i mark %llu gc_gen %i", - pkey(k), PTR_BUCKET_NR(b->c, k, i), atomic_read(&g->pin), - g->prio, g->gen, g->last_gc, GC_MARK(g), g->gc_gen); + buf, PTR_BUCKET_NR(b->c, k, i), atomic_read(&g->pin), + g->prio, g->gen, g->last_gc, GC_MARK(g), g->gc_gen); + } return true; #endif } diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 218d486259a3..53a0f4ef4e32 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -1770,7 +1770,7 @@ static bool btree_insert_key(struct btree *b, struct btree_op *op, { struct bset *i = b->sets[b->nsets].data; struct bkey *m, *prev; - const char *status = "insert"; + unsigned status = BTREE_INSERT_STATUS_INSERT; BUG_ON(bkey_cmp(k, &b->key) > 0); BUG_ON(b->level && !KEY_PTRS(k)); @@ -1803,17 +1803,17 @@ static bool btree_insert_key(struct btree *b, struct btree_op *op, goto insert; /* prev is in the tree, if we merge we're done */ - status = "back merging"; + status = BTREE_INSERT_STATUS_BACK_MERGE; if (prev && bch_bkey_try_merge(b, prev, k)) goto merged; - status = "overwrote front"; + status = BTREE_INSERT_STATUS_OVERWROTE; if (m != end(i) && KEY_PTRS(m) == KEY_PTRS(k) && !KEY_SIZE(m)) goto copy; - status = "front merge"; + status = BTREE_INSERT_STATUS_FRONT_MERGE; if (m != end(i) && bch_bkey_try_merge(b, k, m)) goto copy; @@ -1823,16 +1823,12 @@ static bool btree_insert_key(struct btree *b, struct btree_op *op, insert: shift_keys(b, m, k); copy: bkey_copy(m, k); merged: - bch_check_keys(b, "%s for %s at %s: %s", status, - op_type(op), pbtree(b), pkey(k)); - bch_check_key_order_msg(b, i, "%s for %s at %s: %s", status, - op_type(op), pbtree(b), pkey(k)); + bch_check_keys(b, "%u for %s", status, op_type(op)); if (b->level && !KEY_OFFSET(k)) btree_current_write(b)->prio_blocked++; - pr_debug("%s for %s at %s: %s", status, - op_type(op), pbtree(b), pkey(k)); + trace_bcache_btree_insert_key(b, k, op->type, status); return true; } @@ -2234,9 +2230,6 @@ int bch_btree_search_recurse(struct btree *b, struct btree_op *op) struct btree_iter iter; bch_btree_iter_init(b, &iter, &KEY(op->inode, bio->bi_sector, 0)); - pr_debug("at %s searching for %u:%llu", pbtree(b), op->inode, - (uint64_t) bio->bi_sector); - do { k = bch_btree_iter_next_filter(&iter, b, bch_ptr_bad); if (!k) { @@ -2302,8 +2295,6 @@ static int bch_btree_refill_keybuf(struct btree *b, struct btree_op *op, if (buf->key_predicate(buf, k)) { struct keybuf_key *w; - pr_debug("%s", pkey(k)); - spin_lock(&buf->lock); w = array_alloc(&buf->freelist); diff --git a/drivers/md/bcache/btree.h b/drivers/md/bcache/btree.h index 809bd77847a2..2b016b93cad4 100644 --- a/drivers/md/bcache/btree.h +++ b/drivers/md/bcache/btree.h @@ -271,6 +271,13 @@ struct btree_op { BKEY_PADDED(replace); }; +enum { + BTREE_INSERT_STATUS_INSERT, + BTREE_INSERT_STATUS_BACK_MERGE, + BTREE_INSERT_STATUS_OVERWROTE, + BTREE_INSERT_STATUS_FRONT_MERGE, +}; + void bch_btree_op_init_stack(struct btree_op *); static inline void rw_lock(bool w, struct btree *b, int level) diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index ae6096c6845d..82e3a07771ec 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c @@ -47,11 +47,10 @@ const char *bch_ptr_status(struct cache_set *c, const struct bkey *k) return ""; } -struct keyprint_hack bch_pkey(const struct bkey *k) +int bch_bkey_to_text(char *buf, size_t size, const struct bkey *k) { unsigned i = 0; - struct keyprint_hack r; - char *out = r.s, *end = r.s + KEYHACK_SIZE; + char *out = buf, *end = buf + size; #define p(...) (out += scnprintf(out, end - out, __VA_ARGS__)) @@ -75,16 +74,14 @@ struct keyprint_hack bch_pkey(const struct bkey *k) if (KEY_CSUM(k)) p(" cs%llu %llx", KEY_CSUM(k), k->ptr[1]); #undef p - return r; + return out - buf; } -struct keyprint_hack bch_pbtree(const struct btree *b) +int bch_btree_to_text(char *buf, size_t size, const struct btree *b) { - struct keyprint_hack r; - - snprintf(r.s, 40, "%zu level %i/%i", PTR_BUCKET_NR(b->c, &b->key, 0), - b->level, b->c->root ? b->c->root->level : -1); - return r; + return scnprintf(buf, size, "%zu level %i/%i", + PTR_BUCKET_NR(b->c, &b->key, 0), + b->level, b->c->root ? b->c->root->level : -1); } #if defined(CONFIG_BCACHE_DEBUG) || defined(CONFIG_BCACHE_EDEBUG) @@ -100,10 +97,12 @@ static void dump_bset(struct btree *b, struct bset *i) { struct bkey *k; unsigned j; + char buf[80]; for (k = i->start; k < end(i); k = bkey_next(k)) { + bch_bkey_to_text(buf, sizeof(buf), k); printk(KERN_ERR "block %zu key %zi/%u: %s", index(i, b), - (uint64_t *) k - i->d, i->keys, pkey(k)); + (uint64_t *) k - i->d, i->keys, buf); for (j = 0; j < KEY_PTRS(k); j++) { size_t n = PTR_BUCKET_NR(b->c, k, j); @@ -252,6 +251,7 @@ static void vdump_bucket_and_panic(struct btree *b, const char *fmt, va_list args) { unsigned i; + char buf[80]; console_lock(); @@ -262,7 +262,8 @@ static void vdump_bucket_and_panic(struct btree *b, const char *fmt, console_unlock(); - panic("at %s\n", pbtree(b)); + bch_btree_to_text(buf, sizeof(buf), b); + panic("at %s\n", buf); } void bch_check_key_order_msg(struct btree *b, struct bset *i, @@ -337,6 +338,7 @@ static ssize_t bch_dump_read(struct file *file, char __user *buf, { struct dump_iterator *i = file->private_data; ssize_t ret = 0; + char kbuf[80]; while (size) { struct keybuf_key *w; @@ -359,7 +361,8 @@ static ssize_t bch_dump_read(struct file *file, char __user *buf, if (!w) break; - i->bytes = snprintf(i->buf, PAGE_SIZE, "%s\n", pkey(&w->key)); + bch_bkey_to_text(kbuf, sizeof(kbuf), &w->key); + i->bytes = snprintf(i->buf, PAGE_SIZE, "%s\n", kbuf); bch_keybuf_del(&i->keys, w); } @@ -526,10 +529,17 @@ static ssize_t btree_fuzz(struct kobject *k, struct kobj_attribute *a, k < end(i); k = bkey_next(k), l = bkey_next(l)) if (bkey_cmp(k, l) || - KEY_SIZE(k) != KEY_SIZE(l)) + KEY_SIZE(k) != KEY_SIZE(l)) { + char buf1[80]; + char buf2[80]; + + bch_bkey_to_text(buf1, sizeof(buf1), k); + bch_bkey_to_text(buf2, sizeof(buf2), l); + pr_err("key %zi differs: %s != %s", (uint64_t *) k - i->d, - pkey(k), pkey(l)); + buf1, buf2); + } for (j = 0; j < 3; j++) { pr_err("**** Set %i ****", j); diff --git a/drivers/md/bcache/debug.h b/drivers/md/bcache/debug.h index f9378a218148..1c39b5a2489b 100644 --- a/drivers/md/bcache/debug.h +++ b/drivers/md/bcache/debug.h @@ -3,15 +3,8 @@ /* Btree/bkey debug printing */ -#define KEYHACK_SIZE 80 -struct keyprint_hack { - char s[KEYHACK_SIZE]; -}; - -struct keyprint_hack bch_pkey(const struct bkey *k); -struct keyprint_hack bch_pbtree(const struct btree *b); -#define pkey(k) (&bch_pkey(k).s[0]) -#define pbtree(b) (&bch_pbtree(b).s[0]) +int bch_bkey_to_text(char *buf, size_t size, const struct bkey *k); +int bch_btree_to_text(char *buf, size_t size, const struct btree *b); #ifdef CONFIG_BCACHE_EDEBUG diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 47bc13745068..f24c2e0cbb1c 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -343,6 +343,7 @@ static void uuid_io(struct cache_set *c, unsigned long rw, struct closure *cl = &c->uuid_write.cl; struct uuid_entry *u; unsigned i; + char buf[80]; BUG_ON(!parent); closure_lock(&c->uuid_write, parent); @@ -363,8 +364,8 @@ static void uuid_io(struct cache_set *c, unsigned long rw, break; } - pr_debug("%s UUIDs at %s", rw & REQ_WRITE ? "wrote" : "read", - pkey(&c->uuid_bucket)); + bch_bkey_to_text(buf, sizeof(buf), k); + pr_debug("%s UUIDs at %s", rw & REQ_WRITE ? "wrote" : "read", buf); for (u = c->uuids; u < c->uuids + c->nr_uuids; u++) if (!bch_is_zero(u->uuid, 16)) diff --git a/drivers/md/bcache/trace.c b/drivers/md/bcache/trace.c index 7f4f38aa16ae..f7b6c197f90f 100644 --- a/drivers/md/bcache/trace.c +++ b/drivers/md/bcache/trace.c @@ -40,6 +40,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_gc_end); EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_gc_copy); EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_gc_copy_collision); +EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_insert_key); + EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_node_split); EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_node_compact); EXPORT_TRACEPOINT_SYMBOL_GPL(bcache_btree_set_root); diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h index c9952b36fcea..5ebda976ea93 100644 --- a/include/trace/events/bcache.h +++ b/include/trace/events/bcache.h @@ -305,6 +305,39 @@ DEFINE_EVENT(bkey, bcache_gc_copy_collision, TP_ARGS(k) ); +TRACE_EVENT(bcache_btree_insert_key, + TP_PROTO(struct btree *b, struct bkey *k, unsigned op, unsigned status), + TP_ARGS(b, k, op, status), + + TP_STRUCT__entry( + __field(u64, btree_node ) + __field(u32, btree_level ) + __field(u32, inode ) + __field(u64, offset ) + __field(u32, size ) + __field(u8, dirty ) + __field(u8, op ) + __field(u8, status ) + ), + + TP_fast_assign( + __entry->btree_node = PTR_BUCKET_NR(b->c, &b->key, 0); + __entry->btree_level = b->level; + __entry->inode = KEY_INODE(k); + __entry->offset = KEY_OFFSET(k); + __entry->size = KEY_SIZE(k); + __entry->dirty = KEY_DIRTY(k); + __entry->op = op; + __entry->status = status; + ), + + TP_printk("%u for %u at %llu(%u): %u:%llu len %u dirty %u", + __entry->status, __entry->op, + __entry->btree_node, __entry->btree_level, + __entry->inode, __entry->offset, + __entry->size, __entry->dirty) +); + DECLARE_EVENT_CLASS(btree_split, TP_PROTO(struct btree *b, unsigned keys), TP_ARGS(b, keys), From 6ded34d1a54c046a45db071d3cb7b37bd0a4a31f Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Sat, 11 May 2013 15:59:37 -0700 Subject: [PATCH 037/913] bcache: Improve lazy sorting The old lazy sorting code was kind of hacky - rewrite in a way that mathematically makes more sense; the idea is that the size of the sets of keys in a btree node should increase by a more or less fixed ratio from smallest to biggest. Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/bcache.h | 1 + drivers/md/bcache/bset.c | 40 ++++++++++++++++++++++---------------- drivers/md/bcache/super.c | 2 ++ 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 59c15e09e4dd..6fa5a1e33c49 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -828,6 +828,7 @@ struct cache_set { */ struct mutex sort_lock; struct bset *sort; + unsigned sort_crit_factor; /* List of buckets we're currently writing data to */ struct list_head data_buckets; diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c index e9399ed7f688..a0f190ac17a4 100644 --- a/drivers/md/bcache/bset.c +++ b/drivers/md/bcache/bset.c @@ -1092,33 +1092,39 @@ void bch_btree_sort_into(struct btree *b, struct btree *new) new->sets->size = 0; } +#define SORT_CRIT (4096 / sizeof(uint64_t)) + void bch_btree_sort_lazy(struct btree *b) { - if (b->nsets) { - unsigned i, j, keys = 0, total; + unsigned crit = SORT_CRIT; + int i; - for (i = 0; i <= b->nsets; i++) - keys += b->sets[i].data->keys; + /* Don't sort if nothing to do */ + if (!b->nsets) + goto out; - total = keys; + /* If not a leaf node, always sort */ + if (b->level) { + bch_btree_sort(b); + return; + } - for (j = 0; j < b->nsets; j++) { - if (keys * 2 < total || - keys < 1000) { - bch_btree_sort_partial(b, j); - return; - } + for (i = b->nsets - 1; i >= 0; --i) { + crit *= b->c->sort_crit_factor; - keys -= b->sets[j].data->keys; - } - - /* Must sort if b->nsets == 3 or we'll overflow */ - if (b->nsets >= (MAX_BSETS - 1) - b->level) { - bch_btree_sort(b); + if (b->sets[i].data->keys < crit) { + bch_btree_sort_partial(b, i); return; } } + /* Sort if we'd overflow */ + if (b->nsets + 1 == MAX_BSETS) { + bch_btree_sort(b); + return; + } + +out: bset_build_written_tree(b); } diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index f24c2e0cbb1c..3c8474161e8e 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1375,6 +1375,8 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) c->btree_pages = max_t(int, c->btree_pages / 4, BTREE_MAX_PAGES); + c->sort_crit_factor = int_sqrt(c->btree_pages); + mutex_init(&c->bucket_lock); mutex_init(&c->sort_lock); spin_lock_init(&c->sort_time_lock); From 444fc0b6b167ed164e7436621a9d095e042644dd Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Sat, 11 May 2013 17:07:26 -0700 Subject: [PATCH 038/913] bcache: Initialize sectors_dirty when attaching Previously, dirty_data wouldn't get initialized until the first garbage collection... which was a bit of a problem for background writeback (as the PD controller keys off of it) and also confusing for users. This is also prep work for making background writeback aware of raid5/6 stripes. Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/bcache.h | 2 +- drivers/md/bcache/btree.c | 29 +--------------------------- drivers/md/bcache/super.c | 1 + drivers/md/bcache/writeback.c | 36 +++++++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 6fa5a1e33c49..d099d8894c2f 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -438,7 +438,6 @@ struct bcache_device { atomic_t detaching; atomic_long_t sectors_dirty; - unsigned long sectors_dirty_gc; unsigned long sectors_dirty_last; long sectors_dirty_derivative; @@ -1225,6 +1224,7 @@ void bch_cache_set_stop(struct cache_set *); struct cache_set *bch_cache_set_alloc(struct cache_sb *); void bch_btree_cache_free(struct cache_set *); int bch_btree_cache_alloc(struct cache_set *); +void bch_sectors_dirty_init(struct cached_dev *); void bch_cached_dev_writeback_init(struct cached_dev *); void bch_moving_init_cache_set(struct cache_set *); diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 53a0f4ef4e32..230c3a6d9be2 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -1119,11 +1119,8 @@ static int btree_gc_mark_node(struct btree *b, unsigned *keys, gc->nkeys++; gc->data += KEY_SIZE(k); - if (KEY_DIRTY(k)) { + if (KEY_DIRTY(k)) gc->dirty += KEY_SIZE(k); - if (d) - d->sectors_dirty_gc += KEY_SIZE(k); - } } for (t = b->sets; t <= &b->sets[b->nsets]; t++) @@ -1377,7 +1374,6 @@ static void btree_gc_start(struct cache_set *c) { struct cache *ca; struct bucket *b; - struct bcache_device **d; unsigned i; if (!c->gc_mark_valid) @@ -1395,12 +1391,6 @@ static void btree_gc_start(struct cache_set *c) SET_GC_MARK(b, GC_MARK_RECLAIMABLE); } - for (d = c->devices; - d < c->devices + c->nr_uuids; - d++) - if (*d) - (*d)->sectors_dirty_gc = 0; - mutex_unlock(&c->bucket_lock); } @@ -1409,7 +1399,6 @@ size_t bch_btree_gc_finish(struct cache_set *c) size_t available = 0; struct bucket *b; struct cache *ca; - struct bcache_device **d; unsigned i; mutex_lock(&c->bucket_lock); @@ -1452,22 +1441,6 @@ size_t bch_btree_gc_finish(struct cache_set *c) } } - for (d = c->devices; - d < c->devices + c->nr_uuids; - d++) - if (*d) { - unsigned long last = - atomic_long_read(&((*d)->sectors_dirty)); - long difference = (*d)->sectors_dirty_gc - last; - - pr_debug("sectors dirty off by %li", difference); - - (*d)->sectors_dirty_last += difference; - - atomic_long_set(&((*d)->sectors_dirty), - (*d)->sectors_dirty_gc); - } - mutex_unlock(&c->bucket_lock); return available; } diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 3c8474161e8e..dbfa1c38e85e 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -961,6 +961,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c) atomic_set(&dc->count, 1); if (BDEV_STATE(&dc->sb) == BDEV_STATE_DIRTY) { + bch_sectors_dirty_init(dc); atomic_set(&dc->has_dirty, 1); atomic_inc(&dc->count); bch_writeback_queue(dc); diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index 82f6d4577be2..553949eefd51 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -377,6 +377,42 @@ err: refill_dirty(cl); } +/* Init */ + +static int bch_btree_sectors_dirty_init(struct btree *b, struct btree_op *op, + struct cached_dev *dc) +{ + struct bkey *k; + struct btree_iter iter; + + bch_btree_iter_init(b, &iter, &KEY(dc->disk.id, 0, 0)); + while ((k = bch_btree_iter_next_filter(&iter, b, bch_ptr_bad))) + if (!b->level) { + if (KEY_INODE(k) > dc->disk.id) + break; + + if (KEY_DIRTY(k)) + atomic_long_add(KEY_SIZE(k), + &dc->disk.sectors_dirty); + } else { + btree(sectors_dirty_init, k, b, op, dc); + if (KEY_INODE(k) > dc->disk.id) + break; + + cond_resched(); + } + + return 0; +} + +void bch_sectors_dirty_init(struct cached_dev *dc) +{ + struct btree_op op; + + bch_btree_op_init_stack(&op); + btree_root(sectors_dirty_init, dc->disk.c, &op, dc); +} + void bch_cached_dev_writeback_init(struct cached_dev *dc) { closure_init_unlocked(&dc->writeback); From 279afbad4e54acbd61bf88a54a73af3bbfdeb5dd Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Wed, 5 Jun 2013 06:21:07 -0700 Subject: [PATCH 039/913] bcache: Track dirty data by stripe To make background writeback aware of raid5/6 stripes, we first need to track the amount of dirty data within each stripe - we do this by breaking up the existing sectors_dirty into per stripe atomic_ts Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/bcache.h | 10 ++++----- drivers/md/bcache/btree.c | 20 ++++++++++++------ drivers/md/bcache/request.c | 3 ++- drivers/md/bcache/super.c | 32 ++++++++++++++++++++++++---- drivers/md/bcache/sysfs.c | 5 +++-- drivers/md/bcache/writeback.c | 40 +++++++++++++++++++++++++++++------ drivers/md/bcache/writeback.h | 21 ++++++++++++++++++ 7 files changed, 105 insertions(+), 26 deletions(-) create mode 100644 drivers/md/bcache/writeback.h diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index d099d8894c2f..dbddef0cdb59 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -437,7 +437,10 @@ struct bcache_device { /* If nonzero, we're detaching/unregistering from cache set */ atomic_t detaching; - atomic_long_t sectors_dirty; + uint64_t nr_stripes; + unsigned stripe_size_bits; + atomic_t *stripe_sectors_dirty; + unsigned long sectors_dirty_last; long sectors_dirty_derivative; @@ -1159,9 +1162,6 @@ static inline void wake_up_allocators(struct cache_set *c) /* Forward declarations */ -void bch_writeback_queue(struct cached_dev *); -void bch_writeback_add(struct cached_dev *, unsigned); - void bch_count_io_errors(struct cache *, int, const char *); void bch_bbio_count_io_errors(struct cache_set *, struct bio *, int, const char *); @@ -1224,8 +1224,6 @@ void bch_cache_set_stop(struct cache_set *); struct cache_set *bch_cache_set_alloc(struct cache_sb *); void bch_btree_cache_free(struct cache_set *); int bch_btree_cache_alloc(struct cache_set *); -void bch_sectors_dirty_init(struct cached_dev *); -void bch_cached_dev_writeback_init(struct cached_dev *); void bch_moving_init_cache_set(struct cache_set *); int bch_cache_allocator_start(struct cache *ca); diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 230c3a6d9be2..b93cf56260a4 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -24,6 +24,7 @@ #include "btree.h" #include "debug.h" #include "request.h" +#include "writeback.h" #include <linux/slab.h> #include <linux/bitops.h> @@ -1599,14 +1600,14 @@ static bool fix_overlapping_extents(struct btree *b, struct btree_iter *iter, struct btree_op *op) { - void subtract_dirty(struct bkey *k, int sectors) + void subtract_dirty(struct bkey *k, uint64_t offset, int sectors) { - struct bcache_device *d = b->c->devices[KEY_INODE(k)]; - - if (KEY_DIRTY(k) && d) - atomic_long_sub(sectors, &d->sectors_dirty); + if (KEY_DIRTY(k)) + bcache_dev_sectors_dirty_add(b->c, KEY_INODE(k), + offset, -sectors); } + uint64_t old_offset; unsigned old_size, sectors_found = 0; while (1) { @@ -1618,6 +1619,7 @@ static bool fix_overlapping_extents(struct btree *b, if (bkey_cmp(k, &START_KEY(insert)) <= 0) continue; + old_offset = KEY_START(k); old_size = KEY_SIZE(k); /* @@ -1673,7 +1675,7 @@ static bool fix_overlapping_extents(struct btree *b, struct bkey *top; - subtract_dirty(k, KEY_SIZE(insert)); + subtract_dirty(k, KEY_START(insert), KEY_SIZE(insert)); if (bkey_written(b, k)) { /* @@ -1720,7 +1722,7 @@ static bool fix_overlapping_extents(struct btree *b, } } - subtract_dirty(k, old_size - KEY_SIZE(k)); + subtract_dirty(k, old_offset, old_size - KEY_SIZE(k)); } check_failed: @@ -1796,6 +1798,10 @@ static bool btree_insert_key(struct btree *b, struct btree_op *op, insert: shift_keys(b, m, k); copy: bkey_copy(m, k); merged: + if (KEY_DIRTY(k)) + bcache_dev_sectors_dirty_add(b->c, KEY_INODE(k), + KEY_START(k), KEY_SIZE(k)); + bch_check_keys(b, "%u for %s", status, op_type(op)); if (b->level && !KEY_OFFSET(k)) diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 695469958c1e..017c95fced8e 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -10,6 +10,7 @@ #include "btree.h" #include "debug.h" #include "request.h" +#include "writeback.h" #include <linux/cgroup.h> #include <linux/module.h> @@ -1044,7 +1045,7 @@ static void request_write(struct cached_dev *dc, struct search *s) closure_bio_submit(bio, cl, s->d); } else { s->op.cache_bio = bio; - bch_writeback_add(dc, bio_sectors(bio)); + bch_writeback_add(dc); } out: closure_call(&s->op.cl, bch_insert_data, NULL, cl); diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index dbfa1c38e85e..8c73f0c7f28a 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -10,6 +10,7 @@ #include "btree.h" #include "debug.h" #include "request.h" +#include "writeback.h" #include <linux/blkdev.h> #include <linux/buffer_head.h> @@ -744,13 +745,35 @@ static void bcache_device_free(struct bcache_device *d) mempool_destroy(d->unaligned_bvec); if (d->bio_split) bioset_free(d->bio_split); + if (is_vmalloc_addr(d->stripe_sectors_dirty)) + vfree(d->stripe_sectors_dirty); + else + kfree(d->stripe_sectors_dirty); closure_debug_destroy(&d->cl); } -static int bcache_device_init(struct bcache_device *d, unsigned block_size) +static int bcache_device_init(struct bcache_device *d, unsigned block_size, + sector_t sectors) { struct request_queue *q; + size_t n; + + if (!d->stripe_size_bits) + d->stripe_size_bits = 31; + + d->nr_stripes = round_up(sectors, 1 << d->stripe_size_bits) >> + d->stripe_size_bits; + + if (!d->nr_stripes || d->nr_stripes > SIZE_MAX / sizeof(atomic_t)) + return -ENOMEM; + + n = d->nr_stripes * sizeof(atomic_t); + d->stripe_sectors_dirty = n < PAGE_SIZE << 6 + ? kzalloc(n, GFP_KERNEL) + : vzalloc(n); + if (!d->stripe_sectors_dirty) + return -ENOMEM; if (!(d->bio_split = bioset_create(4, offsetof(struct bbio, bio))) || !(d->unaligned_bvec = mempool_create_kmalloc_pool(1, @@ -760,6 +783,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size) !(q = blk_alloc_queue(GFP_KERNEL))) return -ENOMEM; + set_capacity(d->disk, sectors); snprintf(d->disk->disk_name, DISK_NAME_LEN, "bcache%i", bcache_minor); d->disk->major = bcache_major; @@ -1047,7 +1071,8 @@ static int cached_dev_init(struct cached_dev *dc, unsigned block_size) hlist_add_head(&io->hash, dc->io_hash + RECENT_IO); } - ret = bcache_device_init(&dc->disk, block_size); + ret = bcache_device_init(&dc->disk, block_size, + dc->bdev->bd_part->nr_sects - dc->sb.data_offset); if (ret) return ret; @@ -1146,11 +1171,10 @@ static int flash_dev_run(struct cache_set *c, struct uuid_entry *u) kobject_init(&d->kobj, &bch_flash_dev_ktype); - if (bcache_device_init(d, block_bytes(c))) + if (bcache_device_init(d, block_bytes(c), u->sectors)) goto err; bcache_device_attach(d, c, u - c->uuids); - set_capacity(d->disk, u->sectors); bch_flash_dev_request_init(d); add_disk(d->disk); diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index f5c2d8695230..cf8d91ec3238 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -9,6 +9,7 @@ #include "sysfs.h" #include "btree.h" #include "request.h" +#include "writeback.h" #include <linux/blkdev.h> #include <linux/sort.h> @@ -128,7 +129,7 @@ SHOW(__bch_cached_dev) char derivative[20]; char target[20]; bch_hprint(dirty, - atomic_long_read(&dc->disk.sectors_dirty) << 9); + bcache_dev_sectors_dirty(&dc->disk) << 9); bch_hprint(derivative, dc->writeback_rate_derivative << 9); bch_hprint(target, dc->writeback_rate_target << 9); @@ -144,7 +145,7 @@ SHOW(__bch_cached_dev) } sysfs_hprint(dirty_data, - atomic_long_read(&dc->disk.sectors_dirty) << 9); + bcache_dev_sectors_dirty(&dc->disk) << 9); var_printf(sequential_merge, "%i"); var_hprint(sequential_cutoff); diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index 553949eefd51..dd815475c524 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -9,6 +9,7 @@ #include "bcache.h" #include "btree.h" #include "debug.h" +#include "writeback.h" #include <trace/events/bcache.h> @@ -38,7 +39,7 @@ static void __update_writeback_rate(struct cached_dev *dc) int change = 0; int64_t error; - int64_t dirty = atomic_long_read(&dc->disk.sectors_dirty); + int64_t dirty = bcache_dev_sectors_dirty(&dc->disk); int64_t derivative = dirty - dc->disk.sectors_dirty_last; dc->disk.sectors_dirty_last = dirty; @@ -183,10 +184,8 @@ void bch_writeback_queue(struct cached_dev *dc) } } -void bch_writeback_add(struct cached_dev *dc, unsigned sectors) +void bch_writeback_add(struct cached_dev *dc) { - atomic_long_add(sectors, &dc->disk.sectors_dirty); - if (!atomic_read(&dc->has_dirty) && !atomic_xchg(&dc->has_dirty, 1)) { atomic_inc(&dc->count); @@ -205,6 +204,34 @@ void bch_writeback_add(struct cached_dev *dc, unsigned sectors) } } +void bcache_dev_sectors_dirty_add(struct cache_set *c, unsigned inode, + uint64_t offset, int nr_sectors) +{ + struct bcache_device *d = c->devices[inode]; + unsigned stripe_size, stripe_offset; + uint64_t stripe; + + if (!d) + return; + + stripe_size = 1 << d->stripe_size_bits; + stripe = offset >> d->stripe_size_bits; + stripe_offset = offset & (stripe_size - 1); + + while (nr_sectors) { + int s = min_t(unsigned, abs(nr_sectors), + stripe_size - stripe_offset); + + if (nr_sectors < 0) + s = -s; + + atomic_add(s, d->stripe_sectors_dirty + stripe); + nr_sectors -= s; + stripe_offset = 0; + stripe++; + } +} + /* Background writeback - IO loop */ static void dirty_io_destructor(struct closure *cl) @@ -392,8 +419,9 @@ static int bch_btree_sectors_dirty_init(struct btree *b, struct btree_op *op, break; if (KEY_DIRTY(k)) - atomic_long_add(KEY_SIZE(k), - &dc->disk.sectors_dirty); + bcache_dev_sectors_dirty_add(b->c, dc->disk.id, + KEY_START(k), + KEY_SIZE(k)); } else { btree(sectors_dirty_init, k, b, op, dc); if (KEY_INODE(k) > dc->disk.id) diff --git a/drivers/md/bcache/writeback.h b/drivers/md/bcache/writeback.h new file mode 100644 index 000000000000..5ce9771df047 --- /dev/null +++ b/drivers/md/bcache/writeback.h @@ -0,0 +1,21 @@ +#ifndef _BCACHE_WRITEBACK_H +#define _BCACHE_WRITEBACK_H + +static inline uint64_t bcache_dev_sectors_dirty(struct bcache_device *d) +{ + uint64_t i, ret = 0; + + for (i = 0; i < d->nr_stripes; i++) + ret += atomic_read(d->stripe_sectors_dirty + i); + + return ret; +} + +void bcache_dev_sectors_dirty_add(struct cache_set *, unsigned, uint64_t, int); +void bch_writeback_queue(struct cached_dev *); +void bch_writeback_add(struct cached_dev *); + +void bch_sectors_dirty_init(struct cached_dev *dc); +void bch_cached_dev_writeback_init(struct cached_dev *); + +#endif From 72c270612bd33192fa836ad0f2939af1ca218292 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Wed, 5 Jun 2013 06:24:39 -0700 Subject: [PATCH 040/913] bcache: Write out full stripes Now that we're tracking dirty data per stripe, we can add two optimizations for raid5/6: * If a stripe is already dirty, force writes to that stripe to writeback mode - to help build up full stripes of dirty data * When flushing dirty data, preferentially write out full stripes first if there are any. Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/bcache.h | 3 +-- drivers/md/bcache/btree.c | 19 ++++++++------- drivers/md/bcache/btree.h | 9 +++---- drivers/md/bcache/debug.c | 4 ++-- drivers/md/bcache/movinggc.c | 5 ++-- drivers/md/bcache/request.c | 23 ++++++------------ drivers/md/bcache/sysfs.c | 8 +++++++ drivers/md/bcache/writeback.c | 44 +++++++++++++++++++++++++++++++++-- drivers/md/bcache/writeback.h | 43 ++++++++++++++++++++++++++++++++++ 9 files changed, 121 insertions(+), 37 deletions(-) diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index dbddef0cdb59..342ba86c6e4f 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -387,8 +387,6 @@ struct keybuf_key { typedef bool (keybuf_pred_fn)(struct keybuf *, struct bkey *); struct keybuf { - keybuf_pred_fn *key_predicate; - struct bkey last_scanned; spinlock_t lock; @@ -532,6 +530,7 @@ struct cached_dev { unsigned sequential_merge:1; unsigned verify:1; + unsigned partial_stripes_expensive:1; unsigned writeback_metadata:1; unsigned writeback_running:1; unsigned char writeback_percent; diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index b93cf56260a4..09fb8a2f43da 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -2252,7 +2252,8 @@ static inline int keybuf_nonoverlapping_cmp(struct keybuf_key *l, } static int bch_btree_refill_keybuf(struct btree *b, struct btree_op *op, - struct keybuf *buf, struct bkey *end) + struct keybuf *buf, struct bkey *end, + keybuf_pred_fn *pred) { struct btree_iter iter; bch_btree_iter_init(b, &iter, &buf->last_scanned); @@ -2271,7 +2272,7 @@ static int bch_btree_refill_keybuf(struct btree *b, struct btree_op *op, if (bkey_cmp(&buf->last_scanned, end) >= 0) break; - if (buf->key_predicate(buf, k)) { + if (pred(buf, k)) { struct keybuf_key *w; spin_lock(&buf->lock); @@ -2290,7 +2291,7 @@ static int bch_btree_refill_keybuf(struct btree *b, struct btree_op *op, if (!k) break; - btree(refill_keybuf, k, b, op, buf, end); + btree(refill_keybuf, k, b, op, buf, end, pred); /* * Might get an error here, but can't really do anything * and it'll get logged elsewhere. Just read what we @@ -2308,7 +2309,7 @@ static int bch_btree_refill_keybuf(struct btree *b, struct btree_op *op, } void bch_refill_keybuf(struct cache_set *c, struct keybuf *buf, - struct bkey *end) + struct bkey *end, keybuf_pred_fn *pred) { struct bkey start = buf->last_scanned; struct btree_op op; @@ -2316,7 +2317,7 @@ void bch_refill_keybuf(struct cache_set *c, struct keybuf *buf, cond_resched(); - btree_root(refill_keybuf, c, &op, buf, end); + btree_root(refill_keybuf, c, &op, buf, end, pred); closure_sync(&op.cl); pr_debug("found %s keys from %llu:%llu to %llu:%llu", @@ -2402,7 +2403,8 @@ struct keybuf_key *bch_keybuf_next(struct keybuf *buf) struct keybuf_key *bch_keybuf_next_rescan(struct cache_set *c, struct keybuf *buf, - struct bkey *end) + struct bkey *end, + keybuf_pred_fn *pred) { struct keybuf_key *ret; @@ -2416,15 +2418,14 @@ struct keybuf_key *bch_keybuf_next_rescan(struct cache_set *c, break; } - bch_refill_keybuf(c, buf, end); + bch_refill_keybuf(c, buf, end, pred); } return ret; } -void bch_keybuf_init(struct keybuf *buf, keybuf_pred_fn *fn) +void bch_keybuf_init(struct keybuf *buf) { - buf->key_predicate = fn; buf->last_scanned = MAX_KEY; buf->keys = RB_ROOT; diff --git a/drivers/md/bcache/btree.h b/drivers/md/bcache/btree.h index 2b016b93cad4..f66d69a7baf1 100644 --- a/drivers/md/bcache/btree.h +++ b/drivers/md/bcache/btree.h @@ -391,13 +391,14 @@ void bch_moving_gc(struct closure *); int bch_btree_check(struct cache_set *, struct btree_op *); uint8_t __bch_btree_mark_key(struct cache_set *, int, struct bkey *); -void bch_keybuf_init(struct keybuf *, keybuf_pred_fn *); -void bch_refill_keybuf(struct cache_set *, struct keybuf *, struct bkey *); +void bch_keybuf_init(struct keybuf *); +void bch_refill_keybuf(struct cache_set *, struct keybuf *, struct bkey *, + keybuf_pred_fn *); bool bch_keybuf_check_overlapping(struct keybuf *, struct bkey *, struct bkey *); void bch_keybuf_del(struct keybuf *, struct keybuf_key *); struct keybuf_key *bch_keybuf_next(struct keybuf *); -struct keybuf_key *bch_keybuf_next_rescan(struct cache_set *, - struct keybuf *, struct bkey *); +struct keybuf_key *bch_keybuf_next_rescan(struct cache_set *, struct keybuf *, + struct bkey *, keybuf_pred_fn *); #endif diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index 82e3a07771ec..1c8fd319846e 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c @@ -357,7 +357,7 @@ static ssize_t bch_dump_read(struct file *file, char __user *buf, if (i->bytes) break; - w = bch_keybuf_next_rescan(i->c, &i->keys, &MAX_KEY); + w = bch_keybuf_next_rescan(i->c, &i->keys, &MAX_KEY, dump_pred); if (!w) break; @@ -380,7 +380,7 @@ static int bch_dump_open(struct inode *inode, struct file *file) file->private_data = i; i->c = c; - bch_keybuf_init(&i->keys, dump_pred); + bch_keybuf_init(&i->keys); i->keys.last_scanned = KEY(0, 0, 0); return 0; diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c index 04f6b97ffda6..a241e9fd4f7f 100644 --- a/drivers/md/bcache/movinggc.c +++ b/drivers/md/bcache/movinggc.c @@ -136,7 +136,8 @@ static void read_moving(struct closure *cl) /* XXX: if we error, background writeback could stall indefinitely */ while (!test_bit(CACHE_SET_STOPPING, &c->flags)) { - w = bch_keybuf_next_rescan(c, &c->moving_gc_keys, &MAX_KEY); + w = bch_keybuf_next_rescan(c, &c->moving_gc_keys, + &MAX_KEY, moving_pred); if (!w) break; @@ -248,5 +249,5 @@ void bch_moving_gc(struct closure *cl) void bch_moving_init_cache_set(struct cache_set *c) { - bch_keybuf_init(&c->moving_gc_keys, moving_pred); + bch_keybuf_init(&c->moving_gc_keys); } diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 017c95fced8e..17bd59704eba 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -22,8 +22,6 @@ #define CUTOFF_CACHE_ADD 95 #define CUTOFF_CACHE_READA 90 -#define CUTOFF_WRITEBACK 50 -#define CUTOFF_WRITEBACK_SYNC 75 struct kmem_cache *bch_search_cache; @@ -998,17 +996,6 @@ static void cached_dev_write_complete(struct closure *cl) cached_dev_bio_complete(cl); } -static bool should_writeback(struct cached_dev *dc, struct bio *bio) -{ - unsigned threshold = (bio->bi_rw & REQ_SYNC) - ? CUTOFF_WRITEBACK_SYNC - : CUTOFF_WRITEBACK; - - return !atomic_read(&dc->disk.detaching) && - cache_mode(dc, bio) == CACHE_MODE_WRITEBACK && - dc->disk.c->gc_stats.in_use < threshold; -} - static void request_write(struct cached_dev *dc, struct search *s) { struct closure *cl = &s->cl; @@ -1030,12 +1017,16 @@ static void request_write(struct cached_dev *dc, struct search *s) if (bio->bi_rw & REQ_DISCARD) goto skip; + if (should_writeback(dc, s->orig_bio, + cache_mode(dc, bio), + s->op.skip)) { + s->op.skip = false; + s->writeback = true; + } + if (s->op.skip) goto skip; - if (should_writeback(dc, s->orig_bio)) - s->writeback = true; - trace_bcache_write(s->orig_bio, s->writeback, s->op.skip); if (!s->writeback) { diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index cf8d91ec3238..70c6dff0d0cd 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -81,6 +81,9 @@ rw_attribute(writeback_rate_p_term_inverse); rw_attribute(writeback_rate_d_smooth); read_attribute(writeback_rate_debug); +read_attribute(stripe_size); +read_attribute(partial_stripes_expensive); + rw_attribute(synchronous); rw_attribute(journal_delay_ms); rw_attribute(discard); @@ -147,6 +150,9 @@ SHOW(__bch_cached_dev) sysfs_hprint(dirty_data, bcache_dev_sectors_dirty(&dc->disk) << 9); + sysfs_hprint(stripe_size, (1 << dc->disk.stripe_size_bits) << 9); + var_printf(partial_stripes_expensive, "%u"); + var_printf(sequential_merge, "%i"); var_hprint(sequential_cutoff); var_hprint(readahead); @@ -286,6 +292,8 @@ static struct attribute *bch_cached_dev_files[] = { &sysfs_writeback_rate_d_smooth, &sysfs_writeback_rate_debug, &sysfs_dirty_data, + &sysfs_stripe_size, + &sysfs_partial_stripes_expensive, &sysfs_sequential_cutoff, &sysfs_sequential_merge, &sysfs_clear_stats, diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index dd815475c524..d81ee5ccc726 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -108,6 +108,31 @@ static bool dirty_pred(struct keybuf *buf, struct bkey *k) return KEY_DIRTY(k); } +static bool dirty_full_stripe_pred(struct keybuf *buf, struct bkey *k) +{ + uint64_t stripe; + unsigned nr_sectors = KEY_SIZE(k); + struct cached_dev *dc = container_of(buf, struct cached_dev, + writeback_keys); + unsigned stripe_size = 1 << dc->disk.stripe_size_bits; + + if (!KEY_DIRTY(k)) + return false; + + stripe = KEY_START(k) >> dc->disk.stripe_size_bits; + while (1) { + if (atomic_read(dc->disk.stripe_sectors_dirty + stripe) != + stripe_size) + return false; + + if (nr_sectors <= stripe_size) + return true; + + nr_sectors -= stripe_size; + stripe++; + } +} + static void dirty_init(struct keybuf_key *w) { struct dirty_io *io = w->private; @@ -152,7 +177,22 @@ static void refill_dirty(struct closure *cl) searched_from_start = true; } - bch_refill_keybuf(dc->disk.c, buf, &end); + if (dc->partial_stripes_expensive) { + uint64_t i; + + for (i = 0; i < dc->disk.nr_stripes; i++) + if (atomic_read(dc->disk.stripe_sectors_dirty + i) == + 1 << dc->disk.stripe_size_bits) + goto full_stripes; + + goto normal_refill; +full_stripes: + bch_refill_keybuf(dc->disk.c, buf, &end, + dirty_full_stripe_pred); + } else { +normal_refill: + bch_refill_keybuf(dc->disk.c, buf, &end, dirty_pred); + } if (bkey_cmp(&buf->last_scanned, &end) >= 0 && searched_from_start) { /* Searched the entire btree - delay awhile */ @@ -446,7 +486,7 @@ void bch_cached_dev_writeback_init(struct cached_dev *dc) closure_init_unlocked(&dc->writeback); init_rwsem(&dc->writeback_lock); - bch_keybuf_init(&dc->writeback_keys, dirty_pred); + bch_keybuf_init(&dc->writeback_keys); dc->writeback_metadata = true; dc->writeback_running = true; diff --git a/drivers/md/bcache/writeback.h b/drivers/md/bcache/writeback.h index 5ce9771df047..c91f61bb95b6 100644 --- a/drivers/md/bcache/writeback.h +++ b/drivers/md/bcache/writeback.h @@ -1,6 +1,9 @@ #ifndef _BCACHE_WRITEBACK_H #define _BCACHE_WRITEBACK_H +#define CUTOFF_WRITEBACK 40 +#define CUTOFF_WRITEBACK_SYNC 70 + static inline uint64_t bcache_dev_sectors_dirty(struct bcache_device *d) { uint64_t i, ret = 0; @@ -11,6 +14,46 @@ static inline uint64_t bcache_dev_sectors_dirty(struct bcache_device *d) return ret; } +static inline bool bcache_dev_stripe_dirty(struct bcache_device *d, + uint64_t offset, + unsigned nr_sectors) +{ + uint64_t stripe = offset >> d->stripe_size_bits; + + while (1) { + if (atomic_read(d->stripe_sectors_dirty + stripe)) + return true; + + if (nr_sectors <= 1 << d->stripe_size_bits) + return false; + + nr_sectors -= 1 << d->stripe_size_bits; + stripe++; + } +} + +static inline bool should_writeback(struct cached_dev *dc, struct bio *bio, + unsigned cache_mode, bool would_skip) +{ + unsigned in_use = dc->disk.c->gc_stats.in_use; + + if (cache_mode != CACHE_MODE_WRITEBACK || + atomic_read(&dc->disk.detaching) || + in_use > CUTOFF_WRITEBACK_SYNC) + return false; + + if (dc->partial_stripes_expensive && + bcache_dev_stripe_dirty(&dc->disk, bio->bi_sector, + bio_sectors(bio))) + return true; + + if (would_skip) + return false; + + return bio->bi_rw & REQ_SYNC || + in_use <= CUTOFF_WRITEBACK; +} + void bcache_dev_sectors_dirty_add(struct cache_set *, unsigned, uint64_t, int); void bch_writeback_queue(struct cached_dev *); void bch_writeback_add(struct cached_dev *); From bd206b51bca1e0a1c5f4b00218d56213a1f6d3bd Mon Sep 17 00:00:00 2001 From: Masanari Iida <standby24x7@gmail.com> Date: Mon, 20 May 2013 00:04:35 +0900 Subject: [PATCH 041/913] doc: Fix typo in documentation/bcache.txt Correct spelling typo in documentation/bcache.txt Signed-off-by: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Kent Overstreet <koverstreet@google.com> --- Documentation/bcache.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/bcache.txt b/Documentation/bcache.txt index b3a7e7d384f6..c3365f26b2d9 100644 --- a/Documentation/bcache.txt +++ b/Documentation/bcache.txt @@ -181,7 +181,7 @@ want for getting the best possible numbers when benchmarking. In practice this isn't an issue because as soon as a write comes along it'll cause the btree node to be split, and you need almost no write traffic for - this to not show up enough to be noticable (especially since bcache's btree + this to not show up enough to be noticeable (especially since bcache's btree nodes are huge and index large regions of the device). But when you're benchmarking, if you're trying to warm the cache by reading a bunch of data and there's no other traffic - that can be a problem. @@ -222,7 +222,7 @@ running it's in passthrough mode or caching). sequential_cutoff - A sequential IO will bypass the cache once it passes this threshhold; the + A sequential IO will bypass the cache once it passes this threshold; the most recent 128 IOs are tracked so sequential IO can be detected even when it isn't all done at once. @@ -296,7 +296,7 @@ cache_miss_collisions since the synchronization for cache misses was rewritten) cache_readaheads - Count of times readahead occured. + Count of times readahead occurred. SYSFS - CACHE SET: @@ -362,7 +362,7 @@ unregister SYSFS - CACHE SET INTERNAL: This directory also exposes timings for a number of internal operations, with -separate files for average duration, average frequency, last occurence and max +separate files for average duration, average frequency, last occurrence and max duration: garbage collection, btree read, btree node sorts and btree splits. active_journal_entries @@ -417,7 +417,7 @@ freelist_percent space. io_errors - Number of errors that have occured, decayed by io_error_halflife. + Number of errors that have occurred, decayed by io_error_halflife. metadata_written Sum of all non data writes (btree writes and all other metadata). From a25c32bedeff3573b53572b87bcafe10ec5b75a9 Mon Sep 17 00:00:00 2001 From: Gabriel de Perthuis <g2p.code@gmail.com> Date: Fri, 7 Jun 2013 23:27:01 +0200 Subject: [PATCH 042/913] bcache: Send a uevent with a cached device's UUID Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com> --- drivers/md/bcache/super.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 8c73f0c7f28a..a104dad2c7fa 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -825,6 +825,11 @@ static void calc_cached_dev_sectors(struct cache_set *c) void bch_cached_dev_run(struct cached_dev *dc) { struct bcache_device *d = &dc->disk; + char *env[] = { + "DRIVER=bcache", + kasprintf(GFP_KERNEL, "CACHED_UUID=%pU", dc->sb.uuid), + NULL + }; if (atomic_xchg(&dc->running, 1)) return; @@ -841,10 +846,11 @@ void bch_cached_dev_run(struct cached_dev *dc) add_disk(d->disk); bd_link_disk_holder(dc->bdev, dc->disk.disk); -#if 0 - char *env[] = { "SYMLINK=label" , NULL }; + /* won't show up in the uevent file, use udevadm monitor -e instead + * only class / kset properties are persistent */ kobject_uevent_env(&disk_to_dev(d->disk)->kobj, KOBJ_CHANGE, env); -#endif + kfree(env[1]); + if (sysfs_create_link(&d->kobj, &disk_to_dev(d->disk)->kobj, "dev") || sysfs_create_link(&disk_to_dev(d->disk)->kobj, &d->kobj, "bcache")) pr_debug("error creating sysfs link"); From ab9e14002e271eba41f7f9ab7e9b03cac4adc22d Mon Sep 17 00:00:00 2001 From: Gabriel de Perthuis <g2p.code@gmail.com> Date: Sun, 9 Jun 2013 00:54:48 +0200 Subject: [PATCH 043/913] bcache: Send label uevents Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com> Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/super.c | 9 ++++++++- drivers/md/bcache/sysfs.c | 9 +++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index a104dad2c7fa..cff2d182dfb0 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -825,12 +825,18 @@ static void calc_cached_dev_sectors(struct cache_set *c) void bch_cached_dev_run(struct cached_dev *dc) { struct bcache_device *d = &dc->disk; + char buf[SB_LABEL_SIZE + 1]; char *env[] = { "DRIVER=bcache", kasprintf(GFP_KERNEL, "CACHED_UUID=%pU", dc->sb.uuid), - NULL + NULL, + NULL, }; + memcpy(buf, dc->sb.label, SB_LABEL_SIZE); + buf[SB_LABEL_SIZE] = '\0'; + env[2] = kasprintf(GFP_KERNEL, "CACHED_LABEL=%s", buf); + if (atomic_xchg(&dc->running, 1)) return; @@ -850,6 +856,7 @@ void bch_cached_dev_run(struct cached_dev *dc) * only class / kset properties are persistent */ kobject_uevent_env(&disk_to_dev(d->disk)->kobj, KOBJ_CHANGE, env); kfree(env[1]); + kfree(env[2]); if (sysfs_create_link(&d->kobj, &disk_to_dev(d->disk)->kobj, "dev") || sysfs_create_link(&disk_to_dev(d->disk)->kobj, &d->kobj, "bcache")) diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index 70c6dff0d0cd..dd3f00a42729 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -178,6 +178,7 @@ STORE(__cached_dev) disk.kobj); unsigned v = size; struct cache_set *c; + struct kobj_uevent_env *env; #define d_strtoul(var) sysfs_strtoul(var, dc->var) #define d_strtoi_h(var) sysfs_hatoi(var, dc->var) @@ -222,6 +223,7 @@ STORE(__cached_dev) } if (attr == &sysfs_label) { + /* note: endlines are preserved */ memcpy(dc->sb.label, buf, SB_LABEL_SIZE); bch_write_bdev_super(dc, NULL); if (dc->disk.c) { @@ -229,6 +231,13 @@ STORE(__cached_dev) buf, SB_LABEL_SIZE); bch_uuid_write(dc->disk.c); } + env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL); + add_uevent_var(env, "DRIVER=bcache"); + add_uevent_var(env, "CACHED_UUID=%pU", dc->sb.uuid), + add_uevent_var(env, "CACHED_LABEL=%s", buf); + kobject_uevent_env( + &disk_to_dev(dc->disk.disk)->kobj, KOBJ_CHANGE, env->envp); + kfree(env); } if (attr == &sysfs_attach) { From cecd628d9a9966ed0af1237df5cc5818945fe9f2 Mon Sep 17 00:00:00 2001 From: Gabriel de Perthuis <g2p.code@gmail.com> Date: Thu, 27 Jun 2013 02:12:07 +0200 Subject: [PATCH 044/913] bcache: Refresh usage docs Mention udev autoregistration, symlinks. Write down some sysfs paths. Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com> Signed-off-by: Kent Overstreet <koverstreet@google.com> --- Documentation/bcache.txt | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/Documentation/bcache.txt b/Documentation/bcache.txt index c3365f26b2d9..32b6c3189d98 100644 --- a/Documentation/bcache.txt +++ b/Documentation/bcache.txt @@ -46,29 +46,33 @@ you format your backing devices and cache device at the same time, you won't have to manually attach: make-bcache -B /dev/sda /dev/sdb -C /dev/sdc -To make bcache devices known to the kernel, echo them to /sys/fs/bcache/register: +bcache-tools now ships udev rules, and bcache devices are known to the kernel +immediately. Without udev, you can manually register devices like this: echo /dev/sdb > /sys/fs/bcache/register echo /dev/sdc > /sys/fs/bcache/register -To register your bcache devices automatically, you could add something like -this to an init script: +Registering the backing device makes the bcache device show up in /dev; you can +now format it and use it as normal. But the first time using a new bcache +device, it'll be running in passthrough mode until you attach it to a cache. +See the section on attaching. - echo /dev/sd* > /sys/fs/bcache/register_quiet +The devices show up as: -It'll look for bcache superblocks and ignore everything that doesn't have one. + /dev/bcache<N> -Registering the backing device makes the bcache show up in /dev; you can now -format it and use it as normal. But the first time using a new bcache device, -it'll be running in passthrough mode until you attach it to a cache. See the -section on attaching. +As well as (with udev): -The devices show up at /dev/bcacheN, and can be controlled via sysfs from -/sys/block/bcacheN/bcache: + /dev/bcache/by-uuid/<uuid> + /dev/bcache/by-label/<label> + +To get started: mkfs.ext4 /dev/bcache0 mount /dev/bcache0 /mnt +You can control bcache devices through sysfs at /sys/block/bcache<N>/bcache . + Cache devices are managed as sets; multiple caches per set isn't supported yet but will allow for mirroring of metadata and dirty data in the future. Your new cache set shows up as /sys/fs/bcache/<UUID> @@ -80,11 +84,11 @@ must be attached to your cache set to enable caching. Attaching a backing device to a cache set is done thusly, with the UUID of the cache set in /sys/fs/bcache: - echo <UUID> > /sys/block/bcache0/bcache/attach + echo <CSET-UUID> > /sys/block/bcache0/bcache/attach This only has to be done once. The next time you reboot, just reregister all your bcache devices. If a backing device has data in a cache somewhere, the -/dev/bcache# device won't be created until the cache shows up - particularly +/dev/bcache<N> device won't be created until the cache shows up - particularly important if you have writeback caching turned on. If you're booting up and your cache device is gone and never coming back, you @@ -191,6 +195,9 @@ want for getting the best possible numbers when benchmarking. SYSFS - BACKING DEVICE: +Available at /sys/block/<bdev>/bcache, /sys/block/bcache*/bcache and +(if attached) /sys/fs/bcache/<cset-uuid>/bdev* + attach Echo the UUID of a cache set to this file to enable caching. @@ -300,6 +307,8 @@ cache_readaheads SYSFS - CACHE SET: +Available at /sys/fs/bcache/<cset-uuid> + average_key_size Average data per key in the btree. @@ -390,6 +399,8 @@ trigger_gc SYSFS - CACHE DEVICE: +Available at /sys/block/<cdev>/bcache + block_size Minimum granularity of writes - should match hardware sector size. From 26ea8f9239a062a47cfef38ea9c63409906366ff Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher <agruen@linbit.com> Date: Tue, 25 Jun 2013 16:50:03 +0200 Subject: [PATCH 045/913] drbd: Do not sleep inside rcu Signed-off-by: Andreas Gruenbacher <agruen@linbit.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/drbd/drbd_receiver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 4222affff488..adee58e19e83 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -1039,6 +1039,8 @@ randomize: rcu_read_lock(); idr_for_each_entry(&tconn->volumes, mdev, vnr) { kref_get(&mdev->kref); + rcu_read_unlock(); + /* Prevent a race between resync-handshake and * being promoted to Primary. * @@ -1049,8 +1051,6 @@ randomize: mutex_lock(mdev->state_mutex); mutex_unlock(mdev->state_mutex); - rcu_read_unlock(); - if (discard_my_data) set_bit(DISCARD_MY_DATA, &mdev->flags); else From 6110d70bdf99f9d0448f1f61798542e3b123b42a Mon Sep 17 00:00:00 2001 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Tue, 25 Jun 2013 16:50:04 +0200 Subject: [PATCH 046/913] drbd: fix error return code in drbd_init() Fix to return a negative error code from the error handling case instead of 0, as returned elsewhere in this function. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com> Signed-off-by: Andreas Gruenbacher <agruen@linbit.com> Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/drbd/drbd_main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index a5dca6affcbb..49040a336949 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c @@ -2762,8 +2762,6 @@ int __init drbd_init(void) /* * allocate all necessary structs */ - err = -ENOMEM; - init_waitqueue_head(&drbd_pp_wait); drbd_proc = NULL; /* play safe for drbd_cleanup */ @@ -2773,6 +2771,7 @@ int __init drbd_init(void) if (err) goto fail; + err = -ENOMEM; drbd_proc = proc_create_data("drbd", S_IFREG | S_IRUGO , NULL, &drbd_proc_fops, NULL); if (!drbd_proc) { printk(KERN_ERR "drbd: unable to register proc file\n"); @@ -2803,7 +2802,6 @@ int __init drbd_init(void) fail: drbd_cleanup(); if (err == -ENOMEM) - /* currently always the case */ printk(KERN_ERR "drbd: ran out of memory\n"); else printk(KERN_ERR "drbd: initialization failure\n"); From f9eb7bf424e766e00bbc6d69fd7eaaf4bd003cf9 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher <agruen@linbit.com> Date: Tue, 25 Jun 2013 16:50:05 +0200 Subject: [PATCH 047/913] drbd: Fix rcu_read_lock balance on error path Signed-off-by: Andreas Gruenbacher <agruen@linbit.com> Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/drbd/drbd_nl.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 9e3f441e7e84..0936d6aabef9 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -2658,7 +2658,6 @@ int nla_put_status_info(struct sk_buff *skb, struct drbd_conf *mdev, const struct sib_info *sib) { struct state_info *si = NULL; /* for sizeof(si->member); */ - struct net_conf *nc; struct nlattr *nla; int got_ldev; int err = 0; @@ -2688,13 +2687,19 @@ int nla_put_status_info(struct sk_buff *skb, struct drbd_conf *mdev, goto nla_put_failure; rcu_read_lock(); - if (got_ldev) - if (disk_conf_to_skb(skb, rcu_dereference(mdev->ldev->disk_conf), exclude_sensitive)) - goto nla_put_failure; + if (got_ldev) { + struct disk_conf *disk_conf; - nc = rcu_dereference(mdev->tconn->net_conf); - if (nc) - err = net_conf_to_skb(skb, nc, exclude_sensitive); + disk_conf = rcu_dereference(mdev->ldev->disk_conf); + err = disk_conf_to_skb(skb, disk_conf, exclude_sensitive); + } + if (!err) { + struct net_conf *nc; + + nc = rcu_dereference(mdev->tconn->net_conf); + if (nc) + err = net_conf_to_skb(skb, nc, exclude_sensitive); + } rcu_read_unlock(); if (err) goto nla_put_failure; From 28e448bb30d0f3fc7daa652d2d3a30adaf9e171b Mon Sep 17 00:00:00 2001 From: Philipp Reisner <philipp.reisner@linbit.com> Date: Tue, 25 Jun 2013 16:50:06 +0200 Subject: [PATCH 048/913] drbd: Ignore the exit code of a fence-peer handler if it returns too late In case the connection was established and lost again before the a fence-peer handler returns, ignore the exit code of this instance. (And use the exit code of the later started instance) Signed-off-by: Andreas Gruenbacher <agruen@linbit.com> Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/drbd/drbd_int.h | 1 + drivers/block/drbd/drbd_nl.c | 15 +++++++++++++-- drivers/block/drbd/drbd_state.c | 4 +++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index f943aacfdad8..f104328d6325 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h @@ -832,6 +832,7 @@ struct drbd_tconn { /* is a resource from the config file */ unsigned susp_nod:1; /* IO suspended because no data */ unsigned susp_fen:1; /* IO suspended because fence peer handler runs */ struct mutex cstate_mutex; /* Protects graceful disconnects */ + unsigned int connect_cnt; /* Inc each time a connection is established */ unsigned long flags; struct net_conf *net_conf; /* content protected by rcu */ diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 0936d6aabef9..e25803b447ff 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -417,6 +417,7 @@ static enum drbd_fencing_p highest_fencing_policy(struct drbd_tconn *tconn) bool conn_try_outdate_peer(struct drbd_tconn *tconn) { + unsigned int connect_cnt; union drbd_state mask = { }; union drbd_state val = { }; enum drbd_fencing_p fp; @@ -428,6 +429,10 @@ bool conn_try_outdate_peer(struct drbd_tconn *tconn) return false; } + spin_lock_irq(&tconn->req_lock); + connect_cnt = tconn->connect_cnt; + spin_unlock_irq(&tconn->req_lock); + fp = highest_fencing_policy(tconn); switch (fp) { case FP_NOT_AVAIL: @@ -492,8 +497,14 @@ bool conn_try_outdate_peer(struct drbd_tconn *tconn) here, because we might were able to re-establish the connection in the meantime. */ spin_lock_irq(&tconn->req_lock); - if (tconn->cstate < C_WF_REPORT_PARAMS && !test_bit(STATE_SENT, &tconn->flags)) - _conn_request_state(tconn, mask, val, CS_VERBOSE); + if (tconn->cstate < C_WF_REPORT_PARAMS && !test_bit(STATE_SENT, &tconn->flags)) { + if (tconn->connect_cnt != connect_cnt) + /* In case the connection was established and droped + while the fence-peer handler was running, ignore it */ + conn_info(tconn, "Ignoring fence-peer exit code\n"); + else + _conn_request_state(tconn, mask, val, CS_VERBOSE); + } spin_unlock_irq(&tconn->req_lock); return conn_highest_pdsk(tconn) <= D_OUTDATED; diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c index 90c5be2b1d30..216d47b7e88b 100644 --- a/drivers/block/drbd/drbd_state.c +++ b/drivers/block/drbd/drbd_state.c @@ -1115,8 +1115,10 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns, drbd_thread_restart_nowait(&mdev->tconn->receiver); /* Resume AL writing if we get a connection */ - if (os.conn < C_CONNECTED && ns.conn >= C_CONNECTED) + if (os.conn < C_CONNECTED && ns.conn >= C_CONNECTED) { drbd_resume_al(mdev); + mdev->tconn->connect_cnt++; + } /* remember last attach time so request_timer_fn() won't * kill newly established sessions while we are still trying to thaw From e96c96333fe5a4f252cc4e1d7edde8ee7dce7dfe Mon Sep 17 00:00:00 2001 From: Philipp Reisner <philipp.reisner@linbit.com> Date: Tue, 25 Jun 2013 16:50:07 +0200 Subject: [PATCH 049/913] drbd: Constants should be UPPERCASE Signed-off-by: Andreas Gruenbacher <agruen@linbit.com> Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/drbd/drbd_int.h | 7 ++++++- drivers/block/drbd/drbd_nl.c | 20 ++++++++++---------- drivers/block/drbd/drbd_receiver.c | 6 +++--- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index f104328d6325..4519d63350fb 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h @@ -1467,7 +1467,12 @@ extern void drbd_suspend_io(struct drbd_conf *mdev); extern void drbd_resume_io(struct drbd_conf *mdev); extern char *ppsize(char *buf, unsigned long long size); extern sector_t drbd_new_dev_size(struct drbd_conf *, struct drbd_backing_dev *, sector_t, int); -enum determine_dev_size { dev_size_error = -1, unchanged = 0, shrunk = 1, grew = 2 }; +enum determine_dev_size { + DS_ERROR = -1, + DS_UNCHANGED = 0, + DS_SHRUNK = 1, + DS_GREW = 2 +}; extern enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *, enum dds_flags) __must_hold(local); extern void resync_after_online_grow(struct drbd_conf *); extern void drbd_reconsider_max_bio_size(struct drbd_conf *mdev); diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index e25803b447ff..45d127522e0a 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -835,7 +835,7 @@ enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *mdev, enum dds char ppb[10]; int md_moved, la_size_changed; - enum determine_dev_size rv = unchanged; + enum determine_dev_size rv = DS_UNCHANGED; /* race: * application request passes inc_ap_bio, @@ -878,7 +878,7 @@ enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *mdev, enum dds "Leaving size unchanged at size = %lu KB\n", (unsigned long)size); } - rv = dev_size_error; + rv = DS_ERROR; } /* racy, see comments above. */ drbd_set_my_capacity(mdev, size); @@ -886,7 +886,7 @@ enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *mdev, enum dds dev_info(DEV, "size = %s (%llu KB)\n", ppsize(ppb, size>>1), (unsigned long long)size>>1); } - if (rv == dev_size_error) + if (rv == DS_ERROR) goto out; la_size_changed = (la_size_sect != mdev->ldev->md.la_size_sect); @@ -905,16 +905,16 @@ enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *mdev, enum dds err = drbd_bitmap_io(mdev, md_moved ? &drbd_bm_write_all : &drbd_bm_write, "size changed", BM_LOCKED_MASK); if (err) { - rv = dev_size_error; + rv = DS_ERROR; goto out; } drbd_md_mark_dirty(mdev); } if (size > la_size_sect) - rv = grew; + rv = DS_GREW; if (size < la_size_sect) - rv = shrunk; + rv = DS_SHRUNK; out: lc_unlock(mdev->act_log); wake_up(&mdev->al_wait); @@ -1619,10 +1619,10 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) set_bit(USE_DEGR_WFC_T, &mdev->flags); dd = drbd_determine_dev_size(mdev, 0); - if (dd == dev_size_error) { + if (dd == DS_ERROR) { retcode = ERR_NOMEM_BITMAP; goto force_diskless_dec; - } else if (dd == grew) + } else if (dd == DS_GREW) set_bit(RESYNC_AFTER_NEG, &mdev->flags); if (drbd_md_test_flag(mdev->ldev, MDF_FULL_SYNC) || @@ -2387,13 +2387,13 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) dd = drbd_determine_dev_size(mdev, ddsf); drbd_md_sync(mdev); put_ldev(mdev); - if (dd == dev_size_error) { + if (dd == DS_ERROR) { retcode = ERR_NOMEM_BITMAP; goto fail; } if (mdev->state.conn == C_CONNECTED) { - if (dd == grew) + if (dd == DS_GREW) set_bit(RESIZE_PENDING, &mdev->flags); drbd_send_uuids(mdev); diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index adee58e19e83..26852b87b034 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -3545,7 +3545,7 @@ static int receive_sizes(struct drbd_tconn *tconn, struct packet_info *pi) { struct drbd_conf *mdev; struct p_sizes *p = pi->data; - enum determine_dev_size dd = unchanged; + enum determine_dev_size dd = DS_UNCHANGED; sector_t p_size, p_usize, my_usize; int ldsc = 0; /* local disk size changed */ enum dds_flags ddsf; @@ -3619,7 +3619,7 @@ static int receive_sizes(struct drbd_tconn *tconn, struct packet_info *pi) if (get_ldev(mdev)) { dd = drbd_determine_dev_size(mdev, ddsf); put_ldev(mdev); - if (dd == dev_size_error) + if (dd == DS_ERROR) return -EIO; drbd_md_sync(mdev); } else { @@ -3647,7 +3647,7 @@ static int receive_sizes(struct drbd_tconn *tconn, struct packet_info *pi) drbd_send_sizes(mdev, 0, ddsf); } if (test_and_clear_bit(RESIZE_PENDING, &mdev->flags) || - (dd == grew && mdev->state.conn == C_CONNECTED)) { + (dd == DS_GREW && mdev->state.conn == C_CONNECTED)) { if (mdev->state.pdsk >= D_INCONSISTENT && mdev->state.disk >= D_INCONSISTENT) { if (ddsf & DDSF_NO_RESYNC) From d752b2696072ed52fd5afab08b601e2220a3b87e Mon Sep 17 00:00:00 2001 From: Philipp Reisner <philipp.reisner@linbit.com> Date: Tue, 25 Jun 2013 16:50:08 +0200 Subject: [PATCH 050/913] drbd: Allow online change of al-stripes and al-stripe-size Allow to change the AL layout with an resize operation. For that the reisze command gets two new fields: al_stripes and al_stripe_size. In order to make the operation crash save: 1) Lock out all IO and MD-IO 2) Write the super block with MDF_PRIMARY_IND clear 3) write the bitmap to the new location (all zeros, since we allow only while connected) 4) Initialize the new AL-area 5) Write the super block with the restored MDF_PRIMARY_IND. 6) Unfreeze all IO Since the AL-layout has no influence on the protocol, this operation needs to be beforemed on both sides of a resource (if intended). Signed-off-by: Andreas Gruenbacher <agruen@linbit.com> Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> --- drivers/block/drbd/drbd_actlog.c | 21 +++++ drivers/block/drbd/drbd_int.h | 7 +- drivers/block/drbd/drbd_main.c | 57 +++++++----- drivers/block/drbd/drbd_nl.c | 137 +++++++++++++++++++++++------ drivers/block/drbd/drbd_receiver.c | 2 +- include/linux/drbd.h | 6 +- include/linux/drbd_genl.h | 2 + include/linux/drbd_limits.h | 9 ++ 8 files changed, 188 insertions(+), 53 deletions(-) diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c index 6608076dc39e..28c73ca320a8 100644 --- a/drivers/block/drbd/drbd_actlog.c +++ b/drivers/block/drbd/drbd_actlog.c @@ -659,6 +659,27 @@ void drbd_al_shrink(struct drbd_conf *mdev) wake_up(&mdev->al_wait); } +int drbd_initialize_al(struct drbd_conf *mdev, void *buffer) +{ + struct al_transaction_on_disk *al = buffer; + struct drbd_md *md = &mdev->ldev->md; + sector_t al_base = md->md_offset + md->al_offset; + int al_size_4k = md->al_stripes * md->al_stripe_size_4k; + int i; + + memset(al, 0, 4096); + al->magic = cpu_to_be32(DRBD_AL_MAGIC); + al->transaction_type = cpu_to_be16(AL_TR_INITIALIZED); + al->crc32c = cpu_to_be32(crc32c(0, al, 4096)); + + for (i = 0; i < al_size_4k; i++) { + int err = drbd_md_sync_page_io(mdev, mdev->ldev, al_base + i * 8, WRITE); + if (err) + return err; + } + return 0; +} + static int w_update_odbm(struct drbd_work *w, int unused) { struct update_odbm_work *udw = container_of(w, struct update_odbm_work, w); diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 4519d63350fb..2d7f608d181c 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h @@ -1133,6 +1133,7 @@ extern void drbd_mdev_cleanup(struct drbd_conf *mdev); void drbd_print_uuids(struct drbd_conf *mdev, const char *text); extern void conn_md_sync(struct drbd_tconn *tconn); +extern void drbd_md_write(struct drbd_conf *mdev, void *buffer); extern void drbd_md_sync(struct drbd_conf *mdev); extern int drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev); extern void drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val) __must_hold(local); @@ -1468,12 +1469,15 @@ extern void drbd_resume_io(struct drbd_conf *mdev); extern char *ppsize(char *buf, unsigned long long size); extern sector_t drbd_new_dev_size(struct drbd_conf *, struct drbd_backing_dev *, sector_t, int); enum determine_dev_size { + DS_ERROR_SHRINK = -3, + DS_ERROR_SPACE_MD = -2, DS_ERROR = -1, DS_UNCHANGED = 0, DS_SHRUNK = 1, DS_GREW = 2 }; -extern enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *, enum dds_flags) __must_hold(local); +extern enum determine_dev_size +drbd_determine_dev_size(struct drbd_conf *, enum dds_flags, struct resize_parms *) __must_hold(local); extern void resync_after_online_grow(struct drbd_conf *); extern void drbd_reconsider_max_bio_size(struct drbd_conf *mdev); extern enum drbd_state_rv drbd_set_role(struct drbd_conf *mdev, @@ -1639,6 +1643,7 @@ extern int __drbd_set_out_of_sync(struct drbd_conf *mdev, sector_t sector, #define drbd_set_out_of_sync(mdev, sector, size) \ __drbd_set_out_of_sync(mdev, sector, size, __FILE__, __LINE__) extern void drbd_al_shrink(struct drbd_conf *mdev); +extern int drbd_initialize_al(struct drbd_conf *, void *); /* drbd_nl.c */ /* state info broadcast */ diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 49040a336949..55635edf563b 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c @@ -2879,34 +2879,14 @@ struct meta_data_on_disk { u8 reserved_u8[4096 - (7*8 + 10*4)]; } __packed; -/** - * drbd_md_sync() - Writes the meta data super block if the MD_DIRTY flag bit is set - * @mdev: DRBD device. - */ -void drbd_md_sync(struct drbd_conf *mdev) + + +void drbd_md_write(struct drbd_conf *mdev, void *b) { - struct meta_data_on_disk *buffer; + struct meta_data_on_disk *buffer = b; sector_t sector; int i; - /* Don't accidentally change the DRBD meta data layout. */ - BUILD_BUG_ON(UI_SIZE != 4); - BUILD_BUG_ON(sizeof(struct meta_data_on_disk) != 4096); - - del_timer(&mdev->md_sync_timer); - /* timer may be rearmed by drbd_md_mark_dirty() now. */ - if (!test_and_clear_bit(MD_DIRTY, &mdev->flags)) - return; - - /* We use here D_FAILED and not D_ATTACHING because we try to write - * metadata even if we detach due to a disk failure! */ - if (!get_ldev_if_state(mdev, D_FAILED)) - return; - - buffer = drbd_md_get_buffer(mdev); - if (!buffer) - goto out; - memset(buffer, 0, sizeof(*buffer)); buffer->la_size_sect = cpu_to_be64(drbd_get_capacity(mdev->this_bdev)); @@ -2935,6 +2915,35 @@ void drbd_md_sync(struct drbd_conf *mdev) dev_err(DEV, "meta data update failed!\n"); drbd_chk_io_error(mdev, 1, DRBD_META_IO_ERROR); } +} + +/** + * drbd_md_sync() - Writes the meta data super block if the MD_DIRTY flag bit is set + * @mdev: DRBD device. + */ +void drbd_md_sync(struct drbd_conf *mdev) +{ + struct meta_data_on_disk *buffer; + + /* Don't accidentally change the DRBD meta data layout. */ + BUILD_BUG_ON(UI_SIZE != 4); + BUILD_BUG_ON(sizeof(struct meta_data_on_disk) != 4096); + + del_timer(&mdev->md_sync_timer); + /* timer may be rearmed by drbd_md_mark_dirty() now. */ + if (!test_and_clear_bit(MD_DIRTY, &mdev->flags)) + return; + + /* We use here D_FAILED and not D_ATTACHING because we try to write + * metadata even if we detach due to a disk failure! */ + if (!get_ldev_if_state(mdev, D_FAILED)) + return; + + buffer = drbd_md_get_buffer(mdev); + if (!buffer) + goto out; + + drbd_md_write(mdev, buffer); /* Update mdev->ldev->md.la_size_sect, * since we updated it on metadata. */ diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 45d127522e0a..8cc1e640f485 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -827,12 +827,17 @@ void drbd_resume_io(struct drbd_conf *mdev) * Returns 0 on success, negative return values indicate errors. * You should call drbd_md_sync() after calling this function. */ -enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *mdev, enum dds_flags flags) __must_hold(local) +enum determine_dev_size +drbd_determine_dev_size(struct drbd_conf *mdev, enum dds_flags flags, struct resize_parms *rs) __must_hold(local) { sector_t prev_first_sect, prev_size; /* previous meta location */ sector_t la_size_sect, u_size; + struct drbd_md *md = &mdev->ldev->md; + u32 prev_al_stripe_size_4k; + u32 prev_al_stripes; sector_t size; char ppb[10]; + void *buffer; int md_moved, la_size_changed; enum determine_dev_size rv = DS_UNCHANGED; @@ -847,6 +852,11 @@ enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *mdev, enum dds * still lock the act_log to not trigger ASSERTs there. */ drbd_suspend_io(mdev); + buffer = drbd_md_get_buffer(mdev); /* Lock meta-data IO */ + if (!buffer) { + drbd_resume_io(mdev); + return DS_ERROR; + } /* no wait necessary anymore, actually we could assert that */ wait_event(mdev->al_wait, lc_try_lock(mdev->act_log)); @@ -855,7 +865,17 @@ enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *mdev, enum dds prev_size = mdev->ldev->md.md_size_sect; la_size_sect = mdev->ldev->md.la_size_sect; - /* TODO: should only be some assert here, not (re)init... */ + if (rs) { + /* rs is non NULL if we should change the AL layout only */ + + prev_al_stripes = md->al_stripes; + prev_al_stripe_size_4k = md->al_stripe_size_4k; + + md->al_stripes = rs->al_stripes; + md->al_stripe_size_4k = rs->al_stripe_size / 4; + md->al_size_4k = (u64)rs->al_stripes * rs->al_stripe_size / 4; + } + drbd_md_set_sector_offsets(mdev, mdev->ldev); rcu_read_lock(); @@ -863,6 +883,21 @@ enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *mdev, enum dds rcu_read_unlock(); size = drbd_new_dev_size(mdev, mdev->ldev, u_size, flags & DDSF_FORCED); + if (size < la_size_sect) { + if (rs && u_size == 0) { + /* Remove "rs &&" later. This check should always be active, but + right now the receiver expects the permissive behavior */ + dev_warn(DEV, "Implicit shrink not allowed. " + "Use --size=%llus for explicit shrink.\n", + (unsigned long long)size); + rv = DS_ERROR_SHRINK; + } + if (u_size > size) + rv = DS_ERROR_SPACE_MD; + if (rv != DS_UNCHANGED) + goto err_out; + } + if (drbd_get_capacity(mdev->this_bdev) != size || drbd_bm_capacity(mdev) != size) { int err; @@ -886,38 +921,57 @@ enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *mdev, enum dds dev_info(DEV, "size = %s (%llu KB)\n", ppsize(ppb, size>>1), (unsigned long long)size>>1); } - if (rv == DS_ERROR) - goto out; + if (rv <= DS_ERROR) + goto err_out; la_size_changed = (la_size_sect != mdev->ldev->md.la_size_sect); md_moved = prev_first_sect != drbd_md_first_sector(mdev->ldev) || prev_size != mdev->ldev->md.md_size_sect; - if (la_size_changed || md_moved) { - int err; + if (la_size_changed || md_moved || rs) { + u32 prev_flags; drbd_al_shrink(mdev); /* All extents inactive. */ + + prev_flags = md->flags; + md->flags &= ~MDF_PRIMARY_IND; + drbd_md_write(mdev, buffer); + dev_info(DEV, "Writing the whole bitmap, %s\n", la_size_changed && md_moved ? "size changed and md moved" : la_size_changed ? "size changed" : "md moved"); /* next line implicitly does drbd_suspend_io()+drbd_resume_io() */ - err = drbd_bitmap_io(mdev, md_moved ? &drbd_bm_write_all : &drbd_bm_write, - "size changed", BM_LOCKED_MASK); - if (err) { - rv = DS_ERROR; - goto out; - } - drbd_md_mark_dirty(mdev); + drbd_bitmap_io(mdev, md_moved ? &drbd_bm_write_all : &drbd_bm_write, + "size changed", BM_LOCKED_MASK); + drbd_initialize_al(mdev, buffer); + + md->flags = prev_flags; + drbd_md_write(mdev, buffer); + + if (rs) + dev_info(DEV, "Changed AL layout to al-stripes = %d, al-stripe-size-kB = %d\n", + md->al_stripes, md->al_stripe_size_4k * 4); } if (size > la_size_sect) rv = DS_GREW; if (size < la_size_sect) rv = DS_SHRUNK; -out: + + if (0) { + err_out: + if (rs) { + md->al_stripes = prev_al_stripes; + md->al_stripe_size_4k = prev_al_stripe_size_4k; + md->al_size_4k = (u64)prev_al_stripes * prev_al_stripe_size_4k; + + drbd_md_set_sector_offsets(mdev, mdev->ldev); + } + } lc_unlock(mdev->act_log); wake_up(&mdev->al_wait); + drbd_md_put_buffer(mdev); drbd_resume_io(mdev); return rv; @@ -1618,8 +1672,8 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) !drbd_md_test_flag(mdev->ldev, MDF_CONNECTED_IND)) set_bit(USE_DEGR_WFC_T, &mdev->flags); - dd = drbd_determine_dev_size(mdev, 0); - if (dd == DS_ERROR) { + dd = drbd_determine_dev_size(mdev, 0, NULL); + if (dd <= DS_ERROR) { retcode = ERR_NOMEM_BITMAP; goto force_diskless_dec; } else if (dd == DS_GREW) @@ -2316,6 +2370,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) struct drbd_conf *mdev; enum drbd_ret_code retcode; enum determine_dev_size dd; + bool change_al_layout = false; enum dds_flags ddsf; sector_t u_size; int err; @@ -2326,31 +2381,33 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) if (retcode != NO_ERROR) goto fail; + mdev = adm_ctx.mdev; + if (!get_ldev(mdev)) { + retcode = ERR_NO_DISK; + goto fail; + } + memset(&rs, 0, sizeof(struct resize_parms)); + rs.al_stripes = mdev->ldev->md.al_stripes; + rs.al_stripe_size = mdev->ldev->md.al_stripe_size_4k * 4; if (info->attrs[DRBD_NLA_RESIZE_PARMS]) { err = resize_parms_from_attrs(&rs, info); if (err) { retcode = ERR_MANDATORY_TAG; drbd_msg_put_info(from_attrs_err_to_txt(err)); - goto fail; + goto fail_ldev; } } - mdev = adm_ctx.mdev; if (mdev->state.conn > C_CONNECTED) { retcode = ERR_RESIZE_RESYNC; - goto fail; + goto fail_ldev; } if (mdev->state.role == R_SECONDARY && mdev->state.peer == R_SECONDARY) { retcode = ERR_NO_PRIMARY; - goto fail; - } - - if (!get_ldev(mdev)) { - retcode = ERR_NO_DISK; - goto fail; + goto fail_ldev; } if (rs.no_resync && mdev->tconn->agreed_pro_version < 93) { @@ -2369,6 +2426,28 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) } } + if (mdev->ldev->md.al_stripes != rs.al_stripes || + mdev->ldev->md.al_stripe_size_4k != rs.al_stripe_size / 4) { + u32 al_size_k = rs.al_stripes * rs.al_stripe_size; + + if (al_size_k > (16 * 1024 * 1024)) { + retcode = ERR_MD_LAYOUT_TOO_BIG; + goto fail_ldev; + } + + if (al_size_k < MD_32kB_SECT/2) { + retcode = ERR_MD_LAYOUT_TOO_SMALL; + goto fail_ldev; + } + + if (mdev->state.conn != C_CONNECTED) { + retcode = ERR_MD_LAYOUT_CONNECTED; + goto fail_ldev; + } + + change_al_layout = true; + } + if (mdev->ldev->known_size != drbd_get_capacity(mdev->ldev->backing_bdev)) mdev->ldev->known_size = drbd_get_capacity(mdev->ldev->backing_bdev); @@ -2384,12 +2463,18 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) } ddsf = (rs.resize_force ? DDSF_FORCED : 0) | (rs.no_resync ? DDSF_NO_RESYNC : 0); - dd = drbd_determine_dev_size(mdev, ddsf); + dd = drbd_determine_dev_size(mdev, ddsf, change_al_layout ? &rs : NULL); drbd_md_sync(mdev); put_ldev(mdev); if (dd == DS_ERROR) { retcode = ERR_NOMEM_BITMAP; goto fail; + } else if (dd == DS_ERROR_SPACE_MD) { + retcode = ERR_MD_LAYOUT_NO_FIT; + goto fail; + } else if (dd == DS_ERROR_SHRINK) { + retcode = ERR_IMPLICIT_SHRINK; + goto fail; } if (mdev->state.conn == C_CONNECTED) { diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 26852b87b034..cc29cd3bf78b 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -3617,7 +3617,7 @@ static int receive_sizes(struct drbd_tconn *tconn, struct packet_info *pi) ddsf = be16_to_cpu(p->dds_flags); if (get_ldev(mdev)) { - dd = drbd_determine_dev_size(mdev, ddsf); + dd = drbd_determine_dev_size(mdev, ddsf, NULL); put_ldev(mdev); if (dd == DS_ERROR) return -EIO; diff --git a/include/linux/drbd.h b/include/linux/drbd.h index 1b4d4ee1168f..de7d74ab3de6 100644 --- a/include/linux/drbd.h +++ b/include/linux/drbd.h @@ -177,7 +177,11 @@ enum drbd_ret_code { ERR_NEED_APV_100 = 163, ERR_NEED_ALLOW_TWO_PRI = 164, ERR_MD_UNCLEAN = 165, - + ERR_MD_LAYOUT_CONNECTED = 166, + ERR_MD_LAYOUT_TOO_BIG = 167, + ERR_MD_LAYOUT_TOO_SMALL = 168, + ERR_MD_LAYOUT_NO_FIT = 169, + ERR_IMPLICIT_SHRINK = 170, /* insert new ones above this line */ AFTER_LAST_ERR_CODE }; diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h index d0d8fac8a6e4..e8c44572b8cb 100644 --- a/include/linux/drbd_genl.h +++ b/include/linux/drbd_genl.h @@ -181,6 +181,8 @@ GENL_struct(DRBD_NLA_RESIZE_PARMS, 7, resize_parms, __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size) __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force) __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync) + __u32_field_def(4, 0 /* OPTIONAL */, al_stripes, DRBD_AL_STRIPES_DEF) + __u32_field_def(5, 0 /* OPTIONAL */, al_stripe_size, DRBD_AL_STRIPE_SIZE_DEF) ) GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info, diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h index 1fedf2b17cc8..17e50bb00521 100644 --- a/include/linux/drbd_limits.h +++ b/include/linux/drbd_limits.h @@ -215,4 +215,13 @@ #define DRBD_ALWAYS_ASBP_DEF 0 #define DRBD_USE_RLE_DEF 1 +#define DRBD_AL_STRIPES_MIN 1 +#define DRBD_AL_STRIPES_MAX 1024 +#define DRBD_AL_STRIPES_DEF 1 +#define DRBD_AL_STRIPES_SCALE '1' + +#define DRBD_AL_STRIPE_SIZE_MIN 4 +#define DRBD_AL_STRIPE_SIZE_MAX 16777216 +#define DRBD_AL_STRIPE_SIZE_DEF 32 +#define DRBD_AL_STRIPE_SIZE_SCALE 'k' /* kilobytes */ #endif From 94fccb78414a87f3c4bc7049ff8b6e80156944d9 Mon Sep 17 00:00:00 2001 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Tue, 18 Jun 2013 14:08:00 +0100 Subject: [PATCH 051/913] iio: dac: ad7303: fix error return code in ad7303_probe() Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org> --- drivers/iio/dac/ad7303.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad7303.c b/drivers/iio/dac/ad7303.c index 85aeef60dc5f..d546f50f9258 100644 --- a/drivers/iio/dac/ad7303.c +++ b/drivers/iio/dac/ad7303.c @@ -235,8 +235,10 @@ static int ad7303_probe(struct spi_device *spi) if (ext_ref) { st->vref_reg = regulator_get(&spi->dev, "REF"); - if (IS_ERR(st->vref_reg)) + if (IS_ERR(st->vref_reg)) { + ret = PTR_ERR(st->vref_reg); goto err_disable_vdd_reg; + } ret = regulator_enable(st->vref_reg); if (ret) From 8bade406649245292d6fcd1947cd7ad2ad8c80c1 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron <jic23@kernel.org> Date: Sat, 22 Jun 2013 12:00:04 +0100 Subject: [PATCH 052/913] iio:trigger: device_unregister->device_del to avoid double free iio_trigger unregistration and freeing has been separated in this code for some time, but it looks like the calls to the device handling were not appropriately updated. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reported-by: Otavio Salvador <otavio@ossystems.com.br> Tested-by: Otavio Salvador <otavio@ossystems.com.br> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> --- drivers/iio/industrialio-trigger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index 4d6c7d84e155..ea8a4146620d 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -104,7 +104,7 @@ void iio_trigger_unregister(struct iio_trigger *trig_info) ida_simple_remove(&iio_trigger_ida, trig_info->id); /* Possible issue in here */ - device_unregister(&trig_info->dev); + device_del(&trig_info->dev); } EXPORT_SYMBOL(iio_trigger_unregister); From e49c7c374e7aacd1f04ecbc21d9dbbeeea4a77d6 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Wed, 26 Jun 2013 17:25:38 -0700 Subject: [PATCH 053/913] bcache: FUA fixes Journal writes need to be marked FUA, not just REQ_FLUSH. And btree node writes have... weird ordering requirements. Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/btree.c | 25 ++++++++++++++++++++++--- drivers/md/bcache/journal.c | 2 +- drivers/md/bcache/request.c | 13 ++++++++++++- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 09fb8a2f43da..a6ad49ac5f2b 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -328,10 +328,25 @@ static void do_btree_node_write(struct btree *b) b->bio->bi_end_io = btree_node_write_endio; b->bio->bi_private = &b->io.cl; - b->bio->bi_rw = REQ_META|WRITE_SYNC; - b->bio->bi_size = set_blocks(i, b->c) * block_bytes(b->c); + b->bio->bi_rw = REQ_META|WRITE_SYNC|REQ_FUA; + b->bio->bi_size = set_blocks(i, b->c) * block_bytes(b->c); bch_bio_map(b->bio, i); + /* + * If we're appending to a leaf node, we don't technically need FUA - + * this write just needs to be persisted before the next journal write, + * which will be marked FLUSH|FUA. + * + * Similarly if we're writing a new btree root - the pointer is going to + * be in the next journal entry. + * + * But if we're writing a new btree node (that isn't a root) or + * appending to a non leaf btree node, we need either FUA or a flush + * when we write the parent with the new pointer. FUA is cheaper than a + * flush, and writes appending to leaf nodes aren't blocking anything so + * just make all btree node writes FUA to keep things sane. + */ + bkey_copy(&k.key, &b->key); SET_PTR_OFFSET(&k.key, 0, PTR_OFFSET(&k.key, 0) + bset_offset(b, i)); @@ -2092,6 +2107,9 @@ int bch_btree_insert(struct btree_op *op, struct cache_set *c) void bch_btree_set_root(struct btree *b) { unsigned i; + struct closure cl; + + closure_init_stack(&cl); trace_bcache_btree_set_root(b); @@ -2107,7 +2125,8 @@ void bch_btree_set_root(struct btree *b) b->c->root = b; __bkey_put(b->c, &b->key); - bch_journal_meta(b->c, NULL); + bch_journal_meta(b->c, &cl); + closure_sync(&cl); } /* Cache lookup */ diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 5ca22149b749..4b250667bb7f 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -620,7 +620,7 @@ static void journal_write_unlocked(struct closure *cl) bio_reset(bio); bio->bi_sector = PTR_OFFSET(k, i); bio->bi_bdev = ca->bdev; - bio->bi_rw = REQ_WRITE|REQ_SYNC|REQ_META|REQ_FLUSH; + bio->bi_rw = REQ_WRITE|REQ_SYNC|REQ_META|REQ_FLUSH|REQ_FUA; bio->bi_size = sectors << 9; bio->bi_end_io = journal_write_endio; diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 17bd59704eba..bcdf1f782c3e 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -1035,8 +1035,19 @@ static void request_write(struct cached_dev *dc, struct search *s) closure_bio_submit(bio, cl, s->d); } else { - s->op.cache_bio = bio; bch_writeback_add(dc); + + if (s->op.flush_journal) { + /* Also need to send a flush to the backing device */ + s->op.cache_bio = bio_clone_bioset(bio, GFP_NOIO, + dc->disk.bio_split); + + bio->bi_size = 0; + bio->bi_vcnt = 0; + closure_bio_submit(bio, cl, s->d); + } else { + s->op.cache_bio = bio; + } } out: closure_call(&s->op.cl, bch_insert_data, NULL, cl); From 36c9ea9837c1cb21c778781495101eaff7e5eb56 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Mon, 3 Jun 2013 13:04:56 -0700 Subject: [PATCH 054/913] bcache: Document shrinker reserve better Signed-off-by: Kent Overstreet <kmo@daterainc.com> --- drivers/md/bcache/btree.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index a6ad49ac5f2b..04636a70ffaa 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -622,6 +622,13 @@ static int bch_mca_shrink(struct shrinker *shrink, struct shrink_control *sc) else if (!mutex_trylock(&c->bucket_lock)) return -1; + /* + * It's _really_ critical that we don't free too many btree nodes - we + * have to always leave ourselves a reserve. The reserve is how we + * guarantee that allocating memory for a new btree node can always + * succeed, so that inserting keys into the btree can always succeed and + * IO can always make forward progress: + */ nr /= c->btree_pages; nr = min_t(unsigned long, nr, mca_can_free(c)); From f3059a54610f6c516c0942d58b9435921768ce2d Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Wed, 15 May 2013 17:13:45 -0700 Subject: [PATCH 055/913] bcache: Delete fuzz tester This code has rotted and it hasn't been used in ages anyways. Signed-off-by: Kent Overstreet <kmo@daterainc.com> --- drivers/md/bcache/btree.c | 4 +- drivers/md/bcache/btree.h | 2 - drivers/md/bcache/debug.c | 148 -------------------------------------- 3 files changed, 2 insertions(+), 152 deletions(-) diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 04636a70ffaa..e0cca3673d0f 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -135,7 +135,7 @@ static uint64_t btree_csum_set(struct btree *b, struct bset *i) return crc ^ 0xffffffffffffffffULL; } -void bch_btree_node_read_done(struct btree *b) +static void bch_btree_node_read_done(struct btree *b) { const char *err = "bad btree header"; struct bset *i = b->sets[0].data; @@ -1834,7 +1834,7 @@ merged: return true; } -bool bch_btree_insert_keys(struct btree *b, struct btree_op *op) +static bool bch_btree_insert_keys(struct btree *b, struct btree_op *op) { bool ret = false; struct bkey *k; diff --git a/drivers/md/bcache/btree.h b/drivers/md/bcache/btree.h index f66d69a7baf1..3333d3723633 100644 --- a/drivers/md/bcache/btree.h +++ b/drivers/md/bcache/btree.h @@ -369,7 +369,6 @@ static inline bool should_split(struct btree *b) } void bch_btree_node_read(struct btree *); -void bch_btree_node_read_done(struct btree *); void bch_btree_node_write(struct btree *, struct closure *); void bch_cannibalize_unlock(struct cache_set *, struct closure *); @@ -378,7 +377,6 @@ struct btree *bch_btree_node_alloc(struct cache_set *, int, struct closure *); struct btree *bch_btree_node_get(struct cache_set *, struct bkey *, int, struct btree_op *); -bool bch_btree_insert_keys(struct btree *, struct btree_op *); bool bch_btree_insert_check_key(struct btree *, struct btree_op *, struct bio *); int bch_btree_insert(struct btree_op *, struct cache_set *); diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index 1c8fd319846e..ba2ceee0fdbb 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c @@ -412,149 +412,6 @@ void bch_debug_init_cache_set(struct cache_set *c) #endif -/* Fuzz tester has rotted: */ -#if 0 - -static ssize_t btree_fuzz(struct kobject *k, struct kobj_attribute *a, - const char *buffer, size_t size) -{ - void dump(struct btree *b) - { - struct bset *i; - - for (i = b->sets[0].data; - index(i, b) < btree_blocks(b) && - i->seq == b->sets[0].data->seq; - i = ((void *) i) + set_blocks(i, b->c) * block_bytes(b->c)) - dump_bset(b, i); - } - - struct cache_sb *sb; - struct cache_set *c; - struct btree *all[3], *b, *fill, *orig; - int j; - - struct btree_op op; - bch_btree_op_init_stack(&op); - - sb = kzalloc(sizeof(struct cache_sb), GFP_KERNEL); - if (!sb) - return -ENOMEM; - - sb->bucket_size = 128; - sb->block_size = 4; - - c = bch_cache_set_alloc(sb); - if (!c) - return -ENOMEM; - - for (j = 0; j < 3; j++) { - BUG_ON(list_empty(&c->btree_cache)); - all[j] = list_first_entry(&c->btree_cache, struct btree, list); - list_del_init(&all[j]->list); - - all[j]->key = KEY(0, 0, c->sb.bucket_size); - bkey_copy_key(&all[j]->key, &MAX_KEY); - } - - b = all[0]; - fill = all[1]; - orig = all[2]; - - while (1) { - for (j = 0; j < 3; j++) - all[j]->written = all[j]->nsets = 0; - - bch_bset_init_next(b); - - while (1) { - struct bset *i = write_block(b); - struct bkey *k = op.keys.top; - unsigned rand; - - bkey_init(k); - rand = get_random_int(); - - op.type = rand & 1 - ? BTREE_INSERT - : BTREE_REPLACE; - rand >>= 1; - - SET_KEY_SIZE(k, bucket_remainder(c, rand)); - rand >>= c->bucket_bits; - rand &= 1024 * 512 - 1; - rand += c->sb.bucket_size; - SET_KEY_OFFSET(k, rand); -#if 0 - SET_KEY_PTRS(k, 1); -#endif - bch_keylist_push(&op.keys); - bch_btree_insert_keys(b, &op); - - if (should_split(b) || - set_blocks(i, b->c) != - __set_blocks(i, i->keys + 15, b->c)) { - i->csum = csum_set(i); - - memcpy(write_block(fill), - i, set_bytes(i)); - - b->written += set_blocks(i, b->c); - fill->written = b->written; - if (b->written == btree_blocks(b)) - break; - - bch_btree_sort_lazy(b); - bch_bset_init_next(b); - } - } - - memcpy(orig->sets[0].data, - fill->sets[0].data, - btree_bytes(c)); - - bch_btree_sort(b); - fill->written = 0; - bch_btree_node_read_done(fill); - - if (b->sets[0].data->keys != fill->sets[0].data->keys || - memcmp(b->sets[0].data->start, - fill->sets[0].data->start, - b->sets[0].data->keys * sizeof(uint64_t))) { - struct bset *i = b->sets[0].data; - struct bkey *k, *l; - - for (k = i->start, - l = fill->sets[0].data->start; - k < end(i); - k = bkey_next(k), l = bkey_next(l)) - if (bkey_cmp(k, l) || - KEY_SIZE(k) != KEY_SIZE(l)) { - char buf1[80]; - char buf2[80]; - - bch_bkey_to_text(buf1, sizeof(buf1), k); - bch_bkey_to_text(buf2, sizeof(buf2), l); - - pr_err("key %zi differs: %s != %s", - (uint64_t *) k - i->d, - buf1, buf2); - } - - for (j = 0; j < 3; j++) { - pr_err("**** Set %i ****", j); - dump(all[j]); - } - panic("\n"); - } - - pr_info("fuzz complete: %i keys", b->sets[0].data->keys); - } -} - -kobj_attribute_write(fuzz, btree_fuzz); -#endif - void bch_debug_exit(void) { if (!IS_ERR_OR_NULL(debug)) @@ -564,11 +421,6 @@ void bch_debug_exit(void) int __init bch_debug_init(struct kobject *kobj) { int ret = 0; -#if 0 - ret = sysfs_create_file(kobj, &ksysfs_fuzz.attr); - if (ret) - return ret; -#endif debug = debugfs_create_dir("bcache", NULL); return ret; From 47cd2eb0ee05d9b1f8acd4808a1c829d63e93ac1 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <kmo@daterainc.com> Date: Mon, 1 Jul 2013 12:19:55 -0700 Subject: [PATCH 056/913] bcache: Update email address Signed-off-by: Kent Overstreet <kmo@daterainc.com> --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 5be702cc8449..58814f0f06bd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1621,7 +1621,7 @@ S: Maintained F: drivers/net/hamradio/baycom* BCACHE (BLOCK LAYER CACHE) -M: Kent Overstreet <koverstreet@google.com> +M: Kent Overstreet <kmo@daterainc.com> L: linux-bcache@vger.kernel.org W: http://bcache.evilpiepirate.org S: Maintained: From 8e51e414a3c6d92ef2cc41720c67342a8e2c0bf7 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <koverstreet@google.com> Date: Thu, 6 Jun 2013 18:15:57 -0700 Subject: [PATCH 057/913] bcache: Use standard utility code Some of bcache's utility code has made it into the rest of the kernel, so drop the bcache versions. Bcache used to have a workaround for allocating from a bio set under generic_make_request() (if you allocated more than once, the bios you already allocated would get stuck on current->bio_list when you submitted, and you'd risk deadlock) - bcache would mask out __GFP_WAIT when allocating bios under generic_make_request() so that allocation could fail and it could retry from workqueue. But bio_alloc_bioset() has a workaround now, so we can drop this hack and the associated error handling. Signed-off-by: Kent Overstreet <koverstreet@google.com> --- drivers/md/bcache/btree.c | 7 +-- drivers/md/bcache/debug.c | 2 +- drivers/md/bcache/io.c | 64 +++++++++----------------- drivers/md/bcache/movinggc.c | 7 +-- drivers/md/bcache/request.c | 87 ++++++++--------------------------- drivers/md/bcache/util.c | 17 ------- drivers/md/bcache/util.h | 4 -- drivers/md/bcache/writeback.c | 7 +-- 8 files changed, 51 insertions(+), 144 deletions(-) diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index e0cca3673d0f..15b58239c683 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -350,7 +350,7 @@ static void do_btree_node_write(struct btree *b) bkey_copy(&k.key, &b->key); SET_PTR_OFFSET(&k.key, 0, PTR_OFFSET(&k.key, 0) + bset_offset(b, i)); - if (!bch_bio_alloc_pages(b->bio, GFP_NOIO)) { + if (!bio_alloc_pages(b->bio, GFP_NOIO)) { int j; struct bio_vec *bv; void *base = (void *) ((unsigned long) i & ~(PAGE_SIZE - 1)); @@ -1865,7 +1865,7 @@ bool bch_btree_insert_check_key(struct btree *b, struct btree_op *op, should_split(b)) goto out; - op->replace = KEY(op->inode, bio_end(bio), bio_sectors(bio)); + op->replace = KEY(op->inode, bio_end_sector(bio), bio_sectors(bio)); SET_KEY_PTRS(&op->replace, 1); get_random_bytes(&op->replace.ptr[0], sizeof(uint64_t)); @@ -2194,9 +2194,6 @@ static int submit_partial_cache_hit(struct btree *b, struct btree_op *op, KEY_OFFSET(k) - bio->bi_sector); n = bch_bio_split(bio, sectors, GFP_NOIO, s->d->bio_split); - if (!n) - return -EAGAIN; - if (n == bio) op->lookup_done = true; diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index ba2ceee0fdbb..88e6411eab4f 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c @@ -199,7 +199,7 @@ void bch_data_verify(struct search *s) if (!check) return; - if (bch_bio_alloc_pages(check, GFP_NOIO)) + if (bio_alloc_pages(check, GFP_NOIO)) goto out_put; check->bi_rw = READ_SYNC; diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c index 0f6d69658b61..9056632995b1 100644 --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c @@ -68,13 +68,6 @@ static void bch_generic_make_request_hack(struct bio *bio) * The newly allocated bio will point to @bio's bi_io_vec, if the split was on a * bvec boundry; it is the caller's responsibility to ensure that @bio is not * freed before the split. - * - * If bch_bio_split() is running under generic_make_request(), it's not safe to - * allocate more than one bio from the same bio set. Therefore, if it is running - * under generic_make_request() it masks out __GFP_WAIT when doing the - * allocation. The caller must check for failure if there's any possibility of - * it being called from under generic_make_request(); it is then the caller's - * responsibility to retry from a safe context (by e.g. punting to workqueue). */ struct bio *bch_bio_split(struct bio *bio, int sectors, gfp_t gfp, struct bio_set *bs) @@ -85,15 +78,6 @@ struct bio *bch_bio_split(struct bio *bio, int sectors, BUG_ON(sectors <= 0); - /* - * If we're being called from underneath generic_make_request() and we - * already allocated any bios from this bio set, we risk deadlock if we - * use the mempool. So instead, we possibly fail and let the caller punt - * to workqueue or somesuch and retry in a safe context. - */ - if (current->bio_list) - gfp &= ~__GFP_WAIT; - if (sectors >= bio_sectors(bio)) return bio; @@ -164,17 +148,18 @@ static unsigned bch_bio_max_sectors(struct bio *bio) struct request_queue *q = bdev_get_queue(bio->bi_bdev); unsigned max_segments = min_t(unsigned, BIO_MAX_PAGES, queue_max_segments(q)); - struct bio_vec *bv, *end = bio_iovec(bio) + - min_t(int, bio_segments(bio), max_segments); if (bio->bi_rw & REQ_DISCARD) return min(ret, q->limits.max_discard_sectors); if (bio_segments(bio) > max_segments || q->merge_bvec_fn) { + struct bio_vec *bv; + int i, seg = 0; + ret = 0; - for (bv = bio_iovec(bio); bv < end; bv++) { + bio_for_each_segment(bv, bio, i) { struct bvec_merge_data bvm = { .bi_bdev = bio->bi_bdev, .bi_sector = bio->bi_sector, @@ -182,10 +167,14 @@ static unsigned bch_bio_max_sectors(struct bio *bio) .bi_rw = bio->bi_rw, }; + if (seg == max_segments) + break; + if (q->merge_bvec_fn && q->merge_bvec_fn(q, &bvm, bv) < (int) bv->bv_len) break; + seg++; ret += bv->bv_len >> 9; } } @@ -222,30 +211,10 @@ static void bch_bio_submit_split_endio(struct bio *bio, int error) closure_put(cl); } -static void __bch_bio_submit_split(struct closure *cl) -{ - struct bio_split_hook *s = container_of(cl, struct bio_split_hook, cl); - struct bio *bio = s->bio, *n; - - do { - n = bch_bio_split(bio, bch_bio_max_sectors(bio), - GFP_NOIO, s->p->bio_split); - if (!n) - continue_at(cl, __bch_bio_submit_split, system_wq); - - n->bi_end_io = bch_bio_submit_split_endio; - n->bi_private = cl; - - closure_get(cl); - bch_generic_make_request_hack(n); - } while (n != bio); - - continue_at(cl, bch_bio_submit_split_done, NULL); -} - void bch_generic_make_request(struct bio *bio, struct bio_split_pool *p) { struct bio_split_hook *s; + struct bio *n; if (!bio_has_data(bio) && !(bio->bi_rw & REQ_DISCARD)) goto submit; @@ -254,6 +223,7 @@ void bch_generic_make_request(struct bio *bio, struct bio_split_pool *p) goto submit; s = mempool_alloc(p->bio_split_hook, GFP_NOIO); + closure_init(&s->cl, NULL); s->bio = bio; s->p = p; @@ -261,8 +231,18 @@ void bch_generic_make_request(struct bio *bio, struct bio_split_pool *p) s->bi_private = bio->bi_private; bio_get(bio); - closure_call(&s->cl, __bch_bio_submit_split, NULL, NULL); - return; + do { + n = bch_bio_split(bio, bch_bio_max_sectors(bio), + GFP_NOIO, s->p->bio_split); + + n->bi_end_io = bch_bio_submit_split_endio; + n->bi_private = &s->cl; + + closure_get(&s->cl); + bch_generic_make_request_hack(n); + } while (n != bio); + + continue_at(&s->cl, bch_bio_submit_split_done, NULL); submit: bch_generic_make_request_hack(bio); } diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c index a241e9fd4f7f..1a3b4f4786c3 100644 --- a/drivers/md/bcache/movinggc.c +++ b/drivers/md/bcache/movinggc.c @@ -46,9 +46,10 @@ static void write_moving_finish(struct closure *cl) { struct moving_io *io = container_of(cl, struct moving_io, s.cl); struct bio *bio = &io->bio.bio; - struct bio_vec *bv = bio_iovec_idx(bio, bio->bi_vcnt); + struct bio_vec *bv; + int i; - while (bv-- != bio->bi_io_vec) + bio_for_each_segment_all(bv, bio, i) __free_page(bv->bv_page); if (io->s.op.insert_collision) @@ -158,7 +159,7 @@ static void read_moving(struct closure *cl) bio->bi_rw = READ; bio->bi_end_io = read_moving_endio; - if (bch_bio_alloc_pages(bio, GFP_KERNEL)) + if (bio_alloc_pages(bio, GFP_KERNEL)) goto err; trace_bcache_gc_copy(&w->key); diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index bcdf1f782c3e..b6e74d3c8faf 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -509,10 +509,6 @@ static void bch_insert_data_loop(struct closure *cl) goto err; n = bch_bio_split(bio, KEY_SIZE(k), GFP_NOIO, split); - if (!n) { - __bkey_put(op->c, k); - continue_at(cl, bch_insert_data_loop, bcache_wq); - } n->bi_end_io = bch_insert_data_endio; n->bi_private = cl; @@ -821,53 +817,13 @@ static void request_read_done(struct closure *cl) */ if (s->op.cache_bio) { - struct bio_vec *src, *dst; - unsigned src_offset, dst_offset, bytes; - void *dst_ptr; - bio_reset(s->op.cache_bio); s->op.cache_bio->bi_sector = s->cache_miss->bi_sector; s->op.cache_bio->bi_bdev = s->cache_miss->bi_bdev; s->op.cache_bio->bi_size = s->cache_bio_sectors << 9; bch_bio_map(s->op.cache_bio, NULL); - src = bio_iovec(s->op.cache_bio); - dst = bio_iovec(s->cache_miss); - src_offset = src->bv_offset; - dst_offset = dst->bv_offset; - dst_ptr = kmap(dst->bv_page); - - while (1) { - if (dst_offset == dst->bv_offset + dst->bv_len) { - kunmap(dst->bv_page); - dst++; - if (dst == bio_iovec_idx(s->cache_miss, - s->cache_miss->bi_vcnt)) - break; - - dst_offset = dst->bv_offset; - dst_ptr = kmap(dst->bv_page); - } - - if (src_offset == src->bv_offset + src->bv_len) { - src++; - if (src == bio_iovec_idx(s->op.cache_bio, - s->op.cache_bio->bi_vcnt)) - BUG(); - - src_offset = src->bv_offset; - } - - bytes = min(dst->bv_offset + dst->bv_len - dst_offset, - src->bv_offset + src->bv_len - src_offset); - - memcpy(dst_ptr + dst_offset, - page_address(src->bv_page) + src_offset, - bytes); - - src_offset += bytes; - dst_offset += bytes; - } + bio_copy_data(s->cache_miss, s->op.cache_bio); bio_put(s->cache_miss); s->cache_miss = NULL; @@ -912,9 +868,6 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, struct bio *miss; miss = bch_bio_split(bio, sectors, GFP_NOIO, s->d->bio_split); - if (!miss) - return -EAGAIN; - if (miss == bio) s->op.lookup_done = true; @@ -933,8 +886,9 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, reada = min(dc->readahead >> 9, sectors - bio_sectors(miss)); - if (bio_end(miss) + reada > bdev_sectors(miss->bi_bdev)) - reada = bdev_sectors(miss->bi_bdev) - bio_end(miss); + if (bio_end_sector(miss) + reada > bdev_sectors(miss->bi_bdev)) + reada = bdev_sectors(miss->bi_bdev) - + bio_end_sector(miss); } s->cache_bio_sectors = bio_sectors(miss) + reada; @@ -958,7 +912,7 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, goto out_put; bch_bio_map(s->op.cache_bio, NULL); - if (bch_bio_alloc_pages(s->op.cache_bio, __GFP_NOWARN|GFP_NOIO)) + if (bio_alloc_pages(s->op.cache_bio, __GFP_NOWARN|GFP_NOIO)) goto out_put; s->cache_miss = miss; @@ -1002,7 +956,7 @@ static void request_write(struct cached_dev *dc, struct search *s) struct bio *bio = &s->bio.bio; struct bkey start, end; start = KEY(dc->disk.id, bio->bi_sector, 0); - end = KEY(dc->disk.id, bio_end(bio), 0); + end = KEY(dc->disk.id, bio_end_sector(bio), 0); bch_keybuf_check_overlapping(&s->op.c->moving_gc_keys, &start, &end); @@ -1176,7 +1130,7 @@ found: if (i->sequential + bio->bi_size > i->sequential) i->sequential += bio->bi_size; - i->last = bio_end(bio); + i->last = bio_end_sector(bio); i->jiffies = jiffies + msecs_to_jiffies(5000); s->task->sequential_io = i->sequential; @@ -1294,30 +1248,25 @@ void bch_cached_dev_request_init(struct cached_dev *dc) static int flash_dev_cache_miss(struct btree *b, struct search *s, struct bio *bio, unsigned sectors) { + struct bio_vec *bv; + int i; + /* Zero fill bio */ - while (bio->bi_idx != bio->bi_vcnt) { - struct bio_vec *bv = bio_iovec(bio); + bio_for_each_segment(bv, bio, i) { unsigned j = min(bv->bv_len >> 9, sectors); void *p = kmap(bv->bv_page); memset(p + bv->bv_offset, 0, j << 9); kunmap(bv->bv_page); - bv->bv_len -= j << 9; - bv->bv_offset += j << 9; - - if (bv->bv_len) - return 0; - - bio->bi_sector += j; - bio->bi_size -= j << 9; - - bio->bi_idx++; - sectors -= j; + sectors -= j; } - s->op.lookup_done = true; + bio_advance(bio, min(sectors << 9, bio->bi_size)); + + if (!bio->bi_size) + s->op.lookup_done = true; return 0; } @@ -1344,8 +1293,8 @@ static void flash_dev_make_request(struct request_queue *q, struct bio *bio) closure_call(&s->op.cl, btree_read_async, NULL, cl); } else if (bio_has_data(bio) || s->op.skip) { bch_keybuf_check_overlapping(&s->op.c->moving_gc_keys, - &KEY(d->id, bio->bi_sector, 0), - &KEY(d->id, bio_end(bio), 0)); + &KEY(d->id, bio->bi_sector, 0), + &KEY(d->id, bio_end_sector(bio), 0)); s->writeback = true; s->op.cache_bio = bio; diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c index da3a99e85b1e..98eb81159a22 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c @@ -228,23 +228,6 @@ start: bv->bv_len = min_t(size_t, PAGE_SIZE - bv->bv_offset, } } -int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp) -{ - int i; - struct bio_vec *bv; - - bio_for_each_segment(bv, bio, i) { - bv->bv_page = alloc_page(gfp); - if (!bv->bv_page) { - while (bv-- != bio->bi_io_vec + bio->bi_idx) - __free_page(bv->bv_page); - return -ENOMEM; - } - } - - return 0; -} - /* * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group (Any * use permitted, subject to terms of PostgreSQL license; see.) diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h index e02780545f12..1ae2a73ad85f 100644 --- a/drivers/md/bcache/util.h +++ b/drivers/md/bcache/util.h @@ -564,12 +564,8 @@ static inline unsigned fract_exp_two(unsigned x, unsigned fract_bits) return x; } -#define bio_end(bio) ((bio)->bi_sector + bio_sectors(bio)) - void bch_bio_map(struct bio *bio, void *base); -int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp); - static inline sector_t bdev_sectors(struct block_device *bdev) { return bdev->bd_inode->i_size >> 9; diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index d81ee5ccc726..22cbff551628 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -285,9 +285,10 @@ static void write_dirty_finish(struct closure *cl) struct dirty_io *io = container_of(cl, struct dirty_io, cl); struct keybuf_key *w = io->bio.bi_private; struct cached_dev *dc = io->dc; - struct bio_vec *bv = bio_iovec_idx(&io->bio, io->bio.bi_vcnt); + struct bio_vec *bv; + int i; - while (bv-- != io->bio.bi_io_vec) + bio_for_each_segment_all(bv, &io->bio, i) __free_page(bv->bv_page); /* This is kind of a dumb way of signalling errors. */ @@ -418,7 +419,7 @@ static void read_dirty(struct closure *cl) io->bio.bi_rw = READ; io->bio.bi_end_io = read_dirty_endio; - if (bch_bio_alloc_pages(&io->bio, GFP_KERNEL)) + if (bio_alloc_pages(&io->bio, GFP_KERNEL)) goto err_free; trace_bcache_writeback(&w->key); From 1c297a66654a3295ae87e2b7f3724d214eb2b5ec Mon Sep 17 00:00:00 2001 From: Alexandre Belloni <alexandre.belloni@free-electrons.com> Date: Mon, 1 Jul 2013 15:20:00 +0100 Subject: [PATCH 058/913] iio: Fix iio_channel_has_info Since the info_mask split, iio_channel_has_info() is not working correctly. info_mask_separate and info_mask_shared_by_type, it is not possible to compare them directly with the iio_chan_info_enum enum. Correct that bit using the BIT() macro. Cc: <stable@vger.kernel.org> # 3.10.x Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> --- include/linux/iio/iio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 8d171f427632..3d35b7023591 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -211,8 +211,8 @@ struct iio_chan_spec { static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, enum iio_chan_info_enum type) { - return (chan->info_mask_separate & type) | - (chan->info_mask_shared_by_type & type); + return (chan->info_mask_separate & BIT(type)) | + (chan->info_mask_shared_by_type & BIT(type)); } #define IIO_ST(si, rb, sb, sh) \ From f91d1b63a4e096d3023aaaafec9d9d3aff25997f Mon Sep 17 00:00:00 2001 From: Alexandre Belloni <alexandre.belloni@free-electrons.com> Date: Mon, 1 Jul 2013 17:40:00 +0100 Subject: [PATCH 059/913] iio: inkern: fix iio_convert_raw_to_processed_unlocked When reading IIO_CHAN_INFO_OFFSET, the return value of iio_channel_read() for success will be IIO_VAL*, checking for 0 is not correct. Without this fix the offset applied by iio drivers will be ignored when converting a raw value to one in appropriate base units (e.g mV) in a IIO client drivers that use iio_convert_raw_to_processed including iio-hwmon. Cc: <stable@vger.kernel.org> # 3.10.x Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> --- drivers/iio/inkern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 98ddc323add0..0cf5f8e06cfc 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -451,7 +451,7 @@ static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan, int ret; ret = iio_channel_read(chan, &offset, NULL, IIO_CHAN_INFO_OFFSET); - if (ret == 0) + if (ret >= 0) raw64 += offset; scale_type = iio_channel_read(chan, &scale_val, &scale_val2, From e1b1fa66a0398f0b52ae79a2bdc7de87c205d074 Mon Sep 17 00:00:00 2001 From: Marek Vasut <marex@denx.de> Date: Sat, 29 Jun 2013 22:20:00 +0100 Subject: [PATCH 060/913] iio: mxs-lradc: Fix misuse of iio->trig The struct iio_dev .trig field is to be used only by the IIO core, the driver shall not fill this field. This fixes ugly crash when the driver is compiled as a module and the module is rmmod'd. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org> --- drivers/staging/iio/adc/mxs-lradc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index d92c97a59d61..c5edf1cad07a 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -661,12 +661,13 @@ static int mxs_lradc_trigger_init(struct iio_dev *iio) { int ret; struct iio_trigger *trig; + struct mxs_lradc *lradc = iio_priv(iio); trig = iio_trigger_alloc("%s-dev%i", iio->name, iio->id); if (trig == NULL) return -ENOMEM; - trig->dev.parent = iio->dev.parent; + trig->dev.parent = lradc->dev; iio_trigger_set_drvdata(trig, iio); trig->ops = &mxs_lradc_trigger_ops; @@ -676,15 +677,17 @@ static int mxs_lradc_trigger_init(struct iio_dev *iio) return ret; } - iio->trig = trig; + lradc->trig = trig; return 0; } static void mxs_lradc_trigger_remove(struct iio_dev *iio) { - iio_trigger_unregister(iio->trig); - iio_trigger_free(iio->trig); + struct mxs_lradc *lradc = iio_priv(iio); + + iio_trigger_unregister(lradc->trig); + iio_trigger_free(lradc->trig); } static int mxs_lradc_buffer_preenable(struct iio_dev *iio) From 2a961d0995cdadbfba565b28beada59c5ae7ebae Mon Sep 17 00:00:00 2001 From: Marek Vasut <marex@denx.de> Date: Wed, 3 Jul 2013 22:25:00 +0100 Subject: [PATCH 061/913] iio: mxs-lradc: Remove useless check in read_raw The removed check in the read_raw implementation was always true, therefore remove it. This also fixes a bug, by closely inspecting the code, one can notice the iio_validate_scan_mask_onehot() will always return 1 and therefore the subsequent condition will always succeed, therefore making the mxs_lradc_read_raw() function always return -EINVAL; . Signed-off-by: Marek Vasut <marex@denx.de> Tested-by: Otavio Salvador <otavio@ossystems.com.br> Acked-by: Hector Palacios <hector.palacios@digi.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> --- drivers/staging/iio/adc/mxs-lradc.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index c5edf1cad07a..9f52a2857929 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -234,7 +234,6 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev, { struct mxs_lradc *lradc = iio_priv(iio_dev); int ret; - unsigned long mask; if (m != IIO_CHAN_INFO_RAW) return -EINVAL; @@ -243,12 +242,6 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev, if (chan->channel > LRADC_MAX_TOTAL_CHANS) return -EINVAL; - /* Validate the channel if it doesn't intersect with reserved chans. */ - bitmap_set(&mask, chan->channel, 1); - ret = iio_validate_scan_mask_onehot(iio_dev, &mask); - if (ret) - return -EINVAL; - /* * See if there is no buffered operation in progess. If there is, simply * bail out. This can be improved to support both buffered and raw IO at From bc93aa7640fe97df8d69b50fdce70da1126e12b3 Mon Sep 17 00:00:00 2001 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Sat, 6 Jul 2013 05:20:00 +0100 Subject: [PATCH 062/913] iio: ti_am335x_adc: add missing .driver_module to struct iio_info Add missing .driver_module of struct iio_info. This prevents the module from being removed from underneath its users. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Jonathan Cameron <jic23@kernel.org> --- drivers/iio/adc/ti_am335x_adc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index 5f9a7e7d3135..985f58873d03 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c @@ -134,6 +134,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, static const struct iio_info tiadc_info = { .read_raw = &tiadc_read_raw, + .driver_module = THIS_MODULE, }; static int tiadc_probe(struct platform_device *pdev) From bb3779610254ea5efbf8ec727138e041d801747c Mon Sep 17 00:00:00 2001 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Thu, 4 Jul 2013 14:46:00 +0100 Subject: [PATCH 063/913] staging:iio:ad7291: add missing .driver_module to struct iio_info Add missing .driver_module of struct iio_info. This prevents the module from being removed from underneath its users. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Jonathan Cameron <jic23@kernel.org> --- drivers/staging/iio/adc/ad7291.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c index 3fc79e582750..a2e61c2fc8d1 100644 --- a/drivers/staging/iio/adc/ad7291.c +++ b/drivers/staging/iio/adc/ad7291.c @@ -517,6 +517,7 @@ static const struct iio_info ad7291_info = { .read_event_value = &ad7291_read_event_value, .write_event_value = &ad7291_write_event_value, .event_attrs = &ad7291_event_attribute_group, + .driver_module = THIS_MODULE, }; static int ad7291_probe(struct i2c_client *client, From 8f6817a0a57cf15935f8f076d0ade34da01cf26d Mon Sep 17 00:00:00 2001 From: Peter Meerwald <pmeerw@pmeerw.net> Date: Sun, 7 Jul 2013 21:24:00 +0100 Subject: [PATCH 064/913] iio staging: fix lis3l02dq, read error handling Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org> --- drivers/staging/iio/accel/lis3l02dq_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c index 1bfe5d81792b..8ed75a94f465 100644 --- a/drivers/staging/iio/accel/lis3l02dq_core.c +++ b/drivers/staging/iio/accel/lis3l02dq_core.c @@ -257,6 +257,8 @@ static int lis3l02dq_read_raw(struct iio_dev *indio_dev, ret = lis3l02dq_read_reg_s16(indio_dev, reg, val); } mutex_unlock(&indio_dev->mlock); + if (ret < 0) + goto error_ret; return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: *val = 0; From add0c59d802e6118e51e21244c3871be35164e4b Mon Sep 17 00:00:00 2001 From: Tejun Heo <tj@kernel.org> Date: Tue, 9 Jul 2013 16:17:39 -0700 Subject: [PATCH 065/913] cgroup: remove bcache_subsys_id which got added stealthily cafe563591 ("bcache: A block layer cache") added a new cgroup subsystem bcache_subsys without proper review and ack. bcache_subsys seems to use cgroup for group stats and per-group cache_mode configuration. This is very much the type of usage that we don't want to allow. Fortunately, CONFIG_CGROUP_BCACHE which enables bcache_subsys is currently commented out, so this shouldn't have any upstream users. Let's nip in the bud. While at it, clarify in cgroup_subsys.h that no new subsystem should be added without explicit acks from cgroup maintainers. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Li Zefan <lizefan@huawei.com> Cc: cgroups@vger.kernel.org Cc: Kent Overstreet <kent.overstreet@gmail.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: linux-bcache@vger.kernel.org --- include/linux/cgroup_subsys.h | 45 ++++++----------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index 6e7ec64b69ab..b613ffd402d1 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h @@ -1,86 +1,55 @@ -/* Add subsystem definitions of the form SUBSYS(<name>) in this - * file. Surround each one by a line of comment markers so that - * patches don't collide +/* + * List of cgroup subsystems. + * + * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS. */ - -/* */ - -/* */ - #if IS_SUBSYS_ENABLED(CONFIG_CPUSETS) SUBSYS(cpuset) #endif -/* */ - #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG) SUBSYS(debug) #endif -/* */ - #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED) SUBSYS(cpu_cgroup) #endif -/* */ - #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT) SUBSYS(cpuacct) #endif -/* */ - #if IS_SUBSYS_ENABLED(CONFIG_MEMCG) SUBSYS(mem_cgroup) #endif -/* */ - #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE) SUBSYS(devices) #endif -/* */ - #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER) SUBSYS(freezer) #endif -/* */ - #if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP) SUBSYS(net_cls) #endif -/* */ - #if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP) SUBSYS(blkio) #endif -/* */ - #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF) SUBSYS(perf) #endif -/* */ - #if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP) SUBSYS(net_prio) #endif -/* */ - #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB) SUBSYS(hugetlb) #endif - -/* */ - -#ifdef CONFIG_CGROUP_BCACHE -SUBSYS(bcache) -#endif - -/* */ +/* + * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS. + */ From 060810d7abaabcab282e062c595871d661561400 Mon Sep 17 00:00:00 2001 From: Ben Skeggs <bskeggs@redhat.com> Date: Mon, 8 Jul 2013 14:15:51 +1000 Subject: [PATCH 066/913] drm/nouveau: fix locking issues in page flipping paths b580c9e2b7ba5030a795aa2fb73b796523d65a78 introduced additional problems while trying to solve issues that became apparent while porting to the new reservation stuff. The major problem was that the the previously mentioned patch took the client mutex earlier than previously, but the pinning of new_bo can can potentially cause a buffer move, which would result in attempting to acquire the same mutex again. This commit attempts to fix that "fix". Thanks to Maarten for the tips on keeping lockdep happy and cooking :) Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Acked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> --- drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +- drivers/gpu/drm/nouveau/nouveau_display.c | 53 +++++++++-------------- drivers/gpu/drm/nouveau/nouveau_drm.c | 3 -- 3 files changed, 22 insertions(+), 36 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 4b1afb131380..85fed108d7e4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -973,7 +973,7 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr, struct ttm_mem_reg *old_mem = &bo->mem; int ret; - mutex_lock(&chan->cli->mutex); + mutex_lock_nested(&chan->cli->mutex, SINGLE_DEPTH_NESTING); /* create temporary vmas for the transfer and attach them to the * old nouveau_mem node, these will get cleaned up after ttm has diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 708b2d1c0037..61fdef8eac49 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -524,9 +524,12 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, struct nouveau_page_flip_state *s; struct nouveau_channel *chan = NULL; struct nouveau_fence *fence; - struct list_head res; - struct ttm_validate_buffer res_val[2]; + struct ttm_validate_buffer resv[2] = { + { .bo = &old_bo->bo }, + { .bo = &new_bo->bo }, + }; struct ww_acquire_ctx ticket; + LIST_HEAD(res); int ret; if (!drm->channel) @@ -545,27 +548,19 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, chan = drm->channel; spin_unlock(&old_bo->bo.bdev->fence_lock); - mutex_lock(&chan->cli->mutex); - if (new_bo != old_bo) { ret = nouveau_bo_pin(new_bo, TTM_PL_FLAG_VRAM); - if (likely(!ret)) { - res_val[0].bo = &old_bo->bo; - res_val[1].bo = &new_bo->bo; - INIT_LIST_HEAD(&res); - list_add_tail(&res_val[0].head, &res); - list_add_tail(&res_val[1].head, &res); - ret = ttm_eu_reserve_buffers(&ticket, &res); - if (ret) - nouveau_bo_unpin(new_bo); - } - } else - ret = ttm_bo_reserve(&new_bo->bo, false, false, false, 0); + if (ret) + goto fail_free; - if (ret) { - mutex_unlock(&chan->cli->mutex); - goto fail_free; + list_add(&resv[1].head, &res); } + list_add(&resv[0].head, &res); + + mutex_lock(&chan->cli->mutex); + ret = ttm_eu_reserve_buffers(&ticket, &res); + if (ret) + goto fail_unpin; /* Initialize a page flip struct */ *s = (struct nouveau_page_flip_state) @@ -576,10 +571,8 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, /* Emit a page flip */ if (nv_device(drm->device)->card_type >= NV_50) { ret = nv50_display_flip_next(crtc, fb, chan, 0); - if (ret) { - mutex_unlock(&chan->cli->mutex); + if (ret) goto fail_unreserve; - } } ret = nouveau_page_flip_emit(chan, old_bo, new_bo, s, &fence); @@ -590,22 +583,18 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, /* Update the crtc struct and cleanup */ crtc->fb = fb; - if (old_bo != new_bo) { - ttm_eu_fence_buffer_objects(&ticket, &res, fence); + ttm_eu_fence_buffer_objects(&ticket, &res, fence); + if (old_bo != new_bo) nouveau_bo_unpin(old_bo); - } else { - nouveau_bo_fence(new_bo, fence); - ttm_bo_unreserve(&new_bo->bo); - } nouveau_fence_unref(&fence); return 0; fail_unreserve: - if (old_bo != new_bo) { - ttm_eu_backoff_reservation(&ticket, &res); + ttm_eu_backoff_reservation(&ticket, &res); +fail_unpin: + mutex_unlock(&chan->cli->mutex); + if (old_bo != new_bo) nouveau_bo_unpin(new_bo); - } else - ttm_bo_unreserve(&new_bo->bo); fail_free: kfree(s); return ret; diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 218a4b522fe5..4eca52b8d573 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -284,8 +284,6 @@ static int nouveau_drm_probe(struct pci_dev *pdev, return 0; } -static struct lock_class_key drm_client_lock_class_key; - static int nouveau_drm_load(struct drm_device *dev, unsigned long flags) { @@ -297,7 +295,6 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) ret = nouveau_cli_create(pdev, "DRM", sizeof(*drm), (void**)&drm); if (ret) return ret; - lockdep_set_class(&drm->client.mutex, &drm_client_lock_class_key); dev->dev_private = drm; drm->dev = dev; From fdfb8332651db7a280851dfccfc4f0cff4bcd052 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst <maarten.lankhorst@canonical.com> Date: Mon, 8 Jul 2013 14:50:54 +1000 Subject: [PATCH 067/913] drm/nouveau: fix some error-path leaks in fbcon handling code Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/nouveau_display.c | 16 ++++++++++------ drivers/gpu/drm/nouveau/nouveau_fbcon.c | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 61fdef8eac49..907d20ef6d4d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -138,7 +138,7 @@ nouveau_user_framebuffer_create(struct drm_device *dev, { struct nouveau_framebuffer *nouveau_fb; struct drm_gem_object *gem; - int ret; + int ret = -ENOMEM; gem = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); if (!gem) @@ -146,15 +146,19 @@ nouveau_user_framebuffer_create(struct drm_device *dev, nouveau_fb = kzalloc(sizeof(struct nouveau_framebuffer), GFP_KERNEL); if (!nouveau_fb) - return ERR_PTR(-ENOMEM); + goto err_unref; ret = nouveau_framebuffer_init(dev, nouveau_fb, mode_cmd, nouveau_gem_object(gem)); - if (ret) { - drm_gem_object_unreference(gem); - return ERR_PTR(ret); - } + if (ret) + goto err; return &nouveau_fb->base; + +err: + kfree(nouveau_fb); +err_unref: + drm_gem_object_unreference(gem); + return ERR_PTR(ret); } static const struct drm_mode_config_funcs nouveau_mode_config_funcs = { diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 9352010030e9..4c1bc061fae2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c @@ -385,6 +385,7 @@ out_unlock: mutex_unlock(&dev->struct_mutex); if (chan) nouveau_bo_vma_del(nvbo, &fbcon->nouveau_fb.vma); + nouveau_bo_unmap(nvbo); out_unpin: nouveau_bo_unpin(nvbo); out_unref: From 8dda53fca24789acf891ef31a3c5e03332b43cce Mon Sep 17 00:00:00 2001 From: Ben Skeggs <bskeggs@redhat.com> Date: Tue, 9 Jul 2013 12:35:55 +1000 Subject: [PATCH 068/913] drm/nv50/kms: fix pin refcnt leaks Weren't critical previously, the buffers would go away anyway. But with recent changes to core drm/ttm lockdep will get pissed off now, so let's fix it. Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Acked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> --- drivers/gpu/drm/nouveau/nv50_display.c | 46 ++++++++++++++++++++------ 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 54dc6355b0c2..8b40a36c1b57 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -355,6 +355,7 @@ struct nv50_oimm { struct nv50_head { struct nouveau_crtc base; + struct nouveau_bo *image; struct nv50_curs curs; struct nv50_sync sync; struct nv50_ovly ovly; @@ -517,9 +518,10 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, { struct nouveau_framebuffer *nv_fb = nouveau_framebuffer(fb); struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); + struct nv50_head *head = nv50_head(crtc); struct nv50_sync *sync = nv50_sync(crtc); - int head = nv_crtc->index, ret; u32 *push; + int ret; swap_interval <<= 4; if (swap_interval == 0) @@ -537,7 +539,7 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, return ret; BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 2); - OUT_RING (chan, NvEvoSema0 + head); + OUT_RING (chan, NvEvoSema0 + nv_crtc->index); OUT_RING (chan, sync->addr ^ 0x10); BEGIN_NV04(chan, 0, NV11_SUBCHAN_SEMAPHORE_RELEASE, 1); OUT_RING (chan, sync->data + 1); @@ -546,7 +548,7 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, OUT_RING (chan, sync->data); } else if (chan && nv_mclass(chan->object) < NVC0_CHANNEL_IND_CLASS) { - u64 addr = nv84_fence_crtc(chan, head) + sync->addr; + u64 addr = nv84_fence_crtc(chan, nv_crtc->index) + sync->addr; ret = RING_SPACE(chan, 12); if (ret) return ret; @@ -565,7 +567,7 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, OUT_RING (chan, NV84_SUBCHAN_SEMAPHORE_TRIGGER_ACQUIRE_EQUAL); } else if (chan) { - u64 addr = nv84_fence_crtc(chan, head) + sync->addr; + u64 addr = nv84_fence_crtc(chan, nv_crtc->index) + sync->addr; ret = RING_SPACE(chan, 10); if (ret) return ret; @@ -630,6 +632,8 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, evo_mthd(push, 0x0080, 1); evo_data(push, 0x00000000); evo_kick(push, sync); + + nouveau_bo_ref(nv_fb->nvbo, &head->image); return 0; } @@ -1038,18 +1042,17 @@ static int nv50_crtc_swap_fbs(struct drm_crtc *crtc, struct drm_framebuffer *old_fb) { struct nouveau_framebuffer *nvfb = nouveau_framebuffer(crtc->fb); + struct nv50_head *head = nv50_head(crtc); int ret; ret = nouveau_bo_pin(nvfb->nvbo, TTM_PL_FLAG_VRAM); - if (ret) - return ret; - - if (old_fb) { - nvfb = nouveau_framebuffer(old_fb); - nouveau_bo_unpin(nvfb->nvbo); + if (ret == 0) { + if (head->image) + nouveau_bo_unpin(head->image); + nouveau_bo_ref(nvfb->nvbo, &head->image); } - return 0; + return ret; } static int @@ -1198,6 +1201,15 @@ nv50_crtc_lut_load(struct drm_crtc *crtc) } } +static void +nv50_crtc_disable(struct drm_crtc *crtc) +{ + struct nv50_head *head = nv50_head(crtc); + if (head->image) + nouveau_bo_unpin(head->image); + nouveau_bo_ref(NULL, &head->image); +} + static int nv50_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, uint32_t handle, uint32_t width, uint32_t height) @@ -1271,18 +1283,29 @@ nv50_crtc_destroy(struct drm_crtc *crtc) struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); struct nv50_disp *disp = nv50_disp(crtc->dev); struct nv50_head *head = nv50_head(crtc); + nv50_dmac_destroy(disp->core, &head->ovly.base); nv50_pioc_destroy(disp->core, &head->oimm.base); nv50_dmac_destroy(disp->core, &head->sync.base); nv50_pioc_destroy(disp->core, &head->curs.base); + + /*XXX: this shouldn't be necessary, but the core doesn't call + * disconnect() during the cleanup paths + */ + if (head->image) + nouveau_bo_unpin(head->image); + nouveau_bo_ref(NULL, &head->image); + nouveau_bo_unmap(nv_crtc->cursor.nvbo); if (nv_crtc->cursor.nvbo) nouveau_bo_unpin(nv_crtc->cursor.nvbo); nouveau_bo_ref(NULL, &nv_crtc->cursor.nvbo); + nouveau_bo_unmap(nv_crtc->lut.nvbo); if (nv_crtc->lut.nvbo) nouveau_bo_unpin(nv_crtc->lut.nvbo); nouveau_bo_ref(NULL, &nv_crtc->lut.nvbo); + drm_crtc_cleanup(crtc); kfree(crtc); } @@ -1296,6 +1319,7 @@ static const struct drm_crtc_helper_funcs nv50_crtc_hfunc = { .mode_set_base = nv50_crtc_mode_set_base, .mode_set_base_atomic = nv50_crtc_mode_set_base_atomic, .load_lut = nv50_crtc_lut_load, + .disable = nv50_crtc_disable, }; static const struct drm_crtc_funcs nv50_crtc_func = { From 4f3855997c5d2bf6443853800eb1a03f61ad9140 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst <maarten.lankhorst@canonical.com> Date: Sun, 7 Jul 2013 10:37:35 +0200 Subject: [PATCH 069/913] drm/nouveau: do not unpin in nouveau_gem_object_del This should no longer be required, and is harmful for framebuffer pinning. Also add a warning if unpin causes the pin count to drop below 0. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/nouveau_bo.c | 7 +++++-- drivers/gpu/drm/nouveau/nouveau_gem.c | 6 ------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 85fed108d7e4..824a98811de6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -148,6 +148,7 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) if (unlikely(nvbo->gem)) DRM_ERROR("bo %p still attached to GEM object\n", bo); + WARN_ON(nvbo->pin_refcnt > 0); nv10_bo_put_tile_region(dev, nvbo->tile, NULL); kfree(nvbo); } @@ -340,13 +341,15 @@ nouveau_bo_unpin(struct nouveau_bo *nvbo) { struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); struct ttm_buffer_object *bo = &nvbo->bo; - int ret; + int ret, ref; ret = ttm_bo_reserve(bo, false, false, false, 0); if (ret) return ret; - if (--nvbo->pin_refcnt) + ref = --nvbo->pin_refcnt; + WARN_ON_ONCE(ref < 0); + if (ref) goto out; nouveau_bo_placement_set(nvbo, bo->mem.placement, 0); diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index e72d09c068a8..830cb7bad922 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -50,12 +50,6 @@ nouveau_gem_object_del(struct drm_gem_object *gem) return; nvbo->gem = NULL; - /* Lockdep hates you for doing reserve with gem object lock held */ - if (WARN_ON_ONCE(nvbo->pin_refcnt)) { - nvbo->pin_refcnt = 1; - nouveau_bo_unpin(nvbo); - } - if (gem->import_attach) drm_prime_gem_destroy(gem, nvbo->bo.sg); From 06b237ef3903a0a5e33785105ea5203153323dd8 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst <maarten.lankhorst@canonical.com> Date: Sun, 7 Jul 2013 10:53:37 +0200 Subject: [PATCH 070/913] drm/nouveau: bump fence timeout to 15 seconds calim didn't like 150 seconds timeout, so lower the timeout for him. 15 seconds should still be plenty. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 1680d9187bab..be3149932c2d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c @@ -143,7 +143,7 @@ nouveau_fence_emit(struct nouveau_fence *fence, struct nouveau_channel *chan) int ret; fence->channel = chan; - fence->timeout = jiffies + (3 * DRM_HZ); + fence->timeout = jiffies + (15 * DRM_HZ); fence->sequence = ++fctx->sequence; ret = fctx->emit(fence); From 00fc6f6f731efb7b76b839598e494b01890d901d Mon Sep 17 00:00:00 2001 From: Ben Skeggs <bskeggs@redhat.com> Date: Tue, 9 Jul 2013 14:20:15 +1000 Subject: [PATCH 071/913] drm/nouveau: use dedicated channel for async moves on GT/GF chipsets. The moves themselves were generally async to graphics previously, with the exception that if the "main" channel is used to synchronise a page flip at the same time, it can end up blocked for a noticable amount of time for large buffer moves. Not really critical, and there's better ways of handling this, but they are all rather invasive, so this is fine for now. Based on a patch by Maarten Lankhorst addressing the same issue. Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Acked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> --- drivers/gpu/drm/nouveau/nouveau_bo.c | 6 +++--- drivers/gpu/drm/nouveau/nouveau_drm.c | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 824a98811de6..459a44550ce5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -581,7 +581,7 @@ nve0_bo_move_init(struct nouveau_channel *chan, u32 handle) int ret = RING_SPACE(chan, 2); if (ret == 0) { BEGIN_NVC0(chan, NvSubCopy, 0x0000, 1); - OUT_RING (chan, handle); + OUT_RING (chan, handle & 0x0000ffff); FIRE_RING (chan); } return ret; @@ -1017,7 +1017,7 @@ nouveau_bo_move_init(struct nouveau_drm *drm) struct ttm_mem_reg *, struct ttm_mem_reg *); int (*init)(struct nouveau_channel *, u32 handle); } _methods[] = { - { "COPY", 0, 0xa0b5, nve0_bo_move_copy, nve0_bo_move_init }, + { "COPY", 4, 0xa0b5, nve0_bo_move_copy, nve0_bo_move_init }, { "GRCE", 0, 0xa0b5, nve0_bo_move_copy, nvc0_bo_move_init }, { "COPY1", 5, 0x90b8, nvc0_bo_move_copy, nvc0_bo_move_init }, { "COPY0", 4, 0x90b5, nvc0_bo_move_copy, nvc0_bo_move_init }, @@ -1037,7 +1037,7 @@ nouveau_bo_move_init(struct nouveau_drm *drm) struct nouveau_channel *chan; u32 handle = (mthd->engine << 16) | mthd->oclass; - if (mthd->init == nve0_bo_move_init) + if (mthd->engine) chan = drm->cechan; else chan = drm->channel; diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 4eca52b8d573..61972668fd05 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -192,6 +192,18 @@ nouveau_accel_init(struct nouveau_drm *drm) arg0 = NVE0_CHANNEL_IND_ENGINE_GR; arg1 = 1; + } else + if (device->chipset >= 0xa3 && + device->chipset != 0xaa && + device->chipset != 0xac) { + ret = nouveau_channel_new(drm, &drm->client, NVDRM_DEVICE, + NVDRM_CHAN + 1, NvDmaFB, NvDmaTT, + &drm->cechan); + if (ret) + NV_ERROR(drm, "failed to create ce channel, %d\n", ret); + + arg0 = NvDmaFB; + arg1 = NvDmaTT; } else { arg0 = NvDmaFB; arg1 = NvDmaTT; From 9b234db37825860b833ba110673301e2009f0546 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst <maarten.lankhorst@canonical.com> Date: Sun, 7 Jul 2013 10:45:43 +0200 Subject: [PATCH 072/913] drm/nouveau: add falcon interrupt handler This prevents 100% cpu usage on fermi cards when the exit interrupt from the secret scrubber is not acked. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- .../gpu/drm/nouveau/core/engine/bsp/nvc0.c | 1 + .../gpu/drm/nouveau/core/engine/bsp/nve0.c | 1 + drivers/gpu/drm/nouveau/core/engine/falcon.c | 19 +++++++++++++++++++ .../gpu/drm/nouveau/core/engine/ppp/nvc0.c | 1 + drivers/gpu/drm/nouveau/core/engine/vp/nvc0.c | 1 + drivers/gpu/drm/nouveau/core/engine/vp/nve0.c | 1 + .../drm/nouveau/core/include/engine/falcon.h | 2 ++ 7 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/nouveau/core/engine/bsp/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/bsp/nvc0.c index 262c9f5f5f60..ce860de43e61 100644 --- a/drivers/gpu/drm/nouveau/core/engine/bsp/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/bsp/nvc0.c @@ -90,6 +90,7 @@ nvc0_bsp_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return ret; nv_subdev(priv)->unit = 0x00008000; + nv_subdev(priv)->intr = nouveau_falcon_intr; nv_engine(priv)->cclass = &nvc0_bsp_cclass; nv_engine(priv)->sclass = nvc0_bsp_sclass; return 0; diff --git a/drivers/gpu/drm/nouveau/core/engine/bsp/nve0.c b/drivers/gpu/drm/nouveau/core/engine/bsp/nve0.c index c46882c83982..ba6aeca0285e 100644 --- a/drivers/gpu/drm/nouveau/core/engine/bsp/nve0.c +++ b/drivers/gpu/drm/nouveau/core/engine/bsp/nve0.c @@ -90,6 +90,7 @@ nve0_bsp_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return ret; nv_subdev(priv)->unit = 0x00008000; + nv_subdev(priv)->intr = nouveau_falcon_intr; nv_engine(priv)->cclass = &nve0_bsp_cclass; nv_engine(priv)->sclass = nve0_bsp_sclass; return 0; diff --git a/drivers/gpu/drm/nouveau/core/engine/falcon.c b/drivers/gpu/drm/nouveau/core/engine/falcon.c index 3c7a31f7590e..e03fc8e4dc1d 100644 --- a/drivers/gpu/drm/nouveau/core/engine/falcon.c +++ b/drivers/gpu/drm/nouveau/core/engine/falcon.c @@ -23,6 +23,25 @@ #include <engine/falcon.h> #include <subdev/timer.h> +void +nouveau_falcon_intr(struct nouveau_subdev *subdev) +{ + struct nouveau_falcon *falcon = (void *)subdev; + u32 dispatch = nv_ro32(falcon, 0x01c); + u32 intr = nv_ro32(falcon, 0x008) & dispatch & ~(dispatch >> 16); + + if (intr & 0x00000010) { + nv_debug(falcon, "ucode halted\n"); + nv_wo32(falcon, 0x004, 0x00000010); + intr &= ~0x00000010; + } + + if (intr) { + nv_error(falcon, "unhandled intr 0x%08x\n", intr); + nv_wo32(falcon, 0x004, intr); + } +} + u32 _nouveau_falcon_rd32(struct nouveau_object *object, u64 addr) { diff --git a/drivers/gpu/drm/nouveau/core/engine/ppp/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/ppp/nvc0.c index 98072c1ff360..73719aaa62d6 100644 --- a/drivers/gpu/drm/nouveau/core/engine/ppp/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/ppp/nvc0.c @@ -90,6 +90,7 @@ nvc0_ppp_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return ret; nv_subdev(priv)->unit = 0x00000002; + nv_subdev(priv)->intr = nouveau_falcon_intr; nv_engine(priv)->cclass = &nvc0_ppp_cclass; nv_engine(priv)->sclass = nvc0_ppp_sclass; return 0; diff --git a/drivers/gpu/drm/nouveau/core/engine/vp/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/vp/nvc0.c index 1879229b60eb..ac1f62aace72 100644 --- a/drivers/gpu/drm/nouveau/core/engine/vp/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/vp/nvc0.c @@ -90,6 +90,7 @@ nvc0_vp_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return ret; nv_subdev(priv)->unit = 0x00020000; + nv_subdev(priv)->intr = nouveau_falcon_intr; nv_engine(priv)->cclass = &nvc0_vp_cclass; nv_engine(priv)->sclass = nvc0_vp_sclass; return 0; diff --git a/drivers/gpu/drm/nouveau/core/engine/vp/nve0.c b/drivers/gpu/drm/nouveau/core/engine/vp/nve0.c index d28ecbf7bc49..d4c3108479c9 100644 --- a/drivers/gpu/drm/nouveau/core/engine/vp/nve0.c +++ b/drivers/gpu/drm/nouveau/core/engine/vp/nve0.c @@ -90,6 +90,7 @@ nve0_vp_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return ret; nv_subdev(priv)->unit = 0x00020000; + nv_subdev(priv)->intr = nouveau_falcon_intr; nv_engine(priv)->cclass = &nve0_vp_cclass; nv_engine(priv)->sclass = nve0_vp_sclass; return 0; diff --git a/drivers/gpu/drm/nouveau/core/include/engine/falcon.h b/drivers/gpu/drm/nouveau/core/include/engine/falcon.h index 1edec386ab36..181aa7da524d 100644 --- a/drivers/gpu/drm/nouveau/core/include/engine/falcon.h +++ b/drivers/gpu/drm/nouveau/core/include/engine/falcon.h @@ -72,6 +72,8 @@ int nouveau_falcon_create_(struct nouveau_object *, struct nouveau_object *, struct nouveau_oclass *, u32, bool, const char *, const char *, int, void **); +void nouveau_falcon_intr(struct nouveau_subdev *subdev); + #define _nouveau_falcon_dtor _nouveau_engine_dtor int _nouveau_falcon_init(struct nouveau_object *); int _nouveau_falcon_fini(struct nouveau_object *, bool); From 0108bc808107b97e101b15af9705729626be6447 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst <maarten.lankhorst@canonical.com> Date: Sun, 7 Jul 2013 10:40:19 +0200 Subject: [PATCH 073/913] drm/nouveau: do not allow negative sizes for now The API allows up to 64-bits allocations, but size is handled as int inside nouveau almost everywhere. Until this is fixed it's better to prevent negative sizes. The 256 kB before INT_MAX is paranoia, because of the large page aligning below that could flip it above INT_MAX. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/nouveau_bo.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 459a44550ce5..4e7ee5f4155c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -198,6 +198,12 @@ nouveau_bo_new(struct drm_device *dev, int size, int align, size_t acc_size; int ret; int type = ttm_bo_type_device; + int max_size = INT_MAX & ~((1 << drm->client.base.vm->vmm->lpg_shift) - 1); + + if (size <= 0 || size > max_size) { + nv_warn(drm, "skipped size %x\n", (u32)size); + return -EINVAL; + } if (sg) type = ttm_bo_type_sg; From 9c23b7d3d6bda41e2a27375df705485523a96dc8 Mon Sep 17 00:00:00 2001 From: Vakul Garg <vakul@freescale.com> Date: Wed, 10 Jul 2013 06:26:13 +0000 Subject: [PATCH 074/913] crypto: caam - Fixed the memory out of bound overwrite issue When kernel is compiled with CONFIG_SLUB_DEBUG=y and CRYPTO_MANAGER_DISABLE_TESTS=n, during kernel bootup, the kernel reports error given below. The root cause is that in function hash_digest_key(), for allocating descriptor, insufficient memory was being allocated. The required number of descriptor words apart from input and output pointers are 8 (instead of 6). ============================================================================= BUG dma-kmalloc-32 (Not tainted): Redzone overwritten ----------------------------------------------------------------------------- Disabling lock debugging due to kernel taint INFO: 0xdec5dec0-0xdec5dec3. First byte 0x0 instead of 0xcc INFO: Allocated in ahash_setkey+0x60/0x594 age=7 cpu=1 pid=1257 __kmalloc+0x154/0x1b4 ahash_setkey+0x60/0x594 test_hash+0x260/0x5a0 alg_test_hash+0x48/0xb0 alg_test+0x84/0x228 cryptomgr_test+0x4c/0x54 kthread+0x98/0x9c ret_from_kernel_thread+0x64/0x6c INFO: Slab 0xc0bd0ba0 objects=19 used=2 fp=0xdec5d0d0 flags=0x0081 INFO: Object 0xdec5dea0 @offset=3744 fp=0x5c200014 Bytes b4 dec5de90: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ Object dec5dea0: b0 80 00 0a 84 41 00 0d f0 40 00 00 00 67 3f c0 .....A...@...g?. Object dec5deb0: 00 00 00 50 2c 14 00 50 f8 40 00 00 1e c5 d0 00 ...P,..P.@...... Redzone dec5dec0: 00 00 00 14 .... Padding dec5df68: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ Call Trace: [dec65b60] [c00071b4] show_stack+0x4c/0x168 (unreliable) [dec65ba0] [c00d4ec8] check_bytes_and_report+0xe4/0x11c [dec65bd0] [c00d507c] check_object+0x17c/0x23c [dec65bf0] [c0550a00] free_debug_processing+0xf4/0x294 [dec65c20] [c0550bdc] __slab_free+0x3c/0x294 [dec65c80] [c03f0744] ahash_setkey+0x4e0/0x594 [dec65cd0] [c01ef138] test_hash+0x260/0x5a0 [dec65e50] [c01ef4c0] alg_test_hash+0x48/0xb0 [dec65e70] [c01eecc4] alg_test+0x84/0x228 [dec65ee0] [c01ec640] cryptomgr_test+0x4c/0x54 [dec65ef0] [c005adc0] kthread+0x98/0x9c [dec65f40] [c000e1ac] ret_from_kernel_thread+0x64/0x6c FIX dma-kmalloc-32: Restoring 0xdec5dec0-0xdec5dec3=0xcc Change-Id: I0c7a1048053e811025d1c3b487940f87345c8f5d Signed-off-by: Vakul Garg <vakul@freescale.com> CC: <stable@vger.kernel.org> #3.9 Reviewed-by: Geanta Neag Horia Ioan-B05471 <horia.geanta@freescale.com> Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> --- drivers/crypto/caam/caamhash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index 5996521a1caf..84573b4d6f92 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -429,7 +429,7 @@ static int hash_digest_key(struct caam_hash_ctx *ctx, const u8 *key_in, dma_addr_t src_dma, dst_dma; int ret = 0; - desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); + desc = kmalloc(CAAM_CMD_SZ * 8 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); if (!desc) { dev_err(jrdev, "unable to allocate key input memory\n"); return -ENOMEM; From 2e26af79b7e24e9644a6c16ad4dca61501fb4b3f Mon Sep 17 00:00:00 2001 From: Asias He <asias@redhat.com> Date: Tue, 7 May 2013 14:54:33 +0800 Subject: [PATCH 075/913] vhost-net: Always access vq->private_data under vq mutex Signed-off-by: Asias He <asias@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- drivers/vhost/net.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 027be91db139..99f8d63491aa 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -346,12 +346,11 @@ static void handle_tx(struct vhost_net *net) struct vhost_net_ubuf_ref *uninitialized_var(ubufs); bool zcopy, zcopy_used; - /* TODO: check that we are running from vhost_worker? */ - sock = rcu_dereference_check(vq->private_data, 1); - if (!sock) - return; - mutex_lock(&vq->mutex); + sock = vq->private_data; + if (!sock) + goto out; + vhost_disable_notify(&net->dev, vq); hdr_size = nvq->vhost_hlen; @@ -461,7 +460,7 @@ static void handle_tx(struct vhost_net *net) break; } } - +out: mutex_unlock(&vq->mutex); } @@ -570,14 +569,14 @@ static void handle_rx(struct vhost_net *net) s16 headcount; size_t vhost_hlen, sock_hlen; size_t vhost_len, sock_len; - /* TODO: check that we are running from vhost_worker? */ - struct socket *sock = rcu_dereference_check(vq->private_data, 1); - - if (!sock) - return; + struct socket *sock; mutex_lock(&vq->mutex); + sock = vq->private_data; + if (!sock) + goto out; vhost_disable_notify(&net->dev, vq); + vhost_hlen = nvq->vhost_hlen; sock_hlen = nvq->sock_hlen; @@ -652,7 +651,7 @@ static void handle_rx(struct vhost_net *net) break; } } - +out: mutex_unlock(&vq->mutex); } From e7802212ea4bbbd5db99181942a19ab36ca4b914 Mon Sep 17 00:00:00 2001 From: Asias He <asias@redhat.com> Date: Tue, 7 May 2013 14:54:35 +0800 Subject: [PATCH 076/913] vhost-scsi: Always access vq->private_data under vq mutex Signed-off-by: Asias He <asias@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- drivers/vhost/scsi.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 4264840ef7dc..45365396dbbc 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -896,19 +896,15 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) int head, ret; u8 target; + mutex_lock(&vq->mutex); /* * We can handle the vq only after the endpoint is setup by calling the * VHOST_SCSI_SET_ENDPOINT ioctl. - * - * TODO: Check that we are running from vhost_worker which acts - * as read-side critical section for vhost kind of RCU. - * See the comments in struct vhost_virtqueue in drivers/vhost/vhost.h */ - vs_tpg = rcu_dereference_check(vq->private_data, 1); + vs_tpg = vq->private_data; if (!vs_tpg) - return; + goto out; - mutex_lock(&vq->mutex); vhost_disable_notify(&vs->dev, vq); for (;;) { @@ -1058,6 +1054,7 @@ err_free: vhost_scsi_free_cmd(cmd); err_cmd: vhost_scsi_send_bad_target(vs, vq, head, out); +out: mutex_unlock(&vq->mutex); } From 22fa90c7fb479694d6affebc049d21f06b714be6 Mon Sep 17 00:00:00 2001 From: Asias He <asias@redhat.com> Date: Tue, 7 May 2013 14:54:36 +0800 Subject: [PATCH 077/913] vhost: Remove custom vhost rcu usage Now, vq->private_data is always accessed under vq mutex. No need to play the vhost rcu trick. Signed-off-by: Asias He <asias@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- drivers/vhost/net.c | 16 ++++++---------- drivers/vhost/scsi.c | 6 ++---- drivers/vhost/test.c | 6 ++---- drivers/vhost/vhost.h | 10 ++-------- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 99f8d63491aa..969a85960e9f 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -15,7 +15,6 @@ #include <linux/moduleparam.h> #include <linux/mutex.h> #include <linux/workqueue.h> -#include <linux/rcupdate.h> #include <linux/file.h> #include <linux/slab.h> @@ -749,8 +748,7 @@ static int vhost_net_enable_vq(struct vhost_net *n, struct vhost_poll *poll = n->poll + (nvq - n->vqs); struct socket *sock; - sock = rcu_dereference_protected(vq->private_data, - lockdep_is_held(&vq->mutex)); + sock = vq->private_data; if (!sock) return 0; @@ -763,10 +761,9 @@ static struct socket *vhost_net_stop_vq(struct vhost_net *n, struct socket *sock; mutex_lock(&vq->mutex); - sock = rcu_dereference_protected(vq->private_data, - lockdep_is_held(&vq->mutex)); + sock = vq->private_data; vhost_net_disable_vq(n, vq); - rcu_assign_pointer(vq->private_data, NULL); + vq->private_data = NULL; mutex_unlock(&vq->mutex); return sock; } @@ -922,8 +919,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) } /* start polling new socket */ - oldsock = rcu_dereference_protected(vq->private_data, - lockdep_is_held(&vq->mutex)); + oldsock = vq->private_data; if (sock != oldsock) { ubufs = vhost_net_ubuf_alloc(vq, sock && vhost_sock_zcopy(sock)); @@ -933,7 +929,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) } vhost_net_disable_vq(n, vq); - rcu_assign_pointer(vq->private_data, sock); + vq->private_data = sock; r = vhost_init_used(vq); if (r) goto err_used; @@ -967,7 +963,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) return 0; err_used: - rcu_assign_pointer(vq->private_data, oldsock); + vq->private_data = oldsock; vhost_net_enable_vq(n, vq); if (ubufs) vhost_net_ubuf_put_wait_and_free(ubufs); diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 45365396dbbc..35ab0ce98414 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -1223,9 +1223,8 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, sizeof(vs->vs_vhost_wwpn)); for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { vq = &vs->vqs[i].vq; - /* Flushing the vhost_work acts as synchronize_rcu */ mutex_lock(&vq->mutex); - rcu_assign_pointer(vq->private_data, vs_tpg); + vq->private_data = vs_tpg; vhost_init_used(vq); mutex_unlock(&vq->mutex); } @@ -1304,9 +1303,8 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs, if (match) { for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { vq = &vs->vqs[i].vq; - /* Flushing the vhost_work acts as synchronize_rcu */ mutex_lock(&vq->mutex); - rcu_assign_pointer(vq->private_data, NULL); + vq->private_data = NULL; mutex_unlock(&vq->mutex); } } diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index a73ea217f24d..339eae85859a 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -13,7 +13,6 @@ #include <linux/module.h> #include <linux/mutex.h> #include <linux/workqueue.h> -#include <linux/rcupdate.h> #include <linux/file.h> #include <linux/slab.h> @@ -200,9 +199,8 @@ static long vhost_test_run(struct vhost_test *n, int test) priv = test ? n : NULL; /* start polling new socket */ - oldpriv = rcu_dereference_protected(vq->private_data, - lockdep_is_held(&vq->mutex)); - rcu_assign_pointer(vq->private_data, priv); + oldpriv = vq->private_data; + vq->private_data = priv; r = vhost_init_used(&n->vqs[index]); diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 42298cd23c73..4465ed5f316d 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h @@ -103,14 +103,8 @@ struct vhost_virtqueue { struct iovec iov[UIO_MAXIOV]; struct iovec *indirect; struct vring_used_elem *heads; - /* We use a kind of RCU to access private pointer. - * All readers access it from worker, which makes it possible to - * flush the vhost_work instead of synchronize_rcu. Therefore readers do - * not need to call rcu_read_lock/rcu_read_unlock: the beginning of - * vhost_work execution acts instead of rcu_read_lock() and the end of - * vhost_work execution acts instead of rcu_read_unlock(). - * Writers use virtqueue mutex. */ - void __rcu *private_data; + /* Protected by virtqueue mutex. */ + void *private_data; /* Log write descriptors */ void __user *log_base; struct vhost_log *log; From 0692282181e248328c226c2520994fc06dfd65bf Mon Sep 17 00:00:00 2001 From: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Thu, 11 Jul 2013 13:35:40 +0200 Subject: [PATCH 078/913] drm/i915: fix up readout of the lvds dither bit on gen2/3 It's in the PFIT_CONTROL register, but very much associated with the lvds encoder. So move the readout for it (in the case of an otherwise disabled pfit) from the pipe to the lvds encoder's get_config function. Otherwise we get a pipe state mismatch if we use pipe B for a non-lvds output and we've left the dither bit enabled behind us. This can happen if the BIOS has set the bit (some seem to unconditionally do that, even in the complete absence of an lvds port), but not enabled pipe B at boot-up. Then we won't clear the pfit control register since we can only touch that if the pfit is associated with our pipe in the crtc configuration - we could trample over the pfit state of the other pipe otherwise since it's shared. Once pipe B is enabled we notice that the 6to8 dither bit is set and complain about the mismatch. Note that testing indicates that we don't actually need to set this bit when the pfit is disabled, dithering on 18bpp panels seems to work regardless. But ripping that code out is not something for a bugfix meant for -rc kernels. v2: While at it clarify the logic in i9xx_get_pfit_config, spurred by comments from Chris on irc. v3: Use Chris suggestion to make the control flow in i9xx_get_pfit_config easier to understand. v4: Kill the extra line, spotted by Chris. Reported-by: Knut Petersen <Knut_Petersen@t-online.de> Cc: Knut Petersen <Knut_Petersen@t-online.de> Cc: Chris Wilson <chris@chris-wilson.co.uk> References: http://lists.freedesktop.org/archives/intel-gfx/2013-July/030092.html Tested-by: Knut Petersen <Knut_Petersen@t-online.de> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/intel_display.c | 11 ++++------- drivers/gpu/drm/i915/intel_lvds.c | 7 +++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 85f3eb74d2b7..c59335ce84f4 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -4913,22 +4913,19 @@ static void i9xx_get_pfit_config(struct intel_crtc *crtc, uint32_t tmp; tmp = I915_READ(PFIT_CONTROL); + if (!(tmp & PFIT_ENABLE)) + return; + /* Check whether the pfit is attached to our pipe. */ if (INTEL_INFO(dev)->gen < 4) { if (crtc->pipe != PIPE_B) return; - - /* gen2/3 store dither state in pfit control, needs to match */ - pipe_config->gmch_pfit.control = tmp & PANEL_8TO6_DITHER_ENABLE; } else { if ((tmp & PFIT_PIPE_MASK) != (crtc->pipe << PFIT_PIPE_SHIFT)) return; } - if (!(tmp & PFIT_ENABLE)) - return; - - pipe_config->gmch_pfit.control = I915_READ(PFIT_CONTROL); + pipe_config->gmch_pfit.control = tmp; pipe_config->gmch_pfit.pgm_ratios = I915_READ(PFIT_PGM_RATIOS); if (INTEL_INFO(dev)->gen < 5) pipe_config->gmch_pfit.lvds_border_bits = diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 2abb2d3c727b..12079983c8ab 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -109,6 +109,13 @@ static void intel_lvds_get_config(struct intel_encoder *encoder, flags |= DRM_MODE_FLAG_PVSYNC; pipe_config->adjusted_mode.flags |= flags; + + /* gen2/3 store dither state in pfit control, needs to match */ + if (INTEL_INFO(dev)->gen < 4) { + tmp = I915_READ(PFIT_CONTROL); + + pipe_config->gmch_pfit.control |= tmp & PANEL_8TO6_DITHER_ENABLE; + } } /* The LVDS pin pair needs to be on before the DPLLs are enabled. From 6aa8f1a6ca41c49721d2de4e048d3da8d06411f9 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <kmo@daterainc.com> Date: Wed, 10 Jul 2013 18:04:21 -0700 Subject: [PATCH 079/913] bcache: Fix a dumb race In the far-too-complicated closure code - closures can have destructors, for probably dubious reasons; they get run after the closure is no longer waiting on anything but before dropping the parent ref, intended just for freeing whatever memory the closure is embedded in. Trouble is, when remaining goes to 0 and we've got nothing more to run - we also have to unlock the closure, setting remaining to -1. If there's a destructor, that unlock isn't doing anything - nobody could be trying to lock it if we're about to free it - but if the unlock _is needed... that check for a destructor was racy. Argh. Signed-off-by: Kent Overstreet <kmo@daterainc.com> Cc: linux-stable <stable@vger.kernel.org> # >= v3.10 --- drivers/md/bcache/closure.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/md/bcache/closure.c b/drivers/md/bcache/closure.c index bd05a9a8c7cf..9aba2017f0d1 100644 --- a/drivers/md/bcache/closure.c +++ b/drivers/md/bcache/closure.c @@ -66,16 +66,18 @@ static inline void closure_put_after_sub(struct closure *cl, int flags) } else { struct closure *parent = cl->parent; struct closure_waitlist *wait = closure_waitlist(cl); + closure_fn *destructor = cl->fn; closure_debug_destroy(cl); + smp_mb(); atomic_set(&cl->remaining, -1); if (wait) closure_wake_up(wait); - if (cl->fn) - cl->fn(cl); + if (destructor) + destructor(cl); if (parent) closure_put(parent); From d2a65ce2ac224413b291307201c5dafb03aa90d7 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Fri, 5 Jul 2013 09:05:46 +0300 Subject: [PATCH 080/913] bcache: check for allocation failures There is a missing NULL check after the kzalloc(). Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- drivers/md/bcache/sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index dd3f00a42729..12a2c2846f99 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -232,6 +232,8 @@ STORE(__cached_dev) bch_uuid_write(dc->disk.c); } env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL); + if (!env) + return -ENOMEM; add_uevent_var(env, "DRIVER=bcache"); add_uevent_var(env, "CACHED_UUID=%pU", dc->sb.uuid), add_uevent_var(env, "CACHED_LABEL=%s", buf); From 54d12f2b4fd0f218590d1490b41a18d0e2328a9a Mon Sep 17 00:00:00 2001 From: Kent Overstreet <kmo@daterainc.com> Date: Wed, 10 Jul 2013 18:44:40 -0700 Subject: [PATCH 081/913] bcache: Advertise that flushes are supported Whoops - bcache's flush/FUA was mostly correct, but flushes get filtered out unless we say we support them... Signed-off-by: Kent Overstreet <kmo@daterainc.com> Cc: linux-stable <stable@vger.kernel.org> # >= v3.10 --- drivers/md/bcache/request.c | 8 +++++++- drivers/md/bcache/super.c | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index b6e74d3c8faf..786a1a4f74d8 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -488,6 +488,12 @@ static void bch_insert_data_loop(struct closure *cl) bch_queue_gc(op->c); } + /* + * Journal writes are marked REQ_FLUSH; if the original write was a + * flush, it'll wait on the journal write. + */ + bio->bi_rw &= ~(REQ_FLUSH|REQ_FUA); + do { unsigned i; struct bkey *k; @@ -710,7 +716,7 @@ static struct search *search_alloc(struct bio *bio, struct bcache_device *d) s->task = current; s->orig_bio = bio; s->write = (bio->bi_rw & REQ_WRITE) != 0; - s->op.flush_journal = (bio->bi_rw & REQ_FLUSH) != 0; + s->op.flush_journal = (bio->bi_rw & (REQ_FLUSH|REQ_FUA)) != 0; s->op.skip = (bio->bi_rw & REQ_DISCARD) != 0; s->recoverable = 1; s->start_time = jiffies; diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index cff2d182dfb0..728fdc673f31 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -806,6 +806,8 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size, set_bit(QUEUE_FLAG_NONROT, &d->disk->queue->queue_flags); set_bit(QUEUE_FLAG_DISCARD, &d->disk->queue->queue_flags); + blk_queue_flush(q, REQ_FLUSH|REQ_FUA); + return 0; } From c9502ea4424b31728703d113fc6b30bfead14633 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <kmo@daterainc.com> Date: Wed, 10 Jul 2013 21:25:02 -0700 Subject: [PATCH 082/913] bcache: Fix a sysfs splat on shutdown If we stopped a bcache device when we were already detaching (or something like that), bcache_device_unlink() would try to remove a symlink from sysfs that was already gone because the bcache dev kobject had already been removed from sysfs. So keep track of whether we've removed stuff from sysfs. Signed-off-by: Kent Overstreet <kmo@daterainc.com> Cc: linux-stable <stable@vger.kernel.org> # >= v3.10 --- drivers/md/bcache/bcache.h | 1 + drivers/md/bcache/super.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 342ba86c6e4f..68f1ded81ae0 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -434,6 +434,7 @@ struct bcache_device { /* If nonzero, we're detaching/unregistering from cache set */ atomic_t detaching; + int flush_done; uint64_t nr_stripes; unsigned stripe_size_bits; diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 728fdc673f31..7a1dcdb2536e 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -706,7 +706,8 @@ static void bcache_device_detach(struct bcache_device *d) atomic_set(&d->detaching, 0); } - bcache_device_unlink(d); + if (!d->flush_done) + bcache_device_unlink(d); d->c->devices[d->id] = NULL; closure_put(&d->c->caching); @@ -1055,6 +1056,14 @@ static void cached_dev_flush(struct closure *cl) struct cached_dev *dc = container_of(cl, struct cached_dev, disk.cl); struct bcache_device *d = &dc->disk; + mutex_lock(&bch_register_lock); + d->flush_done = 1; + + if (d->c) + bcache_device_unlink(d); + + mutex_unlock(&bch_register_lock); + bch_cache_accounting_destroy(&dc->accounting); kobject_del(&d->kobj); From 5caa52afc5abd1396e4af720469abb5843a71eb8 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <kmo@daterainc.com> Date: Wed, 10 Jul 2013 21:03:25 -0700 Subject: [PATCH 083/913] bcache: Shutdown fix Stopping a cache set is supposed to make it stop attached backing devices, but somewhere along the way that code got lost. Fixing this mainly has the effect of fixing our reboot notifier. Signed-off-by: Kent Overstreet <kmo@daterainc.com> Cc: linux-stable <stable@vger.kernel.org> # >= v3.10 --- drivers/md/bcache/super.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 7a1dcdb2536e..f6a62174e8f6 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1354,18 +1354,22 @@ static void cache_set_flush(struct closure *cl) static void __cache_set_unregister(struct closure *cl) { struct cache_set *c = container_of(cl, struct cache_set, caching); - struct cached_dev *dc, *t; + struct cached_dev *dc; size_t i; mutex_lock(&bch_register_lock); - if (test_bit(CACHE_SET_UNREGISTERING, &c->flags)) - list_for_each_entry_safe(dc, t, &c->cached_devs, list) - bch_cached_dev_detach(dc); - for (i = 0; i < c->nr_uuids; i++) - if (c->devices[i] && UUID_FLASH_ONLY(&c->uuids[i])) - bcache_device_stop(c->devices[i]); + if (c->devices[i]) { + if (!UUID_FLASH_ONLY(&c->uuids[i]) && + test_bit(CACHE_SET_UNREGISTERING, &c->flags)) { + dc = container_of(c->devices[i], + struct cached_dev, disk); + bch_cached_dev_detach(dc); + } else { + bcache_device_stop(c->devices[i]); + } + } mutex_unlock(&bch_register_lock); From faa5673617656ee58369a3cfe4a312cfcdc59c81 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <kmo@daterainc.com> Date: Thu, 11 Jul 2013 22:42:14 -0700 Subject: [PATCH 084/913] bcache: Journal replay fix The journal replay code starts by finding something that looks like a valid journal entry, then it does a binary search over the unchecked region of the journal for the journal entries with the highest sequence numbers. Trouble is, the logic was wrong - journal_read_bucket() returns true if it found journal entries we need, but if the range of journal entries we're looking for loops around the end of the journal - in that case journal_read_bucket() could return true when it hadn't found the highest sequence number we'd seen yet, and in that case the binary search did the wrong thing. Whoops. Signed-off-by: Kent Overstreet <kmo@daterainc.com> Cc: linux-stable <stable@vger.kernel.org> # >= v3.10 --- drivers/md/bcache/journal.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 4b250667bb7f..ba95ab84b2be 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -184,9 +184,14 @@ bsearch: pr_debug("starting binary search, l %u r %u", l, r); while (l + 1 < r) { - m = (l + r) >> 1; + seq = list_entry(list->prev, struct journal_replay, + list)->j.seq; - if (read_bucket(m)) + m = (l + r) >> 1; + read_bucket(m); + + if (seq != list_entry(list->prev, struct journal_replay, + list)->j.seq) l = m; else r = m; From 29ebf465b9050f241c4433a796a32e6c896a9dcd Mon Sep 17 00:00:00 2001 From: Kent Overstreet <kmo@daterainc.com> Date: Thu, 11 Jul 2013 19:43:21 -0700 Subject: [PATCH 085/913] bcache: Fix GC_SECTORS_USED() calculation Part of the job of garbage collection is to add up however many sectors of live data it finds in each bucket, but that doesn't work very well if it doesn't reset GC_SECTORS_USED() when it starts. Whoops. This wouldn't have broken anything horribly, but allocation tries to preferentially reclaim buckets that are mostly empty and that's not gonna work with an incorrect GC_SECTORS_USED() value. Signed-off-by: Kent Overstreet <kmo@daterainc.com> Cc: linux-stable <stable@vger.kernel.org> # >= v3.10 --- drivers/md/bcache/btree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 15b58239c683..ee372884c405 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -1410,8 +1410,10 @@ static void btree_gc_start(struct cache_set *c) for_each_cache(ca, c, i) for_each_bucket(b, ca) { b->gc_gen = b->gen; - if (!atomic_read(&b->pin)) + if (!atomic_read(&b->pin)) { SET_GC_MARK(b, GC_MARK_RECLAIMABLE); + SET_GC_SECTORS_USED(b, 0); + } } mutex_unlock(&c->bucket_lock); From 79826c35eb99cd3c0873b8396f45fa26c87fb0b0 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <kmo@daterainc.com> Date: Wed, 10 Jul 2013 18:31:58 -0700 Subject: [PATCH 086/913] bcache: Allocation kthread fixes The alloc kthread should've been using try_to_freeze() - and also there was the potential for the alloc kthread to get woken up after it had shut down, which would have been bad. Signed-off-by: Kent Overstreet <kmo@daterainc.com> --- drivers/md/bcache/alloc.c | 18 ++++++++---------- drivers/md/bcache/bcache.h | 4 ---- drivers/md/bcache/super.c | 11 +++++++---- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c index b54b73b9b2b7..e45f5575fd4d 100644 --- a/drivers/md/bcache/alloc.c +++ b/drivers/md/bcache/alloc.c @@ -63,6 +63,7 @@ #include "bcache.h" #include "btree.h" +#include <linux/freezer.h> #include <linux/kthread.h> #include <linux/random.h> #include <trace/events/bcache.h> @@ -363,11 +364,10 @@ do { \ break; \ \ mutex_unlock(&(ca)->set->bucket_lock); \ - if (test_bit(CACHE_SET_STOPPING_2, &ca->set->flags)) { \ - closure_put(&ca->set->cl); \ + if (kthread_should_stop()) \ return 0; \ - } \ \ + try_to_freeze(); \ schedule(); \ mutex_lock(&(ca)->set->bucket_lock); \ } \ @@ -547,14 +547,12 @@ int bch_bucket_alloc_set(struct cache_set *c, unsigned watermark, int bch_cache_allocator_start(struct cache *ca) { - ca->alloc_thread = kthread_create(bch_allocator_thread, - ca, "bcache_allocator"); - if (IS_ERR(ca->alloc_thread)) - return PTR_ERR(ca->alloc_thread); - - closure_get(&ca->set->cl); - wake_up_process(ca->alloc_thread); + struct task_struct *k = kthread_run(bch_allocator_thread, + ca, "bcache_allocator"); + if (IS_ERR(k)) + return PTR_ERR(k); + ca->alloc_thread = k; return 0; } diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 68f1ded81ae0..b39f6f0b45f2 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -664,13 +664,9 @@ struct gc_stat { * CACHE_SET_STOPPING always gets set first when we're closing down a cache set; * we'll continue to run normally for awhile with CACHE_SET_STOPPING set (i.e. * flushing dirty data). - * - * CACHE_SET_STOPPING_2 gets set at the last phase, when it's time to shut down - * the allocation thread. */ #define CACHE_SET_UNREGISTERING 0 #define CACHE_SET_STOPPING 1 -#define CACHE_SET_STOPPING_2 2 struct cache_set { struct closure cl; diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index f6a62174e8f6..547c4c57b052 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -16,6 +16,7 @@ #include <linux/buffer_head.h> #include <linux/debugfs.h> #include <linux/genhd.h> +#include <linux/kthread.h> #include <linux/module.h> #include <linux/random.h> #include <linux/reboot.h> @@ -1329,11 +1330,9 @@ static void cache_set_free(struct closure *cl) static void cache_set_flush(struct closure *cl) { struct cache_set *c = container_of(cl, struct cache_set, caching); + struct cache *ca; struct btree *b; - - /* Shut down allocator threads */ - set_bit(CACHE_SET_STOPPING_2, &c->flags); - wake_up_allocators(c); + unsigned i; bch_cache_accounting_destroy(&c->accounting); @@ -1348,6 +1347,10 @@ static void cache_set_flush(struct closure *cl) if (btree_node_dirty(b)) bch_btree_node_write(b, NULL); + for_each_cache(ca, c, i) + if (ca->alloc_thread) + kthread_stop(ca->alloc_thread); + closure_return(cl); } From 21d8a4756af5fdf4a42e79a77cf3b6f52678d443 Mon Sep 17 00:00:00 2001 From: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Fri, 12 Jul 2013 08:07:30 +0200 Subject: [PATCH 087/913] drm/i915: fix pfit regression for non-autoscaled resolutions I.e. for letter/pillarboxing. For those cases we need to adjust the mode a bit, but Jesse gmch pfit refactoring in commit 2dd24552cab40ea829ba3fda890eeafd2c4816d8 Author: Jesse Barnes <jbarnes@virtuousgeek.org> Date: Thu Apr 25 12:55:01 2013 -0700 drm/i915: factor out GMCH panel fitting code and use for eDP v3 broke that by reordering the computation of the gmch pfit state with the block of code that prepared the adjusted mode for it and told the modeset core not to overwrite the adjusted mode with default settings. We might want to switch around the core code to just fill in defaults, but this code predates the pipe_config modeset rework. And in the old crtc helpers we did not have a suitable spot to do this. Cc: Mika Kuoppala <mika.kuoppala@intel.com> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: Hans de Bruin <jmdebruin@xmsnet.nl> Reported-and-tested-by: Hans de Bruin <jmdebruin@xmsnet.nl> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/intel_lvds.c | 5 +---- drivers/gpu/drm/i915/intel_panel.c | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 12079983c8ab..9a797c987537 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -297,14 +297,11 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder, intel_pch_panel_fitting(intel_crtc, pipe_config, intel_connector->panel.fitting_mode); - return true; } else { intel_gmch_panel_fitting(intel_crtc, pipe_config, intel_connector->panel.fitting_mode); - } - drm_mode_set_crtcinfo(adjusted_mode, 0); - pipe_config->timings_set = true; + } /* * XXX: It would be nice to support lower refresh rates on the diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 80bea1d3209f..45010bb5d132 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -194,6 +194,9 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, adjusted_mode->vdisplay == mode->vdisplay) goto out; + drm_mode_set_crtcinfo(adjusted_mode, 0); + pipe_config->timings_set = true; + switch (fitting_mode) { case DRM_MODE_SCALE_CENTER: /* From 913ffdb54366f94eec65c656cae8c6e00e1ab1b0 Mon Sep 17 00:00:00 2001 From: Tejun Heo <tj@kernel.org> Date: Thu, 11 Jul 2013 16:34:48 -0700 Subject: [PATCH 088/913] cgroup: replace task_cgroup_path_from_hierarchy() with task_cgroup_path() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit task_cgroup_path_from_hierarchy() was added for the planned new users and none of the currently planned users wants to know about multiple hierarchies. This patch drops the multiple hierarchy part and makes it always return the path in the first non-dummy hierarchy. As unified hierarchy will always have id 1, this is guaranteed to return the path for the unified hierarchy if mounted; otherwise, it will return the path from the hierarchy which happens to occupy the lowest hierarchy id, which will usually be the first hierarchy mounted after boot. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com> Cc: Lennart Poettering <lennart@poettering.net> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Jan Kaluža <jkaluza@redhat.com> --- include/linux/cgroup.h | 3 +-- kernel/cgroup.c | 31 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index fd097ecfcd97..21cfaff7e002 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -540,8 +540,7 @@ int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen); -int task_cgroup_path_from_hierarchy(struct task_struct *task, int hierarchy_id, - char *buf, size_t buflen); +int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen); int cgroup_task_count(const struct cgroup *cgrp); diff --git a/kernel/cgroup.c b/kernel/cgroup.c index e5583d10a325..afb8d53ca6c7 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -1846,36 +1846,43 @@ out: EXPORT_SYMBOL_GPL(cgroup_path); /** - * task_cgroup_path_from_hierarchy - cgroup path of a task on a hierarchy + * task_cgroup_path - cgroup path of a task in the first cgroup hierarchy * @task: target task - * @hierarchy_id: the hierarchy to look up @task's cgroup from * @buf: the buffer to write the path into * @buflen: the length of the buffer * - * Determine @task's cgroup on the hierarchy specified by @hierarchy_id and - * copy its path into @buf. This function grabs cgroup_mutex and shouldn't - * be used inside locks used by cgroup controller callbacks. + * Determine @task's cgroup on the first (the one with the lowest non-zero + * hierarchy_id) cgroup hierarchy and copy its path into @buf. This + * function grabs cgroup_mutex and shouldn't be used inside locks used by + * cgroup controller callbacks. + * + * Returns 0 on success, fails with -%ENAMETOOLONG if @buflen is too short. */ -int task_cgroup_path_from_hierarchy(struct task_struct *task, int hierarchy_id, - char *buf, size_t buflen) +int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen) { struct cgroupfs_root *root; - struct cgroup *cgrp = NULL; - int ret = -ENOENT; + struct cgroup *cgrp; + int hierarchy_id = 1, ret = 0; + + if (buflen < 2) + return -ENAMETOOLONG; mutex_lock(&cgroup_mutex); - root = idr_find(&cgroup_hierarchy_idr, hierarchy_id); + root = idr_get_next(&cgroup_hierarchy_idr, &hierarchy_id); + if (root) { cgrp = task_cgroup_from_root(task, root); ret = cgroup_path(cgrp, buf, buflen); + } else { + /* if no hierarchy exists, everyone is in "/" */ + memcpy(buf, "/", 2); } mutex_unlock(&cgroup_mutex); - return ret; } -EXPORT_SYMBOL_GPL(task_cgroup_path_from_hierarchy); +EXPORT_SYMBOL_GPL(task_cgroup_path); /* * Control Group taskset From bcf53de4e60d9000b82f541d654529e2902a4c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Marchesin?= <marcheu@chromium.org> Date: Fri, 12 Jul 2013 13:54:41 -0700 Subject: [PATCH 089/913] drm/i915: Preserve the DDI_A_4_LANES bit from the bios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise the DDI_A_4_LANES bit gets lost and we can't use > 2 lanes on eDP. This fixes eDP on hsw with > 2 lanes. Also s/port_reversal/saved_port_bits/ since the current name is confusing. Signed-off-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Cc: stable@vger.kernel.org Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/intel_ddi.c | 10 ++++++---- drivers/gpu/drm/i915/intel_drv.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 324211ac9c55..b042ee5c4070 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -301,7 +301,7 @@ static void intel_ddi_mode_set(struct drm_encoder *encoder, struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); - intel_dp->DP = intel_dig_port->port_reversal | + intel_dp->DP = intel_dig_port->saved_port_bits | DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW; intel_dp->DP |= DDI_PORT_WIDTH(intel_dp->lane_count); @@ -1109,7 +1109,8 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder) * enabling the port. */ I915_WRITE(DDI_BUF_CTL(port), - intel_dig_port->port_reversal | DDI_BUF_CTL_ENABLE); + intel_dig_port->saved_port_bits | + DDI_BUF_CTL_ENABLE); } else if (type == INTEL_OUTPUT_EDP) { struct intel_dp *intel_dp = enc_to_intel_dp(encoder); @@ -1347,8 +1348,9 @@ void intel_ddi_init(struct drm_device *dev, enum port port) intel_encoder->get_config = intel_ddi_get_config; intel_dig_port->port = port; - intel_dig_port->port_reversal = I915_READ(DDI_BUF_CTL(port)) & - DDI_BUF_PORT_REVERSAL; + intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) & + (DDI_BUF_PORT_REVERSAL | + DDI_A_4_LANES); intel_dig_port->dp.output_reg = DDI_BUF_CTL(port); intel_encoder->type = INTEL_OUTPUT_UNKNOWN; diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index c8c9b6f48230..b7d6e09456ce 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -504,7 +504,7 @@ struct intel_dp { struct intel_digital_port { struct intel_encoder base; enum port port; - u32 port_reversal; + u32 saved_port_bits; struct intel_dp dp; struct intel_hdmi hdmi; }; From 3a391a39593b48341f0908511590a6c0e55cc069 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Date: Fri, 12 Jul 2013 13:45:59 +0200 Subject: [PATCH 090/913] ACPI / scan: Do not try to attach scan handlers to devices having them In acpi_bus_device_attach(), if there is an ACPI device object for the given handle and that device object has a scan handler attached to it already, there's nothing more to do for that handle. Moreover, if acpi_scan_attach_handler() is called then, it may execute the .attach() callback of the ACPI scan handler already attached to the device object and that may lead to interesting breakage. For this reason, make acpi_bus_device_attach() return success immediately when the handle's device object has a scan handler attached to it. Reported-by: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Toshi Kani <toshi.kani@hp.com> Cc: 3.10+ <stable@vger.kernel.org> --- drivers/acpi/scan.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 10985573aaa7..080d75962c57 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1981,6 +1981,9 @@ static acpi_status acpi_bus_device_attach(acpi_handle handle, u32 lvl_not_used, if (acpi_bus_get_device(handle, &device)) return AE_CTRL_DEPTH; + if (device->handler) + return AE_OK; + ret = acpi_scan_attach_handler(device); if (ret) return ret > 0 ? AE_OK : AE_CTRL_DEPTH; From 8832f7e43fa7f0f19bd54e13766a825dd1ed4d6f Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Date: Mon, 8 Jul 2013 02:01:53 +0200 Subject: [PATCH 091/913] ACPI / scan: Always call acpi_bus_scan() for bus check notifications An ACPI_NOTIFY_BUS_CHECK notification means that we should scan the entire namespace starting from the given handle even if the device represented by that handle is present (other devices below it may just have appeared). For this reason, modify acpi_scan_bus_device_check() to always run acpi_bus_scan() if the notification being handled is of type ACPI_NOTIFY_BUS_CHECK. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Toshi Kani <toshi.kani@hp.com> Cc: 3.10+ <stable@vger.kernel.org> --- drivers/acpi/scan.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 080d75962c57..8a46c924effd 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -352,10 +352,12 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source) mutex_lock(&acpi_scan_lock); lock_device_hotplug(); - acpi_bus_get_device(handle, &device); - if (device) { - dev_warn(&device->dev, "Attempt to re-insert\n"); - goto out; + if (ost_source != ACPI_NOTIFY_BUS_CHECK) { + acpi_bus_get_device(handle, &device); + if (device) { + dev_warn(&device->dev, "Attempt to re-insert\n"); + goto out; + } } acpi_evaluate_hotplug_ost(handle, ost_source, ACPI_OST_SC_INSERT_IN_PROGRESS, NULL); From d19f503e22316a84c39bc19445e0e4fdd49b3532 Mon Sep 17 00:00:00 2001 From: Toshi Kani <toshi.kani@hp.com> Date: Wed, 10 Jul 2013 10:47:13 -0600 Subject: [PATCH 092/913] ACPI / memhotplug: Fix a stale pointer in error path device->driver_data needs to be cleared when releasing its data, mem_device, in an error path of acpi_memory_device_add(). The function evaluates the _CRS of memory device objects, and fails when it gets an unexpected resource or cannot allocate memory. A kernel crash or data corruption may occur when the kernel accesses the stale pointer. Signed-off-by: Toshi Kani <toshi.kani@hp.com> Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Cc: 2.6.32+ <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/acpi_memhotplug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index c711d1144044..999adb5499c7 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -323,6 +323,7 @@ static int acpi_memory_device_add(struct acpi_device *device, /* Get the range from the _CRS */ result = acpi_memory_get_device_resources(mem_device); if (result) { + device->driver_data = NULL; kfree(mem_device); return result; } From aae760ed21cd690fe8a6db9f3a177ad55d7e12ab Mon Sep 17 00:00:00 2001 From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com> Date: Fri, 12 Jul 2013 03:45:37 +0530 Subject: [PATCH 093/913] cpufreq: Revert commit a66b2e to fix suspend/resume regression commit a66b2e (cpufreq: Preserve sysfs files across suspend/resume) has unfortunately caused several things in the cpufreq subsystem to break subtly after a suspend/resume cycle. The intention of that patch was to retain the file permissions of the cpufreq related sysfs files across suspend/resume. To achieve that, the commit completely removed the calls to cpufreq_add_dev() and __cpufreq_remove_dev() during suspend/resume transitions. But the problem is that those functions do 2 kinds of things: 1. Low-level initialization/tear-down that are critical to the correct functioning of cpufreq-core. 2. Kobject and sysfs related initialization/teardown. Ideally we should have reorganized the code to cleanly separate these two responsibilities, and skipped only the sysfs related parts during suspend/resume. Since we skipped the entire callbacks instead (which also included some CPU and cpufreq-specific critical components), cpufreq subsystem started behaving erratically after suspend/resume. So revert the commit to fix the regression. We'll revisit and address the original goal of that commit separately, since it involves quite a bit of careful code reorganization and appears to be non-trivial. (While reverting the commit, note that another commit f51e1eb (cpufreq: Fix cpufreq regression after suspend/resume) already reverted part of the original set of changes. So revert only the remaining ones). Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Tested-by: Paul Bolle <pebolle@tiscali.nl> Cc: 3.10+ <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/cpufreq/cpufreq.c | 4 +++- drivers/cpufreq/cpufreq_stats.c | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 0937b8d6c2a4..7dcfa6854833 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1942,13 +1942,15 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb, if (dev) { switch (action) { case CPU_ONLINE: + case CPU_ONLINE_FROZEN: cpufreq_add_dev(dev, NULL); break; case CPU_DOWN_PREPARE: - case CPU_UP_CANCELED_FROZEN: + case CPU_DOWN_PREPARE_FROZEN: __cpufreq_remove_dev(dev, NULL); break; case CPU_DOWN_FAILED: + case CPU_DOWN_FAILED_FROZEN: cpufreq_add_dev(dev, NULL); break; } diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index cd9e81713a71..12225d19ffcb 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -353,13 +353,11 @@ static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb, cpufreq_update_policy(cpu); break; case CPU_DOWN_PREPARE: + case CPU_DOWN_PREPARE_FROZEN: cpufreq_stats_free_sysfs(cpu); break; case CPU_DEAD: - cpufreq_stats_free_table(cpu); - break; - case CPU_UP_CANCELED_FROZEN: - cpufreq_stats_free_sysfs(cpu); + case CPU_DEAD_FROZEN: cpufreq_stats_free_table(cpu); break; } From e5248a111bf4048a9f3fab1a9c94c4630a10592a Mon Sep 17 00:00:00 2001 From: Liu ShuoX <shuox.liu@intel.com> Date: Thu, 11 Jul 2013 16:03:45 +0800 Subject: [PATCH 094/913] PM / Sleep: avoid 'autosleep' in shutdown progress Prevent automatic system suspend from happening during system shutdown by making try_to_suspend() check system_state and return immediately if it is not SYSTEM_RUNNING. This prevents the following breakage from happening (scenario from Zhang Yanmin): Kernel starts shutdown and calls all device driver's shutdown callback. When a driver's shutdown is called, the last wakelock is released and suspend-to-ram starts. However, as some driver's shut down callbacks already shut down devices and disabled runtime pm, the suspend-to-ram calls driver's suspend callback without noticing that device is already off and causes crash. [rjw: Changelog] Signed-off-by: Liu ShuoX <shuox.liu@intel.com> Cc: 3.5+ <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- kernel/power/autosleep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/power/autosleep.c b/kernel/power/autosleep.c index c6422ffeda9a..9012ecf7b814 100644 --- a/kernel/power/autosleep.c +++ b/kernel/power/autosleep.c @@ -32,7 +32,8 @@ static void try_to_suspend(struct work_struct *work) mutex_lock(&autosleep_lock); - if (!pm_save_wakeup_count(initial_count)) { + if (!pm_save_wakeup_count(initial_count) || + system_state != SYSTEM_RUNNING) { mutex_unlock(&autosleep_lock); goto out; } From 1258ca805f613025ec079d959d4a78acfb1f79d3 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi <cw00.choi@samsung.com> Date: Thu, 11 Jul 2013 13:55:58 +0900 Subject: [PATCH 095/913] PM / Sleep: Fix comment typo in pm_wakeup.h Fix a comment typo (sorce -> source) in pm_wakeup.h. [rjw: Changelog] Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- include/linux/pm_wakeup.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index 569781faa504..a0f70808d7f4 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h @@ -36,8 +36,8 @@ * @last_time: Monotonic clock when the wakeup source's was touched last time. * @prevent_sleep_time: Total time this source has been preventing autosleep. * @event_count: Number of signaled wakeup events. - * @active_count: Number of times the wakeup sorce was activated. - * @relax_count: Number of times the wakeup sorce was deactivated. + * @active_count: Number of times the wakeup source was activated. + * @relax_count: Number of times the wakeup source was deactivated. * @expire_count: Number of times the wakeup source's timeout has expired. * @wakeup_count: Number of times the wakeup source might abort suspend. * @active: Status of the wakeup source. From 4a6c41083df3bf4ad828c45e5f8ee1a224d537c6 Mon Sep 17 00:00:00 2001 From: Paul Bolle <pebolle@tiscali.nl> Date: Sun, 14 Jul 2013 20:29:56 +0200 Subject: [PATCH 096/913] cpufreq: s3c24xx: rename CONFIG_CPU_FREQ_S3C24XX_DEBUGFS The Kconfig symbol CPU_FREQ_S3C24XX_DEBUGFS was renamed to ARM_S3C24XX_CPUFREQ_DEBUGFS in commit f023f8dd59 ("cpufreq: s3c24xx: move cpufreq driver to drivers/cpufreq"). But that commit missed one instance of its macro CONFIG_CPU_FREQ_S3C24XX_DEBUGFS. Rename it too. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/cpufreq/s3c24xx-cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/s3c24xx-cpufreq.c b/drivers/cpufreq/s3c24xx-cpufreq.c index 3513e7477160..87781eb20d6d 100644 --- a/drivers/cpufreq/s3c24xx-cpufreq.c +++ b/drivers/cpufreq/s3c24xx-cpufreq.c @@ -49,7 +49,7 @@ static struct clk *clk_hclk; static struct clk *clk_pclk; static struct clk *clk_arm; -#ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUGFS +#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void) { return &cpu_cur; @@ -59,7 +59,7 @@ struct s3c_iotimings *s3c_cpufreq_getiotimings(void) { return &s3c24xx_iotiming; } -#endif /* CONFIG_CPU_FREQ_S3C24XX_DEBUGFS */ +#endif /* CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS */ static void s3c_cpufreq_getcur(struct s3c_cpufreq_config *cfg) { From f5786b8e934e77f76f689c515baa582ff5a196ec Mon Sep 17 00:00:00 2001 From: Philipp Zabel <p.zabel@pengutronix.de> Date: Fri, 21 Jun 2013 15:36:11 +0200 Subject: [PATCH 097/913] ARM i.MX53: Fix UART pad configuration The current default pad configuration for UART RX and TX pads sets a 360k pull-down and writes 1 to a reserved bit (1 << 0). It doesn't seem right to me that in idle state, the UART has to keep the signal high against a pull-down resistor. This patch instead sets a 100k pull-up, which incidentally corresponds to the register reset value for all but one (MX53_PAD_KEY_ROW0__UART4_RXD_MUX) pad, and removes the write to the reserved bit. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> --- arch/arm/boot/dts/imx53.dtsi | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi index 3895fbba8fce..569aa9f2c4ed 100644 --- a/arch/arm/boot/dts/imx53.dtsi +++ b/arch/arm/boot/dts/imx53.dtsi @@ -725,15 +725,15 @@ uart1 { pinctrl_uart1_1: uart1grp-1 { fsl,pins = < - MX53_PAD_CSI0_DAT10__UART1_TXD_MUX 0x1c5 - MX53_PAD_CSI0_DAT11__UART1_RXD_MUX 0x1c5 + MX53_PAD_CSI0_DAT10__UART1_TXD_MUX 0x1e4 + MX53_PAD_CSI0_DAT11__UART1_RXD_MUX 0x1e4 >; }; pinctrl_uart1_2: uart1grp-2 { fsl,pins = < - MX53_PAD_PATA_DIOW__UART1_TXD_MUX 0x1c5 - MX53_PAD_PATA_DMACK__UART1_RXD_MUX 0x1c5 + MX53_PAD_PATA_DIOW__UART1_TXD_MUX 0x1e4 + MX53_PAD_PATA_DMACK__UART1_RXD_MUX 0x1e4 >; }; @@ -748,8 +748,8 @@ uart2 { pinctrl_uart2_1: uart2grp-1 { fsl,pins = < - MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX 0x1c5 - MX53_PAD_PATA_DMARQ__UART2_TXD_MUX 0x1c5 + MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX 0x1e4 + MX53_PAD_PATA_DMARQ__UART2_TXD_MUX 0x1e4 >; }; @@ -766,17 +766,17 @@ uart3 { pinctrl_uart3_1: uart3grp-1 { fsl,pins = < - MX53_PAD_PATA_CS_0__UART3_TXD_MUX 0x1c5 - MX53_PAD_PATA_CS_1__UART3_RXD_MUX 0x1c5 - MX53_PAD_PATA_DA_1__UART3_CTS 0x1c5 - MX53_PAD_PATA_DA_2__UART3_RTS 0x1c5 + MX53_PAD_PATA_CS_0__UART3_TXD_MUX 0x1e4 + MX53_PAD_PATA_CS_1__UART3_RXD_MUX 0x1e4 + MX53_PAD_PATA_DA_1__UART3_CTS 0x1e4 + MX53_PAD_PATA_DA_2__UART3_RTS 0x1e4 >; }; pinctrl_uart3_2: uart3grp-2 { fsl,pins = < - MX53_PAD_PATA_CS_0__UART3_TXD_MUX 0x1c5 - MX53_PAD_PATA_CS_1__UART3_RXD_MUX 0x1c5 + MX53_PAD_PATA_CS_0__UART3_TXD_MUX 0x1e4 + MX53_PAD_PATA_CS_1__UART3_RXD_MUX 0x1e4 >; }; @@ -785,8 +785,8 @@ uart4 { pinctrl_uart4_1: uart4grp-1 { fsl,pins = < - MX53_PAD_KEY_COL0__UART4_TXD_MUX 0x1c5 - MX53_PAD_KEY_ROW0__UART4_RXD_MUX 0x1c5 + MX53_PAD_KEY_COL0__UART4_TXD_MUX 0x1e4 + MX53_PAD_KEY_ROW0__UART4_RXD_MUX 0x1e4 >; }; }; @@ -794,8 +794,8 @@ uart5 { pinctrl_uart5_1: uart5grp-1 { fsl,pins = < - MX53_PAD_KEY_COL1__UART5_TXD_MUX 0x1c5 - MX53_PAD_KEY_ROW1__UART5_RXD_MUX 0x1c5 + MX53_PAD_KEY_COL1__UART5_TXD_MUX 0x1e4 + MX53_PAD_KEY_ROW1__UART5_RXD_MUX 0x1e4 >; }; }; From bf81e2f1006d10694bcb62c1a001f3a786b902ac Mon Sep 17 00:00:00 2001 From: Markus Pargmann <mpa@pengutronix.de> Date: Sun, 23 Jun 2013 10:51:10 +0200 Subject: [PATCH 098/913] ARM: imx27: Fix documentation for SPLL clock spll_gate was added with commit b7eed2076183994dbda2c19bc7fba99b65a135e3 "ARM: imx27: add a clock gate to activate SPLL clock". spll_gate is missing in the devicetree clock documentation for imx27. This patch adds it to the list of clocks in the documentation. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> --- Documentation/devicetree/bindings/clock/imx27-clock.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/clock/imx27-clock.txt b/Documentation/devicetree/bindings/clock/imx27-clock.txt index ab1a56e9de9d..7a2070393732 100644 --- a/Documentation/devicetree/bindings/clock/imx27-clock.txt +++ b/Documentation/devicetree/bindings/clock/imx27-clock.txt @@ -98,6 +98,7 @@ clocks and IDs. fpm 83 mpll_osc_sel 84 mpll_sel 85 + spll_gate 86 Examples: From 0d5ca6d973b54f76eaccf86116dd0c66b073afc5 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan <shc_work@mail.ru> Date: Sun, 23 Jun 2013 17:40:35 +0400 Subject: [PATCH 099/913] ARM: i.MX27: Typo fix Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> --- arch/arm/mach-imx/mx27.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/mx27.h b/arch/arm/mach-imx/mx27.h index e074616d54ca..8a65f192e7f3 100644 --- a/arch/arm/mach-imx/mx27.h +++ b/arch/arm/mach-imx/mx27.h @@ -135,7 +135,7 @@ #define MX27_INT_GPT4 (NR_IRQS_LEGACY + 4) #define MX27_INT_RTIC (NR_IRQS_LEGACY + 5) #define MX27_INT_CSPI3 (NR_IRQS_LEGACY + 6) -#define MX27_INT_SDHC (NR_IRQS_LEGACY + 7) +#define MX27_INT_MSHC (NR_IRQS_LEGACY + 7) #define MX27_INT_GPIO (NR_IRQS_LEGACY + 8) #define MX27_INT_SDHC3 (NR_IRQS_LEGACY + 9) #define MX27_INT_SDHC2 (NR_IRQS_LEGACY + 10) From ceac9b9214df539ca814a784c2af94f554bc78d4 Mon Sep 17 00:00:00 2001 From: Philipp Zabel <p.zabel@pengutronix.de> Date: Wed, 26 Jun 2013 15:08:48 +0200 Subject: [PATCH 100/913] ARM i.MX6Q: Fix IOMUXC GPR1 defines for ENET_CLK_SEL and IPU1/2_MUX Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> --- include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h index dab34a1deb2c..b1521e82fecf 100644 --- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h +++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h @@ -103,15 +103,15 @@ #define IMX6Q_GPR1_EXC_MON_MASK BIT(22) #define IMX6Q_GPR1_EXC_MON_OKAY 0x0 #define IMX6Q_GPR1_EXC_MON_SLVE BIT(22) -#define IMX6Q_GPR1_MIPI_IPU2_SEL_MASK BIT(21) -#define IMX6Q_GPR1_MIPI_IPU2_SEL_GASKET 0x0 -#define IMX6Q_GPR1_MIPI_IPU2_SEL_IOMUX BIT(21) -#define IMX6Q_GPR1_MIPI_IPU1_MUX_MASK BIT(20) -#define IMX6Q_GPR1_MIPI_IPU1_MUX_GASKET 0x0 -#define IMX6Q_GPR1_MIPI_IPU1_MUX_IOMUX BIT(20) -#define IMX6Q_GPR1_MIPI_IPU2_MUX_MASK BIT(19) +#define IMX6Q_GPR1_ENET_CLK_SEL_MASK BIT(21) +#define IMX6Q_GPR1_ENET_CLK_SEL_PAD 0 +#define IMX6Q_GPR1_ENET_CLK_SEL_ANATOP BIT(21) +#define IMX6Q_GPR1_MIPI_IPU2_MUX_MASK BIT(20) #define IMX6Q_GPR1_MIPI_IPU2_MUX_GASKET 0x0 -#define IMX6Q_GPR1_MIPI_IPU2_MUX_IOMUX BIT(19) +#define IMX6Q_GPR1_MIPI_IPU2_MUX_IOMUX BIT(20) +#define IMX6Q_GPR1_MIPI_IPU1_MUX_MASK BIT(19) +#define IMX6Q_GPR1_MIPI_IPU1_MUX_GASKET 0x0 +#define IMX6Q_GPR1_MIPI_IPU1_MUX_IOMUX BIT(19) #define IMX6Q_GPR1_PCIE_TEST_PD BIT(18) #define IMX6Q_GPR1_IPU_VPU_MUX_MASK BIT(17) #define IMX6Q_GPR1_IPU_VPU_MUX_IPU1 0x0 From 3b79cd15bfc5f1ddb5e387310fa3dbb09b81b552 Mon Sep 17 00:00:00 2001 From: Liu Ying <Ying.Liu@freescale.com> Date: Wed, 3 Jul 2013 15:29:06 +0800 Subject: [PATCH 101/913] ARM: i.MX6Q: correct emi_sel clock muxing The correct muxing for emi_sel clock should be 2b'00 - 396M PFD 2b'01 - PLL3 2b'10 - AXI clk root 2b'11 - 352M PFD This patch corrects the muxing in the clock driver. Signed-off-by: Liu Ying <Ying.Liu@freescale.com> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Dirk Behme <dirk.behme@de.bosch.com> --- arch/arm/mach-imx/clk-imx6q.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c index 4282e99f5ca1..86567d980b07 100644 --- a/arch/arm/mach-imx/clk-imx6q.c +++ b/arch/arm/mach-imx/clk-imx6q.c @@ -199,7 +199,8 @@ static const char *pcie_axi_sels[] = { "axi", "ahb", }; static const char *ssi_sels[] = { "pll3_pfd2_508m", "pll3_pfd3_454m", "pll4_post_div", }; static const char *usdhc_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", }; static const char *enfc_sels[] = { "pll2_pfd0_352m", "pll2_bus", "pll3_usb_otg", "pll2_pfd2_396m", }; -static const char *emi_sels[] = { "axi", "pll3_usb_otg", "pll2_pfd2_396m", "pll2_pfd0_352m", }; +static const char *emi_sels[] = { "pll2_pfd2_396m", "pll3_usb_otg", "axi", "pll2_pfd0_352m", }; +static const char *emi_slow_sels[] = { "axi", "pll3_usb_otg", "pll2_pfd2_396m", "pll2_pfd0_352m", }; static const char *vdo_axi_sels[] = { "axi", "ahb", }; static const char *vpu_axi_sels[] = { "axi", "pll2_pfd2_396m", "pll2_pfd0_352m", }; static const char *cko1_sels[] = { "pll3_usb_otg", "pll2_bus", "pll1_sys", "pll5_video_div", @@ -392,7 +393,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) clk[usdhc4_sel] = imx_clk_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); clk[enfc_sel] = imx_clk_mux("enfc_sel", base + 0x2c, 16, 2, enfc_sels, ARRAY_SIZE(enfc_sels)); clk[emi_sel] = imx_clk_mux("emi_sel", base + 0x1c, 27, 2, emi_sels, ARRAY_SIZE(emi_sels)); - clk[emi_slow_sel] = imx_clk_mux("emi_slow_sel", base + 0x1c, 29, 2, emi_sels, ARRAY_SIZE(emi_sels)); + clk[emi_slow_sel] = imx_clk_mux("emi_slow_sel", base + 0x1c, 29, 2, emi_slow_sels, ARRAY_SIZE(emi_slow_sels)); clk[vdo_axi_sel] = imx_clk_mux("vdo_axi_sel", base + 0x18, 11, 1, vdo_axi_sels, ARRAY_SIZE(vdo_axi_sels)); clk[vpu_axi_sel] = imx_clk_mux("vpu_axi_sel", base + 0x18, 14, 2, vpu_axi_sels, ARRAY_SIZE(vpu_axi_sels)); clk[cko1_sel] = imx_clk_mux("cko1_sel", base + 0x60, 0, 4, cko1_sels, ARRAY_SIZE(cko1_sels)); From 66acaf3f897c9245f5456d884e5ae401700cbc45 Mon Sep 17 00:00:00 2001 From: Shawn Guo <shawn.guo@linaro.org> Date: Mon, 1 Jul 2013 15:46:05 +0800 Subject: [PATCH 102/913] ARM: mxs: saif0 is the clock provider to sgtl5000 These systems all use saif0 as the mclock provider to codec sgtl5000. Reflect that in device tree source, so that sgtl5000 can find the clock by calling clk_get(). Signed-off-by: Shawn Guo <shawn.guo@linaro.org> --- arch/arm/boot/dts/imx28-apx4devkit.dts | 2 +- arch/arm/boot/dts/imx28-evk.dts | 2 +- arch/arm/boot/dts/imx28-m28evk.dts | 2 +- arch/arm/boot/dts/imx28.dtsi | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/imx28-apx4devkit.dts b/arch/arm/boot/dts/imx28-apx4devkit.dts index 43bf3c796cba..0e7fed47bd8d 100644 --- a/arch/arm/boot/dts/imx28-apx4devkit.dts +++ b/arch/arm/boot/dts/imx28-apx4devkit.dts @@ -147,7 +147,7 @@ reg = <0x0a>; VDDA-supply = <®_3p3v>; VDDIO-supply = <®_3p3v>; - + clocks = <&saif0>; }; pcf8563: rtc@51 { diff --git a/arch/arm/boot/dts/imx28-evk.dts b/arch/arm/boot/dts/imx28-evk.dts index 1f0d38d7b16f..e035f4664b97 100644 --- a/arch/arm/boot/dts/imx28-evk.dts +++ b/arch/arm/boot/dts/imx28-evk.dts @@ -195,7 +195,7 @@ reg = <0x0a>; VDDA-supply = <®_3p3v>; VDDIO-supply = <®_3p3v>; - + clocks = <&saif0>; }; at24@51 { diff --git a/arch/arm/boot/dts/imx28-m28evk.dts b/arch/arm/boot/dts/imx28-m28evk.dts index 880df2f13be8..44d9da57736e 100644 --- a/arch/arm/boot/dts/imx28-m28evk.dts +++ b/arch/arm/boot/dts/imx28-m28evk.dts @@ -184,7 +184,7 @@ reg = <0x0a>; VDDA-supply = <®_3p3v>; VDDIO-supply = <®_3p3v>; - + clocks = <&saif0>; }; eeprom: eeprom@51 { diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi index 6a8acb01b1d3..9524a0571281 100644 --- a/arch/arm/boot/dts/imx28.dtsi +++ b/arch/arm/boot/dts/imx28.dtsi @@ -837,6 +837,7 @@ compatible = "fsl,imx28-saif"; reg = <0x80042000 0x2000>; interrupts = <59 80>; + #clock-cells = <0>; clocks = <&clks 53>; dmas = <&dma_apbx 4>; dma-names = "rx-tx"; From 4f71612ee3a1b2d15c8246d926a40c4f7d21cc3b Mon Sep 17 00:00:00 2001 From: Shawn Guo <shawn.guo@linaro.org> Date: Wed, 10 Jul 2013 14:05:44 +0800 Subject: [PATCH 103/913] ARM: imx: fix vf610 enet module clock selection The fec/enet driver calculates MDC rate with the formula below. ref_freq / ((MII_SPEED + 1) x 2) The ref_freq here is the fec internal module clock, which is missing from clk-vf610 clock driver right now. And clk-vf610 driver mistakenly supplies RMII clock (50 MHz) as the source to fec. This results in the situation that fec driver gets ref_freq as 50 MHz, while physically it runs at 66 MHz (fec module clock physically sources from ipg which runs at 66 MHz). That's why software expects MDC runs at 2.5 MHz, while the measurement tells it runs at 3.3 MHz. And this causes the PHY KSZ8041 keeps swithing between Full and Half mode as below. libphy: 400d0000.etherne:00 - Link is Up - 100/Full libphy: 400d0000.etherne:00 - Link is Up - 100/Half libphy: 400d0000.etherne:00 - Link is Up - 100/Full libphy: 400d0000.etherne:00 - Link is Up - 100/Half libphy: 400d0000.etherne:00 - Link is Up - 100/Full libphy: 400d0000.etherne:00 - Link is Up - 100/Half Add the missing module clock for ENET0 and ENET1, and correct the clock supplying in device tree to fix above issue. Thanks to Alison Wang <b18965@freescale.com> for debugging the issue. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> --- arch/arm/boot/dts/vf610.dtsi | 8 ++++---- arch/arm/mach-imx/clk-vf610.c | 2 ++ include/dt-bindings/clock/vf610-clock.h | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi index e1eb7dadda80..67d929cf9804 100644 --- a/arch/arm/boot/dts/vf610.dtsi +++ b/arch/arm/boot/dts/vf610.dtsi @@ -442,8 +442,8 @@ compatible = "fsl,mvf600-fec"; reg = <0x400d0000 0x1000>; interrupts = <0 78 0x04>; - clocks = <&clks VF610_CLK_ENET>, - <&clks VF610_CLK_ENET>, + clocks = <&clks VF610_CLK_ENET0>, + <&clks VF610_CLK_ENET0>, <&clks VF610_CLK_ENET>; clock-names = "ipg", "ahb", "ptp"; status = "disabled"; @@ -453,8 +453,8 @@ compatible = "fsl,mvf600-fec"; reg = <0x400d1000 0x1000>; interrupts = <0 79 0x04>; - clocks = <&clks VF610_CLK_ENET>, - <&clks VF610_CLK_ENET>, + clocks = <&clks VF610_CLK_ENET1>, + <&clks VF610_CLK_ENET1>, <&clks VF610_CLK_ENET>; clock-names = "ipg", "ahb", "ptp"; status = "disabled"; diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c index d617c0b7c809..b169a396d93b 100644 --- a/arch/arm/mach-imx/clk-vf610.c +++ b/arch/arm/mach-imx/clk-vf610.c @@ -183,6 +183,8 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) clk[VF610_CLK_ENET_TS_SEL] = imx_clk_mux("enet_ts_sel", CCM_CSCMR2, 0, 3, enet_ts_sels, 7); clk[VF610_CLK_ENET] = imx_clk_gate("enet", "enet_sel", CCM_CSCDR1, 24); clk[VF610_CLK_ENET_TS] = imx_clk_gate("enet_ts", "enet_ts_sel", CCM_CSCDR1, 23); + clk[VF610_CLK_ENET0] = imx_clk_gate2("enet0", "ipg_bus", CCM_CCGR9, CCM_CCGRx_CGn(0)); + clk[VF610_CLK_ENET1] = imx_clk_gate2("enet1", "ipg_bus", CCM_CCGR9, CCM_CCGRx_CGn(1)); clk[VF610_CLK_PIT] = imx_clk_gate2("pit", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(7)); diff --git a/include/dt-bindings/clock/vf610-clock.h b/include/dt-bindings/clock/vf610-clock.h index 15e997fa78f2..4aa2b48cd151 100644 --- a/include/dt-bindings/clock/vf610-clock.h +++ b/include/dt-bindings/clock/vf610-clock.h @@ -158,6 +158,8 @@ #define VF610_CLK_GPU_SEL 145 #define VF610_CLK_GPU_EN 146 #define VF610_CLK_GPU2D 147 -#define VF610_CLK_END 148 +#define VF610_CLK_ENET0 148 +#define VF610_CLK_ENET1 149 +#define VF610_CLK_END 150 #endif /* __DT_BINDINGS_CLOCK_VF610_H */ From 15968f1bd4341cfa54023348a4e0b94798211742 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Date: Thu, 11 Jul 2013 16:37:47 +0200 Subject: [PATCH 104/913] ARM i.MX53: mba53: Fix PWM backlight DT node The i.MX53 PWM controller uses two cells to describe the PWM specifier. Remove the extra unused values from the backlight DT node pwms property. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> --- arch/arm/boot/dts/imx53-mba53.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx53-mba53.dts b/arch/arm/boot/dts/imx53-mba53.dts index aaa33bc99f78..a63090267941 100644 --- a/arch/arm/boot/dts/imx53-mba53.dts +++ b/arch/arm/boot/dts/imx53-mba53.dts @@ -27,7 +27,7 @@ backlight { compatible = "pwm-backlight"; - pwms = <&pwm2 0 50000 0 0>; + pwms = <&pwm2 0 50000>; brightness-levels = <0 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100>; default-brightness-level = <10>; enable-gpios = <&gpio7 7 0>; From 8acd5e9b1217e58a57124d9e225afa12efeae20d Mon Sep 17 00:00:00 2001 From: Theodore Ts'o <tytso@mit.edu> Date: Mon, 15 Jul 2013 00:09:19 -0400 Subject: [PATCH 105/913] ext4: fix error handling in ext4_ext_truncate() Previously ext4_ext_truncate() was ignoring potential error returns from ext4_es_remove_extent() and ext4_ext_remove_space(). This can lead to the on-diks extent tree and the extent status tree cache getting out of sync, which is particuarlly bad, and can lead to file system corruption and potential data loss. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: stable@vger.kernel.org --- fs/ext4/extents.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 7097b0f680e6..f57cc0e7f1bc 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4405,9 +4405,20 @@ void ext4_ext_truncate(handle_t *handle, struct inode *inode) last_block = (inode->i_size + sb->s_blocksize - 1) >> EXT4_BLOCK_SIZE_BITS(sb); +retry: err = ext4_es_remove_extent(inode, last_block, EXT_MAX_BLOCKS - last_block); + if (err == ENOMEM) { + cond_resched(); + congestion_wait(BLK_RW_ASYNC, HZ/50); + goto retry; + } + if (err) { + ext4_std_error(inode->i_sb, err); + return; + } err = ext4_ext_remove_space(inode, last_block, EXT_MAX_BLOCKS - 1); + ext4_std_error(inode->i_sb, err); } static void ext4_falloc_update_inode(struct inode *inode, From c8e15130e1636f68d5165aa2605b8e9cba0f644c Mon Sep 17 00:00:00 2001 From: Theodore Ts'o <tytso@mit.edu> Date: Mon, 15 Jul 2013 00:09:37 -0400 Subject: [PATCH 106/913] ext4: simplify calculation of blocks to free on error In ext4_ext_map_blocks(), if we have successfully allocated the data blocks, but then run into trouble inserting the extent into the extent tree, most likely due to an ENOSPC condition, determine the arguments to ext4_free_blocks() in a simpler way which is easier to prove to be correct. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> --- fs/ext4/extents.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index f57cc0e7f1bc..593091537e76 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4261,8 +4261,8 @@ got_allocated_blocks: /* not a good idea to call discard here directly, * but otherwise we'd need to call it every free() */ ext4_discard_preallocations(inode); - ext4_free_blocks(handle, inode, NULL, ext4_ext_pblock(&newex), - ext4_ext_get_actual_len(&newex), fb_flags); + ext4_free_blocks(handle, inode, NULL, newblock, + EXT4_C2B(sbi, allocated_clusters), fb_flags); goto out2; } From e15f742ce816076497549b955fbec3254820db85 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o <tytso@mit.edu> Date: Mon, 15 Jul 2013 00:12:14 -0400 Subject: [PATCH 107/913] ext4: make the extent_status code more robust against ENOMEM failures Some callers of ext4_es_remove_extent() and ext4_es_insert_extent() may not be completely robust against ENOMEM failures (or the consequences of reflecting ENOMEM back up to userspace may lead to xfstest or user application failure). To mitigate against this, when trying to insert an entry in the extent status tree, try to shrink the inode's extent status tree before returning ENOMEM. If there are entries which don't record information about extents under delayed allocations, freeing one of them is preferable to returning ENOMEM. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Reviewed-by: Zheng Liu <wenqing.lz@taobao.com> --- fs/ext4/extents_status.c | 51 ++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c index 4b8df7fbb10a..91cb110da1b4 100644 --- a/fs/ext4/extents_status.c +++ b/fs/ext4/extents_status.c @@ -148,6 +148,8 @@ static int __es_remove_extent(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t end); static int __es_try_to_reclaim_extents(struct ext4_inode_info *ei, int nr_to_scan); +static int __ext4_es_shrink(struct ext4_sb_info *sbi, int nr_to_scan, + struct ext4_inode_info *locked_ei); int __init ext4_init_es(void) { @@ -665,7 +667,13 @@ int ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk, err = __es_remove_extent(inode, lblk, end); if (err != 0) goto error; +retry: err = __es_insert_extent(inode, &newes); + if (err == -ENOMEM && __ext4_es_shrink(EXT4_SB(inode->i_sb), 1, + EXT4_I(inode))) + goto retry; + if (err == -ENOMEM && !ext4_es_is_delayed(&newes)) + err = 0; error: write_unlock(&EXT4_I(inode)->i_es_lock); @@ -744,8 +752,10 @@ static int __es_remove_extent(struct inode *inode, ext4_lblk_t lblk, struct extent_status orig_es; ext4_lblk_t len1, len2; ext4_fsblk_t block; - int err = 0; + int err; +retry: + err = 0; es = __es_tree_search(&tree->root, lblk); if (!es) goto out; @@ -780,6 +790,10 @@ static int __es_remove_extent(struct inode *inode, ext4_lblk_t lblk, if (err) { es->es_lblk = orig_es.es_lblk; es->es_len = orig_es.es_len; + if ((err == -ENOMEM) && + __ext4_es_shrink(EXT4_SB(inode->i_sb), 1, + EXT4_I(inode))) + goto retry; goto out; } } else { @@ -889,22 +903,14 @@ static int ext4_inode_touch_time_cmp(void *priv, struct list_head *a, return -1; } -static int ext4_es_shrink(struct shrinker *shrink, struct shrink_control *sc) +static int __ext4_es_shrink(struct ext4_sb_info *sbi, int nr_to_scan, + struct ext4_inode_info *locked_ei) { - struct ext4_sb_info *sbi = container_of(shrink, - struct ext4_sb_info, s_es_shrinker); struct ext4_inode_info *ei; struct list_head *cur, *tmp; LIST_HEAD(skiped); - int nr_to_scan = sc->nr_to_scan; int ret, nr_shrunk = 0; - ret = percpu_counter_read_positive(&sbi->s_extent_cache_cnt); - trace_ext4_es_shrink_enter(sbi->s_sb, nr_to_scan, ret); - - if (!nr_to_scan) - return ret; - spin_lock(&sbi->s_es_lru_lock); /* @@ -933,7 +939,7 @@ static int ext4_es_shrink(struct shrinker *shrink, struct shrink_control *sc) continue; } - if (ei->i_es_lru_nr == 0) + if (ei->i_es_lru_nr == 0 || ei == locked_ei) continue; write_lock(&ei->i_es_lock); @@ -952,6 +958,27 @@ static int ext4_es_shrink(struct shrinker *shrink, struct shrink_control *sc) list_splice_tail(&skiped, &sbi->s_es_lru); spin_unlock(&sbi->s_es_lru_lock); + if (locked_ei && nr_shrunk == 0) + nr_shrunk = __es_try_to_reclaim_extents(ei, nr_to_scan); + + return nr_shrunk; +} + +static int ext4_es_shrink(struct shrinker *shrink, struct shrink_control *sc) +{ + struct ext4_sb_info *sbi = container_of(shrink, + struct ext4_sb_info, s_es_shrinker); + int nr_to_scan = sc->nr_to_scan; + int ret, nr_shrunk; + + ret = percpu_counter_read_positive(&sbi->s_extent_cache_cnt); + trace_ext4_es_shrink_enter(sbi->s_sb, nr_to_scan, ret); + + if (!nr_to_scan) + return ret; + + nr_shrunk = __ext4_es_shrink(sbi, nr_to_scan, NULL); + ret = percpu_counter_read_positive(&sbi->s_extent_cache_cnt); trace_ext4_es_shrink_exit(sbi->s_sb, nr_shrunk, ret); return ret; From ae7cc03e435fe86d95a3fbef52161dbd9f97db77 Mon Sep 17 00:00:00 2001 From: Tony Lindgren <tony@atomide.com> Date: Mon, 15 Jul 2013 00:39:41 -0700 Subject: [PATCH 108/913] ARM: multi_v7: Enabled omap4430 sdp nfsroot By adding support for OCP2SCP, SPI and KS8851 I can also boot test multi_v7_defconfig easily. Note that if using an older u-boot, CONFIG_ARM_ATAG_DTB_COMPAT=y may also be needed for the appended DTB based booting. Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com> --- arch/arm/configs/multi_v7_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index fe0bdc361d2c..120b08edb9a9 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -53,6 +53,7 @@ CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y +CONFIG_OMAP_OCP2SCP=y CONFIG_BLK_DEV_SD=y CONFIG_ATA=y CONFIG_SATA_AHCI_PLATFORM=y @@ -61,6 +62,7 @@ CONFIG_SATA_MV=y CONFIG_NETDEVICES=y CONFIG_SUN4I_EMAC=y CONFIG_NET_CALXEDA_XGMAC=y +CONFIG_KS8851=y CONFIG_SMSC911X=y CONFIG_STMMAC_ETH=y CONFIG_MDIO_SUN4I=y @@ -89,6 +91,7 @@ CONFIG_I2C_DESIGNWARE_PLATFORM=y CONFIG_I2C_SIRF=y CONFIG_I2C_TEGRA=y CONFIG_SPI=y +CONFIG_SPI_OMAP24XX=y CONFIG_SPI_PL022=y CONFIG_SPI_SIRF=y CONFIG_SPI_TEGRA114=y From 13782a7e2821f62efc747fd26605de4dc823ee29 Mon Sep 17 00:00:00 2001 From: Tony Lindgren <tony@atomide.com> Date: Fri, 7 Jun 2013 15:01:58 -0700 Subject: [PATCH 109/913] ARM: dts: Add missing vmmc2 regulator for twl For some reason vmmc2 regulator is missing for twl. Let's add it. Signed-off-by: Tony Lindgren <tony@atomide.com> --- arch/arm/boot/dts/twl4030.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi index b3034da00a37..ae6a17aed9ee 100644 --- a/arch/arm/boot/dts/twl4030.dtsi +++ b/arch/arm/boot/dts/twl4030.dtsi @@ -47,6 +47,12 @@ regulator-max-microvolt = <3150000>; }; + vmmc2: regulator-vmmc2 { + compatible = "ti,twl4030-vmmc2"; + regulator-min-microvolt = <1850000>; + regulator-max-microvolt = <3150000>; + }; + vusb1v5: regulator-vusb1v5 { compatible = "ti,twl4030-vusb1v5"; }; From f3ed0a17f0292300b3caca32d823ecd32554a667 Mon Sep 17 00:00:00 2001 From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Date: Thu, 11 Jul 2013 09:50:30 -0700 Subject: [PATCH 110/913] Thermal: x86 package temp thermal crash On systems with no package MSR support this caused crash as there is a bug in the logic to check presence of DTHERM and PTS feature together. Added a change so that when there is no PTS support, module doesn't get loaded. Even if some CPU comes online with the PTS feature disabled, and other CPUs has this support, this patch will still prevent such MSR accesses. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reported-by: Daniel Walker <dwalker@fifo99.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> --- drivers/thermal/x86_pkg_temp_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c index 5de56f671a9d..034604c021d6 100644 --- a/drivers/thermal/x86_pkg_temp_thermal.c +++ b/drivers/thermal/x86_pkg_temp_thermal.c @@ -511,7 +511,7 @@ static int get_core_online(unsigned int cpu) /* Check if there is already an instance for this package */ if (!phdev) { - if (!cpu_has(c, X86_FEATURE_DTHERM) && + if (!cpu_has(c, X86_FEATURE_DTHERM) || !cpu_has(c, X86_FEATURE_PTS)) return -ENODEV; if (pkg_temp_thermal_device_add(cpu)) @@ -562,7 +562,7 @@ static struct notifier_block pkg_temp_thermal_notifier __refdata = { }; static const struct x86_cpu_id __initconst pkg_temp_thermal_ids[] = { - { X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_DTHERM }, + { X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_PTS }, {} }; MODULE_DEVICE_TABLE(x86cpu, pkg_temp_thermal_ids); From c7c1b3112e643d290471abd0f3b27ffeec6f28dd Mon Sep 17 00:00:00 2001 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Tue, 18 Jun 2013 21:09:12 +0800 Subject: [PATCH 111/913] Thermal: x86_pkg_temp: fix krealloc() misuse in in pkg_temp_thermal_device_add() If krealloc() returns NULL, it doesn't free the original. So any code of the form 'foo = krealloc(foo, ...);' is almost certainly a bug. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Zhang Rui <rui.zhang@intel.com> --- drivers/thermal/x86_pkg_temp_thermal.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c index 034604c021d6..cf172d50b5d3 100644 --- a/drivers/thermal/x86_pkg_temp_thermal.c +++ b/drivers/thermal/x86_pkg_temp_thermal.c @@ -394,6 +394,7 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) char buffer[30]; int thres_count; u32 eax, ebx, ecx, edx; + u8 *temp; cpuid(6, &eax, &ebx, &ecx, &edx); thres_count = ebx & 0x07; @@ -417,13 +418,14 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) spin_lock(&pkg_work_lock); if (topology_physical_package_id(cpu) > max_phy_id) max_phy_id = topology_physical_package_id(cpu); - pkg_work_scheduled = krealloc(pkg_work_scheduled, - (max_phy_id+1) * sizeof(u8), GFP_ATOMIC); - if (!pkg_work_scheduled) { + temp = krealloc(pkg_work_scheduled, + (max_phy_id+1) * sizeof(u8), GFP_ATOMIC); + if (!temp) { spin_unlock(&pkg_work_lock); err = -ENOMEM; goto err_ret_free; } + pkg_work_scheduled = temp; pkg_work_scheduled[topology_physical_package_id(cpu)] = 0; spin_unlock(&pkg_work_lock); From f09eca8db0184aeb6b9718a987cfb3653ad7c4ae Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso <pablo@netfilter.org> Date: Tue, 9 Jul 2013 20:16:39 +0200 Subject: [PATCH 112/913] netfilter: ctnetlink: fix incorrect NAT expectation dumping nf_ct_expect_alloc leaves unset the expectation NAT fields. However, ctnetlink_exp_dump_expect expects them to be zeroed in case they are not used, which may not be the case. This results in dumping the NAT tuple of the expectation when it should not. Fix it by zeroing the NAT fields of the expectation. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> --- net/netfilter/nf_conntrack_expect.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c index c63b618cd619..4fd1ca94fd4a 100644 --- a/net/netfilter/nf_conntrack_expect.c +++ b/net/netfilter/nf_conntrack_expect.c @@ -293,6 +293,11 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class, sizeof(exp->tuple.dst.u3) - len); exp->tuple.dst.u.all = *dst; + +#ifdef CONFIG_NF_NAT_NEEDED + memset(&exp->saved_addr, 0, sizeof(exp->saved_addr)); + memset(&exp->saved_proto, 0, sizeof(exp->saved_proto)); +#endif } EXPORT_SYMBOL_GPL(nf_ct_expect_init); From baf60efa585c78b269f0097288868a51ccc61f55 Mon Sep 17 00:00:00 2001 From: Eric Dumazet <edumazet@google.com> Date: Thu, 11 Jul 2013 19:22:19 -0700 Subject: [PATCH 113/913] netfilter: xt_socket: fix broken v0 support commit 681f130f39e10 ("netfilter: xt_socket: add XT_SOCKET_NOWILDCARD flag") added a potential NULL dereference if an old iptables package uses v0 of the match. Fix this by removing the test on @info in fast path. IPv6 can remove the test as well, as it uses v1 or v2. Reported-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Patrick McHardy <kaber@trash.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> --- net/netfilter/xt_socket.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c index f8b71911037a..20b15916f403 100644 --- a/net/netfilter/xt_socket.c +++ b/net/netfilter/xt_socket.c @@ -172,7 +172,7 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par, /* Ignore non-transparent sockets, if XT_SOCKET_TRANSPARENT is used */ - if (info && info->flags & XT_SOCKET_TRANSPARENT) + if (info->flags & XT_SOCKET_TRANSPARENT) transparent = ((sk->sk_state != TCP_TIME_WAIT && inet_sk(sk)->transparent) || (sk->sk_state == TCP_TIME_WAIT && @@ -196,7 +196,11 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par, static bool socket_mt4_v0(const struct sk_buff *skb, struct xt_action_param *par) { - return socket_match(skb, par, NULL); + static struct xt_socket_mtinfo1 xt_info_v0 = { + .flags = 0, + }; + + return socket_match(skb, par, &xt_info_v0); } static bool @@ -314,7 +318,7 @@ socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par) /* Ignore non-transparent sockets, if XT_SOCKET_TRANSPARENT is used */ - if (info && info->flags & XT_SOCKET_TRANSPARENT) + if (info->flags & XT_SOCKET_TRANSPARENT) transparent = ((sk->sk_state != TCP_TIME_WAIT && inet_sk(sk)->transparent) || (sk->sk_state == TCP_TIME_WAIT && From cdcedd6981194e511cc206887db661d016069d68 Mon Sep 17 00:00:00 2001 From: Felipe Balbi <balbi@ti.com> Date: Mon, 15 Jul 2013 12:36:35 +0300 Subject: [PATCH 114/913] usb: dwc3: gadget: don't prevent gadget from being probed if we fail In case we fail our ->udc_start() callback, we should be ready to accept another modprobe following the failed one. We had forgotten to clear dwc->gadget_driver back to NULL and, because of that, we were preventing gadget driver modprobe from being retried. Cc: <stable@vger.kernel.org> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/dwc3/gadget.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index b5e5b35df49c..f77083fedc68 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1584,6 +1584,7 @@ err1: __dwc3_gadget_ep_disable(dwc->eps[0]); err0: + dwc->gadget_driver = NULL; spin_unlock_irqrestore(&dwc->lock, flags); return ret; From ae40d64b1f2db93d7b092e6425a2f716289fbd09 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann <arnd@arndb.de> Date: Wed, 19 Jun 2013 13:27:27 +0200 Subject: [PATCH 115/913] usb: gadget: at91_udc: call at91udc_of_init only when needed This avoids a build error in at91sam9261_9g10_defconfig: drivers/usb/gadget/at91_udc.c: In function 'at91udc_probe': drivers/usb/gadget/at91_udc.c:1685:34: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized] board->vbus_active_low = (flags & OF_GPIO_ACTIVE_LOW) ? 1 : 0; ^ drivers/usb/gadget/at91_udc.c:1678:21: note: 'flags' was declared here enum of_gpio_flags flags; ^ Making the call to at91udc_of_init conditinal also reduces the object code size without sacrificing build coverage. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Felipe Balbi <balbi@ti.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/at91_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 073b938f9135..2cbab1c9ff58 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -1725,7 +1725,7 @@ static int at91udc_probe(struct platform_device *pdev) /* init software state */ udc = &controller; udc->gadget.dev.parent = dev; - if (pdev->dev.of_node) + if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) at91udc_of_init(udc, pdev->dev.of_node); else memcpy(&udc->board, dev->platform_data, From 88ae742347831c47846ca7343e786abd6635752b Mon Sep 17 00:00:00 2001 From: Yuan-Hsin Chen <yhchen@faraday-tech.com> Date: Fri, 21 Jun 2013 14:50:47 +0000 Subject: [PATCH 116/913] usb: gadget: fotg210-udc: remove __init and __exit Remove __init and __exit from probe() and remove() and would also fix the section mismatch issue. Signed-off-by: Yuan-Hsin Chen <yhchen@faraday-tech.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/fotg210-udc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/fotg210-udc.c b/drivers/usb/gadget/fotg210-udc.c index cce5535b1dc6..10cd18ddd0d4 100644 --- a/drivers/usb/gadget/fotg210-udc.c +++ b/drivers/usb/gadget/fotg210-udc.c @@ -1074,7 +1074,7 @@ static struct usb_gadget_ops fotg210_gadget_ops = { .udc_stop = fotg210_udc_stop, }; -static int __exit fotg210_udc_remove(struct platform_device *pdev) +static int fotg210_udc_remove(struct platform_device *pdev) { struct fotg210_udc *fotg210 = dev_get_drvdata(&pdev->dev); @@ -1088,7 +1088,7 @@ static int __exit fotg210_udc_remove(struct platform_device *pdev) return 0; } -static int __init fotg210_udc_probe(struct platform_device *pdev) +static int fotg210_udc_probe(struct platform_device *pdev) { struct resource *res, *ires; struct fotg210_udc *fotg210 = NULL; From 7628083227b6bc4a7e33d7c381d7a4e558424b6b Mon Sep 17 00:00:00 2001 From: Boris BREZILLON <b.brezillon@overkiz.com> Date: Tue, 25 Jun 2013 10:12:56 +0200 Subject: [PATCH 117/913] usb: gadget: at91_udc: prepare clk before calling enable Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to avoid common clk framework warnings. Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/at91_udc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 2cbab1c9ff58..d9a6add0c852 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -870,8 +870,8 @@ static void clk_on(struct at91_udc *udc) if (udc->clocked) return; udc->clocked = 1; - clk_enable(udc->iclk); - clk_enable(udc->fclk); + clk_prepare_enable(udc->iclk); + clk_prepare_enable(udc->fclk); } static void clk_off(struct at91_udc *udc) @@ -880,8 +880,8 @@ static void clk_off(struct at91_udc *udc) return; udc->clocked = 0; udc->gadget.speed = USB_SPEED_UNKNOWN; - clk_disable(udc->fclk); - clk_disable(udc->iclk); + clk_disable_unprepare(udc->fclk); + clk_disable_unprepare(udc->iclk); } /* @@ -1782,12 +1782,14 @@ static int at91udc_probe(struct platform_device *pdev) } /* don't do anything until we have both gadget driver and VBUS */ - clk_enable(udc->iclk); + retval = clk_prepare_enable(udc->iclk); + if (retval) + goto fail1; at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS); at91_udp_write(udc, AT91_UDP_IDR, 0xffffffff); /* Clear all pending interrupts - UDP may be used by bootloader. */ at91_udp_write(udc, AT91_UDP_ICR, 0xffffffff); - clk_disable(udc->iclk); + clk_disable_unprepare(udc->iclk); /* request UDC and maybe VBUS irqs */ udc->udp_irq = platform_get_irq(pdev, 0); From 1974d494dea05ea227cb42f5e918828801e237aa Mon Sep 17 00:00:00 2001 From: Huang Rui <ray.huang@amd.com> Date: Thu, 27 Jun 2013 01:08:11 +0800 Subject: [PATCH 118/913] usb: dwc3: fix wrong bit mask in dwc3_event_type Per dwc3 2.50a spec, the is_devspec bit is used to distinguish the Device Endpoint-Specific Event or Device-Specific Event (DEVT). If the bit is 1, the event is represented Device-Specific Event, then use [7:1] bits as Device Specific Event to marked the type. It has 7 bits, and we can see the reserved8_31 variable name which means from 8 to 31 bits marked reserved, actually there are 24 bits not 25 bits between that. And 1 + 7 + 24 = 32, the event size is 4 byes. So in dwc3_event_type, the bit mask should be: is_devspec [0] 1 bit type [7:1] 7 bits reserved8_31 [31:8] 24 bits This patch should be backported to kernels as old as 3.2, that contain the commit 72246da40f3719af3bfd104a2365b32537c27d83 "usb: Introduce DesignWare USB3 DRD Driver". Cc: <stable@vger.kernel.org> Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/dwc3/core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index b69d322e3cab..27dad993b007 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -759,8 +759,8 @@ struct dwc3 { struct dwc3_event_type { u32 is_devspec:1; - u32 type:6; - u32 reserved8_31:25; + u32 type:7; + u32 reserved8_31:24; } __packed; #define DWC3_DEPEVT_XFERCOMPLETE 0x01 From 315955d707b50c8aad20a32ec0dd4c9fe243cabe Mon Sep 17 00:00:00 2001 From: Ruchika Kharwar <ruchika@ti.com> Date: Thu, 4 Jul 2013 00:59:34 -0500 Subject: [PATCH 119/913] usb: dwc3: fix the error returned with usb3_phy failure When there is an error with the usb3_phy probe or absence, the error returned is erroneously for usb2_phy. Cc: <stable@vger.kernel.org> Signed-off-by: Ruchika Kharwar <ruchika@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/dwc3/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index c35d49d39b76..358375e0b291 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -450,7 +450,7 @@ static int dwc3_probe(struct platform_device *pdev) } if (IS_ERR(dwc->usb3_phy)) { - ret = PTR_ERR(dwc->usb2_phy); + ret = PTR_ERR(dwc->usb3_phy); /* * if -ENXIO is returned, it means PHY layer wasn't From 5257a6332e9d02ed7a94381f553b9c05437baa5d Mon Sep 17 00:00:00 2001 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Thu, 4 Jul 2013 21:45:02 +0800 Subject: [PATCH 120/913] usb: gadget: mv_u3d_core: fix to pass correct device identity to free_irq() free_irq() expects the same device identity that was passed to corresponding request_irq(), otherwise the IRQ is not freed. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/mv_u3d_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/mv_u3d_core.c b/drivers/usb/gadget/mv_u3d_core.c index 07fdb3eaf48a..ec6a2d290398 100644 --- a/drivers/usb/gadget/mv_u3d_core.c +++ b/drivers/usb/gadget/mv_u3d_core.c @@ -1776,7 +1776,7 @@ static int mv_u3d_remove(struct platform_device *dev) kfree(u3d->eps); if (u3d->irq) - free_irq(u3d->irq, &dev->dev); + free_irq(u3d->irq, u3d); if (u3d->cap_regs) iounmap(u3d->cap_regs); @@ -1974,7 +1974,7 @@ static int mv_u3d_probe(struct platform_device *dev) return 0; err_unregister: - free_irq(u3d->irq, &dev->dev); + free_irq(u3d->irq, u3d); err_request_irq: err_get_irq: kfree(u3d->status_req); From 8047806e64ea7b33fcede5b93f7276568a6119e8 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Date: Mon, 8 Jul 2013 22:47:37 -0700 Subject: [PATCH 121/913] usb: renesas_usbhs: gadget: remove extra check on udc_stop usb_gadget_ops :: udc_stop might be called with driver = NULL since 511f3c5326eabe1ece35202a404c24c0aeacc246 (usb: gadget: udc-core: fix a regression during gadget driver unbinding) Because of that, 2nd times insmod goes fail. This patch fixes it up. Reported-by: Yusuke Goda <yusuke.goda.sx@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/renesas_usbhs/mod_gadget.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index ed4949faa70d..805940c37353 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -855,10 +855,6 @@ static int usbhsg_gadget_stop(struct usb_gadget *gadget, struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv); - if (!driver || - !driver->unbind) - return -EINVAL; - usbhsg_try_stop(priv, USBHSG_STATUS_REGISTERD); gpriv->driver = NULL; From 9d140f796f76d6a11fd27f07838285096e09b63b Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Date: Tue, 9 Jul 2013 08:14:39 +0200 Subject: [PATCH 122/913] usb: gadget: Kconfig: Fix configfs-based RNDIS function build USB_CONFIGFS_RNDIS depends on USB_U_RNDIS. Select it. Acked-by: Michal Nazarewicz <mina86@mina86.com> Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 62f6802f6e0f..5fce99a5d99e 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -639,6 +639,7 @@ config USB_CONFIGFS_RNDIS depends on USB_CONFIGFS depends on NET select USB_U_ETHER + select USB_U_RNDIS select USB_F_RNDIS help Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol, From 8744303eef570b4adc19a406b11418d21baa1c3c Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven <geert@linux-m68k.org> Date: Thu, 11 Jul 2013 15:54:00 +0200 Subject: [PATCH 123/913] usb: dwc3: USB_DWC3 should depend on HAS_DMA If NO_DMA=y: drivers/built-in.o: In function `dwc3_free_one_event_buffer': drivers/usb/dwc3/core.c:132: undefined reference to `dma_free_coherent' drivers/built-in.o: In function `dwc3_alloc_one_event_buffer': drivers/usb/dwc3/core.c:154: undefined reference to `dma_alloc_coherent' drivers/built-in.o: In function `dma_set_coherent_mask': include/linux/dma-mapping.h:93: undefined reference to `dma_supported' drivers/built-in.o: In function `dwc3_free_trb_pool': drivers/usb/dwc3/gadget.c:407: undefined reference to `dma_free_coherent' drivers/built-in.o: In function `dwc3_gadget_exit': drivers/usb/dwc3/gadget.c:2693: undefined reference to `dma_free_coherent' drivers/built-in.o: In function `dwc3_alloc_trb_pool': drivers/usb/dwc3/gadget.c:391: undefined reference to `dma_alloc_coherent' drivers/built-in.o: In function `dwc3_gadget_init': drivers/usb/dwc3/gadget.c:2598: undefined reference to `dma_alloc_coherent' drivers/usb/dwc3/gadget.c:2667: undefined reference to `dma_free_coherent' drivers/usb/dwc3/gadget.c:2674: undefined reference to `dma_free_coherent' drivers/usb/dwc3/gadget.c:2678: undefined reference to `dma_free_coherent' Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/dwc3/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index 757aa18027d0..2378958ea63e 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig @@ -1,6 +1,6 @@ config USB_DWC3 tristate "DesignWare USB3 DRD Core Support" - depends on (USB || USB_GADGET) && GENERIC_HARDIRQS + depends on (USB || USB_GADGET) && GENERIC_HARDIRQS && HAS_DMA select USB_XHCI_PLATFORM if USB_SUPPORT && USB_XHCI_HCD help Say Y or M here if your system has a Dual Role SuperSpeed From 4713aec180b666a78bc658490870b61f6846d8a6 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven <geert@linux-m68k.org> Date: Thu, 11 Jul 2013 15:54:02 +0200 Subject: [PATCH 124/913] usb: gadget: USB_MV_UDC should depend on HAS_DMA If NO_DMA=y: drivers/built-in.o: In function `done': drivers/usb/gadget/mv_udc_core.c:239: undefined reference to `dma_pool_free' drivers/built-in.o: In function `build_dtd': drivers/usb/gadget/mv_udc_core.c:371: undefined reference to `dma_pool_alloc' drivers/built-in.o: In function `udc_prime_status': drivers/usb/gadget/mv_udc_core.c:1465: undefined reference to `dma_map_single' drivers/built-in.o: In function `mv_udc_remove': drivers/usb/gadget/mv_udc_core.c:2087: undefined reference to `dma_pool_destroy' drivers/usb/gadget/mv_udc_core.c:2090: undefined reference to `dma_free_coherent' drivers/built-in.o: In function `mv_udc_probe': drivers/usb/gadget/mv_udc_core.c:2190: undefined reference to `dma_alloc_coherent' drivers/usb/gadget/mv_udc_core.c:2201: undefined reference to `dma_pool_create' drivers/usb/gadget/mv_udc_core.c:2315: undefined reference to `dma_pool_destroy' drivers/usb/gadget/mv_udc_core.c:2317: undefined reference to `dma_free_coherent' Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 5fce99a5d99e..1fd0e17d3706 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -328,7 +328,7 @@ config USB_S3C_HSUDC config USB_MV_UDC tristate "Marvell USB2.0 Device Controller" - depends on GENERIC_HARDIRQS + depends on GENERIC_HARDIRQS && HAS_DMA help Marvell Socs (including PXA and MMP series) include a high speed USB2.0 OTG controller, which can be configured as high speed or From bfcbd020396202e7795d78f8d87845e4e225c3b1 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven <geert@linux-m68k.org> Date: Thu, 11 Jul 2013 15:54:03 +0200 Subject: [PATCH 125/913] usb: gadget: USB_FOTG210_UDC should depend on HAS_DMA If NO_DMA=y: drivers/built-in.o: In function `fotg210_start_dma': drivers/usb/gadget/fotg210-udc.c:354: undefined reference to `dma_map_single' drivers/usb/gadget/fotg210-udc.c:357: undefined reference to `dma_mapping_error' drivers/usb/gadget/fotg210-udc.c:362: undefined reference to `dma_sync_single_for_cpu' drivers/usb/gadget/fotg210-udc.c:376: undefined reference to `dma_unmap_single' Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 1fd0e17d3706..2c4e978cef04 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -193,6 +193,7 @@ config USB_FUSB300 Faraday usb device controller FUSB300 driver config USB_FOTG210_UDC + depends on HAS_DMA tristate "Faraday FOTG210 USB Peripheral Controller" help Faraday USB2.0 OTG controller which can be configured as From 91f6b84739e29069670f54651340d2c20e4e7399 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven <geert@linux-m68k.org> Date: Thu, 11 Jul 2013 15:54:04 +0200 Subject: [PATCH 126/913] usb: gadget: USB_MV_U3D should depend on HAS_DMA If NO_DMA=y: drivers/built-in.o: In function `mv_u3d_done': drivers/usb/gadget/mv_u3d_core.c:206: undefined reference to `dma_pool_free' drivers/usb/gadget/mv_u3d_core.c:209: undefined reference to `dma_unmap_single' drivers/built-in.o: In function `mv_u3d_build_trb_one': drivers/usb/gadget/mv_u3d_core.c:311: undefined reference to `dma_pool_alloc' drivers/built-in.o: In function `mv_u3d_req_to_trb': drivers/usb/gadget/mv_u3d_core.c:480: undefined reference to `dma_map_single' drivers/built-in.o: In function `mv_u3d_remove': drivers/usb/gadget/mv_u3d_core.c:1770: undefined reference to `dma_pool_destroy' drivers/usb/gadget/mv_u3d_core.c:1773: undefined reference to `dma_free_coherent' drivers/built-in.o: In function `mv_u3d_probe': drivers/usb/gadget/mv_u3d_core.c:1880: undefined reference to `dma_alloc_coherent' drivers/usb/gadget/mv_u3d_core.c:1890: undefined reference to `dma_pool_create' drivers/usb/gadget/mv_u3d_core.c:1984: undefined reference to `dma_pool_destroy' drivers/usb/gadget/mv_u3d_core.c:1986: undefined reference to `dma_free_coherent' Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 2c4e978cef04..8e9368330b10 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -336,6 +336,7 @@ config USB_MV_UDC full speed USB peripheral. config USB_MV_U3D + depends on HAS_DMA tristate "MARVELL PXA2128 USB 3.0 controller" help MARVELL PXA2128 Processor series include a super speed USB3.0 device From 908b961326b2ecfbf494c9b2f206847d925f269d Mon Sep 17 00:00:00 2001 From: Alan Stern <stern@rowland.harvard.edu> Date: Fri, 12 Jul 2013 11:06:21 -0400 Subject: [PATCH 127/913] usb: gadget: don't fail when DMA isn't present When CONFIG_HAS_DMA isn't enabled, the UDC core gets build errors: drivers/built-in.o: In function `dma_set_coherent_mask': include/linux/dma-mapping.h:93: undefined reference to `dma_supported' include/linux/dma-mapping.h:93: undefined reference to `dma_supported' drivers/built-in.o: In function `usb_gadget_unmap_request': drivers/usb/gadget/udc-core.c:91: undefined reference to `dma_unmap_sg' drivers/usb/gadget/udc-core.c:96: undefined reference to `dma_unmap_single' drivers/built-in.o: In function `usb_gadget_map_request': drivers/usb/gadget/udc-core.c:62: undefined reference to `dma_map_sg' drivers/usb/gadget/udc-core.c:71: undefined reference to `dma_map_single' drivers/usb/gadget/udc-core.c:74: undefined reference to `dma_mapping_error' Prevent this by protecting the DMA API routines with preprocessor tests. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/udc-core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index ffd8fa541101..c28ac9872030 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c @@ -50,6 +50,8 @@ static DEFINE_MUTEX(udc_lock); /* ------------------------------------------------------------------------- */ +#ifdef CONFIG_HAS_DMA + int usb_gadget_map_request(struct usb_gadget *gadget, struct usb_request *req, int is_in) { @@ -99,6 +101,8 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget, } EXPORT_SYMBOL_GPL(usb_gadget_unmap_request); +#endif /* CONFIG_HAS_DMA */ + /* ------------------------------------------------------------------------- */ void usb_gadget_set_state(struct usb_gadget *gadget, @@ -194,9 +198,11 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget, dev_set_name(&gadget->dev, "gadget"); gadget->dev.parent = parent; +#ifdef CONFIG_HAS_DMA dma_set_coherent_mask(&gadget->dev, parent->coherent_dma_mask); gadget->dev.dma_parms = parent->dma_parms; gadget->dev.dma_mask = parent->dma_mask; +#endif if (release) gadget->dev.release = release; From 24e6bfd9d9d4e2f34dee59f0b477b72bdda5f800 Mon Sep 17 00:00:00 2001 From: Sachin Kamat <sachin.kamat@linaro.org> Date: Mon, 15 Jul 2013 14:06:54 +0530 Subject: [PATCH 128/913] usb: phy: samsung: Fix an error message typo The error message is common to both clk_get functions. Update it accordingly. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/phy/phy-samsung-usb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-samsung-usb2.c b/drivers/usb/phy/phy-samsung-usb2.c index 1011c16ade7e..758b86d0fcb3 100644 --- a/drivers/usb/phy/phy-samsung-usb2.c +++ b/drivers/usb/phy/phy-samsung-usb2.c @@ -388,7 +388,7 @@ static int samsung_usb2phy_probe(struct platform_device *pdev) clk = devm_clk_get(dev, "otg"); if (IS_ERR(clk)) { - dev_err(dev, "Failed to get otg clock\n"); + dev_err(dev, "Failed to get usbhost/otg clock\n"); return PTR_ERR(clk); } From 690c70bab1ebab0782cf9c316b726e2dddebc411 Mon Sep 17 00:00:00 2001 From: Ruchika Kharwar <ruchika@ti.com> Date: Thu, 4 Jul 2013 00:21:19 -0500 Subject: [PATCH 129/913] usb: phy: omap-usb3: fix dpll clock index Correction of the omap_usb3_dpll_params array when the sys_clk_rate is 20MHz. Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Signed-off-by: Ruchika Kharwar <ruchika@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/phy/phy-omap-usb3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-omap-usb3.c b/drivers/usb/phy/phy-omap-usb3.c index efe6e1464f45..a2fb30bbb971 100644 --- a/drivers/usb/phy/phy-omap-usb3.c +++ b/drivers/usb/phy/phy-omap-usb3.c @@ -71,9 +71,9 @@ static struct usb_dpll_params omap_usb3_dpll_params[NUM_SYS_CLKS] = { {1250, 5, 4, 20, 0}, /* 12 MHz */ {3125, 20, 4, 20, 0}, /* 16.8 MHz */ {1172, 8, 4, 20, 65537}, /* 19.2 MHz */ + {1000, 7, 4, 10, 0}, /* 20 MHz */ {1250, 12, 4, 20, 0}, /* 26 MHz */ {3125, 47, 4, 20, 92843}, /* 38.4 MHz */ - {1000, 7, 4, 10, 0}, /* 20 MHz */ }; From 1540c5d3cbf7670eb68a0d02611ec73e5604a91a Mon Sep 17 00:00:00 2001 From: Trond Myklebust <Trond.Myklebust@netapp.com> Date: Sun, 14 Jul 2013 22:57:50 -0400 Subject: [PATCH 130/913] SUNRPC: Fix another issue with rpc_client_register() Fix the error pathway if rpcauth_create() fails. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> --- net/sunrpc/clnt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 9963584605c0..74f6a704e374 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -309,6 +309,7 @@ static int rpc_client_register(const struct rpc_create_args *args, return 0; err_auth: pipefs_sb = rpc_get_sb_net(net); + rpc_unregister_client(clnt); __rpc_clnt_remove_pipedir(clnt); out: if (pipefs_sb) From 84bb08472520882394fe16d7a3548793302563de Mon Sep 17 00:00:00 2001 From: Fabio Estevam <fabio.estevam@freescale.com> Date: Sun, 9 Jun 2013 22:07:47 -0300 Subject: [PATCH 131/913] ARM: dts: imx51-babbage: Pass a real clock to the codec On imx51_babbage the codec clock is activated via GPIO4_26. Provide a real clock to the sgtl5000 codec via device tree. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> --- arch/arm/boot/dts/imx51-babbage.dts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts index 6dd9486c755b..ad3471ca17c7 100644 --- a/arch/arm/boot/dts/imx51-babbage.dts +++ b/arch/arm/boot/dts/imx51-babbage.dts @@ -61,6 +61,16 @@ mux-int-port = <2>; mux-ext-port = <3>; }; + + clocks { + clk_26M: codec_clock { + compatible = "fixed-clock"; + reg=<0>; + #clock-cells = <0>; + clock-frequency = <26000000>; + gpios = <&gpio4 26 1>; + }; + }; }; &esdhc1 { @@ -229,6 +239,7 @@ MX51_PAD_EIM_A27__GPIO2_21 0x5 MX51_PAD_CSPI1_SS0__GPIO4_24 0x85 MX51_PAD_CSPI1_SS1__GPIO4_25 0x85 + MX51_PAD_CSPI1_RDY__GPIO4_26 0x80000000 >; }; }; @@ -255,7 +266,7 @@ sgtl5000: codec@0a { compatible = "fsl,sgtl5000"; reg = <0x0a>; - clock-frequency = <26000000>; + clocks = <&clk_26M>; VDDA-supply = <&vdig_reg>; VDDIO-supply = <&vvideo_reg>; }; From 76828c882630ced08b5ddce22cc0095b05de9bc5 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o <tytso@mit.edu> Date: Mon, 15 Jul 2013 12:27:47 -0400 Subject: [PATCH 132/913] ext4: yield during large unlinks During large unlink operations on files with extents, we can use a lot of CPU time. This adds a cond_resched() call when starting to examine the next level of a multi-level extent tree. Multi-level extent trees are rare in the first place, and this should rarely be executed. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> --- fs/ext4/extents.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 593091537e76..cfdc51e30257 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -2835,6 +2835,9 @@ again: err = -EIO; break; } + /* Yield here to deal with large extent trees. + * Should be a no-op if we did IO above. */ + cond_resched(); if (WARN_ON(i + 1 > depth)) { err = -EIO; break; From 991821c86c2fb6cc4104ce679247864dbc070a83 Mon Sep 17 00:00:00 2001 From: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com> Date: Mon, 15 Jul 2013 16:32:34 +0800 Subject: [PATCH 133/913] tracing: Use correct config guard CONFIG_STACK_TRACER We should use CONFIG_STACK_TRACER to guard readme text of stack tracer related file, not CONFIG_STACKTRACE. Link: http://lkml.kernel.org/r/51E3B3A2.8080609@huawei.com Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 0cd500bffd9b..25b91afc29e0 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -3537,14 +3537,14 @@ static const char readme_msg[] = "\n snapshot\t\t- Like 'trace' but shows the content of the static snapshot buffer\n" "\t\t\t Read the contents for more information\n" #endif -#ifdef CONFIG_STACKTRACE +#ifdef CONFIG_STACK_TRACER " stack_trace\t\t- Shows the max stack trace when active\n" " stack_max_size\t- Shows current max stack size that was traced\n" "\t\t\t Write into this file to reset the max size (trigger a new trace)\n" #ifdef CONFIG_DYNAMIC_FTRACE " stack_trace_filter\t- Like set_ftrace_filter but limits what stack_trace traces\n" #endif -#endif /* CONFIG_STACKTRACE */ +#endif /* CONFIG_STACK_TRACER */ ; static ssize_t From cb6f66a2d278e57a6c9d8fb59bd9ebd8ab3965c2 Mon Sep 17 00:00:00 2001 From: Chih-Chung Chang <chihchung@chromium.org> Date: Mon, 15 Jul 2013 09:38:46 -0700 Subject: [PATCH 134/913] ASoC: max98088 - fix element type of the register cache. The registers of max98088 are 8 bits, not 16 bits. This bug causes the contents of registers to be overwritten with bad values when the codec is suspended and then resumed. Signed-off-by: Chih-Chung Chang <chihchung@chromium.org> Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org --- sound/soc/codecs/max98088.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 3eeada57e87d..566a367c94fa 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -1612,7 +1612,7 @@ static int max98088_dai2_digital_mute(struct snd_soc_dai *codec_dai, int mute) static void max98088_sync_cache(struct snd_soc_codec *codec) { - u16 *reg_cache = codec->reg_cache; + u8 *reg_cache = codec->reg_cache; int i; if (!codec->cache_sync) From 94e791f522595e2d5276e6d27a5b3b57f4e1cd8d Mon Sep 17 00:00:00 2001 From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Date: Mon, 15 Jul 2013 15:38:52 -0700 Subject: [PATCH 135/913] Thermal: x86_pkg_temp: Limit number of pkg temp zones Although it is unlikley that physical package id is set to some arbitary number, it is better to prevent in anycase. Since package temp zones use this in thermal zone type and for allocation, added a limit. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> --- drivers/thermal/x86_pkg_temp_thermal.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c index cf172d50b5d3..810143a6aa33 100644 --- a/drivers/thermal/x86_pkg_temp_thermal.c +++ b/drivers/thermal/x86_pkg_temp_thermal.c @@ -54,6 +54,8 @@ MODULE_PARM_DESC(notify_delay_ms, * is some wrong values returned by cpuid for number of thresholds. */ #define MAX_NUMBER_OF_TRIPS 2 +/* Limit number of package temp zones */ +#define MAX_PKG_TEMP_ZONE_IDS 256 struct phy_dev_entry { struct list_head list; @@ -401,6 +403,9 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) if (!thres_count) return -ENODEV; + if (topology_physical_package_id(cpu) > MAX_PKG_TEMP_ZONE_IDS) + return -ENODEV; + thres_count = clamp_val(thres_count, 0, MAX_NUMBER_OF_TRIPS); err = get_tj_max(cpu, &tj_max); From e085cad6c653e20e213a662ef32fb6191ae0197d Mon Sep 17 00:00:00 2001 From: Kukjin Kim <kgene.kim@samsung.com> Date: Wed, 26 Jun 2013 22:29:44 +0900 Subject: [PATCH 136/913] ARM: EXYNOS: skip pm support on exynos5440 EXYNOS5440 doesn't support PM and current single image for EXYNOS will be break without this patch. Actually, SSDK5440 cannot boot without this so this should be merged during rc. Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> --- arch/arm/mach-exynos/pm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index 41c20692a13f..c679db577269 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -217,6 +217,9 @@ static __init int exynos_pm_drvinit(void) struct clk *pll_base; unsigned int tmp; + if (soc_is_exynos5440()) + return 0; + s3c_pm_init(); /* All wakeup disable */ @@ -340,6 +343,9 @@ static struct syscore_ops exynos_pm_syscore_ops = { static __init int exynos_pm_syscore_init(void) { + if (soc_is_exynos5440()) + return 0; + register_syscore_ops(&exynos_pm_syscore_ops); return 0; } From ea2761763739619ca49602d891ec3ffb33ffc71b Mon Sep 17 00:00:00 2001 From: Subash Patel <subash.rp@samsung.com> Date: Tue, 16 Jul 2013 12:42:13 +0900 Subject: [PATCH 137/913] ARM: EXYNOS: change the PHYSMEM_BITS and SECTION_SIZE On EXYNOS5440 there is DRAM on the 36-bit address range. Hence this patch converts the MAX_PHYSMEM_BITS macro to 36 if LPAE is enabled for the ARM architecture. The conventional section size on EXYNOS is 256M due to sparsemem. Since EXYNOS5440 has memory in multiples of 1G in 32-bit and 36-bit range, this has now been modified to 31. Signed-off-by: Subash Patel <subash.rp@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> --- arch/arm/mach-exynos/include/mach/memory.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/mach-exynos/include/mach/memory.h b/arch/arm/mach-exynos/include/mach/memory.h index 374ef2cf7152..2a4cdb7cb326 100644 --- a/arch/arm/mach-exynos/include/mach/memory.h +++ b/arch/arm/mach-exynos/include/mach/memory.h @@ -15,8 +15,13 @@ #define PLAT_PHYS_OFFSET UL(0x40000000) +#ifndef CONFIG_ARM_LPAE /* Maximum of 256MiB in one bank */ #define MAX_PHYSMEM_BITS 32 #define SECTION_SIZE_BITS 28 +#else +#define MAX_PHYSMEM_BITS 36 +#define SECTION_SIZE_BITS 31 +#endif #endif /* __ASM_ARCH_MEMORY_H */ From cfaf8ee2f91607c8955af68538ba849b125fb8d5 Mon Sep 17 00:00:00 2001 From: Thomas Abraham <thomas.ab@samsung.com> Date: Tue, 16 Jul 2013 12:42:59 +0900 Subject: [PATCH 138/913] ARM: EXYNOS: Enable 64-bit DMA for EXYNOS5440 if LPAE is enabled Allow 64-bit DMA addresses if LPAE is enabled on EXYNOS5440. Signed-off-by: Thomas Abraham <thomas.ab@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> --- arch/arm/mach-exynos/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index 855d4a7b462d..5952e68c76c4 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig @@ -92,6 +92,7 @@ config SOC_EXYNOS5440 bool "SAMSUNG EXYNOS5440" default y depends on ARCH_EXYNOS5 + select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE select ARCH_HAS_OPP select HAVE_ARM_ARCH_TIMER select AUTO_ZRELADDR From a0ec570f4f69c4cb700d743a915096c2c8f56a99 Mon Sep 17 00:00:00 2001 From: Michal Kazior <michal.kazior@tieto.com> Date: Tue, 25 Jun 2013 09:17:17 +0200 Subject: [PATCH 139/913] nl80211: fix mgmt tx status and testmode reporting for netns These two events were sent to the default network namespace. This caused AP mode in a non-default netns to not work correctly. Mgmt tx status was multicasted to a different (default) netns instead of the one the AP was in. Cc: stable@vger.kernel.org Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- net/wireless/nl80211.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 1cc47aca7f05..9fb8820b75c5 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6613,12 +6613,14 @@ EXPORT_SYMBOL(cfg80211_testmode_alloc_event_skb); void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) { + struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0]; void *hdr = ((void **)skb->cb)[1]; struct nlattr *data = ((void **)skb->cb)[2]; nla_nest_end(skb, data); genlmsg_end(skb, hdr); - genlmsg_multicast(skb, 0, nl80211_testmode_mcgrp.id, gfp); + genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), skb, 0, + nl80211_testmode_mcgrp.id, gfp); } EXPORT_SYMBOL(cfg80211_testmode_event); #endif @@ -10064,7 +10066,8 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, genlmsg_end(msg, hdr); - genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp); + genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, + nl80211_mlme_mcgrp.id, gfp); return; nla_put_failure: From 923a0e7dee8c436108279568cf34444749ac796f Mon Sep 17 00:00:00 2001 From: Johannes Berg <johannes@sipsolutions.net> Date: Fri, 28 Jun 2013 11:38:54 +0200 Subject: [PATCH 140/913] cfg80211: fix bugs in new SME implementation When splitting the SME implementation from the MLME code, I introduced a few bugs: * association failures no longer sent a connect-failure event * getting disassociated from the AP caused deauth to be sent but state wasn't cleaned up, leading to warnings * authentication failures weren't cleaned up properly, causing new connection attempts to warn and fail Fix these bugs. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- net/wireless/sme.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 1d3cfb1a3f28..81c8a10d743c 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -34,8 +34,10 @@ struct cfg80211_conn { CFG80211_CONN_SCAN_AGAIN, CFG80211_CONN_AUTHENTICATE_NEXT, CFG80211_CONN_AUTHENTICATING, + CFG80211_CONN_AUTH_FAILED, CFG80211_CONN_ASSOCIATE_NEXT, CFG80211_CONN_ASSOCIATING, + CFG80211_CONN_ASSOC_FAILED, CFG80211_CONN_DEAUTH, CFG80211_CONN_CONNECTED, } state; @@ -164,6 +166,8 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev) NULL, 0, params->key, params->key_len, params->key_idx, NULL, 0); + case CFG80211_CONN_AUTH_FAILED: + return -ENOTCONN; case CFG80211_CONN_ASSOCIATE_NEXT: BUG_ON(!rdev->ops->assoc); wdev->conn->state = CFG80211_CONN_ASSOCIATING; @@ -188,10 +192,17 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev) WLAN_REASON_DEAUTH_LEAVING, false); return err; + case CFG80211_CONN_ASSOC_FAILED: + cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, + NULL, 0, + WLAN_REASON_DEAUTH_LEAVING, false); + return -ENOTCONN; case CFG80211_CONN_DEAUTH: cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, NULL, 0, WLAN_REASON_DEAUTH_LEAVING, false); + /* free directly, disconnected event already sent */ + cfg80211_sme_free(wdev); return 0; default: return 0; @@ -371,7 +382,7 @@ bool cfg80211_sme_rx_assoc_resp(struct wireless_dev *wdev, u16 status) return true; } - wdev->conn->state = CFG80211_CONN_DEAUTH; + wdev->conn->state = CFG80211_CONN_ASSOC_FAILED; schedule_work(&rdev->conn_work); return false; } @@ -383,7 +394,13 @@ void cfg80211_sme_deauth(struct wireless_dev *wdev) void cfg80211_sme_auth_timeout(struct wireless_dev *wdev) { - cfg80211_sme_free(wdev); + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); + + if (!wdev->conn) + return; + + wdev->conn->state = CFG80211_CONN_AUTH_FAILED; + schedule_work(&rdev->conn_work); } void cfg80211_sme_disassoc(struct wireless_dev *wdev) @@ -399,7 +416,13 @@ void cfg80211_sme_disassoc(struct wireless_dev *wdev) void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev) { - cfg80211_sme_disassoc(wdev); + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); + + if (!wdev->conn) + return; + + wdev->conn->state = CFG80211_CONN_ASSOC_FAILED; + schedule_work(&rdev->conn_work); } static int cfg80211_sme_connect(struct wireless_dev *wdev, From f77b86d7d3acf9dfcb5ee834628d12207584b2cb Mon Sep 17 00:00:00 2001 From: Johannes Berg <johannes.berg@intel.com> Date: Mon, 24 Jun 2013 15:43:38 +0200 Subject: [PATCH 141/913] regulatory: add missing rtnl locking restore_regulatory_settings() requires the RTNL to be held, add the missing locking in reg_timeout_work(). Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- net/wireless/reg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 5a24c986f34b..5a950f36bae4 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2279,7 +2279,9 @@ void wiphy_regulatory_deregister(struct wiphy *wiphy) static void reg_timeout_work(struct work_struct *work) { REG_DBG_PRINT("Timeout while waiting for CRDA to reply, restoring regulatory settings\n"); + rtnl_lock(); restore_regulatory_settings(true); + rtnl_unlock(); } int __init regulatory_init(void) From 1cd158573951f737fbc878a35cb5eb47bf9af3d5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau <nbd@openwrt.org> Date: Fri, 28 Jun 2013 21:04:35 +0200 Subject: [PATCH 142/913] mac80211/minstrel_ht: fix cck rate sampling The CCK group needs special treatment to set the right flags and rate index. Add this missing check to prevent setting broken rates for tx packets. Cc: stable@vger.kernel.org # 3.10 Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- net/mac80211/rc80211_minstrel_ht.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 5b2d3012b983..f5aed963b22e 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -804,10 +804,18 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, sample_group = &minstrel_mcs_groups[sample_idx / MCS_GROUP_RATES]; info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; + rate->count = 1; + + if (sample_idx / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) { + int idx = sample_idx % ARRAY_SIZE(mp->cck_rates); + rate->idx = mp->cck_rates[idx]; + rate->flags = 0; + return; + } + rate->idx = sample_idx % MCS_GROUP_RATES + (sample_group->streams - 1) * MCS_GROUP_RATES; rate->flags = IEEE80211_TX_RC_MCS | sample_group->flags; - rate->count = 1; } static void From e13bae4f807401729b3f27c7e882a96b8b292809 Mon Sep 17 00:00:00 2001 From: Johannes Berg <johannes@sipsolutions.net> Date: Mon, 8 Jul 2013 10:43:31 +0200 Subject: [PATCH 143/913] mac80211: fix ethtool stats for non-station interfaces As reported in https://bugzilla.kernel.org/show_bug.cgi?id=60514, the station loop never initialises 'sinfo' and therefore adds up a stack values, leaking stack information (the number of times it adds values is easily obtained another way.) Fix this by initialising the sinfo for each station to add. Cc: stable@vger.kernel.org Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- net/mac80211/cfg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 8184d121ff09..43dd7525bfcb 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -666,6 +666,8 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy, if (sta->sdata->dev != dev) continue; + sinfo.filled = 0; + sta_set_sinfo(sta, &sinfo); i = 0; ADD_STA_STATS(sta); } From 83374fe9de455e37c2a039603d2538eb77e8ec4d Mon Sep 17 00:00:00 2001 From: Chun-Yeow Yeoh <yeohchunyeow@gmail.com> Date: Thu, 11 Jul 2013 18:24:03 +0800 Subject: [PATCH 144/913] nl80211: fix the setting of RSSI threshold value for mesh RSSI threshold value used for mesh peering should be in negative value. After range checks to mesh parameters is introduced, this is not allowed. Fix this. Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- net/wireless/nl80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 9fb8820b75c5..25d217d90807 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -4770,9 +4770,9 @@ do { \ FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding, 0, 1, mask, NL80211_MESHCONF_FORWARDING, nla_get_u8); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, 1, 255, + FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, -255, 0, mask, NL80211_MESHCONF_RSSI_THRESHOLD, - nla_get_u32); + nla_get_s32); FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, 0, 16, mask, NL80211_MESHCONF_HT_OPMODE, nla_get_u16); From 6b0f32745dcfba01d7be33acd1b40306c7a914c6 Mon Sep 17 00:00:00 2001 From: Johannes Berg <johannes.berg@intel.com> Date: Thu, 11 Jul 2013 22:33:26 +0200 Subject: [PATCH 145/913] mac80211: fix duplicate retransmission detection The duplicate retransmission detection code in mac80211 erroneously attempts to do the check for every frame, even frames that don't have a sequence control field or that don't use it (QoS-Null frames.) This is problematic because it causes the code to access data beyond the end of the SKB and depending on the data there will drop packets erroneously. Correct the code to not do duplicate detection for such frames. I found this error while testing AP powersave, it lead to retransmitted PS-Poll frames being dropped entirely as the data beyond the end of the SKB was always zero. Cc: stable@vger.kernel.org [all versions] Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- net/mac80211/rx.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 23dbcfc69b3b..2c5a79bd3777 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -936,8 +936,14 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - /* Drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.2.9) */ - if (rx->sta && !is_multicast_ether_addr(hdr->addr1)) { + /* + * Drop duplicate 802.11 retransmissions + * (IEEE 802.11-2012: 9.3.2.10 "Duplicate detection and recovery") + */ + if (rx->skb->len >= 24 && rx->sta && + !ieee80211_is_ctl(hdr->frame_control) && + !ieee80211_is_qos_nullfunc(hdr->frame_control) && + !is_multicast_ether_addr(hdr->addr1)) { if (unlikely(ieee80211_has_retry(hdr->frame_control) && rx->sta->last_seq_ctrl[rx->seqno_idx] == hdr->seq_ctrl)) { From 67dbf54a3b03881c7b683801fa49ca1f2c4c3bcf Mon Sep 17 00:00:00 2001 From: Jacek Anaszewski <j.anaszewski@samsung.com> Date: Tue, 2 Jul 2013 11:13:00 +0100 Subject: [PATCH 146/913] iio: lps331ap: Fix wrong in_pressure_scale output value This patch fixes improper in_pressure_scale output that is returned by the lps331ap barometer sensor driver. According to the documentation the pressure after applying the scale has to be expressed in kilopascal units. With erroneous implementation the scale value larger by two orders of magnitude is returned - 2441410 instead of 24414. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> --- drivers/iio/pressure/st_pressure_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c index 9c343b40665e..3ffbc56917b4 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c @@ -28,7 +28,9 @@ #include <linux/iio/common/st_sensors.h> #include "st_pressure.h" -#define ST_PRESS_MBAR_TO_KPASCAL(x) (x * 10) +#define ST_PRESS_LSB_PER_MBAR 4096UL +#define ST_PRESS_KPASCAL_NANO_SCALE (100000000UL / \ + ST_PRESS_LSB_PER_MBAR) #define ST_PRESS_NUMBER_DATA_CHANNELS 1 /* DEFAULT VALUE FOR SENSORS */ @@ -51,8 +53,8 @@ #define ST_PRESS_1_FS_ADDR 0x23 #define ST_PRESS_1_FS_MASK 0x30 #define ST_PRESS_1_FS_AVL_1260_VAL 0x00 -#define ST_PRESS_1_FS_AVL_1260_GAIN ST_PRESS_MBAR_TO_KPASCAL(244141) #define ST_PRESS_1_FS_AVL_TEMP_GAIN 2083000 +#define ST_PRESS_1_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE #define ST_PRESS_1_BDU_ADDR 0x20 #define ST_PRESS_1_BDU_MASK 0x04 #define ST_PRESS_1_DRDY_IRQ_ADDR 0x22 From b7327d89ae694a89f9934d428bde520b77b3131c Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Date: Mon, 24 Jun 2013 15:44:03 +0300 Subject: [PATCH 147/913] iwlwifi: mvm: unregister leds when registration failed This was missing and prevented any further attempts to load the module. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index e08683b20531..cab2f0c61ec7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c @@ -257,7 +257,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) if (ret) return ret; - return ieee80211_register_hw(mvm->hw); + ret = ieee80211_register_hw(mvm->hw); + if (ret) + iwl_mvm_leds_exit(mvm); + + return ret; } static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, From 64597f9dae1850e0360ae2e9b5485d4b5d1fdf4c Mon Sep 17 00:00:00 2001 From: Michael Mueller <mimu@linux.vnet.ibm.com> Date: Tue, 2 Jul 2013 22:58:26 +0200 Subject: [PATCH 148/913] s390/ptrace: PTRACE_TE_ABORT_RAND The patch implements a s390 specific ptrace request PTRACE_TE_ABORT_RAND to modify the randomness of spontaneous aborts of memory transactions of the transaction execution facility. The data argument of the ptrace request is used to specify the levels of randomness, 0 for normal operation, 1 to abort every transaction at a random instruction, and 2 to abort a random transaction at a random instruction. The default is 0 for normal operation. Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- arch/s390/include/asm/processor.h | 10 +++++- arch/s390/include/asm/switch_to.h | 4 +-- arch/s390/include/uapi/asm/ptrace.h | 1 + arch/s390/kernel/ptrace.c | 50 ++++++++++++++++++++++------- 4 files changed, 51 insertions(+), 14 deletions(-) diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h index 6b499870662f..b0e6435b2f02 100644 --- a/arch/s390/include/asm/processor.h +++ b/arch/s390/include/asm/processor.h @@ -91,7 +91,15 @@ struct thread_struct { #endif }; -#define PER_FLAG_NO_TE 1UL /* Flag to disable transactions. */ +/* Flag to disable transactions. */ +#define PER_FLAG_NO_TE 1UL +/* Flag to enable random transaction aborts. */ +#define PER_FLAG_TE_ABORT_RAND 2UL +/* Flag to specify random transaction abort mode: + * - abort each transaction at a random instruction before TEND if set. + * - abort random transactions at a random instruction if cleared. + */ +#define PER_FLAG_TE_ABORT_RAND_TEND 4UL typedef struct thread_struct thread_struct; diff --git a/arch/s390/include/asm/switch_to.h b/arch/s390/include/asm/switch_to.h index f3a9e0f92704..80b6f11263c4 100644 --- a/arch/s390/include/asm/switch_to.h +++ b/arch/s390/include/asm/switch_to.h @@ -10,7 +10,7 @@ #include <linux/thread_info.h> extern struct task_struct *__switch_to(void *, void *); -extern void update_per_regs(struct task_struct *task); +extern void update_cr_regs(struct task_struct *task); static inline void save_fp_regs(s390_fp_regs *fpregs) { @@ -86,7 +86,7 @@ static inline void restore_access_regs(unsigned int *acrs) restore_fp_regs(&next->thread.fp_regs); \ restore_access_regs(&next->thread.acrs[0]); \ restore_ri_cb(next->thread.ri_cb, prev->thread.ri_cb); \ - update_per_regs(next); \ + update_cr_regs(next); \ } \ prev = __switch_to(prev,next); \ } while (0) diff --git a/arch/s390/include/uapi/asm/ptrace.h b/arch/s390/include/uapi/asm/ptrace.h index 3aa9f1ec5b29..7a84619e315e 100644 --- a/arch/s390/include/uapi/asm/ptrace.h +++ b/arch/s390/include/uapi/asm/ptrace.h @@ -400,6 +400,7 @@ typedef struct #define PTRACE_POKE_SYSTEM_CALL 0x5008 #define PTRACE_ENABLE_TE 0x5009 #define PTRACE_DISABLE_TE 0x5010 +#define PTRACE_TE_ABORT_RAND 0x5011 /* * PT_PROT definition is loosely based on hppa bsd definition in diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index a314c57f4e94..e9fadb04e3c6 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c @@ -47,7 +47,7 @@ enum s390_regset { REGSET_GENERAL_EXTENDED, }; -void update_per_regs(struct task_struct *task) +void update_cr_regs(struct task_struct *task) { struct pt_regs *regs = task_pt_regs(task); struct thread_struct *thread = &task->thread; @@ -56,17 +56,25 @@ void update_per_regs(struct task_struct *task) #ifdef CONFIG_64BIT /* Take care of the enable/disable of transactional execution. */ if (MACHINE_HAS_TE) { - unsigned long cr0, cr0_new; + unsigned long cr[3], cr_new[3]; - __ctl_store(cr0, 0, 0); - /* set or clear transaction execution bits 8 and 9. */ + __ctl_store(cr, 0, 2); + cr_new[1] = cr[1]; + /* Set or clear transaction execution TXC/PIFO bits 8 and 9. */ if (task->thread.per_flags & PER_FLAG_NO_TE) - cr0_new = cr0 & ~(3UL << 54); + cr_new[0] = cr[0] & ~(3UL << 54); else - cr0_new = cr0 | (3UL << 54); - /* Only load control register 0 if necessary. */ - if (cr0 != cr0_new) - __ctl_load(cr0_new, 0, 0); + cr_new[0] = cr[0] | (3UL << 54); + /* Set or clear transaction execution TDC bits 62 and 63. */ + cr_new[2] = cr[2] & ~3UL; + if (task->thread.per_flags & PER_FLAG_TE_ABORT_RAND) { + if (task->thread.per_flags & PER_FLAG_TE_ABORT_RAND_TEND) + cr_new[2] |= 1UL; + else + cr_new[2] |= 2UL; + } + if (memcmp(&cr_new, &cr, sizeof(cr))) + __ctl_load(cr_new, 0, 2); } #endif /* Copy user specified PER registers */ @@ -100,14 +108,14 @@ void user_enable_single_step(struct task_struct *task) { set_tsk_thread_flag(task, TIF_SINGLE_STEP); if (task == current) - update_per_regs(task); + update_cr_regs(task); } void user_disable_single_step(struct task_struct *task) { clear_tsk_thread_flag(task, TIF_SINGLE_STEP); if (task == current) - update_per_regs(task); + update_cr_regs(task); } /* @@ -447,6 +455,26 @@ long arch_ptrace(struct task_struct *child, long request, if (!MACHINE_HAS_TE) return -EIO; child->thread.per_flags |= PER_FLAG_NO_TE; + child->thread.per_flags &= ~PER_FLAG_TE_ABORT_RAND; + return 0; + case PTRACE_TE_ABORT_RAND: + if (!MACHINE_HAS_TE || (child->thread.per_flags & PER_FLAG_NO_TE)) + return -EIO; + switch (data) { + case 0UL: + child->thread.per_flags &= ~PER_FLAG_TE_ABORT_RAND; + break; + case 1UL: + child->thread.per_flags |= PER_FLAG_TE_ABORT_RAND; + child->thread.per_flags |= PER_FLAG_TE_ABORT_RAND_TEND; + break; + case 2UL: + child->thread.per_flags |= PER_FLAG_TE_ABORT_RAND; + child->thread.per_flags &= ~PER_FLAG_TE_ABORT_RAND_TEND; + break; + default: + return -EINVAL; + } return 0; default: /* Removing high order bit from addr (only for 31 bit). */ From dae7fd42961e9ae9386f527b6d0e14f6e3da2317 Mon Sep 17 00:00:00 2001 From: Sebastian Ott <sebott@linux.vnet.ibm.com> Date: Fri, 5 Jul 2013 09:22:11 +0200 Subject: [PATCH 149/913] s390/qdio: remove unused variable Fix a "set but not used" warning found via make W=1. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- drivers/s390/cio/qdio_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index fb1c1e0483ed..8ed52aa49122 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c @@ -1497,7 +1497,7 @@ static inline int buf_in_between(int bufnr, int start, int count) static int handle_inbound(struct qdio_q *q, unsigned int callflags, int bufnr, int count) { - int used, diff; + int diff; qperf_inc(q, inbound_call); @@ -1530,7 +1530,7 @@ static int handle_inbound(struct qdio_q *q, unsigned int callflags, set: count = set_buf_states(q, bufnr, SLSB_CU_INPUT_EMPTY, count); - used = atomic_add_return(count, &q->nr_buf_used) - count; + atomic_add(count, &q->nr_buf_used); if (need_siga_in(q)) return qdio_siga_input(q); From 707aee401d2467baa785a697f40a6e2d9ee79ad5 Mon Sep 17 00:00:00 2001 From: Johannes Berg <johannes.berg@intel.com> Date: Fri, 3 May 2013 18:58:16 +0200 Subject: [PATCH 150/913] iwlwifi: dvm: don't send BT_CONFIG on devices w/o Bluetooth The BT_CONFIG command that is sent to the device during startup will enable BT coex unless the module parameter turns it off, but on devices without Bluetooth this may cause problems, as reported in Redhat BZ 885407. Fix this by sending the BT_CONFIG command only when the device has Bluetooth. Cc: stable@vger.kernel.org Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- drivers/net/wireless/iwlwifi/dvm/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c index 3952ddf2ddb2..1531a4fc0960 100644 --- a/drivers/net/wireless/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/iwlwifi/dvm/main.c @@ -758,7 +758,7 @@ int iwl_alive_start(struct iwl_priv *priv) BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); if (ret) return ret; - } else { + } else if (priv->lib->bt_params) { /* * default is 2-wire BT coexexistence support */ From 0ecb376375d662987eba2f6e3bfd4bd532bb3907 Mon Sep 17 00:00:00 2001 From: Alexander Bondar <alexander.bondar@intel.com> Date: Sun, 23 Jun 2013 20:31:07 +0300 Subject: [PATCH 151/913] iwlwifi: mvm: Fix VIF specific debugfs directory creation Avoid creating VIF specific debugfs directory if already exist. This may happen when, for example, resetting hw, suspend-resume. Signed-off-by: Alexander Bondar <alexander.bondar@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- drivers/net/wireless/iwlwifi/mvm/debugfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c index e56ed2a84888..c24a744910ac 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c @@ -988,7 +988,11 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); char buf[100]; - if (!dbgfs_dir) + /* + * Check if debugfs directory already exist before creating it. + * This may happen when, for example, resetting hw or suspend-resume + */ + if (!dbgfs_dir || mvmvif->dbgfs_dir) return; mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir); From 93a426673fbfeae7fa6b27008828e2ac4c08dbee Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Date: Tue, 2 Jul 2013 13:35:35 +0300 Subject: [PATCH 152/913] iwlwifi: mvm: fix L2P BA ressources leak We didn't release the Rx AMPDU ressources properly. This bug led to firmware assert after 16 BA sessions. Cc: <stable@vger.kernel.org> [3.9+] Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- drivers/net/wireless/iwlwifi/mvm/sta.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c index 62fe5209093b..b6ab0766ea99 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/iwlwifi/mvm/sta.c @@ -621,8 +621,12 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color); cmd.sta_id = mvm_sta->sta_id; cmd.add_modify = STA_MODE_MODIFY; - cmd.add_immediate_ba_tid = (u8) tid; - cmd.add_immediate_ba_ssn = cpu_to_le16(ssn); + if (start) { + cmd.add_immediate_ba_tid = (u8) tid; + cmd.add_immediate_ba_ssn = cpu_to_le16(ssn); + } else { + cmd.remove_immediate_ba_tid = (u8) tid; + } cmd.modify_mask = start ? STA_MODIFY_ADD_BA_TID : STA_MODIFY_REMOVE_BA_TID; From 113a04470d9178170a5d1aa165809515884f39a8 Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Date: Tue, 2 Jul 2013 14:16:38 +0300 Subject: [PATCH 153/913] iwlwifi: mvm: track the number of Rx BA sessions The firmware / HW can't support more than 16 Rx BA sessions. Deny any attemps to open more sessions than that. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 1 + drivers/net/wireless/iwlwifi/mvm/mvm.h | 1 + drivers/net/wireless/iwlwifi/mvm/sta.c | 15 +++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index cab2f0c61ec7..1a4a032cecb2 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c @@ -389,6 +389,7 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) ieee80211_wake_queues(mvm->hw); mvm->vif_count = 0; + mvm->rx_ba_sessions = 0; } static int iwl_mvm_mac_start(struct ieee80211_hw *hw) diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index d40d7db185d6..420e82d379d9 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h @@ -419,6 +419,7 @@ struct iwl_mvm { struct work_struct sta_drained_wk; unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; atomic_t pending_frames[IWL_MVM_STATION_COUNT]; + u8 rx_ba_sessions; /* configured by mac80211 */ u32 rts_threshold; diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c index b6ab0766ea99..85d4bbe52157 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/iwlwifi/mvm/sta.c @@ -608,6 +608,8 @@ int iwl_mvm_rm_bcast_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *bsta) return ret; } +#define IWL_MAX_RX_BA_SESSIONS 16 + int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, int tid, u16 ssn, bool start) { @@ -618,6 +620,11 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, lockdep_assert_held(&mvm->mutex); + if (start && mvm->rx_ba_sessions >= IWL_MAX_RX_BA_SESSIONS) { + IWL_WARN(mvm, "Not enough RX BA SESSIONS\n"); + return -ENOSPC; + } + cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color); cmd.sta_id = mvm_sta->sta_id; cmd.add_modify = STA_MODE_MODIFY; @@ -652,6 +659,14 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, break; } + if (!ret) { + if (start) + mvm->rx_ba_sessions++; + else if (mvm->rx_ba_sessions > 0) + /* check that restart flow didn't zero the counter */ + mvm->rx_ba_sessions--; + } + return ret; } From 48bc13072109ea58465542aa1ee31b4e1065468a Mon Sep 17 00:00:00 2001 From: Johannes Berg <johannes.berg@intel.com> Date: Thu, 4 Jul 2013 15:55:29 +0200 Subject: [PATCH 154/913] iwlwifi: mvm: refuse connection to APs with BI < 16 Due to a firmware bug, it crashes when the beacon interval is smaller than 16. Avoid this by refusing the station state change creating the AP station, causing mac80211 to abandon the attempt to connect to the AP, and eventually wpa_s to blacklist it. Cc: stable@vger.kernel.org Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 1a4a032cecb2..1eedc424051c 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c @@ -1011,6 +1011,21 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, mutex_lock(&mvm->mutex); if (old_state == IEEE80211_STA_NOTEXIST && new_state == IEEE80211_STA_NONE) { + /* + * Firmware bug - it'll crash if the beacon interval is less + * than 16. We can't avoid connecting at all, so refuse the + * station state change, this will cause mac80211 to abandon + * attempts to connect to this AP, and eventually wpa_s will + * blacklist the AP... + */ + if (vif->type == NL80211_IFTYPE_STATION && + vif->bss_conf.beacon_int < 16) { + IWL_ERR(mvm, + "AP %pM beacon interval is %d, refusing due to firmware bug!\n", + sta->addr, vif->bss_conf.beacon_int); + ret = -EINVAL; + goto out_unlock; + } ret = iwl_mvm_add_sta(mvm, vif, sta); } else if (old_state == IEEE80211_STA_NONE && new_state == IEEE80211_STA_AUTH) { @@ -1043,6 +1058,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, } else { ret = -EIO; } + out_unlock: mutex_unlock(&mvm->mutex); return ret; From fe04e83706037802c502ea41c0d1799ec35fc0d7 Mon Sep 17 00:00:00 2001 From: David Spinadel <david.spinadel@intel.com> Date: Thu, 4 Jul 2013 15:17:48 +0300 Subject: [PATCH 155/913] iwlwifi: mvm: fix bug in scan ssid Increment index in each iteration. Without this increment we are overriding the added SSIDs and we will send only the last SSId and (n_ssids - 1) broadcast probes. Cc: <stable@vger.kernel.org> [3.9+] Signed-off-by: David Spinadel <david.spinadel@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- drivers/net/wireless/iwlwifi/mvm/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 2157b0f8ced5..8023deec20cb 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c @@ -137,8 +137,8 @@ static void iwl_mvm_scan_fill_ssids(struct iwl_scan_cmd *cmd, { int fw_idx, req_idx; - fw_idx = 0; - for (req_idx = req->n_ssids - 1; req_idx > 0; req_idx--) { + for (req_idx = req->n_ssids - 1, fw_idx = 0; req_idx > 0; + req_idx--, fw_idx++) { cmd->direct_scan[fw_idx].id = WLAN_EID_SSID; cmd->direct_scan[fw_idx].len = req->ssids[req_idx].ssid_len; memcpy(cmd->direct_scan[fw_idx].ssid, From a590ad411891de551e6de1b51ea635c0484148d6 Mon Sep 17 00:00:00 2001 From: David Spinadel <david.spinadel@intel.com> Date: Thu, 4 Jul 2013 15:22:26 +0300 Subject: [PATCH 156/913] iwlwifi: mvm: remove extra SSID from probe request Bits 1-21 in this channel type attributes are indication for which SSID is going to be sent on this channel. Since the first SSID is sent implicitly in the probe request, we don't need to toggle its bit here. Signed-off-by: David Spinadel <david.spinadel@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- drivers/net/wireless/iwlwifi/mvm/scan.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 8023deec20cb..268f027b45b0 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c @@ -153,7 +153,9 @@ static void iwl_mvm_scan_fill_ssids(struct iwl_scan_cmd *cmd, * just to notify that this scan is active and not passive. * In order to notify the FW of the number of SSIDs we wish to scan (including * the zero-length one), we need to set the corresponding bits in chan->type, - * one for each SSID, and set the active bit (first). + * one for each SSID, and set the active bit (first). The first SSID is already + * included in the probe template, so we need to set only req->n_ssids - 1 bits + * in addition to the first bit. */ static u16 iwl_mvm_get_active_dwell(enum ieee80211_band band, int n_ssids) { @@ -179,7 +181,7 @@ static void iwl_mvm_scan_fill_channels(struct iwl_scan_cmd *cmd, __le32 chan_type_value; if (req->n_ssids > 0) - chan_type_value = cpu_to_le32(BIT(req->n_ssids + 1) - 1); + chan_type_value = cpu_to_le32(BIT(req->n_ssids) - 1); else chan_type_value = SCAN_CHANNEL_TYPE_PASSIVE; From eac27f04a71e1f39f196f7e520d16dcefc955d77 Mon Sep 17 00:00:00 2001 From: Youquan Song <youquan.song@intel.com> Date: Thu, 11 Jul 2013 21:15:57 -0400 Subject: [PATCH 157/913] ata: Fix DVD not dectected at some platform with Wellsburg PCH There is a patch b55f84e2d527182e7c611d466cd0bb6ddce201de "ata_piix: Fix DVD not dectected at some Haswell platforms" to fix an issue of DVD not recognized on Haswell Desktop platform with Lynx Point. Recently, it is also found the same issue at some platformas with Wellsburg PCH. So deliver a similar patch to fix it by disables 32bit PIO in IDE mode. Signed-off-by: Youquan Song <youquan.song@intel.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: stable@vger.kernel.org --- drivers/ata/ata_piix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index b52a10c8eeb9..513ad7ed0c99 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c @@ -330,7 +330,7 @@ static const struct pci_device_id piix_pci_tbl[] = { /* SATA Controller IDE (Wellsburg) */ { 0x8086, 0x8d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, /* SATA Controller IDE (Wellsburg) */ - { 0x8086, 0x8d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + { 0x8086, 0x8d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, /* SATA Controller IDE (Wellsburg) */ { 0x8086, 0x8d60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, /* SATA Controller IDE (Wellsburg) */ From 741532c4a995be11815cb72d4d7a48f442a22fea Mon Sep 17 00:00:00 2001 From: Roger Quadros <rogerq@ti.com> Date: Tue, 18 Jun 2013 19:04:47 +0300 Subject: [PATCH 158/913] ARM: OMAP2+: Provide alias to USB PHY clock Till the OMAP clocks are correctly defined in device tree, use this temporary hack to provide clock alias to the USB PHY clocks. Without this, USB Host & Ethernet will not be functional with device tree boots on Panda and uEVM. Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com> --- arch/arm/mach-omap2/board-generic.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index e5fbfed69aa2..be5d005ebad2 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c @@ -15,6 +15,7 @@ #include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/irqdomain.h> +#include <linux/clk.h> #include <asm/mach/arch.h> @@ -35,6 +36,21 @@ static struct of_device_id omap_dt_match_table[] __initdata = { { } }; +/* + * Create alias for USB host PHY clock. + * Remove this when clock phandle can be provided via DT + */ +static void __init legacy_init_ehci_clk(char *clkname) +{ + int ret; + + ret = clk_add_alias("main_clk", NULL, clkname, NULL); + if (ret) { + pr_err("%s:Failed to add main_clk alias to %s :%d\n", + __func__, clkname, ret); + } +} + static void __init omap_generic_init(void) { omap_sdrc_init(NULL, NULL); @@ -45,10 +61,15 @@ static void __init omap_generic_init(void) * HACK: call display setup code for selected boards to enable omapdss. * This will be removed when omapdss supports DT. */ - if (of_machine_is_compatible("ti,omap4-panda")) + if (of_machine_is_compatible("ti,omap4-panda")) { omap4_panda_display_init_of(); + legacy_init_ehci_clk("auxclk3_ck"); + + } else if (of_machine_is_compatible("ti,omap4-sdp")) omap_4430sdp_display_init_of(); + else if (of_machine_is_compatible("ti,omap5-uevm")) + legacy_init_ehci_clk("auxclk1_ck"); } #ifdef CONFIG_SOC_OMAP2420 From 63b999685cb372e24eb73f255cd73547026370fd Mon Sep 17 00:00:00 2001 From: Theodore Ts'o <tytso@mit.edu> Date: Tue, 16 Jul 2013 10:28:47 -0400 Subject: [PATCH 159/913] ext4: call ext4_es_lru_add() after handling cache miss If there are no items in the extent status tree, ext4_es_lru_add() is a no-op. So it is not sufficient to call ext4_es_lru_add() before we try to lookup an entry in the extent status tree. We also need to call it at the end of ext4_ext_map_blocks(), after items have been added to the extent status tree. This could lead to inodes with that have extent status trees but which are not in the LRU list, which means they won't get considered for eviction by the es_shrinker. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: Zheng Liu <wenqing.lz@taobao.com> Cc: stable@vger.kernel.org --- fs/ext4/extents.c | 5 +++-- fs/ext4/inode.c | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index cfdc51e30257..a61873808f76 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4385,8 +4385,9 @@ out2: } out3: - trace_ext4_ext_map_blocks_exit(inode, flags, map, err ? err : allocated); - + trace_ext4_ext_map_blocks_exit(inode, flags, map, + err ? err : allocated); + ext4_es_lru_add(inode); return err ? err : allocated; } diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 98b9bff92a8a..ba33c67d6e48 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -514,10 +514,9 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, "logical block %lu\n", inode->i_ino, flags, map->m_len, (unsigned long) map->m_lblk); - ext4_es_lru_add(inode); - /* Lookup extent status tree firstly */ if (ext4_es_lookup_extent(inode, map->m_lblk, &es)) { + ext4_es_lru_add(inode); if (ext4_es_is_written(&es) || ext4_es_is_unwritten(&es)) { map->m_pblk = ext4_es_pblock(&es) + map->m_lblk - es.es_lblk; @@ -1529,11 +1528,9 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, "logical block %lu\n", inode->i_ino, map->m_len, (unsigned long) map->m_lblk); - ext4_es_lru_add(inode); - /* Lookup extent status tree firstly */ if (ext4_es_lookup_extent(inode, iblock, &es)) { - + ext4_es_lru_add(inode); if (ext4_es_is_hole(&es)) { retval = 0; down_read((&EXT4_I(inode)->i_data_sem)); From 5c9fc93bc9bc417418fc1b6366833ae6a07b804d Mon Sep 17 00:00:00 2001 From: Felix Fietkau <nbd@openwrt.org> Date: Mon, 15 Jul 2013 14:35:06 +0200 Subject: [PATCH 160/913] mac80211/minstrel: fix NULL pointer dereference issue When priv_sta == NULL, mi->prev_sample is dereferenced too early. Move the assignment further down, after the rate_control_send_low call. Reported-by: Krzysztof Mazur <krzysiek@podlesie.net> Cc: stable@vger.kernel.org # 3.10 Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- net/mac80211/rc80211_minstrel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index ac7ef5414bde..e6512e2ffd20 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c @@ -290,7 +290,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta, struct minstrel_rate *msr, *mr; unsigned int ndx; bool mrr_capable; - bool prev_sample = mi->prev_sample; + bool prev_sample; int delta; int sampling_ratio; @@ -314,6 +314,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta, (mi->sample_count + mi->sample_deferred / 2); /* delta < 0: no sampling required */ + prev_sample = mi->prev_sample; mi->prev_sample = false; if (delta < 0 || (!mrr_capable && prev_sample)) return; From 30f099cd88c8e92206c5e4ccf814ce0362db3d22 Mon Sep 17 00:00:00 2001 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Wed, 26 Jun 2013 09:58:16 +0800 Subject: [PATCH 161/913] ARM: edma: remove duplicated include from edma.c Remove duplicated include. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Sekhar Nori <nsekhar@ti.com> --- arch/arm/common/edma.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index a432e6c1dac1..39ad030ac0c7 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -26,7 +26,6 @@ #include <linux/io.h> #include <linux/slab.h> #include <linux/edma.h> -#include <linux/err.h> #include <linux/of_address.h> #include <linux/of_device.h> #include <linux/of_dma.h> From 9c559708b6cda71d8fdabc3f98cb7e98edbd4f0b Mon Sep 17 00:00:00 2001 From: Sekhar Nori <nsekhar@ti.com> Date: Fri, 12 Jul 2013 15:19:03 +0530 Subject: [PATCH 162/913] ARM: davinci: make file local variables static Make file local variables static in mach-davinci. This fixes sparse warnings of the form: arch/arm/mach-davinci/dm355.c:863:27: warning: symbol 'dm355_venc_pdata' was not declared. Should it be static? Cc: Prabhakar Lad <prabhakar.csengg@gmail.com> Acked-by: Prabhakar Lad <prabhakar.csengg@gmail.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com> --- arch/arm/mach-davinci/board-dm365-evm.c | 2 +- arch/arm/mach-davinci/dm355.c | 2 +- arch/arm/mach-davinci/dm365.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index afbc439f11d4..4cdb61c54459 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c @@ -505,7 +505,7 @@ static struct vpbe_output dm365evm_vpbe_outputs[] = { /* * Amplifiers on the board */ -struct ths7303_platform_data ths7303_pdata = { +static struct ths7303_platform_data ths7303_pdata = { .ch_1 = 3, .ch_2 = 3, .ch_3 = 3, diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index 42ef53f62c6c..86100d179694 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c @@ -860,7 +860,7 @@ static struct platform_device dm355_vpbe_display = { }, }; -struct venc_platform_data dm355_venc_pdata = { +static struct venc_platform_data dm355_venc_pdata = { .setup_pinmux = dm355_vpbe_setup_pinmux, .setup_clock = dm355_venc_setup_clock, }; diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index fa7af5eda52d..dad28029ba9b 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c @@ -1349,7 +1349,7 @@ static struct platform_device dm365_vpbe_display = { }, }; -struct venc_platform_data dm365_venc_pdata = { +static struct venc_platform_data dm365_venc_pdata = { .setup_pinmux = dm365_vpbe_setup_pinmux, .setup_clock = dm365_venc_setup_clock, }; From cf690331642010a837c026088588761f61528ddf Mon Sep 17 00:00:00 2001 From: Sekhar Nori <nsekhar@ti.com> Date: Fri, 12 Jul 2013 19:19:59 +0530 Subject: [PATCH 163/913] ARM: davinci: defconfig: enable EDMA driver Enable EDMA dmaengine driver by default in DaVinci defconfig files as it is required for DMA support on MMC/SD, SPI etc. Signed-off-by: Sekhar Nori <nsekhar@ti.com> --- arch/arm/configs/da8xx_omapl_defconfig | 2 ++ arch/arm/configs/davinci_all_defconfig | 2 ++ 2 files changed, 4 insertions(+) diff --git a/arch/arm/configs/da8xx_omapl_defconfig b/arch/arm/configs/da8xx_omapl_defconfig index 7c868139bdb0..1571bea48bed 100644 --- a/arch/arm/configs/da8xx_omapl_defconfig +++ b/arch/arm/configs/da8xx_omapl_defconfig @@ -102,6 +102,8 @@ CONFIG_SND_SOC=m CONFIG_SND_DAVINCI_SOC=m # CONFIG_HID_SUPPORT is not set # CONFIG_USB_SUPPORT is not set +CONFIG_DMADEVICES=y +CONFIG_TI_EDMA=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y CONFIG_XFS_FS=m diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig index c86fd75e181a..ab2f7378352c 100644 --- a/arch/arm/configs/davinci_all_defconfig +++ b/arch/arm/configs/davinci_all_defconfig @@ -162,6 +162,8 @@ CONFIG_LEDS_TRIGGERS=y CONFIG_LEDS_TRIGGER_TIMER=m CONFIG_LEDS_TRIGGER_HEARTBEAT=m CONFIG_RTC_CLASS=y +CONFIG_DMADEVICES=y +CONFIG_TI_EDMA=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y CONFIG_XFS_FS=m From 46a5905e1cd4a9d9d238ec7beece49ce49e2ad85 Mon Sep 17 00:00:00 2001 From: Shawn Guo <shawn.guo@linaro.org> Date: Tue, 16 Jul 2013 09:17:27 +0800 Subject: [PATCH 164/913] ASoC: sgtl5000: defer the probe if clock is not found It's not always the case that clock is already available when sgtl5000 get probed at the first time, e.g. the clock is provided by CPU DAI which may be probed after sgtl5000. So let's defer the probe when devm_clk_get() call fails and give it chance to try later. It fixes the regression on imx28 since commit 9e13f34 (ASoC: sgtl5000: Let the codec acquire its clock). [ 1.927637] sgtl5000 0-000a: Failed to get mclock: -2 [ 1.934280] sgtl5000: probe of 0-000a failed with error -2 [ 1.945906] mxs-sgtl5000 sound.13: ASoC: CODEC (null) not registered [ 1.953787] mxs-sgtl5000 sound.13: snd_soc_register_card failed (-517) [ 1.960865] platform sound.13: Driver mxs-sgtl5000 requests probe deferral Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org> --- sound/soc/codecs/sgtl5000.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index d659d3adcfb3..6c8a9e7bee25 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1527,6 +1527,9 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, if (IS_ERR(sgtl5000->mclk)) { ret = PTR_ERR(sgtl5000->mclk); dev_err(&client->dev, "Failed to get mclock: %d\n", ret); + /* Defer the probe to see if the clk will be provided later */ + if (ret == -ENOENT) + return -EPROBE_DEFER; return ret; } From 3715534adf899bfc842868865f13a001b8aa4692 Mon Sep 17 00:00:00 2001 From: Paul Bolle <pebolle@tiscali.nl> Date: Sun, 14 Jul 2013 14:02:19 +0200 Subject: [PATCH 165/913] cpufreq: s3c24xx: fix "depends on ARM_S3C24XX" in Kconfig Kconfig symbol S3C24XX_PLL depends on ARM_S3C24XX. But that symbol doesn't exist. Commit f023f8dd59bf ("cpufreq: s3c24xx: move cpufreq driver to drivers/cpufreq"), which added this issue, makes it clear that ARM_S3C24XX_CPUFREQ was intended here. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- arch/arm/mach-s3c24xx/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig index 6d9252e081ce..7791ac76f945 100644 --- a/arch/arm/mach-s3c24xx/Kconfig +++ b/arch/arm/mach-s3c24xx/Kconfig @@ -208,7 +208,7 @@ config S3C24XX_GPIO_EXTRA128 config S3C24XX_PLL bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)" - depends on ARM_S3C24XX + depends on ARM_S3C24XX_CPUFREQ help Compile in support for changing the PLL frequency from the S3C24XX series CPUfreq driver. The PLL takes time to settle From e8d05276f236ee6435e78411f62be9714e0b9377 Mon Sep 17 00:00:00 2001 From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com> Date: Tue, 16 Jul 2013 22:46:48 +0200 Subject: [PATCH 166/913] cpufreq: Revert commit 2f7021a8 to fix CPU hotplug regression commit 2f7021a8 "cpufreq: protect 'policy->cpus' from offlining during __gov_queue_work()" caused a regression in CPU hotplug, because it lead to a deadlock between cpufreq governor worker thread and the CPU hotplug writer task. Lockdep splat corresponding to this deadlock is shown below: [ 60.277396] ====================================================== [ 60.277400] [ INFO: possible circular locking dependency detected ] [ 60.277407] 3.10.0-rc7-dbg-01385-g241fd04-dirty #1744 Not tainted [ 60.277411] ------------------------------------------------------- [ 60.277417] bash/2225 is trying to acquire lock: [ 60.277422] ((&(&j_cdbs->work)->work)){+.+...}, at: [<ffffffff810621b5>] flush_work+0x5/0x280 [ 60.277444] but task is already holding lock: [ 60.277449] (cpu_hotplug.lock){+.+.+.}, at: [<ffffffff81042d8b>] cpu_hotplug_begin+0x2b/0x60 [ 60.277465] which lock already depends on the new lock. [ 60.277472] the existing dependency chain (in reverse order) is: [ 60.277477] -> #2 (cpu_hotplug.lock){+.+.+.}: [ 60.277490] [<ffffffff810ac6d4>] lock_acquire+0xa4/0x200 [ 60.277503] [<ffffffff815b6157>] mutex_lock_nested+0x67/0x410 [ 60.277514] [<ffffffff81042cbc>] get_online_cpus+0x3c/0x60 [ 60.277522] [<ffffffff814b842a>] gov_queue_work+0x2a/0xb0 [ 60.277532] [<ffffffff814b7891>] cs_dbs_timer+0xc1/0xe0 [ 60.277543] [<ffffffff8106302d>] process_one_work+0x1cd/0x6a0 [ 60.277552] [<ffffffff81063d31>] worker_thread+0x121/0x3a0 [ 60.277560] [<ffffffff8106ae2b>] kthread+0xdb/0xe0 [ 60.277569] [<ffffffff815bb96c>] ret_from_fork+0x7c/0xb0 [ 60.277580] -> #1 (&j_cdbs->timer_mutex){+.+...}: [ 60.277592] [<ffffffff810ac6d4>] lock_acquire+0xa4/0x200 [ 60.277600] [<ffffffff815b6157>] mutex_lock_nested+0x67/0x410 [ 60.277608] [<ffffffff814b785d>] cs_dbs_timer+0x8d/0xe0 [ 60.277616] [<ffffffff8106302d>] process_one_work+0x1cd/0x6a0 [ 60.277624] [<ffffffff81063d31>] worker_thread+0x121/0x3a0 [ 60.277633] [<ffffffff8106ae2b>] kthread+0xdb/0xe0 [ 60.277640] [<ffffffff815bb96c>] ret_from_fork+0x7c/0xb0 [ 60.277649] -> #0 ((&(&j_cdbs->work)->work)){+.+...}: [ 60.277661] [<ffffffff810ab826>] __lock_acquire+0x1766/0x1d30 [ 60.277669] [<ffffffff810ac6d4>] lock_acquire+0xa4/0x200 [ 60.277677] [<ffffffff810621ed>] flush_work+0x3d/0x280 [ 60.277685] [<ffffffff81062d8a>] __cancel_work_timer+0x8a/0x120 [ 60.277693] [<ffffffff81062e53>] cancel_delayed_work_sync+0x13/0x20 [ 60.277701] [<ffffffff814b89d9>] cpufreq_governor_dbs+0x529/0x6f0 [ 60.277709] [<ffffffff814b76a7>] cs_cpufreq_governor_dbs+0x17/0x20 [ 60.277719] [<ffffffff814b5df8>] __cpufreq_governor+0x48/0x100 [ 60.277728] [<ffffffff814b6b80>] __cpufreq_remove_dev.isra.14+0x80/0x3c0 [ 60.277737] [<ffffffff815adc0d>] cpufreq_cpu_callback+0x38/0x4c [ 60.277747] [<ffffffff81071a4d>] notifier_call_chain+0x5d/0x110 [ 60.277759] [<ffffffff81071b0e>] __raw_notifier_call_chain+0xe/0x10 [ 60.277768] [<ffffffff815a0a68>] _cpu_down+0x88/0x330 [ 60.277779] [<ffffffff815a0d46>] cpu_down+0x36/0x50 [ 60.277788] [<ffffffff815a2748>] store_online+0x98/0xd0 [ 60.277796] [<ffffffff81452a28>] dev_attr_store+0x18/0x30 [ 60.277806] [<ffffffff811d9edb>] sysfs_write_file+0xdb/0x150 [ 60.277818] [<ffffffff8116806d>] vfs_write+0xbd/0x1f0 [ 60.277826] [<ffffffff811686fc>] SyS_write+0x4c/0xa0 [ 60.277834] [<ffffffff815bbbbe>] tracesys+0xd0/0xd5 [ 60.277842] other info that might help us debug this: [ 60.277848] Chain exists of: (&(&j_cdbs->work)->work) --> &j_cdbs->timer_mutex --> cpu_hotplug.lock [ 60.277864] Possible unsafe locking scenario: [ 60.277869] CPU0 CPU1 [ 60.277873] ---- ---- [ 60.277877] lock(cpu_hotplug.lock); [ 60.277885] lock(&j_cdbs->timer_mutex); [ 60.277892] lock(cpu_hotplug.lock); [ 60.277900] lock((&(&j_cdbs->work)->work)); [ 60.277907] *** DEADLOCK *** [ 60.277915] 6 locks held by bash/2225: [ 60.277919] #0: (sb_writers#6){.+.+.+}, at: [<ffffffff81168173>] vfs_write+0x1c3/0x1f0 [ 60.277937] #1: (&buffer->mutex){+.+.+.}, at: [<ffffffff811d9e3c>] sysfs_write_file+0x3c/0x150 [ 60.277954] #2: (s_active#61){.+.+.+}, at: [<ffffffff811d9ec3>] sysfs_write_file+0xc3/0x150 [ 60.277972] #3: (x86_cpu_hotplug_driver_mutex){+.+...}, at: [<ffffffff81024cf7>] cpu_hotplug_driver_lock+0x17/0x20 [ 60.277990] #4: (cpu_add_remove_lock){+.+.+.}, at: [<ffffffff815a0d32>] cpu_down+0x22/0x50 [ 60.278007] #5: (cpu_hotplug.lock){+.+.+.}, at: [<ffffffff81042d8b>] cpu_hotplug_begin+0x2b/0x60 [ 60.278023] stack backtrace: [ 60.278031] CPU: 3 PID: 2225 Comm: bash Not tainted 3.10.0-rc7-dbg-01385-g241fd04-dirty #1744 [ 60.278037] Hardware name: Acer Aspire 5741G /Aspire 5741G , BIOS V1.20 02/08/2011 [ 60.278042] ffffffff8204e110 ffff88014df6b9f8 ffffffff815b3d90 ffff88014df6ba38 [ 60.278055] ffffffff815b0a8d ffff880150ed3f60 ffff880150ed4770 3871c4002c8980b2 [ 60.278068] ffff880150ed4748 ffff880150ed4770 ffff880150ed3f60 ffff88014df6bb00 [ 60.278081] Call Trace: [ 60.278091] [<ffffffff815b3d90>] dump_stack+0x19/0x1b [ 60.278101] [<ffffffff815b0a8d>] print_circular_bug+0x2b6/0x2c5 [ 60.278111] [<ffffffff810ab826>] __lock_acquire+0x1766/0x1d30 [ 60.278123] [<ffffffff81067e08>] ? __kernel_text_address+0x58/0x80 [ 60.278134] [<ffffffff810ac6d4>] lock_acquire+0xa4/0x200 [ 60.278142] [<ffffffff810621b5>] ? flush_work+0x5/0x280 [ 60.278151] [<ffffffff810621ed>] flush_work+0x3d/0x280 [ 60.278159] [<ffffffff810621b5>] ? flush_work+0x5/0x280 [ 60.278169] [<ffffffff810a9b14>] ? mark_held_locks+0x94/0x140 [ 60.278178] [<ffffffff81062d77>] ? __cancel_work_timer+0x77/0x120 [ 60.278188] [<ffffffff810a9cbd>] ? trace_hardirqs_on_caller+0xfd/0x1c0 [ 60.278196] [<ffffffff81062d8a>] __cancel_work_timer+0x8a/0x120 [ 60.278206] [<ffffffff81062e53>] cancel_delayed_work_sync+0x13/0x20 [ 60.278214] [<ffffffff814b89d9>] cpufreq_governor_dbs+0x529/0x6f0 [ 60.278225] [<ffffffff814b76a7>] cs_cpufreq_governor_dbs+0x17/0x20 [ 60.278234] [<ffffffff814b5df8>] __cpufreq_governor+0x48/0x100 [ 60.278244] [<ffffffff814b6b80>] __cpufreq_remove_dev.isra.14+0x80/0x3c0 [ 60.278255] [<ffffffff815adc0d>] cpufreq_cpu_callback+0x38/0x4c [ 60.278265] [<ffffffff81071a4d>] notifier_call_chain+0x5d/0x110 [ 60.278275] [<ffffffff81071b0e>] __raw_notifier_call_chain+0xe/0x10 [ 60.278284] [<ffffffff815a0a68>] _cpu_down+0x88/0x330 [ 60.278292] [<ffffffff81024cf7>] ? cpu_hotplug_driver_lock+0x17/0x20 [ 60.278302] [<ffffffff815a0d46>] cpu_down+0x36/0x50 [ 60.278311] [<ffffffff815a2748>] store_online+0x98/0xd0 [ 60.278320] [<ffffffff81452a28>] dev_attr_store+0x18/0x30 [ 60.278329] [<ffffffff811d9edb>] sysfs_write_file+0xdb/0x150 [ 60.278337] [<ffffffff8116806d>] vfs_write+0xbd/0x1f0 [ 60.278347] [<ffffffff81185950>] ? fget_light+0x320/0x4b0 [ 60.278355] [<ffffffff811686fc>] SyS_write+0x4c/0xa0 [ 60.278364] [<ffffffff815bbbbe>] tracesys+0xd0/0xd5 [ 60.280582] smpboot: CPU 1 is now offline The intention of that commit was to avoid warnings during CPU hotplug, which indicated that offline CPUs were getting IPIs from the cpufreq governor's work items. But the real root-cause of that problem was commit a66b2e5 (cpufreq: Preserve sysfs files across suspend/resume) because it totally skipped all the cpufreq callbacks during CPU hotplug in the suspend/resume path, and hence it never actually shut down the cpufreq governor's worker threads during CPU offline in the suspend/resume path. Reflecting back, the reason why we never suspected that commit as the root-cause earlier, was that the original issue was reported with just the halt command and nobody had brought in suspend/resume to the equation. The reason for _that_ in turn, as it turns out, is that earlier halt/shutdown was being done by disabling non-boot CPUs while tasks were frozen, just like suspend/resume.... but commit cf7df378a (reboot: migrate shutdown/reboot to boot cpu) which came somewhere along that very same time changed that logic: shutdown/halt no longer takes CPUs offline. Thus, the test-cases for reproducing the bug were vastly different and thus we went totally off the trail. Overall, it was one hell of a confusion with so many commits affecting each other and also affecting the symptoms of the problems in subtle ways. Finally, now since the original problematic commit (a66b2e5) has been completely reverted, revert this intermediate fix too (2f7021a8), to fix the CPU hotplug deadlock. Phew! Reported-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Tested-by: Peter Wu <lekensteyn@gmail.com> Cc: 3.10+ <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/cpufreq/cpufreq_governor.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 464587697561..7b839a8db2a7 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -25,7 +25,6 @@ #include <linux/slab.h> #include <linux/types.h> #include <linux/workqueue.h> -#include <linux/cpu.h> #include "cpufreq_governor.h" @@ -137,10 +136,8 @@ void gov_queue_work(struct dbs_data *dbs_data, struct cpufreq_policy *policy, if (!all_cpus) { __gov_queue_work(smp_processor_id(), dbs_data, delay); } else { - get_online_cpus(); for_each_cpu(i, policy->cpus) __gov_queue_work(i, dbs_data, delay); - put_online_cpus(); } } EXPORT_SYMBOL_GPL(gov_queue_work); From 36ff66db3fb5642906e46e73ca9cf92f1c5974ff Mon Sep 17 00:00:00 2001 From: Alan Stern <stern@rowland.harvard.edu> Date: Thu, 27 Jun 2013 15:27:07 -0400 Subject: [PATCH 167/913] USB: move the definition of USB_MAXCHILDREN The USB_MAXCHILDREN symbol is used in include/uapi/linux/usb/ch11.h, a user-mode header, even though it is defined in include/linux/usb.h, which is kernel-only. This causes compile-time errors when user programs try to #include linux/usb/ch11.h. This patch fixes the problem by moving the definition of USB_MAXCHILDREN into ch11.h. It also gets rid of unneeded parentheses. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- include/linux/usb.h | 11 ----------- include/uapi/linux/usb/ch11.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/linux/usb.h b/include/linux/usb.h index a232b7ece1f6..0eec2689b955 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -367,17 +367,6 @@ struct usb_bus { /* ----------------------------------------------------------------------- */ -/* This is arbitrary. - * From USB 2.0 spec Table 11-13, offset 7, a hub can - * have up to 255 ports. The most yet reported is 10. - * - * Current Wireless USB host hardware (Intel i1480 for example) allows - * up to 22 devices to connect. Upcoming hardware might raise that - * limit. Because the arrays need to add a bit for hub status data, we - * do 31, so plus one evens out to four bytes. - */ -#define USB_MAXCHILDREN (31) - struct usb_tt; enum usb_device_removable { diff --git a/include/uapi/linux/usb/ch11.h b/include/uapi/linux/usb/ch11.h index 7692dc69ccf7..331499d597fa 100644 --- a/include/uapi/linux/usb/ch11.h +++ b/include/uapi/linux/usb/ch11.h @@ -11,6 +11,17 @@ #include <linux/types.h> /* __u8 etc */ +/* This is arbitrary. + * From USB 2.0 spec Table 11-13, offset 7, a hub can + * have up to 255 ports. The most yet reported is 10. + * + * Current Wireless USB host hardware (Intel i1480 for example) allows + * up to 22 devices to connect. Upcoming hardware might raise that + * limit. Because the arrays need to add a bit for hub status data, we + * use 31, so plus one evens out to four bytes. + */ +#define USB_MAXCHILDREN 31 + /* * Hub request types */ From e583d9db9960cf40e0bc8afee4946baa9d71596e Mon Sep 17 00:00:00 2001 From: Alan Stern <stern@rowland.harvard.edu> Date: Thu, 11 Jul 2013 14:58:04 -0400 Subject: [PATCH 168/913] USB: global suspend and remote wakeup don't mix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hub driver was recently changed to use "global" suspend for system suspend transitions on non-SuperSpeed buses. This means that we don't suspend devices individually by setting the suspend feature on the upstream hub port; instead devices all go into suspend automatically when the root hub stops transmitting packets. The idea was to save time and to avoid certain kinds of wakeup races. Now it turns out that many hubs are buggy; they don't relay wakeup requests from a downstream port to their upstream port if the downstream port's suspend feature is not set (depending on the speed of the downstream port, whether or not the hub is enabled for remote wakeup, and possibly other factors). We can't have hubs dropping wakeup requests. Therefore this patch goes partway back to the old policy: It sets the suspend feature for a port if the device attached to that port or any of its descendants is enabled for wakeup. People will still be able to benefit from the time savings if they don't care about wakeup and leave it disabled on all their devices. In order to accomplish this, the patch adds a new field to the usb_hub structure: wakeup_enabled_descendants is a count of how many devices below a suspended hub are enabled for remote wakeup. A corresponding new subroutine determines the number of wakeup-enabled devices at or below an arbitrary suspended USB device. This should be applied to the 3.10 stable kernel. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Reported-and-tested-by: Toralf Förster <toralf.foerster@gmx.de> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/core/hub.c | 39 +++++++++++++++++++++++++++++++-------- drivers/usb/core/hub.h | 3 +++ 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 4191db32f12c..c857471519e3 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2848,6 +2848,15 @@ static int usb_disable_function_remotewakeup(struct usb_device *udev) USB_CTRL_SET_TIMEOUT); } +/* Count of wakeup-enabled devices at or below udev */ +static unsigned wakeup_enabled_descendants(struct usb_device *udev) +{ + struct usb_hub *hub = usb_hub_to_struct_hub(udev); + + return udev->do_remote_wakeup + + (hub ? hub->wakeup_enabled_descendants : 0); +} + /* * usb_port_suspend - suspend a usb device's upstream port * @udev: device that's no longer in active use, not a root hub @@ -2888,8 +2897,8 @@ static int usb_disable_function_remotewakeup(struct usb_device *udev) * Linux (2.6) currently has NO mechanisms to initiate that: no khubd * timer, no SRP, no requests through sysfs. * - * If Runtime PM isn't enabled or used, non-SuperSpeed devices really get - * suspended only when their bus goes into global suspend (i.e., the root + * If Runtime PM isn't enabled or used, non-SuperSpeed devices may not get + * suspended until their bus goes into global suspend (i.e., the root * hub is suspended). Nevertheless, we change @udev->state to * USB_STATE_SUSPENDED as this is the device's "logical" state. The actual * upstream port setting is stored in @udev->port_is_suspended. @@ -2960,15 +2969,21 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) /* see 7.1.7.6 */ if (hub_is_superspeed(hub->hdev)) status = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_U3); - else if (PMSG_IS_AUTO(msg)) - status = set_port_feature(hub->hdev, port1, - USB_PORT_FEAT_SUSPEND); + /* * For system suspend, we do not need to enable the suspend feature * on individual USB-2 ports. The devices will automatically go * into suspend a few ms after the root hub stops sending packets. * The USB 2.0 spec calls this "global suspend". + * + * However, many USB hubs have a bug: They don't relay wakeup requests + * from a downstream port if the port's suspend feature isn't on. + * Therefore we will turn on the suspend feature if udev or any of its + * descendants is enabled for remote wakeup. */ + else if (PMSG_IS_AUTO(msg) || wakeup_enabled_descendants(udev) > 0) + status = set_port_feature(hub->hdev, port1, + USB_PORT_FEAT_SUSPEND); else { really_suspend = false; status = 0; @@ -3003,15 +3018,16 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) if (!PMSG_IS_AUTO(msg)) status = 0; } else { - /* device has up to 10 msec to fully suspend */ dev_dbg(&udev->dev, "usb %ssuspend, wakeup %d\n", (PMSG_IS_AUTO(msg) ? "auto-" : ""), udev->do_remote_wakeup); - usb_set_device_state(udev, USB_STATE_SUSPENDED); if (really_suspend) { udev->port_is_suspended = 1; + + /* device has up to 10 msec to fully suspend */ msleep(10); } + usb_set_device_state(udev, USB_STATE_SUSPENDED); } /* @@ -3293,7 +3309,11 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg) unsigned port1; int status; - /* Warn if children aren't already suspended */ + /* + * Warn if children aren't already suspended. + * Also, add up the number of wakeup-enabled descendants. + */ + hub->wakeup_enabled_descendants = 0; for (port1 = 1; port1 <= hdev->maxchild; port1++) { struct usb_device *udev; @@ -3303,6 +3323,9 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg) if (PMSG_IS_AUTO(msg)) return -EBUSY; } + if (udev) + hub->wakeup_enabled_descendants += + wakeup_enabled_descendants(udev); } if (hdev->do_remote_wakeup && hub->quirk_check_port_auto_suspend) { diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 6508e02b3dac..4e4790dea343 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -59,6 +59,9 @@ struct usb_hub { struct usb_tt tt; /* Transaction Translator */ unsigned mA_per_port; /* current for each child */ +#ifdef CONFIG_PM + unsigned wakeup_enabled_descendants; +#endif unsigned limited_power:1; unsigned quiescing:1; From ade7615de0643a9da628688e661e08148cd7c463 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Date: Tue, 16 Jul 2013 22:37:09 -0700 Subject: [PATCH 169/913] staging: csr: remove driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This driver is not being updated as the specifications are not able to be gotten from CSR or anyone else. Without those, getting this driver into proper mergable shape is going to be impossible. So remove the driver from the tree. If the specifications ever become available, this patch can be reverted and the driver fixed up properly. Reported-by: Lidza Louina <lidza.louina@gmail.com> Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com> Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com> Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com> Cc: Riku Mettälä <riku.mettala@bluegiga.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - drivers/staging/csr/Kconfig | 9 - drivers/staging/csr/LICENSE.txt | 39 - drivers/staging/csr/Makefile | 73 - drivers/staging/csr/bh.c | 404 - drivers/staging/csr/csr_framework_ext.c | 40 - drivers/staging/csr/csr_framework_ext.h | 35 - drivers/staging/csr/csr_framework_ext_types.h | 30 - drivers/staging/csr/csr_log.h | 223 - drivers/staging/csr/csr_log_configure.h | 39 - drivers/staging/csr/csr_log_text.h | 124 - drivers/staging/csr/csr_macro.h | 39 - drivers/staging/csr/csr_msg_transport.h | 17 - drivers/staging/csr/csr_msgconv.c | 291 - drivers/staging/csr/csr_msgconv.h | 78 - drivers/staging/csr/csr_prim_defs.h | 55 - drivers/staging/csr/csr_result.h | 17 - drivers/staging/csr/csr_sched.h | 85 - drivers/staging/csr/csr_sdio.h | 723 -- .../csr/csr_serialize_primitive_types.c | 100 - drivers/staging/csr/csr_time.c | 33 - drivers/staging/csr/csr_time.h | 76 - drivers/staging/csr/csr_util.c | 15 - drivers/staging/csr/csr_wifi_common.h | 101 - drivers/staging/csr/csr_wifi_fsm.h | 240 - drivers/staging/csr/csr_wifi_fsm_event.h | 42 - drivers/staging/csr/csr_wifi_fsm_types.h | 430 -- drivers/staging/csr/csr_wifi_hip_card.h | 114 - drivers/staging/csr/csr_wifi_hip_card_sdio.c | 4001 ---------- drivers/staging/csr/csr_wifi_hip_card_sdio.h | 694 -- .../staging/csr/csr_wifi_hip_card_sdio_intr.c | 2595 ------- .../staging/csr/csr_wifi_hip_card_sdio_mem.c | 1713 ----- drivers/staging/csr/csr_wifi_hip_chiphelper.c | 793 -- drivers/staging/csr/csr_wifi_hip_chiphelper.h | 407 -- .../csr/csr_wifi_hip_chiphelper_private.h | 200 - .../staging/csr/csr_wifi_hip_conversions.h | 73 - drivers/staging/csr/csr_wifi_hip_download.c | 819 --- drivers/staging/csr/csr_wifi_hip_dump.c | 837 --- drivers/staging/csr/csr_wifi_hip_packing.c | 4804 ------------ drivers/staging/csr/csr_wifi_hip_send.c | 415 -- drivers/staging/csr/csr_wifi_hip_signals.c | 1313 ---- drivers/staging/csr/csr_wifi_hip_signals.h | 128 - drivers/staging/csr/csr_wifi_hip_sigs.h | 1417 ---- .../staging/csr/csr_wifi_hip_ta_sampling.c | 541 -- .../staging/csr/csr_wifi_hip_ta_sampling.h | 66 - drivers/staging/csr/csr_wifi_hip_udi.c | 173 - drivers/staging/csr/csr_wifi_hip_unifi.h | 871 --- .../csr/csr_wifi_hip_unifi_signal_names.c | 41 - drivers/staging/csr/csr_wifi_hip_unifi_udi.h | 52 - drivers/staging/csr/csr_wifi_hip_unifihw.h | 59 - .../staging/csr/csr_wifi_hip_unifiversion.h | 30 - drivers/staging/csr/csr_wifi_hip_xbv.c | 1076 --- drivers/staging/csr/csr_wifi_hip_xbv.h | 119 - drivers/staging/csr/csr_wifi_hostio_prim.h | 18 - drivers/staging/csr/csr_wifi_lib.h | 103 - drivers/staging/csr/csr_wifi_msgconv.h | 49 - .../csr/csr_wifi_nme_ap_converter_init.c | 90 - .../csr/csr_wifi_nme_ap_converter_init.h | 41 - ...csr_wifi_nme_ap_free_downstream_contents.c | 84 - .../csr_wifi_nme_ap_free_upstream_contents.c | 39 - drivers/staging/csr/csr_wifi_nme_ap_lib.h | 495 -- drivers/staging/csr/csr_wifi_nme_ap_prim.h | 494 -- drivers/staging/csr/csr_wifi_nme_ap_sef.c | 30 - drivers/staging/csr/csr_wifi_nme_ap_sef.h | 21 - .../staging/csr/csr_wifi_nme_ap_serialize.c | 909 --- .../staging/csr/csr_wifi_nme_ap_serialize.h | 94 - .../staging/csr/csr_wifi_nme_converter_init.h | 38 - drivers/staging/csr/csr_wifi_nme_lib.h | 991 --- drivers/staging/csr/csr_wifi_nme_prim.h | 1657 ----- drivers/staging/csr/csr_wifi_nme_serialize.h | 166 - drivers/staging/csr/csr_wifi_nme_task.h | 27 - drivers/staging/csr/csr_wifi_private_common.h | 81 - drivers/staging/csr/csr_wifi_result.h | 27 - .../csr/csr_wifi_router_converter_init.c | 82 - .../csr/csr_wifi_router_converter_init.h | 34 - .../csr/csr_wifi_router_ctrl_converter_init.c | 134 - .../csr/csr_wifi_router_ctrl_converter_init.h | 34 - ...ifi_router_ctrl_free_downstream_contents.c | 108 - ..._wifi_router_ctrl_free_upstream_contents.c | 87 - .../staging/csr/csr_wifi_router_ctrl_lib.h | 2082 ------ .../staging/csr/csr_wifi_router_ctrl_prim.h | 2113 ------ .../staging/csr/csr_wifi_router_ctrl_sef.c | 46 - .../staging/csr/csr_wifi_router_ctrl_sef.h | 51 - .../csr/csr_wifi_router_ctrl_serialize.c | 2591 ------- .../csr/csr_wifi_router_ctrl_serialize.h | 333 - ...csr_wifi_router_free_downstream_contents.c | 53 - .../csr_wifi_router_free_upstream_contents.c | 47 - drivers/staging/csr/csr_wifi_router_lib.h | 417 -- drivers/staging/csr/csr_wifi_router_prim.h | 421 -- drivers/staging/csr/csr_wifi_router_sef.c | 19 - drivers/staging/csr/csr_wifi_router_sef.h | 25 - .../staging/csr/csr_wifi_router_serialize.c | 418 -- .../staging/csr/csr_wifi_router_serialize.h | 67 - drivers/staging/csr/csr_wifi_router_task.h | 25 - .../staging/csr/csr_wifi_router_transport.c | 199 - .../csr/csr_wifi_serialize_primitive_types.c | 256 - drivers/staging/csr/csr_wifi_sme_ap_lib.h | 774 -- drivers/staging/csr/csr_wifi_sme_ap_prim.h | 1030 --- .../staging/csr/csr_wifi_sme_converter_init.c | 201 - .../staging/csr/csr_wifi_sme_converter_init.h | 34 - .../csr_wifi_sme_free_downstream_contents.c | 187 - .../csr/csr_wifi_sme_free_upstream_contents.c | 275 - drivers/staging/csr/csr_wifi_sme_lib.h | 4303 ----------- drivers/staging/csr/csr_wifi_sme_prim.h | 6510 ----------------- drivers/staging/csr/csr_wifi_sme_sef.c | 85 - drivers/staging/csr/csr_wifi_sme_sef.h | 142 - drivers/staging/csr/csr_wifi_sme_serialize.c | 5809 --------------- drivers/staging/csr/csr_wifi_sme_serialize.h | 666 -- drivers/staging/csr/csr_wifi_sme_task.h | 25 - drivers/staging/csr/csr_wifi_vif_utils.h | 27 - drivers/staging/csr/data_tx.c | 54 - drivers/staging/csr/drv.c | 2193 ------ drivers/staging/csr/firmware.c | 396 - drivers/staging/csr/inet.c | 104 - drivers/staging/csr/init_hw.c | 108 - drivers/staging/csr/io.c | 1098 --- drivers/staging/csr/mlme.c | 433 -- drivers/staging/csr/monitor.c | 384 - drivers/staging/csr/netdev.c | 3307 --------- drivers/staging/csr/os.c | 477 -- drivers/staging/csr/putest.c | 685 -- drivers/staging/csr/sdio_events.c | 134 - drivers/staging/csr/sdio_mmc.c | 1288 ---- drivers/staging/csr/sdio_stubs.c | 82 - drivers/staging/csr/sme_blocking.c | 1466 ---- drivers/staging/csr/sme_mgt.c | 1012 --- drivers/staging/csr/sme_native.c | 566 -- drivers/staging/csr/sme_sys.c | 3260 --------- drivers/staging/csr/sme_userspace.c | 315 - drivers/staging/csr/sme_userspace.h | 38 - drivers/staging/csr/sme_wext.c | 3327 --------- drivers/staging/csr/ul_int.c | 528 -- drivers/staging/csr/unifi_clients.h | 129 - drivers/staging/csr/unifi_config.h | 34 - drivers/staging/csr/unifi_dbg.c | 110 - drivers/staging/csr/unifi_event.c | 692 -- drivers/staging/csr/unifi_native.h | 257 - drivers/staging/csr/unifi_os.h | 122 - drivers/staging/csr/unifi_pdu_processing.c | 3729 ---------- drivers/staging/csr/unifi_priv.h | 1136 --- drivers/staging/csr/unifi_sme.c | 1225 ---- drivers/staging/csr/unifi_sme.h | 245 - drivers/staging/csr/unifi_wext.h | 108 - drivers/staging/csr/unifiio.h | 398 - drivers/staging/csr/wext_events.c | 283 - 146 files changed, 91599 deletions(-) delete mode 100644 drivers/staging/csr/Kconfig delete mode 100644 drivers/staging/csr/LICENSE.txt delete mode 100644 drivers/staging/csr/Makefile delete mode 100644 drivers/staging/csr/bh.c delete mode 100644 drivers/staging/csr/csr_framework_ext.c delete mode 100644 drivers/staging/csr/csr_framework_ext.h delete mode 100644 drivers/staging/csr/csr_framework_ext_types.h delete mode 100644 drivers/staging/csr/csr_log.h delete mode 100644 drivers/staging/csr/csr_log_configure.h delete mode 100644 drivers/staging/csr/csr_log_text.h delete mode 100644 drivers/staging/csr/csr_macro.h delete mode 100644 drivers/staging/csr/csr_msg_transport.h delete mode 100644 drivers/staging/csr/csr_msgconv.c delete mode 100644 drivers/staging/csr/csr_msgconv.h delete mode 100644 drivers/staging/csr/csr_prim_defs.h delete mode 100644 drivers/staging/csr/csr_result.h delete mode 100644 drivers/staging/csr/csr_sched.h delete mode 100644 drivers/staging/csr/csr_sdio.h delete mode 100644 drivers/staging/csr/csr_serialize_primitive_types.c delete mode 100644 drivers/staging/csr/csr_time.c delete mode 100644 drivers/staging/csr/csr_time.h delete mode 100644 drivers/staging/csr/csr_util.c delete mode 100644 drivers/staging/csr/csr_wifi_common.h delete mode 100644 drivers/staging/csr/csr_wifi_fsm.h delete mode 100644 drivers/staging/csr/csr_wifi_fsm_event.h delete mode 100644 drivers/staging/csr/csr_wifi_fsm_types.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_card.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_card_sdio.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_card_sdio.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_chiphelper.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_chiphelper.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_chiphelper_private.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_conversions.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_download.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_dump.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_packing.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_send.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_signals.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_signals.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_sigs.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_ta_sampling.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_ta_sampling.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_udi.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_unifi.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_unifi_udi.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_unifihw.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_unifiversion.h delete mode 100644 drivers/staging/csr/csr_wifi_hip_xbv.c delete mode 100644 drivers/staging/csr/csr_wifi_hip_xbv.h delete mode 100644 drivers/staging/csr/csr_wifi_hostio_prim.h delete mode 100644 drivers/staging/csr/csr_wifi_lib.h delete mode 100644 drivers/staging/csr/csr_wifi_msgconv.h delete mode 100644 drivers/staging/csr/csr_wifi_nme_ap_converter_init.c delete mode 100644 drivers/staging/csr/csr_wifi_nme_ap_converter_init.h delete mode 100644 drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c delete mode 100644 drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c delete mode 100644 drivers/staging/csr/csr_wifi_nme_ap_lib.h delete mode 100644 drivers/staging/csr/csr_wifi_nme_ap_prim.h delete mode 100644 drivers/staging/csr/csr_wifi_nme_ap_sef.c delete mode 100644 drivers/staging/csr/csr_wifi_nme_ap_sef.h delete mode 100644 drivers/staging/csr/csr_wifi_nme_ap_serialize.c delete mode 100644 drivers/staging/csr/csr_wifi_nme_ap_serialize.h delete mode 100644 drivers/staging/csr/csr_wifi_nme_converter_init.h delete mode 100644 drivers/staging/csr/csr_wifi_nme_lib.h delete mode 100644 drivers/staging/csr/csr_wifi_nme_prim.h delete mode 100644 drivers/staging/csr/csr_wifi_nme_serialize.h delete mode 100644 drivers/staging/csr/csr_wifi_nme_task.h delete mode 100644 drivers/staging/csr/csr_wifi_private_common.h delete mode 100644 drivers/staging/csr/csr_wifi_result.h delete mode 100644 drivers/staging/csr/csr_wifi_router_converter_init.c delete mode 100644 drivers/staging/csr/csr_wifi_router_converter_init.h delete mode 100644 drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c delete mode 100644 drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h delete mode 100644 drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c delete mode 100644 drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c delete mode 100644 drivers/staging/csr/csr_wifi_router_ctrl_lib.h delete mode 100644 drivers/staging/csr/csr_wifi_router_ctrl_prim.h delete mode 100644 drivers/staging/csr/csr_wifi_router_ctrl_sef.c delete mode 100644 drivers/staging/csr/csr_wifi_router_ctrl_sef.h delete mode 100644 drivers/staging/csr/csr_wifi_router_ctrl_serialize.c delete mode 100644 drivers/staging/csr/csr_wifi_router_ctrl_serialize.h delete mode 100644 drivers/staging/csr/csr_wifi_router_free_downstream_contents.c delete mode 100644 drivers/staging/csr/csr_wifi_router_free_upstream_contents.c delete mode 100644 drivers/staging/csr/csr_wifi_router_lib.h delete mode 100644 drivers/staging/csr/csr_wifi_router_prim.h delete mode 100644 drivers/staging/csr/csr_wifi_router_sef.c delete mode 100644 drivers/staging/csr/csr_wifi_router_sef.h delete mode 100644 drivers/staging/csr/csr_wifi_router_serialize.c delete mode 100644 drivers/staging/csr/csr_wifi_router_serialize.h delete mode 100644 drivers/staging/csr/csr_wifi_router_task.h delete mode 100644 drivers/staging/csr/csr_wifi_router_transport.c delete mode 100644 drivers/staging/csr/csr_wifi_serialize_primitive_types.c delete mode 100644 drivers/staging/csr/csr_wifi_sme_ap_lib.h delete mode 100644 drivers/staging/csr/csr_wifi_sme_ap_prim.h delete mode 100644 drivers/staging/csr/csr_wifi_sme_converter_init.c delete mode 100644 drivers/staging/csr/csr_wifi_sme_converter_init.h delete mode 100644 drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c delete mode 100644 drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c delete mode 100644 drivers/staging/csr/csr_wifi_sme_lib.h delete mode 100644 drivers/staging/csr/csr_wifi_sme_prim.h delete mode 100644 drivers/staging/csr/csr_wifi_sme_sef.c delete mode 100644 drivers/staging/csr/csr_wifi_sme_sef.h delete mode 100644 drivers/staging/csr/csr_wifi_sme_serialize.c delete mode 100644 drivers/staging/csr/csr_wifi_sme_serialize.h delete mode 100644 drivers/staging/csr/csr_wifi_sme_task.h delete mode 100644 drivers/staging/csr/csr_wifi_vif_utils.h delete mode 100644 drivers/staging/csr/data_tx.c delete mode 100644 drivers/staging/csr/drv.c delete mode 100644 drivers/staging/csr/firmware.c delete mode 100644 drivers/staging/csr/inet.c delete mode 100644 drivers/staging/csr/init_hw.c delete mode 100644 drivers/staging/csr/io.c delete mode 100644 drivers/staging/csr/mlme.c delete mode 100644 drivers/staging/csr/monitor.c delete mode 100644 drivers/staging/csr/netdev.c delete mode 100644 drivers/staging/csr/os.c delete mode 100644 drivers/staging/csr/putest.c delete mode 100644 drivers/staging/csr/sdio_events.c delete mode 100644 drivers/staging/csr/sdio_mmc.c delete mode 100644 drivers/staging/csr/sdio_stubs.c delete mode 100644 drivers/staging/csr/sme_blocking.c delete mode 100644 drivers/staging/csr/sme_mgt.c delete mode 100644 drivers/staging/csr/sme_native.c delete mode 100644 drivers/staging/csr/sme_sys.c delete mode 100644 drivers/staging/csr/sme_userspace.c delete mode 100644 drivers/staging/csr/sme_userspace.h delete mode 100644 drivers/staging/csr/sme_wext.c delete mode 100644 drivers/staging/csr/ul_int.c delete mode 100644 drivers/staging/csr/unifi_clients.h delete mode 100644 drivers/staging/csr/unifi_config.h delete mode 100644 drivers/staging/csr/unifi_dbg.c delete mode 100644 drivers/staging/csr/unifi_event.c delete mode 100644 drivers/staging/csr/unifi_native.h delete mode 100644 drivers/staging/csr/unifi_os.h delete mode 100644 drivers/staging/csr/unifi_pdu_processing.c delete mode 100644 drivers/staging/csr/unifi_priv.h delete mode 100644 drivers/staging/csr/unifi_sme.c delete mode 100644 drivers/staging/csr/unifi_sme.h delete mode 100644 drivers/staging/csr/unifi_wext.h delete mode 100644 drivers/staging/csr/unifiio.h delete mode 100644 drivers/staging/csr/wext_events.c diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 3227ebeae3f1..57d8b3444600 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -118,8 +118,6 @@ source "drivers/staging/ozwpan/Kconfig" source "drivers/staging/gdm72xx/Kconfig" -source "drivers/staging/csr/Kconfig" - source "drivers/staging/silicom/Kconfig" source "drivers/staging/ced1401/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 4d79ebe2de06..429321f15105 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -52,7 +52,6 @@ obj-$(CONFIG_MFD_NVEC) += nvec/ obj-$(CONFIG_ANDROID) += android/ obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/ obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/ -obj-$(CONFIG_CSR_WIFI) += csr/ obj-$(CONFIG_NET_VENDOR_SILICOM) += silicom/ obj-$(CONFIG_CED1401) += ced1401/ obj-$(CONFIG_DRM_IMX) += imx-drm/ diff --git a/drivers/staging/csr/Kconfig b/drivers/staging/csr/Kconfig deleted file mode 100644 index ad2a1096e920..000000000000 --- a/drivers/staging/csr/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -config CSR_WIFI - tristate "CSR wireless driver" - depends on MMC && CFG80211_WEXT && INET - select WIRELESS_EXT - select WEXT_PRIV - help - Driver for the CSR wireless SDIO device. - - If unsure, select N. diff --git a/drivers/staging/csr/LICENSE.txt b/drivers/staging/csr/LICENSE.txt deleted file mode 100644 index 364853e5fedc..000000000000 --- a/drivers/staging/csr/LICENSE.txt +++ /dev/null @@ -1,39 +0,0 @@ -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -Except as contained in this notice, the names of above-listed -copyright holders and the names of any contributors shall not be used -in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR -CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -Alternatively, this software may be distributed under the terms of the -GNU General Public License ("GPL") version 2 as published -by the Free Software Foundation. - -As a special exception, if other files instantiate templates or use -macros or inline functions from this file, or you compile this file -and link it with other works to produce a work based on this file, -this file does not by itself cause the resulting work to be covered by -the GNU General Public License. However the source code for this file -must still be made available in accordance with section (3) of the GNU -General Public License. - -This exception does not invalidate any other reasons why a work based -on this file might be covered by the GNU General Public License. diff --git a/drivers/staging/csr/Makefile b/drivers/staging/csr/Makefile deleted file mode 100644 index dbd135a8b177..000000000000 --- a/drivers/staging/csr/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -ccflags-y := -DCSR_SME_USERSPACE -DCSR_SUPPORT_SME -DREMOTE_SYS_SAP -DCSR_WIFI_SECURITY_WAPI_ENABLE -DENABLE_SHUTDOWN -DUNIFI_DEBUG -ccflags-y += -DSDIO_EXPORTS_STRUCT_DEVICE -DCSR_WIFI_SUPPORT_MMC_DRIVER -DCSR_WIFI_SINGLE_FUNCTION -DCSR_WIFI_SPLIT_PATCH -ccflags-y += -DCSR_SUPPORT_WEXT -DREMOTE_SYS_SAP -DREMOTE_MGT_SAP -DCSR_WIFI_SECURITY_WAPI_ENABLE -DCSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND -DENABLE_SHUTDOWN -DCSR_WIFI_NME_ENABLE -DCSR_WIFI_AP_ENABLE -DCSR_SUPPORT_WEXT_AP -DCSR_WIFI_REQUEUE_PACKET_TO_HAL - -obj-$(CONFIG_CSR_WIFI) += csr_wifi.o -obj-$(CONFIG_CSR_WIFI) += csr_helper.o - -csr_wifi-y := bh.o \ - data_tx.o \ - drv.o \ - firmware.o \ - inet.o \ - init_hw.o \ - io.o \ - monitor.o \ - netdev.o \ - os.o \ - putest.o \ - sdio_events.o \ - sdio_mmc.o \ - sdio_stubs.o \ - sme_blocking.o \ - ul_int.o \ - unifi_dbg.o \ - unifi_event.o \ - unifi_pdu_processing.o \ - unifi_sme.o \ - csr_wifi_hip_card_sdio.o \ - csr_wifi_hip_card_sdio_intr.o \ - csr_wifi_hip_card_sdio_mem.o \ - csr_wifi_hip_chiphelper.o \ - csr_wifi_hip_download.o \ - csr_wifi_hip_dump.o \ - csr_wifi_hip_packing.o \ - csr_wifi_hip_send.o \ - csr_wifi_hip_signals.o \ - csr_wifi_hip_ta_sampling.o \ - csr_wifi_hip_udi.o \ - csr_wifi_hip_unifi_signal_names.o \ - csr_wifi_hip_xbv.o \ - csr_wifi_nme_ap_converter_init.o \ - csr_wifi_nme_ap_free_downstream_contents.o \ - csr_wifi_nme_ap_free_upstream_contents.o \ - csr_wifi_nme_ap_serialize.o \ - csr_wifi_nme_ap_sef.o \ - csr_wifi_router_ctrl_sef.o \ - csr_wifi_router_sef.o \ - csr_wifi_router_transport.o \ - csr_wifi_sme_sef.o \ - csr_wifi_sme_converter_init.o \ - csr_wifi_sme_free_downstream_contents.o \ - csr_wifi_sme_free_upstream_contents.o \ - csr_wifi_sme_serialize.o \ - csr_wifi_router_ctrl_converter_init.o \ - csr_wifi_router_ctrl_free_downstream_contents.o \ - csr_wifi_router_ctrl_free_upstream_contents.o \ - csr_wifi_router_ctrl_serialize.o \ - csr_wifi_router_converter_init.o \ - csr_wifi_router_free_downstream_contents.o \ - csr_wifi_router_free_upstream_contents.o \ - csr_wifi_router_serialize.o \ - sme_mgt.o \ - sme_sys.o \ - sme_userspace.o \ - sme_wext.o \ - wext_events.o - -csr_helper-y := csr_time.o \ - csr_util.o \ - csr_framework_ext.o \ - csr_wifi_serialize_primitive_types.o \ - csr_serialize_primitive_types.o \ - csr_msgconv.o diff --git a/drivers/staging/csr/bh.c b/drivers/staging/csr/bh.c deleted file mode 100644 index d795852ccb1c..000000000000 --- a/drivers/staging/csr/bh.c +++ /dev/null @@ -1,404 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: bh.c - * - * PURPOSE: - * Provides an implementation for the driver bottom-half. - * It is part of the porting exercise in Linux. - * - * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#include "csr_wifi_hip_unifi.h" -#include "unifi_priv.h" -#include <linux/sched/rt.h> - -/* - * --------------------------------------------------------------------------- - * uf_start_thread - * - * Helper function to start a new thread. - * - * Arguments: - * priv Pointer to OS driver structure for the device. - * thread Pointer to the thread object - * func The thread function - * - * Returns: - * 0 on success or else a Linux error code. - * --------------------------------------------------------------------------- - */ -int uf_start_thread(unifi_priv_t *priv, - struct uf_thread *thread, int (*func)(void *)) -{ - if (thread->thread_task != NULL) { - unifi_error(priv, "%s thread already started\n", thread->name); - return 0; - } - - /* Start the kernel thread that handles all h/w accesses. */ - thread->thread_task = kthread_run(func, priv, "%s", thread->name); - if (IS_ERR(thread->thread_task)) - return PTR_ERR(thread->thread_task); - - /* Module parameter overides the thread priority */ - if (bh_priority != -1) { - if (bh_priority >= 0 && bh_priority <= MAX_RT_PRIO) { - struct sched_param param; - priv->bh_thread.prio = bh_priority; - unifi_trace(priv, UDBG1, - "%s thread (RT) priority = %d\n", - thread->name, bh_priority); - param.sched_priority = bh_priority; - sched_setscheduler(thread->thread_task, - SCHED_FIFO, ¶m); - } else if (bh_priority > MAX_RT_PRIO && - bh_priority <= MAX_PRIO) { - priv->bh_thread.prio = bh_priority; - unifi_trace(priv, UDBG1, "%s thread priority = %d\n", - thread->name, - PRIO_TO_NICE(bh_priority)); - set_user_nice(thread->thread_task, - PRIO_TO_NICE(bh_priority)); - } else { - priv->bh_thread.prio = DEFAULT_PRIO; - unifi_warning(priv, - "%s thread unsupported (%d) priority\n", - thread->name, bh_priority); - } - } else - priv->bh_thread.prio = DEFAULT_PRIO; - unifi_trace(priv, UDBG2, "Started %s thread\n", thread->name); - - return 0; -} /* uf_start_thread() */ - - -/* - * --------------------------------------------------------------------------- - * uf_stop_thread - * - * Helper function to stop a thread. - * - * Arguments: - * priv Pointer to OS driver structure for the device. - * thread Pointer to the thread object - * - * Returns: - * - * --------------------------------------------------------------------------- - */ -void uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread) -{ - if (!thread->thread_task) { - unifi_notice(priv, "%s thread is already stopped\n", - thread->name); - return; - } - - unifi_trace(priv, UDBG2, "Stopping %s thread\n", thread->name); - - kthread_stop(thread->thread_task); - thread->thread_task = NULL; - -} /* uf_stop_thread() */ - - - -/* - * --------------------------------------------------------------------------- - * uf_wait_for_thread_to_stop - * - * Helper function to wait until a thread is stopped. - * - * Arguments: - * priv Pointer to OS driver structure for the device. - * - * Returns: - * - * --------------------------------------------------------------------------- - */ -void -uf_wait_for_thread_to_stop(unifi_priv_t *priv, struct uf_thread *thread) -{ - /* - * kthread_stop() cannot handle the thread exiting while - * kthread_should_stop() is false, so sleep until kthread_stop() - * wakes us up - */ - unifi_trace(priv, UDBG2, "%s waiting for the stop signal.\n", - thread->name); - set_current_state(TASK_INTERRUPTIBLE); - if (!kthread_should_stop()) { - unifi_trace(priv, UDBG2, "%s schedule....\n", thread->name); - schedule(); - } - - thread->thread_task = NULL; - unifi_trace(priv, UDBG2, "%s exiting....\n", thread->name); -} /* uf_wait_for_thread_to_stop() */ - - -/* - * --------------------------------------------------------------------------- - * handle_bh_error - * - * This function reports an error returned from the HIP core bottom-half. - * Normally, implemented during the porting exercise, passing the error - * to the SME using unifi_sys_wifi_off_ind(). - * The SME will try to reset the device and go through - * the initialisation of the UniFi. - * - * Arguments: - * priv Pointer to OS driver structure for the device. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void -handle_bh_error(unifi_priv_t *priv) -{ - netInterface_priv_t *interfacePriv; - u8 conf_param = CONFIG_IND_ERROR; - u8 interfaceTag; - - - /* Block unifi_run_bh() until the error has been handled. */ - priv->bh_thread.block_thread = 1; - - /* Consider UniFi to be uninitialised */ - priv->init_progress = UNIFI_INIT_NONE; - - /* Stop the network traffic */ - for (interfaceTag = 0; - interfaceTag < CSR_WIFI_NUM_INTERFACES; interfaceTag++) { - interfacePriv = priv->interfacePriv[interfaceTag]; - if (interfacePriv->netdev_registered) - netif_carrier_off(priv->netdev[interfaceTag]); - } - -#ifdef CSR_NATIVE_LINUX - /* Force any client waiting on an mlme_wait_for_reply() to abort. */ - uf_abort_mlme(priv); - - /* Cancel any pending workqueue tasks */ - flush_workqueue(priv->unifi_workqueue); - -#endif /* CSR_NATIVE_LINUX */ - - unifi_error(priv, - "handle_bh_error: fatal error is reported to the SME.\n"); - /* Notify the clients (SME or unifi_manager) for the error. */ - ul_log_config_ind(priv, &conf_param, sizeof(u8)); - -} /* handle_bh_error() */ - - - -/* - * --------------------------------------------------------------------------- - * bh_thread_function - * - * All hardware access happens in this thread. - * This means there is no need for locks on the hardware and we don't need - * to worry about reentrancy with the SDIO library. - * Provides and example implementation on how to call unifi_bh(), which - * is part of the HIP core API. - * - * It processes the events generated by unifi_run_bh() to serialise calls - * to unifi_bh(). It also demonstrates how the timeout parameter passed in - * and returned from unifi_bh() needs to be handled. - * - * Arguments: - * arg Pointer to OS driver structure for the device. - * - * Returns: - * None. - * - * Notes: - * When the bottom half of the driver needs to process signals, events, - * or simply the host status (i.e sleep mode), it invokes unifi_run_bh(). - * Since we need all SDIO transaction to be in a single thread, the - * unifi_run_bh() will wake up this thread to process it. - * - * --------------------------------------------------------------------------- - */ -static int bh_thread_function(void *arg) -{ - unifi_priv_t *priv = (unifi_priv_t *)arg; - CsrResult csrResult; - long ret; - u32 timeout, t; - struct uf_thread *this_thread; - - unifi_trace(priv, UDBG2, "bh_thread_function starting\n"); - - this_thread = &priv->bh_thread; - - t = timeout = 0; - while (!kthread_should_stop()) { - /* - * wait until an error occurs, - * or we need to process something. - */ - unifi_trace(priv, UDBG3, "bh_thread goes to sleep.\n"); - - if (timeout > 0) { - /* Convert t in ms to jiffies */ - t = msecs_to_jiffies(timeout); - ret = wait_event_interruptible_timeout( - this_thread->wakeup_q, - (this_thread->wakeup_flag && !this_thread->block_thread) || - kthread_should_stop(), - t); - timeout = (ret > 0) ? jiffies_to_msecs(ret) : 0; - } else { - ret = wait_event_interruptible(this_thread->wakeup_q, - (this_thread->wakeup_flag && !this_thread->block_thread) || - kthread_should_stop()); - } - - if (kthread_should_stop()) { - unifi_trace(priv, UDBG2, - "bh_thread: signalled to exit\n"); - break; - } - - if (ret < 0) { - unifi_notice(priv, - "bh_thread: wait_event returned %d, thread will exit\n", - ret); - uf_wait_for_thread_to_stop(priv, this_thread); - break; - } - - this_thread->wakeup_flag = 0; - - unifi_trace(priv, UDBG3, "bh_thread calls unifi_bh().\n"); - - CsrSdioClaim(priv->sdio); - csrResult = unifi_bh(priv->card, &timeout); - if (csrResult != CSR_RESULT_SUCCESS) { - if (csrResult == CSR_WIFI_HIP_RESULT_NO_DEVICE) { - CsrSdioRelease(priv->sdio); - uf_wait_for_thread_to_stop(priv, this_thread); - break; - } - /* Errors must be delivered to the error task */ - handle_bh_error(priv); - } - CsrSdioRelease(priv->sdio); - } - - /* - * I would normally try to call csr_sdio_remove_irq() here to make sure - * that we do not get any interrupts while this thread is not running. - * However, the MMC/SDIO driver tries to kill its' interrupt thread. - * The kernel threads implementation does not allow to kill threads - * from a signalled to stop thread. - * So, instead call csr_sdio_linux_remove_irq() always after calling - * uf_stop_thread() to kill this thread. - */ - - unifi_trace(priv, UDBG2, "bh_thread exiting....\n"); - return 0; -} /* bh_thread_function() */ - - -/* - * --------------------------------------------------------------------------- - * uf_init_bh - * - * Helper function to start the bottom half of the driver. - * All we need to do here is start the I/O bh thread. - * - * Arguments: - * priv Pointer to OS driver structure for the device. - * - * Returns: - * 0 on success or else a Linux error code. - * --------------------------------------------------------------------------- - */ -int -uf_init_bh(unifi_priv_t *priv) -{ - int r; - - /* Enable mlme interface. */ - priv->io_aborted = 0; - - - /* Start the BH thread */ - r = uf_start_thread(priv, &priv->bh_thread, bh_thread_function); - if (r) { - unifi_error(priv, - "uf_init_bh: failed to start the BH thread.\n"); - return r; - } - - /* Allow interrupts */ - r = csr_sdio_linux_install_irq(priv->sdio); - if (r) { - unifi_error(priv, - "uf_init_bh: failed to install the IRQ.\n"); - - uf_stop_thread(priv, &priv->bh_thread); - } - - return r; -} /* uf_init_bh() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_run_bh - * - * Part of the HIP core lib API, implemented in the porting exercise. - * The bottom half of the driver calls this function when - * it wants to process anything that requires access to unifi. - * We need to call unifi_bh() which in this implementation is done - * by waking up the I/O thread. - * - * Arguments: - * ospriv Pointer to OS driver structure for the device. - * - * Returns: - * 0 on success or else a Linux error code. - * - * Notes: - * --------------------------------------------------------------------------- - */ -CsrResult unifi_run_bh(void *ospriv) -{ - unifi_priv_t *priv = ospriv; - - /* - * If an error has occurred, we discard silently all messages from the bh - * until the error has been processed and the unifi has been - * reinitialised. - */ - if (priv->bh_thread.block_thread == 1) { - unifi_trace(priv, UDBG3, "unifi_run_bh: discard message.\n"); - /* - * Do not try to acknowledge a pending interrupt here. - * This function is called by unifi_send_signal() - * which in turn can be running in an atomic or 'disabled irq' - * level if a signal is sent from a workqueue task - * (i.e multicass addresses set). We can not hold the SDIO lock - * because it might sleep. - */ - return CSR_RESULT_FAILURE; - } - - priv->bh_thread.wakeup_flag = 1; - /* wake up I/O thread */ - wake_up_interruptible(&priv->bh_thread.wakeup_q); - - return CSR_RESULT_SUCCESS; -} /* unifi_run_bh() */ - diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c deleted file mode 100644 index 98122bce1427..000000000000 --- a/drivers/staging/csr/csr_framework_ext.c +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include <linux/kernel.h> -#include <linux/kthread.h> -#include <linux/module.h> -#include <linux/freezer.h> -#include <linux/semaphore.h> -#include <linux/slab.h> -#include <linux/bitops.h> - -#include "csr_framework_ext.h" - -/*----------------------------------------------------------------------------* - * NAME - * CsrThreadSleep - * - * DESCRIPTION - * Sleep for a given period. - * - * RETURNS - * void - * - *----------------------------------------------------------------------------*/ -void CsrThreadSleep(u16 sleepTimeInMs) -{ - unsigned long t; - - /* Convert t in ms to jiffies and round up */ - t = ((sleepTimeInMs * HZ) + 999) / 1000; - schedule_timeout_uninterruptible(t); -} -EXPORT_SYMBOL_GPL(CsrThreadSleep); diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h deleted file mode 100644 index 6d26ac6173b0..000000000000 --- a/drivers/staging/csr/csr_framework_ext.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef CSR_FRAMEWORK_EXT_H__ -#define CSR_FRAMEWORK_EXT_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include "csr_result.h" -#include "csr_framework_ext_types.h" - -/* Result codes */ -#define CSR_FE_RESULT_NO_MORE_EVENTS ((CsrResult) 0x0001) -#define CSR_FE_RESULT_INVALID_POINTER ((CsrResult) 0x0002) -#define CSR_FE_RESULT_INVALID_HANDLE ((CsrResult) 0x0003) -#define CSR_FE_RESULT_NO_MORE_MUTEXES ((CsrResult) 0x0004) -#define CSR_FE_RESULT_TIMEOUT ((CsrResult) 0x0005) -#define CSR_FE_RESULT_NO_MORE_THREADS ((CsrResult) 0x0006) - -/* Thread priorities */ -#define CSR_THREAD_PRIORITY_HIGHEST ((u16) 0) -#define CSR_THREAD_PRIORITY_HIGH ((u16) 1) -#define CSR_THREAD_PRIORITY_NORMAL ((u16) 2) -#define CSR_THREAD_PRIORITY_LOW ((u16) 3) -#define CSR_THREAD_PRIORITY_LOWEST ((u16) 4) - -#define CSR_EVENT_WAIT_INFINITE ((u16) 0xFFFF) - -void CsrThreadSleep(u16 sleepTimeInMs); - -#endif diff --git a/drivers/staging/csr/csr_framework_ext_types.h b/drivers/staging/csr/csr_framework_ext_types.h deleted file mode 100644 index 575598cf69b2..000000000000 --- a/drivers/staging/csr/csr_framework_ext_types.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CSR_FRAMEWORK_EXT_TYPES_H__ -#define CSR_FRAMEWORK_EXT_TYPES_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifdef __KERNEL__ -#include <linux/kthread.h> -#include <linux/semaphore.h> -#else -#include <pthread.h> -#endif - -#ifdef __KERNEL__ - -typedef struct semaphore CsrMutexHandle; - -#else /* __KERNEL __ */ - -typedef pthread_mutex_t CsrMutexHandle; - -#endif /* __KERNEL__ */ - -#endif diff --git a/drivers/staging/csr/csr_log.h b/drivers/staging/csr/csr_log.h deleted file mode 100644 index 982941043ddc..000000000000 --- a/drivers/staging/csr/csr_log.h +++ /dev/null @@ -1,223 +0,0 @@ -#ifndef CSR_LOG_H__ -#define CSR_LOG_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include "csr_sched.h" -#include "csr_prim_defs.h" -#include "csr_msgconv.h" - -/* - * Log filtering - */ - -/*----------------------------------------------------*/ -/* Filtering on environment specific log levels */ -/*----------------------------------------------------*/ -typedef u32 CsrLogLevelEnvironment; -#define CSR_LOG_LEVEL_ENVIRONMENT_OFF ((CsrLogLevelEnvironment) 0x00000000) /* No environment data/events are logged */ -#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_ACL ((CsrLogLevelEnvironment) 0x00000001) /* BlueCore Channel Interface HCI Acl data are logged */ -#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_HCI ((CsrLogLevelEnvironment) 0x00000002) /* BlueCore Channel Interface HCI Cmd/Evt data are logged */ -#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_SCO ((CsrLogLevelEnvironment) 0x00000004) /* BlueCore Channel Interface HCI Sco data are logged */ -#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_VENDOR ((CsrLogLevelEnvironment) 0x00000008) /* BlueCore Channel Interface HCI Vendor specific data are logged (This includes BCCMD, HQ, VM etc) */ -#define CSR_LOG_LEVEL_ENVIRONMENT_TRANSPORTS ((CsrLogLevelEnvironment) 0x00000010) /* Transport protocol data is logged (This includes transport protocols like BCSP, H4 etc.) */ -#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_REG ((CsrLogLevelEnvironment) 0x00000020) /* Background Interrupt registration events are logged */ -#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_UNREG ((CsrLogLevelEnvironment) 0x00000040) /* Background Interrupt unregistration events are logged */ -#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_SET ((CsrLogLevelEnvironment) 0x00000080) /* Background Interrupt set events are logged */ -#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_START ((CsrLogLevelEnvironment) 0x00000100) /* Background Interrupt start events are logged */ -#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_DONE ((CsrLogLevelEnvironment) 0x00000200) /* Background Interrupt done events are logged */ -#define CSR_LOG_LEVEL_ENVIRONMENT_PROTO ((CsrLogLevelEnvironment) 0x00000400) /* Transport protocol events are logged */ -#define CSR_LOG_LEVEL_ENVIRONMENT_PROTO_LOC ((CsrLogLevelEnvironment) 0x00000800) /* The Location where the transport protocol event occurred are logged NB: This is a supplement to CSR_LOG_LEVEL_ENVIRONMENT_PROTO, it has no effect without it */ -/* The bit masks between here are reserved for future usage */ -#define CSR_LOG_LEVEL_ENVIRONMENT_ALL ((CsrLogLevelEnvironment) 0xFFFFFFFF) /* All possible environment data/events are logged WARNING: By using this define the application also accepts future possible environment data/events in the logs */ - -/*----------------------------------------------------*/ -/* Filtering on task specific log levels */ -/*----------------------------------------------------*/ -typedef u32 CsrLogLevelTask; -#define CSR_LOG_LEVEL_TASK_OFF ((CsrLogLevelTask) 0x00000000) /* No events are logged for this task */ -#define CSR_LOG_LEVEL_TASK_TEXT ((CsrLogLevelTask) 0x00000001) /* Text strings printed by a task are logged NB: This bit does not affect the CSR_LOG_TEXT_LEVEL interface. This has to be configured separately */ -#define CSR_LOG_LEVEL_TASK_TEXT_LOC ((CsrLogLevelTask) 0x00000002) /* The locaction where the text string call occurred are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TEXT, it has no effect without it */ -#define CSR_LOG_LEVEL_TASK_STATE ((CsrLogLevelTask) 0x00000004) /* FSM state transitions in a task are logged */ -#define CSR_LOG_LEVEL_TASK_STATE_NAME ((CsrLogLevelTask) 0x00000008) /* The name of each state in a FSM state transition are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */ -#define CSR_LOG_LEVEL_TASK_STATE_LOC ((CsrLogLevelTask) 0x00000010) /* The location where the FSM state transition occurred are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */ -#define CSR_LOG_LEVEL_TASK_TASK_SWITCH ((CsrLogLevelTask) 0x00000020) /* Activation and deactiation of a task are logged */ -#define CSR_LOG_LEVEL_TASK_MESSAGE_PUT ((CsrLogLevelTask) 0x00000080) /* Message put operations are logged */ -#define CSR_LOG_LEVEL_TASK_MESSAGE_PUT_LOC ((CsrLogLevelTask) 0x00000100) /* The location where a message was sent are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_MESSAGE_PUT, it has no effect without it */ -#define CSR_LOG_LEVEL_TASK_MESSAGE_GET ((CsrLogLevelTask) 0x00000200) /* Message get operations are logged */ -#define CSR_LOG_LEVEL_TASK_MESSAGE_QUEUE_PUSH ((CsrLogLevelTask) 0x00000400) /* Message push operations are logged */ -#define CSR_LOG_LEVEL_TASK_MESSAGE_QUEUE_POP ((CsrLogLevelTask) 0x00000800) /* Message pop operations are logged */ -#define CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE ((CsrLogLevelTask) 0x00001000) /* Only the type of primitives in messages are logged. By default the entire primitive is serialized and logged */ -#define CSR_LOG_LEVEL_TASK_PRIM_APPLY_LIMIT ((CsrLogLevelTask) 0x00002000) /* An upper limit (defined by CSR_LOG_PRIM_SIZE_UPPER_LIMIT) is applied to how much of a primitive in a message are logged. NB: This limit is only applied if CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE is _not_ defined */ -#define CSR_LOG_LEVEL_TASK_TIMER_IN ((CsrLogLevelTask) 0x00004000) /* TimedEventIn events are logged */ -#define CSR_LOG_LEVEL_TASK_TIMER_IN_LOC ((CsrLogLevelTask) 0x00008000) /* The location where a timer was started are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TIMER_IN, it has no effect without it */ -#define CSR_LOG_LEVEL_TASK_TIMER_CANCEL ((CsrLogLevelTask) 0x00010000) /* TimedEventCancel events are logged */ -#define CSR_LOG_LEVEL_TASK_TIMER_CANCEL_LOC ((CsrLogLevelTask) 0x00020000) /* The location where a timer was cancelled are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TIMER_CANCEL, it has no effect without it */ -#define CSR_LOG_LEVEL_TASK_TIMER_FIRE ((CsrLogLevelTask) 0x00040000) /* TimedEventFire events are logged */ -#define CSR_LOG_LEVEL_TASK_TIMER_DONE ((CsrLogLevelTask) 0x00080000) /* TimedEventDone events are logged */ -/* The bit masks between here are reserved for future usage */ -#define CSR_LOG_LEVEL_TASK_ALL ((CsrLogLevelTask) 0xFFFFFFFF & ~(CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE | CSR_LOG_LEVEL_TASK_PRIM_APPLY_LIMIT)) /* All info possible to log for a task are logged. WARNING: By using this define the application also accepts future possible task data/events in the logs */ - -u8 CsrLogEnvironmentIsFiltered(CsrLogLevelEnvironment level); -CsrLogLevelTask CsrLogTaskFilterGet(CsrSchedQid taskId); -u8 CsrLogTaskIsFiltered(CsrSchedQid taskId, CsrLogLevelTask level); - -/* - * Logging stuff - */ -#define CSR_LOG_STRINGIFY_REAL(a) (#a) -#define CSR_LOG_STRINGIFY(a) CSR_LOG_STRINGIFY_REAL(a) - -typedef struct { - u16 primitiveType; - const char *primitiveName; - CsrMsgConvMsgEntry *messageConv; /* Private - do not use */ -} CsrLogPrimitiveInformation; - -typedef struct { - const char *techVer; - u32 primitiveInfoCount; - CsrLogPrimitiveInformation *primitiveInfo; -} CsrLogTechInformation; - -/*---------------------------------*/ -/* Tech logging */ -/*---------------------------------*/ -typedef u8 bitmask8_t; -typedef u16 bitmask16_t; -typedef u32 bitmask32_t; - -#ifdef CSR_LOG_ENABLE -#ifdef CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER -/* DEPRECATED - replaced by csr_log_text.h */ -#define CSR_LOG_TEXT(text) \ - do { \ - if (!CsrLogTaskIsFiltered(CsrSchedTaskQueueGet(), CSR_LOG_LEVEL_TASK_TEXT)) { \ - CsrLogTaskText(text, __LINE__, __FILE__); \ - } \ - } while (0) -#else -/* DEPRECATED - replaced by csr_log_text.h */ -#define CSR_LOG_TEXT(text) \ - do { \ - if (!CsrLogTaskIsFiltered(CsrSchedTaskQueueGet(), CSR_LOG_LEVEL_TASK_TEXT)) { \ - CsrLogTaskText(text, 0, NULL); \ - } \ - } while (0) -#endif -#else -#define CSR_LOG_TEXT(text) -#endif - -/* DEPRECATED - replaced by csr_log_text.h */ -void CsrLogTaskText(const char *text, - u32 line, - const char *file); - -#define CSR_LOG_STATE_TRANSITION_MASK_FSM_NAME (0x001) -#define CSR_LOG_STATE_TRANSITION_MASK_NEXT_STATE (0x002) -#define CSR_LOG_STATE_TRANSITION_MASK_NEXT_STATE_STR (0x004) -#define CSR_LOG_STATE_TRANSITION_MASK_PREV_STATE (0x008) -#define CSR_LOG_STATE_TRANSITION_MASK_PREV_STATE_STR (0x010) -#define CSR_LOG_STATE_TRANSITION_MASK_EVENT (0x020) -#define CSR_LOG_STATE_TRANSITION_MASK_EVENT_STR (0x040) - -/* DEPRECATED - replaced by csr_log_text.h */ -void CsrLogStateTransition(bitmask16_t mask, - u32 identifier, - const char *fsm_name, - u32 prev_state, - const char *prev_state_str, - u32 in_event, - const char *in_event_str, - u32 next_state, - const char *next_state_str, - u32 line, - const char *file); - -/*---------------------------------*/ -/* BSP logging */ -/*---------------------------------*/ -void CsrLogSchedInit(u8 thread_id); -void CsrLogSchedDeinit(u8 thread_id); - -void CsrLogSchedStart(u8 thread_id); -void CsrLogSchedStop(u8 thread_id); - -void CsrLogInitTask(u8 thread_id, CsrSchedQid tskid, const char *tskName); -void CsrLogDeinitTask(u16 task_id); - -void CsrLogActivate(CsrSchedQid tskid); -void CsrLogDeactivate(CsrSchedQid tskid); - -#define SYNERGY_SERIALIZER_TYPE_DUMP (0x000) -#define SYNERGY_SERIALIZER_TYPE_SER (0x001) - -void CsrLogMessagePut(u32 line, - const char *file, - CsrSchedQid src_task_id, - CsrSchedQid dst_taskid, - CsrSchedMsgId msg_id, - u16 prim_type, - const void *msg); - -void CsrLogMessageGet(CsrSchedQid src_task_id, - CsrSchedQid dst_taskid, - u8 get_res, - CsrSchedMsgId msg_id, - u16 prim_type, - const void *msg); - -void CsrLogTimedEventIn(u32 line, - const char *file, - CsrSchedQid task_id, - CsrSchedTid tid, - u32 requested_delay, - u16 fniarg, - const void *fnvarg); - -void CsrLogTimedEventFire(CsrSchedQid task_id, - CsrSchedTid tid); - -void CsrLogTimedEventDone(CsrSchedQid task_id, - CsrSchedTid tid); - -void CsrLogTimedEventCancel(u32 line, - const char *file, - CsrSchedQid task_id, - CsrSchedTid tid, - u8 cancel_res); - -void CsrLogBgintRegister(u8 thread_id, - CsrSchedBgint irq, - const char *callback, - const void *ptr); -void CsrLogBgintUnregister(CsrSchedBgint irq); -void CsrLogBgintSet(CsrSchedBgint irq); -void CsrLogBgintServiceStart(CsrSchedBgint irq); -void CsrLogBgintServiceDone(CsrSchedBgint irq); - -void CsrLogExceptionStateEvent(u16 prim_type, - CsrPrim msg_type, - u16 state, - u32 line, - const char *file); -void CsrLogExceptionGeneral(u16 prim_type, - u16 state, - const char *text, - u32 line, - const char *file); -void CsrLogExceptionWarning(u16 prim_type, - u16 state, - const char *text, - u32 line, - const char *file); - -#endif diff --git a/drivers/staging/csr/csr_log_configure.h b/drivers/staging/csr/csr_log_configure.h deleted file mode 100644 index 283647cf9702..000000000000 --- a/drivers/staging/csr/csr_log_configure.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef CSR_LOG_CONFIGURE_H__ -#define CSR_LOG_CONFIGURE_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - - *****************************************************************************/ - -#include "csr_log.h" - -/*--------------------------------------------*/ -/* Filtering on log text warning levels */ -/*--------------------------------------------*/ -typedef u32 CsrLogLevelText; -#define CSR_LOG_LEVEL_TEXT_OFF ((CsrLogLevelText) 0x0000) - -#define CSR_LOG_LEVEL_TEXT_CRITICAL ((CsrLogLevelText) 0x0001) -#define CSR_LOG_LEVEL_TEXT_ERROR ((CsrLogLevelText) 0x0002) -#define CSR_LOG_LEVEL_TEXT_WARNING ((CsrLogLevelText) 0x0004) -#define CSR_LOG_LEVEL_TEXT_INFO ((CsrLogLevelText) 0x0008) -#define CSR_LOG_LEVEL_TEXT_DEBUG ((CsrLogLevelText) 0x0010) - -#define CSR_LOG_LEVEL_TEXT_ALL ((CsrLogLevelText) 0xFFFF) - -/* The log text interface is used by both scheduler tasks and components outside the scheduler context. - * Therefore a CsrLogTextTaskId is introduced. It is effectively considered as two u16's. The lower - * 16 bits corresponds one2one with the scheduler queueId's (CsrSchedQid) and as such these bits can not be used - * by components outside scheduler tasks. The upper 16 bits are allocated for use of components outside the - * scheduler like drivers etc. Components in this range is defined independently by each technology. To avoid - * clashes the technologies are only allowed to assign values within the same restrictive range as allies to - * primitive identifiers. eg. for the framework components outside the scheduler is only allowed to assign - * taskId's in the range 0x0600xxxx to 0x06FFxxxx. And so on for other technologies. */ -typedef u32 CsrLogTextTaskId; - -#endif diff --git a/drivers/staging/csr/csr_log_text.h b/drivers/staging/csr/csr_log_text.h deleted file mode 100644 index cfcf64aa6225..000000000000 --- a/drivers/staging/csr/csr_log_text.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef CSR_LOG_TEXT_H__ -#define CSR_LOG_TEXT_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include "csr_log_configure.h" - -typedef struct CsrLogSubOrigin -{ - u16 subOriginNumber; /* Id of the given SubOrigin */ - const char *subOriginName; /* Prefix Text for this SubOrigin */ -} CsrLogSubOrigin; - -/* Register a task which is going to use the CSR_LOG_TEXT_XXX interface */ -#ifdef CSR_LOG_ENABLE -void CsrLogTextRegister(CsrLogTextTaskId taskId, const char *taskName, u16 subOriginsLength, const CsrLogSubOrigin *subOrigins); -#else -#define CsrLogTextRegister(taskId, taskName, subOriginsLength, subOrigins) -#endif - -/* CRITICAL: Conditions that are threatening to the integrity/stability of the - system as a whole. */ -#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_CRITICAL_DISABLE) -void CsrLogTextCritical(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); -void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...); -#define CSR_LOG_TEXT_CRITICAL(taskId_subOrigin_formatString_varargs) CsrLogTextCritical taskId_subOrigin_formatString_varargs -#define CSR_LOG_TEXT_CONDITIONAL_CRITICAL(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_CRITICAL(logtextargs);}} -#define CSR_LOG_TEXT_BUFFER_CRITICAL(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferCritical taskId_subOrigin_length_buffer_formatString_varargs -#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_CRITICAL(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_CRITICAL(logtextbufferargs);}} -#else -#define CSR_LOG_TEXT_CRITICAL(taskId_subOrigin_formatString_varargs) -#define CSR_LOG_TEXT_CONDITIONAL_CRITICAL(condition, logtextargs) -#define CSR_LOG_TEXT_BUFFER_CRITICAL(taskId_subOrigin_length_buffer_formatString_varargs) -#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_CRITICAL(condition, logtextbufferargs) -#endif - -/* ERROR: Malfunction of a component rendering it unable to operate correctly, - causing lack of functionality but not loss of system integrity/stability. */ -#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_ERROR_DISABLE) -void CsrLogTextError(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); -void CsrLogTextBufferError(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...); -#define CSR_LOG_TEXT_ERROR(taskId_subOrigin_formatString_varargs) CsrLogTextError taskId_subOrigin_formatString_varargs -#define CSR_LOG_TEXT_CONDITIONAL_ERROR(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_ERROR(logtextargs);}} -#define CSR_LOG_TEXT_BUFFER_ERROR(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferError taskId_subOrigin_length_buffer_formatString_varargs -#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_ERROR(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_ERROR(logtextbufferargs);}} -#else -#define CSR_LOG_TEXT_ERROR(taskId_subOrigin_formatString_varargs) -#define CSR_LOG_TEXT_CONDITIONAL_ERROR(condition, logtextargs) -#define CSR_LOG_TEXT_BUFFER_ERROR(taskId_subOrigin_length_buffer_formatString_varargs) -#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_ERROR(condition, logtextbufferargs) -#endif - -/* WARNING: Conditions that are unexpected and indicative of possible problems - or violations of specifications, where the result of such deviations does not - lead to malfunction of the component. */ -#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_WARNING_DISABLE) -void CsrLogTextWarning(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); -void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...); -#define CSR_LOG_TEXT_WARNING(taskId_subOrigin_formatString_varargs) CsrLogTextWarning taskId_subOrigin_formatString_varargs -#define CSR_LOG_TEXT_CONDITIONAL_WARNING(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_WARNING(logtextargs);}} -#define CSR_LOG_TEXT_BUFFER_WARNING(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferWarning taskId_subOrigin_length_buffer_formatString_varargs -#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_WARNING(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_WARNING(logtextbufferargs);}} -#else -#define CSR_LOG_TEXT_WARNING(taskId_subOrigin_formatString_varargs) -#define CSR_LOG_TEXT_CONDITIONAL_WARNING(condition, logtextargs) -#define CSR_LOG_TEXT_BUFFER_WARNING(taskId_subOrigin_length_buffer_formatString_varargs) -#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_WARNING(condition, logtextbufferargs) -#endif - -/* INFO: Important events that may aid in determining the conditions under which - the more severe conditions are encountered. */ -#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_INFO_DISABLE) -void CsrLogTextInfo(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); -void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...); -#define CSR_LOG_TEXT_INFO(taskId_subOrigin_formatString_varargs) CsrLogTextInfo taskId_subOrigin_formatString_varargs -#define CSR_LOG_TEXT_CONDITIONAL_INFO(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_INFO(logtextargs);}} -#define CSR_LOG_TEXT_BUFFER_INFO(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferInfo taskId_subOrigin_length_buffer_formatString_varargs -#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_INFO(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_INFO(logtextbufferargs);}} -#else -#define CSR_LOG_TEXT_INFO(taskId_subOrigin_formatString_varargs) -#define CSR_LOG_TEXT_CONDITIONAL_INFO(condition, logtextargs) -#define CSR_LOG_TEXT_BUFFER_INFO(taskId_subOrigin_length_buffer_formatString_varargs) -#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_INFO(condition, logtextbufferargs) -#endif - -/* DEBUG: Similar to INFO, but dedicated to events that occur more frequently. */ -#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_DEBUG_DISABLE) -void CsrLogTextDebug(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...); -void CsrLogTextBufferDebug(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...); -#define CSR_LOG_TEXT_DEBUG(taskId_subOrigin_formatString_varargs) CsrLogTextDebug taskId_subOrigin_formatString_varargs -#define CSR_LOG_TEXT_CONDITIONAL_DEBUG(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_DEBUG(logtextargs);}} -#define CSR_LOG_TEXT_BUFFER_DEBUG(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferDebug taskId_subOrigin_length_buffer_formatString_varargs -#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_DEBUG(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_DEBUG(logtextbufferargs);}} -#else -#define CSR_LOG_TEXT_DEBUG(taskId_subOrigin_formatString_varargs) -#define CSR_LOG_TEXT_CONDITIONAL_DEBUG(condition, logtextargs) -#define CSR_LOG_TEXT_BUFFER_DEBUG(taskId_subOrigin_length_buffer_formatString_varargs) -#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_DEBUG(condition, logtextbufferargs) -#endif - -/* CSR_LOG_TEXT_ASSERT (CRITICAL) */ -#ifdef CSR_LOG_ENABLE -#define CSR_LOG_TEXT_ASSERT(origin, suborigin, condition) \ - {if (!(condition)) {CSR_LOG_TEXT_CRITICAL((origin, suborigin, "Assertion \"%s\" failed at %s:%u", #condition, __FILE__, __LINE__));}} -#else -#define CSR_LOG_TEXT_ASSERT(origin, suborigin, condition) -#endif - -/* CSR_LOG_TEXT_UNHANDLED_PRIM (CRITICAL) */ -#ifdef CSR_LOG_ENABLE -#define CSR_LOG_TEXT_UNHANDLED_PRIMITIVE(origin, suborigin, primClass, primType) \ - CSR_LOG_TEXT_CRITICAL((origin, suborigin, "Unhandled primitive 0x%04X:0x%04X at %s:%u", primClass, primType, __FILE__, __LINE__)) -#else -#define CSR_LOG_TEXT_UNHANDLED_PRIMITIVE(origin, suborigin, primClass, primType) -#endif - -#endif diff --git a/drivers/staging/csr/csr_macro.h b/drivers/staging/csr/csr_macro.h deleted file mode 100644 index c47f1d91b6fa..000000000000 --- a/drivers/staging/csr/csr_macro.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef CSR_MACRO_H__ -#define CSR_MACRO_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include <linux/types.h> - -#define FALSE (0) -#define TRUE (1) - -/*------------------------------------------------------------------*/ -/* Endian conversion */ -/*------------------------------------------------------------------*/ -#define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((u16) ((u8 *) (ptr))[0]) | ((u16) ((u8 *) (ptr))[1]) << 8) -#define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((u32) ((u8 *) (ptr))[0]) | ((u32) ((u8 *) (ptr))[1]) << 8 | \ - ((u32) ((u8 *) (ptr))[2]) << 16 | ((u32) ((u8 *) (ptr))[3]) << 24) -#define CSR_COPY_UINT16_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x00FF)); \ - ((u8 *) (ptr))[1] = ((u8) ((uint) >> 8)) -#define CSR_COPY_UINT32_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x000000FF)); \ - ((u8 *) (ptr))[1] = ((u8) (((uint) >> 8) & 0x000000FF)); \ - ((u8 *) (ptr))[2] = ((u8) (((uint) >> 16) & 0x000000FF)); \ - ((u8 *) (ptr))[3] = ((u8) (((uint) >> 24) & 0x000000FF)) - -/*------------------------------------------------------------------*/ -/* Misc */ -/*------------------------------------------------------------------*/ -/* Use this macro on unused local variables that cannot be removed (such as - unused function parameters). This will quell warnings from certain compilers - and static code analysis tools like Lint and Valgrind. */ -#define CSR_UNUSED(x) ((void) (x)) - -#endif diff --git a/drivers/staging/csr/csr_msg_transport.h b/drivers/staging/csr/csr_msg_transport.h deleted file mode 100644 index 8d88e7836567..000000000000 --- a/drivers/staging/csr/csr_msg_transport.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CSR_MSG_TRANSPORT_H__ -#define CSR_MSG_TRANSPORT_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifndef CsrMsgTransport -#define CsrMsgTransport CsrSchedMessagePut -#endif - -#endif /* CSR_MSG_TRANSPORT */ diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c deleted file mode 100644 index db5e845e60f5..000000000000 --- a/drivers/staging/csr/csr_msgconv.c +++ /dev/null @@ -1,291 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include <linux/module.h> -#include <linux/types.h> -#include <linux/slab.h> -#include "csr_sched.h" -#include "csr_msgconv.h" -#include "csr_macro.h" - -static CsrMsgConvEntry *converter; - -CsrMsgConvPrimEntry *CsrMsgConvFind(u16 primType) -{ - CsrMsgConvPrimEntry *ptr = NULL; - - if (converter) - { - ptr = converter->profile_converters; - while (ptr) - { - if (ptr->primType == primType) - { - break; - } - else - { - ptr = ptr->next; - } - } - } - - return ptr; -} - -static const CsrMsgConvMsgEntry *find_msg_converter(CsrMsgConvPrimEntry *ptr, u16 msgType) -{ - const CsrMsgConvMsgEntry *cv = ptr->conv; - if (ptr->lookupFunc) - { - return (const CsrMsgConvMsgEntry *) ptr->lookupFunc((CsrMsgConvMsgEntry *) cv, msgType); - } - - while (cv) - { - if (cv->serFunc == NULL) - { - /* We've reached the end of the chain */ - cv = NULL; - break; - } - - if (cv->msgType == msgType) - { - break; - } - else - { - cv++; - } - } - - return cv; -} - -static void *deserialize_data(u16 primType, - size_t length, - u8 *data) -{ - CsrMsgConvPrimEntry *ptr; - u8 *ret; - - ptr = CsrMsgConvFind(primType); - - if (ptr) - { - const CsrMsgConvMsgEntry *cv; - u16 msgId = 0; - size_t offset = 0; - CsrUint16Des(&msgId, data, &offset); - - cv = find_msg_converter(ptr, msgId); - if (cv) - { - ret = cv->deserFunc(data, length); - } - else - { - ret = NULL; - } - } - else - { - ret = NULL; - } - - return ret; -} - -static size_t sizeof_message(u16 primType, void *msg) -{ - CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); - size_t ret; - - if (ptr) - { - const CsrMsgConvMsgEntry *cv; - u16 msgId = *(u16 *) msg; - - cv = find_msg_converter(ptr, msgId); - if (cv) - { - ret = cv->sizeofFunc(msg); - } - else - { - ret = 0; - } - } - else - { - ret = 0; - } - - return ret; -} - -static u8 free_message(u16 primType, u8 *data) -{ - CsrMsgConvPrimEntry *ptr; - u8 ret; - - ptr = CsrMsgConvFind(primType); - - if (ptr) - { - const CsrMsgConvMsgEntry *cv; - u16 msgId = *(u16 *) data; - - cv = find_msg_converter(ptr, msgId); - if (cv) - { - cv->freeFunc(data); - ret = TRUE; - } - else - { - ret = FALSE; - } - } - else - { - ret = FALSE; - } - - return ret; -} - -static u8 *serialize_message(u16 primType, - void *msg, - size_t *length, - u8 *buffer) -{ - CsrMsgConvPrimEntry *ptr; - u8 *ret; - - ptr = CsrMsgConvFind(primType); - - *length = 0; - - if (ptr) - { - const CsrMsgConvMsgEntry *cv; - - cv = find_msg_converter(ptr, *(u16 *) msg); - if (cv) - { - ret = cv->serFunc(buffer, length, msg); - } - else - { - ret = NULL; - } - } - else - { - ret = NULL; - } - - return ret; -} - -size_t CsrMsgConvSizeof(u16 primType, void *msg) -{ - return sizeof_message(primType, msg); -} - -u8 *CsrMsgConvSerialize(u8 *buffer, size_t maxBufferOffset, size_t *offset, u16 primType, void *msg) -{ - if (converter) - { - size_t serializedLength; - u8 *bufSerialized; - u8 *bufOffset = &buffer[*offset]; - bufSerialized = converter->serialize_message(primType, msg, &serializedLength, bufOffset); - *offset += serializedLength; - return bufSerialized; - } - else - { - return NULL; - } -} - -/* Insert profile converter at head of converter list. */ -void CsrMsgConvInsert(u16 primType, const CsrMsgConvMsgEntry *ce) -{ - CsrMsgConvPrimEntry *pc; - pc = CsrMsgConvFind(primType); - - if (pc) - { - /* Already registered. Do nothing */ - } - else - { - pc = kmalloc(sizeof(*pc), GFP_KERNEL); - pc->primType = primType; - pc->conv = ce; - pc->lookupFunc = NULL; - pc->next = converter->profile_converters; - converter->profile_converters = pc; - } -} -EXPORT_SYMBOL_GPL(CsrMsgConvInsert); - -CsrMsgConvMsgEntry *CsrMsgConvFindEntry(u16 primType, u16 msgType) -{ - CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); - if (ptr) - { - return (CsrMsgConvMsgEntry *) find_msg_converter(ptr, msgType); - } - return NULL; -} -EXPORT_SYMBOL_GPL(CsrMsgConvFindEntry); - -CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(u16 primType, const void *msg) -{ - CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); - if (ptr && msg) - { - u16 msgType = *((u16 *) msg); - return (CsrMsgConvMsgEntry *) find_msg_converter(ptr, msgType); - } - return NULL; -} - -void CsrMsgConvCustomLookupRegister(u16 primType, CsrMsgCustomLookupFunc *lookupFunc) -{ - CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType); - if (ptr) - { - ptr->lookupFunc = lookupFunc; - } -} -EXPORT_SYMBOL_GPL(CsrMsgConvCustomLookupRegister); - -CsrMsgConvEntry *CsrMsgConvInit(void) -{ - if (!converter) - { - converter = kmalloc(sizeof(CsrMsgConvEntry), GFP_KERNEL); - - converter->profile_converters = NULL; - converter->free_message = free_message; - converter->sizeof_message = sizeof_message; - converter->serialize_message = serialize_message; - converter->deserialize_data = deserialize_data; - } - - return converter; -} -EXPORT_SYMBOL_GPL(CsrMsgConvInit); diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h deleted file mode 100644 index 7e4dd388ae37..000000000000 --- a/drivers/staging/csr/csr_msgconv.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef CSR_MSGCONV_H__ -#define CSR_MSGCONV_H__ - -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include <linux/types.h> -#include "csr_prim_defs.h" -#include "csr_sched.h" - -typedef size_t (CsrMsgSizeofFunc)(void *msg); -typedef u8 *(CsrMsgSerializeFunc)(u8 *buffer, size_t *length, void *msg); -typedef void (CsrMsgFreeFunc)(void *msg); -typedef void *(CsrMsgDeserializeFunc)(u8 *buffer, size_t length); - -/* Converter entry for one message type */ -typedef struct CsrMsgConvMsgEntry -{ - u16 msgType; - CsrMsgSizeofFunc *sizeofFunc; - CsrMsgSerializeFunc *serFunc; - CsrMsgDeserializeFunc *deserFunc; - CsrMsgFreeFunc *freeFunc; -} CsrMsgConvMsgEntry; - -/* Optional lookup function */ -typedef CsrMsgConvMsgEntry *(CsrMsgCustomLookupFunc)(CsrMsgConvMsgEntry *ce, u16 msgType); - -/* All converter entries for one specific primitive */ -typedef struct CsrMsgConvPrimEntry -{ - u16 primType; - const CsrMsgConvMsgEntry *conv; - CsrMsgCustomLookupFunc *lookupFunc; - struct CsrMsgConvPrimEntry *next; -} CsrMsgConvPrimEntry; - -typedef struct -{ - CsrMsgConvPrimEntry *profile_converters; - void *(*deserialize_data)(u16 primType, size_t length, u8 * data); - u8 (*free_message)(u16 primType, u8 *data); - size_t (*sizeof_message)(u16 primType, void *msg); - u8 *(*serialize_message)(u16 primType, void *msg, - size_t * length, - u8 * buffer); -} CsrMsgConvEntry; - -size_t CsrMsgConvSizeof(u16 primType, void *msg); -u8 *CsrMsgConvSerialize(u8 *buffer, size_t maxBufferOffset, size_t *offset, u16 primType, void *msg); -void CsrMsgConvCustomLookupRegister(u16 primType, CsrMsgCustomLookupFunc *lookupFunc); -void CsrMsgConvInsert(u16 primType, const CsrMsgConvMsgEntry *ce); -CsrMsgConvPrimEntry *CsrMsgConvFind(u16 primType); -CsrMsgConvMsgEntry *CsrMsgConvFindEntry(u16 primType, u16 msgType); -CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(u16 primType, const void *msg); -CsrMsgConvEntry *CsrMsgConvInit(void); - -/* Prototypes for primitive type serializers */ -void CsrUint8Ser(u8 *buffer, size_t *offset, u8 value); -void CsrUint16Ser(u8 *buffer, size_t *offset, u16 value); -void CsrUint32Ser(u8 *buffer, size_t *offset, u32 value); -void CsrMemCpySer(u8 *buffer, size_t *offset, const void *value, size_t length); -void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value); - -void CsrUint8Des(u8 *value, u8 *buffer, size_t *offset); -void CsrUint16Des(u16 *value, u8 *buffer, size_t *offset); -void CsrUint32Des(u32 *value, u8 *buffer, size_t *offset); -void CsrMemCpyDes(void *value, u8 *buffer, size_t *offset, size_t length); -void CsrCharStringDes(char **value, u8 *buffer, size_t *offset); - -#endif diff --git a/drivers/staging/csr/csr_prim_defs.h b/drivers/staging/csr/csr_prim_defs.h deleted file mode 100644 index 81a1eaac30d9..000000000000 --- a/drivers/staging/csr/csr_prim_defs.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef CSR_PRIM_DEFS_H__ -#define CSR_PRIM_DEFS_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/************************************************************************************ - * Segmentation of primitives in upstream and downstream segment - ************************************************************************************/ -typedef u16 CsrPrim; -#define CSR_PRIM_UPSTREAM ((CsrPrim) (0x8000)) - -/************************************************************************************ - * Primitive definitions for Synergy framework - ************************************************************************************/ -#define CSR_SYNERGY_EVENT_CLASS_BASE ((u16) (0x0600)) - -#define CSR_HCI_PRIM ((u16) (0x0000 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_BCCMD_PRIM ((u16) (0x0001 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_HQ_PRIM ((u16) (0x0002 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_VM_PRIM ((u16) (0x0003 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_TM_BLUECORE_PRIM ((u16) (0x0004 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_FP_PRIM ((u16) (0x0005 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_IP_SOCKET_PRIM ((u16) (0x0006 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_IP_ETHER_PRIM ((u16) (0x0007 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_IP_IFCONFIG_PRIM ((u16) (0x0008 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_IP_INTERNAL_PRIM ((u16) (0x0009 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_FSAL_PRIM ((u16) (0x000A | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_DATA_STORE_PRIM ((u16) (0x000B | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_AM_PRIM ((u16) (0x000C | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_TLS_PRIM ((u16) (0x000D | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_DHCP_SERVER_PRIM ((u16) (0x000E | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_TFTP_PRIM ((u16) (0x000F | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_DSPM_PRIM ((u16) (0x0010 | CSR_SYNERGY_EVENT_CLASS_BASE)) -#define CSR_TLS_INTERNAL_PRIM ((u16) (0x0011 | CSR_SYNERGY_EVENT_CLASS_BASE)) - -#define NUMBER_OF_CSR_FW_EVENTS (CSR_DSPM_PRIM - CSR_SYNERGY_EVENT_CLASS_BASE + 1) - -#define CSR_SYNERGY_EVENT_CLASS_MISC_BASE ((u16) (0x06A0)) - -#define CSR_UI_PRIM ((u16) (0x0000 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) -#define CSR_APP_PRIM ((u16) (0x0001 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) -#define CSR_SDIO_PROBE_PRIM ((u16) (0x0002 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) - -#define NUMBER_OF_CSR_FW_MISC_EVENTS (CSR_SDIO_PROBE_PRIM - CSR_SYNERGY_EVENT_CLASS_MISC_BASE + 1) - -#define CSR_ENV_PRIM ((u16) (0x00FF | CSR_SYNERGY_EVENT_CLASS_MISC_BASE)) - -#endif /* CSR_PRIM_DEFS_H__ */ diff --git a/drivers/staging/csr/csr_result.h b/drivers/staging/csr/csr_result.h deleted file mode 100644 index cbb607d943c7..000000000000 --- a/drivers/staging/csr/csr_result.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CSR_RESULT_H__ -#define CSR_RESULT_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -typedef u16 CsrResult; -#define CSR_RESULT_SUCCESS ((CsrResult) 0x0000) -#define CSR_RESULT_FAILURE ((CsrResult) 0xFFFF) - -#endif diff --git a/drivers/staging/csr/csr_sched.h b/drivers/staging/csr/csr_sched.h deleted file mode 100644 index c7d672c59f5b..000000000000 --- a/drivers/staging/csr/csr_sched.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef CSR_SCHED_H__ -#define CSR_SCHED_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ -#include <linux/types.h> -#include "csr_time.h" - -/* An identifier issued by the scheduler. */ -typedef u32 CsrSchedIdentifier; - -/* A task identifier */ -typedef u16 CsrSchedTaskId; - -/* A queue identifier */ -typedef u16 CsrSchedQid; - -/* A message identifier */ -typedef CsrSchedIdentifier CsrSchedMsgId; - -/* A timer event identifier */ -typedef CsrSchedIdentifier CsrSchedTid; -#define CSR_SCHED_TID_INVALID ((CsrSchedTid) 0) - -/* Time constants. */ -#define CSR_SCHED_TIME_MAX (0xFFFFFFFF) -#define CSR_SCHED_MILLISECOND (1000) -#define CSR_SCHED_SECOND (1000 * CSR_SCHED_MILLISECOND) -#define CSR_SCHED_MINUTE (60 * CSR_SCHED_SECOND) - -/* Queue and primitive that identifies the environment */ -#define CSR_SCHED_TASK_ID 0xFFFF -#define CSR_SCHED_PRIM (CSR_SCHED_TASK_ID) -#define CSR_SCHED_EXCLUDED_MODULE_QUEUE 0xFFFF - -/* - * Background interrupt definitions - */ -typedef u16 CsrSchedBgint; -#define CSR_SCHED_BGINT_INVALID ((CsrSchedBgint) 0xFFFF) - -/*----------------------------------------------------------------------------* - * NAME - * CsrSchedMessagePut - * - * DESCRIPTION - * Sends a message consisting of the integer "mi" and the void * pointer - * "mv" to the message queue "q". - * - * "mi" and "mv" are neither inspected nor changed by the scheduler - the - * task that owns "q" is expected to make sense of the values. "mv" may - * be null. - * - * NOTE - * If "mv" is not null then it will typically be a chunk of kmalloc()ed - * memory, though there is no need for it to be so. Tasks should normally - * obey the convention that when a message built with kmalloc()ed memory - * is given to CsrSchedMessagePut() then ownership of the memory is ceded to the - * scheduler - and eventually to the recipient task. I.e., the receiver of - * the message will be expected to kfree() the message storage. - * - * RETURNS - * void. - * - *----------------------------------------------------------------------------*/ -#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) -void CsrSchedMessagePutStringLog(CsrSchedQid q, - u16 mi, - void *mv, - u32 line, - const char *file); -#define CsrSchedMessagePut(q, mi, mv) CsrSchedMessagePutStringLog((q), (mi), (mv), __LINE__, __FILE__) -#else -void CsrSchedMessagePut(CsrSchedQid q, - u16 mi, - void *mv); -#endif - -#endif diff --git a/drivers/staging/csr/csr_sdio.h b/drivers/staging/csr/csr_sdio.h deleted file mode 100644 index 0971d135abf6..000000000000 --- a/drivers/staging/csr/csr_sdio.h +++ /dev/null @@ -1,723 +0,0 @@ -#ifndef CSR_SDIO_H__ -#define CSR_SDIO_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include "csr_result.h" - -/* Result Codes */ -#define CSR_SDIO_RESULT_INVALID_VALUE ((CsrResult) 1) /* Invalid argument value */ -#define CSR_SDIO_RESULT_NO_DEVICE ((CsrResult) 2) /* The specified device is no longer present */ -#define CSR_SDIO_RESULT_CRC_ERROR ((CsrResult) 3) /* The transmitted/received data or command response contained a CRC error */ -#define CSR_SDIO_RESULT_TIMEOUT ((CsrResult) 4) /* No command response or data received from device, or function enable/disable did not succeed within timeout period */ -#define CSR_SDIO_RESULT_NOT_RESET ((CsrResult) 5) /* The device was not reset */ - -/* Features (for use in features member of CsrSdioFunction) */ -#define CSR_SDIO_FEATURE_BYTE_MODE 0x00000001 /* Transfer sizes do not have to be a multiple of block size */ -#define CSR_SDIO_FEATURE_DMA_CAPABLE_MEM_REQUIRED 0x00000002 /* Bulk operations require DMA friendly memory */ - -/* CsrSdioFunctionId wildcards (for use in CsrSdioFunctionId members) */ -#define CSR_SDIO_ANY_MANF_ID 0xFFFF -#define CSR_SDIO_ANY_CARD_ID 0xFFFF -#define CSR_SDIO_ANY_SDIO_FUNCTION 0xFF -#define CSR_SDIO_ANY_SDIO_INTERFACE 0xFF - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunctionId - * - * DESCRIPTION - * This structure describes one or more functions of a device, based on - * four qualitative measures. The CsrSdioFunctionId wildcard defines can be - * used for making the CsrSdioFunctionId match more than one function. - * - * MEMBERS - * manfId - Vendor ID (or CSR_SDIO_ANY_MANF_ID). - * cardId - Device ID (or CSR_SDIO_ANY_CARD_ID). - * sdioFunction - SDIO Function number (or CSR_SDIO_ANY_SDIO_FUNCTION). - * sdioInterface - SDIO Standard Interface Code (or CSR_SDIO_ANY_SDIO_INTERFACE) - * - *----------------------------------------------------------------------------*/ -typedef struct -{ - u16 manfId; /* Vendor ID to match or CSR_SDIO_ANY_MANF_ID */ - u16 cardId; /* Device ID to match or CSR_SDIO_ANY_CARD_ID */ - u8 sdioFunction; /* SDIO Function number to match or CSR_SDIO_ANY_SDIO_FUNCTION */ - u8 sdioInterface; /* SDIO Standard Interface Code to match or CSR_SDIO_ANY_SDIO_INTERFACE */ -} CsrSdioFunctionId; - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunction - * - * DESCRIPTION - * This structure represents a single function on a device. - * - * MEMBERS - * sdioId - A CsrSdioFunctionId describing this particular function. The - * subfield shall not contain any CsrSdioFunctionId wildcards. The - * subfields shall describe the specific single function - * represented by this structure. - * blockSize - Actual configured block size, or 0 if unconfigured. - * features - Bit mask with any of CSR_SDIO_FEATURE_* set. - * device - Handle of device containing the function. If two functions have - * the same device handle, they reside on the same device. - * driverData - For use by the Function Driver. The SDIO Driver shall not - * attempt to dereference the pointer. - * priv - For use by the SDIO Driver. The Function Driver shall not attempt - * to dereference the pointer. - * - * - *----------------------------------------------------------------------------*/ -typedef struct -{ - CsrSdioFunctionId sdioId; - u16 blockSize; /* Actual configured block size, or 0 if unconfigured */ - u32 features; /* Bit mask with any of CSR_SDIO_FEATURE_* set */ - void *device; /* Handle of device containing the function */ - void *driverData; /* For use by the Function Driver */ - void *priv; /* For use by the SDIO Driver */ -} CsrSdioFunction; - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioInsertedCallback, CsrSdioRemovedCallback - * - * DESCRIPTION - * CsrSdioInsertedCallback is called when a function becomes available to - * a registered Function Driver that supports the function. - * CsrSdioRemovedCallback is called when a function is no longer available - * to a Function Driver, either because the device has been removed, or the - * Function Driver has been unregistered. - * - * NOTE: These functions are implemented by the Function Driver, and are - * passed as function pointers in the CsrSdioFunctionDriver struct. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * - *----------------------------------------------------------------------------*/ -typedef void (*CsrSdioInsertedCallback)(CsrSdioFunction *function); -typedef void (*CsrSdioRemovedCallback)(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioInterruptDsrCallback, CsrSdioInterruptCallback - * - * DESCRIPTION - * CsrSdioInterruptCallback is called when an interrupt occurs on the - * the device associated with the specified function. - * - * NOTE: These functions are implemented by the Function Driver, and are - * passed as function pointers in the CsrSdioFunctionDriver struct. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * - * RETURNS (only CsrSdioInterruptCallback) - * A pointer to a CsrSdioInterruptDsrCallback function. - * - *----------------------------------------------------------------------------*/ -typedef void (*CsrSdioInterruptDsrCallback)(CsrSdioFunction *function); -typedef CsrSdioInterruptDsrCallback (*CsrSdioInterruptCallback)(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioSuspendCallback, CsrSdioResumeCallback - * - * DESCRIPTION - * CsrSdioSuspendCallback is called when the system is preparing to go - * into a suspended state. CsrSdioResumeCallback is called when the system - * has entered an active state again. - * - * NOTE: These functions are implemented by the Function Driver, and are - * passed as function pointers in the CsrSdioFunctionDriver struct. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * - *----------------------------------------------------------------------------*/ -typedef void (*CsrSdioSuspendCallback)(CsrSdioFunction *function); -typedef void (*CsrSdioResumeCallback)(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioAsyncCallback, CsrSdioAsyncDsrCallback - * - * DESCRIPTION - * CsrSdioAsyncCallback is called when an asynchronous operation completes. - * - * NOTE: These functions are implemented by the Function Driver, and are - * passed as function pointers in the function calls that initiate - * the operation. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * result - The result of the operation that completed. See the description - * of the initiating function for possible result values. - * - * RETURNS (only CsrSdioAsyncCallback) - * A pointer to a CsrSdioAsyncDsrCallback function. - * - *----------------------------------------------------------------------------*/ -typedef void (*CsrSdioAsyncDsrCallback)(CsrSdioFunction *function, CsrResult result); -typedef CsrSdioAsyncDsrCallback (*CsrSdioAsyncCallback)(CsrSdioFunction *function, CsrResult result); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunctionDriver - * - * DESCRIPTION - * Structure representing a Function Driver. - * - * MEMBERS - * inserted - Callback, see description of CsrSdioInsertedCallback. - * removed - Callback, see description of CsrSdioRemovedCallback. - * intr - Callback, see description of CsrSdioInterruptCallback. - * suspend - Callback, see description of CsrSdioSuspendCallback. - * resume - Callback, see description of CsrSdioResumeCallback. - * ids - Array of CsrSdioFunctionId describing one or more functions that - * are supported by the Function Driver. - * idsCount - Length of the ids array. - * priv - For use by the SDIO Driver. The Function Driver may initialise - * it to NULL, but shall otherwise not access the pointer or attempt - * to dereference it. - * - *----------------------------------------------------------------------------*/ -typedef struct -{ - CsrSdioInsertedCallback inserted; - CsrSdioRemovedCallback removed; - CsrSdioInterruptCallback intr; - CsrSdioSuspendCallback suspend; - CsrSdioResumeCallback resume; - CsrSdioFunctionId *ids; - u8 idsCount; - void *priv; /* For use by the SDIO Driver */ -} CsrSdioFunctionDriver; - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunctionDriverRegister - * - * DESCRIPTION - * Register a Function Driver. - * - * PARAMETERS - * functionDriver - Pointer to struct describing the Function Driver. - * - * RETURNS - * CSR_RESULT_SUCCESS - The Function Driver was successfully - * registered. - * CSR_RESULT_FAILURE - Unable to register the function driver, - * because of an unspecified/unknown error. The - * Function Driver has not been registered. - * CSR_SDIO_RESULT_INVALID_VALUE - The specified Function Driver pointer - * does not point at a valid Function - * Driver structure, or some of the members - * contain invalid entries. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *functionDriver); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunctionDriverUnregister - * - * DESCRIPTION - * Unregister a previously registered Function Driver. - * - * PARAMETERS - * functionDriver - pointer to struct describing the Function Driver. - * - *----------------------------------------------------------------------------*/ -void CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *functionDriver); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunctionEnable, CsrSdioFunctionDisable - * - * DESCRIPTION - * Enable/disable the specified function by setting/clearing the - * corresponding bit in the I/O Enable register in function 0, and then - * periodically reading the related bit in the I/O Ready register until it - * is set/clear, limited by an implementation defined timeout. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * - * RETURNS - * CSR_RESULT_SUCCESS - The specified function was enabled/disabled. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. The state of the - * related bit in the I/O Enable register is - * undefined. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device, or the related - * bit in the I/O ready register was not - * set/cleared within the timeout period. - * - * NOTE: If the SDIO R5 response is available, and either of the - * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit - * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioFunctionEnable(CsrSdioFunction *function); -CsrResult CsrSdioFunctionDisable(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioInterruptEnable, CsrSdioInterruptDisable - * - * DESCRIPTION - * Enable/disable the interrupt for the specified function by - * setting/clearing the corresponding bit in the INT Enable register in - * function 0. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * - * RETURNS - * CSR_RESULT_SUCCESS - The specified function was enabled/disabled. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. The state of the - * related bit in the INT Enable register is - * unchanged. - * CSR_SDIO_RESULT_INVALID_VALUE - The specified function cannot be - * enabled/disabled, because it either - * does not exist or it is not possible to - * individually enable/disable functions. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device. - * - * NOTE: If the SDIO R5 response is available, and either of the - * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit - * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioInterruptEnable(CsrSdioFunction *function); -CsrResult CsrSdioInterruptDisable(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioInterruptAcknowledge - * - * DESCRIPTION - * Acknowledge that a signalled interrupt has been handled. Shall only - * be called once, and exactly once for each signalled interrupt to the - * corresponding function. - * - * PARAMETERS - * function - Pointer to struct representing the function to which the - * event was signalled. - * - *----------------------------------------------------------------------------*/ -void CsrSdioInterruptAcknowledge(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioInsertedAcknowledge, CsrSdioRemovedAcknowledge - * - * DESCRIPTION - * Acknowledge that a signalled inserted/removed event has been handled. - * Shall only be called once, and exactly once for each signalled event to - * the corresponding function. - * - * PARAMETERS - * function - Pointer to struct representing the function to which the - * inserted was signalled. - * result (CsrSdioInsertedAcknowledge only) - * CSR_RESULT_SUCCESS - The Function Driver has accepted the - * function, and the function is attached to - * the Function Driver until the - * CsrSdioRemovedCallback is called and - * acknowledged. - * CSR_RESULT_FAILURE - Unable to accept the function. The - * function is not attached to the Function - * Driver, and it may be passed to another - * Function Driver which supports the - * function. - * - *----------------------------------------------------------------------------*/ -void CsrSdioInsertedAcknowledge(CsrSdioFunction *function, CsrResult result); -void CsrSdioRemovedAcknowledge(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioSuspendAcknowledge, CsrSdioResumeAcknowledge - * - * DESCRIPTION - * Acknowledge that a signalled suspend event has been handled. Shall only - * be called once, and exactly once for each signalled event to the - * corresponding function. - * - * PARAMETERS - * function - Pointer to struct representing the function to which the - * event was signalled. - * result - * CSR_RESULT_SUCCESS - Successfully suspended/resumed. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * - *----------------------------------------------------------------------------*/ -void CsrSdioSuspendAcknowledge(CsrSdioFunction *function, CsrResult result); -void CsrSdioResumeAcknowledge(CsrSdioFunction *function, CsrResult result); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioBlockSizeSet - * - * DESCRIPTION - * Set the block size to use for the function. The actual configured block - * size shall be the minimum of: - * 1) Maximum block size supported by the function. - * 2) Maximum block size supported by the host controller. - * 3) The block size specified by the blockSize argument. - * - * When this function returns, the actual configured block size is - * available in the blockSize member of the function struct. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * blockSize - Block size to use for the function. Valid range is 1 to - * 2048. - * - * RETURNS - * CSR_RESULT_SUCCESS - The block size register on the chip - * was updated. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. The configured block - * size is undefined. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device. - * - * NOTE: If the SDIO R5 response is available, and the FUNCTION_NUMBER - * bits is set, CSR_SDIO_RESULT_INVALID_VALUE shall be returned. - * If the ERROR bit is set (but not FUNCTION_NUMBER), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - * NOTE: Setting the block size requires two individual operations. The - * implementation shall ignore the OUT_OF_RANGE bit of the SDIO R5 - * response for the first operation, as the partially configured - * block size may be out of range, even if the final block size - * (after the second operation) is in the valid range. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioBlockSizeSet(CsrSdioFunction *function, u16 blockSize); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioMaxBusClockFrequencySet - * - * DESCRIPTION - * Set the maximum clock frequency to use for the device associated with - * the specified function. The actual configured clock frequency for the - * device shall be the minimum of: - * 1) Maximum clock frequency supported by the device. - * 2) Maximum clock frequency supported by the host controller. - * 3) Maximum clock frequency specified for any function on the same - * device. - * - * If the clock frequency exceeds 25MHz, it is the responsibility of the - * SDIO driver to enable high speed mode on the device, using the standard - * defined procedure, before increasing the frequency beyond the limit. - * - * Note that the clock frequency configured affects all functions on the - * same device. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * maxFrequency - The maximum clock frequency for the function in Hertz. - * - * RETURNS - * CSR_RESULT_SUCCESS - The maximum clock frequency was successfully - * set for the function. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * - * NOTE: If the SDIO R5 response is available, and the FUNCTION_NUMBER - * bits is set, CSR_SDIO_RESULT_INVALID_VALUE shall be returned. - * If the ERROR bit is set (but not FUNCTION_NUMBER), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, u32 maxFrequency); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioRead8, CsrSdioWrite8, CsrSdioRead8Async, CsrSdioWrite8Async - * - * DESCRIPTION - * Read/write an 8bit value from/to the specified register address. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * address - Register address within the function. - * data - The data to read/write. - * callback - The function to call on operation completion. - * - * RETURNS - * CSR_RESULT_SUCCESS - The data was successfully read/written. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. No data read/written. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device. - * - * NOTE: If the SDIO R5 response is available, and either of the - * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit - * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - * NOTE: The CsrSdioRead8Async and CsrSdioWrite8Async functions return - * immediately, and the supplied callback function is called when the - * operation is complete. The result value is given as an argument to - * the callback function. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioRead8(CsrSdioFunction *function, u32 address, u8 *data); -CsrResult CsrSdioWrite8(CsrSdioFunction *function, u32 address, u8 data); -void CsrSdioRead8Async(CsrSdioFunction *function, u32 address, u8 *data, CsrSdioAsyncCallback callback); -void CsrSdioWrite8Async(CsrSdioFunction *function, u32 address, u8 data, CsrSdioAsyncCallback callback); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioRead16, CsrSdioWrite16, CsrSdioRead16Async, CsrSdioWrite16Async - * - * DESCRIPTION - * Read/write a 16bit value from/to the specified register address. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * address - Register address within the function. - * data - The data to read/write. - * callback - The function to call on operation completion. - * - * RETURNS - * CSR_RESULT_SUCCESS - The data was successfully read/written. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. Data may have been - * partially read/written. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device. - * - * NOTE: If the SDIO R5 response is available, and either of the - * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit - * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - * NOTE: The CsrSdioRead16Async and CsrSdioWrite16Async functions return - * immediately, and the supplied callback function is called when the - * operation is complete. The result value is given as an argument to - * the callback function. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioRead16(CsrSdioFunction *function, u32 address, u16 *data); -CsrResult CsrSdioWrite16(CsrSdioFunction *function, u32 address, u16 data); -void CsrSdioRead16Async(CsrSdioFunction *function, u32 address, u16 *data, CsrSdioAsyncCallback callback); -void CsrSdioWrite16Async(CsrSdioFunction *function, u32 address, u16 data, CsrSdioAsyncCallback callback); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioF0Read8, CsrSdioF0Write8, CsrSdioF0Read8Async, - * CsrSdioF0Write8Async - * - * DESCRIPTION - * Read/write an 8bit value from/to the specified register address in - * function 0. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * address - Register address within the function. - * data - The data to read/write. - * callback - The function to call on operation completion. - * - * RETURNS - * CSR_RESULT_SUCCESS - The data was successfully read/written. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. No data read/written. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device. - * - * NOTE: If the SDIO R5 response is available, and either of the - * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit - * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - * NOTE: The CsrSdioF0Read8Async and CsrSdioF0Write8Async functions return - * immediately, and the supplied callback function is called when the - * operation is complete. The result value is given as an argument to - * the callback function. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioF0Read8(CsrSdioFunction *function, u32 address, u8 *data); -CsrResult CsrSdioF0Write8(CsrSdioFunction *function, u32 address, u8 data); -void CsrSdioF0Read8Async(CsrSdioFunction *function, u32 address, u8 *data, CsrSdioAsyncCallback callback); -void CsrSdioF0Write8Async(CsrSdioFunction *function, u32 address, u8 data, CsrSdioAsyncCallback callback); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioRead, CsrSdioWrite, CsrSdioReadAsync, CsrSdioWriteAsync - * - * DESCRIPTION - * Read/write a specified number of bytes from/to the specified register - * address. - * - * PARAMETERS - * function - Pointer to struct representing the function. - * address - Register address within the function. - * data - The data to read/write. - * length - Number of byte to read/write. - * callback - The function to call on operation completion. - * - * RETURNS - * CSR_RESULT_SUCCESS - The data was successfully read/written. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. Data may have been - * partially read/written. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device. - * - * NOTE: If the SDIO R5 response is available, and either of the - * FUNCTION_NUMBER or OUT_OF_RANGE bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit - * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE), - * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and - * COM_CRC_ERROR bits shall be ignored. - * - * If the CSPI response is available, and any of the - * FUNCTION_DISABLED or CLOCK_DISABLED bits are set, - * CSR_SDIO_RESULT_INVALID_VALUE will be returned. - * - * NOTE: The CsrSdioF0Read8Async and CsrSdioF0Write8Async functions return - * immediately, and the supplied callback function is called when the - * operation is complete. The result value is given as an argument to - * the callback function. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioRead(CsrSdioFunction *function, u32 address, void *data, u32 length); -CsrResult CsrSdioWrite(CsrSdioFunction *function, u32 address, const void *data, u32 length); -void CsrSdioReadAsync(CsrSdioFunction *function, u32 address, void *data, u32 length, CsrSdioAsyncCallback callback); -void CsrSdioWriteAsync(CsrSdioFunction *function, u32 address, const void *data, u32 length, CsrSdioAsyncCallback callback); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioPowerOn, CsrSdioPowerOff - * - * DESCRIPTION - * Power on/off the device. - * - * PARAMETERS - * function - Pointer to struct representing the function that resides on - * the device to power on/off. - * - * RETURNS (only CsrSdioPowerOn) - * CSR_RESULT_SUCCESS - Power was successfully reapplied and the device - * has been reinitialised. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred during reinitialisation. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device during - * reinitialisation. - * CSR_SDIO_RESULT_NOT_RESET - The power was not removed by the - * CsrSdioPowerOff call. The state of the - * device is unchanged. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioPowerOn(CsrSdioFunction *function); -void CsrSdioPowerOff(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioHardReset - * - * DESCRIPTION - * Perform a hardware reset of the device. - * - * PARAMETERS - * function - Pointer to struct representing the function that resides on - * the device to hard reset. - * - * RETURNS - * CSR_RESULT_SUCCESS - Reset was successfully performed and the device - * has been reinitialised. - * CSR_RESULT_FAILURE - Unspecified/unknown error. - * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore. - * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred during reinitialisation. - * CSR_SDIO_RESULT_TIMEOUT - No response from the device during - * reinitialisation. - * CSR_SDIO_RESULT_NOT_RESET - The reset was not applied because it is not - * supported. The state of the device is - * unchanged. - * - *----------------------------------------------------------------------------*/ -CsrResult CsrSdioHardReset(CsrSdioFunction *function); - -/*----------------------------------------------------------------------------* - * NAME - * CsrSdioFunctionActive, CsrSdioFunctionIdle - * - * DESCRIPTION - * - * PARAMETERS - * function - Pointer to struct representing the function. - * - *----------------------------------------------------------------------------*/ -void CsrSdioFunctionActive(CsrSdioFunction *function); -void CsrSdioFunctionIdle(CsrSdioFunction *function); - -#endif diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c deleted file mode 100644 index 9713b9afef64..000000000000 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ /dev/null @@ -1,100 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include <linux/module.h> -#include <linux/slab.h> -#include "csr_prim_defs.h" -#include "csr_msgconv.h" -#include "csr_macro.h" - -void CsrUint8Des(u8 *value, u8 *buffer, size_t *offset) -{ - *value = buffer[*offset]; - *offset += sizeof(*value); -} -EXPORT_SYMBOL_GPL(CsrUint8Des); - -void CsrUint16Des(u16 *value, u8 *buffer, size_t *offset) -{ - *value = (buffer[*offset + 0] << 0) | - (buffer[*offset + 1] << 8); - *offset += sizeof(*value); -} -EXPORT_SYMBOL_GPL(CsrUint16Des); - -void CsrUint32Des(u32 *value, u8 *buffer, size_t *offset) -{ - *value = (buffer[*offset + 0] << 0) | - (buffer[*offset + 1] << 8) | - (buffer[*offset + 2] << 16) | - (buffer[*offset + 3] << 24); - *offset += sizeof(*value); -} -EXPORT_SYMBOL_GPL(CsrUint32Des); - -void CsrMemCpyDes(void *value, u8 *buffer, size_t *offset, size_t length) -{ - memcpy(value, &buffer[*offset], length); - *offset += length; -} -EXPORT_SYMBOL_GPL(CsrMemCpyDes); - -void CsrCharStringDes(char **value, u8 *buffer, size_t *offset) -{ - *value = kstrdup((char *) &buffer[*offset], GFP_KERNEL); - *offset += strlen(*value) + 1; -} -EXPORT_SYMBOL_GPL(CsrCharStringDes); - -void CsrUint8Ser(u8 *buffer, size_t *offset, u8 value) -{ - buffer[*offset] = value; - *offset += sizeof(value); -} -EXPORT_SYMBOL_GPL(CsrUint8Ser); - -void CsrUint16Ser(u8 *buffer, size_t *offset, u16 value) -{ - buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF); - buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF); - *offset += sizeof(value); -} -EXPORT_SYMBOL_GPL(CsrUint16Ser); - -void CsrUint32Ser(u8 *buffer, size_t *offset, u32 value) -{ - buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF); - buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF); - buffer[*offset + 2] = (u8) ((value >> 16) & 0xFF); - buffer[*offset + 3] = (u8) ((value >> 24) & 0xFF); - *offset += sizeof(value); -} -EXPORT_SYMBOL_GPL(CsrUint32Ser); - -void CsrMemCpySer(u8 *buffer, size_t *offset, const void *value, size_t length) -{ - memcpy(&buffer[*offset], value, length); - *offset += length; -} -EXPORT_SYMBOL_GPL(CsrMemCpySer); - -void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value) -{ - if (value) - { - strcpy(((char *) &buffer[*offset]), value); - *offset += strlen(value) + 1; - } - else - { - CsrUint8Ser(buffer, offset, 0); - } -} -EXPORT_SYMBOL_GPL(CsrCharStringSer); diff --git a/drivers/staging/csr/csr_time.c b/drivers/staging/csr/csr_time.c deleted file mode 100644 index 01179e46f47d..000000000000 --- a/drivers/staging/csr/csr_time.c +++ /dev/null @@ -1,33 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include <linux/kernel.h> -#include <linux/time.h> -#include <linux/module.h> - -#include "csr_time.h" - -u32 CsrTimeGet(u32 *high) -{ - struct timespec ts; - u64 time; - u32 low; - - ts = current_kernel_time(); - time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000; - - if (high != NULL) - *high = (u32) ((time >> 32) & 0xFFFFFFFF); - - low = (u32) (time & 0xFFFFFFFF); - - return low; -} -EXPORT_SYMBOL_GPL(CsrTimeGet); diff --git a/drivers/staging/csr/csr_time.h b/drivers/staging/csr/csr_time.h deleted file mode 100644 index fc29e8e5e478..000000000000 --- a/drivers/staging/csr/csr_time.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef CSR_TIME_H__ -#define CSR_TIME_H__ -/***************************************************************************** - -(c) Cambridge Silicon Radio Limited 2010 -All rights reserved and confidential information of CSR - -Refer to LICENSE.txt included with this source for details -on the license terms. - -*****************************************************************************/ - -#include <linux/types.h> - -/******************************************************************************* - -NAME - CsrTimeGet - -DESCRIPTION - Returns the current system time in a low and a high part. The low part - is expressed in microseconds. The high part is incremented when the low - part wraps to provide an extended range. - - The caller may provide a NULL pointer as the high parameter. - In this case the function just returns the low part and ignores the - high parameter. - - Although the time is expressed in microseconds the actual resolution is - platform dependent and can be less. It is recommended that the - resolution is at least 10 milliseconds. - -PARAMETERS - high - Pointer to variable that will receive the high part of the - current system time. Passing NULL is valid. - -RETURNS - Low part of current system time in microseconds. - -*******************************************************************************/ -u32 CsrTimeGet(u32 *high); - - -/*------------------------------------------------------------------*/ -/* CsrTime Macros */ -/*------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------------* - * NAME - * CsrTimeAdd - * - * DESCRIPTION - * Add two time values. Adding the numbers can overflow the range of a - * CsrTime, so the user must be cautious. - * - * RETURNS - * CsrTime - the sum of "t1" and "t2". - * - *----------------------------------------------------------------------------*/ -#define CsrTimeAdd(t1, t2) ((t1) + (t2)) - -/*----------------------------------------------------------------------------* - * NAME - * CsrTimeSub - * - * DESCRIPTION - * Subtract two time values. Subtracting the numbers can provoke an - * underflow, so the user must be cautious. - * - * RETURNS - * CsrTime - "t1" - "t2". - * - *----------------------------------------------------------------------------*/ -#define CsrTimeSub(t1, t2) ((s32) (t1) - (s32) (t2)) - -#endif diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c deleted file mode 100644 index c3aa9d509e5c..000000000000 --- a/drivers/staging/csr/csr_util.c +++ /dev/null @@ -1,15 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include <linux/module.h> - -MODULE_DESCRIPTION("CSR Operating System Kernel Abstraction"); -MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); -MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/csr_wifi_common.h b/drivers/staging/csr/csr_wifi_common.h deleted file mode 100644 index efc43a525a3d..000000000000 --- a/drivers/staging/csr/csr_wifi_common.h +++ /dev/null @@ -1,101 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifndef CSR_WIFI_COMMON_H__ -#define CSR_WIFI_COMMON_H__ - -#include <linux/types.h> -#include "csr_result.h" - -/* MAC address */ -typedef struct -{ - u8 a[6]; -} CsrWifiMacAddress; - -/* IPv4 address */ -typedef struct -{ - u8 a[4]; -} CsrWifiIp4Address; - -/* IPv6 address */ -typedef struct -{ - u8 a[16]; -} CsrWifiIp6Address; - -typedef struct -{ - u8 ssid[32]; - u8 length; -} CsrWifiSsid; - -/******************************************************************************* - - DESCRIPTION - Result values used on the Wifi Interfaces - - VALUES - CSR_RESULT_SUCCESS - - The request/procedure succeeded - CSR_RESULT_FAILURE - - The request/procedure did not succeed because of an error - CSR_WIFI_RESULT_NOT_FOUND - - The request did not succeed because some resource was not - found. - CSR_WIFI_RESULT_TIMED_OUT - - The request/procedure did not succeed because of a time out - CSR_WIFI_RESULT_CANCELLED - - The request was canceled due to another conflicting - request that was issued before this one was completed - CSR_WIFI_RESULT_INVALID_PARAMETER - - The request/procedure did not succeed because it had an - invalid parameter - CSR_WIFI_RESULT_NO_ROOM - - The request did not succeed due to a lack of resources, - e.g. out of memory problem. - CSR_WIFI_RESULT_UNSUPPORTED - - The request/procedure did not succeed because the feature - is not supported yet - CSR_WIFI_RESULT_UNAVAILABLE - - The request cannot be processed at this time - CSR_WIFI_RESULT_WIFI_OFF - - The requested action is not available because Wi-Fi is - currently off - CSR_WIFI_RESULT_SECURITY_ERROR - - The request/procedure did not succeed because of a security - error - CSR_WIFI_RESULT_MIB_SET_FAILURE - - MIB Set Failure: either the MIB OID to be written to does - not exist or the MIB Value is invalid. - CSR_WIFI_RESULT_INVALID_INTERFACE_TAG - - The supplied Interface Tag is not valid. - CSR_WIFI_RESULT_P2P_NOA_CONFIG_CONFLICT - - The new NOA configuration conflicts with the existing NOA configuration - hence not accepted" -*******************************************************************************/ -#define CSR_WIFI_RESULT_NOT_FOUND ((CsrResult) 0x0001) -#define CSR_WIFI_RESULT_TIMED_OUT ((CsrResult) 0x0002) -#define CSR_WIFI_RESULT_CANCELLED ((CsrResult) 0x0003) -#define CSR_WIFI_RESULT_INVALID_PARAMETER ((CsrResult) 0x0004) -#define CSR_WIFI_RESULT_NO_ROOM ((CsrResult) 0x0005) -#define CSR_WIFI_RESULT_UNSUPPORTED ((CsrResult) 0x0006) -#define CSR_WIFI_RESULT_UNAVAILABLE ((CsrResult) 0x0007) -#define CSR_WIFI_RESULT_WIFI_OFF ((CsrResult) 0x0008) -#define CSR_WIFI_RESULT_SECURITY_ERROR ((CsrResult) 0x0009) -#define CSR_WIFI_RESULT_MIB_SET_FAILURE ((CsrResult) 0x000A) -#define CSR_WIFI_RESULT_INVALID_INTERFACE_TAG ((CsrResult) 0x000B) -#define CSR_WIFI_RESULT_P2P_NOA_CONFIG_CONFLICT ((CsrResult) 0x000C) - -#define CSR_WIFI_VERSION "5.1.0.0" - -#endif - diff --git a/drivers/staging/csr/csr_wifi_fsm.h b/drivers/staging/csr/csr_wifi_fsm.h deleted file mode 100644 index fc5c5aa6a3c4..000000000000 --- a/drivers/staging/csr/csr_wifi_fsm.h +++ /dev/null @@ -1,240 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifndef CSR_WIFI_FSM_H -#define CSR_WIFI_FSM_H - -#include "csr_prim_defs.h" -#include "csr_log_text.h" -#include "csr_wifi_fsm_event.h" - -/* including this file for CsrWifiInterfaceMode*/ -#include "csr_wifi_common.h" - -#define CSR_WIFI_FSM_ENV (0xFFFF) - -/** - * @brief - * Toplevel FSM context data - * - * @par Description - * Holds ALL FSM static and dynamic data for a FSM - */ -typedef struct CsrWifiFsmContext CsrWifiFsmContext; - -/** - * @brief - * FSM External Wakeup CallbackFunction Pointer - * - * @par Description - * Defines the external wakeup function for the FSM - * to call when an external event is injected into the systen - * - * @param[in] context : External context - * - * @return - * void - */ -typedef void (*CsrWifiFsmExternalWakupCallbackPtr)(void *context); - -/** - * @brief - * Initialises a top level FSM context - * - * @par Description - * Initialises the FSM Context to an initial state and allocates - * space for "maxProcesses" number of instances - * - * @param[in] osaContext : OSA context - * @param[in] applicationContext : Internal fsm application context - * @param[in] externalContext : External context - * @param[in] maxProcesses : Max processes to allocate room for - * - * @return - * CsrWifiFsmContext* fsm context - */ -extern CsrWifiFsmContext* CsrWifiFsmInit(void *applicationContext, void *externalContext, u16 maxProcesses, CsrLogTextTaskId loggingTaskId); - -/** - * @brief - * Resets the FSM's back to first conditions - * - * @par Description - * This function is used to free any dynamic resources allocated for the - * given context by CsrWifiFsmInit(). - * The FSM's reset function is called to cleanup any fsm specific memory - * The reset function does NOT need to free the fsm data pointer as - * CsrWifiFsmShutdown() will do it. - * the FSM's init function is call again to reinitialise the FSM context. - * CsrWifiFsmReset() should NEVER be called when CsrWifiFsmExecute() is running. - * - * @param[in] context : FSM context - * - * @return - * void - */ -extern void CsrWifiFsmReset(CsrWifiFsmContext *context); - -/** - * @brief - * Frees resources allocated by CsrWifiFsmInit - * - * @par Description - * This function is used to free any dynamic resources allocated for the - * given context by CsrWifiFsmInit(), prior to complete termination of - * the program. - * The FSM's reset function is called to cleanup any fsm specific memory. - * The reset function does NOT need to free the fsm data pointer as - * CsrWifiFsmShutdown() will do it. - * CsrWifiFsmShutdown() should NEVER be called when CsrWifiFsmExecute() is running. - * - * @param[in] context : FSM context - * - * @return - * void - */ -extern void CsrWifiFsmShutdown(CsrWifiFsmContext *context); - -/** - * @brief - * Executes the fsm context - * - * @par Description - * Executes the FSM context and runs until ALL events in the context are processed. - * When no more events are left to process then CsrWifiFsmExecute() returns to a time - * specifying when to next call the CsrWifiFsmExecute() - * Scheduling, threading, blocking and external event notification are outside - * the scope of the FSM and CsrWifiFsmExecute(). - * - * @param[in] context : FSM context - * - * @return - * u32 Time in ms until next timeout or 0xFFFFFFFF for no timer set - */ -extern u32 CsrWifiFsmExecute(CsrWifiFsmContext *context); - -/** - * @brief - * Adds an event to the FSM context's external event queue for processing - * - * @par Description - * Adds an event to the contexts external queue - * This is thread safe and adds an event to the fsm's external event queue. - * - * @param[in] context : FSM context - * @param[in] event : event to add to the event queue - * @param[in] source : source of the event (this can be a synergy task queue or an fsm instance id) - * @param[in] destination : destination of the event (This can be a fsm instance id or CSR_WIFI_FSM_ENV) - * @param[in] id : event id - * - * @return - * void - */ -extern void CsrWifiFsmSendEventExternal(CsrWifiFsmContext *context, CsrWifiFsmEvent *event, u16 source, u16 destination, CsrPrim primtype, u16 id); - -/** - * @brief - * Adds an Alien event to the FSM context's external event queue for processing - * - * @par Description - * Adds an event to the contexts external queue - * This is thread safe and adds an event to the fsm's external event queue. - * - * @param[in] context : FSM context - * @param[in] event : event to add to the event queue - * @param[in] source : source of the event (this can be a synergy task queue or an fsm instance id) - * @param[in] destination : destination of the event (This can be a fsm instance id or CSR_WIFI_FSM_ENV) - * @param[in] id : event id - */ -#define CsrWifiFsmSendAlienEventExternal(_context, _alienEvent, _source, _destination, _primtype, _id) \ - { \ - CsrWifiFsmAlienEvent *_evt = kmalloc(sizeof(CsrWifiFsmAlienEvent), GFP_KERNEL); \ - _evt->alienEvent = _alienEvent; \ - CsrWifiFsmSendEventExternal(_context, (CsrWifiFsmEvent *)_evt, _source, _destination, _primtype, _id); \ - } - - -/** - * @brief - * Current time of day in ms - * - * @param[in] context : FSM context - * - * @return - * u32 32 bit ms tick - */ -extern u32 CsrWifiFsmGetTimeOfDayMs(CsrWifiFsmContext *context); - -/** - * @brief - * Gets the time until the next FSM timer expiry - * - * @par Description - * Returns the next timeout time or 0 if no timers are set. - * - * @param[in] context : FSM context - * - * @return - * u32 Time in ms until next timeout or 0xFFFFFFFF for no timer set - */ -extern u32 CsrWifiFsmGetNextTimeout(CsrWifiFsmContext *context); - -/** - * @brief - * Fast forwards the fsm timers by ms Milliseconds - * - * @param[in] context : FSM context - * @param[in] ms : Milliseconds to fast forward by - * - * @return - * void - */ -extern void CsrWifiFsmFastForward(CsrWifiFsmContext *context, u16 ms); - -/** - * @brief - * shift the current time of day by ms amount - * - * @par Description - * useful to speed up tests where time needs to pass - * - * @param[in] context : FSM context - * @param[in] ms : ms to adjust time by - * - * @return - * void - */ -extern void CsrWifiFsmTestAdvanceTime(CsrWifiFsmContext *context, u32 ms); - -/** - * @brief - * Check if the fsm has events to process - * - * @param[in] context : FSM context - * - * @return - * u8 returns TRUE if there are events for the FSM to process - */ -extern u8 CsrWifiFsmHasEvents(CsrWifiFsmContext *context); - -/** - * @brief - * function that installs the contexts wakeup function - * - * @param[in] context : FSM context - * @param[in] callback : Callback function pointer - * - * @return - * void - */ -extern void CsrWifiFsmInstallWakeupCallback(CsrWifiFsmContext *context, CsrWifiFsmExternalWakupCallbackPtr callback); - -#endif /* CSR_WIFI_FSM_H */ - diff --git a/drivers/staging/csr/csr_wifi_fsm_event.h b/drivers/staging/csr/csr_wifi_fsm_event.h deleted file mode 100644 index 0690ca955ef5..000000000000 --- a/drivers/staging/csr/csr_wifi_fsm_event.h +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifndef CSR_WIFI_FSM_EVENT_H -#define CSR_WIFI_FSM_EVENT_H - -#include "csr_prim_defs.h" -#include "csr_sched.h" - -/** - * @brief - * FSM event header. - * - * @par Description - * All events MUST have this struct as the FIRST member. - * The next member is used internally for linked lists - */ -typedef struct CsrWifiFsmEvent -{ - CsrPrim type; - u16 primtype; - CsrSchedQid destination; - CsrSchedQid source; - - /* Private pointer to allow an optimal Event list */ - /* NOTE: Ignore this pointer. - * Do not waste code initializing OR freeing it. - * The pointer is used internally in the CsrWifiFsm code - * to avoid a second malloc when queuing events. - */ - struct CsrWifiFsmEvent *next; -} CsrWifiFsmEvent; - -#endif /* CSR_WIFI_FSM_EVENT_H */ - diff --git a/drivers/staging/csr/csr_wifi_fsm_types.h b/drivers/staging/csr/csr_wifi_fsm_types.h deleted file mode 100644 index d21c60a81fcf..000000000000 --- a/drivers/staging/csr/csr_wifi_fsm_types.h +++ /dev/null @@ -1,430 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifndef CSR_WIFI_FSM_TYPES_H -#define CSR_WIFI_FSM_TYPES_H - -#include <linux/types.h> -#include "csr_macro.h" -#include "csr_sched.h" - -#ifdef CSR_WIFI_FSM_MUTEX_ENABLE -#include "csr_framework_ext.h" -#endif - -#include "csr_wifi_fsm.h" - -#define CSR_WIFI_FSM_MAX_TRANSITION_HISTORY 10 - -/** - * @brief - * FSM event list header. - * - * @par Description - * Singly linked list of events. - */ -typedef struct CsrWifiFsmEventList -{ - CsrWifiFsmEvent *first; - CsrWifiFsmEvent *last; -} CsrWifiFsmEventList; - - -/** - * @brief - * FSM timer id. - * - * @par Description - * Composite Id made up of the type, dest and a unique id so - * CsrWifiFsmRemoveTimer knows where to look when removing the timer - */ -typedef struct CsrWifiFsmTimerId -{ - CsrPrim type; - u16 primtype; - CsrSchedQid destination; - u16 uniqueid; -} CsrWifiFsmTimerId; - -/** - * @brief - * FSM timer header. - * - * @par Description - * All timer MUST have this struct as the FIRST member. - * The first members of the structure MUST remain compatable - * with the CsrWifiFsmEvent so that timers are just specialised events - */ -typedef struct CsrWifiFsmTimer -{ - CsrPrim type; - u16 primtype; - CsrSchedQid destination; - CsrSchedQid source; - - /* Private pointer to allow an optimal Event list */ - struct CsrWifiFsmTimer *next; - - CsrWifiFsmTimerId timerid; - u32 timeoutTimeMs; -} CsrWifiFsmTimer; - - -/** - * @brief - * Fsm Alien Event - * - * @par Description - * Allows the wrapping of alien events that do not use CsrWifiFsmEvent - * as the first member of the Event struct - */ -typedef struct -{ - CsrWifiFsmEvent event; - void *alienEvent; -} CsrWifiFsmAlienEvent; - - -/** - * @brief - * FSM timer list header. - * - * @par Description - * Singly linked list of timers. - */ -typedef struct CsrWifiFsmTimerList -{ - CsrWifiFsmTimer *first; - CsrWifiFsmTimer *last; - u16 nexttimerid; -} CsrWifiFsmTimerList; - -/** - * @brief - * Process Entry Function Pointer - * - * @par Description - * Defines the entry function for a processes. - * Called at process initialisation. - * - * @param[in] context : FSM context - * - * @return - * void - */ -typedef void (*CsrWifiFsmProcEntryFnPtr)(CsrWifiFsmContext *context); - -/** - * @brief - * Process Transition Function Pointer - * - * @par Description - * Defines a transition function for a processes. - * Called when an event causes a transition on a process - * - * @param[in] CsrWifiFsmContext* : FSM context - * @param[in] void* : FSM data (can be NULL) - * @param[in] const CsrWifiFsmEvent* : event to process - * - * @return - * void - */ -typedef void (*CsrWifiFsmTransitionFnPtr)(CsrWifiFsmContext *context, void *fsmData, const CsrWifiFsmEvent *event); - -/** - * @brief - * Process reset/shutdown Function Pointer - * - * @par Description - * Defines the reset/shutdown function for a processes. - * Called to reset or shutdown an fsm. - * - * @param[in] context : FSM context - * - * @return - * void - */ -typedef void (*CsrWifiFsmProcResetFnPtr)(CsrWifiFsmContext *context); - -/** - * @brief - * FSM Default Destination CallbackFunction Pointer - * - * @par Description - * Defines the default destination function for the FSM - * to call when an event does not have a valid destination. - * This - * - * @param[in] context : External context - * - * @return - * u16 a valid destination OR CSR_WIFI_FSM_ENV - */ -typedef u16 (*CsrWifiFsmDestLookupCallbackPtr)(void *context, const CsrWifiFsmEvent *event); - - -#ifdef CSR_WIFI_FSM_DUMP_ENABLE -/** - * @brief - * Trace Dump Function Pointer - * - * @par Description - * Called when we want to trace the FSM - * - * @param[in] context : FSM context - * @param[in] id : fsm id - * - * @return - * void - */ -typedef void (*CsrWifiFsmDumpFnPtr)(CsrWifiFsmContext *context, void *fsmData); -#endif - -/** - * @brief - * Event ID to transition function entry - * - * @par Description - * Event ID to Transition Entry in a state table. - */ -typedef struct -{ - u32 eventid; - CsrWifiFsmTransitionFnPtr transition; -#ifdef CSR_LOG_ENABLE - const char *transitionName; -#endif -} CsrWifiFsmEventEntry; - -/** - * @brief - * Single State's Transition Table - * - * @par Description - * Stores Data for a single State's event to - * transition functions mapping - */ -typedef struct -{ - const u8 numEntries; - const u8 saveAll; - const CsrWifiFsmEventEntry *eventEntryArray; /* array of transition function pointers for state */ -#ifdef CSR_LOG_ENABLE - u16 stateNumber; - const char *stateName; -#endif -} CsrWifiFsmTableEntry; - -/** - * @brief - * Process State Transtion table - * - * @par Description - * Stores Data for a processes State to transition table - */ -typedef struct -{ - u16 numStates; /* number of states */ - const CsrWifiFsmTableEntry *aStateEventMatrix; /* state event matrix */ -} CsrWifiFsmTransitionFunctionTable; - -/** - * @brief - * Const Process definition - * - * @par Description - * Constant process specification. - * This is ALL the non dynamic data that defines - * a process. - */ -typedef struct -{ - const char *processName; - const u32 processId; - const CsrWifiFsmTransitionFunctionTable transitionTable; - const CsrWifiFsmTableEntry unhandledTransitions; - const CsrWifiFsmTableEntry ignoreFunctions; - const CsrWifiFsmProcEntryFnPtr entryFn; - const CsrWifiFsmProcResetFnPtr resetFn; -#ifdef CSR_WIFI_FSM_DUMP_ENABLE - const CsrWifiFsmDumpFnPtr dumpFn; /* Called to dump fsm specific trace if not NULL */ -#endif -} CsrWifiFsmProcessStateMachine; - -#ifdef CSR_WIFI_FSM_DUMP_ENABLE -/** - * @brief - * Storage for state transition info - */ -typedef struct -{ - u16 transitionNumber; - CsrWifiFsmEvent event; - u16 fromState; - u16 toState; - CsrWifiFsmTransitionFnPtr transitionFn; - u16 transitionCount; /* number consecutive of times this transition was seen */ -#ifdef CSR_LOG_ENABLE - const char *transitionName; -#endif -} CsrWifiFsmTransitionRecord; - -/** - * @brief - * Storage for the last state X transitions - */ -typedef struct -{ - u16 numTransitions; - CsrWifiFsmTransitionRecord records[CSR_WIFI_FSM_MAX_TRANSITION_HISTORY]; -} CsrWifiFsmTransitionRecords; -#endif - -/** - * @brief - * Dynamic Process data - * - * @par Description - * Dynamic process data that is used to keep track of the - * state and data for a process instance - */ -typedef struct -{ - const CsrWifiFsmProcessStateMachine *fsmInfo; /* state machine info that is constant regardless of context */ - u16 instanceId; /* Runtime process id */ - u16 state; /* Current state */ - void *params; /* Instance user data */ - CsrWifiFsmEventList savedEventQueue; /* The saved event queue */ - struct CsrWifiFsmInstanceEntry *subFsm; /* Sub Fsm instance data */ - struct CsrWifiFsmInstanceEntry *subFsmCaller; /* The Fsm instance that created the SubFsm and should be used for callbacks*/ -#ifdef CSR_WIFI_FSM_DUMP_ENABLE - CsrWifiFsmTransitionRecords transitionRecords; /* Last X transitions in the FSM */ -#endif -} CsrWifiFsmInstanceEntry; - -/** - * @brief - * OnCreate Callback Function Pointer - * - * @par Description - * Called when an fsm is created. - * - * @param[in] extContext : External context - * @param[in] instance : FSM instance - * - * @return - * void - */ -typedef void (*CsrWifiFsmOnCreateFnPtr)(void *extContext, const CsrWifiFsmInstanceEntry *instance); - -/** - * @brief - * OnTransition Callback Function Pointer - * - * @par Description - * Called when an event is processed by a fsm - * - * @param[in] extContext : External context - * @param[in] eventEntryArray : Entry data - * @param[in] event : Event - * - * @return - * void - */ -typedef void (*CsrWifiFsmOnTransitionFnPtr)(void *extContext, const CsrWifiFsmEventEntry *eventEntryArray, const CsrWifiFsmEvent *event); - -/** - * @brief - * OnStateChange Callback Function Pointer - * - * @par Description - * Called when CsrWifiFsmNextState is called - * - * @param[in] extContext : External context - * - * @return - * void - */ -typedef void (*CsrWifiFsmOnStateChangeFnPtr)(void *extContext, u16 nextstate); - -/** - * @brief - * OnIgnore,OnError or OnInvalid Callback Function Pointer - * - * @par Description - * Called when an event is processed by a fsm - * - * @param[in] extContext : External context - * @param[in] event : Event - * - * @return - * void - */ -typedef void (*CsrWifiFsmOnEventFnPtr)(void *extContext, const CsrWifiFsmEvent *event); - -/** - * @brief - * Toplevel FSM context data - * - * @par Description - * Holds ALL FSM static and dynamic data for a FSM - */ -struct CsrWifiFsmContext -{ - CsrWifiFsmEventList eventQueue; /* The internal event queue */ - CsrWifiFsmEventList externalEventQueue; /* The external event queue */ -#ifdef CSR_WIFI_FSM_MUTEX_ENABLE - CsrMutexHandle externalEventQueueLock; /* The external event queue mutex */ -#endif - u32 timeOffset; /* Amount to adjust the TimeOfDayMs by */ - CsrWifiFsmTimerList timerQueue; /* The internal timer queue */ - u8 useTempSaveList; /* Should the temp save list be used */ - CsrWifiFsmEventList tempSaveList; /* The temp save event queue */ - CsrWifiFsmEvent *eventForwardedOrSaved; /* The event that was forwarded or Saved */ - u16 maxProcesses; /* Size of instanceArray */ - u16 numProcesses; /* Current number allocated in instanceArray */ - CsrWifiFsmInstanceEntry *instanceArray; /* Array of processes for this component */ - CsrWifiFsmInstanceEntry *ownerInstance; /* The Process that owns currentInstance (SubFsm support) */ - CsrWifiFsmInstanceEntry *currentInstance; /* Current Process that is executing */ - CsrWifiFsmExternalWakupCallbackPtr externalEventFn; /* External event Callback */ - CsrWifiFsmOnEventFnPtr appIgnoreCallback; /* Application Ignore event Callback */ - CsrWifiFsmDestLookupCallbackPtr appEvtDstCallback; /* Application Lookup event Destination Function*/ - - void *applicationContext; /* Internal fsm application context */ - void *externalContext; /* External context (set by the user of the fsm)*/ - CsrLogTextTaskId loggingTaskId; /* Task Id to use in any logging output */ - -#ifndef CSR_WIFI_FSM_SCHEDULER_DISABLED - CsrSchedTid schedTimerId; /* Scheduler TimerId for use in Scheduler Tasks */ - u32 schedTimerNexttimeoutMs; /* Next timeout time for the current timer */ -#endif - -#ifdef CSR_WIFI_FSM_MUTEX_ENABLE -#ifdef CSR_WIFI_FSM_TRANSITION_LOCK - CsrMutexHandle transitionLock; /* Lock when calling transition functions */ -#endif -#endif - -#ifdef CSR_LOG_ENABLE - CsrWifiFsmOnCreateFnPtr onCreate; /* Debug Transition Callback */ - CsrWifiFsmOnTransitionFnPtr onTransition; /* Debug Transition Callback */ - CsrWifiFsmOnTransitionFnPtr onUnhandedCallback; /* Unhanded event Callback */ - CsrWifiFsmOnStateChangeFnPtr onStateChange; /* Debug State Change Callback */ - CsrWifiFsmOnEventFnPtr onIgnoreCallback; /* Ignore event Callback */ - CsrWifiFsmOnEventFnPtr onSaveCallback; /* Save event Callback */ - CsrWifiFsmOnEventFnPtr onErrorCallback; /* Error event Callback */ - CsrWifiFsmOnEventFnPtr onInvalidCallback; /* Invalid event Callback */ -#endif -#ifdef CSR_WIFI_FSM_DUMP_ENABLE - u16 masterTransitionNumber; /* Increments on every transition */ -#endif -}; - -#endif /* CSR_WIFI_FSM_TYPES_H */ diff --git a/drivers/staging/csr/csr_wifi_hip_card.h b/drivers/staging/csr/csr_wifi_hip_card.h deleted file mode 100644 index bd47f606e0de..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_card.h +++ /dev/null @@ -1,114 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - ****************************************************************************** - * FILE : csr_wifi_hip_card.h - * - * PURPOSE : Defines abstract interface for hardware specific functions. - * Note, this is a different file from one of the same name in the - * Windows driver. - * - ***************************************************************************** - */ -#ifndef __CARD_H__ -#define __CARD_H__ - -#include "csr_wifi_hip_card_sdio.h" -#include "csr_wifi_hip_signals.h" -#include "csr_wifi_hip_unifi_udi.h" - - -/***************************************************************************** - * CardEnableInt - - */ -CsrResult CardEnableInt(card_t *card); - -/***************************************************************************** - * CardGenInt - - */ -CsrResult CardGenInt(card_t *card); - -/***************************************************************************** - * CardPendingInt - - */ -CsrResult CardPendingInt(card_t *card, u8 *pintr); - -/***************************************************************************** - * CardDisableInt - - */ -CsrResult CardDisableInt(card_t *card); - -/***************************************************************************** - * CardClearInt - - */ -CsrResult CardClearInt(card_t *card); - -/***************************************************************************** - * CardDisable - - */ -void CardDisable(card_t *card); - -/***************************************************************************** - * CardIntEnabled - - */ -CsrResult CardIntEnabled(card_t *card, u8 *enabled); - -/***************************************************************************** - * CardGetDataSlotSize - */ -u16 CardGetDataSlotSize(card_t *card); - -/***************************************************************************** - * CardWriteBulkData - - */ -CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQueue queue); - - -/***************************************************************************** - * CardClearFromHostDataSlot - - */ -void CardClearFromHostDataSlot(card_t *card, const s16 aSlotNum); - -#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL -/***************************************************************************** - * CardClearFromHostDataSlotWithoutFreeingBulkData - Clear the data stot - * without freeing the bulk data - */ - -void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const s16 aSlotNum); -#endif - -/***************************************************************************** - * CardGetFreeFromHostDataSlots - - */ -u16 CardGetFreeFromHostDataSlots(card_t *card); - -u16 CardAreAllFromHostDataSlotsEmpty(card_t *card); - -CsrResult card_start_processor(card_t *card, enum unifi_dbg_processors_select which); - -CsrResult card_wait_for_firmware_to_start(card_t *card, u32 *paddr); - -CsrResult unifi_dl_firmware(card_t *card, void *arg); -CsrResult unifi_dl_patch(card_t *card, void *arg, u32 boot_ctrl); -CsrResult unifi_do_loader_op(card_t *card, u32 op_addr, u8 opcode); -void* unifi_dl_fw_read_start(card_t *card, s8 is_fw); - -CsrResult unifi_coredump_handle_request(card_t *card); - -CsrResult ConvertCsrSdioToCsrHipResult(card_t *card, CsrResult csrResult); -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -void unifi_debug_log_to_buf(const char *fmt, ...); -void unifi_debug_string_to_buf(const char *str); -void unifi_debug_hex_to_buf(const char *buff, u16 length); -#endif - -#endif /* __CARD_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c deleted file mode 100644 index d5425325894c..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ /dev/null @@ -1,4001 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * FILE: csr_wifi_hip_card_sdio.c - * - * PURPOSE: Implementation of the Card API for SDIO. - * - * NOTES: - * CardInit() is called from the SDIO probe callback when a card is - * inserted. This performs the basic SDIO initialisation, enabling i/o - * etc. - * - * --------------------------------------------------------------------------- - */ -#include <linux/slab.h> -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_conversions.h" -#include "csr_wifi_hip_unifiversion.h" -#include "csr_wifi_hip_card.h" -#include "csr_wifi_hip_card_sdio.h" -#include "csr_wifi_hip_chiphelper.h" - - -/* Time to wait between attempts to read MAILBOX0 */ -#define MAILBOX1_TIMEOUT 10 /* in millisecs */ -#define MAILBOX1_ATTEMPTS 200 /* 2 seconds */ - -#define MAILBOX2_TIMEOUT 5 /* in millisecs */ -#define MAILBOX2_ATTEMPTS 10 /* 50ms */ - -#define RESET_SETTLE_DELAY 25 /* in millisecs */ - -static CsrResult card_init_slots(card_t *card); -static CsrResult card_hw_init(card_t *card); -static CsrResult firmware_present_in_flash(card_t *card); -static void bootstrap_chip_hw(card_t *card); -static CsrResult unifi_reset_hardware(card_t *card); -static CsrResult unifi_hip_init(card_t *card); -static CsrResult card_access_panic(card_t *card); -static CsrResult unifi_read_chip_version(card_t *card); - -/* - * --------------------------------------------------------------------------- - * unifi_alloc_card - * - * Allocate and initialise the card context structure. - * - * Arguments: - * sdio Pointer to SDIO context pointer to pass to low - * level i/o functions. - * ospriv Pointer to O/S private struct to pass when calling - * callbacks to the higher level system. - * - * Returns: - * Pointer to card struct, which represents the driver context or - * NULL if the allocation failed. - * --------------------------------------------------------------------------- - */ -card_t* unifi_alloc_card(CsrSdioFunction *sdio, void *ospriv) -{ - card_t *card; - u32 i; - - - card = kzalloc(sizeof(card_t), GFP_KERNEL); - if (card == NULL) - { - return NULL; - } - - card->sdio_if = sdio; - card->ospriv = ospriv; - - card->unifi_interrupt_seq = 1; - - /* Make these invalid. */ - card->proc_select = (u32)(-1); - card->dmem_page = (u32)(-1); - card->pmem_page = (u32)(-1); - - card->bh_reason_host = 0; - card->bh_reason_unifi = 0; - - for (i = 0; i < sizeof(card->tx_q_paused_flag) / sizeof(card->tx_q_paused_flag[0]); i++) - { - card->tx_q_paused_flag[i] = 0; - } - card->memory_resources_allocated = 0; - - card->low_power_mode = UNIFI_LOW_POWER_DISABLED; - card->periodic_wake_mode = UNIFI_PERIODIC_WAKE_HOST_DISABLED; - - card->host_state = UNIFI_HOST_STATE_AWAKE; - card->intmode = CSR_WIFI_INTMODE_DEFAULT; - - /* - * Memory resources for buffers are allocated when the chip is initialised - * because we need configuration information from the firmware. - */ - - /* - * Initialise wait queues and lists - */ - card->fh_command_queue.q_body = card->fh_command_q_body; - card->fh_command_queue.q_length = UNIFI_SOFT_COMMAND_Q_LENGTH; - - for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) - { - card->fh_traffic_queue[i].q_body = card->fh_traffic_q_body[i]; - card->fh_traffic_queue[i].q_length = UNIFI_SOFT_TRAFFIC_Q_LENGTH; - } - - - /* Initialise mini-coredump pointers in case no coredump buffers - * are requested by the OS layer. - */ - card->request_coredump_on_reset = 0; - card->dump_next_write = NULL; - card->dump_cur_read = NULL; - card->dump_buf = NULL; - -#ifdef UNIFI_DEBUG - /* Determine offset of LSB in pointer for later alignment sanity check. - * Synergy integer types have specific widths, which cause compiler - * warnings when casting pointer types, e.g. on 64-bit systems. - */ - { - u32 val = 0x01234567; - - if (*((u8 *)&val) == 0x01) - { - card->lsb = sizeof(void *) - 1; /* BE */ - } - else - { - card->lsb = 0; /* LE */ - } - } -#endif - return card; -} /* unifi_alloc_card() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_init_card - * - * Reset the hardware and perform HIP initialization - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * CsrResult code - * CSR_RESULT_SUCCESS if successful - * --------------------------------------------------------------------------- - */ -CsrResult unifi_init_card(card_t *card, s32 led_mask) -{ - CsrResult r; - - - if (card == NULL) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - r = unifi_init(card); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - r = unifi_hip_init(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to start host protocol.\n"); - return r; - } - - return CSR_RESULT_SUCCESS; -} - - -/* - * --------------------------------------------------------------------------- - * unifi_init - * - * Init the hardware. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * CsrResult code - * CSR_RESULT_SUCCESS if successful - * --------------------------------------------------------------------------- - */ -CsrResult unifi_init(card_t *card) -{ - CsrResult r; - CsrResult csrResult; - - if (card == NULL) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - /* - * Disable the SDIO interrupts while initialising UniFi. - * Re-enable them when f/w is running. - */ - csrResult = CsrSdioInterruptDisable(card->sdio_if); - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - return CSR_WIFI_HIP_RESULT_NO_DEVICE; - } - - /* - * UniFi's PLL may start with a slow clock (~ 1 MHz) so initially - * set the SDIO bus clock to a similar value or SDIO accesses may - * fail. - */ - csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_SAFE_HZ); - if (csrResult != CSR_RESULT_SUCCESS) - { - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - return r; - } - card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ; - - /* - * Reset UniFi. Note, this only resets the WLAN function part of the chip, - * the SDIO interface is not reset. - */ - unifi_trace(card->ospriv, UDBG1, "Resetting UniFi\n"); - r = unifi_reset_hardware(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to reset UniFi\n"); - return r; - } - - /* Reset the power save mode, to be active until the MLME-reset is complete */ - r = unifi_configure_low_power_mode(card, - UNIFI_LOW_POWER_DISABLED, UNIFI_PERIODIC_WAKE_HOST_DISABLED); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to set power save mode\n"); - return r; - } - - /* - * Set initial value of page registers. - * The page registers will be maintained by unifi_read...() and - * unifi_write...(). - */ - card->proc_select = (u32)(-1); - card->dmem_page = (u32)(-1); - card->pmem_page = (u32)(-1); - r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW3_PAGE(card->helper) * 2, 0); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write SHARED_DMEM_PAGE\n"); - return r; - } - r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW2_PAGE(card->helper) * 2, 0); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write PROG_MEM2_PAGE\n"); - return r; - } - - /* - * If the driver has reset UniFi due to previous SDIO failure, this may - * have been due to a chip watchdog reset. In this case, the driver may - * have requested a mini-coredump which needs to be captured now the - * SDIO interface is alive. - */ - (void)unifi_coredump_handle_request(card); - - /* - * Probe to see if the UniFi has ROM/flash to boot from. CSR6xxx should do. - */ - r = firmware_present_in_flash(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r == CSR_WIFI_HIP_RESULT_NOT_FOUND) - { - unifi_error(card->ospriv, "No firmware found\n"); - } - else if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Probe for Flash failed\n"); - } - - return r; -} /* unifi_init() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_download - * - * Load the firmware. - * - * Arguments: - * card Pointer to card struct - * led_mask Loader LED mask - * - * Returns: - * CSR_RESULT_SUCCESS on success - * CsrResult error code on failure. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_download(card_t *card, s32 led_mask) -{ - CsrResult r; - void *dlpriv; - - if (card == NULL) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - /* Set the loader led mask */ - card->loader_led_mask = led_mask; - - /* Get the firmware file information */ - unifi_trace(card->ospriv, UDBG1, "downloading firmware...\n"); - - dlpriv = unifi_dl_fw_read_start(card, UNIFI_FW_STA); - if (dlpriv == NULL) - { - return CSR_WIFI_HIP_RESULT_NOT_FOUND; - } - - /* Download the firmware. */ - r = unifi_dl_firmware(card, dlpriv); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to download firmware\n"); - return r; - } - - /* Free the firmware file information. */ - unifi_fw_read_stop(card->ospriv, dlpriv); - - return CSR_RESULT_SUCCESS; -} /* unifi_download() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_hip_init - * - * This function performs the f/w initialisation sequence as described - * in the Unifi Host Interface Protocol Specification. - * It allocates memory for host-side slot data and signal queues. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * CSR_RESULT_SUCCESS on success or else a CSR error code - * - * Notes: - * The firmware must have been downloaded. - * --------------------------------------------------------------------------- - */ -static CsrResult unifi_hip_init(card_t *card) -{ - CsrResult r; - CsrResult csrResult; - - r = card_hw_init(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to establish communication with UniFi\n"); - return r; - } -#ifdef CSR_PRE_ALLOC_NET_DATA - /* if there is any preallocated netdata left from the prev session free it now */ - prealloc_netdata_free(card); -#endif - /* - * Allocate memory for host-side slot data and signal queues. - * We need the config info read from the firmware to know how much - * memory to allocate. - */ - r = card_init_slots(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Init slots failed: %d\n", r); - return r; - } - - unifi_trace(card->ospriv, UDBG2, "Sending first UniFi interrupt\n"); - - r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - /* Enable the SDIO interrupts now that the f/w is running. */ - csrResult = CsrSdioInterruptEnable(card->sdio_if); - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - return CSR_WIFI_HIP_RESULT_NO_DEVICE; - } - - /* Signal the UniFi to start handling messages */ - r = CardGenInt(card); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - return CSR_RESULT_SUCCESS; -} /* unifi_hip_init() */ - - -/* - * --------------------------------------------------------------------------- - * _build_sdio_config_data - * - * Unpack the SDIO configuration information from a buffer read from - * UniFi into a host structure. - * The data is byte-swapped for a big-endian host if necessary by the - * UNPACK... macros. - * - * Arguments: - * card Pointer to card struct - * cfg_data Destination structure to unpack into. - * cfg_data_buf Source buffer to read from. This should be the raw - * data read from UniFi. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void _build_sdio_config_data(sdio_config_data_t *cfg_data, - const u8 *cfg_data_buf) -{ - s16 offset = 0; - - cfg_data->version = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT16; - - cfg_data->sdio_ctrl_offset = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT16; - - cfg_data->fromhost_sigbuf_handle = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT16; - - cfg_data->tohost_sigbuf_handle = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT16; - - cfg_data->num_fromhost_sig_frags = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT16; - - cfg_data->num_tohost_sig_frags = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT16; - - cfg_data->num_fromhost_data_slots = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT16; - - cfg_data->num_tohost_data_slots = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT16; - - cfg_data->data_slot_size = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT16; - - cfg_data->initialised = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT16; - - cfg_data->overlay_size = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT32; - - cfg_data->data_slot_round = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT16; - - cfg_data->sig_frag_size = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); - offset += SIZEOF_UINT16; - - cfg_data->tohost_signal_padding = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset); -} /* _build_sdio_config_data() */ - - -/* - * - Function ---------------------------------------------------------------- - * card_hw_init() - * - * Perform the initialisation procedure described in the UniFi Host - * Interface Protocol document (section 3.3.8) and read the run-time - * configuration information from the UniFi. This is stuff like number - * of bulk data slots etc. - * - * The card enumeration and SD initialisation has already been done by - * the SDIO library, see card_sdio_init(). - * - * The initialisation is done when firmware is ready, i.e. this may need - * to be called after a f/w download operation. - * - * The initialisation procedure goes like this: - * - Wait for UniFi to start-up by polling SHARED_MAILBOX1 - * - Find the symbol table and look up SLT_SDIO_SLOT_CONFIG - * - Read the config structure - * - Check the "SDIO initialised" flag, if not zero do a h/w reset and - * start again - * - Decide the number of bulk data slots to allocate, allocate them and - * set "SDIO initialised" flag (and generate an interrupt) to say so. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * CSR_RESULT_SUCEESS on success, - * a CSR error code on failure - * - * Notes: - * All data in the f/w is stored in a little endian format, without any - * padding bytes. Every read from this memory has to be transformed in - * host (cpu specific) format, before it is stored in driver's parameters - * or/and structures. Athough unifi_card_read16() and unifi_read32() do perform - * the conversion internally, unifi_readn() does not. - * --------------------------------------------------------------------------- - */ -static CsrResult card_hw_init(card_t *card) -{ - u32 slut_address; - u16 initialised; - u16 finger_print; - symbol_t slut; - sdio_config_data_t *cfg_data; - u8 cfg_data_buf[SDIO_CONFIG_DATA_SIZE]; - CsrResult r; - void *dlpriv; - s16 major, minor; - s16 search_4slut_again; - CsrResult csrResult; - - /* - * The device revision from the TPLMID_MANF and TPLMID_CARD fields - * of the CIS are available as - * card->sdio_if->pDevice->ManfID - * card->sdio_if->pDevice->AppID - */ - - /* - * Run in a loop so we can patch. - */ - do - { - /* Reset these each time around the loop. */ - search_4slut_again = 0; - cfg_data = NULL; - - r = card_wait_for_firmware_to_start(card, &slut_address); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Firmware hasn't started\n"); - return r; - } - unifi_trace(card->ospriv, UDBG4, "SLUT addr 0x%lX\n", slut_address); - - /* - * Firmware has started, but doesn't know full clock configuration yet - * as some of the information may be in the MIB. Therefore we set an - * initial SDIO clock speed, faster than UNIFI_SDIO_CLOCK_SAFE_HZ, for - * the patch download and subsequent firmware initialisation, and - * full speed UNIFI_SDIO_CLOCK_MAX_HZ will be set once the f/w tells us - * that it is ready. - */ - csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_INIT_HZ); - if (csrResult != CSR_RESULT_SUCCESS) - { - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - return r; - } - card->sdio_clock_speed = UNIFI_SDIO_CLOCK_INIT_HZ; - - /* - * Check the SLUT fingerprint. - * The slut_address is a generic pointer so we must use unifi_card_read16(). - */ - unifi_trace(card->ospriv, UDBG4, "Looking for SLUT finger print\n"); - finger_print = 0; - r = unifi_card_read16(card, slut_address, &finger_print); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read SLUT finger print\n"); - return r; - } - - if (finger_print != SLUT_FINGERPRINT) - { - unifi_error(card->ospriv, "Failed to find Symbol lookup table fingerprint\n"); - return CSR_RESULT_FAILURE; - } - - /* Symbol table starts imedately after the fingerprint */ - slut_address += 2; - - /* Search the table until either the end marker is found, or the - * loading of patch firmware invalidates the current table. - */ - while (!search_4slut_again) - { - u16 s; - u32 l; - - r = unifi_card_read16(card, slut_address, &s); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - slut_address += 2; - - if (s == CSR_SLT_END) - { - unifi_trace(card->ospriv, UDBG3, " found CSR_SLT_END\n"); - break; - } - - r = unifi_read32(card, slut_address, &l); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - slut_address += 4; - - slut.id = s; - slut.obj = l; - - unifi_trace(card->ospriv, UDBG3, " found SLUT id %02d.%08lx\n", slut.id, slut.obj); - switch (slut.id) - { - case CSR_SLT_SDIO_SLOT_CONFIG: - cfg_data = &card->config_data; - /* - * unifi_card_readn reads n bytes from the card, where data is stored - * in a little endian format, without any padding bytes. So, we - * can not just pass the cfg_data pointer or use the - * sizeof(sdio_config_data_t) since the structure in the host can - * be big endian formatted or have padding bytes for alignment. - * We use a char buffer to read the data from the card. - */ - r = unifi_card_readn(card, slut.obj, cfg_data_buf, SDIO_CONFIG_DATA_SIZE); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read config data\n"); - return r; - } - /* .. and then we copy the data to the host structure */ - _build_sdio_config_data(cfg_data, cfg_data_buf); - - /* Make sure the from host data slots are what we expect - we reserve 2 for commands and there should be at least - 1 left for each access category */ - if ((cfg_data->num_fromhost_data_slots < UNIFI_RESERVED_COMMAND_SLOTS) - || (cfg_data->num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS) / UNIFI_NO_OF_TX_QS == 0) - { - unifi_error(card->ospriv, "From host data slots %d\n", cfg_data->num_fromhost_data_slots); - unifi_error(card->ospriv, "need to be (queues * x + 2) (UNIFI_RESERVED_COMMAND_SLOTS for commands)\n"); - return CSR_RESULT_FAILURE; - } - - /* Configure SDIO to-block-size padding */ - if (card->sdio_io_block_pad) - { - /* - * Firmware limits the maximum padding size via data_slot_round. - * Therefore when padding to whole block sizes, the block size - * must be configured correctly by adjusting CSR_WIFI_HIP_SDIO_BLOCK_SIZE. - */ - if (cfg_data->data_slot_round < card->sdio_io_block_size) - { - unifi_error(card->ospriv, - "Configuration error: Block size of %d exceeds f/w data_slot_round of %d\n", - card->sdio_io_block_size, cfg_data->data_slot_round); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - /* - * To force the To-Host signals to be rounded up to the SDIO block - * size, we need to write the To-Host Signal Padding Fragments - * field of the SDIO configuration in UniFi. - */ - if ((card->sdio_io_block_size % cfg_data->sig_frag_size) != 0) - { - unifi_error(card->ospriv, "Configuration error: Can not pad to-host signals.\n"); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - cfg_data->tohost_signal_padding = (u16) (card->sdio_io_block_size / cfg_data->sig_frag_size); - unifi_info(card->ospriv, "SDIO block size %d requires %d padding chunks\n", - card->sdio_io_block_size, cfg_data->tohost_signal_padding); - r = unifi_card_write16(card, slut.obj + SDIO_TO_HOST_SIG_PADDING_OFFSET, cfg_data->tohost_signal_padding); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write To-Host Signal Padding Fragments\n"); - return r; - } - } - - /* Reconstruct the Generic Pointer address of the - * SDIO Control Data Struct. - */ - card->sdio_ctrl_addr = cfg_data->sdio_ctrl_offset | (UNIFI_SH_DMEM << 24); - card->init_flag_addr = slut.obj + SDIO_INIT_FLAG_OFFSET; - break; - - case CSR_SLT_BUILD_ID_NUMBER: - { - u32 n; - r = unifi_read32(card, slut.obj, &n); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read build id\n"); - return r; - } - card->build_id = n; - } - break; - - case CSR_SLT_BUILD_ID_STRING: - r = unifi_readnz(card, slut.obj, card->build_id_string, - sizeof(card->build_id_string)); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read build string\n"); - return r; - } - break; - - case CSR_SLT_PERSISTENT_STORE_DB: - break; - - case CSR_SLT_BOOT_LOADER_CONTROL: - - /* This command copies most of the station firmware - * image from ROM into program RAM. It also clears - * out the zerod data and sets up the initialised - * data. */ - r = unifi_do_loader_op(card, slut.obj + 6, UNIFI_BOOT_LOADER_LOAD_STA); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write loader load image command\n"); - return r; - } - - dlpriv = unifi_dl_fw_read_start(card, UNIFI_FW_STA); - - /* dlpriv might be NULL, we still need to do the do_loader_op step. */ - if (dlpriv != NULL) - { - /* Download the firmware. */ - r = unifi_dl_patch(card, dlpriv, slut.obj); - - /* Free the firmware file information. */ - unifi_fw_read_stop(card->ospriv, dlpriv); - - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to patch firmware\n"); - return r; - } - } - - /* This command starts the firmware image that we want (the - * station by default) with any patches required applied. */ - r = unifi_do_loader_op(card, slut.obj + 6, UNIFI_BOOT_LOADER_RESTART); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write loader restart command\n"); - return r; - } - - /* The now running patch f/w defines a new SLUT data structure - - * the current one is no longer valid. We must drop out of the - * processing loop and enumerate the new SLUT (which may appear - * at a different offset). - */ - search_4slut_again = 1; - break; - - case CSR_SLT_PANIC_DATA_PHY: - card->panic_data_phy_addr = slut.obj; - break; - - case CSR_SLT_PANIC_DATA_MAC: - card->panic_data_mac_addr = slut.obj; - break; - - default: - /* do nothing */ - break; - } - } /* while */ - } while (search_4slut_again); - - /* Did we find the Config Data ? */ - if (cfg_data == NULL) - { - unifi_error(card->ospriv, "Failed to find SDIO_SLOT_CONFIG Symbol\n"); - return CSR_RESULT_FAILURE; - } - - /* - * Has ths card already been initialised? - * If so, return an error so we do a h/w reset and start again. - */ - r = unifi_card_read16(card, card->init_flag_addr, &initialised); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read init flag at %08lx\n", - card->init_flag_addr); - return r; - } - if (initialised != 0) - { - return CSR_RESULT_FAILURE; - } - - - /* - * Now check the UniFi firmware version - */ - major = (cfg_data->version >> 8) & 0xFF; - minor = cfg_data->version & 0xFF; - unifi_info(card->ospriv, "UniFi f/w protocol version %d.%d (driver %d.%d)\n", - major, minor, - UNIFI_HIP_MAJOR_VERSION, UNIFI_HIP_MINOR_VERSION); - - unifi_info(card->ospriv, "Firmware build %u: %s\n", - card->build_id, card->build_id_string); - - if (major != UNIFI_HIP_MAJOR_VERSION) - { - unifi_error(card->ospriv, "UniFi f/w protocol major version (%d) is different from driver (v%d.%d)\n", - major, UNIFI_HIP_MAJOR_VERSION, UNIFI_HIP_MINOR_VERSION); -#ifndef CSR_WIFI_DISABLE_HIP_VERSION_CHECK - return CSR_RESULT_FAILURE; -#endif - } - if (minor < UNIFI_HIP_MINOR_VERSION) - { - unifi_error(card->ospriv, "UniFi f/w protocol version (v%d.%d) is older than minimum required by driver (v%d.%d).\n", - major, minor, - UNIFI_HIP_MAJOR_VERSION, UNIFI_HIP_MINOR_VERSION); -#ifndef CSR_WIFI_DISABLE_HIP_VERSION_CHECK - return CSR_RESULT_FAILURE; -#endif - } - - /* Read panic codes from a previous firmware panic. If the firmware has - * not panicked since power was applied (e.g. power-off hard reset) - * the stored panic codes will not be updated. - */ - unifi_read_panic(card); - - return CSR_RESULT_SUCCESS; -} /* card_hw_init() */ - - -/* - * --------------------------------------------------------------------------- - * card_wait_for_unifi_to_reset - * - * Waits for a reset to complete by polling the WLAN function enable - * bit (which is cleared on reset). - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * CSR_RESULT_SUCCESS on success, CSR error code on failure. - * --------------------------------------------------------------------------- - */ -static CsrResult card_wait_for_unifi_to_reset(card_t *card) -{ - s16 i; - CsrResult r; - u8 io_enable; - CsrResult csrResult; - - r = CSR_RESULT_SUCCESS; - for (i = 0; i < MAILBOX2_ATTEMPTS; i++) - { - unifi_trace(card->ospriv, UDBG1, "waiting for reset to complete, attempt %d\n", i); - if (card->chip_id > SDIO_CARD_ID_UNIFI_2) - { - /* It's quite likely that this read will timeout for the - * first few tries - especially if we have reset via - * DBG_RESET. - */ -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - unifi_debug_log_to_buf("m0@%02X=", SDIO_IO_READY); -#endif - csrResult = CsrSdioF0Read8(card->sdio_if, SDIO_IO_READY, &io_enable); -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_debug_log_to_buf("error=%X\n", csrResult); - } - else - { - unifi_debug_log_to_buf("%X\n", io_enable); - } -#endif - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - return CSR_WIFI_HIP_RESULT_NO_DEVICE; - } - r = CSR_RESULT_SUCCESS; - if (csrResult != CSR_RESULT_SUCCESS) - { - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - } - } - else - { - r = sdio_read_f0(card, SDIO_IO_ENABLE, &io_enable); - } - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r == CSR_RESULT_SUCCESS) - { - u16 mbox2; - s16 enabled = io_enable & (1 << card->function); - - if (!enabled) - { - unifi_trace(card->ospriv, UDBG1, - "Reset complete (function %d is disabled) in ~ %u msecs\n", - card->function, i * MAILBOX2_TIMEOUT); - - /* Enable WLAN function and verify MAILBOX2 is zero'd */ - csrResult = CsrSdioFunctionEnable(card->sdio_if); - if (csrResult != CSR_RESULT_SUCCESS) - { - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - unifi_error(card->ospriv, "CsrSdioFunctionEnable failed %d\n", r); - break; - } - } - - r = unifi_read_direct16(card, ChipHelper_SDIO_HIP_HANDSHAKE(card->helper) * 2, &mbox2); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "read HIP_HANDSHAKE failed %d\n", r); - break; - } - if (mbox2 != 0) - { - unifi_error(card->ospriv, "MAILBOX2 non-zero after reset (mbox2 = %04x)\n", mbox2); - r = CSR_RESULT_FAILURE; - } - break; - } - else - { - if (card->chip_id > SDIO_CARD_ID_UNIFI_2) - { - /* We ignore read failures for the first few reads, - * they are probably benign. */ - if (i > MAILBOX2_ATTEMPTS / 4) - { - unifi_trace(card->ospriv, UDBG1, "Failed to read CCCR IO Ready register while polling for reset\n"); - } - } - else - { - unifi_trace(card->ospriv, UDBG1, "Failed to read CCCR IO Enable register while polling for reset\n"); - } - } - CsrThreadSleep(MAILBOX2_TIMEOUT); - } - - if (r == CSR_RESULT_SUCCESS && i == MAILBOX2_ATTEMPTS) - { - unifi_trace(card->ospriv, UDBG1, "Timeout waiting for UniFi to complete reset\n"); - r = CSR_RESULT_FAILURE; - } - - return r; -} /* card_wait_for_unifi_to_reset() */ - - -/* - * --------------------------------------------------------------------------- - * card_wait_for_unifi_to_disable - * - * Waits for the function to become disabled by polling the - * IO_READY bit. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * CSR_RESULT_SUCCESS on success, CSR error code on failure. - * - * Notes: This function can only be used with - * card->chip_id > SDIO_CARD_ID_UNIFI_2 - * --------------------------------------------------------------------------- - */ -static CsrResult card_wait_for_unifi_to_disable(card_t *card) -{ - s16 i; - CsrResult r; - u8 io_enable; - CsrResult csrResult; - - if (card->chip_id <= SDIO_CARD_ID_UNIFI_2) - { - unifi_error(card->ospriv, - "Function reset method not supported for chip_id=%d\n", - card->chip_id); - return CSR_RESULT_FAILURE; - } - - r = CSR_RESULT_SUCCESS; - for (i = 0; i < MAILBOX2_ATTEMPTS; i++) - { - unifi_trace(card->ospriv, UDBG1, "waiting for disable to complete, attempt %d\n", i); - - /* - * It's quite likely that this read will timeout for the - * first few tries - especially if we have reset via - * DBG_RESET. - */ -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - unifi_debug_log_to_buf("r0@%02X=", SDIO_IO_READY); -#endif - csrResult = CsrSdioF0Read8(card->sdio_if, SDIO_IO_READY, &io_enable); -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_debug_log_to_buf("error=%X\n", csrResult); - } - else - { - unifi_debug_log_to_buf("%X\n", io_enable); - } -#endif - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - return CSR_WIFI_HIP_RESULT_NO_DEVICE; - } - if (csrResult == CSR_RESULT_SUCCESS) - { - s16 enabled = io_enable & (1 << card->function); - r = CSR_RESULT_SUCCESS; - if (!enabled) - { - unifi_trace(card->ospriv, UDBG1, - "Disable complete (function %d is disabled) in ~ %u msecs\n", - card->function, i * MAILBOX2_TIMEOUT); - - break; - } - } - else - { - /* - * We ignore read failures for the first few reads, - * they are probably benign. - */ - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - if (i > (MAILBOX2_ATTEMPTS / 4)) - { - unifi_trace(card->ospriv, UDBG1, - "Failed to read CCCR IO Ready register while polling for disable\n"); - } - } - CsrThreadSleep(MAILBOX2_TIMEOUT); - } - - if ((r == CSR_RESULT_SUCCESS) && (i == MAILBOX2_ATTEMPTS)) - { - unifi_trace(card->ospriv, UDBG1, "Timeout waiting for UniFi to complete disable\n"); - r = CSR_RESULT_FAILURE; - } - - return r; -} /* card_wait_for_unifi_to_reset() */ - - -/* - * --------------------------------------------------------------------------- - * card_wait_for_firmware_to_start - * - * Polls the MAILBOX1 register for a non-zero value. - * Then reads MAILBOX0 and forms the two values into a 32-bit address - * which is returned to the caller. - * - * Arguments: - * card Pointer to card struct - * paddr Pointer to receive the UniFi address formed - * by concatenating MAILBOX1 and MAILBOX0. - * - * Returns: - * CSR_RESULT_SUCCESS on success, CSR error code on failure. - * --------------------------------------------------------------------------- - */ -CsrResult card_wait_for_firmware_to_start(card_t *card, u32 *paddr) -{ - s32 i; - u16 mbox0, mbox1; - CsrResult r; - - /* - * Wait for UniFi to initialise its data structures by polling - * the SHARED_MAILBOX1 register. - * Experience shows this is typically 120ms. - */ - CsrThreadSleep(MAILBOX1_TIMEOUT); - - mbox1 = 0; - unifi_trace(card->ospriv, UDBG1, "waiting for MAILBOX1 to be non-zero...\n"); - for (i = 0; i < MAILBOX1_ATTEMPTS; i++) - { - r = unifi_read_direct16(card, ChipHelper_MAILBOX1(card->helper) * 2, &mbox1); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - /* These reads can fail if UniFi isn't up yet, so try again */ - unifi_warning(card->ospriv, "Failed to read UniFi Mailbox1 register\n"); - } - - if ((r == CSR_RESULT_SUCCESS) && (mbox1 != 0)) - { - unifi_trace(card->ospriv, UDBG1, "MAILBOX1 ready (0x%04X) in %u millisecs\n", - mbox1, i * MAILBOX1_TIMEOUT); - - /* Read the MAILBOX1 again in case we caught the value as it - * changed. */ - r = unifi_read_direct16(card, ChipHelper_MAILBOX1(card->helper) * 2, &mbox1); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read UniFi Mailbox1 register for second time\n"); - return r; - } - unifi_trace(card->ospriv, UDBG1, "MAILBOX1 value=0x%04X\n", mbox1); - - break; - } - - CsrThreadSleep(MAILBOX1_TIMEOUT); - if ((i % 100) == 99) - { - unifi_trace(card->ospriv, UDBG2, "MAILBOX1 not ready (0x%X), still trying...\n", mbox1); - } - } - - if ((r == CSR_RESULT_SUCCESS) && (mbox1 == 0)) - { - unifi_trace(card->ospriv, UDBG1, "Timeout waiting for firmware to start, Mailbox1 still 0 after %d ms\n", - MAILBOX1_ATTEMPTS * MAILBOX1_TIMEOUT); - return CSR_RESULT_FAILURE; - } - - - /* - * Complete the reset handshake by setting MAILBOX2 to 0xFFFF - */ - r = unifi_write_direct16(card, ChipHelper_SDIO_HIP_HANDSHAKE(card->helper) * 2, 0xFFFF); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write f/w startup handshake to MAILBOX2\n"); - return r; - } - - - /* - * Read the Symbol Look Up Table (SLUT) offset. - * Top 16 bits are in mbox1, read the lower 16 bits from mbox0. - */ - mbox0 = 0; - r = unifi_read_direct16(card, ChipHelper_MAILBOX0(card->helper) * 2, &mbox0); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read UniFi Mailbox0 register\n"); - return r; - } - - *paddr = (((u32)mbox1 << 16) | mbox0); - - return CSR_RESULT_SUCCESS; -} /* card_wait_for_firmware_to_start() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_capture_panic - * - * Attempt to capture panic codes from the firmware. This may involve - * warm reset of the chip to regain access following a watchdog reset. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * CSR_RESULT_SUCCESS if panic codes were captured, or none available - * CSR_RESULT_FAILURE if the driver could not access function 1 - * --------------------------------------------------------------------------- - */ -CsrResult unifi_capture_panic(card_t *card) -{ - - /* The firmware must have previously initialised to read the panic addresses - * from the SLUT - */ - if (!card->panic_data_phy_addr || !card->panic_data_mac_addr) - { - return CSR_RESULT_SUCCESS; - } - - /* Ensure we can access function 1 following a panic/watchdog reset */ - if (card_access_panic(card) == CSR_RESULT_SUCCESS) - { - /* Read the panic codes */ - unifi_read_panic(card); - } - else - { - unifi_info(card->ospriv, "Unable to read panic codes"); - } - - return CSR_RESULT_SUCCESS; -} - - -/* - * --------------------------------------------------------------------------- - * card_access_panic - * Attempt to read the WLAN SDIO function in order to read panic codes - * and perform various reset steps to regain access if the read fails. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * CSR_RESULT_SUCCESS if panic codes can be read - * CSR error code if panic codes can not be read - * --------------------------------------------------------------------------- - */ -static CsrResult card_access_panic(card_t *card) -{ - u16 data_u16 = 0; - s32 i; - CsrResult r, sr; - - /* A chip version of zero means that the version never got successfully read - * during reset. In this case give up because it will not be possible to - * verify the chip version. - */ - if (!card->chip_version) - { - unifi_info(card->ospriv, "Unknown chip version\n"); - return CSR_RESULT_FAILURE; - } - - /* Ensure chip is awake or access to function 1 will fail */ - r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "unifi_set_host_state() failed %d\n", r); - return CSR_RESULT_FAILURE; /* Card is probably unpowered */ - } - CsrThreadSleep(20); - - for (i = 0; i < 3; i++) - { - sr = CsrSdioRead16(card->sdio_if, CHIP_HELPER_UNIFI_GBL_CHIP_VERSION * 2, &data_u16); - if (sr != CSR_RESULT_SUCCESS || data_u16 != card->chip_version) - { - unifi_info(card->ospriv, "Failed to read valid chip version sr=%d (0x%04x want 0x%04x) try %d\n", - sr, data_u16, card->chip_version, i); - - /* Set clock speed low */ - sr = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_SAFE_HZ); - if (sr != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "CsrSdioMaxBusClockFrequencySet() failed1 %d\n", sr); - r = ConvertCsrSdioToCsrHipResult(card, sr); - } - card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ; - - /* First try re-enabling function in case a f/w watchdog reset disabled it */ - if (i == 0) - { - unifi_info(card->ospriv, "Try function enable\n"); - sr = CsrSdioFunctionEnable(card->sdio_if); - if (sr != CSR_RESULT_SUCCESS) - { - r = ConvertCsrSdioToCsrHipResult(card, sr); - unifi_error(card->ospriv, "CsrSdioFunctionEnable failed %d (HIP %d)\n", sr, r); - } - continue; - } - - /* Second try, set awake */ - unifi_info(card->ospriv, "Try set awake\n"); - - /* Ensure chip is awake */ - r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "unifi_set_host_state() failed2 %d\n", r); - } - - /* Set clock speed low in case setting the host state raised it, which - * would only happen if host state was previously TORPID - */ - sr = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_SAFE_HZ); - if (sr != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "CsrSdioMaxBusClockFrequencySet() failed2 %d\n", sr); - } - card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ; - - if (i == 1) - { - continue; - } - - /* Perform a s/w reset to preserve as much as the card state as possible, - * (mainly the preserve RAM). The context will be lost for coredump - but as we - * were unable to access the WLAN function for panic, the coredump would have - * also failed without a reset. - */ - unifi_info(card->ospriv, "Try s/w reset\n"); - - r = unifi_card_hard_reset(card); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "unifi_card_hard_reset() failed %d\n", r); - } - } - else - { - if (i > 0) - { - unifi_info(card->ospriv, "Read chip version 0x%x after %d retries\n", data_u16, i); - } - break; - } - } - - r = ConvertCsrSdioToCsrHipResult(card, sr); - return r; -} - - -/* - * --------------------------------------------------------------------------- - * unifi_read_panic - * Reads, saves and prints panic codes stored by the firmware in UniFi's - * preserve RAM by the last panic that occurred since chip was powered. - * Nothing is saved if the panic codes are read as zero. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * --------------------------------------------------------------------------- - */ -void unifi_read_panic(card_t *card) -{ - CsrResult r; - u16 p_code, p_arg; - - /* The firmware must have previously initialised to read the panic addresses - * from the SLUT - */ - if (!card->panic_data_phy_addr || !card->panic_data_mac_addr) - { - return; - } - - /* Get the panic data from PHY */ - r = unifi_card_read16(card, card->panic_data_phy_addr, &p_code); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "capture_panic: unifi_read16 %08x failed %d\n", card->panic_data_phy_addr, r); - p_code = 0; - } - if (p_code) - { - r = unifi_card_read16(card, card->panic_data_phy_addr + 2, &p_arg); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "capture_panic: unifi_read16 %08x failed %d\n", card->panic_data_phy_addr + 2, r); - } - unifi_error(card->ospriv, "Last UniFi PHY PANIC %04x arg %04x\n", p_code, p_arg); - card->last_phy_panic_code = p_code; - card->last_phy_panic_arg = p_arg; - } - - /* Get the panic data from MAC */ - r = unifi_card_read16(card, card->panic_data_mac_addr, &p_code); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "capture_panic: unifi_read16 %08x failed %d\n", card->panic_data_mac_addr, r); - p_code = 0; - } - if (p_code) - { - r = unifi_card_read16(card, card->panic_data_mac_addr + 2, &p_arg); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "capture_panic: unifi_read16 %08x failed %d\n", card->panic_data_mac_addr + 2, r); - } - unifi_error(card->ospriv, "Last UniFi MAC PANIC %04x arg %04x\n", p_code, p_arg); - card->last_mac_panic_code = p_code; - card->last_mac_panic_arg = p_arg; - } - -} - - -/* - * --------------------------------------------------------------------------- - * card_allocate_memory_resources - * - * Allocates memory for the from-host, to-host bulk data slots, - * soft queue buffers and bulk data buffers. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * CSR_RESULT_SUCCESS on success, CSR error code on failure. - * --------------------------------------------------------------------------- - */ -static CsrResult card_allocate_memory_resources(card_t *card) -{ - s16 n, i, k, r; - sdio_config_data_t *cfg_data; - - /* Reset any state carried forward from a previous life */ - card->fh_command_queue.q_rd_ptr = 0; - card->fh_command_queue.q_wr_ptr = 0; - (void)scnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH, - "fh_cmd_q"); - for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) - { - card->fh_traffic_queue[i].q_rd_ptr = 0; - card->fh_traffic_queue[i].q_wr_ptr = 0; - (void)scnprintf(card->fh_traffic_queue[i].name, - UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_data_q%d", i); - } -#ifndef CSR_WIFI_HIP_TA_DISABLE - unifi_ta_sampling_init(card); -#endif - /* Convenience short-cut */ - cfg_data = &card->config_data; - - /* - * Allocate memory for the from-host and to-host signal buffers. - */ - card->fh_buffer.buf = kmalloc(UNIFI_FH_BUF_SIZE, GFP_KERNEL); - if (card->fh_buffer.buf == NULL) - { - unifi_error(card->ospriv, "Failed to allocate memory for F-H signals\n"); - return CSR_WIFI_HIP_RESULT_NO_MEMORY; - } - card->fh_buffer.bufsize = UNIFI_FH_BUF_SIZE; - card->fh_buffer.ptr = card->fh_buffer.buf; - card->fh_buffer.count = 0; - - card->th_buffer.buf = kmalloc(UNIFI_FH_BUF_SIZE, GFP_KERNEL); - if (card->th_buffer.buf == NULL) - { - unifi_error(card->ospriv, "Failed to allocate memory for T-H signals\n"); - return CSR_WIFI_HIP_RESULT_NO_MEMORY; - } - card->th_buffer.bufsize = UNIFI_FH_BUF_SIZE; - card->th_buffer.ptr = card->th_buffer.buf; - card->th_buffer.count = 0; - - - /* - * Allocate memory for the from-host and to-host bulk data slots. - * This is done as separate kmallocs because lots of smaller - * allocations are more likely to succeed than one huge one. - */ - - /* Allocate memory for the array of pointers */ - n = cfg_data->num_fromhost_data_slots; - - unifi_trace(card->ospriv, UDBG3, "Alloc from-host resources, %d slots.\n", n); - card->from_host_data = kmalloc(n * sizeof(slot_desc_t), GFP_KERNEL); - if (card->from_host_data == NULL) - { - unifi_error(card->ospriv, "Failed to allocate memory for F-H bulk data array\n"); - return CSR_WIFI_HIP_RESULT_NO_MEMORY; - } - - /* Initialise from-host bulk data slots */ - for (i = 0; i < n; i++) - { - UNIFI_INIT_BULK_DATA(&card->from_host_data[i].bd); - } - - /* Allocate memory for the array used for slot host tag mapping */ - card->fh_slot_host_tag_record = kmalloc(n * sizeof(u32), GFP_KERNEL); - - if (card->fh_slot_host_tag_record == NULL) - { - unifi_error(card->ospriv, "Failed to allocate memory for F-H slot host tag mapping array\n"); - return CSR_WIFI_HIP_RESULT_NO_MEMORY; - } - - /* Initialise host tag entries for from-host bulk data slots */ - for (i = 0; i < n; i++) - { - card->fh_slot_host_tag_record[i] = CSR_WIFI_HIP_RESERVED_HOST_TAG; - } - - - /* Allocate memory for the array of pointers */ - n = cfg_data->num_tohost_data_slots; - - unifi_trace(card->ospriv, UDBG3, "Alloc to-host resources, %d slots.\n", n); - card->to_host_data = kmalloc(n * sizeof(bulk_data_desc_t), GFP_KERNEL); - if (card->to_host_data == NULL) - { - unifi_error(card->ospriv, "Failed to allocate memory for T-H bulk data array\n"); - return CSR_WIFI_HIP_RESULT_NO_MEMORY; - } - - /* Initialise to-host bulk data slots */ - for (i = 0; i < n; i++) - { - UNIFI_INIT_BULK_DATA(&card->to_host_data[i]); - } - - /* - * Initialise buffers for soft Q - */ - for (i = 0; i < UNIFI_SOFT_COMMAND_Q_LENGTH; i++) - { - for (r = 0; r < UNIFI_MAX_DATA_REFERENCES; r++) - { - UNIFI_INIT_BULK_DATA(&card->fh_command_q_body[i].bulkdata[r]); - } - } - - for (k = 0; k < UNIFI_NO_OF_TX_QS; k++) - { - for (i = 0; i < UNIFI_SOFT_TRAFFIC_Q_LENGTH; i++) - { - for (r = 0; r < UNIFI_MAX_DATA_REFERENCES; r++) - { - UNIFI_INIT_BULK_DATA(&card->fh_traffic_q_body[k][i].bulkdata[r]); - } - } - } - - card->memory_resources_allocated = 1; - - return CSR_RESULT_SUCCESS; -} /* card_allocate_memory_resources() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_free_bulk_data - * - * Free the data associated to a bulk data structure. - * - * Arguments: - * card Pointer to card struct - * bulk_data_slot Pointer to bulk data structure - * - * Returns: - * None. - * - * --------------------------------------------------------------------------- - */ -static void unifi_free_bulk_data(card_t *card, bulk_data_desc_t *bulk_data_slot) -{ - if (bulk_data_slot->data_length != 0) - { - unifi_net_data_free(card->ospriv, bulk_data_slot); - } -} /* unifi_free_bulk_data() */ - - -/* - * --------------------------------------------------------------------------- - * card_free_memory_resources - * - * Frees memory allocated for the from-host, to-host bulk data slots, - * soft queue buffers and bulk data buffers. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void card_free_memory_resources(card_t *card) -{ - - unifi_trace(card->ospriv, UDBG1, "Freeing card memory resources.\n"); - - /* Clear our internal queues */ - unifi_cancel_pending_signals(card); - - - kfree(card->to_host_data); - card->to_host_data = NULL; - - kfree(card->from_host_data); - card->from_host_data = NULL; - - /* free the memory for slot host tag mapping array */ - kfree(card->fh_slot_host_tag_record); - card->fh_slot_host_tag_record = NULL; - - kfree(card->fh_buffer.buf); - card->fh_buffer.ptr = card->fh_buffer.buf = NULL; - card->fh_buffer.bufsize = 0; - card->fh_buffer.count = 0; - - kfree(card->th_buffer.buf); - card->th_buffer.ptr = card->th_buffer.buf = NULL; - card->th_buffer.bufsize = 0; - card->th_buffer.count = 0; - - - card->memory_resources_allocated = 0; - -} /* card_free_memory_resources() */ - - -static void card_init_soft_queues(card_t *card) -{ - s16 i; - - unifi_trace(card->ospriv, UDBG1, "Initialising internal signal queues.\n"); - /* Reset any state carried forward from a previous life */ - card->fh_command_queue.q_rd_ptr = 0; - card->fh_command_queue.q_wr_ptr = 0; - (void)scnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH, - "fh_cmd_q"); - for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) - { - card->fh_traffic_queue[i].q_rd_ptr = 0; - card->fh_traffic_queue[i].q_wr_ptr = 0; - (void)scnprintf(card->fh_traffic_queue[i].name, - UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_data_q%d", i); - } -#ifndef CSR_WIFI_HIP_TA_DISABLE - unifi_ta_sampling_init(card); -#endif -} - - -/* - * --------------------------------------------------------------------------- - * unifi_cancel_pending_signals - * - * Free the signals and associated bulk data, pending in the core. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void unifi_cancel_pending_signals(card_t *card) -{ - s16 i, n, r; - - unifi_trace(card->ospriv, UDBG1, "Canceling pending signals.\n"); - - if (card->to_host_data) - { - /* - * Free any bulk data buffers allocated for the t-h slots - * This will clear all buffers that did not make it to - * unifi_receive_event() before cancel was request. - */ - n = card->config_data.num_tohost_data_slots; - unifi_trace(card->ospriv, UDBG3, "Freeing to-host resources, %d slots.\n", n); - for (i = 0; i < n; i++) - { - unifi_free_bulk_data(card, &card->to_host_data[i]); - } - } - - /* - * If any of the from-host bulk data has reached the card->from_host_data - * but not UniFi, we need to free the buffers here. - */ - if (card->from_host_data) - { - /* Free any bulk data buffers allocated for the f-h slots */ - n = card->config_data.num_fromhost_data_slots; - unifi_trace(card->ospriv, UDBG3, "Freeing from-host resources, %d slots.\n", n); - for (i = 0; i < n; i++) - { - unifi_free_bulk_data(card, &card->from_host_data[i].bd); - } - - for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) - { - card->dynamic_slot_data.from_host_used_slots[i] = 0; - card->dynamic_slot_data.from_host_max_slots[i] = 0; - card->dynamic_slot_data.from_host_reserved_slots[i] = 0; - } - } - - /* - * Free any bulk data buffers allocated in the soft queues. - * This covers the case where a bulk data pointer has reached the soft queue - * but not the card->from_host_data. - */ - unifi_trace(card->ospriv, UDBG3, "Freeing cmd q resources.\n"); - for (i = 0; i < UNIFI_SOFT_COMMAND_Q_LENGTH; i++) - { - for (r = 0; r < UNIFI_MAX_DATA_REFERENCES; r++) - { - unifi_free_bulk_data(card, &card->fh_command_q_body[i].bulkdata[r]); - } - } - - unifi_trace(card->ospriv, UDBG3, "Freeing traffic q resources.\n"); - for (n = 0; n < UNIFI_NO_OF_TX_QS; n++) - { - for (i = 0; i < UNIFI_SOFT_TRAFFIC_Q_LENGTH; i++) - { - for (r = 0; r < UNIFI_MAX_DATA_REFERENCES; r++) - { - unifi_free_bulk_data(card, &card->fh_traffic_q_body[n][i].bulkdata[r]); - } - } - } - - card_init_soft_queues(card); - -} /* unifi_cancel_pending_signals() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_free_card - * - * Free the memory allocated for the card structure and buffers. - * - * Notes: - * The porting layer is responsible for freeing any mini-coredump buffers - * allocated when it called unifi_coredump_init(), by calling - * unifi_coredump_free() before calling this function. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void unifi_free_card(card_t *card) -{ -#ifdef CSR_PRE_ALLOC_NET_DATA - prealloc_netdata_free(card); -#endif - /* Free any memory allocated. */ - card_free_memory_resources(card); - - /* Warn if caller didn't free coredump buffers */ - if (card->dump_buf) - { - unifi_error(card->ospriv, "Caller should call unifi_coredump_free()\n"); - unifi_coredump_free(card); /* free anyway to prevent memory leak */ - } - - kfree(card); - -} /* unifi_free_card() */ - - -/* - * --------------------------------------------------------------------------- - * card_init_slots - * - * Allocate memory for host-side slot data and signal queues. - * - * Arguments: - * card Pointer to card object - * - * Returns: - * CSR error code. - * --------------------------------------------------------------------------- - */ -static CsrResult card_init_slots(card_t *card) -{ - CsrResult r; - u8 i; - - /* Allocate the buffers we need, only once. */ - if (card->memory_resources_allocated == 1) - { - card_free_memory_resources(card); - } - else - { - /* Initialise our internal command and traffic queues */ - card_init_soft_queues(card); - } - - r = card_allocate_memory_resources(card); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to allocate card memory resources.\n"); - card_free_memory_resources(card); - return r; - } - - if (card->sdio_ctrl_addr == 0) - { - unifi_error(card->ospriv, "Failed to find config struct!\n"); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - /* - * Set initial counts. - */ - - card->from_host_data_head = 0; - - /* Get initial signal counts from UniFi, in case it has not been reset. */ - { - u16 s; - - /* Get the from-host-signals-written count */ - r = unifi_card_read16(card, card->sdio_ctrl_addr + 0, &s); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read from-host sig written count\n"); - return r; - } - card->from_host_signals_w = (s16)s; - - /* Get the to-host-signals-written count */ - r = unifi_card_read16(card, card->sdio_ctrl_addr + 6, &s); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read to-host sig read count\n"); - return r; - } - card->to_host_signals_r = (s16)s; - } - - /* Set Initialised flag. */ - r = unifi_card_write16(card, card->init_flag_addr, 0x0001); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write initialised flag\n"); - return r; - } - - /* Dynamic queue reservation */ - memset(&card->dynamic_slot_data, 0, sizeof(card_dynamic_slot_t)); - - for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) - { - card->dynamic_slot_data.from_host_max_slots[i] = card->config_data.num_fromhost_data_slots - - UNIFI_RESERVED_COMMAND_SLOTS; - card->dynamic_slot_data.queue_stable[i] = FALSE; - } - - card->dynamic_slot_data.packets_interval = UNIFI_PACKETS_INTERVAL; - - return CSR_RESULT_SUCCESS; -} /* card_init_slots() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_set_udi_hook - * - * Registers the udi hook that reports the sent signals to the core. - * - * Arguments: - * card Pointer to the card context struct - * udi_fn Pointer to the callback function. - * - * Returns: - * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the card pointer is invalid, - * CSR_RESULT_SUCCESS on success. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_set_udi_hook(card_t *card, udi_func_t udi_fn) -{ - if (card == NULL) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - if (card->udi_hook == NULL) - { - card->udi_hook = udi_fn; - } - - return CSR_RESULT_SUCCESS; -} /* unifi_set_udi_hook() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_remove_udi_hook - * - * Removes the udi hook that reports the sent signals from the core. - * - * Arguments: - * card Pointer to the card context struct - * udi_fn Pointer to the callback function. - * - * Returns: - * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the card pointer is invalid, - * CSR_RESULT_SUCCESS on success. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn) -{ - if (card == NULL) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - if (card->udi_hook == udi_fn) - { - card->udi_hook = NULL; - } - - return CSR_RESULT_SUCCESS; -} /* unifi_remove_udi_hook() */ - - -static void CardReassignDynamicReservation(card_t *card) -{ - u8 i; - - unifi_trace(card->ospriv, UDBG5, "Packets Txed %d %d %d %d\n", - card->dynamic_slot_data.packets_txed[0], - card->dynamic_slot_data.packets_txed[1], - card->dynamic_slot_data.packets_txed[2], - card->dynamic_slot_data.packets_txed[3]); - - /* Clear reservation and recalculate max slots */ - for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) - { - card->dynamic_slot_data.queue_stable[i] = FALSE; - card->dynamic_slot_data.from_host_reserved_slots[i] = 0; - card->dynamic_slot_data.from_host_max_slots[i] = card->config_data.num_fromhost_data_slots - - UNIFI_RESERVED_COMMAND_SLOTS; - card->dynamic_slot_data.packets_txed[i] = 0; - - unifi_trace(card->ospriv, UDBG5, "CardReassignDynamicReservation: queue %d reserved %d Max %d\n", i, - card->dynamic_slot_data.from_host_reserved_slots[i], - card->dynamic_slot_data.from_host_max_slots[i]); - } - - card->dynamic_slot_data.total_packets_txed = 0; -} - - -/* Algorithm to dynamically reserve slots. The logic is based mainly on the outstanding queue - * length. Slots are reserved for particular queues during an interval and cleared after the interval. - * Each queue has three associated variables.. a) used slots - the number of slots currently occupied - * by the queue b) reserved slots - number of slots reserved specifically for the queue c) max slots - total - * slots that this queue can actually use (may be higher than reserved slots and is dependent on reserved slots - * for other queues). - * This function is called when there are no slots available for a queue. It checks to see if there are enough - * unreserved slots sufficient for this request. If available these slots are reserved for the queue. - * If there are not enough unreserved slots, a fair share for each queue is calculated based on the total slots - * and the number of active queues (any queue with existing reservation is considered active). Queues needing - * less than their fair share are allowed to have the previously reserved slots. The remaining slots are - * distributed evenly among queues that need more than the fair share - * - * A better scheme would take current bandwidth per AC into consideration when reserving slots. An - * implementation scheme could consider the relative time/service period for slots in an AC. If the firmware - * services other ACs faster than a particular AC (packets wait in the slots longer) then it is fair to reserve - * less slots for the AC - */ -static void CardCheckDynamicReservation(card_t *card, unifi_TrafficQueue queue) -{ - u16 q_len, active_queues = 0, excess_queue_slots, div_extra_slots, - queue_fair_share, reserved_slots = 0, q, excess_need_queues = 0, unmovable_slots = 0; - s32 i; - q_t *sigq; - u16 num_data_slots = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS; - - /* Calculate the pending queue length */ - sigq = &card->fh_traffic_queue[queue]; - q_len = CSR_WIFI_HIP_Q_SLOTS_USED(sigq); - - if (q_len <= card->dynamic_slot_data.from_host_reserved_slots[queue]) - { - unifi_trace(card->ospriv, UDBG5, "queue %d q_len %d already has that many reserved slots, exiting\n", queue, q_len); - return; - } - - /* Upper limit */ - if (q_len > num_data_slots) - { - q_len = num_data_slots; - } - - for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) - { - if (i != (s32)queue) - { - reserved_slots += card->dynamic_slot_data.from_host_reserved_slots[i]; - } - if ((i == (s32)queue) || (card->dynamic_slot_data.from_host_reserved_slots[i] > 0)) - { - active_queues++; - } - } - - unifi_trace(card->ospriv, UDBG5, "CardCheckDynamicReservation: queue %d q_len %d\n", queue, q_len); - unifi_trace(card->ospriv, UDBG5, "Active queues %d reserved slots on other queues %d\n", - active_queues, reserved_slots); - - if (reserved_slots + q_len <= num_data_slots) - { - card->dynamic_slot_data.from_host_reserved_slots[queue] = q_len; - if (q_len == num_data_slots) - { - /* This is the common case when just 1 stream is going */ - card->dynamic_slot_data.queue_stable[queue] = TRUE; - } - } - else - { - queue_fair_share = num_data_slots / active_queues; - unifi_trace(card->ospriv, UDBG5, "queue fair share %d\n", queue_fair_share); - - /* Evenly distribute slots among active queues */ - /* Find out the queues that need excess of fair share. Also find slots allocated - * to queues less than their fair share, these slots cannot be reallocated (unmovable slots) */ - - card->dynamic_slot_data.from_host_reserved_slots[queue] = q_len; - - for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) - { - if (card->dynamic_slot_data.from_host_reserved_slots[i] > queue_fair_share) - { - excess_need_queues++; - } - else - { - unmovable_slots += card->dynamic_slot_data.from_host_reserved_slots[i]; - } - } - - unifi_trace(card->ospriv, UDBG5, "Excess need queues %d\n", excess_need_queues); - - /* Now find the slots per excess demand queue */ - excess_queue_slots = (num_data_slots - unmovable_slots) / excess_need_queues; - div_extra_slots = (num_data_slots - unmovable_slots) - excess_queue_slots * excess_need_queues; - for (i = UNIFI_NO_OF_TX_QS - 1; i >= 0; i--) - { - if (card->dynamic_slot_data.from_host_reserved_slots[i] > excess_queue_slots) - { - card->dynamic_slot_data.from_host_reserved_slots[i] = excess_queue_slots; - if (div_extra_slots > 0) - { - card->dynamic_slot_data.from_host_reserved_slots[i]++; - div_extra_slots--; - } - /* No more slots will be allocated to this queue during the current interval */ - card->dynamic_slot_data.queue_stable[i] = TRUE; - unifi_trace(card->ospriv, UDBG5, "queue stable %d\n", i); - } - } - } - - /* Redistribute max slots */ - for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) - { - reserved_slots = 0; - for (q = 0; q < UNIFI_NO_OF_TX_QS; q++) - { - if (i != q) - { - reserved_slots += card->dynamic_slot_data.from_host_reserved_slots[q]; - } - } - - card->dynamic_slot_data.from_host_max_slots[i] = num_data_slots - reserved_slots; - unifi_trace(card->ospriv, UDBG5, "queue %d reserved %d Max %d\n", i, - card->dynamic_slot_data.from_host_reserved_slots[i], - card->dynamic_slot_data.from_host_max_slots[i]); - } - -} - - -/* - * --------------------------------------------------------------------------- - * CardClearFromHostDataSlot - * - * Clear a the given data slot, making it available again. - * - * Arguments: - * card Pointer to Card object - * slot Index of the signal slot to clear. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void CardClearFromHostDataSlot(card_t *card, const s16 slot) -{ - u8 queue = card->from_host_data[slot].queue; - const void *os_data_ptr = card->from_host_data[slot].bd.os_data_ptr; - - if (card->from_host_data[slot].bd.data_length == 0) - { - unifi_warning(card->ospriv, - "Surprise: request to clear an already free FH data slot: %d\n", - slot); - return; - } - - if (os_data_ptr == NULL) - { - unifi_warning(card->ospriv, - "Clearing FH data slot %d: has null payload, len=%d\n", - slot, card->from_host_data[slot].bd.data_length); - } - - /* Free card->from_host_data[slot].bd.os_net_ptr here. */ - /* Mark slot as free by setting length to 0. */ - unifi_free_bulk_data(card, &card->from_host_data[slot].bd); - if (queue < UNIFI_NO_OF_TX_QS) - { - if (card->dynamic_slot_data.from_host_used_slots[queue] == 0) - { - unifi_error(card->ospriv, "Goofed up used slots q = %d used slots = %d\n", - queue, - card->dynamic_slot_data.from_host_used_slots[queue]); - } - else - { - card->dynamic_slot_data.from_host_used_slots[queue]--; - } - card->dynamic_slot_data.packets_txed[queue]++; - card->dynamic_slot_data.total_packets_txed++; - if (card->dynamic_slot_data.total_packets_txed >= card->dynamic_slot_data.packets_interval) - { - CardReassignDynamicReservation(card); - } - } - - unifi_trace(card->ospriv, UDBG4, "CardClearFromHostDataSlot: slot %d recycled %p\n", slot, os_data_ptr); - -} /* CardClearFromHostDataSlot() */ - - -#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL -/* - * --------------------------------------------------------------------------- - * CardClearFromHostDataSlotWithoutFreeingBulkData - * - * Clear the given data slot with out freeing the bulk data. - * - * Arguments: - * card Pointer to Card object - * slot Index of the signal slot to clear. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const s16 slot) -{ - u8 queue = card->from_host_data[slot].queue; - - /* Initialise the from_host data slot so it can be re-used, - * Set length field in from_host_data array to 0. - */ - UNIFI_INIT_BULK_DATA(&card->from_host_data[slot].bd); - - queue = card->from_host_data[slot].queue; - - if (queue < UNIFI_NO_OF_TX_QS) - { - if (card->dynamic_slot_data.from_host_used_slots[queue] == 0) - { - unifi_error(card->ospriv, "Goofed up used slots q = %d used slots = %d\n", - queue, - card->dynamic_slot_data.from_host_used_slots[queue]); - } - else - { - card->dynamic_slot_data.from_host_used_slots[queue]--; - } - card->dynamic_slot_data.packets_txed[queue]++; - card->dynamic_slot_data.total_packets_txed++; - if (card->dynamic_slot_data.total_packets_txed >= - card->dynamic_slot_data.packets_interval) - { - CardReassignDynamicReservation(card); - } - } -} /* CardClearFromHostDataSlotWithoutFreeingBulkData() */ - - -#endif - -u16 CardGetDataSlotSize(card_t *card) -{ - return card->config_data.data_slot_size; -} /* CardGetDataSlotSize() */ - - -/* - * --------------------------------------------------------------------------- - * CardGetFreeFromHostDataSlots - * - * Retrieve the number of from-host bulk data slots available. - * - * Arguments: - * card Pointer to the card context struct - * - * Returns: - * Number of free from-host bulk data slots. - * --------------------------------------------------------------------------- - */ -u16 CardGetFreeFromHostDataSlots(card_t *card) -{ - u16 i, n = 0; - - /* First two slots reserved for MLME */ - for (i = 0; i < card->config_data.num_fromhost_data_slots; i++) - { - if (card->from_host_data[i].bd.data_length == 0) - { - /* Free slot */ - n++; - } - } - - return n; -} /* CardGetFreeFromHostDataSlots() */ - - -/* - * --------------------------------------------------------------------------- - * CardAreAllFromHostDataSlotsEmpty - * - * Returns the state of from-host bulk data slots. - * - * Arguments: - * card Pointer to the card context struct - * - * Returns: - * 1 The from-host bulk data slots are all empty (available). - * 0 Some or all the from-host bulk data slots are in use. - * --------------------------------------------------------------------------- - */ -u16 CardAreAllFromHostDataSlotsEmpty(card_t *card) -{ - u16 i; - - for (i = 0; i < card->config_data.num_fromhost_data_slots; i++) - { - if (card->from_host_data[i].bd.data_length != 0) - { - return 0; - } - } - - return 1; -} /* CardGetFreeFromHostDataSlots() */ - - -static CsrResult unifi_identify_hw(card_t *card) -{ - - card->chip_id = card->sdio_if->sdioId.cardId; - card->function = card->sdio_if->sdioId.sdioFunction; - card->sdio_io_block_size = card->sdio_if->blockSize; - - /* If SDIO controller doesn't support byte mode CMD53, pad transfers to block sizes */ - card->sdio_io_block_pad = (card->sdio_if->features & CSR_SDIO_FEATURE_BYTE_MODE)?FALSE : TRUE; - - /* - * Setup the chip helper so that we can access the registers (and - * also tell what sub-type of HIP we should use). - */ - card->helper = ChipHelper_GetVersionSdio((u8)card->chip_id); - if (!card->helper) - { - unifi_error(card->ospriv, "Null ChipHelper\n"); - } - - unifi_info(card->ospriv, "Chip ID 0x%02X Function %u Block Size %u Name %s(%s)\n", - card->chip_id, card->function, card->sdio_io_block_size, - ChipHelper_MarketingName(card->helper), - ChipHelper_FriendlyName(card->helper)); - - return CSR_RESULT_SUCCESS; -} /* unifi_identify_hw() */ - - -static CsrResult unifi_prepare_hw(card_t *card) -{ - CsrResult r; - CsrResult csrResult; - enum unifi_host_state old_state = card->host_state; - - r = unifi_identify_hw(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to identify hw\n"); - return r; - } - - unifi_trace(card->ospriv, UDBG1, - "%s mode SDIO\n", card->sdio_io_block_pad?"Block" : "Byte"); - /* - * Chip must be a awake or blocks that are asleep may not get - * reset. We can only do this after we have read the chip_id. - */ - r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - - if (old_state == UNIFI_HOST_STATE_TORPID) - { - /* Ensure the initial clock rate is set; if a reset occurred when the chip was - * TORPID, unifi_set_host_state() may have raised it to MAX. - */ - csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_INIT_HZ); - if (csrResult != CSR_RESULT_SUCCESS) - { - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - return r; - } - card->sdio_clock_speed = UNIFI_SDIO_CLOCK_INIT_HZ; - } - - /* - * The WLAN function must be enabled to access MAILBOX2 and DEBUG_RST - * registers. - */ - csrResult = CsrSdioFunctionEnable(card->sdio_if); - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - return CSR_WIFI_HIP_RESULT_NO_DEVICE; - } - if (csrResult != CSR_RESULT_SUCCESS) - { - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - /* Can't enable WLAN function. Try resetting the SDIO block. */ - unifi_error(card->ospriv, "Failed to re-enable function %d.\n", card->function); - return r; - } - - /* - * Poke some registers to make sure the PLL has started, - * otherwise memory accesses are likely to fail. - */ - bootstrap_chip_hw(card); - - /* Try to read the chip version from register. */ - r = unifi_read_chip_version(card); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - return CSR_RESULT_SUCCESS; -} /* unifi_prepare_hw() */ - - -static CsrResult unifi_read_chip_version(card_t *card) -{ - u32 gbl_chip_version; - CsrResult r; - u16 ver; - - gbl_chip_version = ChipHelper_GBL_CHIP_VERSION(card->helper); - - /* Try to read the chip version from register. */ - if (gbl_chip_version != 0) - { - r = unifi_read_direct16(card, gbl_chip_version * 2, &ver); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read GBL_CHIP_VERSION\n"); - return r; - } - card->chip_version = ver; - } - else - { - unifi_info(card->ospriv, "Unknown Chip ID, cannot locate GBL_CHIP_VERSION\n"); - r = CSR_RESULT_FAILURE; - } - - unifi_info(card->ospriv, "Chip Version 0x%04X\n", card->chip_version); - - return r; -} /* unifi_read_chip_version() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_reset_hardware - * - * Execute the UniFi reset sequence. - * - * Note: This may fail if the chip is going TORPID so retry at - * least once. - * - * Arguments: - * card - pointer to card context structure - * - * Returns: - * CSR_RESULT_SUCCESS on success, CSR error otherwise. - * - * Notes: - * Some platforms (e.g. Windows Vista) do not allow access to registers - * that are necessary for a software soft reset. - * --------------------------------------------------------------------------- - */ -static CsrResult unifi_reset_hardware(card_t *card) -{ - CsrResult r; - u16 new_block_size = UNIFI_IO_BLOCK_SIZE; - CsrResult csrResult; - - /* Errors returned by unifi_prepare_hw() are not critical at this point */ - r = unifi_prepare_hw(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - - /* First try SDIO controller reset, which may power cycle the UniFi, assert - * its reset line, or not be implemented depending on the platform. - */ - unifi_info(card->ospriv, "Calling CsrSdioHardReset\n"); - csrResult = CsrSdioHardReset(card->sdio_if); - if (csrResult == CSR_RESULT_SUCCESS) - { - unifi_info(card->ospriv, "CsrSdioHardReset succeeded on resetting UniFi\n"); - r = unifi_prepare_hw(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "unifi_prepare_hw failed after hard reset\n"); - return r; - } - } - else if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - return CSR_WIFI_HIP_RESULT_NO_DEVICE; - } - else - { - /* Falling back to software hard reset methods */ - unifi_info(card->ospriv, "Falling back to software hard reset\n"); - r = unifi_card_hard_reset(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "software hard reset failed\n"); - return r; - } - - /* If we fell back to unifi_card_hard_reset() methods, chip version may - * not have been read. (Note in the unlikely event that it is zero, - * it will be harmlessly read again) - */ - if (card->chip_version == 0) - { - r = unifi_read_chip_version(card); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - } - } - -#ifdef CSR_WIFI_HIP_SDIO_BLOCK_SIZE - new_block_size = CSR_WIFI_HIP_SDIO_BLOCK_SIZE; -#endif - - /* After hard reset, we need to restore the SDIO block size */ - csrResult = CsrSdioBlockSizeSet(card->sdio_if, new_block_size); - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - - /* Warn if a different block size was achieved by the transport */ - if (card->sdio_if->blockSize != new_block_size) - { - unifi_info(card->ospriv, - "Actually got block size %d\n", card->sdio_if->blockSize); - } - - /* sdio_io_block_size always needs be updated from the achieved block size, - * as it is used by the OS layer to allocate memory in unifi_net_malloc(). - * Controllers which don't support block mode (e.g. CSPI) will report a - * block size of zero. - */ - if (card->sdio_if->blockSize == 0) - { - unifi_info(card->ospriv, "Block size 0, block mode not available\n"); - - /* Set sdio_io_block_size to 1 so that unifi_net_data_malloc() has a - * sensible rounding value. Elsewhere padding will already be - * disabled because the controller supports byte mode. - */ - card->sdio_io_block_size = 1; - - /* Controller features must declare support for byte mode */ - if (!(card->sdio_if->features & CSR_SDIO_FEATURE_BYTE_MODE)) - { - unifi_error(card->ospriv, "Requires byte mode\n"); - r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - } - else - { - /* Padding will be enabled if CSR_SDIO_FEATURE_BYTE_MODE isn't set */ - card->sdio_io_block_size = card->sdio_if->blockSize; - } - - - return r; -} /* unifi_reset_hardware() */ - - -/* - * --------------------------------------------------------------------------- - * card_reset_method_io_enable - * - * Issue a hard reset to the hw writing the IO_ENABLE. - * - * Arguments: - * card Pointer to Card object - * - * Returns: - * 0 on success, - * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected - * CSR_RESULT_FAILURE if an SDIO error occurred or if a response - * was not seen in the expected time - * --------------------------------------------------------------------------- - */ -static CsrResult card_reset_method_io_enable(card_t *card) -{ - CsrResult r; - CsrResult csrResult; - - /* - * This resets only function 1, so should be used in - * preference to the method below (CSR_FUNC_EN) - */ - unifi_trace(card->ospriv, UDBG1, "Hard reset (IO_ENABLE)\n"); - - csrResult = CsrSdioFunctionDisable(card->sdio_if); - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - return CSR_WIFI_HIP_RESULT_NO_DEVICE; - } - if (csrResult != CSR_RESULT_SUCCESS) - { - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - unifi_warning(card->ospriv, "SDIO error writing IO_ENABLE: %d\n", r); - } - else - { - /* Delay here to let the reset take affect. */ - CsrThreadSleep(RESET_SETTLE_DELAY); - - r = card_wait_for_unifi_to_disable(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - - if (r == CSR_RESULT_SUCCESS) - { - r = card_wait_for_unifi_to_reset(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - } - } - - if (r != CSR_RESULT_SUCCESS) - { - unifi_trace(card->ospriv, UDBG1, "Hard reset (CSR_FUNC_EN)\n"); - - r = sdio_write_f0(card, SDIO_CSR_FUNC_EN, 0); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_warning(card->ospriv, "SDIO error writing SDIO_CSR_FUNC_EN: %d\n", r); - return r; - } - else - { - /* Delay here to let the reset take affect. */ - CsrThreadSleep(RESET_SETTLE_DELAY); - - r = card_wait_for_unifi_to_reset(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - } - } - - if (r != CSR_RESULT_SUCCESS) - { - unifi_warning(card->ospriv, "card_reset_method_io_enable failed to reset UniFi\n"); - } - - return r; -} /* card_reset_method_io_enable() */ - - -/* - * --------------------------------------------------------------------------- - * card_reset_method_dbg_reset - * - * Issue a hard reset to the hw writing the DBG_RESET. - * - * Arguments: - * card Pointer to Card object - * - * Returns: - * CSR_RESULT_SUCCESS on success, - * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected - * CSR_RESULT_FAILURE if an SDIO error occurred or if a response - * was not seen in the expected time - * --------------------------------------------------------------------------- - */ -static CsrResult card_reset_method_dbg_reset(card_t *card) -{ - CsrResult r; - - /* - * Prepare UniFi for h/w reset - */ - if (card->host_state == UNIFI_HOST_STATE_TORPID) - { - r = unifi_set_host_state(card, UNIFI_HOST_STATE_DROWSY); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to set UNIFI_HOST_STATE_DROWSY\n"); - return r; - } - CsrThreadSleep(5); - } - - r = unifi_card_stop_processor(card, UNIFI_PROC_BOTH); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Can't stop processors\n"); - return r; - } - - unifi_trace(card->ospriv, UDBG1, "Hard reset (DBG_RESET)\n"); - - /* - * This register write may fail. The debug reset resets - * parts of the Function 0 sections of the chip, and - * therefore the response cannot be sent back to the host. - */ - r = unifi_write_direct_8_or_16(card, ChipHelper_DBG_RESET(card->helper) * 2, 1); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_warning(card->ospriv, "SDIO error writing DBG_RESET: %d\n", r); - return r; - } - - /* Delay here to let the reset take affect. */ - CsrThreadSleep(RESET_SETTLE_DELAY); - - r = card_wait_for_unifi_to_reset(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_warning(card->ospriv, "card_reset_method_dbg_reset failed to reset UniFi\n"); - } - - return r; -} /* card_reset_method_dbg_reset() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_card_hard_reset - * - * Issue reset to hardware, by writing to registers on the card. - * Power to the card is preserved. - * - * Arguments: - * card Pointer to Card object - * - * Returns: - * CSR_RESULT_SUCCESS on success, - * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected - * CSR_RESULT_FAILURE if an SDIO error occurred or if a response - * was not seen in the expected time - * --------------------------------------------------------------------------- - */ -CsrResult unifi_card_hard_reset(card_t *card) -{ - CsrResult r; - const struct chip_helper_reset_values *init_data; - u32 chunks; - - /* Clear cache of page registers */ - card->proc_select = (u32)(-1); - card->dmem_page = (u32)(-1); - card->pmem_page = (u32)(-1); - - /* - * We need to have a valid card->helper before we use software hard reset. - * If unifi_identify_hw() fails to get the card ID, it probably means - * that there is no way to talk to the h/w. - */ - r = unifi_identify_hw(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "unifi_card_hard_reset failed to identify h/w\n"); - return r; - } - - /* Search for some reset code. */ - chunks = ChipHelper_HostResetSequence(card->helper, &init_data); - if (chunks != 0) - { - unifi_error(card->ospriv, - "Hard reset (Code download) is unsupported\n"); - - return CSR_RESULT_FAILURE; - } - - if (card->chip_id > SDIO_CARD_ID_UNIFI_2) - { - /* The HIP spec considers this a bus-specific reset. - * This resets only function 1, so should be used in - * preference to the method below (CSR_FUNC_EN) - * If this method fails, it means that the f/w is probably - * not running. In this case, try the DBG_RESET method. - */ - r = card_reset_method_io_enable(card); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r == CSR_RESULT_SUCCESS) - { - return r; - } - } - - /* Software hard reset */ - r = card_reset_method_dbg_reset(card); - - return r; -} /* unifi_card_hard_reset() */ - - -/* - * --------------------------------------------------------------------------- - * - * CardGenInt - * - * Prod the card. - * This function causes an internal interrupt to be raised in the - * UniFi chip. It is used to signal the firmware that some action has - * been completed. - * The UniFi Host Interface asks that the value used increments for - * debugging purposes. - * - * Arguments: - * card Pointer to Card object - * - * Returns: - * CSR_RESULT_SUCCESS on success, - * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected - * CSR_RESULT_FAILURE if an SDIO error occurred or if a response - * was not seen in the expected time - * --------------------------------------------------------------------------- - */ -CsrResult CardGenInt(card_t *card) -{ - CsrResult r; - - if (card->chip_id > SDIO_CARD_ID_UNIFI_2) - { - r = sdio_write_f0(card, SDIO_CSR_FROM_HOST_SCRATCH0, - (u8)card->unifi_interrupt_seq); - } - else - { - r = unifi_write_direct_8_or_16(card, - ChipHelper_SHARED_IO_INTERRUPT(card->helper) * 2, - (u8)card->unifi_interrupt_seq); - } - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "SDIO error writing UNIFI_SHARED_IO_INTERRUPT: %d\n", r); - return r; - } - - card->unifi_interrupt_seq++; - - return CSR_RESULT_SUCCESS; -} /* CardGenInt() */ - - -/* - * --------------------------------------------------------------------------- - * CardEnableInt - * - * Enable the outgoing SDIO interrupt from UniFi to the host. - * - * Arguments: - * card Pointer to Card object - * - * Returns: - * CSR_RESULT_SUCCESS on success, - * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected - * CSR_RESULT_FAILURE if an SDIO error occurred, - * --------------------------------------------------------------------------- - */ -CsrResult CardEnableInt(card_t *card) -{ - CsrResult r; - u8 int_enable; - - r = sdio_read_f0(card, SDIO_INT_ENABLE, &int_enable); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "SDIO error reading SDIO_INT_ENABLE\n"); - return r; - } - - int_enable |= (1 << card->function) | UNIFI_SD_INT_ENABLE_IENM; - - r = sdio_write_f0(card, SDIO_INT_ENABLE, int_enable); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "SDIO error writing SDIO_INT_ENABLE\n"); - return r; - } - - return CSR_RESULT_SUCCESS; -} /* CardEnableInt() */ - - -/* - * --------------------------------------------------------------------------- - * CardDisableInt - * - * Disable the outgoing SDIO interrupt from UniFi to the host. - * - * Arguments: - * card Pointer to Card object - * - * Returns: - * CSR_RESULT_SUCCESS on success, - * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected - * CSR_RESULT_FAILURE if an SDIO error occurred, - * --------------------------------------------------------------------------- - */ -CsrResult CardDisableInt(card_t *card) -{ - CsrResult r; - u8 int_enable; - - r = sdio_read_f0(card, SDIO_INT_ENABLE, &int_enable); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "SDIO error reading SDIO_INT_ENABLE\n"); - return r; - } - - int_enable &= ~(1 << card->function); - - r = sdio_write_f0(card, SDIO_INT_ENABLE, int_enable); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "SDIO error writing SDIO_INT_ENABLE\n"); - return r; - } - - return CSR_RESULT_SUCCESS; -} /* CardDisableInt() */ - - -/* - * --------------------------------------------------------------------------- - * CardPendingInt - * - * Determine whether UniFi is currently asserting the SDIO interrupt - * request. - * - * Arguments: - * card Pointer to Card object - * pintr Pointer to location to write interrupt status, - * TRUE if interrupt pending, - * FALSE if no interrupt pending. - * Returns: - * CSR_RESULT_SUCCESS interrupt status read successfully - * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected - * CSR_RESULT_FAILURE if an SDIO error occurred, - * --------------------------------------------------------------------------- - */ -CsrResult CardPendingInt(card_t *card, u8 *pintr) -{ - CsrResult r; - u8 pending; - - *pintr = FALSE; - - r = sdio_read_f0(card, SDIO_INT_PENDING, &pending); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "SDIO error reading SDIO_INT_PENDING\n"); - return r; - } - - *pintr = (pending & (1 << card->function))?TRUE : FALSE; - - return CSR_RESULT_SUCCESS; -} /* CardPendingInt() */ - - -/* - * --------------------------------------------------------------------------- - * CardClearInt - * - * Clear the UniFi SDIO interrupt request. - * - * Arguments: - * card Pointer to Card object - * - * Returns: - * CSR_RESULT_SUCCESS if pending interrupt was cleared, or no pending interrupt. - * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected - * CSR_RESULT_FAILURE if an SDIO error occurred, - * --------------------------------------------------------------------------- - */ -CsrResult CardClearInt(card_t *card) -{ - CsrResult r; - u8 intr; - - if (card->chip_id > SDIO_CARD_ID_UNIFI_2) - { - /* CardPendingInt() sets intr, if there is a pending interrupt */ - r = CardPendingInt(card, &intr); - if (intr == FALSE) - { - return r; - } - - r = sdio_write_f0(card, SDIO_CSR_HOST_INT_CLEAR, 1); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "SDIO error writing SDIO_CSR_HOST_INT_CLEAR\n"); - } - } - else - { - r = unifi_write_direct_8_or_16(card, - ChipHelper_SDIO_HOST_INT(card->helper) * 2, - 0); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "SDIO error writing UNIFI_SDIO_HOST_INT\n"); - } - } - - return r; -} /* CardClearInt() */ - - -/* - * --------------------------------------------------------------------------- - * CardIntEnabled - * - * Determine whether UniFi is currently asserting the SDIO interrupt - * request. - * - * Arguments: - * card Pointer to Card object - * enabled Pointer to location to write interrupt enable status, - * TRUE if interrupts enabled, - * FALSE if interupts disabled. - * - * Returns: - * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected - * CSR_RESULT_FAILURE if an SDIO error occurred, - * --------------------------------------------------------------------------- - */ -CsrResult CardIntEnabled(card_t *card, u8 *enabled) -{ - CsrResult r; - u8 int_enable; - - r = sdio_read_f0(card, SDIO_INT_ENABLE, &int_enable); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "SDIO error reading SDIO_INT_ENABLE\n"); - return r; - } - - *enabled = (int_enable & (1 << card->function))?TRUE : FALSE; - - return CSR_RESULT_SUCCESS; -} /* CardIntEnabled() */ - - -/* - * --------------------------------------------------------------------------- - * CardWriteBulkData - * Allocate slot in the pending bulkdata arrays and assign it to a signal's - * bulkdata reference. The slot is then ready for UniFi's bulkdata commands - * to transfer the data to/from the host. - * - * Arguments: - * card Pointer to Card object - * csptr Pending signal pointer, including bulkdata ref - * queue Traffic queue that this signal is using - * - * Returns: - * CSR_RESULT_SUCCESS if a free slot was assigned - * CSR_RESULT_FAILURE if no slot was available - * --------------------------------------------------------------------------- - */ -CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQueue queue) -{ - u16 i, slots[UNIFI_MAX_DATA_REFERENCES], j = 0; - u8 *packed_sigptr, num_slots_required = 0; - bulk_data_desc_t *bulkdata = csptr->bulkdata; - s16 h, nslots; - - /* Count the number of slots required */ - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) - { - if (bulkdata[i].data_length != 0) - { - num_slots_required++; - } - } - - /* Get the slot numbers */ - if (num_slots_required != 0) - { - /* Last 2 slots for MLME */ - if (queue == UNIFI_TRAFFIC_Q_MLME) - { - h = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS; - for (i = 0; i < card->config_data.num_fromhost_data_slots; i++) - { - if (card->from_host_data[h].bd.data_length == 0) - { - /* Free data slot, claim it */ - slots[j++] = h; - if (j == num_slots_required) - { - break; - } - } - - if (++h >= card->config_data.num_fromhost_data_slots) - { - h = 0; - } - } - } - else - { - if (card->dynamic_slot_data.from_host_used_slots[queue] - < card->dynamic_slot_data.from_host_max_slots[queue]) - { - /* Data commands get a free slot only after a few checks */ - nslots = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS; - - h = card->from_host_data_head; - - for (i = 0; i < nslots; i++) - { - if (card->from_host_data[h].bd.data_length == 0) - { - /* Free data slot, claim it */ - slots[j++] = h; - if (j == num_slots_required) - { - break; - } - } - - if (++h >= nslots) - { - h = 0; - } - } - card->from_host_data_head = h; - } - } - - /* Required number of slots are not available, bail out */ - if (j != num_slots_required) - { - unifi_trace(card->ospriv, UDBG5, "CardWriteBulkData: didn't find free slot/s\n"); - - /* If we haven't already reached the stable state we can ask for reservation */ - if ((queue != UNIFI_TRAFFIC_Q_MLME) && (card->dynamic_slot_data.queue_stable[queue] == FALSE)) - { - CardCheckDynamicReservation(card, queue); - } - - for (i = 0; i < card->config_data.num_fromhost_data_slots; i++) - { - unifi_trace(card->ospriv, UDBG5, "fh data slot %d: %d\n", i, card->from_host_data[i].bd.data_length); - } - return CSR_RESULT_FAILURE; - } - } - - packed_sigptr = csptr->sigbuf; - - /* Fill in the slots with data */ - j = 0; - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) - { - if (bulkdata[i].data_length == 0) - { - /* Zero-out the DATAREF in the signal */ - SET_PACKED_DATAREF_SLOT(packed_sigptr, i, 0); - SET_PACKED_DATAREF_LEN(packed_sigptr, i, 0); - } - else - { - /* - * Fill in the slot number in the SIGNAL structure but - * preserve the offset already in there - */ - SET_PACKED_DATAREF_SLOT(packed_sigptr, i, slots[j] | (((u16)packed_sigptr[SIZEOF_SIGNAL_HEADER + (i * SIZEOF_DATAREF) + 1]) << 8)); - SET_PACKED_DATAREF_LEN(packed_sigptr, i, bulkdata[i].data_length); - - /* Do not copy the data, just store the information to them */ - card->from_host_data[slots[j]].bd.os_data_ptr = bulkdata[i].os_data_ptr; - card->from_host_data[slots[j]].bd.os_net_buf_ptr = bulkdata[i].os_net_buf_ptr; - card->from_host_data[slots[j]].bd.data_length = bulkdata[i].data_length; - card->from_host_data[slots[j]].bd.net_buf_length = bulkdata[i].net_buf_length; - card->from_host_data[slots[j]].queue = queue; - - unifi_trace(card->ospriv, UDBG4, "CardWriteBulkData sig=0x%x, fh slot %d = %p\n", - GET_SIGNAL_ID(packed_sigptr), i, bulkdata[i].os_data_ptr); - - /* Sanity-check that the bulk data desc being assigned to the slot - * actually has a payload. - */ - if (!bulkdata[i].os_data_ptr) - { - unifi_error(card->ospriv, "Assign null os_data_ptr (len=%d) fh slot %d, i=%d, q=%d, sig=0x%x", - bulkdata[i].data_length, slots[j], i, queue, GET_SIGNAL_ID(packed_sigptr)); - } - - j++; - if (queue < UNIFI_NO_OF_TX_QS) - { - card->dynamic_slot_data.from_host_used_slots[queue]++; - } - } - } - - return CSR_RESULT_SUCCESS; -} /* CardWriteBulkData() */ - - -/* - * --------------------------------------------------------------------------- - * card_find_data_slot - * - * Dereference references to bulk data slots into pointers to real data. - * - * Arguments: - * card Pointer to the card struct. - * slot Slot number from a signal structure - * - * Returns: - * Pointer to entry in bulk_data_slot array. - * --------------------------------------------------------------------------- - */ -bulk_data_desc_t* card_find_data_slot(card_t *card, s16 slot) -{ - s16 sn; - bulk_data_desc_t *bd; - - sn = slot & 0x7FFF; - - /* ?? check sanity of slot number ?? */ - - if (slot & SLOT_DIR_TO_HOST) - { - bd = &card->to_host_data[sn]; - } - else - { - bd = &card->from_host_data[sn].bd; - } - - return bd; -} /* card_find_data_slot() */ - - -/* - * --------------------------------------------------------------------------- - * firmware_present_in_flash - * - * Probe for external Flash that looks like it might contain firmware. - * - * If Flash is not present, reads always return 0x0008. - * If Flash is present, but empty, reads return 0xFFFF. - * Anything else is considered to be firmware. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * CSR_RESULT_SUCCESS firmware is present in ROM or flash - * CSR_WIFI_HIP_RESULT_NOT_FOUND firmware is not present in ROM or flash - * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected - * CSR_RESULT_FAILURE if an SDIO error occurred - * --------------------------------------------------------------------------- - */ -static CsrResult firmware_present_in_flash(card_t *card) -{ - CsrResult r; - u16 m1, m5; - - if (ChipHelper_HasRom(card->helper)) - { - return CSR_RESULT_SUCCESS; - } - if (!ChipHelper_HasFlash(card->helper)) - { - return CSR_WIFI_HIP_RESULT_NOT_FOUND; - } - - /* - * Examine the Flash locations that are the power-on default reset - * vectors of the XAP processors. - * These are words 1 and 5 in Flash. - */ - r = unifi_card_read16(card, UNIFI_MAKE_GP(EXT_FLASH, 2), &m1); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - r = unifi_card_read16(card, UNIFI_MAKE_GP(EXT_FLASH, 10), &m5); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - /* Check for uninitialised/missing flash */ - if ((m1 == 0x0008) || (m1 == 0xFFFF) || - (m1 == 0x0004) || (m5 == 0x0004) || - (m5 == 0x0008) || (m5 == 0xFFFF)) - { - return CSR_WIFI_HIP_RESULT_NOT_FOUND; - } - - return CSR_RESULT_SUCCESS; -} /* firmware_present_in_flash() */ - - -/* - * --------------------------------------------------------------------------- - * bootstrap_chip_hw - * - * Perform chip specific magic to "Get It Working" TM. This will - * increase speed of PLLs in analogue and maybe enable some - * on-chip regulators. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void bootstrap_chip_hw(card_t *card) -{ - const struct chip_helper_init_values *vals; - u32 i, len; - void *sdio = card->sdio_if; - CsrResult csrResult; - - len = ChipHelper_ClockStartupSequence(card->helper, &vals); - if (len != 0) - { - for (i = 0; i < len; i++) - { - csrResult = CsrSdioWrite16(sdio, vals[i].addr * 2, vals[i].value); - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_warning(card->ospriv, "Failed to write bootstrap value %d\n", i); - /* Might not be fatal */ - } - - CsrThreadSleep(1); - } - } -} /* bootstrap_chip_hw() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_card_stop_processor - * - * Stop the UniFi XAP processors. - * - * Arguments: - * card Pointer to card struct - * which One of UNIFI_PROC_MAC, UNIFI_PROC_PHY, UNIFI_PROC_BOTH - * - * Returns: - * CSR_RESULT_SUCCESS if successful, or CSR error code - * --------------------------------------------------------------------------- - */ -CsrResult unifi_card_stop_processor(card_t *card, enum unifi_dbg_processors_select which) -{ - CsrResult r = CSR_RESULT_SUCCESS; - u8 status; - s16 retry = 100; - - while (retry--) - { - /* Select both XAPs */ - r = unifi_set_proc_select(card, which); - if (r != CSR_RESULT_SUCCESS) - { - break; - } - - /* Stop processors */ - r = unifi_write_direct16(card, ChipHelper_DBG_EMU_CMD(card->helper) * 2, 2); - if (r != CSR_RESULT_SUCCESS) - { - break; - } - - /* Read status */ - r = unifi_read_direct_8_or_16(card, - ChipHelper_DBG_HOST_STOP_STATUS(card->helper) * 2, - &status); - if (r != CSR_RESULT_SUCCESS) - { - break; - } - - if ((status & 1) == 1) - { - /* Success! */ - return CSR_RESULT_SUCCESS; - } - - /* Processors didn't stop, try again */ - } - - if (r != CSR_RESULT_SUCCESS) - { - /* An SDIO error occurred */ - unifi_error(card->ospriv, "Failed to stop processors: SDIO error\n"); - } - else - { - /* If we reach here, we didn't the status in time. */ - unifi_error(card->ospriv, "Failed to stop processors: timeout waiting for stopped status\n"); - r = CSR_RESULT_FAILURE; - } - - return r; -} /* unifi_card_stop_processor() */ - - -/* - * --------------------------------------------------------------------------- - * card_start_processor - * - * Start the UniFi XAP processors. - * - * Arguments: - * card Pointer to card struct - * which One of UNIFI_PROC_MAC, UNIFI_PROC_PHY, UNIFI_PROC_BOTH - * - * Returns: - * CSR_RESULT_SUCCESS or CSR error code - * --------------------------------------------------------------------------- - */ -CsrResult card_start_processor(card_t *card, enum unifi_dbg_processors_select which) -{ - CsrResult r; - - /* Select both XAPs */ - r = unifi_set_proc_select(card, which); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "unifi_set_proc_select failed: %d.\n", r); - return r; - } - - - r = unifi_write_direct_8_or_16(card, - ChipHelper_DBG_EMU_CMD(card->helper) * 2, 8); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - r = unifi_write_direct_8_or_16(card, - ChipHelper_DBG_EMU_CMD(card->helper) * 2, 0); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - return CSR_RESULT_SUCCESS; -} /* card_start_processor() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_set_interrupt_mode - * - * Configure the interrupt processing mode used by the HIP - * - * Arguments: - * card Pointer to card struct - * mode Interrupt mode to apply - * - * Returns: - * None - * --------------------------------------------------------------------------- - */ -void unifi_set_interrupt_mode(card_t *card, u32 mode) -{ - if (mode == CSR_WIFI_INTMODE_RUN_BH_ONCE) - { - unifi_info(card->ospriv, "Scheduled interrupt mode"); - } - card->intmode = mode; -} /* unifi_set_interrupt_mode() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_start_processors - * - * Start all UniFi XAP processors. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * CSR_RESULT_SUCCESS on success, CSR error code on error - * --------------------------------------------------------------------------- - */ -CsrResult unifi_start_processors(card_t *card) -{ - return card_start_processor(card, UNIFI_PROC_BOTH); -} /* unifi_start_processors() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_request_max_sdio_clock - * - * Requests that the maximum SDIO clock rate is set at the next suitable - * opportunity (e.g. when the BH next runs, so as not to interfere with - * any current operation). - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * None - * --------------------------------------------------------------------------- - */ -void unifi_request_max_sdio_clock(card_t *card) -{ - card->request_max_clock = 1; -} /* unifi_request_max_sdio_clock() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_set_host_state - * - * Set the host deep-sleep state. - * - * If transitioning to TORPID, the SDIO driver will be notified - * that the SD bus will be unused (idle) and conversely, when - * transitioning from TORPID that the bus will be used (active). - * - * Arguments: - * card Pointer to card struct - * state New deep-sleep state. - * - * Returns: - * CSR_RESULT_SUCCESS on success - * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected - * CSR_RESULT_FAILURE if an SDIO error occurred - * - * Notes: - * We need to reduce the SDIO clock speed before trying to wake up the - * chip. Actually, in the implementation below we reduce the clock speed - * not just before we try to wake up the chip, but when we put the chip to - * deep sleep. This means that if the f/w wakes up on its' own, we waste - * a reduce/increace cycle. However, trying to eliminate this overhead is - * proved difficult, as the current state machine in the HIP lib does at - * least a CMD52 to disable the interrupts before we configure the host - * state. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_set_host_state(card_t *card, enum unifi_host_state state) -{ - CsrResult r = CSR_RESULT_SUCCESS; - CsrResult csrResult; - static const char *const states[] = { - "AWAKE", "DROWSY", "TORPID" - }; - static const u8 state_csr_host_wakeup[] = { - 1, 3, 0 - }; - static const u8 state_io_abort[] = { - 0, 2, 3 - }; - - unifi_trace(card->ospriv, UDBG4, "State %s to %s\n", - states[card->host_state], states[state]); - - if (card->host_state == UNIFI_HOST_STATE_TORPID) - { - CsrSdioFunctionActive(card->sdio_if); - } - - /* Write the new state to UniFi. */ - if (card->chip_id > SDIO_CARD_ID_UNIFI_2) - { - r = sdio_write_f0(card, SDIO_CSR_HOST_WAKEUP, - (u8)((card->function << 4) | state_csr_host_wakeup[state])); - } - else - { - r = sdio_write_f0(card, SDIO_IO_ABORT, state_io_abort[state]); - } - - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write UniFi deep sleep state\n"); - } - else - { - /* - * If the chip was in state TORPID then we can now increase - * the maximum bus clock speed. - */ - if (card->host_state == UNIFI_HOST_STATE_TORPID) - { - csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, - UNIFI_SDIO_CLOCK_MAX_HZ); - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - /* Non-fatal error */ - if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - unifi_warning(card->ospriv, - "Failed to increase the SDIO clock speed\n"); - } - else - { - card->sdio_clock_speed = UNIFI_SDIO_CLOCK_MAX_HZ; - } - } - - /* - * Cache the current state in the card structure to avoid - * unnecessary SDIO reads. - */ - card->host_state = state; - - if (state == UNIFI_HOST_STATE_TORPID) - { - /* - * If the chip is now in state TORPID then we must now decrease - * the maximum bus clock speed. - */ - csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, - UNIFI_SDIO_CLOCK_SAFE_HZ); - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - unifi_warning(card->ospriv, - "Failed to decrease the SDIO clock speed\n"); - } - else - { - card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ; - } - CsrSdioFunctionIdle(card->sdio_if); - } - } - - return r; -} /* unifi_set_host_state() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_card_info - * - * Update the card information data structure - * - * Arguments: - * card Pointer to card struct - * card_info Pointer to info structure to update - * - * Returns: - * None - * --------------------------------------------------------------------------- - */ -void unifi_card_info(card_t *card, card_info_t *card_info) -{ - card_info->chip_id = card->chip_id; - card_info->chip_version = card->chip_version; - card_info->fw_build = card->build_id; - card_info->fw_hip_version = card->config_data.version; - card_info->sdio_block_size = card->sdio_io_block_size; -} /* unifi_card_info() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_check_io_status - * - * Check UniFi for spontaneous reset and pending interrupt. - * - * Arguments: - * card Pointer to card struct - * status Pointer to location to write chip status: - * 0 if UniFi is running, and no interrupt pending - * 1 if UniFi has spontaneously reset - * 2 if there is a pending interrupt - * Returns: - * CSR_RESULT_SUCCESS if OK, or CSR error - * --------------------------------------------------------------------------- - */ -CsrResult unifi_check_io_status(card_t *card, s32 *status) -{ - u8 io_en; - CsrResult r; - u8 pending; - - *status = 0; - - r = sdio_read_f0(card, SDIO_IO_ENABLE, &io_en); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read SDIO_IO_ENABLE to check for spontaneous reset\n"); - return r; - } - - if ((io_en & (1 << card->function)) == 0) - { - s32 fw_count; - *status = 1; - unifi_error(card->ospriv, "UniFi has spontaneously reset.\n"); - - /* - * These reads are very likely to fail. We want to know if the function is really - * disabled or the SDIO driver just returns rubbish. - */ - fw_count = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4); - if (fw_count < 0) - { - unifi_error(card->ospriv, "Failed to read to-host sig written count\n"); - } - else - { - unifi_error(card->ospriv, "thsw: %u (driver thinks is %u)\n", - fw_count, card->to_host_signals_w); - } - fw_count = unifi_read_shared_count(card, card->sdio_ctrl_addr + 2); - if (fw_count < 0) - { - unifi_error(card->ospriv, "Failed to read from-host sig read count\n"); - } - else - { - unifi_error(card->ospriv, "fhsr: %u (driver thinks is %u)\n", - fw_count, card->from_host_signals_r); - } - - return r; - } - - unifi_info(card->ospriv, "UniFi function %d is enabled.\n", card->function); - - /* See if we missed an SDIO interrupt */ - r = CardPendingInt(card, &pending); - if (pending) - { - unifi_error(card->ospriv, "There is an unhandled pending interrupt.\n"); - *status = 2; - return r; - } - - return r; -} /* unifi_check_io_status() */ - - -void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo) -{ - s32 count_fhr; - s16 t; - u32 occupied_fh; - - q_t *sigq; - u16 nslots, i; - - memset(hipqosinfo, 0, sizeof(unifi_HipQosInfo)); - - nslots = card->config_data.num_fromhost_data_slots; - - for (i = 0; i < nslots; i++) - { - if (card->from_host_data[i].bd.data_length == 0) - { - hipqosinfo->free_fh_bulkdata_slots++; - } - } - - for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) - { - sigq = &card->fh_traffic_queue[i]; - t = sigq->q_wr_ptr - sigq->q_rd_ptr; - if (t < 0) - { - t += sigq->q_length; - } - hipqosinfo->free_fh_sig_queue_slots[i] = (sigq->q_length - t) - 1; - } - - count_fhr = unifi_read_shared_count(card, card->sdio_ctrl_addr + 2); - if (count_fhr < 0) - { - unifi_error(card->ospriv, "Failed to read from-host sig read count - %d\n", count_fhr); - hipqosinfo->free_fh_fw_slots = 0xfa; - return; - } - - occupied_fh = (card->from_host_signals_w - count_fhr) % 128; - - hipqosinfo->free_fh_fw_slots = (u16)(card->config_data.num_fromhost_sig_frags - occupied_fh); -} - - - -CsrResult ConvertCsrSdioToCsrHipResult(card_t *card, CsrResult csrResult) -{ - CsrResult r = CSR_RESULT_FAILURE; - - switch (csrResult) - { - case CSR_RESULT_SUCCESS: - r = CSR_RESULT_SUCCESS; - break; - /* Timeout errors */ - case CSR_SDIO_RESULT_TIMEOUT: - /* Integrity errors */ - case CSR_SDIO_RESULT_CRC_ERROR: - r = CSR_RESULT_FAILURE; - break; - case CSR_SDIO_RESULT_NO_DEVICE: - r = CSR_WIFI_HIP_RESULT_NO_DEVICE; - break; - case CSR_SDIO_RESULT_INVALID_VALUE: - r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; - break; - case CSR_RESULT_FAILURE: - r = CSR_RESULT_FAILURE; - break; - default: - unifi_warning(card->ospriv, "Unrecognised csrResult error code: %d\n", csrResult); - break; - } - - return r; -} /* ConvertCsrSdioToCsrHipResult() */ - - diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.h b/drivers/staging/csr/csr_wifi_hip_card_sdio.h deleted file mode 100644 index a9b9ec427320..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.h +++ /dev/null @@ -1,694 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * - * FILE: csr_wifi_hip_card_sdio.h - * - * PURPOSE: - * Internal header for Card API for SDIO. - * --------------------------------------------------------------------------- - */ -#ifndef __CARD_SDIO_H__ -#define __CARD_SDIO_H__ - -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_unifi_udi.h" -#include "csr_wifi_hip_unifihw.h" -#include "csr_wifi_hip_unifiversion.h" -#ifndef CSR_WIFI_HIP_TA_DISABLE -#include "csr_wifi_hip_ta_sampling.h" -#endif -#include "csr_wifi_hip_xbv.h" -#include "csr_wifi_hip_chiphelper.h" - - -/* - * - * Configuration items. - * Which of these should go in a platform unifi_config.h file? - * - */ - -/* - * When the traffic queues contain more signals than there is space for on - * UniFi, a limiting algorithm comes into play. - * If a traffic queue has enough slots free to buffer more traffic from the - * network stack, then the following check is applied. The number of free - * slots is RESUME_XMIT_THRESHOLD. - */ -#define RESUME_XMIT_THRESHOLD 4 - - -/* - * When reading signals from UniFi, the host processes pending all signals - * and then acknowledges them together in a single write to update the - * to-host-chunks-read location. - * When there is more than one bulk data transfer (e.g. one received data - * packet and a request for the payload data of a transmitted packet), the - * update can be delayed significantly. This ties up resources on chip. - * - * To remedy this problem, to-host-chunks-read is updated after processing - * a signal if TO_HOST_FLUSH_THRESHOLD bytes of bulk data have been - * transferred since the last update. - */ -#define TO_HOST_FLUSH_THRESHOLD (500 * 5) - - -/* SDIO Card Common Control Registers */ -#define SDIO_CCCR_SDIO_REVISION (0x00) -#define SDIO_SD_SPEC_REVISION (0x01) -#define SDIO_IO_ENABLE (0x02) -#define SDIO_IO_READY (0x03) -#define SDIO_INT_ENABLE (0x04) -#define SDIO_INT_PENDING (0x05) -#define SDIO_IO_ABORT (0x06) -#define SDIO_BUS_IFACE_CONTROL (0x07) -#define SDIO_CARD_CAPABILOTY (0x08) -#define SDIO_COMMON_CIS_POINTER (0x09) -#define SDIO_BUS_SUSPEND (0x0C) -#define SDIO_FUNCTION_SELECT (0x0D) -#define SDIO_EXEC_FLAGS (0x0E) -#define SDIO_READY_FLAGS (0x0F) -#define SDIO_FN0_BLOCK_SIZE (0x10) -#define SDIO_POWER_CONTROL (0x12) -#define SDIO_VENDOR_START (0xF0) - -#define SDIO_CSR_HOST_WAKEUP (0xf0) -#define SDIO_CSR_HOST_INT_CLEAR (0xf1) -#define SDIO_CSR_FROM_HOST_SCRATCH0 (0xf2) -#define SDIO_CSR_FROM_HOST_SCRATCH1 (0xf3) -#define SDIO_CSR_TO_HOST_SCRATCH0 (0xf4) -#define SDIO_CSR_TO_HOST_SCRATCH1 (0xf5) -#define SDIO_CSR_FUNC_EN (0xf6) -#define SDIO_CSR_CSPI_MODE (0xf7) -#define SDIO_CSR_CSPI_STATUS (0xf8) -#define SDIO_CSR_CSPI_PADDING (0xf9) - - -#define UNIFI_SD_INT_ENABLE_IENM 0x0001 /* Master INT Enable */ - -#ifdef CSR_PRE_ALLOC_NET_DATA -#define BULK_DATA_PRE_ALLOC_NUM 16 -#endif - -/* - * Structure to hold configuration information read from UniFi. - */ -typedef struct -{ - /* - * The version of the SDIO signal queues and bulk data pools - * configuration structure. The MSB is the major version number, used to - * indicate incompatible changes. The LSB gives the minor revision number, - * used to indicate changes that maintain backwards compatibility. - */ - u16 version; - - /* - * offset from the start of the shared data memory to the SD IO - * control structure. - */ - u16 sdio_ctrl_offset; - - /* Buffer handle of the from-host signal queue */ - u16 fromhost_sigbuf_handle; - - /* Buffer handle of the to-host signal queue */ - u16 tohost_sigbuf_handle; - - /* - * Maximum number of signal primitive or bulk data command fragments that may be - * pending in the to-hw signal queue. - */ - u16 num_fromhost_sig_frags; - - /* - * Number of signal primitive or bulk data command fragments that must be pending - * in the to-host signal queue before the host will generate an interrupt - * to indicate that it has read a signal. This will usually be the total - * capacity of the to-host signal buffer less the size of the largest signal - * primitive divided by the signal primitive fragment size, but may be set - * to 1 to request interrupts every time that the host read a signal. - * Note that the hw may place more signals in the to-host signal queue - * than indicated by this field. - */ - u16 num_tohost_sig_frags; - - /* - * Number of to-hw bulk data slots. Slots are numbered from 0 (zero) to - * one less than the value in this field - */ - u16 num_fromhost_data_slots; - - /* - * Number of frm-hw bulk data slots. Slots are numbered from 0 (zero) to - * one less than the value in this field - */ - u16 num_tohost_data_slots; - - /* - * Size of the bulk data slots (2 octets) - * The size of the bulk data slots in octets. This will usually be - * the size of the largest MSDU. The value should always be even. - */ - u16 data_slot_size; - - /* - * Indicates that the host has finished the initialisation sequence. - * Initialised to 0x0000 by the firmware, and set to 0x0001 by us. - */ - u16 initialised; - - /* Added by protocol version 0x0001 */ - u32 overlay_size; - - /* Added by protocol version 0x0300 */ - u16 data_slot_round; - u16 sig_frag_size; - - /* Added by protocol version 0x0500 */ - u16 tohost_signal_padding; -} sdio_config_data_t; - -/* - * These values may change with versions of the Host Interface Protocol. - */ -/* - * Size of config info block pointed to by the CSR_SLT_SDIO_SLOT_CONFIG - * entry in the f/w symbol table - */ -#define SDIO_CONFIG_DATA_SIZE 30 - -/* Offset of the INIT flag in the config info block. */ -#define SDIO_INIT_FLAG_OFFSET 0x12 -#define SDIO_TO_HOST_SIG_PADDING_OFFSET 0x1C - - -/* Structure for a bulk data transfer command */ -typedef struct -{ - u16 cmd_and_len; /* bits 12-15 cmd, bits 0-11 len */ - u16 data_slot; /* slot number, perhaps OR'd with SLOT_DIR_TO_HOST */ - u16 offset; - u16 buffer_handle; -} bulk_data_cmd_t; - - -/* Bulk Data signal command values */ -#define SDIO_CMD_SIGNAL 0x00 -#define SDIO_CMD_TO_HOST_TRANSFER 0x01 -#define SDIO_CMD_TO_HOST_TRANSFER_ACK 0x02 /*deprecated*/ -#define SDIO_CMD_FROM_HOST_TRANSFER 0x03 -#define SDIO_CMD_FROM_HOST_TRANSFER_ACK 0x04 /*deprecated*/ -#define SDIO_CMD_CLEAR_SLOT 0x05 -#define SDIO_CMD_OVERLAY_TRANSFER 0x06 -#define SDIO_CMD_OVERLAY_TRANSFER_ACK 0x07 /*deprecated*/ -#define SDIO_CMD_FROM_HOST_AND_CLEAR 0x08 -#define SDIO_CMD_PADDING 0x0f - -#define SLOT_DIR_TO_HOST 0x8000 - - -/* Initialise bulkdata slot - * params: - * bulk_data_desc_t *bulk_data_slot - */ -#define UNIFI_INIT_BULK_DATA(bulk_data_slot) \ - { \ - (bulk_data_slot)->os_data_ptr = NULL; \ - (bulk_data_slot)->data_length = 0; \ - (bulk_data_slot)->os_net_buf_ptr = NULL; \ - (bulk_data_slot)->net_buf_length = 0; \ - } - -/* - * Structure to contain a SIGNAL datagram. - * This is used to build signal queues between the main driver and the - * i/o thread. - * The fields are: - * sigbuf Contains the HIP signal is wire-format (i.e. packed, - * little-endian) - * bulkdata Contains a copy of any associated bulk data - * signal_length The size of the signal in the sigbuf - */ -typedef struct card_signal -{ - u8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; - - /* Length of the SIGNAL inside sigbuf */ - u16 signal_length; - - bulk_data_desc_t bulkdata[UNIFI_MAX_DATA_REFERENCES]; -} card_signal_t; - - -/* - * Control structure for a generic ring buffer. - */ -#define UNIFI_QUEUE_NAME_MAX_LENGTH 16 -typedef struct -{ - card_signal_t *q_body; - - /* Num elements in queue (capacity is one less than this!) */ - u16 q_length; - - u16 q_wr_ptr; - u16 q_rd_ptr; - - char name[UNIFI_QUEUE_NAME_MAX_LENGTH]; -} q_t; - - -#define UNIFI_RESERVED_COMMAND_SLOTS 2 - -/* Considering approx 500 us per packet giving 0.5 secs */ -#define UNIFI_PACKETS_INTERVAL 1000 - -/* - * Dynamic slot reservation for QoS - */ -typedef struct -{ - u16 from_host_used_slots[UNIFI_NO_OF_TX_QS]; - u16 from_host_max_slots[UNIFI_NO_OF_TX_QS]; - u16 from_host_reserved_slots[UNIFI_NO_OF_TX_QS]; - - /* Parameters to determine if a queue was active. - If number of packets sent is greater than the threshold - for the queue, the queue is considered active and no - re reservation is done, it is important not to keep this - value too low */ - /* Packets sent during this interval */ - u16 packets_txed[UNIFI_NO_OF_TX_QS]; - u16 total_packets_txed; - - /* Number of packets to see if slots need to be reassigned */ - u16 packets_interval; - - /* Once a queue reaches a stable state, avoid processing */ - u8 queue_stable[UNIFI_NO_OF_TX_QS]; -} card_dynamic_slot_t; - - -/* These are type-safe and don't write incorrect values to the - * structure. */ - -/* Return queue slots used count - * params: - * const q_t *q - * returns: - * u16 - */ -#define CSR_WIFI_HIP_Q_SLOTS_USED(q) \ - (((q)->q_wr_ptr - (q)->q_rd_ptr < 0)? \ - ((q)->q_wr_ptr - (q)->q_rd_ptr + (q)->q_length) : ((q)->q_wr_ptr - (q)->q_rd_ptr)) - -/* Return queue slots free count - * params: - * const q_t *q - * returns: - * u16 - */ -#define CSR_WIFI_HIP_Q_SLOTS_FREE(q) \ - ((q)->q_length - CSR_WIFI_HIP_Q_SLOTS_USED((q)) - 1) - -/* Return slot signal data pointer - * params: - * const q_t *q - * u16 slot - * returns: - * card_signal_t * - */ -#define CSR_WIFI_HIP_Q_SLOT_DATA(q, slot) \ - ((q)->q_body + slot) - -/* Return queue next read slot - * params: - * const q_t *q - * returns: - * u16 slot offset - */ -#define CSR_WIFI_HIP_Q_NEXT_R_SLOT(q) \ - ((q)->q_rd_ptr) - -/* Return queue next write slot - * params: - * const q_t *q - * returns: - * u16 slot offset - */ -#define CSR_WIFI_HIP_Q_NEXT_W_SLOT(q) \ - ((q)->q_wr_ptr) - -/* Return updated queue pointer wrapped around its length - * params: - * const q_t *q - * u16 x amount to add to queue pointer - * returns: - * u16 wrapped queue pointer - */ -#define CSR_WIFI_HIP_Q_WRAP(q, x) \ - ((((x) >= (q)->q_length)?((x) % (q)->q_length) : (x))) - -/* Advance queue read pointer - * params: - * const q_t *q - */ -#define CSR_WIFI_HIP_Q_INC_R(q) \ - ((q)->q_rd_ptr = CSR_WIFI_HIP_Q_WRAP((q), (q)->q_rd_ptr + 1)) - -/* Advance queue write pointer - * params: - * const q_t *q - */ -#define CSR_WIFI_HIP_Q_INC_W(q) \ - ((q)->q_wr_ptr = CSR_WIFI_HIP_Q_WRAP((q), (q)->q_wr_ptr + 1)) - -enum unifi_host_state -{ - UNIFI_HOST_STATE_AWAKE = 0, - UNIFI_HOST_STATE_DROWSY = 1, - UNIFI_HOST_STATE_TORPID = 2 -}; - -typedef struct -{ - bulk_data_desc_t bd; - unifi_TrafficQueue queue; /* Used for dynamic slot reservation */ -} slot_desc_t; - -/* - * Structure describing a UniFi SDIO card. - */ -struct card -{ - /* - * Back pointer for the higher level OS code. This is passed as - * an argument to callbacks (e.g. for received data and indications). - */ - void *ospriv; - - /* - * mapping of HIP slot to MA-PACKET.req host tag, the - * array is indexed by slot numbers and each index stores - * information of the last host tag it was used for - */ - u32 *fh_slot_host_tag_record; - - - /* Info read from Symbol Table during probe */ - u32 build_id; - char build_id_string[128]; - - /* Retrieve from SDIO driver. */ - u16 chip_id; - - /* Read from GBL_CHIP_VERSION. */ - u16 chip_version; - - /* From the SDIO driver (probably 1) */ - u8 function; - - /* This is sused to get the register addresses and things. */ - ChipDescript *helper; - - /* - * Bit mask of PIOs for the loader to waggle during download. - * We assume these are connected to LEDs. The main firmware gets - * the mask from a MIB entry. - */ - s32 loader_led_mask; - - /* - * Support for flow control. When the from-host queue of signals - * is full, we ask the host upper layer to stop sending packets. When - * the queue drains we tell it that it can send packets again. - * We use this flag to remember the current state. - */ -#define card_is_tx_q_paused(card, q) (card->tx_q_paused_flag[q]) -#define card_tx_q_unpause(card, q) (card->tx_q_paused_flag[q] = 0) -#define card_tx_q_pause(card, q) (card->tx_q_paused_flag[q] = 1) - - u16 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX + 1 + UNIFI_NO_OF_TX_QS]; /* defensive more than big enough */ - - /* UDI callback for logging UniFi interactions */ - udi_func_t udi_hook; - - u8 bh_reason_host; - u8 bh_reason_unifi; - - /* SDIO clock speed request from OS layer */ - u8 request_max_clock; - - /* Last SDIO clock frequency set */ - u32 sdio_clock_speed; - - /* - * Current host state (copy of value in IOABORT register and - * spinlock to protect it. - */ - enum unifi_host_state host_state; - - enum unifi_low_power_mode low_power_mode; - enum unifi_periodic_wake_mode periodic_wake_mode; - - /* - * Ring buffer of signal structs for a queue of data packets from - * the host. - * The queue is empty when fh_data_q_num_rd == fh_data_q_num_wr. - * To add a packet to the queue, copy it to index given by - * (fh_data_q_num_wr%UNIFI_SOFT_Q_LENGTH) and advance fh_data_q_num_wr. - * To take a packet from the queue, copy data from index given by - * (fh_data_q_num_rd%UNIFI_SOFT_Q_LENGTH) and advance fh_data_q_num_rd. - * fh_data_q_num_rd and fh_data_q_num_rd are both modulo 256. - */ - card_signal_t fh_command_q_body[UNIFI_SOFT_COMMAND_Q_LENGTH]; - q_t fh_command_queue; - - card_signal_t fh_traffic_q_body[UNIFI_NO_OF_TX_QS][UNIFI_SOFT_TRAFFIC_Q_LENGTH]; - q_t fh_traffic_queue[UNIFI_NO_OF_TX_QS]; - - /* - * Signal counts from UniFi SDIO Control Data Structure. - * These are cached and synchronised with the UniFi before and after - * a batch of operations. - * - * These are the modulo-256 count of signals written to or read from UniFi - * The value is incremented for every signal. - */ - s32 from_host_signals_w; - s32 from_host_signals_r; - s32 to_host_signals_r; - s32 to_host_signals_w; - - - /* Should specify buffer size as a number of signals */ - /* - * Enough for 10 th and 10 fh data slots: - * 1 * 10 * 8 = 80 - * 2 * 10 * 8 = 160 - */ -#define UNIFI_FH_BUF_SIZE 1024 - struct sigbuf - { - u8 *buf; /* buffer area */ - u8 *ptr; /* current pos */ - u16 count; /* signal count */ - u16 bufsize; - } fh_buffer; - struct sigbuf th_buffer; - - - /* - * Field to use for the incrementing value to write to the UniFi - * SHARED_IO_INTERRUPT register. - * Flag to say we need to generate an interrupt at end of processing. - */ - u32 unifi_interrupt_seq; - u8 generate_interrupt; - - - /* Pointers to the bulk data slots */ - slot_desc_t *from_host_data; - bulk_data_desc_t *to_host_data; - - - /* - * Index of the next (hopefully) free data slot. - * This is an optimisation that starts searching at a more likely point - * than the beginning. - */ - s16 from_host_data_head; - - /* Dynamic slot allocation for queues */ - card_dynamic_slot_t dynamic_slot_data; - - /* - * SDIO specific fields - */ - - /* Interface pointer for the SDIO library */ - CsrSdioFunction *sdio_if; - - /* Copy of config_data struct from the card */ - sdio_config_data_t config_data; - - /* SDIO address of the Initialised flag and Control Data struct */ - u32 init_flag_addr; - u32 sdio_ctrl_addr; - - /* The last value written to the Shared Data Memory Page register */ - u32 proc_select; - u32 dmem_page; - u32 pmem_page; - - /* SDIO traffic counters limited to 32 bits for Synergy compatibility */ - u32 sdio_bytes_read; - u32 sdio_bytes_written; - - u8 memory_resources_allocated; - - /* UniFi SDIO I/O Block size. */ - u16 sdio_io_block_size; - - /* Pad transfer sizes to SDIO block boundaries */ - u8 sdio_io_block_pad; - - /* Read from the XBV */ - struct FWOV fwov; - -#ifndef CSR_WIFI_HIP_TA_DISABLE - /* TA sampling */ - ta_data_t ta_sampling; -#endif - - /* Auto-coredump */ - s16 request_coredump_on_reset; /* request coredump on next reset */ - struct coredump_buf *dump_buf; /* root node */ - struct coredump_buf *dump_next_write; /* node to fill at next dump */ - struct coredump_buf *dump_cur_read; /* valid node to read, or NULL */ - -#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE - struct cmd_profile - { - u32 cmd52_count; - u32 cmd53_count; - u32 tx_count; - u32 tx_cfm_count; - u32 rx_count; - u32 bh_count; - u32 process_count; - u32 protocol_count; - - u32 cmd52_f0_r_count; - u32 cmd52_f0_w_count; - u32 cmd52_r8or16_count; - u32 cmd52_w8or16_count; - u32 cmd52_r16_count; - u32 cmd52_w16_count; - u32 cmd52_r32_count; - - u32 sdio_cmd_signal; - u32 sdio_cmd_clear_slot; - u32 sdio_cmd_to_host; - u32 sdio_cmd_from_host; - u32 sdio_cmd_from_host_and_clear; - } hip_prof; - struct cmd_profile cmd_prof; -#endif - - /* Interrupt processing mode flags */ - u32 intmode; - -#ifdef UNIFI_DEBUG - u8 lsb; -#endif - - /* Historic firmware panic codes */ - u32 panic_data_phy_addr; - u32 panic_data_mac_addr; - u16 last_phy_panic_code; - u16 last_phy_panic_arg; - u16 last_mac_panic_code; - u16 last_mac_panic_arg; -#ifdef CSR_PRE_ALLOC_NET_DATA - bulk_data_desc_t bulk_data_desc_list[BULK_DATA_PRE_ALLOC_NUM]; - u16 prealloc_netdata_r; - u16 prealloc_netdata_w; -#endif -}; /* struct card */ - - -/* Reset types */ -enum unifi_reset_type -{ - UNIFI_COLD_RESET = 1, - UNIFI_WARM_RESET = 2 -}; - -/* - * unifi_set_host_state() implements signalling for waking UniFi from - * deep sleep. The host indicates to UniFi that it is in one of three states: - * Torpid - host has nothing to send, UniFi can go to sleep. - * Drowsy - host has data to send to UniFi. UniFi will respond with an - * SDIO interrupt. When hosts responds it moves to Awake. - * Awake - host has data to transfer, UniFi must stay awake. - * When host has finished, it moves to Torpid. - */ -CsrResult unifi_set_host_state(card_t *card, enum unifi_host_state state); - - -CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select select); -s32 card_read_signal_counts(card_t *card); -bulk_data_desc_t* card_find_data_slot(card_t *card, s16 slot); - - -CsrResult unifi_read32(card_t *card, u32 unifi_addr, u32 *pdata); -CsrResult unifi_readnz(card_t *card, u32 unifi_addr, - void *pdata, u16 len); -s32 unifi_read_shared_count(card_t *card, u32 addr); - -CsrResult unifi_writen(card_t *card, u32 unifi_addr, void *pdata, u16 len); - -CsrResult unifi_bulk_rw(card_t *card, u32 handle, - void *pdata, u32 len, s16 direction); -CsrResult unifi_bulk_rw_noretry(card_t *card, u32 handle, - void *pdata, u32 len, s16 direction); -#define UNIFI_SDIO_READ 0 -#define UNIFI_SDIO_WRITE 1 - -CsrResult unifi_read_8_or_16(card_t *card, u32 unifi_addr, u8 *pdata); -CsrResult unifi_write_8_or_16(card_t *card, u32 unifi_addr, u8 data); -CsrResult unifi_read_direct_8_or_16(card_t *card, u32 addr, u8 *pdata); -CsrResult unifi_write_direct_8_or_16(card_t *card, u32 addr, u8 data); - -CsrResult unifi_read_direct16(card_t *card, u32 addr, u16 *pdata); -CsrResult unifi_read_direct32(card_t *card, u32 addr, u32 *pdata); -CsrResult unifi_read_directn(card_t *card, u32 addr, void *pdata, u16 len); - -CsrResult unifi_write_direct16(card_t *card, u32 addr, u16 data); -CsrResult unifi_write_directn(card_t *card, u32 addr, void *pdata, u16 len); - -CsrResult sdio_read_f0(card_t *card, u32 addr, u8 *pdata); -CsrResult sdio_write_f0(card_t *card, u32 addr, u8 data); - -void unifi_read_panic(card_t *card); -#ifdef CSR_PRE_ALLOC_NET_DATA -void prealloc_netdata_free(card_t *card); -CsrResult prealloc_netdata_alloc(card_t *card); -#endif -/* For diagnostic use */ -void dump(void *mem, u16 len); -void dump16(void *mem, u16 len); - -#endif /* __CARD_SDIO_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c deleted file mode 100644 index cfe186e07071..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ /dev/null @@ -1,2595 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * FILE: csr_wifi_hip_card_sdio_intr.c - * - * PURPOSE: - * Interrupt processing for the UniFi SDIO driver. - * - * We may need another signal queue of responses to UniFi to hold - * bulk data commands generated by read_to_host_signals(). - * - * --------------------------------------------------------------------------- - */ -#undef CSR_WIFI_HIP_NOISY - -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_conversions.h" -#include "csr_wifi_hip_card.h" -#include "csr_wifi_hip_xbv.h" - - -/* - * If the SDIO link is idle for this time (in milliseconds), - * signal UniFi to go into Deep Sleep. - * Valid return value of unifi_bh(). - */ -#define UNIFI_DEFAULT_HOST_IDLE_TIMEOUT 5 -/* - * If the UniFi has not woken up for this time (in milliseconds), - * signal the bottom half to take action. - * Valid return value of unifi_bh(). - */ -#define UNIFI_DEFAULT_WAKE_TIMEOUT 1000 - - -static CsrResult process_bh(card_t *card); -static CsrResult handle_host_protocol(card_t *card, u8 *processed_something); - -static CsrResult flush_fh_buffer(card_t *card); - -static CsrResult check_fh_sig_slots(card_t *card, u16 needed, s32 *space); - -static CsrResult read_to_host_signals(card_t *card, s32 *processed); -static CsrResult process_to_host_signals(card_t *card, s32 *processed); - -static CsrResult process_bulk_data_command(card_t *card, - const u8 *cmdptr, - s16 cmd, u16 len); -static CsrResult process_clear_slot_command(card_t *card, - const u8 *cmdptr); -static CsrResult process_fh_cmd_queue(card_t *card, s32 *processed); -static CsrResult process_fh_traffic_queue(card_t *card, s32 *processed); -static void restart_packet_flow(card_t *card); -static CsrResult process_clock_request(card_t *card); - -#ifdef CSR_WIFI_HIP_NOISY -s16 dump_fh_buf = 0; -#endif /* CSR_WIFI_HIP_NOISY */ - -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE - -/* - * The unifi_debug_output buffer can be used to debug the HIP behaviour offline - * i.e. without using the tracing functions that change the timing. - * - * Call unifi_debug_log_to_buf() with printf arguments to store a string into - * unifi_debug_output. When unifi_debug_buf_dump() is called, the contents of the - * buffer are dumped with dump_str() which has to be implemented in the - * OS layer, during the porting exercise. The offset printed, holds the - * offset where the last character is (always a zero). - * - */ - -#define UNIFI_DEBUG_GBUFFER_SIZE 8192 -static char unifi_debug_output[UNIFI_DEBUG_GBUFFER_SIZE]; -static char *unifi_dbgbuf_ptr = unifi_debug_output; -static char *unifi_dbgbuf_start = unifi_debug_output; - -static void append_char(char c) -{ - /* write char and advance pointer */ - *unifi_dbgbuf_ptr++ = c; - /* wrap pointer at end of buffer */ - if ((unifi_dbgbuf_ptr - unifi_debug_output) >= UNIFI_DEBUG_GBUFFER_SIZE) - { - unifi_dbgbuf_ptr = unifi_debug_output; - } -} /* append_char() */ - - -void unifi_debug_string_to_buf(const char *str) -{ - const char *p = str; - while (*p) - { - append_char(*p); - p++; - } - /* Update start-of-buffer pointer */ - unifi_dbgbuf_start = unifi_dbgbuf_ptr + 1; - if ((unifi_dbgbuf_start - unifi_debug_output) >= UNIFI_DEBUG_GBUFFER_SIZE) - { - unifi_dbgbuf_start = unifi_debug_output; - } -} - - -void unifi_debug_log_to_buf(const char *fmt, ...) -{ -#define DEBUG_BUFFER_SIZE 80 - static char s[DEBUG_BUFFER_SIZE]; - va_list args; - - va_start(args, fmt); - vsnprintf(s, DEBUG_BUFFER_SIZE, fmt, args); - va_end(args); - - unifi_debug_string_to_buf(s); -} /* unifi_debug_log_to_buf() */ - - -/* Convert signed 32 bit (or less) integer to string */ -static void CsrUInt16ToHex(u16 number, char *str) -{ - u16 index; - u16 currentValue; - - for (index = 0; index < 4; index++) - { - currentValue = (u16) (number & 0x000F); - number >>= 4; - str[3 - index] = (char) (currentValue > 9 ? currentValue + 55 : currentValue + '0'); - } - str[4] = '\0'; -} - - -/* - * --------------------------------------------------------------------------- - * unifi_debug_hex_to_buf - * - * puts the contents of the passed buffer into the debug buffer as a hex string - * - * Arguments: - * buff buffer to print as hex - * length number of chars to print - * - * Returns: - * None. - * - * --------------------------------------------------------------------------- - */ -void unifi_debug_hex_to_buf(const char *buff, u16 length) -{ - char s[5]; - u16 i; - - for (i = 0; i < length; i = i + 2) - { - CsrUInt16ToHex(*((u16 *)(buff + i)), s); - unifi_debug_string_to_buf(s); - } -} - - -void unifi_debug_buf_dump(void) -{ - s32 offset = unifi_dbgbuf_ptr - unifi_debug_output; - - unifi_error(NULL, "HIP debug buffer offset=%d\n", offset); - dump_str(unifi_debug_output + offset, UNIFI_DEBUG_GBUFFER_SIZE - offset); - dump_str(unifi_debug_output, offset); -} /* unifi_debug_buf_dump() */ - - -#endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */ - -#ifdef CSR_PRE_ALLOC_NET_DATA -#define NETDATA_PRE_ALLOC_BUF_SIZE 8000 - -void prealloc_netdata_free(card_t *card) -{ - unifi_warning(card->ospriv, "prealloc_netdata_free: IN: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r); - - while (card->bulk_data_desc_list[card->prealloc_netdata_r].data_length != 0) - { - unifi_warning(card->ospriv, "prealloc_netdata_free: r=%d\n", card->prealloc_netdata_r); - - unifi_net_data_free(card->ospriv, &card->bulk_data_desc_list[card->prealloc_netdata_r]); - card->prealloc_netdata_r++; - card->prealloc_netdata_r %= BULK_DATA_PRE_ALLOC_NUM; - } - card->prealloc_netdata_r = card->prealloc_netdata_w = 0; - - unifi_warning(card->ospriv, "prealloc_netdata_free: OUT: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r); -} - - -CsrResult prealloc_netdata_alloc(card_t *card) -{ - CsrResult r; - - unifi_trace(card->ospriv, UDBG5, "prealloc_netdata_alloc: IN: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r); - - while (card->bulk_data_desc_list[card->prealloc_netdata_w].data_length == 0) - { - r = unifi_net_data_malloc(card->ospriv, &card->bulk_data_desc_list[card->prealloc_netdata_w], NETDATA_PRE_ALLOC_BUF_SIZE); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "prealloc_netdata_alloc: Failed to allocate t-h bulk data\n"); - return CSR_RESULT_FAILURE; - } - card->prealloc_netdata_w++; - card->prealloc_netdata_w %= BULK_DATA_PRE_ALLOC_NUM; - } - unifi_trace(card->ospriv, UDBG5, "prealloc_netdata_alloc: OUT: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r); - - return CSR_RESULT_SUCCESS; -} - - -static CsrResult prealloc_netdata_get(card_t *card, bulk_data_desc_t *bulk_data_slot, u32 size) -{ - CsrResult r; - - unifi_trace(card->ospriv, UDBG5, "prealloc_netdata_get: IN: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r); - - if (card->bulk_data_desc_list[card->prealloc_netdata_r].data_length == 0) - { - unifi_error(card->ospriv, "prealloc_netdata_get: data_length = 0\n"); - } - - if ((size > NETDATA_PRE_ALLOC_BUF_SIZE) || (card->bulk_data_desc_list[card->prealloc_netdata_r].data_length == 0)) - { - unifi_warning(card->ospriv, "prealloc_netdata_get: Calling net_data_malloc\n"); - - r = unifi_net_data_malloc(card->ospriv, bulk_data_slot, size); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "prealloc_netdata_get: Failed to allocate t-h bulk data\n"); - return CSR_RESULT_FAILURE; - } - return CSR_RESULT_SUCCESS; - } - - *bulk_data_slot = card->bulk_data_desc_list[card->prealloc_netdata_r]; - card->bulk_data_desc_list[card->prealloc_netdata_r].os_data_ptr = NULL; - card->bulk_data_desc_list[card->prealloc_netdata_r].os_net_buf_ptr = NULL; - card->bulk_data_desc_list[card->prealloc_netdata_r].net_buf_length = 0; - card->bulk_data_desc_list[card->prealloc_netdata_r].data_length = 0; - - card->prealloc_netdata_r++; - card->prealloc_netdata_r %= BULK_DATA_PRE_ALLOC_NUM; - - unifi_trace(card->ospriv, UDBG5, "prealloc_netdata_get: OUT: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r); - - return CSR_RESULT_SUCCESS; -} - - -#endif - -/* - * --------------------------------------------------------------------------- - * unifi_sdio_interrupt_handler - * - * This function should be called by the OS-dependent code to handle - * an SDIO interrupt from the UniFi. - * - * Arguments: - * card Pointer to card context structure. - * - * Returns: - * None. - * - * Notes: This function may be called in DRS context. In this case, - * tracing with the unifi_trace(), etc, is not allowed. - * --------------------------------------------------------------------------- - */ -void unifi_sdio_interrupt_handler(card_t *card) -{ - /* - * Set the flag to say reason for waking was SDIO interrupt. - * Then ask the OS layer to run the unifi_bh to give attention to the UniFi. - */ - card->bh_reason_unifi = 1; - (void)unifi_run_bh(card->ospriv); -} /* sdio_interrupt_handler() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_configure_low_power_mode - * - * This function should be called by the OS-dependent when - * the deep sleep signaling needs to be enabled or disabled. - * - * Arguments: - * card Pointer to card context structure. - * low_power_mode Disable/Enable the deep sleep signaling - * periodic_wake_mode UniFi wakes host periodically. - * - * Returns: - * CSR_RESULT_SUCCESS on success or a CSR error code. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_configure_low_power_mode(card_t *card, - enum unifi_low_power_mode low_power_mode, - enum unifi_periodic_wake_mode periodic_wake_mode) -{ - card->low_power_mode = low_power_mode; - card->periodic_wake_mode = periodic_wake_mode; - - unifi_trace(card->ospriv, UDBG1, - "unifi_configure_low_power_mode: new mode = %s, wake_host = %s\n", - (low_power_mode == UNIFI_LOW_POWER_DISABLED)?"disabled" : "enabled", - (periodic_wake_mode == UNIFI_PERIODIC_WAKE_HOST_DISABLED)?"FALSE" : "TRUE"); - - (void)unifi_run_bh(card->ospriv); - return CSR_RESULT_SUCCESS; -} /* unifi_configure_low_power_mode() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_force_low_power_mode - * - * This function should be called by the OS-dependent when - * UniFi needs to be set to the low power mode (e.g. on suspend) - * - * Arguments: - * card Pointer to card context structure. - * - * Returns: - * CSR_RESULT_SUCCESS on success or a CSR error code. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_force_low_power_mode(card_t *card) -{ - if (card->low_power_mode == UNIFI_LOW_POWER_DISABLED) - { - unifi_error(card->ospriv, "Attempt to set mode to TORPID when lower power mode is disabled\n"); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - return unifi_set_host_state(card, UNIFI_HOST_STATE_TORPID); -} /* unifi_force_low_power_mode() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_bh - * - * This function should be called by the OS-dependent code when - * host and/or UniFi has requested an exchange of messages. - * - * Arguments: - * card Pointer to card context structure. - * - * Returns: - * CSR_RESULT_SUCCESS on success or a CSR error code. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_bh(card_t *card, u32 *remaining) -{ - CsrResult r; - CsrResult csrResult; - u8 pending; - s32 iostate, j; - const enum unifi_low_power_mode low_power_mode = card->low_power_mode; - u16 data_slots_used = 0; - - - /* Process request to raise the maximum SDIO clock */ - r = process_clock_request(card); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Error setting maximum SDIO clock\n"); - goto exit; - } - - /* - * Why was the BH thread woken? - * If it was an SDIO interrupt, UniFi is awake and we need to process it. - * If it was a host process queueing data, then we need to awaken UniFi. - * - * Priority of flags is top down. - * - * ----------------------------------------------------------+ - * \state| AWAKE | DROWSY | TORPID | - * flag\ | | | | - * ---------+--------------+----------------+----------------| - * | do the host | go to AWAKE and| go to AWAKE and| - * unifi | protocol | do the host | do the host | - * | | protocol | protocol | - * ---------+--------------+----------------+----------------| - * | do the host | | | - * host | protocol | do nothing | go to DROWSY | - * | | | | - * ---------+--------------+----------------+----------------| - * | | | should not | - * timeout | go to TORPID | error, unifi | occur | - * | | didn't wake up | do nothing | - * ----------------------------------------------------------+ - * - * Note that if we end up in the AWAKE state we always do the host protocol. - */ - - do - { - /* - * When the host state is set to DROWSY, then we can not disable the - * interrupts as UniFi can generate an interrupt even when the INT_ENABLE - * register has the interrupts disabled. This interrupt will be lost. - */ - if (card->host_state == UNIFI_HOST_STATE_DROWSY || card->host_state == UNIFI_HOST_STATE_TORPID) - { - u8 reason_unifi; - - /* - * An interrupt may occur while or after we cache the reason. - * This interrupt will cause the unifi_bh() to be scheduled again. - * Any interrupt that has happened before the register is read - * and is considered spurious has to acknowledged. - */ - reason_unifi = card->bh_reason_unifi; - - /* - * If an interrupt is received, check if it was a real one, - * set the host state to AWAKE and run the BH. - */ - r = CardPendingInt(card, &pending); - if (r != CSR_RESULT_SUCCESS) - { - goto exit; - } - - if (pending) - { - unifi_trace(card->ospriv, UDBG5, - "UNIFI_HOST_STATE_%s: Set state to AWAKE.\n", - (card->host_state == UNIFI_HOST_STATE_TORPID)?"TORPID" : "DROWSY"); - - r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); - if (r == CSR_RESULT_SUCCESS) - { - (*remaining) = 0; - break; - } - } - else if (reason_unifi) - { - CsrSdioInterruptAcknowledge(card->sdio_if); - } - - /* - * If an chip is in TORPID, and the host wants to wake it up, - * set the host state to DROWSY and wait for the wake-up interrupt. - */ - if ((card->host_state == UNIFI_HOST_STATE_TORPID) && card->bh_reason_host) - { - r = unifi_set_host_state(card, UNIFI_HOST_STATE_DROWSY); - if (r == CSR_RESULT_SUCCESS) - { - /* - * set the timeout value to UNIFI_DEFAULT_WAKE_TIMEOUT - * to capture a wake error. - */ - card->bh_reason_host = 0; - (*remaining) = UNIFI_DEFAULT_WAKE_TIMEOUT; - return CSR_RESULT_SUCCESS; - } - - goto exit; - } - - /* - * If the chip is in DROWSY, and the timeout expires, - * we need to reset the chip. This should never occur. - * (If it does, check that the calling thread set "remaining" - * according to the time remaining when unifi_bh() was called). - */ - if ((card->host_state == UNIFI_HOST_STATE_DROWSY) && ((*remaining) == 0)) - { - unifi_error(card->ospriv, "UniFi did not wake up on time...\n"); - - /* - * Check if Function1 has gone away or - * if we missed an SDIO interrupt. - */ - r = unifi_check_io_status(card, &iostate); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - goto exit; - } - /* Need to reset and reboot */ - return CSR_RESULT_FAILURE; - } - } - else - { - if (card->bh_reason_unifi || card->bh_reason_host) - { - break; - } - - if (((*remaining) == 0) && (low_power_mode == UNIFI_LOW_POWER_ENABLED)) - { - r = unifi_set_host_state(card, UNIFI_HOST_STATE_TORPID); - if (r == CSR_RESULT_SUCCESS) - { - (*remaining) = 0; - return CSR_RESULT_SUCCESS; - } - - goto exit; - } - } - - /* No need to run the host protocol */ - return CSR_RESULT_SUCCESS; - } while (0); - - - /* Disable the SDIO interrupts while doing SDIO ops */ - csrResult = CsrSdioInterruptDisable(card->sdio_if); - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - r = CSR_WIFI_HIP_RESULT_NO_DEVICE; - goto exit; - } - if (csrResult != CSR_RESULT_SUCCESS) - { - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - unifi_error(card->ospriv, "Failed to disable SDIO interrupts. unifi_bh queues error.\n"); - goto exit; - } - - /* Now that the interrupts are disabled, ack the interrupt */ - CsrSdioInterruptAcknowledge(card->sdio_if); - - /* Run the HIP */ - r = process_bh(card); - if (r != CSR_RESULT_SUCCESS) - { - goto exit; - } - - /* - * If host is now idle, schedule a timer for the delay before we - * let UniFi go into deep sleep. - * If the timer goes off, we will move to TORPID state. - * If UniFi raises an interrupt in the meantime, we will cancel - * the timer and start a new one when we become idle. - */ - for (j = 0; j < UNIFI_NO_OF_TX_QS; j++) - { - data_slots_used += CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[j]); - } - - if ((low_power_mode == UNIFI_LOW_POWER_ENABLED) && (data_slots_used == 0)) - { -#ifndef CSR_WIFI_HIP_TA_DISABLE - if (card->ta_sampling.traffic_type != CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_PERIODIC) - { -#endif - /* return the UNIFI_DEFAULT_HOST_IDLE_TIMEOUT, so we can go to sleep. */ - unifi_trace(card->ospriv, UDBG5, - "Traffic is not periodic, set timer for TORPID.\n"); - (*remaining) = UNIFI_DEFAULT_HOST_IDLE_TIMEOUT; -#ifndef CSR_WIFI_HIP_TA_DISABLE - } - else - { - unifi_trace(card->ospriv, UDBG5, - "Traffic is periodic, set unifi to TORPID immediately.\n"); - if (CardAreAllFromHostDataSlotsEmpty(card) == 1) - { - r = unifi_set_host_state(card, UNIFI_HOST_STATE_TORPID); - if (r != CSR_RESULT_SUCCESS) - { - goto exit; - } - } - } -#endif - } - - csrResult = CsrSdioInterruptEnable(card->sdio_if); - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - r = CSR_WIFI_HIP_RESULT_NO_DEVICE; - } - if (csrResult != CSR_RESULT_SUCCESS) - { - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - unifi_error(card->ospriv, "Failed to enable SDIO interrupt\n"); - } - -exit: - - unifi_trace(card->ospriv, UDBG4, "New state=%d\n", card->host_state); - - if (r != CSR_RESULT_SUCCESS) - { -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - unifi_debug_buf_dump(); -#endif - /* If an interrupt has been raised, ack it here */ - if (card->bh_reason_unifi) - { - CsrSdioInterruptAcknowledge(card->sdio_if); - } - - unifi_error(card->ospriv, - "unifi_bh: state=%d %c, clock=%dkHz, interrupt=%d host=%d, power_save=%s\n", - card->host_state, - (card->host_state == UNIFI_HOST_STATE_AWAKE)?'A' : (card->host_state == UNIFI_HOST_STATE_DROWSY)?'D' : 'T', - card->sdio_clock_speed / 1000, - card->bh_reason_unifi, card->bh_reason_host, - (low_power_mode == UNIFI_LOW_POWER_DISABLED)?"disabled" : "enabled"); - - /* Try to capture firmware panic codes */ - (void)unifi_capture_panic(card); - - /* Ask for a mini-coredump when the driver has reset UniFi */ - (void)unifi_coredump_request_at_next_reset(card, 1); - } - - return r; -} /* unifi_bh() */ - - -/* - * --------------------------------------------------------------------------- - * process_clock_request - * - * Handle request from the OS layer to increase the SDIO clock speed. - * The fast clock is limited until the firmware has indicated that it has - * completed initialisation to the OS layer. - * - * Arguments: - * card Pointer to card context structure. - * - * Returns: - * CSR_RESULT_SUCCESS on success or CSR error code. - * --------------------------------------------------------------------------- - */ -static CsrResult process_clock_request(card_t *card) -{ - CsrResult r = CSR_RESULT_SUCCESS; - CsrResult csrResult; - - if (!card->request_max_clock) - { - return CSR_RESULT_SUCCESS; /* No pending request */ - } - - /* - * The SDIO clock speed request from the OS layer is only acted upon if - * the UniFi is awake. If it was in any other state, the clock speed will - * transition through SAFE to MAX while the host wakes it up, and the - * final speed reached will be UNIFI_SDIO_CLOCK_MAX_HZ. - * This assumes that the SME never requests low power mode while the f/w - * initialisation takes place. - */ - if (card->host_state == UNIFI_HOST_STATE_AWAKE) - { - unifi_trace(card->ospriv, UDBG1, "Set SDIO max clock\n"); - csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_MAX_HZ); - if (csrResult != CSR_RESULT_SUCCESS) - { - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - } - else - { - card->sdio_clock_speed = UNIFI_SDIO_CLOCK_MAX_HZ; /* log the new freq */ - } - } - else - { - unifi_trace(card->ospriv, UDBG1, "Will set SDIO max clock after wakeup\n"); - } - - /* Cancel the request now that it has been acted upon, or is about to be - * by the wakeup mechanism - */ - card->request_max_clock = 0; - - return r; -} - - -/* - * --------------------------------------------------------------------------- - * process_bh - * - * Exchange messages with UniFi - * - * Arguments: - * card Pointer to card context structure. - * - * Returns: - * CSR_RESULT_SUCCESS on success or CSR error code. - * --------------------------------------------------------------------------- - */ -static CsrResult process_bh(card_t *card) -{ - CsrResult r; - u8 more; - more = FALSE; - - /* Process the reasons (interrupt, signals) */ - do - { - /* - * Run in a while loop, to save clearing the interrupts - * every time around the outside loop. - */ - do - { - /* If configured to run the HIP just once, skip first loop */ - if (card->intmode & CSR_WIFI_INTMODE_RUN_BH_ONCE) - { - break; - } - - r = handle_host_protocol(card, &more); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - unifi_debug_log_to_buf("c52=%d c53=%d tx=%d txc=%d rx=%d s=%d t=%d fc=%d\n", - card->cmd_prof.cmd52_count, - card->cmd_prof.cmd53_count, - card->cmd_prof.tx_count, - card->cmd_prof.tx_cfm_count, - card->cmd_prof.rx_count, - card->cmd_prof.sdio_cmd_signal, - card->cmd_prof.sdio_cmd_to_host, - card->cmd_prof.sdio_cmd_from_host_and_clear - ); - - card->cmd_prof.cmd52_count = card->cmd_prof.cmd53_count = 0; - card->cmd_prof.tx_count = card->cmd_prof.tx_cfm_count = card->cmd_prof.rx_count = 0; - - card->cmd_prof.cmd52_f0_r_count = 0; - card->cmd_prof.cmd52_f0_w_count = 0; - card->cmd_prof.cmd52_r8or16_count = 0; - card->cmd_prof.cmd52_w8or16_count = 0; - card->cmd_prof.cmd52_r16_count = 0; - card->cmd_prof.cmd52_w16_count = 0; - card->cmd_prof.cmd52_r32_count = 0; - - card->cmd_prof.sdio_cmd_signal = 0; - card->cmd_prof.sdio_cmd_clear_slot = 0; - card->cmd_prof.sdio_cmd_to_host = 0; - card->cmd_prof.sdio_cmd_from_host = 0; - card->cmd_prof.sdio_cmd_from_host_and_clear = 0; -#endif - - - } while (more || card->bh_reason_unifi || card->bh_reason_host); - - /* Acknowledge the h/w interrupt */ - r = CardClearInt(card); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to acknowledge interrupt.\n"); - return r; - } - - /* - * UniFi may have tried to generate an interrupt during the - * CardClearInt() was running. So, we need to run the host - * protocol again, to check if there are any pending requests. - */ - r = handle_host_protocol(card, &more); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - unifi_debug_log_to_buf("c52=%d c53=%d tx=%d txc=%d rx=%d s=%d t=%d fc=%d\n", - card->cmd_prof.cmd52_count, - card->cmd_prof.cmd53_count, - card->cmd_prof.tx_count, - card->cmd_prof.tx_cfm_count, - card->cmd_prof.rx_count, - card->cmd_prof.sdio_cmd_signal, - card->cmd_prof.sdio_cmd_to_host, - card->cmd_prof.sdio_cmd_from_host_and_clear - ); - - card->cmd_prof.cmd52_count = card->cmd_prof.cmd53_count = 0; - card->cmd_prof.tx_count = card->cmd_prof.tx_cfm_count = card->cmd_prof.rx_count = 0; - - card->cmd_prof.cmd52_f0_r_count = 0; - card->cmd_prof.cmd52_f0_w_count = 0; - card->cmd_prof.cmd52_r8or16_count = 0; - card->cmd_prof.cmd52_w8or16_count = 0; - card->cmd_prof.cmd52_r16_count = 0; - card->cmd_prof.cmd52_w16_count = 0; - card->cmd_prof.cmd52_r32_count = 0; - - card->cmd_prof.sdio_cmd_signal = 0; - card->cmd_prof.sdio_cmd_clear_slot = 0; - card->cmd_prof.sdio_cmd_to_host = 0; - card->cmd_prof.sdio_cmd_from_host = 0; - card->cmd_prof.sdio_cmd_from_host_and_clear = 0; -#endif - /* If configured to run the HIP just once, work is now done */ - if (card->intmode & CSR_WIFI_INTMODE_RUN_BH_ONCE) - { - break; - } - - } while (more || card->bh_reason_unifi || card->bh_reason_host); - -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - if ((card->intmode & CSR_WIFI_INTMODE_RUN_BH_ONCE) == 0) - { - unifi_debug_log_to_buf("proc=%d\n", - card->cmd_prof.process_count); - } -#endif - - return CSR_RESULT_SUCCESS; -} /* process_bh() */ - - -/* - * --------------------------------------------------------------------------- - * handle_host_protocol - * - * This function implements the Host Interface Protocol (HIP) as - * described in the Host Interface Protocol Specification. - * - * Arguments: - * card Pointer to card context structure. - * processed_something Pointer to location to update processing status: - * TRUE when data was transferred - * FALSE when no data was transferred (queues empty) - * - * Returns: - * CSR_RESULT_SUCCESS on success or CSR error code. - * --------------------------------------------------------------------------- - */ -static CsrResult handle_host_protocol(card_t *card, u8 *processed_something) -{ - CsrResult r; - s32 done; - - *processed_something = FALSE; - -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, " ======================== \n"); -#endif /* CSR_WIFI_HIP_NOISY */ - -#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE - card->cmd_prof.process_count++; -#endif - - card->bh_reason_unifi = card->bh_reason_host = 0; - card->generate_interrupt = 0; - - - /* - * (Re)fill the T-H signal buffer - */ - r = read_to_host_signals(card, &done); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Error occurred reading to-host signals\n"); - return r; - } - if (done > 0) - { - *processed_something = TRUE; - } - - /* - * Process any to-host signals. - * Perform any requested CMD53 transfers here, but just queue any - * bulk data command responses. - */ - r = process_to_host_signals(card, &done); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Error occurred processing to-host signals\n"); - return r; - } - - /* Now send any signals in the F-H queues */ - /* Give precedence to the command queue */ - r = process_fh_cmd_queue(card, &done); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Error occurred processing from-host signals\n"); - return r; - } - if (done > 0) - { - *processed_something = TRUE; - } - - r = process_fh_traffic_queue(card, &done); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Error occurred processing from-host data signals\n"); - return r; - } - if (done > 0) - { - *processed_something = TRUE; - } - - /* Flush out the batch of signals to the UniFi. */ - r = flush_fh_buffer(card); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to copy from-host signals to UniFi\n"); - return r; - } - - - /* - * Send the host interrupt to say the queues have been modified. - */ - if (card->generate_interrupt) - { - r = CardGenInt(card); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to notify UniFi that queues have been modified.\n"); - return r; - } - } - -#ifdef CSR_WIFI_RX_PATH_SPLIT -#ifdef CSR_WIFI_RX_PATH_SPLIT_DONT_USE_WQ - unifi_rx_queue_flush(card->ospriv); -#endif -#endif - - /* See if we can re-enable transmission now */ - restart_packet_flow(card); - -#ifdef CSR_PRE_ALLOC_NET_DATA - r = prealloc_netdata_alloc(card); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "prealloc_netdata failed\n"); - return r; - } -#endif - - /* - * Don't put the thread sleep if we just interacted with the chip, - * there might be more to do if we look again. - */ - return r; -} /* handle_host_protocol() */ - - -/* - * Rounds the given signal length in bytes to a whole number - * of sig_frag_size. - */ -#define GET_CHUNKS_FOR(SIG_FRAG_SIZE, LENGTH) (((LENGTH) + ((SIG_FRAG_SIZE)-1)) / (SIG_FRAG_SIZE)) - - -/* - * --------------------------------------------------------------------------- - * read_to_host_signals - * - * Read everything pending in the UniFi TH signal buffer. - * Only do it if the local buffer is empty. - * - * Arguments: - * card Pointer to card context struct - * processed Number of signals read: - * 0 if there were no signals pending, - * 1 if we read at least one signal - * Returns: - * CSR error code if an error occurred. - * --------------------------------------------------------------------------- - */ -static CsrResult read_to_host_signals(card_t *card, s32 *processed) -{ - s32 count_thw, count_thr; - s32 unread_chunks, unread_bytes; - CsrResult r; - - *processed = 0; - - /* Read any pending signals or bulk data commands */ - count_thw = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4); - if (count_thw < 0) - { - unifi_error(card->ospriv, "Failed to read to-host sig written count\n"); - return CSR_RESULT_FAILURE; - } - card->to_host_signals_w = count_thw; /* diag */ - - count_thr = card->to_host_signals_r; - - if (count_thw == count_thr) - { - return CSR_RESULT_SUCCESS; - } - - unread_chunks = - (((count_thw - count_thr) + 128) % 128) - card->th_buffer.count; - - if (unread_chunks == 0) - { - return CSR_RESULT_SUCCESS; - } - - unread_bytes = card->config_data.sig_frag_size * unread_chunks; - - - r = unifi_bulk_rw(card, - card->config_data.tohost_sigbuf_handle, - card->th_buffer.ptr, - unread_bytes, - UNIFI_SDIO_READ); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read ToHost signal\n"); - return r; - } - - card->th_buffer.ptr += unread_bytes; - card->th_buffer.count += (u16)unread_chunks; - - *processed = 1; - - return CSR_RESULT_SUCCESS; -} /* read_to_host_signals() */ - - -/* - * --------------------------------------------------------------------------- - * update_to_host_signals_r - * - * Advance the shared-memory count of chunks read from the to-host - * signal buffer. - * Raise a UniFi internal interrupt to tell the firmware that the - * count has changed. - * - * Arguments: - * card Pointer to card context struct - * pending Number of chunks remaining - * - * Returns: - * CSR_RESULT_SUCCESS on success or CSR error code - * --------------------------------------------------------------------------- - */ -static CsrResult update_to_host_signals_r(card_t *card, s16 pending) -{ - CsrResult r; - - card->to_host_signals_r = - (card->to_host_signals_r + (card->th_buffer.count - pending)) % 128; - card->th_buffer.count = pending; - - /* Update the count of signals read */ - r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 6, - (u8)card->to_host_signals_r); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to update to-host signals read\n"); - return r; - } - - r = CardGenInt(card); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to notify UniFi that we processed to-host signals.\n"); - return r; - } - - card->generate_interrupt = 0; - - return CSR_RESULT_SUCCESS; -} /* update_to_host_signals_r() */ - - -/* - * --------------------------------------------------------------------------- - * read_unpack_cmd - * - * Converts a wire-formatted command to the host bulk_data_cmd_t structure. - * - * Arguments: - * ptr Pointer to the command - * bulk_data_cmd Pointer to the host structure - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void read_unpack_cmd(const u8 *ptr, bulk_data_cmd_t *bulk_data_cmd) -{ - s16 index = 0; - bulk_data_cmd->cmd_and_len = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - bulk_data_cmd->data_slot = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - bulk_data_cmd->offset = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - bulk_data_cmd->buffer_handle = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; -} /* read_unpack_cmd */ - - -/* - * --------------------------------------------------------------------------- - * process_to_host_signals - * - * Read and dispatch signals from the UniFi - * - * Arguments: - * card Pointer to card context struct - * processed Pointer to location to write processing result: - * 0 if there were no signals pending, - * 1 if we read at least one signal - * - * Returns: - * CSR error code if there was an error - * - * Notes: - * Since bulk data transfers can take a long time, if we wait until - * all are done before we acknowledge the signals, the UniFi runs out - * of buffer space. Therefore we keep a count of the bytes transferred - * in bulk data commands, and update the to-host-signals-read count - * if we've done a large transfer. - * - * All data in the f/w is stored in a little endian format, without any - * padding bytes. Every read from the memory has to be transformed in - * host (cpu specific) format, before we can process it. Therefore we - * use read_unpack_cmd() and read_unpack_signal() to convert the raw data - * contained in the card->th_buffer.buf to host structures. - * Important: UDI clients use wire-formatted structures, so we need to - * indicate all data, as we have read it from the device. - * --------------------------------------------------------------------------- - */ -static CsrResult process_to_host_signals(card_t *card, s32 *processed) -{ - s16 pending; - s16 remaining; - u8 *bufptr; - bulk_data_param_t data_ptrs; - s16 cmd; - u16 sig_len; - s16 i; - u16 chunks_in_buf; - u16 bytes_transferred = 0; - CsrResult r = CSR_RESULT_SUCCESS; - - *processed = 0; - - pending = card->th_buffer.count; - - /* Are there new to-host signals? */ - unifi_trace(card->ospriv, UDBG4, "handling %d to-host chunks\n", pending); - - if (!pending) - { - return CSR_RESULT_SUCCESS; - } - - /* - * This is a pointer to the raw data we have read from the f/w. - * Can be a signal or a command. Note that we need to convert - * it to a host structure before we process it. - */ - bufptr = card->th_buffer.buf; - - while (pending > 0) - { - s16 f_flush_count = 0; - - /* - * Command and length are common to signal and bulk data msgs. - * If command == 0 (i.e. a signal), len is number of bytes - * *following* the 2-byte header. - */ - cmd = bufptr[1] >> 4; - sig_len = bufptr[0] + ((bufptr[1] & 0x0F) << 8); - -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, "Received UniFi msg cmd=%d, len=%d\n", - cmd, sig_len); -#endif /* CSR_WIFI_HIP_NOISY */ - - if ((sig_len == 0) && - ((cmd != SDIO_CMD_CLEAR_SLOT) && (cmd != SDIO_CMD_PADDING))) - { - unifi_error(card->ospriv, "incomplete signal or command: has size zero\n"); - return CSR_RESULT_FAILURE; - } - /* - * Make sure the buffer contains a complete message. - * Signals may occupy multiple chunks, bulk-data commands occupy - * one chunk. - */ - if (cmd == SDIO_CMD_SIGNAL) - { - chunks_in_buf = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(sig_len + 2)); - } - else - { - chunks_in_buf = 1; - } - - if (chunks_in_buf > (u16)pending) - { - unifi_error(card->ospriv, "incomplete signal (0x%x?): need %d chunks, got %d\n", - GET_SIGNAL_ID(bufptr + 2), - chunks_in_buf, pending); - unifi_error(card->ospriv, " thsw=%d, thsr=%d\n", - card->to_host_signals_w, - card->to_host_signals_r); - return CSR_RESULT_FAILURE; - } - - - switch (cmd) - { - case SDIO_CMD_SIGNAL: - /* This is a signal. Read the rest of it and then handle it. */ -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - card->cmd_prof.sdio_cmd_signal++; -#endif - - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) - { - /* Retrieve dataRefs[i].DataLength */ - u16 data_len = GET_PACKED_DATAREF_LEN(bufptr + 2, i); - - /* - * The bulk data length in the signal can not be greater than - * the maximun length allowed by the SDIO config structure. - */ - if (data_len > card->config_data.data_slot_size) - { - unifi_error(card->ospriv, - "Bulk Data length (%d) exceeds Maximum Bulk Data length (%d)\n", - data_len, card->config_data.data_slot_size); - return CSR_RESULT_FAILURE; - } - - /* - * Len here might not be the same as the length in the - * bulk data slot. The slot length will always be even, - * but len could be odd. - */ - if (data_len != 0) - { - /* Retrieve dataRefs[i].SlotNumber */ - s16 slot = GET_PACKED_DATAREF_SLOT(bufptr + 2, i); - - if (slot >= card->config_data.num_tohost_data_slots) - { - unifi_error(card->ospriv, "!!!bad slot number in to-host signal: %d, sig 0x%X\n", - slot, cmd); - return CSR_RESULT_FAILURE; - } - - data_ptrs.d[i].os_data_ptr = card->to_host_data[slot].os_data_ptr; - data_ptrs.d[i].os_net_buf_ptr = card->to_host_data[slot].os_net_buf_ptr; - data_ptrs.d[i].net_buf_length = card->to_host_data[slot].net_buf_length; - data_ptrs.d[i].data_length = data_len; - } - else - { - UNIFI_INIT_BULK_DATA(&data_ptrs.d[i]); - } - } - - /* - * Log the signal to the UDI, before call unifi_receive_event() as - * it can modify the bulk data. - */ - if (card->udi_hook) - { - (*card->udi_hook)(card->ospriv, bufptr + 2, sig_len, - &data_ptrs, UDI_LOG_TO_HOST); - } - -#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE - if (GET_SIGNAL_ID(bufptr + 2) == CSR_MA_PACKET_CONFIRM_ID) - { - card->cmd_prof.tx_cfm_count++; - } - else if (GET_SIGNAL_ID(bufptr + 2) == CSR_MA_PACKET_INDICATION_ID) - { - if (data_ptrs.d[0].os_data_ptr) - { - if ((*data_ptrs.d[0].os_data_ptr) & 0x08) - { - card->cmd_prof.rx_count++; - } - } - } -#endif - /* - * Check if the signal is MA-PACKET.cfm and if so check the status. - * If the status is failure, search through the slot records to find - * if any slots are occupied for this host tag. This can happen if - * f/w has not downloaded the bulkdata and before that itself it has - * signalled the confirm with failure. If it finds a slot with that - * host tag then, it clears the corresponding slot - */ - - if (GET_SIGNAL_ID(bufptr + 2) == CSR_MA_PACKET_CONFIRM_ID) - { - /* Get host tag and transmission status */ - u32 host_tag = GET_PACKED_MA_PACKET_CONFIRM_HOST_TAG(bufptr + 2); - u16 status = GET_PACKED_MA_PACKET_CONFIRM_TRANSMISSION_STATUS(bufptr + 2); - - unifi_trace(card->ospriv, UDBG4, "process_to_host_signals signal ID=%x host Tag=%x status=%x\n", - GET_SIGNAL_ID(bufptr + 2), host_tag, status); - - /* If transmission status is failure then search through the slot records - * and if for any slot records the clear slot is not done then do it now - */ - - if (status && (card->fh_slot_host_tag_record)) - { - u16 num_fh_slots = card->config_data.num_fromhost_data_slots; - - /* search through the list of slot records and match with host tag - * If a slot is not yet cleared then clear the slot from here - */ - for (i = 0; i < num_fh_slots; i++) - { - if (card->fh_slot_host_tag_record[i] == host_tag) - { -#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL - /* Invoke the HAL module function to requeue it back to HAL Queues */ - r = unifi_reque_ma_packet_request(card->ospriv, host_tag, status, &card->from_host_data[i].bd); - card->fh_slot_host_tag_record[i] = CSR_WIFI_HIP_RESERVED_HOST_TAG; - if (CSR_RESULT_SUCCESS != r) - { - unifi_trace(card->ospriv, UDBG5, "process_to_host_signals: Failed to requeue Packet(hTag:%x) back to HAL \n", host_tag); - CardClearFromHostDataSlot(card, i); - } - else - { - CardClearFromHostDataSlotWithoutFreeingBulkData(card, i); - } - -#else - unifi_trace(card->ospriv, UDBG4, "process_to_host_signals Clear slot=%x host tag=%x\n", i, host_tag); - card->fh_slot_host_tag_record[i] = CSR_WIFI_HIP_RESERVED_HOST_TAG; - - /* Set length field in from_host_data array to 0 */ - CardClearFromHostDataSlot(card, i); -#endif - break; - } - } - } - } - - /* Pass event to OS layer */ - unifi_receive_event(card->ospriv, bufptr + 2, sig_len, &data_ptrs); - - /* Initialise the to_host data, so it can be re-used. */ - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) - { - /* The slot is only valid if the length is non-zero. */ - if (GET_PACKED_DATAREF_LEN(bufptr + 2, i) != 0) - { - s16 slot = GET_PACKED_DATAREF_SLOT(bufptr + 2, i); - if (slot < card->config_data.num_tohost_data_slots) - { - UNIFI_INIT_BULK_DATA(&card->to_host_data[slot]); - } - } - } - -#ifndef CSR_WIFI_DEFER_TH_FLUSH - /* - * If we have previously transferred a lot of data, ack - * the signals read so far, so f/w can reclaim the buffer - * memory sooner. - */ - if (bytes_transferred >= TO_HOST_FLUSH_THRESHOLD) - { - f_flush_count = 1; - } -#endif - break; - - - case SDIO_CMD_CLEAR_SLOT: -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - card->cmd_prof.sdio_cmd_clear_slot++; -#endif - /* This is a clear slot command. */ - if (sig_len != 0) - { - unifi_error(card->ospriv, "process_to_host_signals: clear slot, bad data len: 0x%X at offset %d\n", - sig_len, bufptr - card->th_buffer.buf); - return CSR_RESULT_FAILURE; - } - - r = process_clear_slot_command(card, bufptr); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to process clear slot\n"); - return r; - } - break; - - case SDIO_CMD_TO_HOST_TRANSFER: - case SDIO_CMD_FROM_HOST_TRANSFER: - case SDIO_CMD_FROM_HOST_AND_CLEAR: - case SDIO_CMD_OVERLAY_TRANSFER: - /* This is a bulk data command. */ - if (sig_len & 1) - { - unifi_error(card->ospriv, "process_to_host_signals: bulk data, bad data len: 0x%X at offset %d\n", - sig_len, bufptr - card->th_buffer.buf); - return CSR_RESULT_FAILURE; - } - - r = process_bulk_data_command(card, bufptr, cmd, sig_len); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to process bulk cmd\n"); - return r; - } - /* Count the bytes transferred */ - bytes_transferred += sig_len; - - if (cmd == SDIO_CMD_FROM_HOST_AND_CLEAR) - { -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - card->cmd_prof.sdio_cmd_from_host_and_clear++; -#endif -#ifndef CSR_WIFI_DEFER_TH_FLUSH - f_flush_count = 1; -#endif - } -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - else if (cmd == SDIO_CMD_FROM_HOST_TRANSFER) - { - card->cmd_prof.sdio_cmd_from_host++; - } - else if (cmd == SDIO_CMD_TO_HOST_TRANSFER) - { - card->cmd_prof.sdio_cmd_to_host++; - } -#endif - break; - - case SDIO_CMD_PADDING: - break; - - default: - unifi_error(card->ospriv, "Unrecognised to-host command: %d\n", cmd); - break; - } - - bufptr += chunks_in_buf * card->config_data.sig_frag_size; - pending -= chunks_in_buf; - - /* - * Write out the host signal count when a significant - * number of bytes of bulk data have been transferred or - * when we have performed a CopyFromHostAndClear. - */ - if (f_flush_count) - { - r = update_to_host_signals_r(card, pending); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - bytes_transferred = 0; - } - } - - if (pending) - { - unifi_warning(card->ospriv, "proc_th_sigs: %d unprocessed\n", pending); - } - - /* If we processed any signals, write the updated count to UniFi */ - if (card->th_buffer.count != pending) - { - r = update_to_host_signals_r(card, pending); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - } - - /* - * Reset the buffer pointer, copying down any un-processed signals. - * This can happen if we enable the optimisation in read_to_host_signals() - * that limits the length to whole blocks. - */ - remaining = card->th_buffer.ptr - bufptr; - if (remaining < 0) - { - unifi_error(card->ospriv, "Processing TH signals overran the buffer\n"); - return CSR_RESULT_FAILURE; - } - if (remaining > 0) - { - /* Use a safe copy because source and destination may overlap */ - u8 *d = card->th_buffer.buf; - u8 *s = bufptr; - s32 n = remaining; - while (n--) - { - *d++ = *s++; - } - } - card->th_buffer.ptr = card->th_buffer.buf + remaining; - - - /* If we reach here then we processed something */ - *processed = 1; - return CSR_RESULT_SUCCESS; -} /* process_to_host_signals() */ - - -/* - * --------------------------------------------------------------------------- - * process_clear_slot_command - * - * Process a clear slot command fom the UniFi. - * - * Arguments: - * card Pointer to card context struct - * bdcmd Pointer to bulk-data command msg from UniFi - * - * Returns: - * 0 on success, CSR error code on error - * --------------------------------------------------------------------------- - */ -static CsrResult process_clear_slot_command(card_t *card, const u8 *cmdptr) -{ - u16 data_slot; - s16 slot; - - data_slot = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cmdptr + SIZEOF_UINT16); - - unifi_trace(card->ospriv, UDBG4, "Processing clear slot cmd, slot=0x%X\n", - data_slot); - - slot = data_slot & 0x7FFF; - -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, "CMD clear data slot 0x%04x\n", data_slot); -#endif /* CSR_WIFI_HIP_NOISY */ - - if (data_slot & SLOT_DIR_TO_HOST) - { - if (slot >= card->config_data.num_tohost_data_slots) - { - unifi_error(card->ospriv, - "Invalid to-host data slot in SDIO_CMD_CLEAR_SLOT: %d\n", - slot); - return CSR_RESULT_FAILURE; - } - /* clear to-host data slot */ - unifi_warning(card->ospriv, "Unexpected clear to-host data slot cmd: 0x%04x\n", - data_slot); - } - else - { - if (slot >= card->config_data.num_fromhost_data_slots) - { - unifi_error(card->ospriv, - "Invalid from-host data slot in SDIO_CMD_CLEAR_SLOT: %d\n", - slot); - return CSR_RESULT_FAILURE; - } - - /* - * The driver is the owner to clear all slots now - * Ref - comment in process_fh_traffic_queue - * so it will just ignore the clear slot command from firmware - * and return success - */ - return CSR_RESULT_SUCCESS; - - /* Set length field in from_host_data array to 0 */ - /* CardClearFromHostDataSlot(card, slot); */ - } - - return CSR_RESULT_SUCCESS; -} /* process_clear_slot_command() */ - - -/* - * --------------------------------------------------------------------------- - * process_bulk_data_command - * - * Process a bulk data request from the UniFi. - * - * Arguments: - * card Pointer to card context struct - * bdcmd Pointer to bulk-data command msg from UniFi - * cmd, len Decoded values of command and length from the msg header - * Cmd will only be one of: - * SDIO_CMD_TO_HOST_TRANSFER - * SDIO_CMD_FROM_HOST_TRANSFER - * SDIO_CMD_FROM_HOST_AND_CLEAR - * SDIO_CMD_OVERLAY_TRANSFER - * - * Returns: - * CSR_RESULT_SUCCESS on success, CSR error code on error - * --------------------------------------------------------------------------- - */ -static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, - s16 cmd, u16 len) -{ - bulk_data_desc_t *bdslot; -#ifdef CSR_WIFI_ALIGNMENT_WORKAROUND - u8 *host_bulk_data_slot; -#endif - bulk_data_cmd_t bdcmd; - s16 offset; - s16 slot; - s16 dir; - CsrResult r; - - read_unpack_cmd(cmdptr, &bdcmd); - - unifi_trace(card->ospriv, UDBG4, "Processing bulk data cmd %d %s, len=%d, slot=0x%X\n", - cmd, lookup_bulkcmd_name(cmd), len, bdcmd.data_slot); - - /* - * Round up the transfer length if required. - * This is useful to force all transfers to be a multiple of the SDIO block - * size, so the SDIO driver won't try to use a byte-mode CMD53. These are - * broken on some hardware platforms. - */ - if (card->sdio_io_block_pad) - { - len = (len + card->sdio_io_block_size - 1) & ~(card->sdio_io_block_size - 1); - unifi_trace(card->ospriv, UDBG4, "Rounded bulk data length up to %d\n", len); - } - - slot = bdcmd.data_slot & 0x7FFF; - - if (cmd == SDIO_CMD_OVERLAY_TRANSFER) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; /* Not used on CSR6xxx */ - } - else - { - if (bdcmd.data_slot & SLOT_DIR_TO_HOST) - { - /* Request is for to-host bulk data */ - - /* Check sanity of slot number */ - if (slot >= card->config_data.num_tohost_data_slots) - { - unifi_error(card->ospriv, - "Invalid to-host data slot in SDIO bulk xfr req: %d\n", - slot); - return CSR_RESULT_FAILURE; - } - - /* Allocate memory for card->to_host_data[slot] bulk data here. */ -#ifdef CSR_PRE_ALLOC_NET_DATA - r = prealloc_netdata_get(card, &card->to_host_data[slot], len); -#else - r = unifi_net_data_malloc(card->ospriv, &card->to_host_data[slot], len); -#endif - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to allocate t-h bulk data\n"); - return CSR_RESULT_FAILURE; - } - - bdslot = &card->to_host_data[slot]; - - /* Make sure that the buffer is 4-bytes aligned */ - r = unifi_net_dma_align(card->ospriv, bdslot); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to align t-h bulk data buffer for DMA\n"); - return CSR_RESULT_FAILURE; - } - } - else - { - /* Request is for from-host bulk data */ - - if (slot >= card->config_data.num_fromhost_data_slots) - { - unifi_error(card->ospriv, - "Invalid from-host data slot in SDIO bulk xfr req: %d\n", - slot); - return CSR_RESULT_FAILURE; - } - bdslot = &card->from_host_data[slot].bd; - } - offset = bdcmd.offset; - } - /* Do the transfer */ - dir = (cmd == SDIO_CMD_TO_HOST_TRANSFER)? - UNIFI_SDIO_READ : UNIFI_SDIO_WRITE; - - unifi_trace(card->ospriv, UDBG4, - "Bulk %c %s len=%d, handle %d - slot=%d %p+(%d)\n", - (dir == UNIFI_SDIO_READ)?'R' : 'W', - lookup_bulkcmd_name(cmd), - len, - bdcmd.buffer_handle, - slot, bdslot->os_data_ptr, offset); -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, "Bulk %s len=%d, handle %d - slot=%d %p+(%d)\n", - lookup_bulkcmd_name(cmd), - len, - bdcmd.buffer_handle, - slot, bdslot->os_data_ptr, offset); -#endif /* CSR_WIFI_HIP_NOISY */ - - - if (bdslot->os_data_ptr == NULL) - { - unifi_error(card->ospriv, "Null os_data_ptr - Bulk %s handle %d - slot=%d o=(%d)\n", - lookup_bulkcmd_name(cmd), - bdcmd.buffer_handle, - slot, - offset); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - -#ifdef CSR_WIFI_ALIGNMENT_WORKAROUND - /* if os_data_ptr is not 4-byte aligned, then allocate a new buffer and copy data - to new buffer to ensure the address passed to unifi_bulk_rw is 4-byte aligned */ - - if (len != 0 && (dir == UNIFI_SDIO_WRITE) && (((ptrdiff_t)bdslot->os_data_ptr + offset) & 3)) - { - host_bulk_data_slot = kmalloc(len, GFP_KERNEL); - - if (!host_bulk_data_slot) - { - unifi_error(card->ospriv, " failed to allocate request_data before unifi_bulk_rw\n"); - return -1; - } - - memcpy((void *)host_bulk_data_slot, - (void *)(bdslot->os_data_ptr + offset), len); - - r = unifi_bulk_rw(card, - bdcmd.buffer_handle, - (void *)host_bulk_data_slot, - len, - dir); - } - else -#endif - { - r = unifi_bulk_rw(card, - bdcmd.buffer_handle, - (void *)(bdslot->os_data_ptr + offset), - len, - dir); - } - - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, - "Failed: %s hlen=%d, slen=%d, handle %d - slot=%d %p+0x%X\n", - lookup_bulkcmd_name(cmd), - len, /* Header length */ - bdslot->data_length, /* Length stored in slot */ - bdcmd.buffer_handle, - slot, bdslot->os_data_ptr, offset); - return r; - } - - bdslot->data_length = len; - - if (cmd == SDIO_CMD_FROM_HOST_AND_CLEAR) - { - if (slot >= card->config_data.num_fromhost_data_slots) - { - unifi_error(card->ospriv, - "Invalid from-host data slot in SDIO_CMD_FROM_HOST_AND_CLEAR: %d\n", - slot); - return CSR_RESULT_FAILURE; - } - -#ifdef CSR_WIFI_ALIGNMENT_WORKAROUND - /* moving this check before we clear host data slot */ - if ((len != 0) && (dir == UNIFI_SDIO_WRITE) && (((ptrdiff_t)bdslot->os_data_ptr + offset) & 3)) - { - kfree(host_bulk_data_slot); - } -#endif - - if (card->fh_slot_host_tag_record) - { - unifi_trace(card->ospriv, UDBG5, "CopyFromHostAndClearSlot Reset entry for slot=%d\n", slot); - - /* reset the host tag entry for the corresponding slot */ - card->fh_slot_host_tag_record[slot] = CSR_WIFI_HIP_RESERVED_HOST_TAG; - } - - - /* Set length field in from_host_data array to 0 */ - CardClearFromHostDataSlot(card, slot); - } - - return CSR_RESULT_SUCCESS; -} /* process_bulk_data_command() */ - - -/* - * --------------------------------------------------------------------------- - * check_fh_sig_slots - * - * Check whether there are <n> free signal slots available on UniFi. - * This takes into account the signals already batched since the - * from_host_signal counts were last read. - * If the from_host_signal counts indicate not enough space, we read - * the latest count from UniFi to see if some more have been freed. - * - * Arguments: - * None. - * - * Returns: - * CSR_RESULT_SUCCESS, otherwise CSR error code on error. - * --------------------------------------------------------------------------- - */ -static CsrResult check_fh_sig_slots(card_t *card, u16 needed, s32 *space_fh) -{ - u32 count_fhw; - u32 occupied_fh, slots_fh; - s32 count_fhr; - - count_fhw = card->from_host_signals_w; - count_fhr = card->from_host_signals_r; - slots_fh = card->config_data.num_fromhost_sig_frags; - - /* Only read the space in from-host queue if necessary */ - occupied_fh = (count_fhw - count_fhr) % 128; - - if (slots_fh < occupied_fh) - { - *space_fh = 0; - } - else - { - *space_fh = slots_fh - occupied_fh; - } - - if ((occupied_fh != 0) && (*space_fh < needed)) - { - count_fhr = unifi_read_shared_count(card, card->sdio_ctrl_addr + 2); - if (count_fhr < 0) - { - unifi_error(card->ospriv, "Failed to read from-host sig read count\n"); - return CSR_RESULT_FAILURE; - } - card->from_host_signals_r = count_fhr; /* diag */ - - occupied_fh = (count_fhw - count_fhr) % 128; - *space_fh = slots_fh - occupied_fh; - } - - return CSR_RESULT_SUCCESS; -} /* check_fh_sig_slots() */ - - -/* -* If we are padding the From-Host signals to the SDIO block size, -* we need to round up the needed_chunks to the SDIO block size. -*/ -#define ROUND_UP_NEEDED_CHUNKS(_card, _needed_chunks) \ - { \ - u16 _chunks_per_block; \ - u16 _chunks_in_last_block; \ - \ - if (_card->sdio_io_block_pad) \ - { \ - _chunks_per_block = _card->sdio_io_block_size / _card->config_data.sig_frag_size; \ - _chunks_in_last_block = _needed_chunks % _chunks_per_block; \ - if (_chunks_in_last_block != 0) \ - { \ - _needed_chunks = _needed_chunks + (_chunks_per_block - _chunks_in_last_block); \ - } \ - } \ - } - - -#define ROUND_UP_SPACE_CHUNKS(_card, _space_chunks) \ - { \ - u16 _chunks_per_block; \ - \ - if (_card->sdio_io_block_pad) \ - { \ - _chunks_per_block = _card->sdio_io_block_size / _card->config_data.sig_frag_size; \ - _space_chunks = ((_space_chunks / _chunks_per_block) * _chunks_per_block); \ - } \ - } - - - - - -/* - * --------------------------------------------------------------------------- - * process_fh_cmd_queue - * - * Take one signal off the from-host queue and copy it to the UniFi. - * Does nothing if the UniFi has no slots free. - * - * Arguments: - * card Pointer to card context struct - * processed Location to write: - * 0 if there is nothing on the queue to process - * 1 if a signal was successfully processed - * - * Returns: - * CSR error code if an error occurred. - * - * Notes: - * The from-host queue contains signal requests from the network driver - * and any UDI clients interspersed. UDI clients' requests have been stored - * in the from-host queue using the wire-format structures, as they arrive. - * All other requests are stored in the from-host queue using the host - * (cpu specific) structures. We use the is_packed member of the card_signal_t - * structure that describes the queue to make the distinction. - * --------------------------------------------------------------------------- - */ -static CsrResult process_fh_cmd_queue(card_t *card, s32 *processed) -{ - q_t *sigq = &card->fh_command_queue; - - CsrResult r; - u16 pending_sigs; - u16 pending_chunks; - u16 needed_chunks; - s32 space_chunks; - u16 q_index; - - *processed = 0; - - /* Get the number of pending signals. */ - pending_sigs = CSR_WIFI_HIP_Q_SLOTS_USED(sigq); - unifi_trace(card->ospriv, UDBG5, "proc_fh: %d pending\n", pending_sigs); - if (pending_sigs == 0) - { - /* Nothing to do */ - return CSR_RESULT_SUCCESS; - } - - /* Work out how many chunks we have waiting to send */ - for (pending_chunks = 0, q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(sigq); - q_index != CSR_WIFI_HIP_Q_NEXT_W_SLOT(sigq); - q_index = CSR_WIFI_HIP_Q_WRAP(sigq, q_index + 1)) - { - card_signal_t *csptr = CSR_WIFI_HIP_Q_SLOT_DATA(sigq, q_index); - - /* - * Note that GET_CHUNKS_FOR() needs the size of the packed - * (wire-formatted) structure - */ - pending_chunks += GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(csptr->signal_length + 2)); - } - - /* - * Check whether UniFi has space for all the buffered bulk-data - * commands and signals as well. - */ - needed_chunks = pending_chunks + card->fh_buffer.count; - - /* Round up to the block size if necessary */ - ROUND_UP_NEEDED_CHUNKS(card, needed_chunks); - - r = check_fh_sig_slots(card, needed_chunks, &space_chunks); - if (r != CSR_RESULT_SUCCESS) - { - /* Error */ - unifi_error(card->ospriv, "Failed to read fh sig count\n"); - return r; - } - -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, "proc_fh: %d chunks free, need %d\n", - space_chunks, needed_chunks); -#endif /* CSR_WIFI_HIP_NOISY */ - - - /* - * Coalesce as many from-host signals as possible - * into a single block and write using a single CMD53 - */ - if (needed_chunks > (u16)space_chunks) - { - /* Round up to the block size if necessary */ - ROUND_UP_SPACE_CHUNKS(card, space_chunks); - - /* - * If the f/w has less free chunks than those already pending - * return immediately. - */ - if ((u16)space_chunks <= card->fh_buffer.count) - { - /* - * No room in UniFi for any signals after the buffered bulk - * data commands have been sent. - */ - unifi_error(card->ospriv, "not enough room to send signals, need %d chunks, %d free\n", - card->fh_buffer.count, space_chunks); - card->generate_interrupt = 1; - return CSR_RESULT_SUCCESS; - } - pending_chunks = (u16)(space_chunks - card->fh_buffer.count); - } - - while (pending_sigs-- && pending_chunks > 0) - { - card_signal_t *csptr; - s16 i; - u16 sig_chunks, total_length, free_chunks_in_fh_buffer; - bulk_data_param_t bulkdata; - u8 *packed_sigptr; - u16 signal_length = 0; - - /* Retrieve the entry at the head of the queue */ - q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(sigq); - - /* Get a pointer to the containing card_signal_t struct */ - csptr = CSR_WIFI_HIP_Q_SLOT_DATA(sigq, q_index); - - /* Get the new length of the packed signal */ - signal_length = csptr->signal_length; - - if ((signal_length & 1) || (signal_length > UNIFI_PACKED_SIGBUF_SIZE)) - { - unifi_error(card->ospriv, "process_fh_queue: Bad len: %d\n", signal_length); - return CSR_RESULT_FAILURE; - } - - /* Need space for 2-byte SDIO protocol header + signal */ - sig_chunks = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(signal_length + 2)); - - free_chunks_in_fh_buffer = GET_CHUNKS_FOR(card->config_data.sig_frag_size, - (u16)((card->fh_buffer.buf + UNIFI_FH_BUF_SIZE) - card->fh_buffer.ptr)); - if (free_chunks_in_fh_buffer < sig_chunks) - { - /* No more room */ - unifi_notice(card->ospriv, "proc_fh_cmd_q: no room in fh buffer for 0x%.4X, deferring\n", - (u16)(GET_SIGNAL_ID(csptr->sigbuf))); - break; - } - - packed_sigptr = csptr->sigbuf; - - /* Claim and set up a from-host data slot */ - if (CSR_RESULT_FAILURE == CardWriteBulkData(card, csptr, UNIFI_TRAFFIC_Q_MLME)) - { - unifi_notice(card->ospriv, "proc_fh_cmd_q: no fh data slots for 0x%.4X, deferring\n", - (u16)(GET_SIGNAL_ID(csptr->sigbuf))); - break; - } - - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) - { - if (csptr->bulkdata[i].data_length == 0) - { - UNIFI_INIT_BULK_DATA(&bulkdata.d[i]); - } - else - { - bulkdata.d[i].os_data_ptr = csptr->bulkdata[i].os_data_ptr; - bulkdata.d[i].data_length = csptr->bulkdata[i].data_length; - } - - /* Pass the free responsibility to the lower layer. */ - UNIFI_INIT_BULK_DATA(&csptr->bulkdata[i]); - } - - unifi_trace(card->ospriv, UDBG2, "Sending signal 0x%.4X\n", - GET_SIGNAL_ID(packed_sigptr)); -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, "Sending signal 0x%.4X\n", - GET_SIGNAL_ID(packed_sigptr)); -#endif /* CSR_WIFI_HIP_NOISY */ - - - /* Append packed signal to F-H buffer */ - total_length = sig_chunks * card->config_data.sig_frag_size; - - card->fh_buffer.ptr[0] = (u8)(signal_length & 0xff); - card->fh_buffer.ptr[1] = - (u8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4)); - - memcpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length); - memset(card->fh_buffer.ptr + 2 + signal_length, 0, - total_length - (2 + signal_length)); - -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, "proc_fh: fh_buffer %d bytes \n", - signal_length + 2); - dump(card->fh_buffer.ptr, signal_length + 2); - unifi_trace(card->ospriv, UDBG1, " \n"); -#endif /* CSR_WIFI_HIP_NOISY */ - - card->fh_buffer.ptr += total_length; - card->fh_buffer.count += sig_chunks; - -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, "Added %d to fh buf, len now %d, count %d\n", - signal_length, - card->fh_buffer.ptr - card->fh_buffer.buf, - card->fh_buffer.count); -#endif /* CSR_WIFI_HIP_NOISY */ - - (*processed)++; - pending_chunks -= sig_chunks; - - /* Log the signal to the UDI. */ - /* UDI will get the packed structure */ - /* Can not log the unpacked signal, unless we reconstruct it! */ - if (card->udi_hook) - { - (*card->udi_hook)(card->ospriv, packed_sigptr, signal_length, - &bulkdata, UDI_LOG_FROM_HOST); - } - - /* Remove entry from q */ - csptr->signal_length = 0; - CSR_WIFI_HIP_Q_INC_R(sigq); - } - - return CSR_RESULT_SUCCESS; -} /* process_fh_cmd_queue() */ - - -/* - * --------------------------------------------------------------------------- - * process_fh_traffic_queue - * - * Take signals off the from-host queue and copy them to the UniFi. - * Does nothing if the UniFi has no slots free. - * - * Arguments: - * card Pointer to card context struct - * sigq Pointer to the traffic queue - * processed Pointer to location to write: - * 0 if there is nothing on the queue to process - * 1 if a signal was successfully processed - * - * Returns: - * CSR error code if an error occurred. - * - * Notes: - * The from-host queue contains signal requests from the network driver - * and any UDI clients interspersed. - * --------------------------------------------------------------------------- - */ -static CsrResult process_fh_traffic_queue(card_t *card, s32 *processed) -{ - q_t *sigq = card->fh_traffic_queue; - - CsrResult r; - s16 n = 0; - s32 q_no; - u16 pending_sigs = 0; - u16 pending_chunks = 0; - u16 needed_chunks; - s32 space_chunks; - u16 q_index; - u32 host_tag = 0; - u16 slot_num = 0; - - *processed = 0; - - /* calculate how many signals are in queues and how many chunks are needed. */ - for (n = UNIFI_NO_OF_TX_QS - 1; n >= 0; n--) - { - /* Get the number of pending signals. */ - pending_sigs += CSR_WIFI_HIP_Q_SLOTS_USED(&sigq[n]); - unifi_trace(card->ospriv, UDBG5, "proc_fh%d: %d pending\n", n, pending_sigs); - - /* Work out how many chunks we have waiting to send */ - for (q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(&sigq[n]); - q_index != CSR_WIFI_HIP_Q_NEXT_W_SLOT(&sigq[n]); - q_index = CSR_WIFI_HIP_Q_WRAP(&sigq[n], q_index + 1)) - { - card_signal_t *csptr = CSR_WIFI_HIP_Q_SLOT_DATA(&sigq[n], q_index); - - /* - * Note that GET_CHUNKS_FOR() needs the size of the packed - * (wire-formatted) structure - */ - pending_chunks += GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(csptr->signal_length + 2)); - } - } - - /* If there are no pending signals, just return */ - if (pending_sigs == 0) - { - /* Nothing to do */ - return CSR_RESULT_SUCCESS; - } - - /* - * Check whether UniFi has space for all the buffered bulk-data - * commands and signals as well. - */ - needed_chunks = pending_chunks + card->fh_buffer.count; - - /* Round up to the block size if necessary */ - ROUND_UP_NEEDED_CHUNKS(card, needed_chunks); - - r = check_fh_sig_slots(card, needed_chunks, &space_chunks); - if (r != CSR_RESULT_SUCCESS) - { - /* Error */ - unifi_error(card->ospriv, "Failed to read fh sig count\n"); - return r; - } - -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, - "process_fh_traffic_queue: %d chunks free, need %d\n", - space_chunks, needed_chunks); - read_fhsr(card); /* debugging only */ -#endif /* CSR_WIFI_HIP_NOISY */ - - /* Coalesce as many from-host signals as possible - into a single block and write using a single CMD53 */ - if (needed_chunks > (u16)space_chunks) - { - /* Round up to the block size if necessary */ - ROUND_UP_SPACE_CHUNKS(card, space_chunks); - - if ((u16)space_chunks <= card->fh_buffer.count) - { - /* - * No room in UniFi for any signals after the buffered bulk - * data commands have been sent. - */ - unifi_error(card->ospriv, "not enough room to send signals, need %d chunks, %d free\n", - card->fh_buffer.count, space_chunks); - card->generate_interrupt = 1; - return 0; - } - - pending_chunks = (u16)space_chunks - card->fh_buffer.count; - } - - q_no = UNIFI_NO_OF_TX_QS - 1; - - /* - * pending_sigs will be exhausted if there are is no restriction to the pending - * signals per queue. pending_chunks may be exhausted if there is a restriction. - * q_no check will be exhausted if there is a restriction and our round-robin - * algorith fails to fill all chunks. - */ - do - { - card_signal_t *csptr; - u16 sig_chunks, total_length, free_chunks_in_fh_buffer; - bulk_data_param_t bulkdata; - u8 *packed_sigptr; - u16 signal_length = 0; - - /* if this queue is empty go to next one. */ - if (CSR_WIFI_HIP_Q_SLOTS_USED(&sigq[q_no]) == 0) - { - q_no--; - continue; - } - - /* Retrieve the entry at the head of the queue */ - q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(&sigq[q_no]); - - /* Get a pointer to the containing card_signal_t struct */ - csptr = CSR_WIFI_HIP_Q_SLOT_DATA(&sigq[q_no], q_index); - - /* Get the new length of the packed signal */ - signal_length = csptr->signal_length; - - if ((signal_length & 1) || (signal_length > UNIFI_PACKED_SIGBUF_SIZE)) - { - unifi_error(card->ospriv, "process_fh_traffic_queue: Bad len: %d\n", signal_length); - return CSR_RESULT_FAILURE; - } - - /* Need space for 2-byte SDIO protocol header + signal */ - sig_chunks = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(signal_length + 2)); - free_chunks_in_fh_buffer = GET_CHUNKS_FOR(card->config_data.sig_frag_size, - (u16)((card->fh_buffer.buf + UNIFI_FH_BUF_SIZE) - card->fh_buffer.ptr)); - if (free_chunks_in_fh_buffer < sig_chunks) - { - /* No more room */ - unifi_notice(card->ospriv, "process_fh_traffic_queue: no more chunks.\n"); - break; - } - - packed_sigptr = csptr->sigbuf; - /* Claim and set up a from-host data slot */ - if (CSR_RESULT_FAILURE == CardWriteBulkData(card, csptr, (unifi_TrafficQueue)q_no)) - { - q_no--; - continue; - } - - /* Sanity check: MA-PACKET.req must have a valid bulk data */ - if ((csptr->bulkdata[0].data_length == 0) || (csptr->bulkdata[0].os_data_ptr == NULL)) - { - unifi_error(card->ospriv, "MA-PACKET.req with empty bulk data (%d bytes in %p)\n", - csptr->bulkdata[0].data_length, csptr->bulkdata[0].os_data_ptr); - dump(packed_sigptr, signal_length); - return CSR_RESULT_FAILURE; - } - - bulkdata.d[0].os_data_ptr = csptr->bulkdata[0].os_data_ptr; - bulkdata.d[0].data_length = csptr->bulkdata[0].data_length; - bulkdata.d[0].os_net_buf_ptr = csptr->bulkdata[0].os_net_buf_ptr; - bulkdata.d[0].net_buf_length = csptr->bulkdata[0].net_buf_length; - - /* The driver owns clearing of HIP slots for following scenario - * - driver has requested a MA-PACKET.req signal - * - The f/w after receiving the signal decides it can't send it out due to various reasons - * - So the f/w without downloading the bulk data decides to just send a confirmation with fail - * - and then sends a clear slot signal to HIP - * - * But in some cases the clear slot signal never comes and the slot remains --NOT-- freed for ever - * - * To handle this, HIP will keep the record of host tag for each occupied slot - * and then based on status of that Host tag and slot the driver will decide if the slot is - * cleared by f/w signal or the slot has to be freed by driver - */ - - if (card->fh_slot_host_tag_record) - { - /* Update the f-h slot record for the corresponding host tag */ - host_tag = GET_PACKED_MA_PACKET_REQUEST_HOST_TAG(packed_sigptr); - slot_num = GET_PACKED_DATAREF_SLOT(packed_sigptr, 0) & 0x00FF; - - unifi_trace(card->ospriv, UDBG5, - "process_fh_traffic_queue signal ID =%x fh slot=%x Host tag =%x\n", - GET_SIGNAL_ID(packed_sigptr), slot_num, host_tag); - card->fh_slot_host_tag_record[slot_num] = host_tag; - } - UNIFI_INIT_BULK_DATA(&bulkdata.d[1]); - UNIFI_INIT_BULK_DATA(&csptr->bulkdata[0]); - UNIFI_INIT_BULK_DATA(&csptr->bulkdata[1]); - -#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE - if (bulkdata.d[0].os_data_ptr) - { - if ((*bulkdata.d[0].os_data_ptr) & 0x08) - { - card->cmd_prof.tx_count++; - } - } -#endif - unifi_trace(card->ospriv, UDBG3, "Sending signal 0x%.4X\n", - GET_SIGNAL_ID(packed_sigptr)); -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, "Sending signal 0x%.4X\n", - GET_SIGNAL_ID(packed_sigptr)); -#endif /* CSR_WIFI_HIP_NOISY */ - - /* Append packed signal to F-H buffer */ - total_length = sig_chunks * card->config_data.sig_frag_size; - - card->fh_buffer.ptr[0] = (u8)(signal_length & 0xff); - card->fh_buffer.ptr[1] = - (u8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4)); - - memcpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length); - memset(card->fh_buffer.ptr + 2 + signal_length, 0, - total_length - (2 + signal_length)); - -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, "proc_fh: fh_buffer %d bytes \n", - signal_length + 2); - dump(card->fh_buffer.ptr, signal_length + 2); - unifi_trace(card->ospriv, UDBG1, " \n"); -#endif /* CSR_WIFI_HIP_NOISY */ - - card->fh_buffer.ptr += total_length; - card->fh_buffer.count += sig_chunks; - -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, "Added %d to fh buf, len now %d, count %d\n", - signal_length, - card->fh_buffer.ptr - card->fh_buffer.buf, - card->fh_buffer.count); -#endif /* CSR_WIFI_HIP_NOISY */ - - (*processed)++; - pending_sigs--; - pending_chunks -= sig_chunks; - - /* Log the signal to the UDI. */ - /* UDI will get the packed structure */ - /* Can not log the unpacked signal, unless we reconstruct it! */ - if (card->udi_hook) - { - (*card->udi_hook)(card->ospriv, packed_sigptr, signal_length, - &bulkdata, UDI_LOG_FROM_HOST); - } - - /* Remove entry from q */ - csptr->signal_length = 0; - /* Note that the traffic queue has only one valid bulk data buffer. */ - csptr->bulkdata[0].data_length = 0; - - CSR_WIFI_HIP_Q_INC_R(&sigq[q_no]); - } while ((pending_sigs > 0) && (pending_chunks > 0) && (q_no >= 0)); - - return CSR_RESULT_SUCCESS; -} /* process_fh_traffic_queue() */ - - -/* - * --------------------------------------------------------------------------- - * flush_fh_buffer - * - * Write out the cache from-hosts signals to the UniFi. - * - * Arguments: - * card Pointer to card context struct - * - * Returns: - * CSR error code if an SDIO error occurred. - * --------------------------------------------------------------------------- - */ -static CsrResult flush_fh_buffer(card_t *card) -{ - CsrResult r; - u16 len; - u16 sig_units; - u16 data_round; - u16 chunks_in_last_block; - u16 padding_chunks; - u16 i; - - len = card->fh_buffer.ptr - card->fh_buffer.buf; - -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, "fh_buffer is at %p, ptr= %p\n", - card->fh_buffer.buf, card->fh_buffer.ptr); -#endif /* CSR_WIFI_HIP_NOISY */ - - if (len == 0) - { - return CSR_RESULT_SUCCESS; - } - -#ifdef CSR_WIFI_HIP_NOISY - if (dump_fh_buf) - { - dump(card->fh_buffer.buf, len); - dump_fh_buf = 0; - } -#endif /* CSR_WIFI_HIP_NOISY */ - - if (card->sdio_io_block_pad) - { - /* Both of these are powers of 2 */ - sig_units = card->config_data.sig_frag_size; - data_round = card->sdio_io_block_size; - - if (data_round > sig_units) - { - chunks_in_last_block = (len % data_round) / sig_units; - - if (chunks_in_last_block != 0) - { - padding_chunks = (data_round / sig_units) - chunks_in_last_block; - - memset(card->fh_buffer.ptr, 0, padding_chunks * sig_units); - for (i = 0; i < padding_chunks; i++) - { - card->fh_buffer.ptr[1] = SDIO_CMD_PADDING << 4; - card->fh_buffer.ptr += sig_units; - } - - card->fh_buffer.count += padding_chunks; - len += padding_chunks * sig_units; - } - } - } - - r = unifi_bulk_rw(card, - card->config_data.fromhost_sigbuf_handle, - card->fh_buffer.buf, - len, UNIFI_SDIO_WRITE); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write fh signals: %u bytes, error %d\n", len, r); - return r; - } - - /* Update from-host-signals-written signal count */ - card->from_host_signals_w = - (card->from_host_signals_w + card->fh_buffer.count) % 128u; - r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 0, - (u8)card->from_host_signals_w); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write fh signal count %u with error %d\n", - card->from_host_signals_w, r); - return r; - } - card->generate_interrupt = 1; - - /* Reset the fh buffer pointer */ - card->fh_buffer.ptr = card->fh_buffer.buf; - card->fh_buffer.count = 0; - -#ifdef CSR_WIFI_HIP_NOISY - unifi_error(card->ospriv, "END flush: fh len %d, count %d\n", - card->fh_buffer.ptr - card->fh_buffer.buf, - card->fh_buffer.count); -#endif /* CSR_WIFI_HIP_NOISY */ - - return CSR_RESULT_SUCCESS; -} /* flush_fh_buffer() */ - - -/* - * --------------------------------------------------------------------------- - * restart_packet_flow - * - * This function is called before the bottom-half thread sleeps. - * It checks whether both data and signal resources are available and - * then calls the OS-layer function to re-enable packet transmission. - * - * Arguments: - * card Pointer to card context struct - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void restart_packet_flow(card_t *card) -{ - u8 q; - - /* - * We only look at the fh_traffic_queue, because that is where packets from - * the network stack are placed. - */ - for (q = 0; q <= UNIFI_TRAFFIC_Q_VO; q++) - { - if (card_is_tx_q_paused(card, q) && - CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[q]) >= RESUME_XMIT_THRESHOLD) - { -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - unifi_debug_log_to_buf("U"); -#endif - card_tx_q_unpause(card, q); - unifi_restart_xmit(card->ospriv, (unifi_TrafficQueue)q); - } - } -} /* restart_packet_flow() */ - - diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c deleted file mode 100644 index 17867f60df16..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c +++ /dev/null @@ -1,1713 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * FILE: csr_wifi_hip_card_sdio_mem.c - * - * PURPOSE: Implementation of the Card API for SDIO. - * - * --------------------------------------------------------------------------- - */ -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_card.h" - -#define SDIO_RETRIES 3 -#define CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH 16 - - -#define retryable_sdio_error(_csrResult) (((_csrResult) == CSR_SDIO_RESULT_CRC_ERROR) || ((_csrResult) == CSR_SDIO_RESULT_TIMEOUT)) - - -/* - * --------------------------------------------------------------------------- - * retrying_read8 - * retrying_write8 - * - * These functions provide the first level of retry for SDIO operations. - * If an SDIO command fails for reason of a response timeout or CRC - * error, it is retried immediately. If three attempts fail we report a - * failure. - * If the command failed for any other reason, the failure is reported - * immediately. - * - * Arguments: - * card Pointer to card structure. - * funcnum The SDIO function to access. - * Function 0 is the Card Configuration Register space, - * function 1/2 is the UniFi register space. - * addr Address to access - * pdata Pointer in which to return the value read. - * data Value to write. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * --------------------------------------------------------------------------- - */ -static CsrResult retrying_read8(card_t *card, s16 funcnum, u32 addr, u8 *pdata) -{ - CsrSdioFunction *sdio = card->sdio_if; - CsrResult r = CSR_RESULT_SUCCESS; - s16 retries; - CsrResult csrResult = CSR_RESULT_SUCCESS; - - retries = 0; - while (retries++ < SDIO_RETRIES) - { - if (funcnum == 0) - { -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - unifi_debug_log_to_buf("r0@%02X", addr); -#endif - csrResult = CsrSdioF0Read8(sdio, addr, pdata); - } - else - { -#ifdef CSR_WIFI_TRANSPORT_CSPI - unifi_error(card->ospriv, - "retrying_read_f0_8: F1 8-bit reads are not allowed.\n"); - return CSR_RESULT_FAILURE; -#else -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - unifi_debug_log_to_buf("r@%02X", addr); -#endif - csrResult = CsrSdioRead8(sdio, addr, pdata); -#endif - } -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_debug_log_to_buf("error=%X\n", csrResult); - } - else - { - unifi_debug_log_to_buf("=%X\n", *pdata); - } -#endif - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - return CSR_WIFI_HIP_RESULT_NO_DEVICE; - } - /* - * Try again for retryable (CRC or TIMEOUT) errors, - * break on success or fatal error - */ - if (!retryable_sdio_error(csrResult)) - { -#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE - card->cmd_prof.cmd52_count++; -#endif - break; - } - unifi_trace(card->ospriv, UDBG2, "retryable SDIO error reading F%d 0x%lX\n", funcnum, addr); - } - - if ((csrResult == CSR_RESULT_SUCCESS) && (retries > 1)) - { - unifi_warning(card->ospriv, "Read succeeded after %d attempts\n", retries); - } - - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read from UniFi (addr 0x%lX) after %d tries\n", - addr, retries - 1); - /* Report any SDIO error as a general i/o error */ - r = CSR_RESULT_FAILURE; - } - - return r; -} /* retrying_read8() */ - - -static CsrResult retrying_write8(card_t *card, s16 funcnum, u32 addr, u8 data) -{ - CsrSdioFunction *sdio = card->sdio_if; - CsrResult r = CSR_RESULT_SUCCESS; - s16 retries; - CsrResult csrResult = CSR_RESULT_SUCCESS; - - retries = 0; - while (retries++ < SDIO_RETRIES) - { - if (funcnum == 0) - { -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - unifi_debug_log_to_buf("w0@%02X=%X", addr, data); -#endif - csrResult = CsrSdioF0Write8(sdio, addr, data); - } - else - { -#ifdef CSR_WIFI_TRANSPORT_CSPI - unifi_error(card->ospriv, - "retrying_write_f0_8: F1 8-bit writes are not allowed.\n"); - return CSR_RESULT_FAILURE; -#else -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - unifi_debug_log_to_buf("w@%02X=%X", addr, data); -#endif - csrResult = CsrSdioWrite8(sdio, addr, data); -#endif - } -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_debug_log_to_buf(",error=%X", csrResult); - } - unifi_debug_string_to_buf("\n"); -#endif - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - return CSR_WIFI_HIP_RESULT_NO_DEVICE; - } - /* - * Try again for retryable (CRC or TIMEOUT) errors, - * break on success or fatal error - */ - if (!retryable_sdio_error(csrResult)) - { -#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE - card->cmd_prof.cmd52_count++; -#endif - break; - } - unifi_trace(card->ospriv, UDBG2, "retryable SDIO error writing %02X to F%d 0x%lX\n", - data, funcnum, addr); - } - - if ((csrResult == CSR_RESULT_SUCCESS) && (retries > 1)) - { - unifi_warning(card->ospriv, "Write succeeded after %d attempts\n", retries); - } - - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write to UniFi (addr 0x%lX) after %d tries\n", - addr, retries - 1); - /* Report any SDIO error as a general i/o error */ - r = CSR_RESULT_FAILURE; - } - - return r; -} /* retrying_write8() */ - - -static CsrResult retrying_read16(card_t *card, s16 funcnum, - u32 addr, u16 *pdata) -{ - CsrSdioFunction *sdio = card->sdio_if; - CsrResult r = CSR_RESULT_SUCCESS; - s16 retries; - CsrResult csrResult = CSR_RESULT_SUCCESS; - - retries = 0; - while (retries++ < SDIO_RETRIES) - { -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - unifi_debug_log_to_buf("r@%02X", addr); -#endif - csrResult = CsrSdioRead16(sdio, addr, pdata); -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_debug_log_to_buf("error=%X\n", csrResult); - } - else - { - unifi_debug_log_to_buf("=%X\n", *pdata); - } -#endif - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - return CSR_WIFI_HIP_RESULT_NO_DEVICE; - } - - /* - * Try again for retryable (CRC or TIMEOUT) errors, - * break on success or fatal error - */ - if (!retryable_sdio_error(csrResult)) - { -#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE - card->cmd_prof.cmd52_count++; -#endif - break; - } - unifi_trace(card->ospriv, UDBG2, "retryable SDIO error reading F%d 0x%lX\n", funcnum, addr); - } - - if ((csrResult == CSR_RESULT_SUCCESS) && (retries > 1)) - { - unifi_warning(card->ospriv, "Read succeeded after %d attempts\n", retries); - } - - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read from UniFi (addr 0x%lX) after %d tries\n", - addr, retries - 1); - /* Report any SDIO error as a general i/o error */ - r = CSR_RESULT_FAILURE; - } - - return r; -} /* retrying_read16() */ - - -static CsrResult retrying_write16(card_t *card, s16 funcnum, - u32 addr, u16 data) -{ - CsrSdioFunction *sdio = card->sdio_if; - CsrResult r = CSR_RESULT_SUCCESS; - s16 retries; - CsrResult csrResult = CSR_RESULT_SUCCESS; - - retries = 0; - while (retries++ < SDIO_RETRIES) - { -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - unifi_debug_log_to_buf("w@%02X=%X", addr, data); -#endif - csrResult = CsrSdioWrite16(sdio, addr, data); -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_debug_log_to_buf(",error=%X", csrResult); - } - unifi_debug_string_to_buf("\n"); -#endif - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - return CSR_WIFI_HIP_RESULT_NO_DEVICE; - } - - /* - * Try again for retryable (CRC or TIMEOUT) errors, - * break on success or fatal error - */ - if (!retryable_sdio_error(csrResult)) - { -#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE - card->cmd_prof.cmd52_count++; -#endif - break; - } - unifi_trace(card->ospriv, UDBG2, "retryable SDIO error writing %02X to F%d 0x%lX\n", - data, funcnum, addr); - } - - if ((csrResult == CSR_RESULT_SUCCESS) && (retries > 1)) - { - unifi_warning(card->ospriv, "Write succeeded after %d attempts\n", retries); - } - - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write to UniFi (addr 0x%lX) after %d tries\n", - addr, retries - 1); - /* Report any SDIO error as a general i/o error */ - r = CSR_RESULT_FAILURE; - } - - return r; -} /* retrying_write16() */ - - -/* - * --------------------------------------------------------------------------- - * sdio_read_f0 - * - * Reads a byte value from the CCCR (func 0) area of UniFi. - * - * Arguments: - * card Pointer to card structure. - * addr Address to read from - * pdata Pointer in which to store the read value. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * --------------------------------------------------------------------------- - */ -CsrResult sdio_read_f0(card_t *card, u32 addr, u8 *pdata) -{ -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - card->cmd_prof.cmd52_f0_r_count++; -#endif - return retrying_read8(card, 0, addr, pdata); -} /* sdio_read_f0() */ - - -/* - * --------------------------------------------------------------------------- - * sdio_write_f0 - * - * Writes a byte value to the CCCR (func 0) area of UniFi. - * - * Arguments: - * card Pointer to card structure. - * addr Address to read from - * data Data value to write. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * --------------------------------------------------------------------------- - */ -CsrResult sdio_write_f0(card_t *card, u32 addr, u8 data) -{ -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - card->cmd_prof.cmd52_f0_w_count++; -#endif - return retrying_write8(card, 0, addr, data); -} /* sdio_write_f0() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_read_direct_8_or_16 - * - * Read a 8-bit value from the UniFi SDIO interface. - * - * Arguments: - * card Pointer to card structure. - * addr Address to read from - * pdata Pointer in which to return data. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * --------------------------------------------------------------------------- - */ -CsrResult unifi_read_direct_8_or_16(card_t *card, u32 addr, u8 *pdata) -{ -#ifdef CSR_WIFI_TRANSPORT_CSPI - u16 w; - CsrResult r; - - r = retrying_read16(card, card->function, addr, &w); - *pdata = (u8)(w & 0xFF); - return r; -#else - return retrying_read8(card, card->function, addr, pdata); -#endif -} /* unifi_read_direct_8_or_16() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_write_direct_8_or_16 - * - * Write a byte value to the UniFi SDIO interface. - * - * Arguments: - * card Pointer to card structure. - * addr Address to write to - * data Value to write. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error - * - * Notes: - * If 8-bit write is used, the even address *must* be written second. - * This is because writes to odd bytes are cached and not committed - * to memory until the preceding even address is written. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_write_direct_8_or_16(card_t *card, u32 addr, u8 data) -{ - if (addr & 1) - { - unifi_warning(card->ospriv, - "Warning: Byte write to an odd address (0x%lX) is dangerous\n", - addr); - } - -#ifdef CSR_WIFI_TRANSPORT_CSPI - return retrying_write16(card, card->function, addr, (u16)data); -#else - return retrying_write8(card, card->function, addr, data); -#endif -} /* unifi_write_direct_8_or_16() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_read_direct16 - * - * Read a 16-bit value from the UniFi SDIO interface. - * - * Arguments: - * card Pointer to card structure. - * addr Address to read from - * pdata Pointer in which to return data. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * - * Notes: - * The even address *must* be read first. This is because reads from - * odd bytes are cached and read from memory when the preceding - * even address is read. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_read_direct16(card_t *card, u32 addr, u16 *pdata) -{ - return retrying_read16(card, card->function, addr, pdata); -} /* unifi_read_direct16() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_write_direct16 - * - * Write a 16-bit value to the UniFi SDIO interface. - * - * Arguments: - * card Pointer to card structure. - * addr Address to write to - * data Value to write. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * - * Notes: - * The even address *must* be written second. This is because writes to - * odd bytes are cached and not committed to memory until the preceding - * even address is written. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_write_direct16(card_t *card, u32 addr, u16 data) -{ - return retrying_write16(card, card->function, addr, data); -} /* unifi_write_direct16() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_read_direct32 - * - * Read a 32-bit value from the UniFi SDIO interface. - * - * Arguments: - * card Pointer to card structure. - * addr Address to read from - * pdata Pointer in which to return data. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * --------------------------------------------------------------------------- - */ -CsrResult unifi_read_direct32(card_t *card, u32 addr, u32 *pdata) -{ - CsrResult r; - u16 w0, w1; - - r = retrying_read16(card, card->function, addr, &w0); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - r = retrying_read16(card, card->function, addr + 2, &w1); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - *pdata = ((u32)w1 << 16) | (u32)w0; - - return CSR_RESULT_SUCCESS; -} /* unifi_read_direct32() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_read_directn_match - * - * Read multiple 8-bit values from the UniFi SDIO interface, - * stopping when either we have read 'len' bytes or we have read - * a octet equal to 'match'. If 'match' is not a valid octet - * then this function is the same as 'unifi_read_directn'. - * - * Arguments: - * card Pointer to card structure. - * addr Start address to read from. - * pdata Pointer to which to write data. - * len Maximum umber of bytes to read - * match The value to stop reading at. - * num Pointer to buffer to write number of bytes read - * - * Returns: - * number of octets read on success, negative error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * - * Notes: - * The even address *must* be read first. This is because reads from - * odd bytes are cached and read from memory when the preceding - * even address is read. - * --------------------------------------------------------------------------- - */ -static CsrResult unifi_read_directn_match(card_t *card, u32 addr, void *pdata, u16 len, s8 m, u32 *num) -{ - CsrResult r; - u32 i; - u8 *cptr; - u16 w; - - *num = 0; - - cptr = (u8 *)pdata; - for (i = 0; i < len; i += 2) - { - r = retrying_read16(card, card->function, addr, &w); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - *cptr++ = ((u8)w & 0xFF); - if ((m >= 0) && (((s8)w & 0xFF) == m)) - { - break; - } - - if (i + 1 == len) - { - /* The len is odd. Ignore the last high byte */ - break; - } - - *cptr++ = ((u8)(w >> 8) & 0xFF); - if ((m >= 0) && (((s8)(w >> 8) & 0xFF) == m)) - { - break; - } - - addr += 2; - } - - *num = (s32)(cptr - (u8 *)pdata); - return CSR_RESULT_SUCCESS; -} - - -/* - * --------------------------------------------------------------------------- - * unifi_read_directn - * - * Read multiple 8-bit values from the UniFi SDIO interface. - * - * Arguments: - * card Pointer to card structure. - * addr Start address to read from. - * pdata Pointer to which to write data. - * len Number of bytes to read - * - * Returns: - * 0 on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * - * Notes: - * The even address *must* be read first. This is because reads from - * odd bytes are cached and read from memory when the preceding - * even address is read. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_read_directn(card_t *card, u32 addr, void *pdata, u16 len) -{ - u32 num; - - return unifi_read_directn_match(card, addr, pdata, len, -1, &num); -} /* unifi_read_directn() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_write_directn - * - * Write multiple 8-bit values to the UniFi SDIO interface. - * - * Arguments: - * card Pointer to card structure. - * addr Start address to write to. - * pdata Source data pointer. - * len Number of bytes to write, must be even. - * - * Returns: - * 0 on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * - * Notes: - * The UniFi has a peculiar 16-bit bus architecture. Writes are only - * committed to memory when an even address is accessed. Writes to - * odd addresses are cached and only committed if the next write is - * to the preceding address. - * This means we must write data as pairs of bytes in reverse order. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_write_directn(card_t *card, u32 addr, void *pdata, u16 len) -{ - CsrResult r; - u8 *cptr; - s16 signed_len; - - cptr = (u8 *)pdata; - signed_len = (s16)len; - while (signed_len > 0) - { - /* This is UniFi-1 specific code. CSPI not supported so 8-bit write allowed */ - r = retrying_write16(card, card->function, addr, *cptr); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - cptr += 2; - addr += 2; - signed_len -= 2; - } - - return CSR_RESULT_SUCCESS; -} /* unifi_write_directn() */ - - -/* - * --------------------------------------------------------------------------- - * set_dmem_page - * set_pmem_page - * - * Set up the page register for the shared data memory window or program - * memory window. - * - * Arguments: - * card Pointer to card structure. - * dmem_addr UniFi shared-data-memory address to access. - * pmem_addr UniFi program memory address to access. This includes - * External FLASH memory at 0x000000 - * Processor program memory at 0x200000 - * External SRAM at memory 0x400000 - * paddr Location to write an SDIO address (24-bit) for - * use in a unifi_read_direct or unifi_write_direct call. - * - * Returns: - * CSR_RESULT_SUCCESS on success - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * --------------------------------------------------------------------------- - */ -static CsrResult set_dmem_page(card_t *card, u32 dmem_addr, u32 *paddr) -{ - u16 page, addr; - u32 len; - CsrResult r; - - *paddr = 0; - - if (!ChipHelper_DecodeWindow(card->helper, - CHIP_HELPER_WINDOW_3, - CHIP_HELPER_WT_SHARED, - dmem_addr / 2, - &page, &addr, &len)) - { - unifi_error(card->ospriv, "Failed to decode SHARED_DMEM_PAGE %08lx\n", dmem_addr); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - if (page != card->dmem_page) - { - unifi_trace(card->ospriv, UDBG6, "setting dmem page=0x%X, addr=0x%lX\n", page, addr); - - /* change page register */ - r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW3_PAGE(card->helper) * 2, page); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write SHARED_DMEM_PAGE\n"); - return r; - } - - card->dmem_page = page; - } - - *paddr = ((s32)addr * 2) + (dmem_addr & 1); - - return CSR_RESULT_SUCCESS; -} /* set_dmem_page() */ - - -static CsrResult set_pmem_page(card_t *card, u32 pmem_addr, - enum chip_helper_window_type mem_type, u32 *paddr) -{ - u16 page, addr; - u32 len; - CsrResult r; - - *paddr = 0; - - if (!ChipHelper_DecodeWindow(card->helper, - CHIP_HELPER_WINDOW_2, - mem_type, - pmem_addr / 2, - &page, &addr, &len)) - { - unifi_error(card->ospriv, "Failed to decode PROG MEM PAGE %08lx %d\n", pmem_addr, mem_type); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - if (page != card->pmem_page) - { - unifi_trace(card->ospriv, UDBG6, "setting pmem page=0x%X, addr=0x%lX\n", page, addr); - - /* change page register */ - r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW2_PAGE(card->helper) * 2, page); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write PROG MEM PAGE\n"); - return r; - } - - card->pmem_page = page; - } - - *paddr = ((s32)addr * 2) + (pmem_addr & 1); - - return CSR_RESULT_SUCCESS; -} /* set_pmem_page() */ - - -/* - * --------------------------------------------------------------------------- - * set_page - * - * Sets up the appropriate page register to access the given address. - * Returns the sdio address at which the unifi address can be accessed. - * - * Arguments: - * card Pointer to card structure. - * generic_addr UniFi internal address to access, in Generic Pointer - * format, i.e. top byte is space indicator. - * paddr Location to write page address - * SDIO address (24-bit) for use in a unifi_read_direct or - * unifi_write_direct call - * - * Returns: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * CSR_WIFI_HIP_RESULT_INVALID_VALUE the address is invalid - * --------------------------------------------------------------------------- - */ -static CsrResult set_page(card_t *card, u32 generic_addr, u32 *paddr) -{ - s32 space; - u32 addr; - CsrResult r = CSR_RESULT_SUCCESS; - - if (!paddr) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - *paddr = 0; - space = UNIFI_GP_SPACE(generic_addr); - addr = UNIFI_GP_OFFSET(generic_addr); - switch (space) - { - case UNIFI_SH_DMEM: - /* Shared Data Memory is accessed via the Shared Data Memory window */ - r = set_dmem_page(card, addr, paddr); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - break; - - case UNIFI_EXT_FLASH: - if (!ChipHelper_HasFlash(card->helper)) - { - unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n", - generic_addr, card->helper); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - /* External FLASH is accessed via the Program Memory window */ - r = set_pmem_page(card, addr, CHIP_HELPER_WT_FLASH, paddr); - break; - - case UNIFI_EXT_SRAM: - if (!ChipHelper_HasExtSram(card->helper)) - { - unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08l (helper=0x%x)\n", - generic_addr, card->helper); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - /* External SRAM is accessed via the Program Memory window */ - r = set_pmem_page(card, addr, CHIP_HELPER_WT_EXT_SRAM, paddr); - break; - - case UNIFI_REGISTERS: - /* Registers are accessed directly */ - *paddr = addr; - break; - - case UNIFI_PHY_DMEM: - r = unifi_set_proc_select(card, UNIFI_PROC_PHY); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - *paddr = ChipHelper_DATA_MEMORY_RAM_OFFSET(card->helper) * 2 + addr; - break; - - case UNIFI_MAC_DMEM: - r = unifi_set_proc_select(card, UNIFI_PROC_MAC); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - *paddr = ChipHelper_DATA_MEMORY_RAM_OFFSET(card->helper) * 2 + addr; - break; - - case UNIFI_BT_DMEM: - if (!ChipHelper_HasBt(card->helper)) - { - unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n", - generic_addr, card->helper); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - r = unifi_set_proc_select(card, UNIFI_PROC_BT); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - *paddr = ChipHelper_DATA_MEMORY_RAM_OFFSET(card->helper) * 2 + addr; - break; - - case UNIFI_PHY_PMEM: - r = unifi_set_proc_select(card, UNIFI_PROC_PHY); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - r = set_pmem_page(card, addr, CHIP_HELPER_WT_CODE_RAM, paddr); - break; - - case UNIFI_MAC_PMEM: - r = unifi_set_proc_select(card, UNIFI_PROC_MAC); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - r = set_pmem_page(card, addr, CHIP_HELPER_WT_CODE_RAM, paddr); - break; - - case UNIFI_BT_PMEM: - if (!ChipHelper_HasBt(card->helper)) - { - unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n", - generic_addr, card->helper); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - r = unifi_set_proc_select(card, UNIFI_PROC_BT); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - r = set_pmem_page(card, addr, CHIP_HELPER_WT_CODE_RAM, paddr); - break; - - case UNIFI_PHY_ROM: - if (!ChipHelper_HasRom(card->helper)) - { - unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n", - generic_addr, card->helper); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - r = unifi_set_proc_select(card, UNIFI_PROC_PHY); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - r = set_pmem_page(card, addr, CHIP_HELPER_WT_ROM, paddr); - break; - - case UNIFI_MAC_ROM: - if (!ChipHelper_HasRom(card->helper)) - { - unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n", - generic_addr, card->helper); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - r = unifi_set_proc_select(card, UNIFI_PROC_MAC); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - r = set_pmem_page(card, addr, CHIP_HELPER_WT_ROM, paddr); - break; - - case UNIFI_BT_ROM: - if (!ChipHelper_HasRom(card->helper) || !ChipHelper_HasBt(card->helper)) - { - unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n", - generic_addr, card->helper); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - r = unifi_set_proc_select(card, UNIFI_PROC_BT); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - r = set_pmem_page(card, addr, CHIP_HELPER_WT_ROM, paddr); - break; - - default: - unifi_error(card->ospriv, "Bad address space %d in generic pointer 0x%08lX (helper=0x%x)\n", - space, generic_addr, card->helper); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - return r; -} /* set_page() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_set_proc_select - * - * - * Arguments: - * card Pointer to card structure. - * select Which XAP core to select - * - * Returns: - * 0 on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * --------------------------------------------------------------------------- - */ -CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select select) -{ - CsrResult r; - - /* Verify the the select value is allowed. */ - switch (select) - { - case UNIFI_PROC_MAC: - case UNIFI_PROC_PHY: - case UNIFI_PROC_BOTH: - break; - - - default: - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - if (card->proc_select != (u32)select) - { - r = unifi_write_direct16(card, - ChipHelper_DBG_HOST_PROC_SELECT(card->helper) * 2, - (u8)select); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write to Proc Select register\n"); - return r; - } - - card->proc_select = (u32)select; - } - - return CSR_RESULT_SUCCESS; -} - - -/* - * --------------------------------------------------------------------------- - * unifi_read_8_or_16 - * - * Performs a byte read of the given address in shared data memory. - * Set up the shared data memory page register as required. - * - * Arguments: - * card Pointer to card structure. - * unifi_addr UniFi shared-data-memory address to access. - * pdata Pointer to a byte variable for the value read. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified - * --------------------------------------------------------------------------- - */ -CsrResult unifi_read_8_or_16(card_t *card, u32 unifi_addr, u8 *pdata) -{ - u32 sdio_addr; - CsrResult r; -#ifdef CSR_WIFI_TRANSPORT_CSPI - u16 w; -#endif - - r = set_page(card, unifi_addr, &sdio_addr); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - card->cmd_prof.cmd52_r8or16_count++; -#endif -#ifdef CSR_WIFI_TRANSPORT_CSPI - r = retrying_read16(card, card->function, sdio_addr, &w); - *pdata = (u8)(w & 0xFF); - return r; -#else - return retrying_read8(card, card->function, sdio_addr, pdata); -#endif -} /* unifi_read_8_or_16() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_write_8_or_16 - * - * Performs a byte write of the given address in shared data memory. - * Set up the shared data memory page register as required. - * - * Arguments: - * card Pointer to card context struct. - * unifi_addr UniFi shared-data-memory address to access. - * data Value to write. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified - * - * Notes: - * Beware using unifi_write8() because byte writes are not safe on UniFi. - * Writes to odd bytes are cached, writes to even bytes perform a 16-bit - * write with the previously cached odd byte. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_write_8_or_16(card_t *card, u32 unifi_addr, u8 data) -{ - u32 sdio_addr; - CsrResult r; -#ifdef CSR_WIFI_TRANSPORT_CSPI - u16 w; -#endif - - r = set_page(card, unifi_addr, &sdio_addr); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - if (sdio_addr & 1) - { - unifi_warning(card->ospriv, - "Warning: Byte write to an odd address (0x%lX) is dangerous\n", - sdio_addr); - } - -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - card->cmd_prof.cmd52_w8or16_count++; -#endif -#ifdef CSR_WIFI_TRANSPORT_CSPI - w = data; - return retrying_write16(card, card->function, sdio_addr, w); -#else - return retrying_write8(card, card->function, sdio_addr, data); -#endif -} /* unifi_write_8_or_16() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_card_read16 - * - * Performs a 16-bit read of the given address in shared data memory. - * Set up the shared data memory page register as required. - * - * Arguments: - * card Pointer to card structure. - * unifi_addr UniFi shared-data-memory address to access. - * pdata Pointer to a 16-bit int variable for the value read. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified - * --------------------------------------------------------------------------- - */ -CsrResult unifi_card_read16(card_t *card, u32 unifi_addr, u16 *pdata) -{ - u32 sdio_addr; - CsrResult r; - - r = set_page(card, unifi_addr, &sdio_addr); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - card->cmd_prof.cmd52_r16_count++; -#endif - return unifi_read_direct16(card, sdio_addr, pdata); -} /* unifi_card_read16() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_card_write16 - * - * Performs a 16-bit write of the given address in shared data memory. - * Set up the shared data memory page register as required. - * - * Arguments: - * card Pointer to card structure. - * unifi_addr UniFi shared-data-memory address to access. - * pdata Pointer to a byte variable for the value write. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified - * --------------------------------------------------------------------------- - */ -CsrResult unifi_card_write16(card_t *card, u32 unifi_addr, u16 data) -{ - u32 sdio_addr; - CsrResult r; - - r = set_page(card, unifi_addr, &sdio_addr); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - card->cmd_prof.cmd52_w16_count++; -#endif - return unifi_write_direct16(card, sdio_addr, data); -} /* unifi_card_write16() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_read32 - * - * Performs a 32-bit read of the given address in shared data memory. - * Set up the shared data memory page register as required. - * - * Arguments: - * card Pointer to card structure. - * unifi_addr UniFi shared-data-memory address to access. - * pdata Pointer to a int variable for the value read. - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified - * --------------------------------------------------------------------------- - */ -CsrResult unifi_read32(card_t *card, u32 unifi_addr, u32 *pdata) -{ - u32 sdio_addr; - CsrResult r; - - r = set_page(card, unifi_addr, &sdio_addr); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - card->cmd_prof.cmd52_r32_count++; -#endif - return unifi_read_direct32(card, sdio_addr, pdata); -} /* unifi_read32() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_card_readn - * unifi_readnz - * - * Read multiple 8-bit values from the UniFi SDIO interface. - * This function interprets the address as a GenericPointer as - * defined in the UniFi Host Interface Protocol Specification. - * The readnz version of this function will stop when it reads a - * zero octet. - * - * Arguments: - * card Pointer to card structure. - * unifi_addr UniFi shared-data-memory address to access. - * pdata Pointer to which to write data. - * len Number of bytes to read - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified - * --------------------------------------------------------------------------- - */ -CsrResult unifi_readn_match(card_t *card, u32 unifi_addr, void *pdata, u16 len, s8 match) -{ - u32 sdio_addr; - CsrResult r; - u32 num; - - r = set_page(card, unifi_addr, &sdio_addr); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - r = unifi_read_directn_match(card, sdio_addr, pdata, len, match, &num); - return r; -} /* unifi_readn_match() */ - - -CsrResult unifi_card_readn(card_t *card, u32 unifi_addr, void *pdata, u16 len) -{ - return unifi_readn_match(card, unifi_addr, pdata, len, -1); -} /* unifi_card_readn() */ - - -CsrResult unifi_readnz(card_t *card, u32 unifi_addr, void *pdata, u16 len) -{ - return unifi_readn_match(card, unifi_addr, pdata, len, 0); -} /* unifi_readnz() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_read_shared_count - * - * Read signal count locations, checking for an SDIO error. The - * signal count locations only contain a valid number if the - * highest bit isn't set. - * - * Arguments: - * card Pointer to card context structure. - * addr Shared-memory address to read. - * - * Returns: - * Value read from memory (0-127) or -1 on error - * --------------------------------------------------------------------------- - */ -s32 unifi_read_shared_count(card_t *card, u32 addr) -{ - u8 b; - /* I've increased this count, because I have seen cases where - * there were three reads in a row with the top bit set. I'm not - * sure why this might have happened, but I can't see a problem - * with increasing this limit. It's better to take a while to - * recover than to fail. */ -#define SHARED_READ_RETRY_LIMIT 10 - s32 i; - - /* - * Get the to-host-signals-written count. - * The top-bit will be set if the firmware was in the process of - * changing the value, in which case we read again. - */ - /* Limit the number of repeats so we don't freeze */ - for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++) - { - CsrResult r; - r = unifi_read_8_or_16(card, addr, &b); - if (r != CSR_RESULT_SUCCESS) - { - return -1; - } - if (!(b & 0x80)) - { - /* There is a chance that the MSB may have contained invalid data - * (overflow) at the time it was read. Therefore mask off the MSB. - * This avoids a race between driver read and firmware write of the - * word, the value we need is in the lower 8 bits anway. - */ - return (s32)(b & 0xff); - } - } - - return -1; /* this function has changed in WMM mods */ -} /* unifi_read_shared_count() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_writen - * - * Write multiple 8-bit values to the UniFi SDIO interface using CMD52 - * This function interprets the address as a GenericPointer as - * defined in the UniFi Host Interface Protocol Specification. - * - * Arguments: - * card Pointer to card structure. - * unifi_addr UniFi shared-data-memory address to access. - * pdata Pointer to which to write data. - * len Number of bytes to write - * - * Returns: - * 0 on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * CSR_WIFI_HIP_RESULT_INVALID_VALUE an odd length or length too big. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_writen(card_t *card, u32 unifi_addr, void *pdata, u16 len) -{ - u32 sdio_addr; - CsrResult r; - - r = set_page(card, unifi_addr, &sdio_addr); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - return unifi_write_directn(card, sdio_addr, pdata, len); -} /* unifi_writen() */ - - -static CsrResult csr_sdio_block_rw(card_t *card, s16 funcnum, - u32 addr, u8 *pdata, - u16 count, s16 dir_is_write) -{ - CsrResult csrResult; - - if (dir_is_write == UNIFI_SDIO_READ) - { -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - unifi_debug_log_to_buf("r@%02X#%X=", addr, count); -#endif -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - unifi_debug_log_to_buf("R"); -#endif - csrResult = CsrSdioRead(card->sdio_if, addr, pdata, count); -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - unifi_debug_log_to_buf("<"); -#endif - } - else - { -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - unifi_debug_log_to_buf("w@%02X#%X=", addr, count); - unifi_debug_hex_to_buf(pdata, count > CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH?CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH : count); -#endif -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - unifi_debug_log_to_buf("W"); -#endif - csrResult = CsrSdioWrite(card->sdio_if, addr, pdata, count); -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - unifi_debug_log_to_buf(">"); -#endif - } -#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE - card->cmd_prof.cmd53_count++; -#endif -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE) - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_debug_log_to_buf("error=%X", csrResult); - } - else if (dir_is_write == UNIFI_SDIO_READ) - { - unifi_debug_hex_to_buf(pdata, count > CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH?CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH : count); - } - unifi_debug_string_to_buf("\n"); -#endif - return csrResult; /* CSR SDIO (not HIP) error code */ -} - - -/* - * --------------------------------------------------------------------------- - * unifi_bulk_rw - * - * Transfer bulk data to or from the UniFi SDIO interface. - * This function is used to read or write signals and bulk data. - * - * Arguments: - * card Pointer to card structure. - * handle Value to put in the Register Address field of the CMD53 req. - * data Pointer to data to write. - * direction One of UNIFI_SDIO_READ or UNIFI_SDIO_WRITE - * - * Returns: - * CSR_RESULT_SUCCESS on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * - * Notes: - * This function uses SDIO CMD53, which is the block transfer mode. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_bulk_rw(card_t *card, u32 handle, void *pdata, - u32 len, s16 direction) -{ -#define CMD53_RETRIES 3 - /* - * Ideally instead of sleeping, we want to busy wait. - * Currently there is no framework API to do this. When it becomes available, - * we can use it to busy wait using usecs - */ -#define REWIND_RETRIES 15 /* when REWIND_DELAY==1msec, or 250 when REWIND_DELAY==50usecs */ -#define REWIND_POLLING_RETRIES 5 -#define REWIND_DELAY 1 /* msec or 50usecs */ - CsrResult csrResult; /* SDIO error code */ - CsrResult r = CSR_RESULT_SUCCESS; /* HIP error code */ - s16 retries = CMD53_RETRIES; - s16 stat_retries; - u8 stat; - s16 dump_read; -#ifdef UNIFI_DEBUG - u8 *pdata_lsb = ((u8 *)&pdata) + card->lsb; -#endif -#ifdef CSR_WIFI_MAKE_FAKE_CMD53_ERRORS - static s16 fake_error; -#endif - - dump_read = 0; -#ifdef UNIFI_DEBUG - if (*pdata_lsb & 1) - { - unifi_notice(card->ospriv, "CD53 request on a unaligned buffer (addr: 0x%X) dir %s-Host\n", - pdata, (direction == UNIFI_SDIO_READ)?"To" : "From"); - if (direction == UNIFI_SDIO_WRITE) - { - dump(pdata, (u16)len); - } - else - { - dump_read = 1; - } - } -#endif - - /* Defensive checks */ - if (!pdata) - { - unifi_error(card->ospriv, "Null pdata for unifi_bulk_rw() len: %d\n", len); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - if ((len & 1) || (len > 0xffff)) - { - unifi_error(card->ospriv, "Impossible CMD53 length requested: %d\n", len); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - while (1) - { - csrResult = csr_sdio_block_rw(card, card->function, handle, - (u8 *)pdata, (u16)len, - direction); - if (csrResult == CSR_SDIO_RESULT_NO_DEVICE) - { - return CSR_WIFI_HIP_RESULT_NO_DEVICE; - } -#ifdef CSR_WIFI_MAKE_FAKE_CMD53_ERRORS - if (++fake_error > 100) - { - fake_error = 90; - unifi_warning(card->ospriv, "Faking a CMD53 error,\n"); - if (csrResult == CSR_RESULT_SUCCESS) - { - csrResult = CSR_RESULT_FAILURE; - } - } -#endif - if (csrResult == CSR_RESULT_SUCCESS) - { - if (dump_read) - { - dump(pdata, (u16)len); - } - break; - } - - /* - * At this point the SDIO driver should have written the I/O Abort - * register to notify UniFi that the command has failed. - * UniFi-1 and UniFi-2 (not UF6xxx) use the same register to store the - * Deep Sleep State. This means we have to restore the Deep Sleep - * State (AWAKE in any case since we can not perform a CD53 in any other - * state) by rewriting the I/O Abort register to its previous value. - */ - if (card->chip_id <= SDIO_CARD_ID_UNIFI_2) - { - (void)unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); - } - - /* If csr_sdio_block_rw() failed in a non-retryable way, or retries exhausted - * then stop retrying - */ - if (!retryable_sdio_error(csrResult)) - { - unifi_error(card->ospriv, "Fatal error in a CMD53 transfer\n"); - break; - } - - /* - * These happen from time to time, try again - */ - if (--retries == 0) - { - break; - } - - unifi_trace(card->ospriv, UDBG4, - "Error in a CMD53 transfer, retrying (h:%d,l:%u)...\n", - (s16)handle & 0xff, len); - - /* The transfer failed, rewind and try again */ - r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 8, - (u8)(handle & 0xff)); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - /* - * If we can't even do CMD52 (register read/write) then - * stop here. - */ - unifi_error(card->ospriv, "Failed to write REWIND cmd\n"); - return r; - } - - /* Signal the UniFi to look for the rewind request. */ - r = CardGenInt(card); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - /* Wait for UniFi to acknowledge the rewind */ - stat_retries = REWIND_RETRIES; - while (1) - { - r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 8, &stat); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read REWIND status\n"); - return CSR_RESULT_FAILURE; - } - - if (stat == 0) - { - break; - } - if (--stat_retries == 0) - { - unifi_error(card->ospriv, "Timeout waiting for REWIND ready\n"); - return CSR_RESULT_FAILURE; - } - - /* Poll for the ack a few times */ - if (stat_retries < REWIND_RETRIES - REWIND_POLLING_RETRIES) - { - CsrThreadSleep(REWIND_DELAY); - } - } - } - - /* The call to csr_sdio_block_rw() still failed after retrying */ - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Block %s failed after %d retries\n", - (direction == UNIFI_SDIO_READ)?"read" : "write", - CMD53_RETRIES - retries); - /* Report any SDIO error as a general i/o error */ - return CSR_RESULT_FAILURE; - } - - /* Collect some stats */ - if (direction == UNIFI_SDIO_READ) - { - card->sdio_bytes_read += len; - } - else - { - card->sdio_bytes_written += len; - } - - return CSR_RESULT_SUCCESS; -} /* unifi_bulk_rw() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_bulk_rw_noretry - * - * Transfer bulk data to or from the UniFi SDIO interface. - * This function is used to read or write signals and bulk data. - * - * Arguments: - * card Pointer to card structure. - * handle Value to put in the Register Address field of - * the CMD53 req. - * data Pointer to data to write. - * direction One of UNIFI_SDIO_READ or UNIFI_SDIO_WRITE - * - * Returns: - * 0 on success, non-zero error code on error: - * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected - * CSR_RESULT_FAILURE an SDIO error occurred - * - * Notes: - * This function uses SDIO CMD53, which is the block transfer mode. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_bulk_rw_noretry(card_t *card, u32 handle, void *pdata, - u32 len, s16 direction) -{ - CsrResult csrResult; - - csrResult = csr_sdio_block_rw(card, card->function, handle, - (u8 *)pdata, (u16)len, direction); - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Block %s failed\n", - (direction == UNIFI_SDIO_READ)?"read" : "write"); - return csrResult; - } - - return CSR_RESULT_SUCCESS; -} /* unifi_bulk_rw_noretry() */ - - diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.c b/drivers/staging/csr/csr_wifi_hip_chiphelper.c deleted file mode 100644 index 5cf5b8a5a1e1..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.c +++ /dev/null @@ -1,793 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include "csr_macro.h" -#include "csr_wifi_hip_chiphelper_private.h" - -#ifndef nelem -#define nelem(a) (sizeof(a) / sizeof(a[0])) -#endif - -#define counted(foo) { nelem(foo), foo } -#define null_counted() { 0, NULL } - -/* The init values are a set of register writes that we must - perform when we first connect to the chip to get it working. - They swicth on the correct clocks and possibly set the host - interface as a wkaeup source. They should not be used if - proper HIP opperation is required, but are useful before we - do a code download. */ -static const struct chip_helper_init_values init_vals_v1[] = { - { 0xFDBB, 0xFFFF }, - { 0xFDB6, 0x03FF }, - { 0xFDB1, 0x01E3 }, - { 0xFDB3, 0x0FFF }, - { 0xFEE3, 0x08F0 }, - { 0xFEE7, 0x3C3F }, - { 0xFEE6, 0x0050 }, - { 0xFDBA, 0x0000 } -}; - -static const struct chip_helper_init_values init_vals_v2[] = { - { 0xFDB6, 0x0FFF }, - { 0xF023, 0x3F3F }, - { 0xFDB1, 0x01E3 }, - { 0xFDB3, 0x0FFF }, - { 0xF003, 0x08F0 }, - { 0xF007, 0x3C3F }, - { 0xF006, 0x0050 } -}; - - -static const struct chip_helper_init_values init_vals_v22_v23[] = { - { 0xF81C, 0x00FF }, - /*{ 0x????, 0x???? }, */ - { 0xF80C, 0x1FFF }, - { 0xFA25, 0x001F }, - { 0xF804, 0x00FF }, - { 0xF802, 0x0FFF }, - /*{ 0x????, 0x???? }, - { 0x????, 0x???? }, - { 0x????, 0x???? }*/ -}; - -static const u16 reset_program_a_v1_or_v2[] = { - 0x0000 -}; -static const u16 reset_program_b_v1_or_v2[] = { - 0x0010, 0xFE00, 0xA021, 0xFF00, 0x8111, 0x0009, 0x0CA4, 0x0114, - 0x0280, 0x04F8, 0xFE00, 0x6F25, 0x06E0, 0x0010, 0xFC00, 0x0121, - 0xFC00, 0x0225, 0xFE00, 0x7125, 0xFE00, 0x6D11, 0x03F0, 0xFE00, - 0x6E25, 0x0008, 0x00E0 -}; - -static const struct chip_helper_reset_values reset_program_v1_or_v2[] = -{ - { - MAKE_GP(REGISTERS, 0x000C), - nelem(reset_program_a_v1_or_v2), - reset_program_a_v1_or_v2 - }, - { - MAKE_GP(MAC_PMEM, 0x000000), - nelem(reset_program_b_v1_or_v2), - reset_program_b_v1_or_v2 - } -}; - -static const struct chip_map_address_t unifi_map_address_v1_v2[] = -{ - { 0xFE9F, 0xFE7B }, /* PM1_BANK_SELECT */ - { 0xFE9E, 0xFE78 }, /* PM2_BANK_SELECT */ - { 0xFE9D, 0xFE7E }, /* SHARED_DMEM_PAGE */ - { 0xFE91, 0xFE90 }, /* PROC_SELECT */ - { 0xFE8D, 0xFE8C }, /* STOP_STATUS */ -}; - -static const struct chip_map_address_t unifi_map_address_v22_v23[] = -{ - { 0xF8F9, 0xF8AC }, /* GW1_CONFIG */ - { 0xF8FA, 0xF8AD }, /* GW2_CONFIG */ - { 0xF8FB, 0xF8AE }, /* GW3_CONFIG */ - { 0xF830, 0xF81E }, /* PROC_SELECT */ - { 0xF831, 0xF81F }, /* STOP_STATUS */ - { 0xF8FC, 0xF8AF }, /* IO_LOG_ADDRESS */ -}; - -static const struct chip_device_regs_t unifi_device_regs_null = -{ - 0xFE81, /* GBL_CHIP_VERSION */ - 0x0000, /* GBL_MISC_ENABLES */ - 0x0000, /* DBG_EMU_CMD */ - { - 0x0000, /* HOST.DBG_PROC_SELECT */ - 0x0000, /* HOST.DBG_STOP_STATUS */ - 0x0000, /* HOST.WINDOW1_PAGE */ - 0x0000, /* HOST.WINDOW2_PAGE */ - 0x0000, /* HOST.WINDOW3_PAGE */ - 0x0000 /* HOST.IO_LOG_ADDR */ - }, - { - 0x0000, /* SPI.DBG_PROC_SELECT */ - 0x0000, /* SPI.DBG_STOP_STATUS */ - 0x0000, /* SPI.WINDOW1_PAGE */ - 0x0000, /* SPI.WINDOW2_PAGE */ - 0x0000, /* SPI.WINDOW3_PAGE */ - 0x0000 /* SPI.IO_LOG_ADDR */ - }, - 0x0000, /* DBG_RESET */ - 0x0000, /* > DBG_RESET_VALUE */ - 0x0000, /* DBG_RESET_WARN */ - 0x0000, /* DBG_RESET_WARN_VALUE */ - 0x0000, /* DBG_RESET_RESULT */ - 0xFFE9, /* XAP_PCH */ - 0xFFEA, /* XAP_PCL */ - 0x0000, /* PROC_PC_SNOOP */ - 0x0000, /* WATCHDOG_DISABLE */ - 0x0000, /* MAILBOX0 */ - 0x0000, /* MAILBOX1 */ - 0x0000, /* MAILBOX2 */ - 0x0000, /* MAILBOX3 */ - 0x0000, /* SDIO_HOST_INT */ - 0x0000, /* SHARED_IO_INTERRUPT */ - 0x0000, /* SDIO HIP HANDSHAKE */ - 0x0000 /* COEX_STATUS */ -}; - -/* UF105x */ -static const struct chip_device_regs_t unifi_device_regs_v1 = -{ - 0xFE81, /* GBL_CHIP_VERSION */ - 0xFE87, /* GBL_MISC_ENABLES */ - 0xFE9C, /* DBG_EMU_CMD */ - { - 0xFE90, /* HOST.DBG_PROC_SELECT */ - 0xFE8C, /* HOST.DBG_STOP_STATUS */ - 0xFE7B, /* HOST.WINDOW1_PAGE */ - 0xFE78, /* HOST.WINDOW2_PAGE */ - 0xFE7E, /* HOST.WINDOW3_PAGE */ - 0x0000 /* HOST.IO_LOG_ADDR */ - }, - { - 0xFE91, /* SPI.DBG_PROC_SELECT */ - 0xFE8D, /* SPI.DBG_STOP_STATUS */ - 0xFE9F, /* SPI.WINDOW1_PAGE */ - 0xFE9E, /* SPI.WINDOW2_PAGE */ - 0xFE9D, /* SPI.WINDOW3_PAGE */ - 0x0000 /* SPI.IO_LOG_ADDR */ - }, - 0xFE92, /* DBG_RESET */ - 0x0001, /* > DBG_RESET_VALUE */ - 0xFDA0, /* DBG_RESET_WARN (HOST_SELECT) */ - 0x0000, /* DBG_RESET_WARN_VALUE */ - 0xFE92, /* DBG_RESET_RESULT */ - 0xFFE9, /* XAP_PCH */ - 0xFFEA, /* XAP_PCL */ - 0x0051, /* PROC_PC_SNOOP */ - 0xFE70, /* WATCHDOG_DISABLE */ - 0xFE6B, /* MAILBOX0 */ - 0xFE6A, /* MAILBOX1 */ - 0xFE69, /* MAILBOX2 */ - 0xFE68, /* MAILBOX3 */ - 0xFE67, /* SDIO_HOST_INT */ - 0xFE65, /* SHARED_IO_INTERRUPT */ - 0xFDE9, /* SDIO HIP HANDSHAKE */ - 0x0000 /* COEX_STATUS */ -}; - -/* UF2... */ -static const struct chip_device_regs_t unifi_device_regs_v2 = -{ - 0xFE81, /* GBL_CHIP_VERSION */ - 0xFE87, /* GBL_MISC_ENABLES */ - 0xFE9C, /* DBG_EMU_CMD */ - { - 0xFE90, /* HOST.DBG_PROC_SELECT */ - 0xFE8C, /* HOST.DBG_STOP_STATUS */ - 0xFE7B, /* HOST.WINDOW1_PAGE */ - 0xFE78, /* HOST.WINDOW2_PAGE */ - 0xFE7E, /* HOST.WINDOW3_PAGE */ - 0x0000 /* HOST.IO_LOG_ADDR */ - }, - { - 0xFE91, /* SPI.DBG_PROC_SELECT */ - 0xFE8D, /* SPI.DBG_STOP_STATUS */ - 0xFE9F, /* SPI.WINDOW1_PAGE */ - 0xFE9E, /* SPI.WINDOW2_PAGE */ - 0xFE9D, /* SPI.WINDOW3_PAGE */ - 0x0000 /* SPI.IO_LOG_ADDR */ - }, - 0xFE92, /* DBG_RESET */ - 0x0000, /* > DBG_RESET_VALUE */ - 0xFDE9, /* DBG_RESET_WARN (TEST_FLASH_DATA - SHARED_MAILBOX2B) */ - 0xFFFF, /* DBG_RESET_WARN_VALUE */ - 0xFDE9, /* DBG_RESET_RESULT (TEST_FLASH_DATA) */ - 0xFFE9, /* XAP_PCH */ - 0xFFEA, /* XAP_PCL */ - 0x0051, /* PROC_PC_SNOOP */ - 0xFE70, /* WATCHDOG_DISABLE */ - 0xFE6B, /* MAILBOX0 */ - 0xFE6A, /* MAILBOX1 */ - 0xFE69, /* MAILBOX2 */ - 0xFE68, /* MAILBOX3 */ - 0xFE67, /* SDIO_HOST_INT */ - 0xFE65, /* SHARED_IO_INTERRUPT */ - 0xFE69, /* SDIO HIP HANDSHAKE */ - 0x0000 /* COEX_STATUS */ -}; - -/* UF60xx */ -static const struct chip_device_regs_t unifi_device_regs_v22_v23 = -{ - 0xFE81, /* GBL_CHIP_VERSION */ - 0xF84F, /* GBL_MISC_ENABLES */ - 0xF81D, /* DBG_EMU_CMD */ - { - 0xF81E, /* HOST.DBG_PROC_SELECT */ - 0xF81F, /* HOST.DBG_STOP_STATUS */ - 0xF8AC, /* HOST.WINDOW1_PAGE */ - 0xF8AD, /* HOST.WINDOW2_PAGE */ - 0xF8AE, /* HOST.WINDOW3_PAGE */ - 0xF8AF /* HOST.IO_LOG_ADDR */ - }, - { - 0xF830, /* SPI.DBG_PROC_SELECT */ - 0xF831, /* SPI.DBG_STOP_STATUS */ - 0xF8F9, /* SPI.WINDOW1_PAGE */ - 0xF8FA, /* SPI.WINDOW2_PAGE */ - 0xF8FB, /* SPI.WINDOW3_PAGE */ - 0xF8FC /* SPI.IO_LOG_ADDR */ - }, - 0xF82F, /* DBG_RESET */ - 0x0001, /* > DBG_RESET_VALUE */ - 0x0000, /* DBG_RESET_WARN */ - 0x0000, /* DBG_RESET_WARN_VALUE */ - 0xF82F, /* DBG_RESET_RESULT */ - 0xFFE9, /* XAP_PCH */ - 0xFFEA, /* XAP_PCL */ - 0x001B, /* PROC_PC_SNOOP */ - 0x0055, /* WATCHDOG_DISABLE */ - 0xF84B, /* MAILBOX0 */ - 0xF84C, /* MAILBOX1 */ - 0xF84D, /* MAILBOX2 */ - 0xF84E, /* MAILBOX3 */ - 0xF92F, /* SDIO_HOST_INT */ - 0xF92B, /* SDIO_FROMHOST_SCRTACH0 / SHARED_IO_INTERRUPT */ - 0xF84D, /* SDIO HIP HANDSHAKE (MAILBOX2) */ - 0xF9FB /* COEX_STATUS */ -}; - -/* Program memory window on UF105x. */ -static const struct window_shift_info_t prog_window_array_unifi_v1_v2[CHIP_HELPER_WT_COUNT] = -{ - { TRUE, 11, 0x0200 }, /* CODE RAM */ - { TRUE, 11, 0x0000 }, /* FLASH */ - { TRUE, 11, 0x0400 }, /* External SRAM */ - { FALSE, 0, 0 }, /* ROM */ - { FALSE, 0, 0 } /* SHARED */ -}; - -/* Shared memory window on UF105x. */ -static const struct window_shift_info_t shared_window_array_unifi_v1_v2[CHIP_HELPER_WT_COUNT] = -{ - { FALSE, 0, 0 }, /* CODE RAM */ - { FALSE, 0, 0 }, /* FLASH */ - { FALSE, 0, 0 }, /* External SRAM */ - { FALSE, 0, 0 }, /* ROM */ - { TRUE, 11, 0x0000 } /* SHARED */ -}; - -/* One of the Generic Windows on UF60xx and later. */ -static const struct window_shift_info_t generic_window_array_unifi_v22_v23[CHIP_HELPER_WT_COUNT] = -{ - { TRUE, 11, 0x3800 }, /* CODE RAM */ - { FALSE, 0, 0 }, /* FLASH */ - { FALSE, 0, 0 }, /* External SRAM */ - { TRUE, 11, 0x2000 }, /* ROM */ - { TRUE, 11, 0x0000 } /* SHARED */ -}; - -/* The three windows on UF105x. */ -static const struct window_info_t prog1_window_unifi_v1_v2 = { 0x0000, 0x2000, 0x0080, prog_window_array_unifi_v1_v2 }; -static const struct window_info_t prog2_window_unifi_v1_v2 = { 0x2000, 0x2000, 0x0000, prog_window_array_unifi_v1_v2 }; -static const struct window_info_t shared_window_unifi_v1_v2 = { 0x4000, 0x2000, 0x0000, shared_window_array_unifi_v1_v2 }; - -/* The three windows on UF60xx and later. */ -static const struct window_info_t generic1_window_unifi_v22_v23 = { 0x0000, 0x2000, 0x0080, generic_window_array_unifi_v22_v23 }; -static const struct window_info_t generic2_window_unifi_v22_v23 = { 0x2000, 0x2000, 0x0000, generic_window_array_unifi_v22_v23 }; -static const struct window_info_t generic3_window_unifi_v22_v23 = { 0x4000, 0x2000, 0x0000, generic_window_array_unifi_v22_v23 }; - -static const struct chip_device_desc_t chip_device_desc_null = -{ - { FALSE, 0x0000, 0x0000, 0x00 }, - "", - "", - null_counted(), /* init */ - null_counted(), /* reset_prog */ - &unifi_device_regs_null, /* regs */ - { - FALSE, /* has_flash */ - FALSE, /* has_ext_sram */ - FALSE, /* has_rom */ - FALSE, /* has_bt */ - FALSE, /* has_wlan */ - }, - null_counted(), - /* prog_offset */ - { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 - }, - /* data_offset */ - { - 0x0000 /* ram */ - }, - /* windows */ - { - NULL, - NULL, - NULL - } -}; - -static const struct chip_device_desc_t unifi_device_desc_v1 = -{ - { FALSE, 0xf0ff, 0x1001, 0x01 }, /* UF105x R01 */ - "UF105x", - "UniFi-1", - counted(init_vals_v1), /* init */ - counted(reset_program_v1_or_v2), /* reset_prog */ - &unifi_device_regs_v1, /* regs */ - { - TRUE, /* has_flash */ - TRUE, /* has_ext_sram */ - FALSE, /* has_rom */ - FALSE, /* has_bt */ - TRUE, /* has_wlan */ - }, - counted(unifi_map_address_v1_v2), /* map */ - /* prog_offset */ - { - 0x00100000, /* ram */ - 0x00000000, /* rom (invalid) */ - 0x00000000, /* flash */ - 0x00200000, /* ext_ram */ - }, - /* data_offset */ - { - 0x8000 /* ram */ - }, - /* windows */ - { - &prog1_window_unifi_v1_v2, - &prog2_window_unifi_v1_v2, - &shared_window_unifi_v1_v2 - } -}; - -static const struct chip_device_desc_t unifi_device_desc_v2 = -{ - { FALSE, 0xf0ff, 0x2001, 0x02 }, /* UF2... R02 */ - "UF2...", - "UniFi-2", - counted(init_vals_v2), /* init */ - counted(reset_program_v1_or_v2), /* reset_prog */ - &unifi_device_regs_v2, /* regs */ - { - TRUE, /* has_flash */ - TRUE, /* has_ext_sram */ - FALSE, /* has_rom */ - FALSE, /* has_bt */ - TRUE, /* has_wlan */ - }, - counted(unifi_map_address_v1_v2), /* map */ - /* prog_offset */ - { - 0x00100000, /* ram */ - 0x00000000, /* rom (invalid) */ - 0x00000000, /* flash */ - 0x00200000, /* ext_ram */ - }, - /* data_offset */ - { - 0x8000 /* ram */ - }, - /* windows */ - { - &prog1_window_unifi_v1_v2, - &prog2_window_unifi_v1_v2, - &shared_window_unifi_v1_v2 - } -}; - -static const struct chip_device_desc_t unifi_device_desc_v3 = -{ - { FALSE, 0xf0ff, 0x3001, 0x02 }, /* UF2... R03 */ - "UF2...", - "UniFi-3", - counted(init_vals_v2), /* init */ - counted(reset_program_v1_or_v2), /* reset_prog */ - &unifi_device_regs_v2, /* regs */ - { - TRUE, /* has_flash */ - TRUE, /* has_ext_sram */ - FALSE, /* has_rom */ - FALSE, /* has_bt */ - TRUE, /* has_wlan */ - }, - counted(unifi_map_address_v1_v2), /* map */ - /* prog_offset */ - { - 0x00100000, /* ram */ - 0x00000000, /* rom (invalid) */ - 0x00000000, /* flash */ - 0x00200000, /* ext_ram */ - }, - /* data_offset */ - { - 0x8000 /* ram */ - }, - /* windows */ - { - &prog1_window_unifi_v1_v2, - &prog2_window_unifi_v1_v2, - &shared_window_unifi_v1_v2 - } -}; - -static const struct chip_device_desc_t unifi_device_desc_v22 = -{ - { FALSE, 0x00ff, 0x0022, 0x07 }, /* UF60xx */ - "UF60xx", - "UniFi-4", - counted(init_vals_v22_v23), /* init */ - null_counted(), /* reset_prog */ - &unifi_device_regs_v22_v23, /* regs */ - { - FALSE, /* has_flash */ - FALSE, /* has_ext_sram */ - TRUE, /* has_rom */ - FALSE, /* has_bt */ - TRUE, /* has_wlan */ - }, - counted(unifi_map_address_v22_v23), /* map */ - /* prog_offset */ - { - 0x00C00000, /* ram */ - 0x00000000, /* rom */ - 0x00000000, /* flash (invalid) */ - 0x00000000, /* ext_ram (invalid) */ - }, - /* data_offset */ - { - 0x8000 /* ram */ - }, - /* windows */ - { - &generic1_window_unifi_v22_v23, - &generic2_window_unifi_v22_v23, - &generic3_window_unifi_v22_v23 - } -}; - -static const struct chip_device_desc_t unifi_device_desc_v23 = -{ - { FALSE, 0x00ff, 0x0023, 0x08 }, /* UF.... */ - "UF....", - "UF.... (5)", - counted(init_vals_v22_v23), /* init */ - null_counted(), /* reset_prog */ - &unifi_device_regs_v22_v23, /* regs */ - { - FALSE, /* has_flash */ - FALSE, /* has_ext_sram */ - TRUE, /* has_rom */ - TRUE, /* has_bt */ - TRUE, /* has_wlan */ - }, - counted(unifi_map_address_v22_v23), - /* prog_offset */ - { - 0x00C00000, /* ram */ - 0x00000000, /* rom */ - 0x00000000, /* flash (invalid) */ - 0x00000000, /* ext_sram (invalid) */ - }, - /* data_offset */ - { - 0x8000 /* ram */ - }, - /* windows */ - { - &generic1_window_unifi_v22_v23, - &generic2_window_unifi_v22_v23, - &generic3_window_unifi_v22_v23 - } -}; - -static const struct chip_device_desc_t hyd_wlan_subsys_desc_v1 = -{ - { FALSE, 0x00ff, 0x0044, 0x00 }, /* UF.... */ - "HYD...", - "HYD... ", - counted(init_vals_v22_v23), /* init */ - null_counted(), /* reset_prog */ - &unifi_device_regs_v22_v23, /* regs */ - { - FALSE, /* has_flash */ - FALSE, /* has_ext_sram */ - TRUE, /* has_rom */ - FALSE, /* has_bt */ - TRUE, /* has_wlan */ - }, - counted(unifi_map_address_v22_v23), - /* prog_offset */ - { - 0x00C00000, /* ram */ - 0x00000000, /* rom */ - 0x00000000, /* flash (invalid) */ - 0x00000000, /* ext_sram (invalid) */ - }, - /* data_offset */ - { - 0x8000 /* ram */ - }, - /* windows */ - { - &generic1_window_unifi_v22_v23, - &generic2_window_unifi_v22_v23, - &generic3_window_unifi_v22_v23 - } -}; - - -/* This is the list of all chips that we know about. I'm - assuming that the order here will be important - we - might have multiple entries witrh the same SDIO id for - instance. The first one in this list will be the one - that is returned if a search is done on only that id. - The client will then have to call GetVersionXXX again - but with more detailed info. - - I don't know if we need to signal this up to the client - in some way? - - (We get the SDIO id before we know anything else about - the chip. We might not be able to read any of the other - registers at first, but we still need to know about the - chip). */ -static const struct chip_device_desc_t *chip_ver_to_desc[] = -{ - &unifi_device_desc_v1, /* UF105x R01 */ - &unifi_device_desc_v2, /* UF2... R02 */ - &unifi_device_desc_v3, /* UF2... R03 */ - &unifi_device_desc_v22, /* UF60xx */ - &unifi_device_desc_v23, /* UF.... */ - &hyd_wlan_subsys_desc_v1 -}; - -ChipDescript* ChipHelper_GetVersionSdio(u8 sdio_ver) -{ - u32 i; - - for (i = 0; i < nelem(chip_ver_to_desc); i++) - { - if (chip_ver_to_desc[i]->chip_version.sdio == sdio_ver) - { - return chip_ver_to_desc[i]; - } - } - - return &chip_device_desc_null; -} - - -ChipDescript* ChipHelper_GetVersionAny(u16 from_FF9A, u16 from_FE81) -{ - u32 i; - - if ((from_FF9A & 0xFF00) != 0) - { - for (i = 0; i < nelem(chip_ver_to_desc); i++) - { - if (chip_ver_to_desc[i]->chip_version.pre_bc7 && - ((from_FF9A & chip_ver_to_desc[i]->chip_version.mask) == - chip_ver_to_desc[i]->chip_version.result)) - { - return chip_ver_to_desc[i]; - } - } - } - else - { - for (i = 0; i < nelem(chip_ver_to_desc); i++) - { - if (!chip_ver_to_desc[i]->chip_version.pre_bc7 && - ((from_FE81 & chip_ver_to_desc[i]->chip_version.mask) == - chip_ver_to_desc[i]->chip_version.result)) - { - return chip_ver_to_desc[i]; - } - } - } - - return &chip_device_desc_null; -} - - -ChipDescript* ChipHelper_GetVersionUniFi(u16 ver) -{ - return ChipHelper_GetVersionAny(0x0000, ver); -} - - -ChipDescript *ChipHelper_Null(void) -{ - return &chip_device_desc_null; -} - - -ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age bc_age, u16 version) -{ - if (bc_age == chip_helper_bluecore_pre_bc7) - { - return ChipHelper_GetVersionAny(version, 0x0000); - } - else - { - return ChipHelper_GetVersionAny(0x0000, version); - } -} - - -/* Expand the DEF0 functions into simple code to return the - correct thing. The DEF1 functions expand to nothing in - this X macro expansion. */ -#define CHIP_HELPER_DEF0_C_DEF(ret_type, name, info) \ - ret_type ChipHelper_ ## name(ChipDescript * chip_help) \ - { \ - return chip_help->info; \ - } -#define CHIP_HELPER_DEF1_C_DEF(ret_type, name, type1, name1) - -CHIP_HELPER_LIST(C_DEF) - -/* - * Map register addresses between HOST and SPI access. - */ -u16 ChipHelper_MapAddress_SPI2HOST(ChipDescript *chip_help, u16 addr) -{ - u32 i; - for (i = 0; i < chip_help->map.len; i++) - { - if (chip_help->map.vals[i].spi == addr) - { - return chip_help->map.vals[i].host; - } - } - return addr; -} - - -u16 ChipHelper_MapAddress_HOST2SPI(ChipDescript *chip_help, u16 addr) -{ - u32 i; - for (i = 0; i < chip_help->map.len; i++) - { - if (chip_help->map.vals[i].host == addr) - { - return chip_help->map.vals[i].spi; - } - } - return addr; -} - - -/* The address returned by this function is the start of the - window in the address space, that is where we can start - accessing data from. If a section of the window at the - start is unusable because something else is cluttering up - the address map then that is taken into account and this - function returns that address justt past that. */ -u16 ChipHelper_WINDOW_ADDRESS(ChipDescript *chip_help, - enum chip_helper_window_index window) -{ - if (window < CHIP_HELPER_WINDOW_COUNT && - chip_help->windows[window] != NULL) - { - return chip_help->windows[window]->address + chip_help->windows[window]->blocked; - } - return 0; -} - - -/* This returns the size of the window minus any blocked section */ -u16 ChipHelper_WINDOW_SIZE(ChipDescript *chip_help, - enum chip_helper_window_index window) -{ - if (window < CHIP_HELPER_WINDOW_COUNT && - chip_help->windows[window] != NULL) - { - return chip_help->windows[window]->size - chip_help->windows[window]->blocked; - } - return 0; -} - - -/* Get the register writes we should do to make sure that - the chip is running with most clocks on. */ -u32 ChipHelper_ClockStartupSequence(ChipDescript *chip_help, - const struct chip_helper_init_values **val) -{ - *val = chip_help->init.vals; - return chip_help->init.len; -} - - -/* Get the set of values tat we should write to the chip to perform a reset. */ -u32 ChipHelper_HostResetSequence(ChipDescript *chip_help, - const struct chip_helper_reset_values **val) -{ - *val = chip_help->reset_prog.vals; - return chip_help->reset_prog.len; -} - - -/* Decode a windowed access to the chip. */ -s32 ChipHelper_DecodeWindow(ChipDescript *chip_help, - enum chip_helper_window_index window, - enum chip_helper_window_type type, - u32 offset, - u16 *page, u16 *addr, u32 *len) -{ - const struct window_info_t *win; - const struct window_shift_info_t *mode; - u16 of, pg; - - if (window >= CHIP_HELPER_WINDOW_COUNT) - { - return FALSE; - } - if ((win = chip_help->windows[window]) == NULL) - { - return FALSE; - } - if (type >= CHIP_HELPER_WT_COUNT) - { - return FALSE; - } - if ((mode = &win->mode[type]) == NULL) - { - return FALSE; - } - if (!mode->allowed) - { - return FALSE; - } - - pg = (u16)(offset >> mode->page_shift) + mode->page_offset; - of = (u16)(offset & ((1 << mode->page_shift) - 1)); - /* If 'blocked' is zero this does nothing, else decrease - the page register and increase the offset until we aren't - in the blocked region of the window. */ - while (of < win->blocked) - { - of += 1 << mode->page_shift; - pg--; - } - *page = pg; - *addr = win->address + of; - *len = win->size - of; - return TRUE; -} - - diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.h b/drivers/staging/csr/csr_wifi_hip_chiphelper.h deleted file mode 100644 index 09b3aefcbced..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper.h +++ /dev/null @@ -1,407 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifndef CSR_WIFI_HIP_CHIPHELPER_H__ -#define CSR_WIFI_HIP_CHIPHELPER_H__ - - -#include <linux/types.h> - -/* The age of the BlueCore chip. This is probably not useful, if - you know the age then you can probably work out the version directly. */ -enum chip_helper_bluecore_age -{ - chip_helper_bluecore_pre_bc7, - chip_helper_bluecore_bc7_or_later -}; - -/* We support up to three windowed regions at the moment. - Don't reorder these - they're used to index into an array. */ -enum chip_helper_window_index -{ - CHIP_HELPER_WINDOW_1 = 0, - CHIP_HELPER_WINDOW_2 = 1, - CHIP_HELPER_WINDOW_3 = 2, - CHIP_HELPER_WINDOW_COUNT = 3 -}; - -/* These are the things that we can access through a window. - Don't reorder these - they're used to index into an array. */ -enum chip_helper_window_type -{ - CHIP_HELPER_WT_CODE_RAM = 0, - CHIP_HELPER_WT_FLASH = 1, - CHIP_HELPER_WT_EXT_SRAM = 2, - CHIP_HELPER_WT_ROM = 3, - CHIP_HELPER_WT_SHARED = 4, - CHIP_HELPER_WT_COUNT = 5 -}; - -/* Commands to stop and start the XAP */ -enum chip_helper_dbg_emu_cmd_enum -{ - CHIP_HELPER_DBG_EMU_CMD_XAP_STEP_MASK = 0x0001, - CHIP_HELPER_DBG_EMU_CMD_XAP_RUN_B_MASK = 0x0002, - CHIP_HELPER_DBG_EMU_CMD_XAP_BRK_MASK = 0x0004, - CHIP_HELPER_DBG_EMU_CMD_XAP_WAKEUP_MASK = 0x0008 -}; - -/* Bitmasks for Stop and sleep status: DBG_SPI_STOP_STATUS & DBG_HOST_STOP_STATUS */ -enum chip_helper_dbg_stop_status_enum -{ - CHIP_HELPER_DBG_STOP_STATUS_NONE_MASK = 0x0000, - CHIP_HELPER_DBG_STOP_STATUS_P0_MASK = 0x0001, - CHIP_HELPER_DBG_STOP_STATUS_P1_MASK = 0x0002, - CHIP_HELPER_DBG_STOP_STATUS_P2_MASK = 0x0004, - CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_P0_MASK = 0x0008, - CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_P1_MASK = 0x0010, - CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_P2_MASK = 0x0020, - /* Legacy names/alias */ - CHIP_HELPER_DBG_STOP_STATUS_MAC_MASK = 0x0001, - CHIP_HELPER_DBG_STOP_STATUS_PHY_MASK = 0x0002, - CHIP_HELPER_DBG_STOP_STATUS_BT_MASK = 0x0004, - CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_MAC_MASK = 0x0008, - CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_PHY_MASK = 0x0010, - CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_BT_MASK = 0x0020 -}; - -/* Codes to disable the watchdog */ -enum chip_helper_watchdog_disable_enum -{ - CHIP_HELPER_WATCHDOG_DISABLE_CODE1 = 0x6734, - CHIP_HELPER_WATCHDOG_DISABLE_CODE2 = 0xD6BF, - CHIP_HELPER_WATCHDOG_DISABLE_CODE3 = 0xC31E -}; - -/* Other bits have changed between versions */ -enum chip_helper_gbl_misc_enum -{ - CHIP_HELPER_GBL_MISC_SPI_STOP_OUT_EN_MASK = 0x0001, - CHIP_HELPER_GBL_MISC_MMU_INIT_DONE_MASK = 0x0004 -}; - -/* Coex status register, contains interrupt status and reset pullup status. - * CHIP_HELPER_COEX_STATUS_RST_PULLS_MSB_MASK can be used to check - * for WAPI on R03 chips and later. */ -enum chip_helper_coex_status_mask_enum -{ - CHIP_HELPER_COEX_STATUS_RST_PULLS_LSB_MASK = 0x0001, - CHIP_HELPER_COEX_STATUS_RST_PULLS_MSB_MASK = 0x0008, - CHIP_HELPER_COEX_STATUS_WL_FEC_PINS_LSB_MASK = 0x0010, - CHIP_HELPER_COEX_STATUS_WL_FEC_PINS_MSB_MASK = 0x0080, - CHIP_HELPER_COEX_STATUS_INT_UART_MASK = 0x0100, - CHIP_HELPER_COEX_STATUS_INT_BT_LEG_MASK = 0x0200 -}; - -/* How to select the different CPUs */ -enum chip_helper_dbg_proc_sel_enum -{ - CHIP_HELPER_DBG_PROC_SEL_MAC = 0, - CHIP_HELPER_DBG_PROC_SEL_PHY = 1, - CHIP_HELPER_DBG_PROC_SEL_BT = 2, - CHIP_HELPER_DBG_PROC_SEL_NONE = 2, - CHIP_HELPER_DBG_PROC_SEL_BOTH = 3 -}; - -/* These are the only registers that we have to know the - address of before we know the chip version. */ -enum chip_helper_fixed_registers -{ - /* This is the address of GBL_CHIP_VERISON on BC7, - UF105x, UF60xx and - anything later than that. */ - CHIP_HELPER_UNIFI_GBL_CHIP_VERSION = 0xFE81, - - CHIP_HELPER_OLD_BLUECORE_GBL_CHIP_VERSION = 0xFF9A - - /* This isn't used at the moment (but might be needed - to distinguish the BlueCore sub version?) */ - /* CHIP_HELPER_OLD_BLUECORE_ANA_VERSION_ID = 0xFF7D */ -}; - -/* Address-value pairs for defining initialisation values */ -struct chip_helper_init_values -{ - u16 addr; - u16 value; -}; - -/* A block of data that should be written to the device */ -struct chip_helper_reset_values -{ - u32 gp_address; - u32 len; - const u16 *data; -}; - -/* - * This is the C API. - */ - -/* opaque type */ -typedef const struct chip_device_desc_t ChipDescript; - -/* Return a NULL descriptor */ -ChipDescript* ChipHelper_Null(void); - -/* This should get the correct version for any CSR chip. - The two parameters are what is read from addresses - 0xFF9A and 0xFE81 (OLD_BLUECORE_GBL_CHIP_VERSION and - UNIFI_GBL_CHIP_VERSION). These should give a unique identity - for most (all?) chips. - - FF9A is the old GBL_CHIP_VERSION register. If the high - eight bits are zero then the chip is a new (BC7 +) one - and FE81 is the _new_ GBL_CHIP_VERSION register. */ -ChipDescript* ChipHelper_GetVersionAny(u16 from_FF9A, u16 from_FE81); - -/* The chip is a UniFi, but we don't know which type - The parameter is the value of UNIFI_GBL_CHIP_VERSION (0xFE81) */ -ChipDescript* ChipHelper_GetVersionUniFi(u16 version); - -/* This gets the version from the SDIO device id. This only - gives quite a coarse grained version, so we should update once - we hav access to the function N registers. */ -ChipDescript* ChipHelper_GetVersionSdio(u8 sdio_version); - -/* The chip is some sort of BlueCore. If "age" is "pre_bc7" then - "version" is what was read from FF9A. If "age" is bc7_or_later - then "version" is read from FE81. If we don't know if we're pre - or post BC7 then we should use "GetVersionAny". */ -ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age age, - u16 version); - -/* The main functions of this class are built with an X macro. This - means we can generate the C and C++ versions from the same source - without the two diverging. - - The DEF0 functions are simple and take no parameters. The first - parameter to the macro is the return type. The second parameter - is the function name and the third parameter is where to get the - info from (this is hidden from the user). - - The DEF1 functions take one parameter. This time the third macro - parameter is the type of this parameter, and the fourth macro - parameter is the name of the parameter. The bodies of these - functions are hand written. */ -#define CHIP_HELPER_LIST(m) \ - CHIP_HELPER_DEF0(m, (const char *, FriendlyName, friendly_name)) \ - CHIP_HELPER_DEF0(m, (const char *, MarketingName, marketing_name)) \ - CHIP_HELPER_DEF0(m, (u16, DBG_EMU_CMD, regs->dbg_emu_cmd)) \ - CHIP_HELPER_DEF0(m, (u16, DBG_HOST_PROC_SELECT, regs->host.dbg_proc_select)) \ - CHIP_HELPER_DEF0(m, (u16, DBG_HOST_STOP_STATUS, regs->host.dbg_stop_status)) \ - CHIP_HELPER_DEF0(m, (u16, HOST_WINDOW1_PAGE, regs->host.window1_page)) \ - CHIP_HELPER_DEF0(m, (u16, HOST_WINDOW2_PAGE, regs->host.window2_page)) \ - CHIP_HELPER_DEF0(m, (u16, HOST_WINDOW3_PAGE, regs->host.window3_page)) \ - CHIP_HELPER_DEF0(m, (u16, HOST_IO_LOG_ADDR, regs->host.io_log_addr)) \ - CHIP_HELPER_DEF0(m, (u16, DBG_SPI_PROC_SELECT, regs->spi.dbg_proc_select)) \ - CHIP_HELPER_DEF0(m, (u16, DBG_SPI_STOP_STATUS, regs->spi.dbg_stop_status)) \ - CHIP_HELPER_DEF0(m, (u16, SPI_WINDOW1_PAGE, regs->spi.window1_page)) \ - CHIP_HELPER_DEF0(m, (u16, SPI_WINDOW2_PAGE, regs->spi.window2_page)) \ - CHIP_HELPER_DEF0(m, (u16, SPI_WINDOW3_PAGE, regs->spi.window3_page)) \ - CHIP_HELPER_DEF0(m, (u16, SPI_IO_LOG_ADDR, regs->spi.io_log_addr)) \ - CHIP_HELPER_DEF0(m, (u16, DBG_RESET, regs->dbg_reset)) \ - CHIP_HELPER_DEF0(m, (u16, DBG_RESET_VALUE, regs->dbg_reset_value)) \ - CHIP_HELPER_DEF0(m, (u16, DBG_RESET_WARN, regs->dbg_reset_warn)) \ - CHIP_HELPER_DEF0(m, (u16, DBG_RESET_WARN_VALUE, regs->dbg_reset_warn_value)) \ - CHIP_HELPER_DEF0(m, (u16, DBG_RESET_RESULT, regs->dbg_reset_result)) \ - CHIP_HELPER_DEF0(m, (u16, WATCHDOG_DISABLE, regs->watchdog_disable)) \ - CHIP_HELPER_DEF0(m, (u16, PROC_PC_SNOOP, regs->proc_pc_snoop)) \ - CHIP_HELPER_DEF0(m, (u16, GBL_CHIP_VERSION, regs->gbl_chip_version)) \ - CHIP_HELPER_DEF0(m, (u16, GBL_MISC_ENABLES, regs->gbl_misc_enables)) \ - CHIP_HELPER_DEF0(m, (u16, XAP_PCH, regs->xap_pch)) \ - CHIP_HELPER_DEF0(m, (u16, XAP_PCL, regs->xap_pcl)) \ - CHIP_HELPER_DEF0(m, (u16, MAILBOX0, regs->mailbox0)) \ - CHIP_HELPER_DEF0(m, (u16, MAILBOX1, regs->mailbox1)) \ - CHIP_HELPER_DEF0(m, (u16, MAILBOX2, regs->mailbox2)) \ - CHIP_HELPER_DEF0(m, (u16, MAILBOX3, regs->mailbox3)) \ - CHIP_HELPER_DEF0(m, (u16, SDIO_HIP_HANDSHAKE, regs->sdio_hip_handshake)) \ - CHIP_HELPER_DEF0(m, (u16, SDIO_HOST_INT, regs->sdio_host_int)) \ - CHIP_HELPER_DEF0(m, (u16, COEX_STATUS, regs->coex_status)) \ - CHIP_HELPER_DEF0(m, (u16, SHARED_IO_INTERRUPT, regs->shared_io_interrupt)) \ - CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_RAM_OFFSET, prog_offset.ram)) \ - CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_ROM_OFFSET, prog_offset.rom)) \ - CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_FLASH_OFFSET, prog_offset.flash)) \ - CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_EXT_SRAM_OFFSET, prog_offset.ext_sram)) \ - CHIP_HELPER_DEF0(m, (u16, DATA_MEMORY_RAM_OFFSET, data_offset.ram)) \ - CHIP_HELPER_DEF0(m, (s32, HasFlash, bools.has_flash)) \ - CHIP_HELPER_DEF0(m, (s32, HasExtSram, bools.has_ext_sram)) \ - CHIP_HELPER_DEF0(m, (s32, HasRom, bools.has_rom)) \ - CHIP_HELPER_DEF0(m, (s32, HasBt, bools.has_bt)) \ - CHIP_HELPER_DEF0(m, (s32, HasWLan, bools.has_wlan)) \ - CHIP_HELPER_DEF1(m, (u16, WINDOW_ADDRESS, enum chip_helper_window_index, window)) \ - CHIP_HELPER_DEF1(m, (u16, WINDOW_SIZE, enum chip_helper_window_index, window)) \ - CHIP_HELPER_DEF1(m, (u16, MapAddress_SPI2HOST, u16, addr)) \ - CHIP_HELPER_DEF1(m, (u16, MapAddress_HOST2SPI, u16, addr)) \ - CHIP_HELPER_DEF1(m, (u32, ClockStartupSequence, const struct chip_helper_init_values **, val)) \ - CHIP_HELPER_DEF1(m, (u32, HostResetSequence, const struct chip_helper_reset_values **, val)) - -/* Some magic to help the expansion */ -#define CHIP_HELPER_DEF0(a, b) \ - CHIP_HELPER_DEF0_ ## a b -#define CHIP_HELPER_DEF1(a, b) \ - CHIP_HELPER_DEF1_ ## a b - -/* Macros so that when we expand the list we get "C" function prototypes. */ -#define CHIP_HELPER_DEF0_C_DEC(ret_type, name, info) \ - ret_type ChipHelper_ ## name(ChipDescript * chip_help); -#define CHIP_HELPER_DEF1_C_DEC(ret_type, name, type1, name1) \ - ret_type ChipHelper_ ## name(ChipDescript * chip_help, type1 name1); - -CHIP_HELPER_LIST(C_DEC) - -/* FriendlyName - MarketingName - - These two functions return human readable strings that describe - the chip. FriendlyName returns something that a software engineer - at CSR might understand. MarketingName returns something more like - an external name for a CSR chip. -*/ -/* DBG_EMU_CMD - WATCHDOG_DISABLE - PROC_PC_SNOOP - GBL_CHIP_VERSION - XAP_PCH - XAP_PCL - - These registers are used to control the XAPs. -*/ -/* DBG_HOST_PROC_SELECT DBG_HOST_STOP_STATUS - HOST_WINDOW1_PAGE HOST_WINDOW2_PAGE HOST_WINDOW3_PAGE - HOST_IO_LOG_ADDR - DBG_SPI_PROC_SELECT DBG_SPI_STOP_STATUS - SPI_WINDOW1_PAGE SPI_WINDOW2_PAGE SPI_WINDOW3_PAGE - SPI_IO_LOG_ADDR - - These register are used to control the XAPs and the memory - windows, normally while debugging the code on chip. There - are two versons of these registers, one for access via SPI - and another for access via the host interface. -*/ -/* DBG_RESET - DBG_RESET_VALUE - DBG_RESET_WARN - DBG_RESET_WARN_VALUE - DBG_RESET_RESULT - - These registers are used to reset the XAP. This can be - quite complex for some chips. If DBG_RESET_WARN is non - zero the DBG_RESET_WARN_VALUE should be written to address - DBG_RESET_WARN before the reset is perfeormed. DBG_RESET_VALUE - should then be written to DBG_RESET to make the reset happen. - The DBG_RESET_RESULT register should contain 0 if the reset - was successful. -*/ -/* GBL_MISC_ENABLES - - This register controls some special chip features. It - should be used with care is it changes quite a lot between - chip versions. -*/ -/* MAILBOX0 - MAILBOX1 - MAILBOX2 - MAILBOX3 - - The mailbox registers are for communication between the host - and the firmware. There use is described in part by the host - interface protcol specifcation. -*/ -/* SDIO_HIP_HANDSHAKE - - This is one of the more important SDIO HIP registers. On some - chips it has the same value as one of the mailbox registers - and on other chips it is different. -*/ -/* SDIO_HOST_INT - SHARED_IO_INTERRUPT - - These registers are used by some versions of the host interface - protocol specification. Their names should probably be changed - to hide the registers and to expose the functions more. -*/ -/* COEX_STATUS - - Coex status register, contains interrupt status and reset - pullup status. The latter is used to detect WAPI. -*/ -/* PROGRAM_MEMORY_RAM_OFFSET - PROGRAM_MEMORY_ROM_OFFSET - PROGRAM_MEMORY_FLASH_OFFSET - PROGRAM_MEMORY_EXT_SRAM_OFFSET - DATA_MEMORY_RAM_OFFSET - - These are constants that describe the offset of the different - memory types in the two different address spaces. -*/ -/* HasFlash HasExtSram HasRom - HasBt HasWLan - - These are a set of bools describing the chip. -*/ -/* WINDOW_ADDRESS WINDOW_SIZE - - These two functions return the size and address of the windows. - The address is the address of the lowest value in the address - map that is part of the window and the size is the number of - visible words. - - Some of the windows have their lowest portion covered by - registers. For these windows address is the first address - after the registers and size is the siave excluding the part - covered by registers. -*/ -/* MapAddress_SPI2HOST - MapAddress_HOST2SPI - - The debugging interface is duplicated on UniFi and later chips - so that there are two versions - one over the SPI interaface and - the other over the SDIO interface. These functions map the - registers between these two interfaces. -*/ -/* ClockStartupSequence - - This function returns the list of register value pairs that - should be forced into UniFi to enable SPI communication. This - set of registers is not needed if the firmware is running, but - will be needed if the device is being booted from cold. These - register writes enable the clocks and setup the PLL to a basic - working state. SPI access might be unreliable until these writes - have occurred (And they may take mulitple goes). -*/ -/* HostResetSequence - - This returns a number of chunks of data and generic pointers. - All of the XAPs should be stopped. The data should be written - to the generic pointers. The instruction pointer for the MAC - should then be set to the start of program memory and then the - MAC should be "go"d. This will reset the chip in a reliable - and orderly manner without resetting the SDIO interface. It - is therefore not needed if the chip is being accessed by the - SPI interface (the DBG_RESET_ mechanism can be used instead). -*/ - -/* The Decode Window function is more complex. For the window - 'window' it tries to return the address and page register - value needed to see offset 'offset' of memory type 'type'. - - It return 1 on success and 0 on failure. 'page' is what - should be written to the page register. 'addr' is the - address in the XAPs 16 address map to read from. 'len' - is the length that we can read without having to change - the page registers. */ -s32 ChipHelper_DecodeWindow(ChipDescript *chip_help, - enum chip_helper_window_index window, - enum chip_helper_window_type type, - u32 offset, - u16 *page, u16 *addr, u32 *len); - -#endif diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h deleted file mode 100644 index e5e579912550..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h +++ /dev/null @@ -1,200 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifndef CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__ -#define CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__ - - -#include "csr_wifi_hip_chiphelper.h" - -/* This GP stuff should be somewhere else? */ - -/* Memory spaces encoded in top byte of Generic Pointer type */ -#define UNIFI_SH_DMEM 0x01 /* Shared Data Memory */ -#define UNIFI_EXT_FLASH 0x02 /* External FLASH */ -#define UNIFI_EXT_SRAM 0x03 /* External SRAM */ -#define UNIFI_REGISTERS 0x04 /* Registers */ -#define UNIFI_PHY_DMEM 0x10 /* PHY Data Memory */ -#define UNIFI_PHY_PMEM 0x11 /* PHY Program Memory */ -#define UNIFI_PHY_ROM 0x12 /* PHY ROM */ -#define UNIFI_MAC_DMEM 0x20 /* MAC Data Memory */ -#define UNIFI_MAC_PMEM 0x21 /* MAC Program Memory */ -#define UNIFI_MAC_ROM 0x22 /* MAC ROM */ -#define UNIFI_BT_DMEM 0x30 /* BT Data Memory */ -#define UNIFI_BT_PMEM 0x31 /* BT Program Memory */ -#define UNIFI_BT_ROM 0x32 /* BT ROM */ - -#define MAKE_GP(R, O) (((UNIFI_ ## R) << 24) | (O)) -#define GP_OFFSET(GP) ((GP) & 0xFFFFFF) -#define GP_SPACE(GP) (((GP) >> 24) & 0xFF) - - -/* Address value pairs */ -struct val_array_t -{ - u32 len; - const struct chip_helper_init_values *vals; -}; - -/* Just a (counted) u16 array */ -struct data_array_t -{ - u32 len; - const u16 *vals; -}; - -struct reset_prog_t -{ - u32 len; - const struct chip_helper_reset_values *vals; -}; - -/* The addresses of registers that are equivalent but on - different host transports. */ -struct chip_map_address_t -{ - u16 spi, host; -}; - -struct map_array_t -{ - u32 len; - const struct chip_map_address_t *vals; -}; - -struct chip_device_regs_per_transport_t -{ - u16 dbg_proc_select; - u16 dbg_stop_status; - u16 window1_page; /* PROG_PMEM1 or GW1 */ - u16 window2_page; /* PROG_PMEM2 or GW2 */ - u16 window3_page; /* SHARED or GW3 */ - u16 io_log_addr; -}; - -struct chip_device_regs_t -{ - u16 gbl_chip_version; - u16 gbl_misc_enables; - u16 dbg_emu_cmd; - struct chip_device_regs_per_transport_t host; - struct chip_device_regs_per_transport_t spi; - u16 dbg_reset; - u16 dbg_reset_value; - u16 dbg_reset_warn; - u16 dbg_reset_warn_value; - u16 dbg_reset_result; - u16 xap_pch; - u16 xap_pcl; - u16 proc_pc_snoop; - u16 watchdog_disable; - u16 mailbox0; - u16 mailbox1; - u16 mailbox2; - u16 mailbox3; - u16 sdio_host_int; - u16 shared_io_interrupt; - u16 sdio_hip_handshake; - u16 coex_status; /* Allows WAPI detection */ -}; - -/* If allowed is false then this window does not provide this - type of access. - This describes how addresses should be shifted to make the - "page" address. The address is shifted left by 'page_shift' - and then has 'page_offset' added. This value should then be - written to the page register. */ -struct window_shift_info_t -{ - s32 allowed; - u32 page_shift; - u16 page_offset; -}; - -/* Each window has an address and size. These are obvious. It then - has a description for each type of memory that might be accessed - through it. There might also be a start to the offset of the window. - This means that that number of addresses at the start of the window - are unusable. */ -struct window_info_t -{ - u16 address; - u16 size; - u16 blocked; - const struct window_shift_info_t *mode; -}; - -/* If GBL_CHIP_VERSION and'ed with 'mask' and is equal to 'result' - then this is the correct set of info. If pre_bc7 is true then the - address of GBL_CHIP_VERSION is FF9A, else its FE81. */ -struct chip_version_t -{ - s32 pre_bc7; - u16 mask; - u16 result; - u8 sdio; -}; - -struct chip_device_desc_t -{ - struct chip_version_t chip_version; - - /* This is a text string that a human might find useful (BC02, UF105x) */ - const char *friendly_name; - /* This is what we show to customers */ - const char *marketing_name; - - /* Initialisation values to write following a reset */ - struct val_array_t init; - - /* Binary sequence for hard reset */ - struct reset_prog_t reset_prog; - - /* The register map */ - const struct chip_device_regs_t *regs; - - /* Some misc. info on the chip */ - struct - { - u32 has_flash : 1; - u32 has_ext_sram : 1; - u32 has_rom : 1; - u32 has_bt : 1; - u32 has_wlan : 1; - } bools; - - /* This table is used to remap register addresses depending on what - host interface is used. On the BC7 and later chips there are - multiple sets of memory window registers, on for each host - interafce (SDIO / SPI). The correct one is needed. */ - struct map_array_t map; - - /* The offsets into the program address space of the different types of memory. - The RAM offset is probably the most useful. */ - struct - { - u32 ram; - u32 rom; - u32 flash; - u32 ext_sram; - } prog_offset; - - /* The offsets into the data address space of interesting things. */ - struct - { - u16 ram; - /* maybe add shared / page tables? */ - } data_offset; - - /* Information on the different windows */ - const struct window_info_t *windows[CHIP_HELPER_WINDOW_COUNT]; -}; - -#endif /* CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_conversions.h b/drivers/staging/csr/csr_wifi_hip_conversions.h deleted file mode 100644 index bf7a52e82995..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_conversions.h +++ /dev/null @@ -1,73 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * - * FILE: csr_wifi_hip_conversions.h - * - * PURPOSE: - * This header file provides the macros for converting to and from - * wire format. - * These macros *MUST* work for little-endian AND big-endian hosts. - * - * --------------------------------------------------------------------------- - */ -#ifndef __CSR_WIFI_HIP_CONVERSIONS_H__ -#define __CSR_WIFI_HIP_CONVERSIONS_H__ - -#define SIZEOF_UINT16 2 -#define SIZEOF_UINT32 4 -#define SIZEOF_UINT64 8 - -#define SIZEOF_SIGNAL_HEADER 6 -#define SIZEOF_DATAREF 4 - - -/* - * Macro to retrieve the signal ID from a wire-format signal. - */ -#define GET_SIGNAL_ID(_buf) CSR_GET_UINT16_FROM_LITTLE_ENDIAN((_buf)) - -/* - * Macros to retrieve and set the DATAREF fields in a packed (i.e. wire-format) - * HIP signal. - */ -#define GET_PACKED_DATAREF_SLOT(_buf, _ref) \ - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 0)) - -#define GET_PACKED_DATAREF_LEN(_buf, _ref) \ - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 2)) - -#define SET_PACKED_DATAREF_SLOT(_buf, _ref, _slot) \ - CSR_COPY_UINT16_TO_LITTLE_ENDIAN((_slot), ((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 0)) - -#define SET_PACKED_DATAREF_LEN(_buf, _ref, _len) \ - CSR_COPY_UINT16_TO_LITTLE_ENDIAN((_len), ((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 2)) - -#define GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(_buf) \ - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 8)) - -#define GET_PACKED_MA_PACKET_REQUEST_HOST_TAG(_buf) \ - CSR_GET_UINT32_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 4)) - -#define GET_PACKED_MA_PACKET_CONFIRM_HOST_TAG(_buf) \ - CSR_GET_UINT32_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 8)) - -#define GET_PACKED_MA_PACKET_CONFIRM_TRANSMISSION_STATUS(_buf) \ - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 2)) - - -s32 get_packed_struct_size(const u8 *buf); -CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig); -CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len); - -#endif /* __CSR_WIFI_HIP_CONVERSIONS_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c deleted file mode 100644 index 2f44a383d2cf..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ /dev/null @@ -1,819 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * FILE: csr_wifi_hip_download.c - * - * PURPOSE: - * Routines for downloading firmware to UniFi. - * - * --------------------------------------------------------------------------- - */ -#include <linux/slab.h> -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_unifiversion.h" -#include "csr_wifi_hip_card.h" -#include "csr_wifi_hip_xbv.h" - -#undef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH - -static CsrResult do_patch_download(card_t *card, void *dlpriv, - xbv1_t *pfwinfo, u32 boot_ctrl_addr); - -static CsrResult do_patch_convert_download(card_t *card, - void *dlpriv, xbv1_t *pfwinfo); - -/* - * --------------------------------------------------------------------------- - * _find_in_slut - * - * Find the offset of the appropriate object in the SLUT of a card - * - * Arguments: - * card Pointer to card struct - * psym Pointer to symbol object. - * id set up by caller - * obj will be set up by this function - * pslut Pointer to SLUT address, if 0xffffffff then it must be - * read from the chip. - * Returns: - * CSR_RESULT_SUCCESS on success - * Non-zero on error, - * CSR_WIFI_HIP_RESULT_NOT_FOUND if not found - * --------------------------------------------------------------------------- - */ -static CsrResult _find_in_slut(card_t *card, symbol_t *psym, u32 *pslut) -{ - u32 slut_address; - u16 finger_print; - CsrResult r; - CsrResult csrResult; - - /* Get SLUT address */ - if (*pslut == 0xffffffff) - { - r = card_wait_for_firmware_to_start(card, &slut_address); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Firmware hasn't started\n"); - return r; - } - *pslut = slut_address; - - /* - * Firmware has started so set the SDIO bus clock to the initial speed, - * faster than UNIFI_SDIO_CLOCK_SAFE_HZ, to speed up the f/w download. - */ - csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_INIT_HZ); - if (csrResult != CSR_RESULT_SUCCESS) - { - r = ConvertCsrSdioToCsrHipResult(card, csrResult); - return r; - } - card->sdio_clock_speed = UNIFI_SDIO_CLOCK_INIT_HZ; - } - else - { - slut_address = *pslut; /* Use previously discovered address */ - } - unifi_trace(card->ospriv, UDBG4, "SLUT addr: 0x%lX\n", slut_address); - - /* - * Check the SLUT fingerprint. - * The slut_address is a generic pointer so we must use unifi_card_read16(). - */ - unifi_trace(card->ospriv, UDBG4, "Looking for SLUT finger print\n"); - finger_print = 0; - r = unifi_card_read16(card, slut_address, &finger_print); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read SLUT finger print\n"); - return r; - } - - if (finger_print != SLUT_FINGERPRINT) - { - unifi_error(card->ospriv, "Failed to find SLUT fingerprint\n"); - return CSR_RESULT_FAILURE; - } - - /* Symbol table starts imedately after the fingerprint */ - slut_address += 2; - - while (1) - { - u16 id; - u32 obj; - - r = unifi_card_read16(card, slut_address, &id); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - slut_address += 2; - - if (id == CSR_SLT_END) - { - /* End of table reached: not found */ - r = CSR_WIFI_HIP_RESULT_RANGE; - break; - } - - r = unifi_read32(card, slut_address, &obj); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - slut_address += 4; - - unifi_trace(card->ospriv, UDBG3, " found SLUT id %02d.%08lx\n", id, obj); - - r = CSR_WIFI_HIP_RESULT_NOT_FOUND; - /* Found search term? */ - if (id == psym->id) - { - unifi_trace(card->ospriv, UDBG1, " matched SLUT id %02d.%08lx\n", id, obj); - psym->obj = obj; - r = CSR_RESULT_SUCCESS; - break; - } - } - - return r; -} - - -/* - * --------------------------------------------------------------------------- - * do_patch_convert_download - * - * Download the given firmware image to the UniFi, converting from FWDL - * to PTDL XBV format. - * - * Arguments: - * card Pointer to card struct - * dlpriv Pointer to source firmware image - * fwinfo Pointer to source firmware info struct - * - * Returns: - * CSR_RESULT_SUCCESS on success, CSR error code on error - * - * Notes: - * --------------------------------------------------------------------------- - */ -static CsrResult do_patch_convert_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo) -{ - CsrResult r; - u32 slut_base = 0xffffffff; - void *pfw; - u32 psize; - symbol_t sym; - - /* Reset the chip to guarantee that the ROM loader is running */ - r = unifi_init(card); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, - "do_patch_convert_download: failed to re-init UniFi\n"); - return r; - } - - /* If no unifi_helper is running, the firmware version must be read */ - if (card->build_id == 0) - { - u32 ver = 0; - sym.id = CSR_SLT_BUILD_ID_NUMBER; - sym.obj = 0; /* To be updated by _find_in_slut() */ - - unifi_trace(card->ospriv, UDBG1, "Need f/w version\n"); - - /* Find chip build id entry in SLUT */ - r = _find_in_slut(card, &sym, &slut_base); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to find CSR_SLT_BUILD_ID_NUMBER\n"); - return CSR_RESULT_FAILURE; - } - - /* Read running f/w version */ - r = unifi_read32(card, sym.obj, &ver); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read f/w id\n"); - return CSR_RESULT_FAILURE; - } - card->build_id = ver; - } - - /* Convert the ptest firmware to a patch against the running firmware */ - pfw = xbv_to_patch(card, unifi_fw_read, dlpriv, pfwinfo, &psize); - if (!pfw) - { - unifi_error(card->ospriv, "Failed to convert f/w to patch"); - return CSR_WIFI_HIP_RESULT_NO_MEMORY; - } - else - { - void *desc; - sym.id = CSR_SLT_BOOT_LOADER_CONTROL; - sym.obj = 0; /* To be updated by _find_in_slut() */ - - /* Find boot loader control entry in SLUT */ - r = _find_in_slut(card, &sym, &slut_base); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to find BOOT_LOADER_CONTROL\n"); - kfree(pfw); - return CSR_RESULT_FAILURE; - } - - r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to wake UniFi\n"); - } - - /* Get a dlpriv for the patch buffer so that unifi_fw_read() can - * access it. - */ - desc = unifi_fw_open_buffer(card->ospriv, pfw, psize); - if (!desc) - { - kfree(pfw); - return CSR_WIFI_HIP_RESULT_NO_MEMORY; - } - - /* Download the patch */ - unifi_info(card->ospriv, "Downloading converted f/w as patch\n"); - r = unifi_dl_patch(card, desc, sym.obj); - kfree(pfw); - unifi_fw_close_buffer(card->ospriv, desc); - - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Converted patch download failed\n"); - return r; - } - else - { - unifi_trace(card->ospriv, UDBG1, "Converted patch downloaded\n"); - } - - /* This command starts the firmware */ - r = unifi_do_loader_op(card, sym.obj + 6, UNIFI_BOOT_LOADER_RESTART); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write loader restart cmd\n"); - } - - return r; - } -} - - -/* - * --------------------------------------------------------------------------- - * unifi_dl_firmware - * - * Download the given firmware image to the UniFi. - * - * Arguments: - * card Pointer to card struct - * dlpriv A context pointer from the calling function to be - * passed when calling unifi_fw_read(). - * - * Returns: - * CSR_RESULT_SUCCESS on success, - * CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed - * CSR_WIFI_HIP_RESULT_INVALID_VALUE error in XBV file - * CSR_RESULT_FAILURE SDIO error - * - * Notes: - * Stops and resets the chip, does the download and runs the new - * firmware. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_dl_firmware(card_t *card, void *dlpriv) -{ - xbv1_t *fwinfo; - CsrResult r; - - fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL); - if (fwinfo == NULL) - { - unifi_error(card->ospriv, "Failed to allocate memory for firmware\n"); - return CSR_WIFI_HIP_RESULT_NO_MEMORY; - } - - /* - * Scan the firmware file to find the TLVs we are interested in. - * These are: - * - check we support the file format version in VERF - * - SLTP Symbol Lookup Table Pointer - * - FWDL firmware download segments - * - FWOV firmware overlay segment - * - VMEQ Register probe tests to verify matching h/w - */ - r = xbv1_parse(card, unifi_fw_read, dlpriv, fwinfo); - if (r != CSR_RESULT_SUCCESS || fwinfo->mode != xbv_firmware) - { - unifi_error(card->ospriv, "File type is %s, expected firmware.\n", - fwinfo->mode == xbv_patch?"patch" : "unknown"); - kfree(fwinfo); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - /* UF6xxx doesn't accept firmware, only patches. Therefore we convert - * the file to patch format with version numbers matching the current - * running firmware, and then download via the patch mechanism. - * The sole purpose of this is to support production test firmware across - * different ROM releases, the test firmware being provided in non-patch - * format. - */ - if (card->chip_id > SDIO_CARD_ID_UNIFI_2) - { - unifi_info(card->ospriv, "Must convert f/w to patch format\n"); - r = do_patch_convert_download(card, dlpriv, fwinfo); - } - else - { - /* Older UniFi chips allowed firmware to be directly loaded onto the - * chip, which is no longer supported. - */ - unifi_error(card->ospriv, "Only patch downloading supported\n"); - r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - kfree(fwinfo); - return r; -} /* unifi_dl_firmware() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_dl_patch - * - * Load the given patch set into UniFi. - * - * Arguments: - * card Pointer to card struct - * dlpriv The os specific handle to the firmware file. - * boot_ctrl The address of the boot loader control structure. - * - * Returns: - * CSR_RESULT_SUCCESS on success, - * CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed - * CSR_WIFI_HIP_RESULT_INVALID_VALUE error in XBV file - * CSR_RESULT_FAILURE SDIO error - * - * Notes: - * This ends up telling UniFi to restart. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl) -{ - xbv1_t *fwinfo; - CsrResult r; - - unifi_info(card->ospriv, "unifi_dl_patch %p %08x\n", dlpriv, boot_ctrl); - - fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL); - if (fwinfo == NULL) - { - unifi_error(card->ospriv, "Failed to allocate memory for patches\n"); - return CSR_WIFI_HIP_RESULT_NO_MEMORY; - } - - /* - * Scan the firmware file to find the TLVs we are interested in. - * These are: - * - check we support the file format version in VERF - * - FWID The build ID of the ROM that we can patch - * - PTDL patch download segments - */ - r = xbv1_parse(card, unifi_fw_read, dlpriv, fwinfo); - if (r != CSR_RESULT_SUCCESS || fwinfo->mode != xbv_patch) - { - kfree(fwinfo); - unifi_error(card->ospriv, "Failed to read in patch file\n"); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - /* - * We have to check the build id read from the SLUT against that - * for the patch file. They have to match exactly. - * "card->build_id" == XBV1.PTCH.FWID - */ - if (card->build_id != fwinfo->build_id) - { - unifi_error(card->ospriv, "Wrong patch file for chip (chip = %lu, file = %lu)\n", - card->build_id, fwinfo->build_id); - kfree(fwinfo); -#ifndef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; -#else - fwinfo = NULL; - dlpriv = NULL; - return CSR_RESULT_SUCCESS; -#endif - } - - r = do_patch_download(card, dlpriv, fwinfo, boot_ctrl); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to patch image\n"); - } - - kfree(fwinfo); - - return r; -} /* unifi_dl_patch() */ - - -void* unifi_dl_fw_read_start(card_t *card, s8 is_fw) -{ - card_info_t card_info; - - unifi_card_info(card, &card_info); - unifi_trace(card->ospriv, UDBG5, - "id=%d, ver=0x%x, fw_build=%u, fw_hip=0x%x, block_size=%d\n", - card_info.chip_id, card_info.chip_version, - card_info.fw_build, card_info.fw_hip_version, - card_info.sdio_block_size); - - return unifi_fw_read_start(card->ospriv, is_fw, &card_info); -} - - -/* - * --------------------------------------------------------------------------- - * safe_read_shared_location - * - * Read a shared memory location repeatedly until we get two readings - * the same. - * - * Arguments: - * card Pointer to card context struct. - * unifi_addr UniFi shared-data-memory address to access. - * pdata Pointer to a byte variable for the value read. - * - * - * Returns: - * CSR_RESULT_SUCCESS on success, CSR error code on failure - * --------------------------------------------------------------------------- - */ -static CsrResult safe_read_shared_location(card_t *card, u32 address, u8 *pdata) -{ - CsrResult r; - u16 limit = 1000; - u8 b, b2; - - *pdata = 0; - - r = unifi_read_8_or_16(card, address, &b); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - while (limit--) - { - r = unifi_read_8_or_16(card, address, &b2); - if (r != CSR_RESULT_SUCCESS) - { - return r; - } - - /* When we have a stable value, return it */ - if (b == b2) - { - *pdata = b; - return CSR_RESULT_SUCCESS; - } - - b = b2; - } - - return CSR_RESULT_FAILURE; -} /* safe_read_shared_location() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_do_loader_op - * - * Send a loader / boot_loader command to the UniFi and wait for - * it to complete. - * - * Arguments: - * card Pointer to card context struct. - * op_addr The address of the loader operation control word. - * opcode The operation to perform. - * - * Returns: - * CSR_RESULT_SUCCESS on success - * CSR_RESULT_FAILURE SDIO error or SDIO/XAP timeout - * --------------------------------------------------------------------------- - */ - -/* - * Ideally instead of sleeping, we want to busy wait. - * Currently there is no framework API to do this. When it becomes available, - * we can use it to busy wait using usecs - */ -#define OPERATION_TIMEOUT_LOOPS (100) /* when OPERATION_TIMEOUT_DELAY==1, (500) otherwise */ -#define OPERATION_TIMEOUT_DELAY 1 /* msec, or 200usecs */ - -CsrResult unifi_do_loader_op(card_t *card, u32 op_addr, u8 opcode) -{ - CsrResult r; - s16 op_retries; - - unifi_trace(card->ospriv, UDBG4, "Loader cmd 0x%0x -> 0x%08x\n", opcode, op_addr); - - /* Set the Operation command byte to the opcode */ - r = unifi_write_8_or_16(card, op_addr, opcode); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to write loader copy command\n"); - return r; - } - - /* Wait for Operation command byte to be Idle */ - /* Typically takes ~100us */ - op_retries = 0; - r = CSR_RESULT_SUCCESS; - while (1) - { - u8 op; - - /* - * Read the memory location until two successive reads give - * the same value. - * Then handle it. - */ - r = safe_read_shared_location(card, op_addr, &op); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to read loader status\n"); - break; - } - - if (op == UNIFI_LOADER_IDLE) - { - /* Success */ - break; - } - - if (op != opcode) - { - unifi_error(card->ospriv, "Error reported by loader: 0x%X\n", op); - r = CSR_RESULT_FAILURE; - break; - } - - /* Allow 500us timeout */ - if (++op_retries >= OPERATION_TIMEOUT_LOOPS) - { - unifi_error(card->ospriv, "Timeout waiting for loader to ack transfer\n"); - /* Stop XAPs to aid post-mortem */ - r = unifi_card_stop_processor(card, UNIFI_PROC_BOTH); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to stop UniFi processors\n"); - } - else - { - r = CSR_RESULT_FAILURE; - } - break; - } - CsrThreadSleep(OPERATION_TIMEOUT_DELAY); - } /* Loop exits with r != CSR_RESULT_SUCCESS on error */ - - return r; -} /* unifi_do_loader_op() */ - - -/* - * --------------------------------------------------------------------------- - * send_ptdl_to_unifi - * - * Copy a patch block from userland to the UniFi. - * This function reads data, 2K at a time, from userland and writes - * it to the UniFi. - * - * Arguments: - * card A pointer to the card structure - * dlpriv The os specific handle for the firmware file - * ptdl A pointer ot the PTDL block - * handle The buffer handle to use for the xfer - * op_addr The address of the loader operation control word - * - * Returns: - * Number of bytes sent (Positive) or negative value indicating - * error code: - * CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed - * CSR_WIFI_HIP_RESULT_INVALID_VALUE error in XBV file - * CSR_RESULT_FAILURE SDIO error - * --------------------------------------------------------------------------- - */ -static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, - const struct PTDL *ptdl, u32 handle, - u32 op_addr) -{ - u32 offset; - u8 *buf; - s32 data_len; - u32 write_len; - CsrResult r; - const u16 buf_size = 2 * 1024; - - offset = ptdl->dl_offset; - data_len = ptdl->dl_size; - - if (data_len > buf_size) - { - unifi_error(card->ospriv, "PTDL block is too large (%u)\n", - ptdl->dl_size); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - buf = kmalloc(buf_size, GFP_KERNEL); - if (buf == NULL) - { - unifi_error(card->ospriv, "Failed to allocate transfer buffer for firmware download\n"); - return CSR_WIFI_HIP_RESULT_NO_MEMORY; - } - - r = CSR_RESULT_SUCCESS; - - if (unifi_fw_read(card->ospriv, dlpriv, offset, buf, data_len) != data_len) - { - unifi_error(card->ospriv, "Failed to read from file\n"); - } - else - { - /* We can always round these if the host wants to */ - if (card->sdio_io_block_pad) - { - write_len = (data_len + (card->sdio_io_block_size - 1)) & - ~(card->sdio_io_block_size - 1); - - /* Zero out the rest of the buffer (This isn't needed, but it - * makes debugging things later much easier). */ - memset(buf + data_len, 0, write_len - data_len); - } - else - { - write_len = data_len; - } - - r = unifi_bulk_rw_noretry(card, handle, buf, write_len, UNIFI_SDIO_WRITE); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "CMD53 failed writing %d bytes to handle %ld\n", - data_len, handle); - } - else - { - /* - * Can change the order of things to overlap read from file - * with copy to unifi - */ - r = unifi_do_loader_op(card, op_addr, UNIFI_BOOT_LOADER_PATCH); - } - } - - kfree(buf); - - if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - unifi_error(card->ospriv, "Failed to copy block of %u bytes to UniFi\n", - ptdl->dl_size); - } - - return r; -} /* send_ptdl_to_unifi() */ - - -/* - * --------------------------------------------------------------------------- - * do_patch_download - * - * This function downloads a set of patches to UniFi and then - * causes it to restart. - * - * Arguments: - * card Pointer to card struct. - * dlpriv A context pointer from the calling function to be - * used when reading the XBV file. This can be NULL - * in which case not patches are applied. - * pfwinfo Pointer to a fwinfo struct describing the f/w - * XBV file. - * boot_ctrl_addr The address of the boot loader control structure. - * - * Returns: - * 0 on success, or an error code - * CSR_WIFI_HIP_RESULT_INVALID_VALUE for a bad laoader version number - * --------------------------------------------------------------------------- - */ -static CsrResult do_patch_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo, u32 boot_ctrl_addr) -{ - CsrResult r; - s32 i; - u16 loader_version; - u16 handle; - u32 total_bytes; - - /* - * Read info from the SDIO Loader Control Data Structure - */ - /* Check the loader version */ - r = unifi_card_read16(card, boot_ctrl_addr, &loader_version); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Patch download: Failed to read loader version\n"); - return r; - } - unifi_trace(card->ospriv, UDBG2, "Patch download: boot loader version 0x%04X\n", loader_version); - switch (loader_version) - { - case 0x0000: - break; - - default: - unifi_error(card->ospriv, "Patch loader version (0x%04X) is not supported by this driver\n", - loader_version); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - /* Retrieve the handle to use with CMD53 */ - r = unifi_card_read16(card, boot_ctrl_addr + 4, &handle); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Patch download: Failed to read loader handle\n"); - return r; - } - - /* Set the mask of LEDs to flash */ - if (card->loader_led_mask) - { - r = unifi_card_write16(card, boot_ctrl_addr + 2, - (u16)card->loader_led_mask); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Patch download: Failed to write LED mask\n"); - return r; - } - } - - total_bytes = 0; - - /* Copy download data to UniFi memory */ - for (i = 0; i < pfwinfo->num_ptdl; i++) - { - unifi_trace(card->ospriv, UDBG3, "Patch download: %d Downloading for %d from offset %d\n", - i, - pfwinfo->ptdl[i].dl_size, - pfwinfo->ptdl[i].dl_offset); - - r = send_ptdl_to_unifi(card, dlpriv, &pfwinfo->ptdl[i], - handle, boot_ctrl_addr + 6); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - return r; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Patch failed after %u bytes\n", - total_bytes); - return r; - } - total_bytes += pfwinfo->ptdl[i].dl_size; - } - - return CSR_RESULT_SUCCESS; -} /* do_patch_download() */ - - diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c deleted file mode 100644 index 7b7eec49d028..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_dump.c +++ /dev/null @@ -1,837 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * FILE: csr_wifi_hip_dump.c - * - * PURPOSE: - * Routines for retrieving and buffering core status from the UniFi - * - * --------------------------------------------------------------------------- - */ -#include <linux/slab.h> -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_unifiversion.h" -#include "csr_wifi_hip_card.h" - -/* Locations to capture in dump (XAP words) */ -#define HIP_CDUMP_FIRST_CPUREG (0xFFE0) /* First CPU register */ -#define HIP_CDUMP_FIRST_LO (0) /* Start of low address range */ -#define HIP_CDUMP_FIRST_HI_MAC (0x3C00) /* Start of MAC high area */ -#define HIP_CDUMP_FIRST_HI_PHY (0x1C00) /* Start of PHY high area */ -#define HIP_CDUMP_FIRST_SH (0) /* Start of shared memory area */ - -#define HIP_CDUMP_NCPUREGS (10) /* No. of 16-bit XAP registers */ -#define HIP_CDUMP_NWORDS_LO (0x0100) /* Low area size in 16-bit words */ -#define HIP_CDUMP_NWORDS_HI (0x0400) /* High area size in 16-bit words */ -#define HIP_CDUMP_NWORDS_SH (0x0500) /* Shared memory area size, 16-bit words */ - -#define HIP_CDUMP_NUM_ZONES 7 /* Number of UniFi memory areas to capture */ - -/* Mini-coredump state */ -typedef struct coredump_buf -{ - u16 count; /* serial number of dump */ - u32 timestamp; /* host's system time at capture */ - s16 requestor; /* request: 0=auto dump, 1=manual */ - u16 chip_ver; - u32 fw_ver; - u16 *zone[HIP_CDUMP_NUM_ZONES]; - - struct coredump_buf *next; /* circular list */ - struct coredump_buf *prev; /* circular list */ -} coredump_buffer; - -/* Structure used to describe a zone of chip memory captured by mini-coredump */ -struct coredump_zone -{ - unifi_coredump_space_t space; /* XAP memory space this zone covers */ - enum unifi_dbg_processors_select cpu; /* XAP CPU core selector */ - u32 gp; /* Generic Pointer to memory zone on XAP */ - u16 offset; /* 16-bit XAP word offset of zone in memory space */ - u16 length; /* Length of zone in XAP words */ -}; - -static CsrResult unifi_coredump_from_sdio(card_t *card, coredump_buffer *dump_buf); -static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf); -static CsrResult unifi_coredump_read_zone(card_t *card, u16 *zone, - const struct coredump_zone *def); -static s32 get_value_from_coredump(const coredump_buffer *dump, - const unifi_coredump_space_t space, const u16 offset); - -/* Table of chip memory zones we capture on mini-coredump */ -static const struct coredump_zone zonedef_table[HIP_CDUMP_NUM_ZONES] = { - { UNIFI_COREDUMP_MAC_REG, UNIFI_PROC_MAC, UNIFI_MAKE_GP(REGISTERS, HIP_CDUMP_FIRST_CPUREG * 2), HIP_CDUMP_FIRST_CPUREG, HIP_CDUMP_NCPUREGS }, - { UNIFI_COREDUMP_PHY_REG, UNIFI_PROC_PHY, UNIFI_MAKE_GP(REGISTERS, HIP_CDUMP_FIRST_CPUREG * 2), HIP_CDUMP_FIRST_CPUREG, HIP_CDUMP_NCPUREGS }, - { UNIFI_COREDUMP_SH_DMEM, UNIFI_PROC_INVALID, UNIFI_MAKE_GP(SH_DMEM, HIP_CDUMP_FIRST_SH * 2), HIP_CDUMP_FIRST_SH, HIP_CDUMP_NWORDS_SH }, - { UNIFI_COREDUMP_MAC_DMEM, UNIFI_PROC_MAC, UNIFI_MAKE_GP(MAC_DMEM, HIP_CDUMP_FIRST_LO * 2), HIP_CDUMP_FIRST_LO, HIP_CDUMP_NWORDS_LO }, - { UNIFI_COREDUMP_MAC_DMEM, UNIFI_PROC_MAC, UNIFI_MAKE_GP(MAC_DMEM, HIP_CDUMP_FIRST_HI_MAC * 2), HIP_CDUMP_FIRST_HI_MAC, HIP_CDUMP_NWORDS_HI }, - { UNIFI_COREDUMP_PHY_DMEM, UNIFI_PROC_PHY, UNIFI_MAKE_GP(PHY_DMEM, HIP_CDUMP_FIRST_LO * 2), HIP_CDUMP_FIRST_LO, HIP_CDUMP_NWORDS_LO }, - { UNIFI_COREDUMP_PHY_DMEM, UNIFI_PROC_PHY, UNIFI_MAKE_GP(PHY_DMEM, HIP_CDUMP_FIRST_HI_PHY * 2), HIP_CDUMP_FIRST_HI_PHY, HIP_CDUMP_NWORDS_HI }, -}; - -/* - * --------------------------------------------------------------------------- - * unifi_coredump_request_at_next_reset - * - * Request that a mini-coredump is performed when the driver has - * completed resetting the UniFi device. - * - * Arguments: - * card Pointer to card struct - * enable If non-zero, sets the request. - * If zero, cancels any pending request. - * - * Returns: - * CSR_RESULT_SUCCESS or CSR HIP error code - * - * Notes: - * This function is typically called once the driver has detected that - * the UniFi device has become unresponsive due to crash, or internal - * watchdog reset. The driver must reset it to regain communication and, - * immediately after that, the mini-coredump can be captured. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_coredump_request_at_next_reset(card_t *card, s8 enable) -{ - CsrResult r; - - if (enable) - { - unifi_trace(card->ospriv, UDBG2, "Mini-coredump requested after reset\n"); - } - - if (card == NULL) - { - r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - else - { - card->request_coredump_on_reset = enable?1 : 0; - r = CSR_RESULT_SUCCESS; - } - - return r; -} - - -/* - * --------------------------------------------------------------------------- - * unifi_coredump_handle_request - * - * Performs a coredump now, if one was requested, and clears the request. - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * CSR_RESULT_SUCCESS or CSR HIP error code - * - * Notes: - * --------------------------------------------------------------------------- - */ -CsrResult unifi_coredump_handle_request(card_t *card) -{ - CsrResult r = CSR_RESULT_SUCCESS; - - if (card == NULL) - { - r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - else - { - if (card->request_coredump_on_reset == 1) - { - card->request_coredump_on_reset = 0; - r = unifi_coredump_capture(card, NULL); - } - } - - return r; -} - - -/* - * --------------------------------------------------------------------------- - * unifi_coredump_capture - * - * Capture the current status of the UniFi device. - * Various registers are buffered for future offline inspection. - * - * Arguments: - * card Pointer to card struct - * req Pointer to request struct, or NULL: - * A coredump requested manually by the user app - * will have a request struct pointer, an automatic - * coredump will have a NULL pointer. - * Returns: - * CSR_RESULT_SUCCESS on success, - * CSR_RESULT_FAILURE SDIO error - * CSR_WIFI_HIP_RESULT_INVALID_VALUE Initialisation not complete - * - * Notes: - * The result is a filled entry in the circular buffer of core dumps, - * values from which can be extracted to userland via an ioctl. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_coredump_capture(card_t *card, struct unifi_coredump_req *req) -{ - CsrResult r = CSR_RESULT_SUCCESS; - static u16 dump_seq_no = 1; - u32 time_of_capture; - - if (card->dump_next_write == NULL) - { - r = CSR_RESULT_SUCCESS; - goto done; - } - - /* Reject forced capture before initialisation has happened */ - if (card->helper == NULL) - { - r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; - goto done; - } - - - /* - * Force a mini-coredump capture right now - */ - time_of_capture = CsrTimeGet(NULL); - unifi_info(card->ospriv, "Mini-coredump capture at t=%u\n", time_of_capture); - - /* Wake up the processors so we can talk to them */ - r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to wake UniFi\n"); - goto done; - } - CsrThreadSleep(20); - - /* Stop both XAPs */ - unifi_trace(card->ospriv, UDBG4, "Stopping XAPs for coredump capture\n"); - r = unifi_card_stop_processor(card, UNIFI_PROC_BOTH); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to stop UniFi XAPs\n"); - goto done; - } - - /* Dump core into the next available slot in the circular list */ - r = unifi_coredump_from_sdio(card, card->dump_next_write); - if (r == CSR_RESULT_SUCCESS) - { - /* Record whether the dump was manual or automatic */ - card->dump_next_write->requestor = (req?1 : 0); - card->dump_next_write->timestamp = time_of_capture; - /* Advance to the next buffer */ - card->dump_next_write->count = dump_seq_no++; - card->dump_cur_read = card->dump_next_write; - card->dump_next_write = card->dump_next_write->next; - - /* Sequence no. of zero indicates slot not in use, so handle wrap */ - if (dump_seq_no == 0) - { - dump_seq_no = 1; - } - - unifi_trace(card->ospriv, UDBG3, - "Coredump (%p), SeqNo=%d, cur_read=%p, next_write=%p\n", - req, - card->dump_cur_read->count, - card->dump_cur_read, card->dump_next_write); - } - - /* Start both XAPs */ - unifi_trace(card->ospriv, UDBG4, "Restart XAPs after coredump\n"); - r = card_start_processor(card, UNIFI_PROC_BOTH); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Failed to start UniFi XAPs\n"); - goto done; - } - -done: - return r; -} /* unifi_coredump_capture() */ - - -/* - * --------------------------------------------------------------------------- - * get_value_from_coredump - * - * - * - * Arguments: - * dump Pointer to buffered coredump data - * offset_in_space XAP memory space to retrieve from the buffer (there - * may be more than one zone covering the same memory - * space, but starting from different offsets). - * offset Offset within the XAP memory space to be retrieved - * - * Returns: - * >=0 Register value on success - * <0 Register out of range of any captured zones - * - * Notes: - * --------------------------------------------------------------------------- - */ -static s32 get_value_from_coredump(const coredump_buffer *coreDump, - const unifi_coredump_space_t space, - const u16 offset_in_space) -{ - s32 r = -1; - u16 offset_in_zone; - u32 zone_end_offset; - s32 i; - const struct coredump_zone *def = &zonedef_table[0]; - - /* Search zone def table for a match with the requested memory space */ - for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++, def++) - { - if (space == def->space) - { - zone_end_offset = def->offset + def->length; - - /* Is the space offset contained in this zone? */ - if (offset_in_space < zone_end_offset && - offset_in_space >= def->offset) - { - /* Calculate the offset of data within the zone buffer */ - offset_in_zone = offset_in_space - def->offset; - r = (s32) * (coreDump->zone[i] + offset_in_zone); - - unifi_trace(NULL, UDBG6, - "sp %d, offs 0x%04x = 0x%04x (in z%d 0x%04x->0x%04x)\n", - space, offset_in_space, r, - i, def->offset, zone_end_offset - 1); - break; - } - } - } - return r; -} - - -/* - * --------------------------------------------------------------------------- - * unifi_coredump_get_value - * - * Retrieve the value of a register buffered from a previous core dump, - * so that it may be reported back to application code. - * - * Arguments: - * card Pointer to card struct - * req_reg Pointer to request parameter partially filled. This - * function puts in the values retrieved from the dump. - * - * Returns: - * CSR_RESULT_SUCCESS on success, or: - * CSR_WIFI_HIP_RESULT_INVALID_VALUE Null parameter error - * CSR_WIFI_HIP_RESULT_RANGE Register out of range - * CSR_WIFI_HIP_RESULT_NOT_FOUND Dump index not (yet) captured - * - * Notes: - * --------------------------------------------------------------------------- - */ -CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req) -{ - CsrResult r; - s32 i = 0; - coredump_buffer *find_dump = NULL; - - if (req == NULL || card == NULL) - { - r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; - goto done; - } - req->value = -1; - if (card->dump_buf == NULL) - { - unifi_trace(card->ospriv, UDBG2, "No coredump buffers\n"); - r = CSR_WIFI_HIP_RESULT_NOT_FOUND; /* Coredumping disabled */ - goto done; - } - if (card->dump_cur_read == NULL) - { - unifi_trace(card->ospriv, UDBG4, "No coredumps captured\n"); - r = CSR_WIFI_HIP_RESULT_NOT_FOUND; /* No coredump yet captured */ - goto done; - } - - /* Find the requested dump buffer */ - switch (req->index) - { - case 0: /* Newest */ - find_dump = card->dump_cur_read; - break; - case -1: /* Oldest: The next used slot forward */ - for (find_dump = card->dump_cur_read->next; - (find_dump->count == 0) && (find_dump != card->dump_cur_read); - find_dump = card->dump_cur_read->next) - { - } - break; - default: /* Number of steps back from current read position */ - for (i = 0, find_dump = card->dump_cur_read; - i < req->index; - i++, find_dump = find_dump->prev) - { - /* Walk the list for the index'th entry, but - * stop when about to wrap. */ - unifi_trace(card->ospriv, UDBG6, - "%d: %d, @%p, p=%p, n=%p, cr=%p, h=%p\n", - i, find_dump->count, find_dump, find_dump->prev, - find_dump->next, card->dump_cur_read, card->dump_buf); - if (find_dump->prev == card->dump_cur_read) - { - /* Wrapped but still not found, index out of range */ - if (i != req->index) - { - unifi_trace(card->ospriv, UDBG6, - "Dump index %d not found %d\n", req->index, i); - r = CSR_WIFI_HIP_RESULT_NOT_FOUND; - goto done; - } - break; - } - } - break; - } - - /* Check if the slot is actually filled with a core dump */ - if (find_dump->count == 0) - { - unifi_trace(card->ospriv, UDBG4, "Not captured %d\n", req->index); - r = CSR_WIFI_HIP_RESULT_NOT_FOUND; - goto done; - } - - unifi_trace(card->ospriv, UDBG6, "Req index %d, found seq %d at step %d\n", - req->index, find_dump->count, i); - - /* Find the appropriate entry in the buffer */ - req->value = get_value_from_coredump(find_dump, req->space, (u16)req->offset); - if (req->value < 0) - { - r = CSR_WIFI_HIP_RESULT_RANGE; /* Un-captured register */ - unifi_trace(card->ospriv, UDBG4, - "Can't read space %d, reg 0x%x from coredump buffer %d\n", - req->space, req->offset, req->index); - } - else - { - r = CSR_RESULT_SUCCESS; - } - - /* Update the private request structure with the found values */ - req->chip_ver = find_dump->chip_ver; - req->fw_ver = find_dump->fw_ver; - req->timestamp = find_dump->timestamp; - req->requestor = find_dump->requestor; - req->serial = find_dump->count; - -done: - return r; -} /* unifi_coredump_get_value() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_coredump_read_zone - * - * Captures a UniFi memory zone into a buffer on the host - * - * Arguments: - * card Pointer to card struct - * zonebuf Pointer to on-host buffer to dump the memory zone into - * def Pointer to description of the memory zone to read from UniFi. - * - * Returns: - * CSR_RESULT_SUCCESS on success, or: - * CSR_RESULT_FAILURE SDIO error - * CSR_WIFI_HIP_RESULT_INVALID_VALUE Parameter error - * - * Notes: - * It is assumed that the caller has already stopped the XAPs - * --------------------------------------------------------------------------- - */ -static CsrResult unifi_coredump_read_zone(card_t *card, u16 *zonebuf, const struct coredump_zone *def) -{ - CsrResult r; - - if (zonebuf == NULL || def == NULL) - { - r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; - goto done; - } - - /* Select XAP CPU if necessary */ - if (def->cpu != UNIFI_PROC_INVALID) - { - if (def->cpu != UNIFI_PROC_MAC && def->cpu != UNIFI_PROC_PHY) - { - r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; - goto done; - } - r = unifi_set_proc_select(card, def->cpu); - if (r != CSR_RESULT_SUCCESS) - { - goto done; - } - } - - unifi_trace(card->ospriv, UDBG4, - "Dump sp %d, offs 0x%04x, 0x%04x words @GP=%08x CPU %d\n", - def->space, def->offset, def->length, def->gp, def->cpu); - - /* Read on-chip RAM (byte-wise) */ - r = unifi_card_readn(card, def->gp, zonebuf, (u16)(def->length * 2)); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - goto done; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Can't read UniFi shared data area\n"); - goto done; - } - -done: - return r; -} - - -/* - * --------------------------------------------------------------------------- - * unifi_coredump_read_zones - * - * Walks through the table of on-chip memory zones defined in zonedef_table, - * and reads each of them from the UniFi chip - * - * Arguments: - * card Pointer to card struct - * dump_buf Buffer into which register values will be dumped - * - * Returns: - * CSR_RESULT_SUCCESS on success, or: - * CSR_RESULT_FAILURE SDIO error - * CSR_WIFI_HIP_RESULT_INVALID_VALUE Parameter error - * - * Notes: - * It is assumed that the caller has already stopped the XAPs - * --------------------------------------------------------------------------- - */ -static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf) -{ - CsrResult r = CSR_RESULT_SUCCESS; - s32 i; - - /* Walk the table of coredump zone definitions and read them from the chip */ - for (i = 0; - (i < HIP_CDUMP_NUM_ZONES) && (r == 0); - i++) - { - r = unifi_coredump_read_zone(card, dump_buf->zone[i], &zonedef_table[i]); - } - - return r; -} - - -/* - * --------------------------------------------------------------------------- - * unifi_coredump_from_sdio - * - * Capture the status of the UniFi processors, over SDIO - * - * Arguments: - * card Pointer to card struct - * reg_buffer Buffer into which register values will be dumped - * - * Returns: - * CSR_RESULT_SUCCESS on success, or: - * CSR_RESULT_FAILURE SDIO error - * CSR_WIFI_HIP_RESULT_INVALID_VALUE Parameter error - * - * Notes: - * --------------------------------------------------------------------------- - */ -static CsrResult unifi_coredump_from_sdio(card_t *card, coredump_buffer *dump_buf) -{ - u16 val; - CsrResult r; - u32 sdio_addr; - - if (dump_buf == NULL) - { - r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; - goto done; - } - - - /* Chip and firmware version */ - unifi_trace(card->ospriv, UDBG4, "Get chip version\n"); - sdio_addr = 2 * ChipHelper_GBL_CHIP_VERSION(card->helper); - if (sdio_addr != 0) - { - r = unifi_read_direct16(card, sdio_addr, &val); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - goto done; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Can't read GBL_CHIP_VERSION\n"); - goto done; - } - } - dump_buf->chip_ver = val; - dump_buf->fw_ver = card->build_id; - - unifi_trace(card->ospriv, UDBG4, "chip_ver 0x%04x, fw_ver %u\n", - dump_buf->chip_ver, dump_buf->fw_ver); - - /* Capture the memory zones required from UniFi */ - r = unifi_coredump_read_zones(card, dump_buf); - if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE) - { - goto done; - } - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "Can't read UniFi memory areas\n"); - goto done; - } - -done: - return r; -} /* unifi_coredump_from_sdio() */ - - -#ifndef UNIFI_DISABLE_COREDUMP -/* - * --------------------------------------------------------------------------- - * new_coredump_node - * - * Allocates a coredump linked-list node, and links it to the previous. - * - * Arguments: - * ospriv OS context - * prevnode Previous node to link into - * - * Returns: - * Pointer to valid coredump_buffer on success - * NULL on memory allocation failure - * - * Notes: - * Allocates "all or nothing" - * --------------------------------------------------------------------------- - */ -static -coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) -{ - coredump_buffer *newnode = NULL; - u16 *newzone = NULL; - s32 i; - u32 zone_size; - - /* Allocate node header */ - newnode = kzalloc(sizeof(coredump_buffer), GFP_KERNEL); - if (newnode == NULL) - { - return NULL; - } - - /* Allocate chip memory zone capture buffers */ - for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++) - { - zone_size = sizeof(u16) * zonedef_table[i].length; - newzone = kzalloc(zone_size, GFP_KERNEL); - newnode->zone[i] = newzone; - if (newzone == NULL) - { - unifi_error(ospriv, "Out of memory on coredump zone %d (%d words)\n", - i, zonedef_table[i].length); - break; - } - } - - /* Clean up if any zone alloc failed */ - if (newzone == NULL) - { - for (i = 0; newnode->zone[i] != NULL; i++) - { - kfree(newnode->zone[i]); - newnode->zone[i] = NULL; - } - } - - /* Link to previous node */ - newnode->prev = prevnode; - if (prevnode) - { - prevnode->next = newnode; - } - newnode->next = NULL; - - return newnode; -} - - -#endif /* UNIFI_DISABLE_COREDUMP */ - -/* - * --------------------------------------------------------------------------- - * unifi_coredump_init - * - * Allocates buffers for the automatic SDIO core dump - * - * Arguments: - * card Pointer to card struct - * num_dump_buffers Number of buffers to reserve for coredumps - * - * Returns: - * CSR_RESULT_SUCCESS on success, or: - * CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed - * - * Notes: - * Allocates space in advance, to be used for the last n coredump buffers - * the intention being that the size is sufficient for at least one dump, - * probably several. - * It's probably advisable to have at least 2 coredump buffers to allow - * one to be enquired with the unifi_coredump tool, while leaving another - * free for capturing. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_coredump_init(card_t *card, u16 num_dump_buffers) -{ -#ifndef UNIFI_DISABLE_COREDUMP - void *ospriv = card->ospriv; - coredump_buffer *prev = NULL; - coredump_buffer *newnode = NULL; - u32 i = 0; -#endif - - card->request_coredump_on_reset = 0; - card->dump_next_write = NULL; - card->dump_cur_read = NULL; - card->dump_buf = NULL; - -#ifndef UNIFI_DISABLE_COREDUMP - unifi_trace(ospriv, UDBG1, - "Allocate buffers for %d core dumps\n", num_dump_buffers); - if (num_dump_buffers == 0) - { - goto done; - } - - /* Root node */ - card->dump_buf = new_coredump_node(ospriv, NULL); - if (card->dump_buf == NULL) - { - goto fail; - } - prev = card->dump_buf; - newnode = card->dump_buf; - - /* Add each subsequent node at tail */ - for (i = 1; i < num_dump_buffers; i++) - { - newnode = new_coredump_node(ospriv, prev); - if (newnode == NULL) - { - goto fail; - } - prev = newnode; - } - - /* Link the first and last nodes to make the list circular */ - card->dump_buf->prev = newnode; - newnode->next = card->dump_buf; - - /* Set initial r/w access pointers */ - card->dump_next_write = card->dump_buf; - card->dump_cur_read = NULL; - - unifi_trace(ospriv, UDBG2, "Core dump configured (%d dumps max)\n", i); - -done: -#endif - return CSR_RESULT_SUCCESS; - -#ifndef UNIFI_DISABLE_COREDUMP -fail: - /* Unwind what we allocated so far */ - unifi_error(ospriv, "Out of memory allocating core dump node %d\n", i); - unifi_coredump_free(card); - return CSR_WIFI_HIP_RESULT_NO_MEMORY; -#endif -} /* unifi_coreump_init() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_coredump_free - * - * Free all memory dynamically allocated for core dump - * - * Arguments: - * card Pointer to card struct - * - * Returns: - * None - * - * Notes: - * --------------------------------------------------------------------------- - */ -void unifi_coredump_free(card_t *card) -{ - void *ospriv = card->ospriv; - coredump_buffer *node, *del_node; - s16 i = 0; - s16 j; - - unifi_trace(ospriv, UDBG2, "Core dump de-configured\n"); - - if (card->dump_buf == NULL) - { - return; - } - - node = card->dump_buf; - do - { - /* Free payload zones */ - for (j = 0; j < HIP_CDUMP_NUM_ZONES; j++) - { - kfree(node->zone[j]); - node->zone[j] = NULL; - } - - /* Detach */ - del_node = node; - node = node->next; - - /* Free header */ - kfree(del_node); - i++; - } while ((node != NULL) && (node != card->dump_buf)); - - unifi_trace(ospriv, UDBG3, "Freed %d coredump buffers\n", i); - - card->dump_buf = NULL; - card->dump_next_write = NULL; - card->dump_cur_read = NULL; -} /* unifi_coredump_free() */ - - diff --git a/drivers/staging/csr/csr_wifi_hip_packing.c b/drivers/staging/csr/csr_wifi_hip_packing.c deleted file mode 100644 index 0768aefc6d1f..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_packing.c +++ /dev/null @@ -1,4804 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#include "csr_wifi_hip_signals.h" -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_conversions.h" - - -/* - * --------------------------------------------------------------------------- - * get_packed_struct_size - * - * Examine a buffer containing a UniFi signal in wire-format. - * The first two bytes contain the signal ID, decode the signal ID and - * return the size, in bytes, of the signal, not including any bulk - * data. - * - * WARNING: This function is auto-generated, DO NOT EDIT! - * - * Arguments: - * buf Pointer to buffer to decode. - * - * Returns: - * 0 if the signal ID is not recognised (i.e. zero length), - * otherwise the number of bytes occupied by the signal in the buffer. - * This is useful for stepping past the signal to the object in the buffer. - * --------------------------------------------------------------------------- - */ -s32 get_packed_struct_size(const u8 *buf) -{ - s32 size = 0; - u16 sig_id; - - sig_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(buf); - - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - switch (sig_id) - { -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SETKEYS_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SM_START_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TSPEC_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif - case CSR_DEBUG_WORD16_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; - case CSR_DEBUG_GENERIC_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; - case CSR_MA_PACKET_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT64; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; - case CSR_MLME_SET_TIM_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECTED_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_TRIGGERED_GET_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT32; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DELETEKEYS_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_NEXT_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CHANNEL_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_START_AGGREGATION_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - break; -#endif - case CSR_DEBUG_GENERIC_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_LEAVE_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_RESET_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_CANCEL_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT32; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECT_STATUS_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_LEAVE_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TSPEC_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif - case CSR_MLME_SET_TIM_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif - case CSR_DEBUG_GENERIC_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; - case CSR_MA_PACKET_CANCEL_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT32; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif - case CSR_MA_PACKET_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT32; - size += SIZEOF_UINT16; - size += 48 / 8; - size += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif - case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CHANNEL_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - break; -#endif - case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_POWERMGT_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_NEXT_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT32; - size += SIZEOF_UINT32; - size += SIZEOF_UINT32; - size += 48 / 8; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DELETEKEYS_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_RESET_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT32; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SM_START_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - size += 48 / 8; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_PERIODIC_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SETKEYS_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 32 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_POWERMGT_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif - case CSR_MA_PACKET_ERROR_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_PERIODIC_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT32; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TSPEC_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT32; - size += SIZEOF_UINT32; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TSPEC_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif - case CSR_DEBUG_STRING_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_START_AGGREGATION_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += 48 / 8; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_MEASURE_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif - case CSR_MA_PACKET_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT32; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_MEASURE_REQUEST_ID: - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - size += SIZEOF_UINT16; - break; -#endif - default: - size = 0; - } - return size; -} /* get_packed_struct_size() */ - - -/* - * --------------------------------------------------------------------------- - * read_unpack_signal - * - * Unpack a wire-format signal into a host-native structure. - * This function handles any necessary conversions for endianness and - * places no restrictions on packing or alignment for the structure - * definition. - * - * WARNING: This function is auto-generated, DO NOT EDIT! - * - * Arguments: - * ptr Signal buffer to unpack. - * sig Pointer to destination structure to populate. - * - * Returns: - * CSR_RESULT_SUCCESS on success, - * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the ID of signal was not recognised. - * --------------------------------------------------------------------------- - */ -CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig) -{ - s32 index = 0; - - sig->SignalPrimitiveHeader.SignalId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - - sig->SignalPrimitiveHeader.ReceiverProcessId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - - sig->SignalPrimitiveHeader.SenderProcessId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - - switch (sig->SignalPrimitiveHeader.SignalId) - { -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: - sig->u.MlmeSetPacketFilterConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetPacketFilterConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetPacketFilterConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetPacketFilterConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetPacketFilterConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetPacketFilterConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SETKEYS_CONFIRM_ID: - sig->u.MlmeSetkeysConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: - sig->u.MlmeConfigQueueConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConfigQueueConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConfigQueueConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConfigQueueConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConfigQueueConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: - sig->u.MlmeAddAutonomousScanConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanConfirm.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: - sig->u.MlmeAddBlackoutConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutConfirm.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: - sig->u.MlmeDelBlackoutRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelBlackoutRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelBlackoutRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelBlackoutRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelBlackoutRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelBlackoutRequest.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: - sig->u.MlmeGetKeySequenceConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SM_START_CONFIRM_ID: - sig->u.MlmeSmStartConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: - sig->u.MlmeStopAggregationConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopAggregationConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopAggregationConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopAggregationConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopAggregationConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeStopAggregationConfirm.PeerQstaAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MlmeStopAggregationConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopAggregationConfirm.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopAggregationConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TSPEC_REQUEST_ID: - sig->u.MlmeDelTspecRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTspecRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTspecRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTspecRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTspecRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTspecRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTspecRequest.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_DEBUG_WORD16_INDICATION_ID: - sig->u.DebugWord16Indication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[8] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[9] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[10] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[11] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[12] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[13] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[14] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugWord16Indication.DebugWords[15] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; - case CSR_DEBUG_GENERIC_CONFIRM_ID: - sig->u.DebugGenericConfirm.DebugVariable.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericConfirm.DebugVariable.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericConfirm.DebugWords[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericConfirm.DebugWords[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericConfirm.DebugWords[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericConfirm.DebugWords[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericConfirm.DebugWords[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericConfirm.DebugWords[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericConfirm.DebugWords[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericConfirm.DebugWords[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; - case CSR_MA_PACKET_INDICATION_ID: - sig->u.MaPacketIndication.Data.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketIndication.Data.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MaPacketIndication.LocalTime.x, &ptr[index], 64 / 8); - index += 64 / 8; - sig->u.MaPacketIndication.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketIndication.Channel = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketIndication.ReceptionStatus = (CSR_RECEPTION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketIndication.Rssi = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketIndication.Snr = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketIndication.ReceivedRate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; - case CSR_MLME_SET_TIM_REQUEST_ID: - sig->u.MlmeSetTimRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetTimRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetTimRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetTimRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetTimRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetTimRequest.AssociationId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetTimRequest.TimValue = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECTED_INDICATION_ID: - sig->u.MlmeConnectedIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectedIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectedIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectedIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectedIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectedIndication.ConnectionStatus = (CSR_CONNECTION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeConnectedIndication.PeerMacAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: - sig->u.MlmeDelRxTriggerRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelRxTriggerRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelRxTriggerRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelRxTriggerRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelRxTriggerRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelRxTriggerRequest.TriggerId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_TRIGGERED_GET_INDICATION_ID: - sig->u.MlmeTriggeredGetIndication.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeTriggeredGetIndication.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeTriggeredGetIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeTriggeredGetIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeTriggeredGetIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeTriggeredGetIndication.Status = (CSR_MIB_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeTriggeredGetIndication.ErrorIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeTriggeredGetIndication.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_REQUEST_ID: - sig->u.MlmeScanRequest.ChannelList.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanRequest.ChannelList.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanRequest.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanRequest.ScanType = (CSR_SCAN_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanRequest.ProbeDelay = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT32; - sig->u.MlmeScanRequest.MinChannelTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanRequest.MaxChannelTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DELETEKEYS_CONFIRM_ID: - sig->u.MlmeDeletekeysConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDeletekeysConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDeletekeysConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDeletekeysConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDeletekeysConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDeletekeysConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_NEXT_REQUEST_ID: - sig->u.MlmeGetNextRequest.MibAttribute.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetNextRequest.MibAttribute.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetNextRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetNextRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CHANNEL_CONFIRM_ID: - sig->u.MlmeSetChannelConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetChannelConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetChannelConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetChannelConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetChannelConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetChannelConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_START_AGGREGATION_REQUEST_ID: - sig->u.MlmeStartAggregationRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeStartAggregationRequest.PeerQstaAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MlmeStartAggregationRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationRequest.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationRequest.StartingSequenceNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationRequest.BufferSize = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationRequest.BlockAckTimeout = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_REQUEST_ID: - sig->u.MlmeHlSyncRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeHlSyncRequest.GroupAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - break; -#endif - case CSR_DEBUG_GENERIC_REQUEST_ID: - sig->u.DebugGenericRequest.DebugVariable.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericRequest.DebugVariable.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericRequest.DebugWords[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericRequest.DebugWords[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericRequest.DebugWords[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericRequest.DebugWords[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericRequest.DebugWords[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericRequest.DebugWords[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericRequest.DebugWords[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericRequest.DebugWords[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_LEAVE_CONFIRM_ID: - sig->u.MlmeLeaveConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeLeaveConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeLeaveConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeLeaveConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeLeaveConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeLeaveConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: - sig->u.MlmeDelTriggeredGetRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTriggeredGetRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTriggeredGetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTriggeredGetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTriggeredGetRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTriggeredGetRequest.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: - sig->u.MlmeAddMulticastAddressRequest.Data.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddMulticastAddressRequest.Data.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddMulticastAddressRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddMulticastAddressRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddMulticastAddressRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddMulticastAddressRequest.NumberOfMulticastGroupAddresses = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_RESET_REQUEST_ID: - sig->u.MlmeResetRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeResetRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeResetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeResetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeResetRequest.StaAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MlmeResetRequest.SetDefaultMib = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_CANCEL_REQUEST_ID: - sig->u.MlmeScanCancelRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanCancelRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanCancelRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanCancelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanCancelRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: - sig->u.MlmeAddTriggeredGetConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTriggeredGetConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTriggeredGetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTriggeredGetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTriggeredGetConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTriggeredGetConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTriggeredGetConfirm.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: - sig->u.MlmeSetPacketFilterRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetPacketFilterRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetPacketFilterRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetPacketFilterRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetPacketFilterRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetPacketFilterRequest.PacketFilterMode = (CSR_PACKET_FILTER_MODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetPacketFilterRequest.ArpFilterAddress = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT32; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: - sig->u.MlmeDelRxTriggerConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelRxTriggerConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelRxTriggerConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelRxTriggerConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelRxTriggerConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelRxTriggerConfirm.TriggerId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelRxTriggerConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECT_STATUS_REQUEST_ID: - sig->u.MlmeConnectStatusRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectStatusRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectStatusRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectStatusRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectStatusRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectStatusRequest.ConnectionStatus = (CSR_CONNECTION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeConnectStatusRequest.StaAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MlmeConnectStatusRequest.AssociationId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectStatusRequest.AssociationCapabilityInformation = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_LEAVE_REQUEST_ID: - sig->u.MlmeLeaveRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeLeaveRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeLeaveRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeLeaveRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeLeaveRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: - sig->u.MlmeConfigQueueRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConfigQueueRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConfigQueueRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConfigQueueRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConfigQueueRequest.QueueIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConfigQueueRequest.Aifs = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConfigQueueRequest.Cwmin = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConfigQueueRequest.Cwmax = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConfigQueueRequest.TxopLimit = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TSPEC_CONFIRM_ID: - sig->u.MlmeDelTspecConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTspecConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTspecConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTspecConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTspecConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTspecConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTspecConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_MLME_SET_TIM_CONFIRM_ID: - sig->u.MlmeSetTimConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetTimConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetTimConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetTimConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetTimConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetTimConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_INDICATION_ID: - sig->u.MlmeMeasureIndication.MeasurementReportSet.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureIndication.MeasurementReportSet.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureIndication.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: - sig->u.MlmeDelBlackoutConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelBlackoutConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelBlackoutConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelBlackoutConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelBlackoutConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelBlackoutConfirm.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelBlackoutConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: - sig->u.MlmeDelTriggeredGetConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTriggeredGetConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTriggeredGetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTriggeredGetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTriggeredGetConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTriggeredGetConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelTriggeredGetConfirm.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_DEBUG_GENERIC_INDICATION_ID: - sig->u.DebugGenericIndication.DebugVariable.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericIndication.DebugVariable.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericIndication.DebugWords[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericIndication.DebugWords[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericIndication.DebugWords[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericIndication.DebugWords[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericIndication.DebugWords[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericIndication.DebugWords[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericIndication.DebugWords[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugGenericIndication.DebugWords[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; - case CSR_MA_PACKET_CANCEL_REQUEST_ID: - sig->u.MaPacketCancelRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketCancelRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketCancelRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketCancelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketCancelRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketCancelRequest.HostTag = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT32; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: - sig->u.MlmeModifyBssParameterConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeModifyBssParameterConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeModifyBssParameterConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeModifyBssParameterConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeModifyBssParameterConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeModifyBssParameterConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: - sig->u.MlmePauseAutonomousScanConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePauseAutonomousScanConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePauseAutonomousScanConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePauseAutonomousScanConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePauseAutonomousScanConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePauseAutonomousScanConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePauseAutonomousScanConfirm.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_MA_PACKET_REQUEST_ID: - sig->u.MaPacketRequest.Data.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketRequest.Data.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketRequest.TransmitRate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketRequest.HostTag = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT32; - sig->u.MaPacketRequest.Priority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MaPacketRequest.Ra.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MaPacketRequest.TransmissionControl = (CSR_TRANSMISSION_CONTROL) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: - sig->u.MlmeModifyBssParameterRequest.Data.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeModifyBssParameterRequest.Data.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeModifyBssParameterRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeModifyBssParameterRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeModifyBssParameterRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeModifyBssParameterRequest.BeaconPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeModifyBssParameterRequest.DtimPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeModifyBssParameterRequest.CapabilityInformation = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeModifyBssParameterRequest.Bssid.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MlmeModifyBssParameterRequest.RtsThreshold = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: - sig->u.MlmeAddRxTriggerRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddRxTriggerRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddRxTriggerRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddRxTriggerRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddRxTriggerRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddRxTriggerRequest.TriggerId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddRxTriggerRequest.Priority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: - sig->u.MaVifAvailabilityIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaVifAvailabilityIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaVifAvailabilityIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaVifAvailabilityIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaVifAvailabilityIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaVifAvailabilityIndication.Multicast = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: - sig->u.MlmeHlSyncCancelRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncCancelRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncCancelRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncCancelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeHlSyncCancelRequest.GroupAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: - sig->u.MlmeDelAutonomousScanRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelAutonomousScanRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelAutonomousScanRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelAutonomousScanRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelAutonomousScanRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelAutonomousScanRequest.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: - sig->u.MlmeBlackoutEndedIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeBlackoutEndedIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeBlackoutEndedIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeBlackoutEndedIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeBlackoutEndedIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeBlackoutEndedIndication.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: - sig->u.MlmeAutonomousScanDoneIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAutonomousScanDoneIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAutonomousScanDoneIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAutonomousScanDoneIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAutonomousScanDoneIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAutonomousScanDoneIndication.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAutonomousScanDoneIndication.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: - sig->u.MlmeGetKeySequenceRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceRequest.KeyId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetKeySequenceRequest.KeyType = (CSR_KEY_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeGetKeySequenceRequest.Address.x, &ptr[index], 48 / 8); - index += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CHANNEL_REQUEST_ID: - sig->u.MlmeSetChannelRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetChannelRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetChannelRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetChannelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetChannelRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetChannelRequest.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetChannelRequest.Channel = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeSetChannelRequest.Address.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MlmeSetChannelRequest.AvailabilityDuration = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetChannelRequest.AvailabilityInterval = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_CONFIRM_ID: - sig->u.MlmeMeasureConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureConfirm.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: - sig->u.MlmeAddTriggeredGetRequest.MibAttribute.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTriggeredGetRequest.MibAttribute.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTriggeredGetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTriggeredGetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTriggeredGetRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTriggeredGetRequest.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: - sig->u.MlmeAutonomousScanLossIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAutonomousScanLossIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAutonomousScanLossIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAutonomousScanLossIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAutonomousScanLossIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeAutonomousScanLossIndication.Bssid.x, &ptr[index], 48 / 8); - index += 48 / 8; - break; -#endif - case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: - sig->u.MaVifAvailabilityResponse.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaVifAvailabilityResponse.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaVifAvailabilityResponse.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaVifAvailabilityResponse.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaVifAvailabilityResponse.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaVifAvailabilityResponse.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: - sig->u.MlmeAddTemplateRequest.Data1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTemplateRequest.Data1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTemplateRequest.Data2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTemplateRequest.Data2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTemplateRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTemplateRequest.FrameType = (CSR_FRAME_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTemplateRequest.MinTransmitRate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_POWERMGT_CONFIRM_ID: - sig->u.MlmePowermgtConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: - sig->u.MlmeAddPeriodicConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicConfirm.PeriodicId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_CONFIRM_ID: - sig->u.MlmeGetConfirm.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetConfirm.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetConfirm.Status = (CSR_MIB_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetConfirm.ErrorIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_NEXT_CONFIRM_ID: - sig->u.MlmeGetNextConfirm.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetNextConfirm.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetNextConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetNextConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetNextConfirm.Status = (CSR_MIB_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetNextConfirm.ErrorIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: - sig->u.MlmeStopAggregationRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopAggregationRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopAggregationRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopAggregationRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopAggregationRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeStopAggregationRequest.PeerQstaAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MlmeStopAggregationRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopAggregationRequest.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: - sig->u.MlmeAddRxTriggerConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddRxTriggerConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddRxTriggerConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddRxTriggerConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddRxTriggerConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddRxTriggerConfirm.TriggerId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddRxTriggerConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: - sig->u.MlmeAddBlackoutRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutRequest.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutRequest.BlackoutType = (CSR_BLACKOUT_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutRequest.BlackoutSource = (CSR_BLACKOUT_SOURCE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddBlackoutRequest.BlackoutStartReference = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT32; - sig->u.MlmeAddBlackoutRequest.BlackoutPeriod = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT32; - sig->u.MlmeAddBlackoutRequest.BlackoutDuration = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT32; - memcpy(sig->u.MlmeAddBlackoutRequest.PeerStaAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MlmeAddBlackoutRequest.BlackoutCount = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DELETEKEYS_REQUEST_ID: - sig->u.MlmeDeletekeysRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDeletekeysRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDeletekeysRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDeletekeysRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDeletekeysRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDeletekeysRequest.KeyId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDeletekeysRequest.KeyType = (CSR_KEY_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeDeletekeysRequest.Address.x, &ptr[index], 48 / 8); - index += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_RESET_CONFIRM_ID: - sig->u.MlmeResetConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeResetConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeResetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeResetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeResetConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CONFIRM_ID: - sig->u.MlmeHlSyncConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeHlSyncConfirm.GroupAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MlmeHlSyncConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: - sig->u.MlmeAddAutonomousScanRequest.ChannelList.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanRequest.ChannelList.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanRequest.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanRequest.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanRequest.ChannelStartingFactor = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanRequest.ScanType = (CSR_SCAN_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanRequest.ProbeDelay = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT32; - sig->u.MlmeAddAutonomousScanRequest.MinChannelTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddAutonomousScanRequest.MaxChannelTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_REQUEST_ID: - sig->u.MlmeSetRequest.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetRequest.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SM_START_REQUEST_ID: - sig->u.MlmeSmStartRequest.Beacon.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartRequest.Beacon.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartRequest.BssParameters.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartRequest.BssParameters.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartRequest.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartRequest.Channel = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeSmStartRequest.InterfaceAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - memcpy(sig->u.MlmeSmStartRequest.Bssid.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MlmeSmStartRequest.BeaconPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartRequest.DtimPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSmStartRequest.CapabilityInformation = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: - sig->u.MlmeConnectStatusConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectStatusConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectStatusConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectStatusConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectStatusConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeConnectStatusConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: - sig->u.MlmeDelAutonomousScanConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelAutonomousScanConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelAutonomousScanConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelAutonomousScanConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelAutonomousScanConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelAutonomousScanConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelAutonomousScanConfirm.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_PERIODIC_REQUEST_ID: - sig->u.MlmeDelPeriodicRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelPeriodicRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelPeriodicRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelPeriodicRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelPeriodicRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelPeriodicRequest.PeriodicId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SETKEYS_REQUEST_ID: - sig->u.MlmeSetkeysRequest.Key.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.Key.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.Length = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.KeyId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.KeyType = (CSR_KEY_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeSetkeysRequest.Address.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MlmeSetkeysRequest.SequenceNumber[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.SequenceNumber[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.SequenceNumber[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.SequenceNumber[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.SequenceNumber[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.SequenceNumber[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.SequenceNumber[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetkeysRequest.SequenceNumber[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(&sig->u.MlmeSetkeysRequest.CipherSuiteSelector, &ptr[index], 32 / 8); - index += 32 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: - sig->u.MlmePauseAutonomousScanRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePauseAutonomousScanRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePauseAutonomousScanRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePauseAutonomousScanRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePauseAutonomousScanRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePauseAutonomousScanRequest.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePauseAutonomousScanRequest.Pause = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_REQUEST_ID: - sig->u.MlmeGetRequest.MibAttribute.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetRequest.MibAttribute.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeGetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_POWERMGT_REQUEST_ID: - sig->u.MlmePowermgtRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtRequest.PowerManagementMode = (CSR_POWER_MANAGEMENT_MODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtRequest.ReceiveDtims = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtRequest.ListenInterval = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmePowermgtRequest.TrafficWindow = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_MA_PACKET_ERROR_INDICATION_ID: - sig->u.MaPacketErrorIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketErrorIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketErrorIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketErrorIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketErrorIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MaPacketErrorIndication.PeerQstaAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MaPacketErrorIndication.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketErrorIndication.SequenceNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_PERIODIC_REQUEST_ID: - sig->u.MlmeAddPeriodicRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicRequest.PeriodicId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicRequest.MaximumLatency = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT32; - sig->u.MlmeAddPeriodicRequest.PeriodicSchedulingMode = (CSR_PERIODIC_SCHEDULING_MODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicRequest.WakeHost = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddPeriodicRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TSPEC_REQUEST_ID: - sig->u.MlmeAddTspecRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecRequest.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecRequest.PsScheme = (CSR_PS_SCHEME) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecRequest.MediumTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecRequest.ServiceStartTime = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT32; - sig->u.MlmeAddTspecRequest.ServiceInterval = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT32; - sig->u.MlmeAddTspecRequest.MinimumDataRate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: - sig->u.MlmeAddMulticastAddressConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddMulticastAddressConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddMulticastAddressConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddMulticastAddressConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddMulticastAddressConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddMulticastAddressConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TSPEC_CONFIRM_ID: - sig->u.MlmeAddTspecConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTspecConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: - sig->u.MlmeHlSyncCancelConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncCancelConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncCancelConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncCancelConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeHlSyncCancelConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_CONFIRM_ID: - sig->u.MlmeScanConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeScanConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_DEBUG_STRING_INDICATION_ID: - sig->u.DebugStringIndication.DebugMessage.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugStringIndication.DebugMessage.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugStringIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.DebugStringIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: - sig->u.MlmeAddTemplateConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTemplateConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTemplateConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTemplateConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTemplateConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTemplateConfirm.FrameType = (CSR_FRAME_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeAddTemplateConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: - sig->u.MlmeBlockackErrorIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeBlockackErrorIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeBlockackErrorIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeBlockackErrorIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeBlockackErrorIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeBlockackErrorIndication.ResultCode = (CSR_REASON_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeBlockackErrorIndication.PeerQstaAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CONFIRM_ID: - sig->u.MlmeSetConfirm.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetConfirm.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetConfirm.Status = (CSR_MIB_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeSetConfirm.ErrorIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_REQUEST_ID: - sig->u.MlmeMeasureRequest.MeasurementRequestSet.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureRequest.MeasurementRequestSet.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeMeasureRequest.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_START_AGGREGATION_CONFIRM_ID: - sig->u.MlmeStartAggregationConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - memcpy(sig->u.MlmeStartAggregationConfirm.PeerQstaAddress.x, &ptr[index], 48 / 8); - index += 48 / 8; - sig->u.MlmeStartAggregationConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationConfirm.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStartAggregationConfirm.SequenceNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_MEASURE_CONFIRM_ID: - sig->u.MlmeStopMeasureConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopMeasureConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopMeasureConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopMeasureConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopMeasureConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopMeasureConfirm.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_MA_PACKET_CONFIRM_ID: - sig->u.MaPacketConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketConfirm.TransmissionStatus = (CSR_TRANSMISSION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketConfirm.RetryCount = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketConfirm.Rate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MaPacketConfirm.HostTag = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT32; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: - sig->u.MlmeDelPeriodicConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelPeriodicConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelPeriodicConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelPeriodicConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelPeriodicConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelPeriodicConfirm.PeriodicId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeDelPeriodicConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_MEASURE_REQUEST_ID: - sig->u.MlmeStopMeasureRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopMeasureRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopMeasureRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopMeasureRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - sig->u.MlmeStopMeasureRequest.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index); - index += SIZEOF_UINT16; - break; -#endif - - default: - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - return CSR_RESULT_SUCCESS; -} /* read_unpack_signal() */ - - -/* - * --------------------------------------------------------------------------- - * write_pack - * - * Convert a signal structure, in host-native format, to the - * little-endian wire format specified in the UniFi Host Interface - * Protocol Specification. - * - * WARNING: This function is auto-generated, DO NOT EDIT! - * - * Arguments: - * sig Pointer to signal structure to pack. - * ptr Destination buffer to pack into. - * sig_len Returns the length of the packed signal, i.e. the - * number of bytes written to ptr. - * - * Returns: - * CSR_RESULT_SUCCESS on success, - * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the ID of signal was not recognised. - * --------------------------------------------------------------------------- - */ -CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len) -{ - s16 index = 0; - - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->SignalPrimitiveHeader.SignalId, ptr + index); - index += SIZEOF_UINT16; - - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->SignalPrimitiveHeader.ReceiverProcessId, ptr + index); - index += SIZEOF_UINT16; - - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->SignalPrimitiveHeader.SenderProcessId, ptr + index); - index += SIZEOF_UINT16; - - switch (sig->SignalPrimitiveHeader.SignalId) - { -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SETKEYS_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.AutonomousScanId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.BlackoutId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.BlackoutId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[0], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[1], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[2], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[3], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[4], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[5], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[6], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[7], ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SM_START_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeStopAggregationConfirm.PeerQstaAddress.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.UserPriority, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Direction, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TSPEC_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.UserPriority, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Direction, ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_DEBUG_WORD16_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[0], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[1], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[2], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[3], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[4], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[5], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[6], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[7], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[8], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[9], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[10], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[11], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[12], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[13], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[14], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[15], ptr + index); - index += SIZEOF_UINT16; - break; - case CSR_DEBUG_GENERIC_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugVariable.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugVariable.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[0], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[1], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[2], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[3], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[4], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[5], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[6], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[7], ptr + index); - index += SIZEOF_UINT16; - break; - case CSR_MA_PACKET_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Data.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Data.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MaPacketIndication.LocalTime.x, 64 / 8); - index += 64 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Ifindex, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Channel, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.ReceptionStatus, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Rssi, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Snr, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.ReceivedRate, ptr + index); - index += SIZEOF_UINT16; - break; - case CSR_MLME_SET_TIM_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.AssociationId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.TimValue, ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECTED_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.ConnectionStatus, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeConnectedIndication.PeerMacAddress.x, 48 / 8); - index += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.TriggerId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_TRIGGERED_GET_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.MibAttributeValue.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.MibAttributeValue.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.Status, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.ErrorIndex, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.TriggeredId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.ChannelList.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.ChannelList.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.InformationElements.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.InformationElements.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.Ifindex, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.ScanType, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.ProbeDelay, ptr + index); - index += SIZEOF_UINT32; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.MinChannelTime, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.MaxChannelTime, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DELETEKEYS_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_NEXT_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextRequest.MibAttribute.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextRequest.MibAttribute.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CHANNEL_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_START_AGGREGATION_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeStartAggregationRequest.PeerQstaAddress.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.UserPriority, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Direction, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.StartingSequenceNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.BufferSize, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.BlockAckTimeout, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeHlSyncRequest.GroupAddress.x, 48 / 8); - index += 48 / 8; - break; -#endif - case CSR_DEBUG_GENERIC_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugVariable.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugVariable.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[0], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[1], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[2], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[3], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[4], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[5], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[6], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[7], ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_LEAVE_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.TriggeredId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.Data.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.Data.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.NumberOfMulticastGroupAddresses, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_RESET_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeResetRequest.StaAddress.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.SetDefaultMib, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_CANCEL_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.TriggeredId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.InformationElements.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.InformationElements.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.PacketFilterMode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.ArpFilterAddress, ptr + index); - index += SIZEOF_UINT32; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.TriggerId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECT_STATUS_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.InformationElements.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.InformationElements.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.ConnectionStatus, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeConnectStatusRequest.StaAddress.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.AssociationId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.AssociationCapabilityInformation, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_LEAVE_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.QueueIndex, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Aifs, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Cwmin, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Cwmax, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.TxopLimit, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TSPEC_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.UserPriority, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_MLME_SET_TIM_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.MeasurementReportSet.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.MeasurementReportSet.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.DialogToken, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.BlackoutId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.TriggeredId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_DEBUG_GENERIC_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugVariable.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugVariable.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[0], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[1], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[2], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[3], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[4], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[5], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[6], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[7], ptr + index); - index += SIZEOF_UINT16; - break; - case CSR_MA_PACKET_CANCEL_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.HostTag, ptr + index); - index += SIZEOF_UINT32; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.AutonomousScanId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_MA_PACKET_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Data.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Data.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.TransmitRate, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.HostTag, ptr + index); - index += SIZEOF_UINT32; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Priority, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MaPacketRequest.Ra.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.TransmissionControl, ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.Data.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.Data.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.BeaconPeriod, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.DtimPeriod, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.CapabilityInformation, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeModifyBssParameterRequest.Bssid.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.RtsThreshold, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.InformationElements.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.InformationElements.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.TriggerId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.Priority, ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Multicast, ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeHlSyncCancelRequest.GroupAddress.x, 48 / 8); - index += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.AutonomousScanId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.BlackoutId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.ResultCode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.AutonomousScanId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.KeyId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.KeyType, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeGetKeySequenceRequest.Address.x, 48 / 8); - index += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CHANNEL_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Ifindex, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Channel, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeSetChannelRequest.Address.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.AvailabilityDuration, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.AvailabilityInterval, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.DialogToken, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.MibAttribute.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.MibAttribute.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.TriggeredId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeAutonomousScanLossIndication.Bssid.x, 48 / 8); - index += 48 / 8; - break; -#endif - case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.Data1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.Data1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.Data2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.Data2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.FrameType, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.MinTransmitRate, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_POWERMGT_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.PeriodicId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.MibAttributeValue.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.MibAttributeValue.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.Status, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.ErrorIndex, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_NEXT_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.MibAttributeValue.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.MibAttributeValue.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.Status, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.ErrorIndex, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeStopAggregationRequest.PeerQstaAddress.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.UserPriority, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Direction, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.TriggerId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutType, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutSource, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutStartReference, ptr + index); - index += SIZEOF_UINT32; - CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutPeriod, ptr + index); - index += SIZEOF_UINT32; - CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutDuration, ptr + index); - index += SIZEOF_UINT32; - memcpy(ptr + index, sig->u.MlmeAddBlackoutRequest.PeerStaAddress.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutCount, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DELETEKEYS_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.KeyId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.KeyType, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeDeletekeysRequest.Address.x, 48 / 8); - index += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_RESET_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeHlSyncConfirm.GroupAddress.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ChannelList.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ChannelList.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.InformationElements.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.InformationElements.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.AutonomousScanId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.Ifindex, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ChannelStartingFactor, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ScanType, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ProbeDelay, ptr + index); - index += SIZEOF_UINT32; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.MinChannelTime, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.MaxChannelTime, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetRequest.MibAttributeValue.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetRequest.MibAttributeValue.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SM_START_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Beacon.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Beacon.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.BssParameters.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.BssParameters.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Ifindex, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Channel, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeSmStartRequest.InterfaceAddress.x, 48 / 8); - index += 48 / 8; - memcpy(ptr + index, sig->u.MlmeSmStartRequest.Bssid.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.BeaconPeriod, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.DtimPeriod, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.CapabilityInformation, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.AutonomousScanId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_PERIODIC_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.PeriodicId, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SETKEYS_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Key.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Key.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Length, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.KeyId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.KeyType, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeSetkeysRequest.Address.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[0], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[1], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[2], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[3], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[4], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[5], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[6], ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[7], ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, &sig->u.MlmeSetkeysRequest.CipherSuiteSelector, 32 / 8); - index += 32 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.AutonomousScanId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Pause, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetRequest.MibAttribute.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetRequest.MibAttribute.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_POWERMGT_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.PowerManagementMode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.ReceiveDtims, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.ListenInterval, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.TrafficWindow, ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_MA_PACKET_ERROR_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MaPacketErrorIndication.PeerQstaAddress.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.UserPriority, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.SequenceNumber, ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_PERIODIC_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.PeriodicId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.MaximumLatency, ptr + index); - index += SIZEOF_UINT32; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.PeriodicSchedulingMode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.WakeHost, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.UserPriority, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TSPEC_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.UserPriority, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Direction, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.PsScheme, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.MediumTime, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.ServiceStartTime, ptr + index); - index += SIZEOF_UINT32; - CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.ServiceInterval, ptr + index); - index += SIZEOF_UINT32; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.MinimumDataRate, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TSPEC_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.UserPriority, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_DEBUG_STRING_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugStringIndication.DebugMessage.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugStringIndication.DebugMessage.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugStringIndication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugStringIndication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.FrameType, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.ResultCode, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeBlockackErrorIndication.PeerQstaAddress.x, 48 / 8); - index += 48 / 8; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.MibAttributeValue.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.MibAttributeValue.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.Status, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.ErrorIndex, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.MeasurementRequestSet.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.MeasurementRequestSet.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.DialogToken, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_START_AGGREGATION_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - memcpy(ptr + index, sig->u.MlmeStartAggregationConfirm.PeerQstaAddress.x, 48 / 8); - index += 48 / 8; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.UserPriority, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Direction, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.SequenceNumber, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_MEASURE_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.DialogToken, ptr + index); - index += SIZEOF_UINT16; - break; -#endif - case CSR_MA_PACKET_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.TransmissionStatus, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.RetryCount, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Rate, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.HostTag, ptr + index); - index += SIZEOF_UINT32; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.VirtualInterfaceIdentifier, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.PeriodicId, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.ResultCode, ptr + index); - index += SIZEOF_UINT16; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_MEASURE_REQUEST_ID: - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.Dummydataref1.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.Dummydataref1.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.Dummydataref2.SlotNumber, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.Dummydataref2.DataLength, ptr + index); - index += SIZEOF_UINT16; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.DialogToken, ptr + index); - index += SIZEOF_UINT16; - break; -#endif - - default: - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - *sig_len = index; - - return CSR_RESULT_SUCCESS; -} /* write_pack() */ - - diff --git a/drivers/staging/csr/csr_wifi_hip_send.c b/drivers/staging/csr/csr_wifi_hip_send.c deleted file mode 100644 index 76429e5e77cf..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_send.c +++ /dev/null @@ -1,415 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * *************************************************************************** - * - * FILE: csr_wifi_hip_send.c - * - * PURPOSE: - * Code for adding a signal request to the from-host queue. - * When the driver bottom-half is run, it will take requests from the - * queue and pass them to the UniFi. - * - * *************************************************************************** - */ -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_conversions.h" -#include "csr_wifi_hip_sigs.h" -#include "csr_wifi_hip_card.h" - -unifi_TrafficQueue unifi_frame_priority_to_queue(CSR_PRIORITY priority) -{ - switch (priority) - { - case CSR_QOS_UP0: - case CSR_QOS_UP3: - return UNIFI_TRAFFIC_Q_BE; - case CSR_QOS_UP1: - case CSR_QOS_UP2: - return UNIFI_TRAFFIC_Q_BK; - case CSR_QOS_UP4: - case CSR_QOS_UP5: - return UNIFI_TRAFFIC_Q_VI; - case CSR_QOS_UP6: - case CSR_QOS_UP7: - case CSR_MANAGEMENT: - return UNIFI_TRAFFIC_Q_VO; - default: - return UNIFI_TRAFFIC_Q_BE; - } -} - - -CSR_PRIORITY unifi_get_default_downgrade_priority(unifi_TrafficQueue queue) -{ - switch (queue) - { - case UNIFI_TRAFFIC_Q_BE: - return CSR_QOS_UP0; - case UNIFI_TRAFFIC_Q_BK: - return CSR_QOS_UP1; - case UNIFI_TRAFFIC_Q_VI: - return CSR_QOS_UP5; - case UNIFI_TRAFFIC_Q_VO: - return CSR_QOS_UP6; - default: - return CSR_QOS_UP0; - } -} - - -/* - * --------------------------------------------------------------------------- - * send_signal - * - * This function queues a signal for sending to UniFi. It first checks - * that there is space on the fh_signal_queue for another entry, then - * claims any bulk data slots required and copies data into them. Then - * increments the fh_signal_queue write count. - * - * The fh_signal_queue is later processed by the driver bottom half - * (in unifi_bh()). - * - * This function call unifi_pause_xmit() to pause the flow of data plane - * packets when: - * - the fh_signal_queue ring buffer is full - * - there are less than UNIFI_MAX_DATA_REFERENCES (2) bulk data - * slots available. - * - * Arguments: - * card Pointer to card context structure - * sigptr Pointer to the signal to write to UniFi. - * siglen Number of bytes pointer to by sigptr. - * bulkdata Array of pointers to an associated bulk data. - * sigq To which from-host queue to add the signal. - * - * Returns: - * CSR_RESULT_SUCCESS on success - * CSR_WIFI_HIP_RESULT_NO_SPACE if there were insufficient data slots or - * no free signal queue entry - * - * Notes: - * Calls unifi_pause_xmit() when the last slots are used. - * --------------------------------------------------------------------------- - */ -static CsrResult send_signal(card_t *card, const u8 *sigptr, u32 siglen, - const bulk_data_param_t *bulkdata, - q_t *sigq, u32 priority_q, u32 run_bh) -{ - u16 i, data_slot_size; - card_signal_t *csptr; - s16 qe; - CsrResult r; - s16 debug_print = 0; - - data_slot_size = CardGetDataSlotSize(card); - - /* Check that the fh_data_queue has a free slot */ - if (!CSR_WIFI_HIP_Q_SLOTS_FREE(sigq)) - { - unifi_trace(card->ospriv, UDBG3, "send_signal: %s full\n", sigq->name); - - return CSR_WIFI_HIP_RESULT_NO_SPACE; - } - - /* - * Now add the signal to the From Host signal queue - */ - /* Get next slot on queue */ - qe = CSR_WIFI_HIP_Q_NEXT_W_SLOT(sigq); - csptr = CSR_WIFI_HIP_Q_SLOT_DATA(sigq, qe); - - /* Make up the card_signal struct */ - csptr->signal_length = (u16)siglen; - memcpy((void *)csptr->sigbuf, (void *)sigptr, siglen); - - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i) - { - if ((bulkdata != NULL) && (bulkdata->d[i].data_length != 0)) - { - u32 datalen = bulkdata->d[i].data_length; - - /* Make sure data will fit in a bulk data slot */ - if (bulkdata->d[i].os_data_ptr == NULL) - { - unifi_error(card->ospriv, "send_signal - NULL bulkdata[%d]\n", i); - debug_print++; - csptr->bulkdata[i].data_length = 0; - } - else - { - if (datalen > data_slot_size) - { - unifi_error(card->ospriv, - "send_signal - Invalid data length %u (@%p), " - "truncating\n", - datalen, bulkdata->d[i].os_data_ptr); - datalen = data_slot_size; - debug_print++; - } - /* Store the bulk data info in the soft queue. */ - csptr->bulkdata[i].os_data_ptr = (u8 *)bulkdata->d[i].os_data_ptr; - csptr->bulkdata[i].os_net_buf_ptr = (u8 *)bulkdata->d[i].os_net_buf_ptr; - csptr->bulkdata[i].net_buf_length = bulkdata->d[i].net_buf_length; - csptr->bulkdata[i].data_length = datalen; - } - } - else - { - UNIFI_INIT_BULK_DATA(&csptr->bulkdata[i]); - } - } - - if (debug_print) - { - const u8 *sig = sigptr; - - unifi_error(card->ospriv, "Signal(%d): %*ph\n", siglen, - 16, sig); - unifi_error(card->ospriv, "Bulkdata pointer %p(%d), %p(%d)\n", - bulkdata != NULL?bulkdata->d[0].os_data_ptr : NULL, - bulkdata != NULL?bulkdata->d[0].data_length : 0, - bulkdata != NULL?bulkdata->d[1].os_data_ptr : NULL, - bulkdata != NULL?bulkdata->d[1].data_length : 0); - } - - /* Advance the written count to say there is a new entry */ - CSR_WIFI_HIP_Q_INC_W(sigq); - - /* - * Set the flag to say reason for waking was a host request. - * Then ask the OS layer to run the unifi_bh. - */ - if (run_bh == 1) - { - card->bh_reason_host = 1; - r = unifi_run_bh(card->ospriv); - if (r != CSR_RESULT_SUCCESS) - { - unifi_error(card->ospriv, "failed to run bh.\n"); - card->bh_reason_host = 0; - - /* - * The bulk data buffer will be freed by the caller. - * We need to invalidate the description of the bulk data in our - * soft queue, to prevent the core freeing the bulk data again later. - */ - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i) - { - if (csptr->bulkdata[i].data_length != 0) - { - csptr->bulkdata[i].os_data_ptr = csptr->bulkdata[i].os_net_buf_ptr = NULL; - csptr->bulkdata[i].net_buf_length = csptr->bulkdata[i].data_length = 0; - } - } - return r; - } - } - else - { - unifi_error(card->ospriv, "run_bh=%d, bh not called.\n", run_bh); - } - - /* - * Have we used up all the fh signal list entries? - */ - if (CSR_WIFI_HIP_Q_SLOTS_FREE(sigq) == 0) - { - /* We have filled the queue, so stop the upper layer. The command queue - * is an exception, as suspending due to that being full could delay - * resume/retry until new commands or data are received. - */ - if (sigq != &card->fh_command_queue) - { - /* - * Must call unifi_pause_xmit() *before* setting the paused flag. - * (the unifi_pause_xmit call should not be after setting the flag because of the possibility of being interrupted - * by the bh thread between our setting the flag and the call to unifi_pause_xmit() - * If bh thread then cleared the flag, we would end up paused, but without the flag set) - * Instead, setting it afterwards means that if this thread is interrupted by the bh thread - * the pause flag is still guaranteed to end up set - * However the potential deadlock now is that if bh thread emptied the queue and cleared the flag before this thread's - * call to unifi_pause_xmit(), then bh thread may not run again because it will be waiting for - * a packet to appear in the queue but nothing ever will because xmit is paused. - * So we will end up with the queue paused, and the flag set to say it is paused, but bh never runs to unpause it. - * (Note even this bad situation would not persist long in practice, because something else (eg rx, or tx in different queue) - * is likely to wake bh thread quite soon) - * But to avoid this deadlock completely, after setting the flag we check that there is something left in the queue. - * If there is, we know that bh thread has not emptied the queue yet. - * Since bh thread checks to unpause the queue *after* taking packets from the queue, we know that it is still going to make at - * least one more check to see whether it needs to unpause the queue. So all is well. - * If there are no packets in the queue, then the deadlock described above might happen. To make sure it does not, we - * unpause the queue here. A possible side effect is that unifi_restart_xmit() may (rarely) be called for second time - * unnecessarily, which is harmless - */ - -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - unifi_debug_log_to_buf("P"); -#endif - unifi_pause_xmit(card->ospriv, (unifi_TrafficQueue)priority_q); - card_tx_q_pause(card, priority_q); - if (CSR_WIFI_HIP_Q_SLOTS_USED(sigq) == 0) - { - card_tx_q_unpause(card, priority_q); - unifi_restart_xmit(card->ospriv, (unifi_TrafficQueue) priority_q); - } - } - else - { - unifi_warning(card->ospriv, - "send_signal: fh_cmd_q full, not pausing (run_bh=%d)\n", - run_bh); - } - } - - return CSR_RESULT_SUCCESS; -} /* send_signal() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_send_signal - * - * Invokes send_signal() to queue a signal in the command or traffic queue - * If sigptr pointer is NULL, it pokes the bh to check if UniFi is responsive. - * - * Arguments: - * card Pointer to card context struct - * sigptr Pointer to signal from card. - * siglen Size of the signal - * bulkdata Pointer to the bulk data of the signal - * - * Returns: - * CSR_RESULT_SUCCESS on success - * CSR_WIFI_HIP_RESULT_NO_SPACE if there were insufficient data slots or no free signal queue entry - * - * Notes: - * unifi_send_signal() is used to queue signals, created by the driver, - * to the device. Signals are constructed using the UniFi packed structures. - * --------------------------------------------------------------------------- - */ -CsrResult unifi_send_signal(card_t *card, const u8 *sigptr, u32 siglen, - const bulk_data_param_t *bulkdata) -{ - q_t *sig_soft_q; - u16 signal_id; - CsrResult r; - u32 run_bh; - u32 priority_q; - - /* A NULL signal pointer is a request to check if UniFi is responsive */ - if (sigptr == NULL) - { - card->bh_reason_host = 1; - return unifi_run_bh(card->ospriv); - } - - priority_q = 0; - run_bh = 1; - signal_id = GET_SIGNAL_ID(sigptr); - /* - * If the signal is a CSR_MA_PACKET_REQUEST , - * we send it using the traffic soft queue. Else we use the command soft queue. - */ - if (signal_id == CSR_MA_PACKET_REQUEST_ID) - { - u16 frame_priority; - - if (card->periodic_wake_mode == UNIFI_PERIODIC_WAKE_HOST_ENABLED) - { - run_bh = 0; - } - -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE) - unifi_debug_log_to_buf("D"); -#endif - /* Sanity check: MA-PACKET.req must have a valid bulk data */ - if ((bulkdata->d[0].data_length == 0) || (bulkdata->d[0].os_data_ptr == NULL)) - { - unifi_error(card->ospriv, "MA-PACKET.req with empty bulk data (%d bytes in %p)\n", - bulkdata->d[0].data_length, bulkdata->d[0].os_data_ptr); - dump((void *)sigptr, siglen); - return CSR_RESULT_FAILURE; - } - - /* Map the frame priority to a traffic queue index. */ - frame_priority = GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(sigptr); - priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY)frame_priority); - - sig_soft_q = &card->fh_traffic_queue[priority_q]; - } - else - { - sig_soft_q = &card->fh_command_queue; - } - - r = send_signal(card, sigptr, siglen, bulkdata, sig_soft_q, priority_q, run_bh); - /* On error, the caller must free or requeue bulkdata buffers */ - - return r; -} /* unifi_send_signal() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_send_resources_available - * - * Examines whether there is available space to queue - * a signal in the command or traffic queue - * - * Arguments: - * card Pointer to card context struct - * sigptr Pointer to signal. - * - * Returns: - * CSR_RESULT_SUCCESS if resources available - * CSR_WIFI_HIP_RESULT_NO_SPACE if there was no free signal queue entry - * - * Notes: - * --------------------------------------------------------------------------- - */ -CsrResult unifi_send_resources_available(card_t *card, const u8 *sigptr) -{ - q_t *sig_soft_q; - u16 signal_id = GET_SIGNAL_ID(sigptr); - - /* - * If the signal is a CSR_MA_PACKET_REQUEST , - * we send it using the traffic soft queue. Else we use the command soft queue. - */ - if (signal_id == CSR_MA_PACKET_REQUEST_ID) - { - u16 frame_priority; - u32 priority_q; - - /* Map the frame priority to a traffic queue index. */ - frame_priority = GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(sigptr); - priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY)frame_priority); - - sig_soft_q = &card->fh_traffic_queue[priority_q]; - } - else - { - sig_soft_q = &card->fh_command_queue; - } - - /* Check that the fh_data_queue has a free slot */ - if (!CSR_WIFI_HIP_Q_SLOTS_FREE(sig_soft_q)) - { - unifi_notice(card->ospriv, "unifi_send_resources_available: %s full\n", - sig_soft_q->name); - return CSR_WIFI_HIP_RESULT_NO_SPACE; - } - - return CSR_RESULT_SUCCESS; -} /* unifi_send_resources_available() */ - - diff --git a/drivers/staging/csr/csr_wifi_hip_signals.c b/drivers/staging/csr/csr_wifi_hip_signals.c deleted file mode 100644 index 3c821320df00..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_signals.c +++ /dev/null @@ -1,1313 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - - -/* Generated by hip_dd_l_c_gen.pl */ - -#include "csr_wifi_hip_signals.h" - -#include "csr_wifi_hip_unifi.h" - -s32 SigGetSize(const CSR_SIGNAL *aSignal) -{ - switch (aSignal->SignalPrimitiveHeader.SignalId) - { - case CSR_MA_PACKET_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_REQUEST); - case CSR_MA_PACKET_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_CONFIRM); - case CSR_MA_PACKET_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_INDICATION); - case CSR_MA_PACKET_CANCEL_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_CANCEL_REQUEST); - case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_VIF_AVAILABILITY_RESPONSE); - case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_VIF_AVAILABILITY_INDICATION); - case CSR_MA_PACKET_ERROR_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_ERROR_INDICATION); -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_RESET_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_RESET_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_RESET_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_RESET_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_NEXT_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_NEXT_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_NEXT_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_NEXT_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_POWERMGT_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_POWERMGT_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_POWERMGT_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_POWERMGT_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_INDICATION); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SETKEYS_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SETKEYS_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SETKEYS_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SETKEYS_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DELETEKEYS_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DELETEKEYS_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DELETEKEYS_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DELETEKEYS_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECTED_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECTED_INDICATION); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_CANCEL_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_CANCEL_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CANCEL_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CANCEL_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_PERIODIC_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_PERIODIC_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_PERIODIC_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_PERIODIC_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_PERIODIC_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_PERIODIC_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_PACKET_FILTER_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_PACKET_FILTER_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_MEASURE_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_MEASURE_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_MEASURE_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_MEASURE_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TRIGGERED_GET_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TRIGGERED_GET_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TRIGGERED_GET_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TRIGGERED_GET_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_TRIGGERED_GET_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_TRIGGERED_GET_INDICATION); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_BLACKOUT_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_BLACKOUT_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_BLACKOUT_ENDED_INDICATION); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_BLACKOUT_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_BLACKOUT_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_RX_TRIGGER_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_RX_TRIGGER_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_RX_TRIGGER_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_RX_TRIGGER_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECT_STATUS_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECT_STATUS_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECT_STATUS_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TEMPLATE_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TEMPLATE_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONFIG_QUEUE_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONFIG_QUEUE_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TSPEC_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TSPEC_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TSPEC_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TSPEC_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TSPEC_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TSPEC_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TSPEC_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TSPEC_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_START_AGGREGATION_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_START_AGGREGATION_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_START_AGGREGATION_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_START_AGGREGATION_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_BLOCKACK_ERROR_INDICATION); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_AGGREGATION_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_AGGREGATION_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SM_START_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SM_START_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SM_START_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SM_START_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_LEAVE_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_LEAVE_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_LEAVE_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_LEAVE_CONFIRM); -#endif - case CSR_MLME_SET_TIM_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_TIM_REQUEST); - case CSR_MLME_SET_TIM_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_TIM_CONFIRM); -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_KEY_SEQUENCE_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_KEY_SEQUENCE_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CHANNEL_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CHANNEL_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CHANNEL_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CHANNEL_CONFIRM); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST); -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM); -#endif - case CSR_DEBUG_STRING_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_STRING_INDICATION); - case CSR_DEBUG_WORD16_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_WORD16_INDICATION); - case CSR_DEBUG_GENERIC_REQUEST_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_REQUEST); - case CSR_DEBUG_GENERIC_CONFIRM_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_CONFIRM); - case CSR_DEBUG_GENERIC_INDICATION_ID: - return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_INDICATION); - default: - return 0; - } -} - - -s32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef) -{ - s32 numRefs = 0; - - switch (aSignal->SignalPrimitiveHeader.SignalId) - { - case CSR_MA_PACKET_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MaPacketRequest.Data; - aDataRef[numRefs++] = &aSignal->u.MaPacketRequest.Dummydataref2; - break; - case CSR_MA_PACKET_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MaPacketConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MaPacketConfirm.Dummydataref2; - break; - case CSR_MA_PACKET_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.MaPacketIndication.Data; - aDataRef[numRefs++] = &aSignal->u.MaPacketIndication.Dummydataref2; - break; - case CSR_MA_PACKET_CANCEL_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MaPacketCancelRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MaPacketCancelRequest.Dummydataref2; - break; - case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: - aDataRef[numRefs++] = &aSignal->u.MaVifAvailabilityResponse.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MaVifAvailabilityResponse.Dummydataref2; - break; - case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.MaVifAvailabilityIndication.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MaVifAvailabilityIndication.Dummydataref2; - break; - case CSR_MA_PACKET_ERROR_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.MaPacketErrorIndication.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MaPacketErrorIndication.Dummydataref2; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_RESET_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeResetRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeResetRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_RESET_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeResetConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeResetConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeGetRequest.MibAttribute; - aDataRef[numRefs++] = &aSignal->u.MlmeGetRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeGetConfirm.MibAttributeValue; - aDataRef[numRefs++] = &aSignal->u.MlmeGetConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeSetRequest.MibAttributeValue; - aDataRef[numRefs++] = &aSignal->u.MlmeSetRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeSetConfirm.MibAttributeValue; - aDataRef[numRefs++] = &aSignal->u.MlmeSetConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_NEXT_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeGetNextRequest.MibAttribute; - aDataRef[numRefs++] = &aSignal->u.MlmeGetNextRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_NEXT_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeGetNextConfirm.MibAttributeValue; - aDataRef[numRefs++] = &aSignal->u.MlmeGetNextConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_POWERMGT_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmePowermgtRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmePowermgtRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_POWERMGT_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmePowermgtConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmePowermgtConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeScanRequest.ChannelList; - aDataRef[numRefs++] = &aSignal->u.MlmeScanRequest.InformationElements; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeScanConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeScanConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeMeasureRequest.MeasurementRequestSet; - aDataRef[numRefs++] = &aSignal->u.MlmeMeasureRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeMeasureConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeMeasureConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeMeasureIndication.MeasurementReportSet; - aDataRef[numRefs++] = &aSignal->u.MlmeMeasureIndication.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SETKEYS_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeSetkeysRequest.Key; - aDataRef[numRefs++] = &aSignal->u.MlmeSetkeysRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SETKEYS_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeSetkeysConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeSetkeysConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DELETEKEYS_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDeletekeysRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDeletekeysRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DELETEKEYS_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDeletekeysConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDeletekeysConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAutonomousScanLossIndication.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAutonomousScanLossIndication.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECTED_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeConnectedIndication.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeConnectedIndication.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_CANCEL_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeScanCancelRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeScanCancelRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncCancelRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncCancelRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncCancelConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncCancelConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_PERIODIC_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddPeriodicRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAddPeriodicRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddPeriodicConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAddPeriodicConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_PERIODIC_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDelPeriodicRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDelPeriodicRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDelPeriodicConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDelPeriodicConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddAutonomousScanRequest.ChannelList; - aDataRef[numRefs++] = &aSignal->u.MlmeAddAutonomousScanRequest.InformationElements; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddAutonomousScanConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAddAutonomousScanConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDelAutonomousScanRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDelAutonomousScanRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDelAutonomousScanConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDelAutonomousScanConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeSetPacketFilterRequest.InformationElements; - aDataRef[numRefs++] = &aSignal->u.MlmeSetPacketFilterRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeSetPacketFilterConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeSetPacketFilterConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_MEASURE_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeStopMeasureRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeStopMeasureRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_MEASURE_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeStopMeasureConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeStopMeasureConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmePauseAutonomousScanRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmePauseAutonomousScanRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmePauseAutonomousScanConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmePauseAutonomousScanConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAutonomousScanDoneIndication.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAutonomousScanDoneIndication.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddTriggeredGetRequest.MibAttribute; - aDataRef[numRefs++] = &aSignal->u.MlmeAddTriggeredGetRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddTriggeredGetConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAddTriggeredGetConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDelTriggeredGetRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDelTriggeredGetRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDelTriggeredGetConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDelTriggeredGetConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_TRIGGERED_GET_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeTriggeredGetIndication.MibAttributeValue; - aDataRef[numRefs++] = &aSignal->u.MlmeTriggeredGetIndication.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddBlackoutRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAddBlackoutRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddBlackoutConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAddBlackoutConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeBlackoutEndedIndication.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeBlackoutEndedIndication.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDelBlackoutRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDelBlackoutRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDelBlackoutConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDelBlackoutConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddRxTriggerRequest.InformationElements; - aDataRef[numRefs++] = &aSignal->u.MlmeAddRxTriggerRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddRxTriggerConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAddRxTriggerConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDelRxTriggerRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDelRxTriggerRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDelRxTriggerConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDelRxTriggerConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECT_STATUS_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeConnectStatusRequest.InformationElements; - aDataRef[numRefs++] = &aSignal->u.MlmeConnectStatusRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeConnectStatusConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeConnectStatusConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeModifyBssParameterRequest.Data; - aDataRef[numRefs++] = &aSignal->u.MlmeModifyBssParameterRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeModifyBssParameterConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeModifyBssParameterConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddTemplateRequest.Data1; - aDataRef[numRefs++] = &aSignal->u.MlmeAddTemplateRequest.Data2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddTemplateConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAddTemplateConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeConfigQueueRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeConfigQueueRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeConfigQueueConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeConfigQueueConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TSPEC_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddTspecRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAddTspecRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TSPEC_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddTspecConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAddTspecConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TSPEC_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDelTspecRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDelTspecRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TSPEC_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeDelTspecConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeDelTspecConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_START_AGGREGATION_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeStartAggregationRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeStartAggregationRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_START_AGGREGATION_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeStartAggregationConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeStartAggregationConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeBlockackErrorIndication.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeBlockackErrorIndication.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeStopAggregationRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeStopAggregationRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeStopAggregationConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeStopAggregationConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SM_START_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeSmStartRequest.Beacon; - aDataRef[numRefs++] = &aSignal->u.MlmeSmStartRequest.BssParameters; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SM_START_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeSmStartConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeSmStartConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_LEAVE_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeLeaveRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeLeaveRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_LEAVE_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeLeaveConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeLeaveConfirm.Dummydataref2; - break; -#endif - case CSR_MLME_SET_TIM_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeSetTimRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeSetTimRequest.Dummydataref2; - break; - case CSR_MLME_SET_TIM_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeSetTimConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeSetTimConfirm.Dummydataref2; - break; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeGetKeySequenceRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeGetKeySequenceRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeGetKeySequenceConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeGetKeySequenceConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CHANNEL_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeSetChannelRequest.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeSetChannelRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CHANNEL_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeSetChannelConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeSetChannelConfirm.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddMulticastAddressRequest.Data; - aDataRef[numRefs++] = &aSignal->u.MlmeAddMulticastAddressRequest.Dummydataref2; - break; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.MlmeAddMulticastAddressConfirm.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.MlmeAddMulticastAddressConfirm.Dummydataref2; - break; -#endif - case CSR_DEBUG_STRING_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.DebugStringIndication.DebugMessage; - aDataRef[numRefs++] = &aSignal->u.DebugStringIndication.Dummydataref2; - break; - case CSR_DEBUG_WORD16_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.DebugWord16Indication.Dummydataref1; - aDataRef[numRefs++] = &aSignal->u.DebugWord16Indication.Dummydataref2; - break; - case CSR_DEBUG_GENERIC_REQUEST_ID: - aDataRef[numRefs++] = &aSignal->u.DebugGenericRequest.DebugVariable; - aDataRef[numRefs++] = &aSignal->u.DebugGenericRequest.Dummydataref2; - break; - case CSR_DEBUG_GENERIC_CONFIRM_ID: - aDataRef[numRefs++] = &aSignal->u.DebugGenericConfirm.DebugVariable; - aDataRef[numRefs++] = &aSignal->u.DebugGenericConfirm.Dummydataref2; - break; - case CSR_DEBUG_GENERIC_INDICATION_ID: - aDataRef[numRefs++] = &aSignal->u.DebugGenericIndication.DebugVariable; - aDataRef[numRefs++] = &aSignal->u.DebugGenericIndication.Dummydataref2; - break; - default: - return 0; - } - return numRefs; -} - - -u32 SigGetFilterPos(u16 aSigID) -{ - switch (aSigID) - { - case CSR_MA_PACKET_REQUEST_ID: - return 0x00000001; - case CSR_MA_PACKET_CONFIRM_ID: - return 0x00000002; - case CSR_MA_PACKET_INDICATION_ID: - return 0x00000004; - case CSR_MA_PACKET_CANCEL_REQUEST_ID: - return 0x00000008; - case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID: - return 0x00000010; - case CSR_MA_VIF_AVAILABILITY_INDICATION_ID: - return 0x00000020; - case CSR_MA_PACKET_ERROR_INDICATION_ID: - return 0x00000040; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_RESET_REQUEST_ID: - return 0x00000080; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_RESET_CONFIRM_ID: - return 0x00000100; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_REQUEST_ID: - return 0x00000200; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_CONFIRM_ID: - return 0x00000400; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_REQUEST_ID: - return 0x00000800; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CONFIRM_ID: - return 0x00001000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_NEXT_REQUEST_ID: - return 0x00002000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_NEXT_CONFIRM_ID: - return 0x00004000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_POWERMGT_REQUEST_ID: - return 0x00008000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_POWERMGT_CONFIRM_ID: - return 0x00010001; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_REQUEST_ID: - return 0x00010002; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_CONFIRM_ID: - return 0x00010004; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_REQUEST_ID: - return 0x00010008; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CONFIRM_ID: - return 0x00010010; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_REQUEST_ID: - return 0x00010020; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_CONFIRM_ID: - return 0x00010040; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MEASURE_INDICATION_ID: - return 0x00010080; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SETKEYS_REQUEST_ID: - return 0x00010100; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SETKEYS_CONFIRM_ID: - return 0x00010200; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DELETEKEYS_REQUEST_ID: - return 0x00010400; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DELETEKEYS_CONFIRM_ID: - return 0x00010800; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID: - return 0x00011000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECTED_INDICATION_ID: - return 0x00012000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SCAN_CANCEL_REQUEST_ID: - return 0x00014000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID: - return 0x00018000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: - return 0x00020001; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_PERIODIC_REQUEST_ID: - return 0x00020002; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: - return 0x00020004; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_PERIODIC_REQUEST_ID: - return 0x00020008; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: - return 0x00020010; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID: - return 0x00020020; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: - return 0x00020040; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID: - return 0x00020080; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: - return 0x00020100; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID: - return 0x00020200; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: - return 0x00020400; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_MEASURE_REQUEST_ID: - return 0x00020800; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_MEASURE_CONFIRM_ID: - return 0x00021000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID: - return 0x00022000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: - return 0x00024000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID: - return 0x00028000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID: - return 0x00030001; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: - return 0x00030002; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID: - return 0x00030004; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: - return 0x00030008; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_TRIGGERED_GET_INDICATION_ID: - return 0x00030010; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_BLACKOUT_REQUEST_ID: - return 0x00030020; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: - return 0x00030040; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID: - return 0x00030080; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_BLACKOUT_REQUEST_ID: - return 0x00030100; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: - return 0x00030200; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID: - return 0x00030400; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: - return 0x00030800; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID: - return 0x00031000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: - return 0x00032000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECT_STATUS_REQUEST_ID: - return 0x00034000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: - return 0x00038000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID: - return 0x00040001; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: - return 0x00040002; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TEMPLATE_REQUEST_ID: - return 0x00040004; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: - return 0x00040008; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONFIG_QUEUE_REQUEST_ID: - return 0x00040010; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: - return 0x00040020; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TSPEC_REQUEST_ID: - return 0x00040040; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_TSPEC_CONFIRM_ID: - return 0x00040080; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TSPEC_REQUEST_ID: - return 0x00040100; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_DEL_TSPEC_CONFIRM_ID: - return 0x00040200; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_START_AGGREGATION_REQUEST_ID: - return 0x00040400; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_START_AGGREGATION_CONFIRM_ID: - return 0x00040800; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID: - return 0x00041000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_AGGREGATION_REQUEST_ID: - return 0x00042000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: - return 0x00044000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SM_START_REQUEST_ID: - return 0x00048000; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SM_START_CONFIRM_ID: - return 0x00050001; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_LEAVE_REQUEST_ID: - return 0x00050002; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_LEAVE_CONFIRM_ID: - return 0x00050004; -#endif - case CSR_MLME_SET_TIM_REQUEST_ID: - return 0x00050008; - case CSR_MLME_SET_TIM_CONFIRM_ID: - return 0x00050010; -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID: - return 0x00050020; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: - return 0x00050040; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CHANNEL_REQUEST_ID: - return 0x00050080; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_SET_CHANNEL_CONFIRM_ID: - return 0x00050100; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID: - return 0x00050200; -#endif -#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET - case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: - return 0x00050400; -#endif - case CSR_DEBUG_STRING_INDICATION_ID: - return 0x00050800; - case CSR_DEBUG_WORD16_INDICATION_ID: - return 0x00051000; - case CSR_DEBUG_GENERIC_REQUEST_ID: - return 0x00052000; - case CSR_DEBUG_GENERIC_CONFIRM_ID: - return 0x00054000; - case CSR_DEBUG_GENERIC_INDICATION_ID: - return 0x00058000; - default: - break; - } - return 0xffffffff; -} - - diff --git a/drivers/staging/csr/csr_wifi_hip_signals.h b/drivers/staging/csr/csr_wifi_hip_signals.h deleted file mode 100644 index ca4d0774195c..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_signals.h +++ /dev/null @@ -1,128 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - ***************************************************************************** - * - * FILE: csr_wifi_hip_signals.h - * - * PURPOSE: - * Header file wrapping the auto-generated code in csr_wifi_hip_sigs.h - * and csr_wifi_hip_signals.c - - * csr_wifi_hip_sigs.h provides structures defining UniFi signals and - * csr_wifi_hip_signals.c provides SigGetSize() and SigGetDataRefs(). - * - ***************************************************************************** - */ -#ifndef __CSR_WIFI_HIP_SIGNALS_H__ -#define __CSR_WIFI_HIP_SIGNALS_H__ - -#include <linux/types.h> -#include "csr_wifi_hip_sigs.h" - - -/****************************************************************************/ -/* INFORMATION ELEMENTS */ -/****************************************************************************/ - -/* Information Element ID's - shouldn't be in here, but nowhere better yet */ -#define IE_SSID_ID 0 -#define IE_SUPPORTED_RATES_ID 1 -#define IE_FH_PARAM_SET_ID 2 -#define IE_DS_PARAM_SET_ID 3 -#define IE_CF_PARAM_SET_ID 4 -#define IE_TIM_ID 5 -#define IE_IBSS_PARAM_SET_ID 6 -#define IE_COUNTRY_ID 7 -#define IE_HOPPING_PATTERN_PARAMS_ID 8 -#define IE_HOPPING_PATTERN_TABLE_ID 9 -#define IE_REQUEST_ID 10 -#define IE_QBSS_LOAD_ID 11 -#define IE_EDCA_PARAM_SET_ID 12 -#define IE_TRAFFIC_SPEC_ID 13 -#define IE_TRAFFIC_CLASS_ID 14 -#define IE_SCHEDULE_ID 15 -#define IE_CHALLENGE_TEXT_ID 16 -#define IE_POWER_CONSTRAINT_ID 32 -#define IE_POWER_CAPABILITY_ID 33 -#define IE_TPC_REQUEST_ID 34 -#define IE_TPC_REPORT_ID 35 -#define IE_SUPPORTED_CHANNELS_ID 36 -#define IE_CHANNEL_SWITCH_ANNOUNCE_ID 37 -#define IE_MEASUREMENT_REQUEST_ID 38 -#define IE_MEASUREMENT_REPORT_ID 39 -#define IE_QUIET_ID 40 -#define IE_IBSS_DFS_ID 41 -#define IE_ERP_INFO_ID 42 -#define IE_TS_DELAY_ID 43 -#define IE_TCLAS_PROCESSING_ID 44 -#define IE_QOS_CAPABILITY_ID 46 -#define IE_RSN_ID 48 -#define IE_EXTENDED_SUPPORTED_RATES_ID 50 -#define IE_AP_CHANNEL_REPORT_ID 52 -#define IE_RCPI_ID 53 -#define IE_WPA_ID 221 - - -/* The maximum number of data references in a signal structure */ -#define UNIFI_MAX_DATA_REFERENCES 2 - -/* The space to allow for a wire-format signal structure */ -#define UNIFI_PACKED_SIGBUF_SIZE 64 - - -/******************************************************************************/ -/* SIGNAL PARAMETER VALUES */ -/******************************************************************************/ - -/* ifIndex */ -#define UNIFI_IF_2G4 1 -#define UNIFI_IF_5G 2 - -/* SendProcessId */ -#define HOST_PROC_ID 0xc000 - -#define SIG_CAP_ESS 0x0001 -#define SIG_CAP_IBSS 0x0002 -#define SIG_CAP_CF_POLLABLE 0x0004 -#define SIG_CAP_CF_POLL_REQUEST 0x0008 -#define SIG_CAP_PRIVACY 0x0010 -#define SIG_CAP_SHORT_PREAMBLE 0x0020 -#define SIG_CAP_DSSSOFDM 0x2000 - -/******************************************************************************/ -/* FUNCTION DECLARATIONS */ -/******************************************************************************/ - -/****************************************************************************** - * SigGetNumDataRefs - Retrieve pointers to data-refs from a signal. - * - * PARAMETERS: - * aSignal - Pointer to signal to retrieve the data refs of. - * aDataRef - Address of a pointer to the structure that the data refs - * pointers will be stored. - * - * RETURNS: - * The number of data-refs in the signal. - */ -s32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef); - -/****************************************************************************** - * SigGetSize - Retrieve the size (in bytes) of a given signal. - * - * PARAMETERS: - * aSignal - Pointer to signal to retrieve size of. - * - * RETURNS: - * The size (in bytes) of the given signal. - */ -s32 SigGetSize(const CSR_SIGNAL *aSignal); - -#endif /* __CSR_WIFI_HIP_SIGNALS_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_sigs.h b/drivers/staging/csr/csr_wifi_hip_sigs.h deleted file mode 100644 index 6112cc3e87fa..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_sigs.h +++ /dev/null @@ -1,1417 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - - -/* Generated by hip_dd_l_h_gen.pl */ - -#ifndef CSR_WIFI_HIP_SIGS_H -#define CSR_WIFI_HIP_SIGS_H - -typedef s16 csr_place_holding_type; - -typedef u16 CSR_ASSOCIATION_ID; - -typedef u16 CSR_AUTONOMOUS_SCAN_ID; - -typedef u16 CSR_BEACON_PERIODS; - -typedef u16 CSR_BLACKOUT_ID; - -typedef enum CSR_BLACKOUT_SOURCE -{ - CSR_DOT11_LOCAL = 0x0000, - CSR_DOT11_REMOTE = 0x0001, - CSR_OTHER_RADIO = 0x0002, - CSR_NOT_LINKED = 0x0004 -} CSR_BLACKOUT_SOURCE; - -typedef enum CSR_BLACKOUT_TYPE -{ - CSR_LOCAL_DEVICE_ONLY = 0x0001, - CSR_SPECIFIED_PEER = 0x0002, - CSR_CURRENT_CHANNEL = 0x0004, - CSR_P2P = 0x0008 -} CSR_BLACKOUT_TYPE; - -typedef enum CSR_BOOT_LOADER_OPERATION -{ - CSR_BOOT_LOADER_IDLE = 0x00, - CSR_BOOT_LOADER_RESTART = 0x01, - CSR_BOOT_LOADER_PATCH = 0x02, - CSR_BOOT_LOADER_IMAGE_0 = 0x10, - CSR_BOOT_LOADER_IMAGE_1 = 0x11, - CSR_BOOT_LOADER_IMAGE_2 = 0x12, - CSR_BOOT_LOADER_IMAGE_3 = 0x13 -} CSR_BOOT_LOADER_OPERATION; - -typedef u16 CSR_CAPABILITY_INFORMATION; - -typedef u16 CSR_CHANNEL_STARTING_FACTOR; - -typedef u32 CSR_CIPHER_SUITE_SELECTOR; - -typedef u32 CSR_CLIENT_TAG; - -typedef enum CSR_CONNECTION_STATUS -{ - CSR_DISCONNECTED = 0x0000, - CSR_CONNECTED_AWAKE = 0x0001 -} CSR_CONNECTION_STATUS; - -typedef s16 CSR_DECIBELS; - -typedef enum CSR_DIRECTION -{ - CSR_TRANSMIT = 0x0000, - CSR_RECEIVE = 0x0001, - CSR_BIDIRECTIONAL = 0x0003 -} CSR_DIRECTION; - -typedef enum CSR_FRAME_TYPE -{ - CSR_RESERVED = 0x0000, - CSR_BEACON = 0x0001, - CSR_PROBE_RESPONSE = 0x0002, - CSR_BEACON_AND_PROBE_RESPONSE = 0x0003, - CSR_PROBE_REQUEST = 0x0004 -} CSR_FRAME_TYPE; - -typedef u32 CSR_IPV4_ADDRESS; - -typedef enum CSR_IFINTERFACE -{ - CSR_INDEX_2G4 = 0x0001, - CSR_INDEX_5G = 0x0002 -} CSR_IFINTERFACE; - -typedef enum CSR_KEY_TYPE -{ - CSR_GROUP = 0x0000, - CSR_PAIRWISE = 0x0001, - CSR_PEER_KEY = 0x0002, - CSR_IGTK = 0x0003 -} CSR_KEY_TYPE; - -typedef enum CSR_LOADER_OPERATION -{ - CSR_LOADER_IDLE = 0x0000, - CSR_LOADER_COPY = 0x0001 -} CSR_LOADER_OPERATION; - -typedef struct CSR_MAC_ADDRESS -{ - u8 x[6]; -} CSR_MACADDRESS; - -typedef enum CSR_MIB_STATUS -{ - CSR_MIB_SUCCESSFUL = 0x0000, - CSR_MIB_INVALID_PARAMETERS = 0x0001, - CSR_MIB_WRITE_ONLY = 0x0002, - CSR_MIB_READ_ONLY = 0x0003 -} CSR_MIB_STATUS; - -typedef enum CSR_MEMORY_SPACE -{ - CSR_NONE = 0x00, - CSR_SHARED_DATA_MEMORY = 0x01, - CSR_EXTERNAL_FLASH_MEMORY = 0x02, - CSR_EXTERNAL_SRAM = 0x03, - CSR_REGISTERS = 0x04, - CSR_PHY_PROCESSOR_DATA_MEMORY = 0x10, - CSR_PHY_PROCESSOR_PROGRAM_MEMORY = 0x11, - CSR_PHY_PROCESSOR_ROM = 0x12, - CSR_MAC_PROCESSOR_DATA_MEMORY = 0x20, - CSR_MAC_PROCESSOR_PROGRAM_MEMORY = 0x21, - CSR_MAC_PROCESSOR_ROM = 0x22, - CSR_BT_PROCESSOR_DATA_MEMORY = 0x30, - CSR_BT_PROCESSOR_PROGRAM_MEMORY = 0x31, - CSR_BT_PROCESSOR_ROM = 0x32 -} CSR_MEMORY_SPACE; - -typedef u16 CSR_MICROSECONDS16; - -typedef u32 CSR_MICROSECONDS32; - -typedef u16 CSR_NATURAL16; - -typedef enum CSR_PS_SCHEME -{ - CSR_LEGACY_PS = 0x0001, - CSR_U_APSD = 0x0002, - CSR_S_APSD = 0x0004 -} CSR_PS_SCHEME; - -typedef enum CSR_PACKET_FILTER_MODE -{ - CSR_PFM_OPT_OUT = 0x0000, - CSR_PFM_OPT_IN = 0x0003 -} CSR_PACKET_FILTER_MODE; - -typedef u16 CSR_PERIODIC_ID; - -typedef enum CSR_PERIODIC_SCHEDULING_MODE -{ - CSR_PSM_PERIODIC_SCHEDULE_PS_POLL = 0x0001, - CSR_PSM_PERIODIC_SCHEDULE_PM_BIT = 0x0002, - CSR_PSM_PERIODIC_SCHEDULE_UAPSD = 0x0004, - CSR_PSM_PERIODIC_SCHEDULE_SAPSD = 0x0008 -} CSR_PERIODIC_SCHEDULING_MODE; - -typedef enum CSR_POWER_MANAGEMENT_MODE -{ - CSR_PMM_ACTIVE_MODE = 0x0000, - CSR_PMM_POWER_SAVE = 0x0001, - CSR_PMM_FAST_POWER_SAVE = 0x0002 -} CSR_POWER_MANAGEMENT_MODE; - -typedef enum CSR_PRIORITY -{ - CSR_QOS_UP0 = 0x0000, - CSR_QOS_UP1 = 0x0001, - CSR_QOS_UP2 = 0x0002, - CSR_QOS_UP3 = 0x0003, - CSR_QOS_UP4 = 0x0004, - CSR_QOS_UP5 = 0x0005, - CSR_QOS_UP6 = 0x0006, - CSR_QOS_UP7 = 0x0007, - CSR_CONTENTION = 0x8000, - CSR_MANAGEMENT = 0x8010 -} CSR_PRIORITY; - -typedef enum CSR_REASON_CODE -{ - CSR_UNSPECIFIED_REASON = 0x0001, - CSR_INVALID_INFORMATION_ELEMENT = 0x000d, - CSR_QOS_UNSPECIFIED_REASON = 0x0020, - CSR_QOS_EXCESSIVE_NOT_ACK = 0x0022, - CSR_QOS_TXOP_LIMIT_EXCEEDED = 0x0023, - CSR_QSTA_LEAVING = 0x0024, - CSR_UNKNOWN_BA = 0x0026, - CSR_UNKNOWN_TS = 0x0026, - CSR_TIMEOUT = 0x0027 -} CSR_REASON_CODE; - -typedef enum CSR_RECEPTION_STATUS -{ - CSR_RX_SUCCESS = 0x0000, - CSR_RX_FAILURE_UNSPECIFIED = 0x0001, - CSR_MICHAEL_MIC_ERROR = 0x0002, - CSR_DECRYPTION_ERROR = 0x0003, - CSR_NO_TEMPORAL_KEY_AVAILABLE = 0x0004, - CSR_UNSUPPORTED_MODULATION = 0x0011, - CSR_BAD_FCS = 0x0012, - CSR_BAD_SIGNAL = 0x0013 -} CSR_RECEPTION_STATUS; - -typedef enum CSR_RESULT_CODE -{ - CSR_RC_SUCCESS = 0x0000, - CSR_RC_UNSPECIFIED_FAILURE = 0x0001, - CSR_RC_REFUSED = 0x0003, - CSR_RC_INVALID_PARAMETERS = 0x0026, - CSR_RC_REJECTED_INVALID_IE = 0x0028, - CSR_RC_REJECTED_INVALID_GROUP_CIPHER = 0x0029, - CSR_RC_REJECTED_INVALID_PAIRWISE_CIPHER = 0x002a, - CSR_RC_TIMEOUT = 0x8000, - CSR_RC_TOO_MANY_SIMULTANEOUS_REQUESTS = 0x8001, - CSR_RC_BSS_ALREADY_STARTED_OR_JOINED = 0x8002, - CSR_RC_NOT_SUPPORTED = 0x8003, - CSR_RC_TRANSMISSION_FAILURE = 0x8004, - CSR_RC_RESET_REQUIRED_BEFORE_START = 0x8006, - CSR_RC_INSUFFICIENT_RESOURCE = 0x8007, - CSR_RC_NO_BUFFERED_BROADCAST_MULTICAST_FRAMES = 0x8008, - CSR_RC_INVALID_UNICAST_CIPHER = 0xf02f, - CSR_RC_INVALID_MULTICAST_CIPHER = 0xf030 -} CSR_RESULT_CODE; - -typedef enum CSR_SCAN_TYPE -{ - CSR_SC_ACTIVE_SCAN = 0x0000, - CSR_SC_PASSIVE_SCAN = 0x0001 -} CSR_SCAN_TYPE; - -typedef enum CSR_SIGNAL_ID -{ - CSR_MA_PACKET_REQUEST_ID = 0x0110, - CSR_MA_PACKET_CONFIRM_ID = 0x0111, - CSR_MA_PACKET_INDICATION_ID = 0x0113, - CSR_MA_PACKET_CANCEL_REQUEST_ID = 0x0114, - CSR_MA_VIF_AVAILABILITY_RESPONSE_ID = 0x0116, - CSR_MA_VIF_AVAILABILITY_INDICATION_ID = 0x0117, - CSR_MA_PACKET_ERROR_INDICATION_ID = 0x011b, - CSR_MLME_RESET_REQUEST_ID = 0x0200, - CSR_MLME_RESET_CONFIRM_ID = 0x0201, - CSR_MLME_GET_REQUEST_ID = 0x0204, - CSR_MLME_GET_CONFIRM_ID = 0x0205, - CSR_MLME_SET_REQUEST_ID = 0x0208, - CSR_MLME_SET_CONFIRM_ID = 0x0209, - CSR_MLME_GET_NEXT_REQUEST_ID = 0x020c, - CSR_MLME_GET_NEXT_CONFIRM_ID = 0x020d, - CSR_MLME_POWERMGT_REQUEST_ID = 0x0210, - CSR_MLME_POWERMGT_CONFIRM_ID = 0x0211, - CSR_MLME_SCAN_REQUEST_ID = 0x0214, - CSR_MLME_SCAN_CONFIRM_ID = 0x0215, - CSR_MLME_HL_SYNC_REQUEST_ID = 0x0244, - CSR_MLME_HL_SYNC_CONFIRM_ID = 0x0245, - CSR_MLME_MEASURE_REQUEST_ID = 0x0258, - CSR_MLME_MEASURE_CONFIRM_ID = 0x0259, - CSR_MLME_MEASURE_INDICATION_ID = 0x025b, - CSR_MLME_SETKEYS_REQUEST_ID = 0x0268, - CSR_MLME_SETKEYS_CONFIRM_ID = 0x0269, - CSR_MLME_DELETEKEYS_REQUEST_ID = 0x026c, - CSR_MLME_DELETEKEYS_CONFIRM_ID = 0x026d, - CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID = 0x0287, - CSR_MLME_CONNECTED_INDICATION_ID = 0x028b, - CSR_MLME_SCAN_CANCEL_REQUEST_ID = 0x028c, - CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID = 0x0298, - CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID = 0x0299, - CSR_MLME_ADD_PERIODIC_REQUEST_ID = 0x02a0, - CSR_MLME_ADD_PERIODIC_CONFIRM_ID = 0x02a1, - CSR_MLME_DEL_PERIODIC_REQUEST_ID = 0x02a4, - CSR_MLME_DEL_PERIODIC_CONFIRM_ID = 0x02a5, - CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID = 0x02a8, - CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID = 0x02a9, - CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID = 0x02ac, - CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID = 0x02ad, - CSR_MLME_SET_PACKET_FILTER_REQUEST_ID = 0x02b8, - CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID = 0x02b9, - CSR_MLME_STOP_MEASURE_REQUEST_ID = 0x02bc, - CSR_MLME_STOP_MEASURE_CONFIRM_ID = 0x02bd, - CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID = 0x02cc, - CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID = 0x02cd, - CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID = 0x02db, - CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID = 0x02dc, - CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID = 0x02dd, - CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID = 0x02e0, - CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID = 0x02e1, - CSR_MLME_TRIGGERED_GET_INDICATION_ID = 0x02e7, - CSR_MLME_ADD_BLACKOUT_REQUEST_ID = 0x02f8, - CSR_MLME_ADD_BLACKOUT_CONFIRM_ID = 0x02f9, - CSR_MLME_BLACKOUT_ENDED_INDICATION_ID = 0x02fb, - CSR_MLME_DEL_BLACKOUT_REQUEST_ID = 0x02fc, - CSR_MLME_DEL_BLACKOUT_CONFIRM_ID = 0x02fd, - CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID = 0x0304, - CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID = 0x0305, - CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID = 0x0308, - CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID = 0x0309, - CSR_MLME_CONNECT_STATUS_REQUEST_ID = 0x0310, - CSR_MLME_CONNECT_STATUS_CONFIRM_ID = 0x0311, - CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID = 0x0314, - CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID = 0x0315, - CSR_MLME_ADD_TEMPLATE_REQUEST_ID = 0x0318, - CSR_MLME_ADD_TEMPLATE_CONFIRM_ID = 0x0319, - CSR_MLME_CONFIG_QUEUE_REQUEST_ID = 0x031c, - CSR_MLME_CONFIG_QUEUE_CONFIRM_ID = 0x031d, - CSR_MLME_ADD_TSPEC_REQUEST_ID = 0x0320, - CSR_MLME_ADD_TSPEC_CONFIRM_ID = 0x0321, - CSR_MLME_DEL_TSPEC_REQUEST_ID = 0x0324, - CSR_MLME_DEL_TSPEC_CONFIRM_ID = 0x0325, - CSR_MLME_START_AGGREGATION_REQUEST_ID = 0x0328, - CSR_MLME_START_AGGREGATION_CONFIRM_ID = 0x0329, - CSR_MLME_BLOCKACK_ERROR_INDICATION_ID = 0x032b, - CSR_MLME_STOP_AGGREGATION_REQUEST_ID = 0x032c, - CSR_MLME_STOP_AGGREGATION_CONFIRM_ID = 0x032d, - CSR_MLME_SM_START_REQUEST_ID = 0x0334, - CSR_MLME_SM_START_CONFIRM_ID = 0x0335, - CSR_MLME_LEAVE_REQUEST_ID = 0x0338, - CSR_MLME_LEAVE_CONFIRM_ID = 0x0339, - CSR_MLME_SET_TIM_REQUEST_ID = 0x033c, - CSR_MLME_SET_TIM_CONFIRM_ID = 0x033d, - CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID = 0x0340, - CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID = 0x0341, - CSR_MLME_SET_CHANNEL_REQUEST_ID = 0x034c, - CSR_MLME_SET_CHANNEL_CONFIRM_ID = 0x034d, - CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID = 0x040c, - CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID = 0x040d, - CSR_DEBUG_STRING_INDICATION_ID = 0x0803, - CSR_DEBUG_WORD16_INDICATION_ID = 0x0807, - CSR_DEBUG_GENERIC_REQUEST_ID = 0x0808, - CSR_DEBUG_GENERIC_CONFIRM_ID = 0x0809, - CSR_DEBUG_GENERIC_INDICATION_ID = 0x080b -} CSR_SIGNAL_ID; - -typedef u16 CSR_SIMPLE_POINTER; - -typedef u16 CSR_STARTING_SEQUENCE_NUMBER; - -typedef enum CSR_SYMBOL_ID -{ - CSR_SLT_END = 0x0000, - CSR_SLT_PCI_SLOT_CONFIG = 0x0001, - CSR_SLT_SDIO_SLOT_CONFIG = 0x0002, - CSR_SLT_BUILD_ID_NUMBER = 0x0003, - CSR_SLT_BUILD_ID_STRING = 0x0004, - CSR_SLT_PERSISTENT_STORE_DB = 0x0005, - CSR_SLT_RESET_VECTOR_PHY = 0x0006, - CSR_SLT_RESET_VECTOR_MAC = 0x0007, - CSR_SLT_SDIO_LOADER_CONTROL = 0x0008, - CSR_SLT_TEST_CMD = 0x0009, - CSR_SLT_TEST_ALIVE_COUNTER = 0x000a, - CSR_SLT_TEST_PARAMETERS = 0x000b, - CSR_SLT_TEST_RESULTS = 0x000c, - CSR_SLT_TEST_VERSION = 0x000d, - CSR_SLT_MIB_PSID_RANGES = 0x000e, - CSR_SLT_KIP_TABLE = 0x000f, - CSR_SLT_PANIC_DATA_PHY = 0x0010, - CSR_SLT_PANIC_DATA_MAC = 0x0011, - CSR_SLT_BOOT_LOADER_CONTROL = 0x0012, - CSR_SLT_SOFT_MAC = 0x0013 -} CSR_SYMBOL_ID; - -typedef struct CSR_TSF_TIME -{ - u8 x[8]; -} CSR_TSF_TIME; - -typedef u16 CSR_TIME_UNITS; - -typedef enum CSR_TRANSMISSION_CONTROL -{ - CSR_TRIGGERED = 0x0001, - CSR_END_OF_SERVICE = 0x0002, - CSR_NO_CONFIRM_REQUIRED = 0x0004, - CSR_ALLOW_BA = 0x0008 -} CSR_TRANSMISSION_CONTROL; - -typedef enum CSR_TRANSMISSION_STATUS -{ - CSR_TX_SUCCESSFUL = 0x0000, - CSR_TX_RETRY_LIMIT = 0x0001, - CSR_TX_LIFETIME = 0x0002, - CSR_TX_NO_BSS = 0x0003, - CSR_TX_EXCESSIVE_DATA_LENGTH = 0x0004, - CSR_TX_UNSUPPORTED_PRIORITY = 0x0006, - CSR_TX_UNAVAILABLE_PRIORITY = 0x0007, - CSR_TX_UNAVAILABLE_KEY_MAPPING = 0x000a, - CSR_TX_EDCA_TIMEOUT = 0x000b, - CSR_TX_BLOCK_ACK_TIMEOUT = 0x000c, - CSR_TX_FAIL_TRANSMISSION_VIF_INTERRUPTED = 0x000d, - CSR_TX_REJECTED_PEER_STATION_SLEEPING = 0x000e, - CSR_TX_REJECTED_DTIM_ENDED = 0x000f, - CSR_TX_REJECTED_DTIM_STARTED = 0x0010 -} CSR_TRANSMISSION_STATUS; - -typedef u16 CSR_TRIGGER_ID; - -typedef u16 CSR_TRIGGERED_ID; - -typedef enum CSR_HIP_VERSIONS -{ - CSR_HIP_ENG_VERSION = 0x0001, - CSR_HIP_VERSION = 0x0900 -} CSR_HIP_VERSIONS; - -typedef u16 CSR_BUFFER_HANDLE; - -typedef u16 CSR_CHANNEL_NUMBER; - -typedef struct CSR_DATA_REFERENCE -{ - u16 SlotNumber; - u16 DataLength; -} CSR_DATAREF; - -typedef u16 CSR_DIALOG_TOKEN; - -typedef struct CSR_GENERIC_POINTER -{ - u32 MemoryOffset; - CSR_MEMORY_SPACE MemorySpace; -} CSR_GENERIC_POINTER; - -typedef struct CSR_MLME_CONFIG_QUEUE_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_CONFIG_QUEUE_CONFIRM; - -typedef struct CSR_MLME_CONFIG_QUEUE_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_NATURAL16 QueueIndex; - CSR_NATURAL16 Aifs; - CSR_NATURAL16 Cwmin; - CSR_NATURAL16 Cwmax; - CSR_NATURAL16 TxopLimit; -} CSR_MLME_CONFIG_QUEUE_REQUEST; - -typedef struct CSR_MLME_GET_CONFIRM -{ - CSR_DATAREF MibAttributeValue; - CSR_DATAREF Dummydataref2; - CSR_MIB_STATUS Status; - CSR_NATURAL16 ErrorIndex; -} CSR_MLME_GET_CONFIRM; - -typedef struct CSR_MLME_GET_REQUEST -{ - CSR_DATAREF MibAttribute; - CSR_DATAREF Dummydataref2; -} CSR_MLME_GET_REQUEST; - -typedef struct CSR_MLME_GET_NEXT_CONFIRM -{ - CSR_DATAREF MibAttributeValue; - CSR_DATAREF Dummydataref2; - CSR_MIB_STATUS Status; - CSR_NATURAL16 ErrorIndex; -} CSR_MLME_GET_NEXT_CONFIRM; - -typedef struct CSR_MLME_GET_NEXT_REQUEST -{ - CSR_DATAREF MibAttribute; - CSR_DATAREF Dummydataref2; -} CSR_MLME_GET_NEXT_REQUEST; - -typedef struct CSR_MLME_HL_SYNC_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_MACADDRESS GroupAddress; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_HL_SYNC_CONFIRM; - -typedef struct CSR_MLME_HL_SYNC_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_MACADDRESS GroupAddress; -} CSR_MLME_HL_SYNC_REQUEST; - -typedef struct CSR_MLME_HL_SYNC_CANCEL_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_HL_SYNC_CANCEL_CONFIRM; - -typedef struct CSR_MLME_HL_SYNC_CANCEL_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_MACADDRESS GroupAddress; -} CSR_MLME_HL_SYNC_CANCEL_REQUEST; - -typedef struct CSR_MLME_MEASURE_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_RESULT_CODE ResultCode; - CSR_DIALOG_TOKEN DialogToken; -} CSR_MLME_MEASURE_CONFIRM; - -typedef struct CSR_MLME_MEASURE_INDICATION -{ - CSR_DATAREF MeasurementReportSet; - CSR_DATAREF Dummydataref2; - CSR_DIALOG_TOKEN DialogToken; -} CSR_MLME_MEASURE_INDICATION; - -typedef struct CSR_MLME_MEASURE_REQUEST -{ - CSR_DATAREF MeasurementRequestSet; - CSR_DATAREF Dummydataref2; - CSR_DIALOG_TOKEN DialogToken; -} CSR_MLME_MEASURE_REQUEST; - -typedef struct CSR_MLME_RESET_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_RESET_CONFIRM; - -typedef struct CSR_MLME_RESET_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_MACADDRESS StaAddress; - s16 SetDefaultMib; -} CSR_MLME_RESET_REQUEST; - -typedef struct CSR_MLME_SET_CONFIRM -{ - CSR_DATAREF MibAttributeValue; - CSR_DATAREF Dummydataref2; - CSR_MIB_STATUS Status; - CSR_NATURAL16 ErrorIndex; -} CSR_MLME_SET_CONFIRM; - -typedef struct CSR_MLME_SET_REQUEST -{ - CSR_DATAREF MibAttributeValue; - CSR_DATAREF Dummydataref2; -} CSR_MLME_SET_REQUEST; - -typedef struct CSR_MLME_STOP_MEASURE_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_RESULT_CODE ResultCode; - CSR_DIALOG_TOKEN DialogToken; -} CSR_MLME_STOP_MEASURE_CONFIRM; - -typedef struct CSR_MLME_STOP_MEASURE_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_DIALOG_TOKEN DialogToken; -} CSR_MLME_STOP_MEASURE_REQUEST; - -typedef u16 CSR_PROCESS_ID; - -typedef u16 CSR_RATE; - -typedef u16 CSR_SEQUENCE_NUMBER; - -typedef struct CSR_SIGNAL_PRIMITIVE_HEADER -{ - s16 SignalId; - CSR_PROCESS_ID ReceiverProcessId; - CSR_PROCESS_ID SenderProcessId; -} CSR_SIGNAL_PRIMITIVE_HEADER; - -typedef u16 CSR_TRAFFIC_WINDOW; - -typedef u16 CSR_VIF_IDENTIFIER; - -typedef struct CSR_DEBUG_GENERIC_CONFIRM -{ - CSR_DATAREF DebugVariable; - CSR_DATAREF Dummydataref2; - CSR_NATURAL16 DebugWords[8]; -} CSR_DEBUG_GENERIC_CONFIRM; - -typedef struct CSR_DEBUG_GENERIC_INDICATION -{ - CSR_DATAREF DebugVariable; - CSR_DATAREF Dummydataref2; - CSR_NATURAL16 DebugWords[8]; -} CSR_DEBUG_GENERIC_INDICATION; - -typedef struct CSR_DEBUG_GENERIC_REQUEST -{ - CSR_DATAREF DebugVariable; - CSR_DATAREF Dummydataref2; - CSR_NATURAL16 DebugWords[8]; -} CSR_DEBUG_GENERIC_REQUEST; - -typedef struct CSR_DEBUG_STRING_INDICATION -{ - CSR_DATAREF DebugMessage; - CSR_DATAREF Dummydataref2; -} CSR_DEBUG_STRING_INDICATION; - -typedef struct CSR_DEBUG_WORD16_INDICATION -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_NATURAL16 DebugWords[16]; -} CSR_DEBUG_WORD16_INDICATION; - -typedef struct CSR_MA_PACKET_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_TRANSMISSION_STATUS TransmissionStatus; - CSR_NATURAL16 RetryCount; - CSR_RATE Rate; - CSR_CLIENT_TAG HostTag; -} CSR_MA_PACKET_CONFIRM; - -typedef struct CSR_MA_PACKET_INDICATION -{ - CSR_DATAREF Data; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_TSF_TIME LocalTime; - CSR_IFINTERFACE Ifindex; - CSR_CHANNEL_NUMBER Channel; - CSR_RECEPTION_STATUS ReceptionStatus; - CSR_DECIBELS Rssi; - CSR_DECIBELS Snr; - CSR_RATE ReceivedRate; -} CSR_MA_PACKET_INDICATION; - -typedef struct CSR_MA_PACKET_REQUEST -{ - CSR_DATAREF Data; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RATE TransmitRate; - CSR_CLIENT_TAG HostTag; - CSR_PRIORITY Priority; - CSR_MACADDRESS Ra; - CSR_TRANSMISSION_CONTROL TransmissionControl; -} CSR_MA_PACKET_REQUEST; - -typedef struct CSR_MA_PACKET_CANCEL_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_CLIENT_TAG HostTag; -} CSR_MA_PACKET_CANCEL_REQUEST; - -typedef struct CSR_MA_PACKET_ERROR_INDICATION -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_MACADDRESS PeerQstaAddress; - CSR_PRIORITY UserPriority; - CSR_SEQUENCE_NUMBER SequenceNumber; -} CSR_MA_PACKET_ERROR_INDICATION; - -typedef struct CSR_MA_VIF_AVAILABILITY_INDICATION -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - s16 Multicast; -} CSR_MA_VIF_AVAILABILITY_INDICATION; - -typedef struct CSR_MA_VIF_AVAILABILITY_RESPONSE -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MA_VIF_AVAILABILITY_RESPONSE; - -typedef struct CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; - CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; -} CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM; - -typedef struct CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST -{ - CSR_DATAREF ChannelList; - CSR_DATAREF InformationElements; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; - CSR_IFINTERFACE Ifindex; - CSR_CHANNEL_STARTING_FACTOR ChannelStartingFactor; - CSR_SCAN_TYPE ScanType; - CSR_MICROSECONDS32 ProbeDelay; - CSR_TIME_UNITS MinChannelTime; - CSR_TIME_UNITS MaxChannelTime; -} CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST; - -typedef struct CSR_MLME_ADD_BLACKOUT_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_BLACKOUT_ID BlackoutId; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_ADD_BLACKOUT_CONFIRM; - -typedef struct CSR_MLME_ADD_BLACKOUT_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_BLACKOUT_ID BlackoutId; - CSR_BLACKOUT_TYPE BlackoutType; - CSR_BLACKOUT_SOURCE BlackoutSource; - CSR_MICROSECONDS32 BlackoutStartReference; - CSR_MICROSECONDS32 BlackoutPeriod; - CSR_MICROSECONDS32 BlackoutDuration; - CSR_MACADDRESS PeerStaAddress; - CSR_NATURAL16 BlackoutCount; -} CSR_MLME_ADD_BLACKOUT_REQUEST; - -typedef struct CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM; - -typedef struct CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST -{ - CSR_DATAREF Data; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_NATURAL16 NumberOfMulticastGroupAddresses; -} CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST; - -typedef struct CSR_MLME_ADD_PERIODIC_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_PERIODIC_ID PeriodicId; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_ADD_PERIODIC_CONFIRM; - -typedef struct CSR_MLME_ADD_PERIODIC_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_PERIODIC_ID PeriodicId; - CSR_MICROSECONDS32 MaximumLatency; - CSR_PERIODIC_SCHEDULING_MODE PeriodicSchedulingMode; - s16 WakeHost; - CSR_PRIORITY UserPriority; -} CSR_MLME_ADD_PERIODIC_REQUEST; - -typedef struct CSR_MLME_ADD_RX_TRIGGER_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_TRIGGER_ID TriggerId; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_ADD_RX_TRIGGER_CONFIRM; - -typedef struct CSR_MLME_ADD_RX_TRIGGER_REQUEST -{ - CSR_DATAREF InformationElements; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_TRIGGER_ID TriggerId; - CSR_PRIORITY Priority; -} CSR_MLME_ADD_RX_TRIGGER_REQUEST; - -typedef struct CSR_MLME_ADD_TEMPLATE_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_FRAME_TYPE FrameType; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_ADD_TEMPLATE_CONFIRM; - -typedef struct CSR_MLME_ADD_TEMPLATE_REQUEST -{ - CSR_DATAREF Data1; - CSR_DATAREF Data2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_FRAME_TYPE FrameType; - CSR_RATE MinTransmitRate; -} CSR_MLME_ADD_TEMPLATE_REQUEST; - -typedef struct CSR_MLME_ADD_TRIGGERED_GET_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; - CSR_TRIGGERED_ID TriggeredId; -} CSR_MLME_ADD_TRIGGERED_GET_CONFIRM; - -typedef struct CSR_MLME_ADD_TRIGGERED_GET_REQUEST -{ - CSR_DATAREF MibAttribute; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_TRIGGERED_ID TriggeredId; -} CSR_MLME_ADD_TRIGGERED_GET_REQUEST; - -typedef struct CSR_MLME_ADD_TSPEC_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_PRIORITY UserPriority; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_ADD_TSPEC_CONFIRM; - -typedef struct CSR_MLME_ADD_TSPEC_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_PRIORITY UserPriority; - CSR_DIRECTION Direction; - CSR_PS_SCHEME PsScheme; - CSR_NATURAL16 MediumTime; - CSR_MICROSECONDS32 ServiceStartTime; - CSR_MICROSECONDS32 ServiceInterval; - CSR_RATE MinimumDataRate; -} CSR_MLME_ADD_TSPEC_REQUEST; - -typedef struct CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; - CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; -} CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION; - -typedef struct CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_MACADDRESS Bssid; -} CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION; - -typedef struct CSR_MLME_BLACKOUT_ENDED_INDICATION -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_BLACKOUT_ID BlackoutId; -} CSR_MLME_BLACKOUT_ENDED_INDICATION; - -typedef struct CSR_MLME_BLOCKACK_ERROR_INDICATION -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_REASON_CODE ResultCode; - CSR_MACADDRESS PeerQstaAddress; -} CSR_MLME_BLOCKACK_ERROR_INDICATION; - -typedef struct CSR_MLME_CONNECTED_INDICATION -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_CONNECTION_STATUS ConnectionStatus; - CSR_MACADDRESS PeerMacAddress; -} CSR_MLME_CONNECTED_INDICATION; - -typedef struct CSR_MLME_CONNECT_STATUS_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_CONNECT_STATUS_CONFIRM; - -typedef struct CSR_MLME_CONNECT_STATUS_REQUEST -{ - CSR_DATAREF InformationElements; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_CONNECTION_STATUS ConnectionStatus; - CSR_MACADDRESS StaAddress; - CSR_ASSOCIATION_ID AssociationId; - CSR_CAPABILITY_INFORMATION AssociationCapabilityInformation; -} CSR_MLME_CONNECT_STATUS_REQUEST; - -typedef struct CSR_MLME_DELETEKEYS_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_DELETEKEYS_CONFIRM; - -typedef struct CSR_MLME_DELETEKEYS_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_NATURAL16 KeyId; - CSR_KEY_TYPE KeyType; - CSR_MACADDRESS Address; -} CSR_MLME_DELETEKEYS_REQUEST; - -typedef struct CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; - CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; -} CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM; - -typedef struct CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; -} CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST; - -typedef struct CSR_MLME_DEL_BLACKOUT_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_BLACKOUT_ID BlackoutId; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_DEL_BLACKOUT_CONFIRM; - -typedef struct CSR_MLME_DEL_BLACKOUT_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_BLACKOUT_ID BlackoutId; -} CSR_MLME_DEL_BLACKOUT_REQUEST; - -typedef struct CSR_MLME_DEL_PERIODIC_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_PERIODIC_ID PeriodicId; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_DEL_PERIODIC_CONFIRM; - -typedef struct CSR_MLME_DEL_PERIODIC_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_PERIODIC_ID PeriodicId; -} CSR_MLME_DEL_PERIODIC_REQUEST; - -typedef struct CSR_MLME_DEL_RX_TRIGGER_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_TRIGGER_ID TriggerId; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_DEL_RX_TRIGGER_CONFIRM; - -typedef struct CSR_MLME_DEL_RX_TRIGGER_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_TRIGGER_ID TriggerId; -} CSR_MLME_DEL_RX_TRIGGER_REQUEST; - -typedef struct CSR_MLME_DEL_TRIGGERED_GET_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; - CSR_TRIGGERED_ID TriggeredId; -} CSR_MLME_DEL_TRIGGERED_GET_CONFIRM; - -typedef struct CSR_MLME_DEL_TRIGGERED_GET_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_TRIGGERED_ID TriggeredId; -} CSR_MLME_DEL_TRIGGERED_GET_REQUEST; - -typedef struct CSR_MLME_DEL_TSPEC_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_PRIORITY UserPriority; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_DEL_TSPEC_CONFIRM; - -typedef struct CSR_MLME_DEL_TSPEC_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_PRIORITY UserPriority; - CSR_DIRECTION Direction; -} CSR_MLME_DEL_TSPEC_REQUEST; - -typedef struct CSR_MLME_GET_KEY_SEQUENCE_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; - CSR_NATURAL16 SequenceNumber[8]; -} CSR_MLME_GET_KEY_SEQUENCE_CONFIRM; - -typedef struct CSR_MLME_GET_KEY_SEQUENCE_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_NATURAL16 KeyId; - CSR_KEY_TYPE KeyType; - CSR_MACADDRESS Address; -} CSR_MLME_GET_KEY_SEQUENCE_REQUEST; - -typedef struct CSR_MLME_LEAVE_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_LEAVE_CONFIRM; - -typedef struct CSR_MLME_LEAVE_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; -} CSR_MLME_LEAVE_REQUEST; - -typedef struct CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM; - -typedef struct CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST -{ - CSR_DATAREF Data; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_TIME_UNITS BeaconPeriod; - CSR_BEACON_PERIODS DtimPeriod; - CSR_CAPABILITY_INFORMATION CapabilityInformation; - CSR_MACADDRESS Bssid; - CSR_NATURAL16 RtsThreshold; -} CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST; - -typedef struct CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; - CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; -} CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM; - -typedef struct CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_AUTONOMOUS_SCAN_ID AutonomousScanId; - s16 Pause; -} CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST; - -typedef struct CSR_MLME_POWERMGT_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_POWERMGT_CONFIRM; - -typedef struct CSR_MLME_POWERMGT_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_POWER_MANAGEMENT_MODE PowerManagementMode; - s16 ReceiveDtims; - CSR_BEACON_PERIODS ListenInterval; - CSR_TRAFFIC_WINDOW TrafficWindow; -} CSR_MLME_POWERMGT_REQUEST; - -typedef struct CSR_MLME_SCAN_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_SCAN_CONFIRM; - -typedef struct CSR_MLME_SCAN_REQUEST -{ - CSR_DATAREF ChannelList; - CSR_DATAREF InformationElements; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_IFINTERFACE Ifindex; - CSR_SCAN_TYPE ScanType; - CSR_MICROSECONDS32 ProbeDelay; - CSR_TIME_UNITS MinChannelTime; - CSR_TIME_UNITS MaxChannelTime; -} CSR_MLME_SCAN_REQUEST; - -typedef struct CSR_MLME_SCAN_CANCEL_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; -} CSR_MLME_SCAN_CANCEL_REQUEST; - -typedef struct CSR_MLME_SETKEYS_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_SETKEYS_CONFIRM; - -typedef struct CSR_MLME_SETKEYS_REQUEST -{ - CSR_DATAREF Key; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_NATURAL16 Length; - CSR_NATURAL16 KeyId; - CSR_KEY_TYPE KeyType; - CSR_MACADDRESS Address; - CSR_NATURAL16 SequenceNumber[8]; - CSR_CIPHER_SUITE_SELECTOR CipherSuiteSelector; -} CSR_MLME_SETKEYS_REQUEST; - -typedef struct CSR_MLME_SET_CHANNEL_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_SET_CHANNEL_CONFIRM; - -typedef struct CSR_MLME_SET_CHANNEL_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_IFINTERFACE Ifindex; - CSR_CHANNEL_NUMBER Channel; - CSR_MACADDRESS Address; - CSR_TIME_UNITS AvailabilityDuration; - CSR_TIME_UNITS AvailabilityInterval; -} CSR_MLME_SET_CHANNEL_REQUEST; - -typedef struct CSR_MLME_SET_PACKET_FILTER_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_SET_PACKET_FILTER_CONFIRM; - -typedef struct CSR_MLME_SET_PACKET_FILTER_REQUEST -{ - CSR_DATAREF InformationElements; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_PACKET_FILTER_MODE PacketFilterMode; - CSR_IPV4_ADDRESS ArpFilterAddress; -} CSR_MLME_SET_PACKET_FILTER_REQUEST; - -typedef struct CSR_MLME_SET_TIM_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_SET_TIM_CONFIRM; - -typedef struct CSR_MLME_SET_TIM_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_ASSOCIATION_ID AssociationId; - s16 TimValue; -} CSR_MLME_SET_TIM_REQUEST; - -typedef struct CSR_MLME_SM_START_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_SM_START_CONFIRM; - -typedef struct CSR_MLME_SM_START_REQUEST -{ - CSR_DATAREF Beacon; - CSR_DATAREF BssParameters; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_IFINTERFACE Ifindex; - CSR_CHANNEL_NUMBER Channel; - CSR_MACADDRESS InterfaceAddress; - CSR_MACADDRESS Bssid; - CSR_TIME_UNITS BeaconPeriod; - CSR_BEACON_PERIODS DtimPeriod; - CSR_CAPABILITY_INFORMATION CapabilityInformation; -} CSR_MLME_SM_START_REQUEST; - -typedef struct CSR_MLME_START_AGGREGATION_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_MACADDRESS PeerQstaAddress; - CSR_PRIORITY UserPriority; - CSR_DIRECTION Direction; - CSR_RESULT_CODE ResultCode; - CSR_SEQUENCE_NUMBER SequenceNumber; -} CSR_MLME_START_AGGREGATION_CONFIRM; - -typedef struct CSR_MLME_START_AGGREGATION_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_MACADDRESS PeerQstaAddress; - CSR_PRIORITY UserPriority; - CSR_DIRECTION Direction; - CSR_STARTING_SEQUENCE_NUMBER StartingSequenceNumber; - CSR_NATURAL16 BufferSize; - CSR_TIME_UNITS BlockAckTimeout; -} CSR_MLME_START_AGGREGATION_REQUEST; - -typedef struct CSR_MLME_STOP_AGGREGATION_CONFIRM -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_MACADDRESS PeerQstaAddress; - CSR_PRIORITY UserPriority; - CSR_DIRECTION Direction; - CSR_RESULT_CODE ResultCode; -} CSR_MLME_STOP_AGGREGATION_CONFIRM; - -typedef struct CSR_MLME_STOP_AGGREGATION_REQUEST -{ - CSR_DATAREF Dummydataref1; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_MACADDRESS PeerQstaAddress; - CSR_PRIORITY UserPriority; - CSR_DIRECTION Direction; -} CSR_MLME_STOP_AGGREGATION_REQUEST; - -typedef struct CSR_MLME_TRIGGERED_GET_INDICATION -{ - CSR_DATAREF MibAttributeValue; - CSR_DATAREF Dummydataref2; - CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier; - CSR_MIB_STATUS Status; - CSR_NATURAL16 ErrorIndex; - CSR_TRIGGERED_ID TriggeredId; -} CSR_MLME_TRIGGERED_GET_INDICATION; - -typedef struct CSR_SIGNAL_PRIMITIVE -{ - CSR_SIGNAL_PRIMITIVE_HEADER SignalPrimitiveHeader; - union - { - CSR_MA_PACKET_REQUEST MaPacketRequest; - CSR_MA_PACKET_CONFIRM MaPacketConfirm; - CSR_MA_PACKET_INDICATION MaPacketIndication; - CSR_MA_PACKET_CANCEL_REQUEST MaPacketCancelRequest; - CSR_MA_VIF_AVAILABILITY_RESPONSE MaVifAvailabilityResponse; - CSR_MA_VIF_AVAILABILITY_INDICATION MaVifAvailabilityIndication; - CSR_MA_PACKET_ERROR_INDICATION MaPacketErrorIndication; - CSR_MLME_RESET_REQUEST MlmeResetRequest; - CSR_MLME_RESET_CONFIRM MlmeResetConfirm; - CSR_MLME_GET_REQUEST MlmeGetRequest; - CSR_MLME_GET_CONFIRM MlmeGetConfirm; - CSR_MLME_SET_REQUEST MlmeSetRequest; - CSR_MLME_SET_CONFIRM MlmeSetConfirm; - CSR_MLME_GET_NEXT_REQUEST MlmeGetNextRequest; - CSR_MLME_GET_NEXT_CONFIRM MlmeGetNextConfirm; - CSR_MLME_POWERMGT_REQUEST MlmePowermgtRequest; - CSR_MLME_POWERMGT_CONFIRM MlmePowermgtConfirm; - CSR_MLME_SCAN_REQUEST MlmeScanRequest; - CSR_MLME_SCAN_CONFIRM MlmeScanConfirm; - CSR_MLME_HL_SYNC_REQUEST MlmeHlSyncRequest; - CSR_MLME_HL_SYNC_CONFIRM MlmeHlSyncConfirm; - CSR_MLME_MEASURE_REQUEST MlmeMeasureRequest; - CSR_MLME_MEASURE_CONFIRM MlmeMeasureConfirm; - CSR_MLME_MEASURE_INDICATION MlmeMeasureIndication; - CSR_MLME_SETKEYS_REQUEST MlmeSetkeysRequest; - CSR_MLME_SETKEYS_CONFIRM MlmeSetkeysConfirm; - CSR_MLME_DELETEKEYS_REQUEST MlmeDeletekeysRequest; - CSR_MLME_DELETEKEYS_CONFIRM MlmeDeletekeysConfirm; - CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION MlmeAutonomousScanLossIndication; - CSR_MLME_CONNECTED_INDICATION MlmeConnectedIndication; - CSR_MLME_SCAN_CANCEL_REQUEST MlmeScanCancelRequest; - CSR_MLME_HL_SYNC_CANCEL_REQUEST MlmeHlSyncCancelRequest; - CSR_MLME_HL_SYNC_CANCEL_CONFIRM MlmeHlSyncCancelConfirm; - CSR_MLME_ADD_PERIODIC_REQUEST MlmeAddPeriodicRequest; - CSR_MLME_ADD_PERIODIC_CONFIRM MlmeAddPeriodicConfirm; - CSR_MLME_DEL_PERIODIC_REQUEST MlmeDelPeriodicRequest; - CSR_MLME_DEL_PERIODIC_CONFIRM MlmeDelPeriodicConfirm; - CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST MlmeAddAutonomousScanRequest; - CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM MlmeAddAutonomousScanConfirm; - CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST MlmeDelAutonomousScanRequest; - CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM MlmeDelAutonomousScanConfirm; - CSR_MLME_SET_PACKET_FILTER_REQUEST MlmeSetPacketFilterRequest; - CSR_MLME_SET_PACKET_FILTER_CONFIRM MlmeSetPacketFilterConfirm; - CSR_MLME_STOP_MEASURE_REQUEST MlmeStopMeasureRequest; - CSR_MLME_STOP_MEASURE_CONFIRM MlmeStopMeasureConfirm; - CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST MlmePauseAutonomousScanRequest; - CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM MlmePauseAutonomousScanConfirm; - CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION MlmeAutonomousScanDoneIndication; - CSR_MLME_ADD_TRIGGERED_GET_REQUEST MlmeAddTriggeredGetRequest; - CSR_MLME_ADD_TRIGGERED_GET_CONFIRM MlmeAddTriggeredGetConfirm; - CSR_MLME_DEL_TRIGGERED_GET_REQUEST MlmeDelTriggeredGetRequest; - CSR_MLME_DEL_TRIGGERED_GET_CONFIRM MlmeDelTriggeredGetConfirm; - CSR_MLME_TRIGGERED_GET_INDICATION MlmeTriggeredGetIndication; - CSR_MLME_ADD_BLACKOUT_REQUEST MlmeAddBlackoutRequest; - CSR_MLME_ADD_BLACKOUT_CONFIRM MlmeAddBlackoutConfirm; - CSR_MLME_BLACKOUT_ENDED_INDICATION MlmeBlackoutEndedIndication; - CSR_MLME_DEL_BLACKOUT_REQUEST MlmeDelBlackoutRequest; - CSR_MLME_DEL_BLACKOUT_CONFIRM MlmeDelBlackoutConfirm; - CSR_MLME_ADD_RX_TRIGGER_REQUEST MlmeAddRxTriggerRequest; - CSR_MLME_ADD_RX_TRIGGER_CONFIRM MlmeAddRxTriggerConfirm; - CSR_MLME_DEL_RX_TRIGGER_REQUEST MlmeDelRxTriggerRequest; - CSR_MLME_DEL_RX_TRIGGER_CONFIRM MlmeDelRxTriggerConfirm; - CSR_MLME_CONNECT_STATUS_REQUEST MlmeConnectStatusRequest; - CSR_MLME_CONNECT_STATUS_CONFIRM MlmeConnectStatusConfirm; - CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST MlmeModifyBssParameterRequest; - CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM MlmeModifyBssParameterConfirm; - CSR_MLME_ADD_TEMPLATE_REQUEST MlmeAddTemplateRequest; - CSR_MLME_ADD_TEMPLATE_CONFIRM MlmeAddTemplateConfirm; - CSR_MLME_CONFIG_QUEUE_REQUEST MlmeConfigQueueRequest; - CSR_MLME_CONFIG_QUEUE_CONFIRM MlmeConfigQueueConfirm; - CSR_MLME_ADD_TSPEC_REQUEST MlmeAddTspecRequest; - CSR_MLME_ADD_TSPEC_CONFIRM MlmeAddTspecConfirm; - CSR_MLME_DEL_TSPEC_REQUEST MlmeDelTspecRequest; - CSR_MLME_DEL_TSPEC_CONFIRM MlmeDelTspecConfirm; - CSR_MLME_START_AGGREGATION_REQUEST MlmeStartAggregationRequest; - CSR_MLME_START_AGGREGATION_CONFIRM MlmeStartAggregationConfirm; - CSR_MLME_BLOCKACK_ERROR_INDICATION MlmeBlockackErrorIndication; - CSR_MLME_STOP_AGGREGATION_REQUEST MlmeStopAggregationRequest; - CSR_MLME_STOP_AGGREGATION_CONFIRM MlmeStopAggregationConfirm; - CSR_MLME_SM_START_REQUEST MlmeSmStartRequest; - CSR_MLME_SM_START_CONFIRM MlmeSmStartConfirm; - CSR_MLME_LEAVE_REQUEST MlmeLeaveRequest; - CSR_MLME_LEAVE_CONFIRM MlmeLeaveConfirm; - CSR_MLME_SET_TIM_REQUEST MlmeSetTimRequest; - CSR_MLME_SET_TIM_CONFIRM MlmeSetTimConfirm; - CSR_MLME_GET_KEY_SEQUENCE_REQUEST MlmeGetKeySequenceRequest; - CSR_MLME_GET_KEY_SEQUENCE_CONFIRM MlmeGetKeySequenceConfirm; - CSR_MLME_SET_CHANNEL_REQUEST MlmeSetChannelRequest; - CSR_MLME_SET_CHANNEL_CONFIRM MlmeSetChannelConfirm; - CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST MlmeAddMulticastAddressRequest; - CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM MlmeAddMulticastAddressConfirm; - CSR_DEBUG_STRING_INDICATION DebugStringIndication; - CSR_DEBUG_WORD16_INDICATION DebugWord16Indication; - CSR_DEBUG_GENERIC_REQUEST DebugGenericRequest; - CSR_DEBUG_GENERIC_CONFIRM DebugGenericConfirm; - CSR_DEBUG_GENERIC_INDICATION DebugGenericIndication; - } u; -} CSR_SIGNAL; - -#define SIG_FILTER_SIZE 6 - -u32 SigGetFilterPos(u16 aSigID); - -#endif diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c deleted file mode 100644 index f1df36aa87e7..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c +++ /dev/null @@ -1,541 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * FILE: csr_wifi_hip_ta_sampling.c - * - * PURPOSE: - * The traffic analysis sampling module. - * This gathers data which is sent to the SME and used to analyse - * the traffic behaviour. - * - * Provides: - * unifi_ta_sampling_init - Initialise the internal state - * unifi_ta_sample - Sampling function, call this for every data packet - * - * Calls these external functions which must be provided: - * unifi_ta_indicate_sampling - Pass sample data to the SME. - * unifi_ta_indicate_protocol - Report certain data packet types to the SME. - * --------------------------------------------------------------------------- - */ - -#include "csr_wifi_hip_card_sdio.h" - -/* Maximum number of Tx frames we store each CYCLE_1, for detecting period */ -#define TA_MAX_INTERVALS_IN_C1 100 - -/* Number of intervals in CYCLE_1 (one second), for detecting periodic */ -/* Must match size of unifi_TrafficStats.intervals - 1 */ -#define TA_INTERVALS_NUM 10 - -/* Step (in msecs) between intervals, for detecting periodic */ -/* We are only interested in periods up to 100ms, i.e. between beacons */ -/* This is correct for TA_INTERVALS_NUM=10 */ -#define TA_INTERVALS_STEP 10 - - -enum ta_frame_identity -{ - TA_FRAME_UNKNOWN, - TA_FRAME_ETHERNET_UNINTERESTING, - TA_FRAME_ETHERNET_INTERESTING -}; - - -#define TA_ETHERNET_TYPE_OFFSET 6 -#define TA_LLC_HEADER_SIZE 8 -#define TA_IP_TYPE_OFFSET 17 -#define TA_UDP_SOURCE_PORT_OFFSET 28 -#define TA_UDP_DEST_PORT_OFFSET (TA_UDP_SOURCE_PORT_OFFSET + 2) -#define TA_BOOTP_CLIENT_MAC_ADDR_OFFSET 64 -#define TA_DHCP_MESSAGE_TYPE_OFFSET 278 -#define TA_DHCP_MESSAGE_TYPE_ACK 0x05 -#define TA_PROTO_TYPE_IP 0x0800 -#define TA_PROTO_TYPE_EAP 0x888E -#define TA_PROTO_TYPE_WAI 0x8864 -#define TA_PROTO_TYPE_ARP 0x0806 -#define TA_IP_TYPE_TCP 0x06 -#define TA_IP_TYPE_UDP 0x11 -#define TA_UDP_PORT_BOOTPC 0x0044 -#define TA_UDP_PORT_BOOTPS 0x0043 -#define TA_EAPOL_TYPE_OFFSET 9 -#define TA_EAPOL_TYPE_START 0x01 - -#define snap_802_2 0xAAAA0300 -#define oui_rfc1042 0x00000000 -#define oui_8021h 0x0000f800 -static const u8 aironet_snap[5] = { 0x00, 0x40, 0x96, 0x00, 0x00 }; - - -/* - * --------------------------------------------------------------------------- - * ta_detect_protocol - * - * Internal only. - * Detects a specific protocol in a frame and indicates a TA event. - * - * Arguments: - * ta The pointer to the TA module. - * direction The direction of the frame (tx or rx). - * data Pointer to the structure that contains the data. - * - * Returns: - * None - * --------------------------------------------------------------------------- - */ -static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrlProtocolDirection direction, - const bulk_data_desc_t *data, - const u8 *saddr, - const u8 *sta_macaddr) -{ - ta_data_t *tad = &card->ta_sampling; - u16 proto; - u16 source_port, dest_port; - CsrWifiMacAddress srcAddress; - u32 snap_hdr, oui_hdr; - - if (data->data_length < TA_LLC_HEADER_SIZE) - { - return TA_FRAME_UNKNOWN; - } - - snap_hdr = (((u32)data->os_data_ptr[0]) << 24) | - (((u32)data->os_data_ptr[1]) << 16) | - (((u32)data->os_data_ptr[2]) << 8); - if (snap_hdr != snap_802_2) - { - return TA_FRAME_UNKNOWN; - } - - if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM) - { - /* - * Here we would use the custom filter to detect interesting frames. - */ - } - - oui_hdr = (((u32)data->os_data_ptr[3]) << 24) | - (((u32)data->os_data_ptr[4]) << 16) | - (((u32)data->os_data_ptr[5]) << 8); - if ((oui_hdr == oui_rfc1042) || (oui_hdr == oui_8021h)) - { - proto = (data->os_data_ptr[TA_ETHERNET_TYPE_OFFSET] * 256) + - data->os_data_ptr[TA_ETHERNET_TYPE_OFFSET + 1]; - - /* The only interesting IP frames are the DHCP */ - if (proto == TA_PROTO_TYPE_IP) - { - if (data->data_length > TA_IP_TYPE_OFFSET) - { - if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM) - { - ta_l4stats_t *ta_l4stats = &tad->ta_l4stats; - u8 l4proto = data->os_data_ptr[TA_IP_TYPE_OFFSET]; - - if (l4proto == TA_IP_TYPE_TCP) - { - if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX) - { - ta_l4stats->txTcpBytesCount += data->data_length; - } - else - { - ta_l4stats->rxTcpBytesCount += data->data_length; - } - } - else if (l4proto == TA_IP_TYPE_UDP) - { - if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX) - { - ta_l4stats->txUdpBytesCount += data->data_length; - } - else - { - ta_l4stats->rxUdpBytesCount += data->data_length; - } - } - } - - /* detect DHCP frames */ - if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP) - { - /* DHCP frames are UDP frames with BOOTP ports */ - if (data->os_data_ptr[TA_IP_TYPE_OFFSET] == TA_IP_TYPE_UDP) - { - if (data->data_length > TA_UDP_DEST_PORT_OFFSET) - { - source_port = (data->os_data_ptr[TA_UDP_SOURCE_PORT_OFFSET] * 256) + - data->os_data_ptr[TA_UDP_SOURCE_PORT_OFFSET + 1]; - dest_port = (data->os_data_ptr[TA_UDP_DEST_PORT_OFFSET] * 256) + - data->os_data_ptr[TA_UDP_DEST_PORT_OFFSET + 1]; - - if (((source_port == TA_UDP_PORT_BOOTPC) && (dest_port == TA_UDP_PORT_BOOTPS)) || - ((source_port == TA_UDP_PORT_BOOTPS) && (dest_port == TA_UDP_PORT_BOOTPC))) - { - /* The DHCP should have at least a message type (request, ack, nack, etc) */ - if (data->data_length > TA_DHCP_MESSAGE_TYPE_OFFSET + 6) - { - UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr); - - if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX) - { - unifi_ta_indicate_protocol(card->ospriv, - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP, - direction, - &srcAddress); - return TA_FRAME_ETHERNET_UNINTERESTING; - } - - /* DHCPACK is a special indication */ - if (UNIFI_MAC_ADDRESS_CMP(data->os_data_ptr + TA_BOOTP_CLIENT_MAC_ADDR_OFFSET, sta_macaddr) == TRUE) - { - if (data->os_data_ptr[TA_DHCP_MESSAGE_TYPE_OFFSET] == TA_DHCP_MESSAGE_TYPE_ACK) - { - unifi_ta_indicate_protocol(card->ospriv, - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP_ACK, - direction, - &srcAddress); - } - else - { - unifi_ta_indicate_protocol(card->ospriv, - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP, - direction, - &srcAddress); - } - } - } - } - } - } - } - } - - return TA_FRAME_ETHERNET_INTERESTING; - } - - /* detect protocol type EAPOL or WAI (treated as equivalent here) */ - if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL) - { - if (TA_PROTO_TYPE_EAP == proto || TA_PROTO_TYPE_WAI == proto) - { - if ((TA_PROTO_TYPE_WAI == proto) || (direction != CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX) || - (data->os_data_ptr[TA_EAPOL_TYPE_OFFSET] == TA_EAPOL_TYPE_START)) - { - UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr); - unifi_ta_indicate_protocol(card->ospriv, - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL, - direction, &srcAddress); - } - return TA_FRAME_ETHERNET_UNINTERESTING; - } - } - - /* detect protocol type 0x0806 (ARP) */ - if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP) - { - if (proto == TA_PROTO_TYPE_ARP) - { - UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr); - unifi_ta_indicate_protocol(card->ospriv, - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP, - direction, &srcAddress); - return TA_FRAME_ETHERNET_UNINTERESTING; - } - } - - return TA_FRAME_ETHERNET_INTERESTING; - } - else if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET) - { - /* detect Aironet frames */ - if (!memcmp(data->os_data_ptr + 3, aironet_snap, 5)) - { - UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr); - unifi_ta_indicate_protocol(card->ospriv, CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET, - direction, &srcAddress); - } - } - - return TA_FRAME_ETHERNET_UNINTERESTING; -} /* ta_detect_protocol() */ - - -static void tas_reset_data(ta_data_t *tad) -{ - s16 i; - - for (i = 0; i < (TA_INTERVALS_NUM + 1); i++) - { - tad->stats.intervals[i] = 0; - } - - tad->stats.rxFramesNum = 0; - tad->stats.txFramesNum = 0; - tad->stats.rxBytesCount = 0; - tad->stats.txBytesCount = 0; - tad->stats.rxMeanRate = 0; - - tad->rx_sum_rate = 0; - - tad->ta_l4stats.rxTcpBytesCount = 0; - tad->ta_l4stats.txTcpBytesCount = 0; - tad->ta_l4stats.rxUdpBytesCount = 0; - tad->ta_l4stats.txUdpBytesCount = 0; -} /* tas_reset_data() */ - - -/* - * --------------------------------------------------------------------------- - * API. - * unifi_ta_sampling_init - * - * (Re)Initialise the Traffic Analysis sampling module. - * Resets the counters and timestamps. - * - * Arguments: - * tad Pointer to a ta_data_t structure containing the - * context for this device instance. - * drv_priv An opaque pointer that the TA sampling module will - * pass in call-outs. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void unifi_ta_sampling_init(card_t *card) -{ - (void)unifi_ta_configure(card, CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET, NULL); - - card->ta_sampling.packet_filter = CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE; - card->ta_sampling.traffic_type = CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_OCCASIONAL; -} /* unifi_ta_sampling_init() */ - - -/* - * --------------------------------------------------------------------------- - * API. - * unifi_ta_sample - * - * Sample a data frame for the TA module. - * This function stores all the useful information it can extract from - * the frame and detects any specific protocols. - * - * Arguments: - * tad The pointer to the TA sampling context struct. - * direction The direction of the frame (rx, tx) - * data Pointer to the frame data - * saddr Source MAC address of frame. - * timestamp Time (in msecs) that the frame was received. - * rate Reported data rate for the rx frame (0 for tx frames) - * - * Returns: - * None - * --------------------------------------------------------------------------- - */ -void unifi_ta_sample(card_t *card, - CsrWifiRouterCtrlProtocolDirection direction, - const bulk_data_desc_t *data, - const u8 *saddr, - const u8 *sta_macaddr, - u32 timestamp, - u16 rate) -{ - ta_data_t *tad = &card->ta_sampling; - enum ta_frame_identity identity; - u32 time_delta; - - - - /* Step1: Check for specific frames */ - if (tad->packet_filter != CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE) - { - identity = ta_detect_protocol(card, direction, data, saddr, sta_macaddr); - } - else - { - identity = TA_FRAME_ETHERNET_INTERESTING; - } - - - /* Step2: Update the information in the current record */ - if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX) - { - /* Update the Rx packet count and the throughput count */ - tad->stats.rxFramesNum++; - tad->stats.rxBytesCount += data->data_length; - - /* Accumulate packet Rx rates for later averaging */ - tad->rx_sum_rate += rate; - } - else - { - if (identity == TA_FRAME_ETHERNET_INTERESTING) - { - /* - * Store the period between the last and the current frame. - * There is not point storing more than TA_MAX_INTERVALS_IN_C1 periods, - * the traffic will be bursty or continuous. - */ - if (tad->stats.txFramesNum < TA_MAX_INTERVALS_IN_C1) - { - u32 interval; - u32 index_in_intervals; - - interval = timestamp - tad->tx_last_ts; - tad->tx_last_ts = timestamp; - index_in_intervals = (interval + TA_INTERVALS_STEP / 2 - 1) / TA_INTERVALS_STEP; - - /* If the interval is interesting, update the t1_intervals count */ - if (index_in_intervals <= TA_INTERVALS_NUM) - { - unifi_trace(card->ospriv, UDBG5, - "unifi_ta_sample: TX interval=%d index=%d\n", - interval, index_in_intervals); - tad->stats.intervals[index_in_intervals]++; - } - } - } - - /* Update the Tx packet count... */ - tad->stats.txFramesNum++; - /* ... and the number of bytes for throughput. */ - tad->stats.txBytesCount += data->data_length; - } - - /* - * If more than one second has elapsed since the last report, send - * another one. - */ - /* Unsigned subtraction handles wrap-around from 0xFFFFFFFF to 0 */ - time_delta = timestamp - tad->last_indication_time; - if (time_delta >= 1000) - { - /* - * rxFramesNum can be flashed in tas_reset_data() by another thread. - * Use a temp to avoid division by zero. - */ - u32 temp_rxFramesNum; - temp_rxFramesNum = tad->stats.rxFramesNum; - - /* Calculate this interval's mean frame Rx rate from the sum */ - if (temp_rxFramesNum) - { - tad->stats.rxMeanRate = tad->rx_sum_rate / temp_rxFramesNum; - } - unifi_trace(card->ospriv, UDBG5, - "unifi_ta_sample: RX fr=%lu, r=%u, sum=%lu, av=%lu\n", - tad->stats.rxFramesNum, rate, - tad->rx_sum_rate, tad->stats.rxMeanRate); - - /* - * Send the information collected in the stats struct - * to the SME and reset the counters. - */ - if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM) - { - u32 rxTcpThroughput = tad->ta_l4stats.rxTcpBytesCount / time_delta; - u32 txTcpThroughput = tad->ta_l4stats.txTcpBytesCount / time_delta; - u32 rxUdpThroughput = tad->ta_l4stats.rxUdpBytesCount / time_delta; - u32 txUdpThroughput = tad->ta_l4stats.txUdpBytesCount / time_delta; - - unifi_ta_indicate_l4stats(card->ospriv, - rxTcpThroughput, - txTcpThroughput, - rxUdpThroughput, - txUdpThroughput - ); - } - unifi_ta_indicate_sampling(card->ospriv, &tad->stats); - tas_reset_data(tad); - tad->last_indication_time = timestamp; - } -} /* unifi_ta_sample() */ - - -/* - * --------------------------------------------------------------------------- - * External API. - * unifi_ta_configure - * - * Configures the TA module parameters. - * - * Arguments: - * ta The pointer to the TA module. - * config_type The type of the configuration request - * config Pointer to the configuration parameters. - * - * Returns: - * CSR_RESULT_SUCCESS on success, CSR error code otherwise - * --------------------------------------------------------------------------- - */ -CsrResult unifi_ta_configure(card_t *card, - CsrWifiRouterCtrlTrafficConfigType config_type, - const CsrWifiRouterCtrlTrafficConfig *config) -{ - ta_data_t *tad = &card->ta_sampling; - - /* Reinitialise our data when we are reset */ - if (config_type == CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET) - { - /* Reset the stats to zero */ - tas_reset_data(tad); - - /* Reset the timer variables */ - tad->tx_last_ts = 0; - tad->last_indication_time = 0; - - return CSR_RESULT_SUCCESS; - } - - if (config_type == CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER) - { - tad->packet_filter = config->packetFilter; - - if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM) - { - tad->custom_filter = config->customFilter; - } - - return CSR_RESULT_SUCCESS; - } - - return CSR_RESULT_SUCCESS; -} /* unifi_ta_configure() */ - - -/* - * --------------------------------------------------------------------------- - * External API. - * unifi_ta_classification - * - * Configures the current TA classification. - * - * Arguments: - * ta The pointer to the TA module. - * traffic_type The classification type - * period The traffic period if the type is periodic - * - * Returns: - * None - * --------------------------------------------------------------------------- - */ -void unifi_ta_classification(card_t *card, - CsrWifiRouterCtrlTrafficType traffic_type, - u16 period) -{ - unifi_trace(card->ospriv, UDBG3, - "Changed current ta classification to: %d\n", traffic_type); - - card->ta_sampling.traffic_type = traffic_type; -} - - diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.h b/drivers/staging/csr/csr_wifi_hip_ta_sampling.h deleted file mode 100644 index aa684c654d06..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_ta_sampling.h +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * FILE: csr_wifi_hip_ta_sampling.h - * - * PURPOSE: - * This file contains Traffic Analysis definitions common to the - * sampling and analysis modules. - * - * --------------------------------------------------------------------------- - */ -#ifndef __TA_SAMPLING_H__ -#define __TA_SAMPLING_H__ - -#include "csr_wifi_hip_unifi.h" - -typedef struct ta_l4stats -{ - u32 rxTcpBytesCount; - u32 txTcpBytesCount; - u32 rxUdpBytesCount; - u32 txUdpBytesCount; -} ta_l4stats_t; - -/* - * Context structure to preserve state between calls. - */ - -typedef struct ta_data -{ - /* Current packet filter configuration */ - u16 packet_filter; - - /* Current packet custom filter configuration */ - CsrWifiRouterCtrlTrafficFilter custom_filter; - - /* The timestamp of the last tx packet processed. */ - u32 tx_last_ts; - - /* The timestamp of the last packet processed. */ - u32 last_indication_time; - - /* Statistics */ - CsrWifiRouterCtrlTrafficStats stats; - - /* Current traffic classification */ - CsrWifiRouterCtrlTrafficType traffic_type; - - /* Sum of packet rx rates for this interval used to calculate mean */ - u32 rx_sum_rate; - ta_l4stats_t ta_l4stats; -} ta_data_t; - - -void unifi_ta_sampling_init(card_t *card); - -#endif /* __TA_SAMPLING_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_udi.c b/drivers/staging/csr/csr_wifi_hip_udi.c deleted file mode 100644 index a6b006b0e983..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_udi.c +++ /dev/null @@ -1,173 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * FILE: csr_wifi_hip_card_udi.c - * - * PURPOSE: - * Maintain a list of callbacks to log UniFi exchanges to one or more - * debug/monitoring client applications. - * - * NOTES: - * Just call the UDI driver log fn directly for now. - * When done properly, each open() on the UDI device will install - * a log function. We will call all log fns whenever a signal is written - * to or read form the UniFi. - * - * --------------------------------------------------------------------------- - */ -#include <linux/seq_file.h> -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_card.h" - - -static void unifi_print_unsafe_sdio_status(card_t *card, struct seq_file *m) -{ -#ifdef CSR_UNSAFE_SDIO_ACCESS - s32 iostate; - CsrResult r; - static const char *const states[] = { - "AWAKE", "DROWSY", "TORPID" - }; -#define SHARED_READ_RETRY_LIMIT 10 - u8 b; - - seq_printf(m, "Host State: %s\n", states[card->host_state]); - - r = unifi_check_io_status(card, &iostate); - if (iostate == 1) { - seq_puts(m, remaining, "I/O Check: F1 disabled\n"); - } else { - if (iostate == 1) { - seq_puts(m, "I/O Check: pending interrupt\n"); - - seq_printf(m, "BH reason interrupt = %d\n", card->bh_reason_unifi); - seq_printf(m, "BH reason host = %d\n", card->bh_reason_host); - - for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++) { - r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 2, &b); - if (r == CSR_RESULT_SUCCESS && !(b & 0x80)) { - seq_printf(m, "fhsr: %u (driver thinks is %u)\n", - b, card->from_host_signals_r); - break; - } - } - - iostate = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4); - seq_printf(m, "thsw: %u (driver thinks is %u)\n", - iostate, card->to_host_signals_w); - } -#endif -} - -/* - * --------------------------------------------------------------------------- - * unifi_print_status - * - * Print status info to given character buffer. - * - * Arguments: - * None. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -s32 unifi_print_status(card_t *card, struct seq_file *m) -{ - sdio_config_data_t *cfg; - u16 i, n; - - i = n = 0; - seq_printf(m, "Chip ID %u\n", card->chip_id); - seq_printf(m, "Chip Version %04X\n", card->chip_version); - seq_printf(m, "HIP v%u.%u\n", - (card->config_data.version >> 8) & 0xFF, - card->config_data.version & 0xFF); - seq_printf(m, "Build %u: %s\n", card->build_id, card->build_id_string); - - cfg = &card->config_data; - - seq_printf(m, "sdio ctrl offset %u\n", cfg->sdio_ctrl_offset); - seq_printf(m, "fromhost sigbuf handle %u\n", cfg->fromhost_sigbuf_handle); - seq_printf(m, "tohost_sigbuf_handle %u\n", cfg->tohost_sigbuf_handle); - seq_printf(m, "num_fromhost_sig_frags %u\n", cfg->num_fromhost_sig_frags); - seq_printf(m, "num_tohost_sig_frags %u\n", cfg->num_tohost_sig_frags); - seq_printf(m, "num_fromhost_data_slots %u\n", cfg->num_fromhost_data_slots); - seq_printf(m, "num_tohost_data_slots %u\n", cfg->num_tohost_data_slots); - seq_printf(m, "data_slot_size %u\n", cfg->data_slot_size); - - /* Added by protocol version 0x0001 */ - seq_printf(m, "overlay_size %u\n", cfg->overlay_size); - - /* Added by protocol version 0x0300 */ - seq_printf(m, "data_slot_round %u\n", cfg->data_slot_round); - seq_printf(m, "sig_frag_size %u\n", cfg->sig_frag_size); - - /* Added by protocol version 0x0300 */ - seq_printf(m, "tohost_sig_pad %u\n", cfg->tohost_signal_padding); - - seq_puts(m, "\nInternal state:\n"); - - seq_printf(m, "Last PHY PANIC: %04x:%04x\n", - card->last_phy_panic_code, card->last_phy_panic_arg); - seq_printf(m, "Last MAC PANIC: %04x:%04x\n", - card->last_mac_panic_code, card->last_mac_panic_arg); - - seq_printf(m, "fhsr: %hu\n", (u16)card->from_host_signals_r); - seq_printf(m, "fhsw: %hu\n", (u16)card->from_host_signals_w); - seq_printf(m, "thsr: %hu\n", (u16)card->to_host_signals_r); - seq_printf(m, "thsw: %hu\n", (u16)card->to_host_signals_w); - seq_printf(m, "fh buffer contains: %d signals, %td bytes\n", - card->fh_buffer.count, - card->fh_buffer.ptr - card->fh_buffer.buf); - - seq_puts(m, "paused: "); - for (i = 0; i < ARRAY_SIZE(card->tx_q_paused_flag); i++) - seq_printf(m, card->tx_q_paused_flag[i] ? "1" : "0"); - seq_putc(m, '\n'); - - seq_printf(m, "fh command q: %u waiting, %u free of %u:\n", - CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_command_queue), - CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_command_queue), - UNIFI_SOFT_COMMAND_Q_LENGTH); - - for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) - seq_printf(m, "fh traffic q[%u]: %u waiting, %u free of %u:\n", - i, - CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[i]), - CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[i]), - UNIFI_SOFT_TRAFFIC_Q_LENGTH); - - seq_printf(m, "fh data slots free: %u\n", - card->from_host_data ? CardGetFreeFromHostDataSlots(card) : 0); - - seq_puts(m, "From host data slots:"); - n = card->config_data.num_fromhost_data_slots; - for (i = 0; i < n && card->from_host_data; i++) - seq_printf(m, " %hu", (u16)card->from_host_data[i].bd.data_length); - seq_putc(m, '\n'); - - seq_puts(m, "To host data slots:"); - n = card->config_data.num_tohost_data_slots; - for (i = 0; i < n && card->to_host_data; i++) - seq_printf(m, " %hu", (u16)card->to_host_data[i].data_length); - seq_putc(m, '\n'); - - unifi_print_unsafe_sdio_status(card, m); - - seq_puts(m, "\nStats:\n"); - seq_printf(m, "Total SDIO bytes: R=%u W=%u\n", - card->sdio_bytes_read, card->sdio_bytes_written); - - seq_printf(m, "Interrupts generated on card: %u\n", card->unifi_interrupt_seq); - return 0; -} diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h deleted file mode 100644 index 1160a0e25c7d..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_unifi.h +++ /dev/null @@ -1,871 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * - * FILE : csr_wifi_hip_unifi.h - * - * PURPOSE : Public API for the UniFi HIP core library. - * - * --------------------------------------------------------------------------- - */ -#ifndef __CSR_WIFI_HIP_UNIFI_H__ -#define __CSR_WIFI_HIP_UNIFI_H__ 1 - -#ifndef CSR_WIFI_HIP_TA_DISABLE -#include "csr_wifi_router_ctrl_prim.h" -#include "csr_wifi_router_prim.h" -#else -#include "csr_time.h" -#endif - -/* SDIO chip ID numbers */ - -/* Manufacturer id */ -#define SDIO_MANF_ID_CSR 0x032a - -/* Device id */ -#define SDIO_CARD_ID_UNIFI_1 0x0001 -#define SDIO_CARD_ID_UNIFI_2 0x0002 -#define SDIO_CARD_ID_UNIFI_3 0x0007 -#define SDIO_CARD_ID_UNIFI_4 0x0008 - -/* Function number for WLAN */ -#define SDIO_WLAN_FUNC_ID_UNIFI_1 0x0001 -#define SDIO_WLAN_FUNC_ID_UNIFI_2 0x0001 -#define SDIO_WLAN_FUNC_ID_UNIFI_3 0x0001 -#define SDIO_WLAN_FUNC_ID_UNIFI_4 0x0002 - -/* Maximum SDIO bus clock supported. */ -#define UNIFI_SDIO_CLOCK_MAX_HZ 50000000 /* Hz */ - -/* - * Initialisation SDIO bus clock. - * - * The initialisation clock speed should be used from when the chip has been - * reset until the first MLME-reset has been received (i.e. during firmware - * initialisation), unless UNIFI_SDIO_CLOCK_SAFE_HZ applies. - */ -#define UNIFI_SDIO_CLOCK_INIT_HZ 12500000 /* Hz */ - -/* - * Safe SDIO bus clock. - * - * The safe speed should be used when the chip is in deep sleep or - * it's state is unknown (just after reset / power on). - */ -#define UNIFI_SDIO_CLOCK_SAFE_HZ 1000000 /* Hz */ - -/* I/O default block size to use for UniFi. */ -#define UNIFI_IO_BLOCK_SIZE 64 - -#define UNIFI_WOL_OFF 0 -#define UNIFI_WOL_SDIO 1 -#define UNIFI_WOL_PIO 2 - -/* The number of Tx traffic queues */ -#define UNIFI_NO_OF_TX_QS 4 - -#define CSR_WIFI_HIP_RESERVED_HOST_TAG 0xFFFFFFFF - -/* - * The number of slots in the from-host queues. - * - * UNIFI_SOFT_TRAFFIC_Q_LENGTH is the number of slots in the traffic queues - * and there will be UNIFI_NO_OF_TX_QS of them. - * Traffic queues are used for data packets. - * - * UNIFI_SOFT_COMMAND_Q_LENGTH is the number of slots in the command queue. - * The command queue is used for MLME management requests. - * - * Queues are ring buffers and so must always have 1 unused slot. - */ -#define UNIFI_SOFT_TRAFFIC_Q_LENGTH (20 + 1) -#define UNIFI_SOFT_COMMAND_Q_LENGTH (16 + 1) - -#include "csr_framework_ext.h" /* from the synergy porting folder */ -#include "csr_sdio.h" /* from the synergy porting folder */ -#include "csr_macro.h" /* from the synergy porting folder */ -#include "csr_wifi_result.h" - -/* Utility MACROS. Note that UNIFI_MAC_ADDRESS_CMP returns TRUE on success */ -#define UNIFI_MAC_ADDRESS_COPY(dst, src) \ - do { (dst)[0] = (src)[0]; (dst)[1] = (src)[1]; \ - (dst)[2] = (src)[2]; (dst)[3] = (src)[3]; \ - (dst)[4] = (src)[4]; (dst)[5] = (src)[5]; \ - } while (0) - -#define UNIFI_MAC_ADDRESS_CMP(addr1, addr2) \ - (((addr1)[0] == (addr2)[0]) && ((addr1)[1] == (addr2)[1]) && \ - ((addr1)[2] == (addr2)[2]) && ((addr1)[3] == (addr2)[3]) && \ - ((addr1)[4] == (addr2)[4]) && ((addr1)[5] == (addr2)[5])) - -/* Traffic queue ordered according to priority - * EAPOL/Uncontrolled port Queue should be the last - */ -typedef enum -{ - UNIFI_TRAFFIC_Q_BK = 0, - UNIFI_TRAFFIC_Q_BE, - UNIFI_TRAFFIC_Q_VI, - UNIFI_TRAFFIC_Q_VO, - UNIFI_TRAFFIC_Q_EAPOL, /* Non existent in HIP */ - UNIFI_TRAFFIC_Q_MAX, /* Non existent */ - UNIFI_TRAFFIC_Q_MLME /* Non existent */ -} unifi_TrafficQueue; - -/* - * Structure describing a bulk data slot. - * This structure is shared between the HIP core library and the OS - * layer. See the definition of unifi_net_data_malloc() for more details. - * - * The data_length field is used to indicate empty/occupied state. - * Needs to be defined before #include "unifi_os.h". - */ -typedef struct _bulk_data_desc -{ - const u8 *os_data_ptr; - u32 data_length; - const void *os_net_buf_ptr; - u32 net_buf_length; -} bulk_data_desc_t; - -/* Structure of an entry in the Symbol Look Up Table (SLUT). */ -typedef struct _symbol -{ - u16 id; - u32 obj; -} symbol_t; - -/* - * Header files need to be included from the current directory, - * the SME library, the synergy framework and the OS layer. - * A thin OS layer needs to be implemented in the porting exercise. - * - * Note that unifi_os.h should be included only in unifi.h - */ - -#include "unifi_os.h" - -/* - * Contains the HIP core definitions selected in the porting exercise, such as - * UNIFI_PAD_BULK_DATA_TO_BLOCK_SIZE and UNIFI_PAD_SIGNALS_TO_BLOCK_SIZE. - * Implemented in the OS layer, as part of the porting exersice. - */ -#include "unifi_config.h" - -#include "csr_wifi_hip_signals.h" /* from this dir */ - -/* - * The card structure is an opaque pointer that is used to pass context - * to the upper-edge API functions. - */ -typedef struct card card_t; - - -/* - * This structure describes all of the bulk data that 'might' be - * associated with a signal. - */ -typedef struct _bulk_data_param -{ - bulk_data_desc_t d[UNIFI_MAX_DATA_REFERENCES]; -} bulk_data_param_t; - - -/* - * This structure describes the chip and HIP core lib - * information that exposed to the OS layer. - */ -typedef struct _card_info -{ - u16 chip_id; - u16 chip_version; - u32 fw_build; - u16 fw_hip_version; - u32 sdio_block_size; -} card_info_t; - - -/* - * Mini-coredump definitions - */ -/* Definition of XAP memory ranges used by the mini-coredump system. - * Note that, these values are NOT the same as UNIFI_REGISTERS, etc - * in unifihw.h which don't allow selection of register areas for each XAP. - */ -typedef enum unifi_coredump_space -{ - UNIFI_COREDUMP_MAC_REG, - UNIFI_COREDUMP_PHY_REG, - UNIFI_COREDUMP_SH_DMEM, - UNIFI_COREDUMP_MAC_DMEM, - UNIFI_COREDUMP_PHY_DMEM, - UNIFI_COREDUMP_TRIGGER_MAGIC = 0xFEED -} unifi_coredump_space_t; - -/* Structure used to request a register value from a mini-coredump buffer */ -typedef struct unifi_coredump_req -{ - /* From user */ - s32 index; /* 0=newest, -1=oldest */ - unifi_coredump_space_t space; /* memory space */ - u32 offset; /* register offset in space */ - /* From driver */ - u32 drv_build; /* Driver build id */ - u32 chip_ver; /* Chip version */ - u32 fw_ver; /* Firmware version */ - s32 requestor; /* Requestor: 0=auto dump, 1=manual */ - u32 timestamp; /* time of capture by driver */ - u32 serial; /* capture serial number */ - s32 value; /* register value */ -} unifi_coredump_req_t; /* mini-coredumped reg value request */ - - -/** - * @defgroup upperedge Upper edge API - * - * The following functions are implemented in the HIP core lib. - */ - -/** - * - * Initialise the HIP core lib. - * Note that the OS layer must initialise the SDIO glue layer and obtain - * an SDIO function context, prior to this call. - * - * @param sdiopriv the SDIO function context. - * - * @param ospriv the OS layer context. - * - * @return \p card_t the HIP core lib API context. - * - * @ingroup upperedge - */ -card_t* unifi_alloc_card(CsrSdioFunction *sdiopriv, void *ospriv); - - -/** - * - * Initialise the UniFi chip. - * - * @param card the HIP core lib API context. - * - * @param led_mask the led mask to apply to UniFi. - * - * @return \b 0 if UniFi is initialized. - * - * @return \b -CSR_EIO if an I/O error occurred while initializing UniFi - * - * @return \b -CSR_ENODEV if the card is no longer present. - * - * @ingroup upperedge - */ -CsrResult unifi_init_card(card_t *card, s32 led_mask); - -/** - * - * De-Initialise the HIP core lib. - * - * @param card the HIP core lib API context. - * - * @ingroup upperedge - */ -void unifi_free_card(card_t *card); - -/** - * - * Cancel all the signals pending in the HIP core lib. - * Normally used during a system suspend when the power is retained on UniFi. - * - * @param card the HIP core lib API context. - * - * @ingroup upperedge - */ -void unifi_cancel_pending_signals(card_t *card); - -/** - * - * Send a signal to UniFi. - * Normally it is called from unifi_sys_hip_req() and the OS layer - * Tx data plane. - * - * Note that the bulkdata buffers ownership is passed to the HIP core lib. - * These buffers must be allocated using unifi_net_data_malloc(). - * - * @param card the HIP core lib API context. - * - * @param sigptr pointer to the signal. - * - * @param siglen size of the signal. - * - * @param bulkdata pointer to the bulk data associated with the signal. - * - * @return \b 0 signal is sent. - * - * @return \b -CSR_EIO if an error occurred while sending the signal - * - * @return \b -CSR_ENODEV if the card is no longer present. - * - * @ingroup upperedge - */ -CsrResult unifi_send_signal(card_t *card, const u8 *sigptr, - u32 siglen, - const bulk_data_param_t *bulkdata); - -/** - * - * Check if the HIP core lib has resources to send a signal. - * Normally there no need to use this function. - * - * @param card the HIP core lib API context. - * - * @param sigptr pointer to the signal. - * - * @return \b 0 if there are resources for the signal. - * - * @return \b -CSR_ENOSPC if there are not enough resources - * - * @ingroup upperedge - */ -CsrResult unifi_send_resources_available(card_t *card, const u8 *sigptr); - -/** - * - * Read the UniFi chip and the HIP core lib information. - * - * @param card the HIP core lib API context. - * - * @param card_info pointer to save the information. - * - * @ingroup upperedge - */ -void unifi_card_info(card_t *card, card_info_t *card_info); - -/** - * - * Print the UniFi I/O and Interrupt status. - * Normally it is used for debug purposes only. - * - * @param card the HIP core lib API context. - - * @param status buffer for the chip status - * - * @return \b 0 if the check was performed. - * - * @return \b -CSR_EIO if an error occurred while checking the status. - * - * @return \b -CSR_ENODEV if the card is no longer present. - * - * @ingroup upperedge - */ -CsrResult unifi_check_io_status(card_t *card, s32 *status); - - -/** - * - * Run the HIP core lib Botton-Half. - * Whenever the HIP core lib want this function to be called - * by the OS layer, it calls unifi_run_bh(). - * - * @param card the HIP core lib API context. - * - * @param remaining pointer to return the time (in msecs) that this function - * should be re-scheduled. A return value of 0 means that no re-scheduling - * is required. If unifi_bh() is called before the timeout expires, - * the caller must pass in the remaining time. - * - * @return \b 0 if no error occurred. - * - * @return \b -CSR_ENODEV if the card is no longer present. - * - * @return \b -CSR_E* if an error occurred while running the bottom half. - * - * @ingroup upperedge - */ -CsrResult unifi_bh(card_t *card, u32 *remaining); - - -/** - * UniFi Low Power Mode (Deep Sleep Signaling) - * - * unifi_low_power_mode defines the UniFi Deep Sleep Signaling status. - * Use with unifi_configure_low_power_mode() to enable/disable - * the Deep Sleep Signaling. - */ -enum unifi_low_power_mode -{ - UNIFI_LOW_POWER_DISABLED, - UNIFI_LOW_POWER_ENABLED -}; - -/** - * Periodic Wake Host Mode - * - * unifi_periodic_wake_mode defines the Periodic Wake Host Mode. - * It can only be set to UNIFI_PERIODIC_WAKE_HOST_ENABLED if - * low_power_mode == UNIFI_LOW_POWER_ENABLED. - */ -enum unifi_periodic_wake_mode -{ - UNIFI_PERIODIC_WAKE_HOST_DISABLED, - UNIFI_PERIODIC_WAKE_HOST_ENABLED -}; - -/** - * - * Run the HIP core lib Botton-Half. - * Whenever the HIP core lib want this function to be called - * by the OS layer, it calls unifi_run_bh(). - * - * Typically, the SME is responsible for configuring these parameters, - * so unifi_sys_configure_power_mode_req() is usually implemented - * as a direct call to unifi_configure_low_power_mode(). - * - * Note: When polling mode is used instead of interrupts, - * low_power_mode must never be set to UNIFI_LOW_POWER_ENABLED. - * - * @param card the HIP core lib API context. - * - * @param low_power_mode the Low Power Mode. - * - * @param periodic_wake_mode the Periodic Wake Mode. - * - * @return \b 0 if no error occurred. - * - * @return \b -CSR_E* if the request failed. - * - * @ingroup upperedge - */ -CsrResult unifi_configure_low_power_mode(card_t *card, - enum unifi_low_power_mode low_power_mode, - enum unifi_periodic_wake_mode periodic_wake_mode); - -/** - * - * Forces the UniFi chip to enter a Deep Sleep state. - * This is normally called by the OS layer when the platform suspends. - * - * Note that if the UniFi Low Power Mode is disabled this call fails. - * - * @param card the HIP core lib API context. - * - * @return \b 0 if no error occurred. - * - * @return \b -CSR_ENODEV if the card is no longer present. - * - * @return \b -CSR_E* if the request failed. - * - * @ingroup upperedge - */ -CsrResult unifi_force_low_power_mode(card_t *card); - -#ifndef CSR_WIFI_HIP_TA_DISABLE -/** - * Configure the Traffic Analysis sampling - * - * Enable or disable statistics gathering. - * Enable or disable particular packet detection. - * - * @param card the HIP core context - * @param config_type the item to configure - * @param config pointer to struct containing config info - * - * @return \b 0 if configuration was successful - * - * @return \b -CSR_EINVAL if a parameter had an invalid value - * - * @ingroup upperedge - */ -CsrResult unifi_ta_configure(card_t *card, - CsrWifiRouterCtrlTrafficConfigType config_type, - const CsrWifiRouterCtrlTrafficConfig *config); - -/** - * Pass a packet for Traffic Analysis sampling - * - * @param card the HIP core context - * @param direction the direction (Rx or Tx) of the frame. - * @param data pointer to bulkdata struct containing the packet - * @param saddr the source address of the packet - * @param sta_macaddr the MAC address of the UniFi chip - * @param timestamp the current time in msecs - * - * @ingroup upperedge - */ -void unifi_ta_sample(card_t *card, - CsrWifiRouterCtrlProtocolDirection direction, - const bulk_data_desc_t *data, - const u8 *saddr, - const u8 *sta_macaddr, - u32 timestamp, - u16 rate); - -/** - * Notify the HIP core lib for a detected Traffic Classification. - * Typically, the SME is responsible for configuring these parameters, - * so unifi_sys_traffic_classification_req() is usually implemented - * as a direct call to unifi_ta_classification(). - * - * @param card the HIP core context. - * @param traffic_type the detected traffic type. - * @param period The detected period of the traffic. - * - * @ingroup upperedge - */ -void unifi_ta_classification(card_t *card, - CsrWifiRouterCtrlTrafficType traffic_type, - u16 period); - -#endif -/** - * Use software to hard reset the chip. - * This is a subset of the unifi_init_card() functionality and should - * only be used only to reset a paniced chip before a coredump is taken. - * - * @param card the HIP core context. - * - * @ingroup upperedge - */ -CsrResult unifi_card_hard_reset(card_t *card); - - -CsrResult unifi_card_readn(card_t *card, u32 unifi_addr, void *pdata, u16 len); -CsrResult unifi_card_read16(card_t *card, u32 unifi_addr, u16 *pdata); -CsrResult unifi_card_write16(card_t *card, u32 unifi_addr, u16 data); - - -enum unifi_dbg_processors_select -{ - UNIFI_PROC_MAC, - UNIFI_PROC_PHY, - UNIFI_PROC_BT, - UNIFI_PROC_BOTH, - UNIFI_PROC_INVALID -}; - -CsrResult unifi_card_stop_processor(card_t *card, enum unifi_dbg_processors_select which); - -/** - * Call-outs from the HIP core lib to the OS layer. - * The following functions need to be implemented during the porting exercise. - */ - -/** - * Selects appropriate queue according to priority - * Helps maintain uniformity in queue selection between the HIP - * and the OS layers. - * - * @param priority priority of the packet - * - * @return \b Traffic queue to which a packet of this priority belongs - * - * @ingroup upperedge - */ -unifi_TrafficQueue -unifi_frame_priority_to_queue(CSR_PRIORITY priority); - -/** - * Returns the priority corresponding to a particular Queue when that is used - * when downgrading a packet to a lower AC. - * Helps maintain uniformity in queue - priority mapping between the HIP - * and the OS layers. - * - * @param queue - * - * @return \b Highest priority corresponding to this queue - * - * @ingroup upperedge - */ -CSR_PRIORITY unifi_get_default_downgrade_priority(unifi_TrafficQueue queue); - -/** - * - * Flow control callbacks. - * unifi_pause_xmit() is called when the HIP core lib does not have any - * resources to store data packets. The OS layer needs to pause - * the Tx data plane until unifi_restart_xmit() is called. - * - * @param ospriv the OS layer context. - * - * @ingroup upperedge - */ -void unifi_pause_xmit(void *ospriv, unifi_TrafficQueue queue); -void unifi_restart_xmit(void *ospriv, unifi_TrafficQueue queue); - -/** - * - * Request to run the Bottom-Half. - * The HIP core lib calls this function to request that unifi_bh() - * needs to be run by the OS layer. It can be called anytime, i.e. - * when the unifi_bh() is running. - * Since unifi_bh() is not re-entrant, usually unifi_run_bh() sets - * an event to a thread that schedules a call to unifi_bh(). - * - * @param ospriv the OS layer context. - * - * @ingroup upperedge - */ -CsrResult unifi_run_bh(void *ospriv); - -/** - * - * Delivers a signal received from UniFi to the OS layer. - * Normally, the data signals should be delivered to the data plane - * and all the rest to the SME (unifi_sys_hip_ind()). - * - * Note that the OS layer is responsible for freeing the bulkdata - * buffers, using unifi_net_data_free(). - * - * @param ospriv the OS layer context. - * - * @param sigptr pointer to the signal. - * - * @param siglen size of the signal. - * - * @param bulkdata pointer to the bulk data associated with the signal. - * - * @ingroup upperedge - */ -void unifi_receive_event(void *ospriv, - u8 *sigdata, u32 siglen, - const bulk_data_param_t *bulkdata); - -#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL -/** - * - * Used to reque the failed ma packet request back to hal queues - * - * @param ospriv the OS layer context. - * - * @param host_tag host tag for the packet to requeue. - * - * @param bulkDataDesc pointer to the bulk data. - * - * @ingroup upperedge - */ -CsrResult unifi_reque_ma_packet_request(void *ospriv, u32 host_tag, - u16 status, - bulk_data_desc_t *bulkDataDesc); - -#endif -typedef struct -{ - u16 free_fh_sig_queue_slots[UNIFI_NO_OF_TX_QS]; - u16 free_fh_bulkdata_slots; - u16 free_fh_fw_slots; -} unifi_HipQosInfo; - -void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo); - - -/** - * Functions that read a portion of a firmware file. - * - * Note: If the UniFi chip runs the f/w from ROM, the HIP core may never - * call these functions. Also, the HIP core may call these functions even if - * a f/w file is not available. In this case, it is safe to fail the request. - */ -#define UNIFI_FW_STA 1 /* Identify STA firmware file */ - -/** - * - * Ask the OS layer to initialise a read from a f/w file. - * - * @param ospriv the OS layer context. - * - * @param is_fw if 0 the request if for the loader file, if 1 the request - * is for a f/w file. - * - * @param info a card_info_t structure containing versions information. - * Note that some members of the structure may not be initialised. - * - * @return \p NULL if the file is not available, or a pointer which contains - * OS specific information for the file (typically the contents of the file) - * that the HIP core uses when calling unifi_fw_read() and unifi_fw_read_stop() - * - * @ingroup upperedge - */ -void* unifi_fw_read_start(void *ospriv, s8 is_fw, const card_info_t *info); - -/** - * - * Ask the OS layer to return a portion from a f/w file. - * - * @param ospriv the OS layer context. - * - * @param arg the OS pointer returned by unifi_fw_read_start(). - * - * @param offset the offset in the f/w file to read the read from. - * - * @param buf the buffer to store the returned data. - * - * @param len the size in bytes of the requested read. - * - * @ingroup upperedge - */ -s32 unifi_fw_read(void *ospriv, void *arg, u32 offset, void *buf, u32 len); - -/** - * - * Ask the OS layer to finish reading from a f/w file. - * - * @param ospriv the OS layer context. - * - * @param dlpriv the OS pointer returned by unifi_fw_read_start(). - * - * @ingroup upperedge - */ -void unifi_fw_read_stop(void *ospriv, void *dlpriv); - -/** - * - * Ask OS layer for a handle to a dynamically allocated firmware buffer - * (primarily intended for production test images which may need conversion) - * - * @param ospriv the OS layer context. - * - * @param fwbuf pointer to dynamically allocated buffer - * - * @param len length of provided buffer in bytes - * - * @ingroup upperedge - */ -void* unifi_fw_open_buffer(void *ospriv, void *fwbuf, u32 len); - -/** - * - * Release a handle to a dynamically allocated firmware buffer - * (primarily intended for production test images which may need conversion) - * - * @param ospriv the OS layer context. - * - * @param fwbuf pointer to dynamically allocated buffer - * - * @ingroup upperedge - */ -void unifi_fw_close_buffer(void *ospriv, void *fwbuf); - -#ifndef CSR_WIFI_HIP_TA_DISABLE -/* - * Driver must provide these. - * - * A simple implementation will just call - * unifi_sys_traffic_protocol_ind() or unifi_sys_traffic_classification_ind() - * respectively. See sme_csr_userspace/sme_userspace.c. - */ -/** - * - * Indicates a detected packet of type packet_type. - * Typically, this information is processed by the SME so - * unifi_ta_indicate_protocol() needs to schedule a call to - * unifi_sys_traffic_protocol_ind(). - * - * @param ospriv the OS layer context. - * - * @param packet_type the detected packet type. - * - * @param direction the direction of the packet (Rx, Tx). - * - * @param src_addr the source address of the packet. - * - * @ingroup upperedge - */ -void unifi_ta_indicate_protocol(void *ospriv, - CsrWifiRouterCtrlTrafficPacketType packet_type, - CsrWifiRouterCtrlProtocolDirection direction, - const CsrWifiMacAddress *src_addr); - -/** - * - * Indicates statistics for the sample data over a period. - * Typically, this information is processed by the SME so - * unifi_ta_indicate_sampling() needs to schedule a call to - * unifi_sys_traffic_sample_ind(). - * - * @param ospriv the OS layer context. - * - * @param stats the pointer to the structure that contains the statistics. - * - * @ingroup upperedge - */ -void unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats); -void unifi_ta_indicate_l4stats(void *ospriv, - u32 rxTcpThroughput, - u32 txTcpThroughput, - u32 rxUdpThroughput, - u32 txUdpThroughput); -#endif - -void unifi_rx_queue_flush(void *ospriv); - -/** - * Call-out from the SDIO glue layer. - * - * The glue layer needs to call unifi_sdio_interrupt_handler() every time - * an interrupts occurs. - * - * @param card the HIP core context. - * - * @ingroup bottomedge - */ -void unifi_sdio_interrupt_handler(card_t *card); - - -/* HELPER FUNCTIONS */ - -/* - * unifi_init() and unifi_download() implement a subset of unifi_init_card functionality - * that excludes HIP initialization. - */ -CsrResult unifi_init(card_t *card); -CsrResult unifi_download(card_t *card, s32 led_mask); - -/* - * unifi_start_processors() ensures both on-chip processors are running - */ -CsrResult unifi_start_processors(card_t *card); - -CsrResult unifi_capture_panic(card_t *card); - -/* - * Configure HIP interrupt processing mode - */ -#define CSR_WIFI_INTMODE_DEFAULT 0 -#define CSR_WIFI_INTMODE_RUN_BH_ONCE 1 /* Run BH once per interrupt */ - -void unifi_set_interrupt_mode(card_t *card, u32 mode); - -/* - * unifi_request_max_clock() requests that max SDIO clock speed is set at the - * next suitable opportunity. - */ -void unifi_request_max_sdio_clock(card_t *card); - - -/* Functions to lookup bulk data command names. */ -const char* lookup_bulkcmd_name(u16 id); - -/* Function to log HIP's global debug buffer */ -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -void unifi_debug_buf_dump(void); -void unifi_debug_log_to_buf(const char *fmt, ...); -void unifi_debug_hex_to_buf(const char *buff, u16 length); -#endif - -/* Mini-coredump utility functions */ -CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req); -CsrResult unifi_coredump_capture(card_t *card, struct unifi_coredump_req *req); -CsrResult unifi_coredump_request_at_next_reset(card_t *card, s8 enable); -CsrResult unifi_coredump_init(card_t *card, u16 num_dump_buffers); -void unifi_coredump_free(card_t *card); - -#endif /* __CSR_WIFI_HIP_UNIFI_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c b/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c deleted file mode 100644 index 9a3528599f3c..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c +++ /dev/null @@ -1,41 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include "csr_wifi_hip_unifi.h" - -struct sig_name { - s16 id; - const char *name; -}; - -static const struct sig_name Unifi_bulkcmd_names[] = { - { 0, "SignalCmd" }, - { 1, "CopyToHost" }, - { 2, "CopyToHostAck" }, - { 3, "CopyFromHost" }, - { 4, "CopyFromHostAck" }, - { 5, "ClearSlot" }, - { 6, "CopyOverlay" }, - { 7, "CopyOverlayAck" }, - { 8, "CopyFromHostAndClearSlot" }, - { 15, "Padding" } -}; - -const char *lookup_bulkcmd_name(u16 id) -{ - if (id < 9) - return Unifi_bulkcmd_names[id].name; - if (id == 15) - return "Padding"; - - return "UNKNOWN"; -} - - diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h deleted file mode 100644 index 4126e85bfe9b..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h +++ /dev/null @@ -1,52 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * FILE: csr_wifi_hip_unifi_udi.h - * - * PURPOSE: - * Declarations and definitions for the UniFi Debug Interface. - * - * --------------------------------------------------------------------------- - */ -#ifndef __CSR_WIFI_HIP_UNIFI_UDI_H__ -#define __CSR_WIFI_HIP_UNIFI_UDI_H__ - -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_signals.h" - - -/* - * Support for tracing the wire protocol. - */ -enum udi_log_direction -{ - UDI_LOG_FROM_HOST = 0x0000, - UDI_LOG_TO_HOST = 0x0001 -}; - -typedef void (*udi_func_t)(void *ospriv, u8 *sigdata, - u32 signal_len, - const bulk_data_param_t *bulkdata, - enum udi_log_direction dir); - -CsrResult unifi_set_udi_hook(card_t *card, udi_func_t udi_fn); -CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn); - - -/* - * Function to print current status info to a string. - * This is used in the linux /proc interface and might be useful - * in other systems. - */ -s32 unifi_print_status(card_t *card, struct seq_file *m); - -#endif /* __CSR_WIFI_HIP_UNIFI_UDI_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_unifihw.h b/drivers/staging/csr/csr_wifi_hip_unifihw.h deleted file mode 100644 index 3f9fcbd55b55..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_unifihw.h +++ /dev/null @@ -1,59 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * - * File: csr_wifi_hip_unifihw.h - * - * Definitions of various chip registers, addresses, values etc. - * - * --------------------------------------------------------------------------- - */ -#ifndef __UNIFIHW_H__ -#define __UNIFIHW_H__ 1 - -/* Symbol Look Up Table fingerprint. IDs are in sigs.h */ -#define SLUT_FINGERPRINT 0xD397 - - -/* Values of LoaderOperation */ -#define UNIFI_LOADER_IDLE 0x00 -#define UNIFI_LOADER_COPY 0x01 -#define UNIFI_LOADER_ERROR_MASK 0xF0 - -/* Values of BootLoaderOperation */ -#define UNIFI_BOOT_LOADER_IDLE 0x00 -#define UNIFI_BOOT_LOADER_RESTART 0x01 -#define UNIFI_BOOT_LOADER_PATCH 0x02 -#define UNIFI_BOOT_LOADER_LOAD_STA 0x10 -#define UNIFI_BOOT_LOADER_LOAD_PTEST 0x11 - - -/* Memory spaces encoded in top byte of Generic Pointer type */ -#define UNIFI_SH_DMEM 0x01 /* Shared Data Memory */ -#define UNIFI_EXT_FLASH 0x02 /* External FLASH */ -#define UNIFI_EXT_SRAM 0x03 /* External SRAM */ -#define UNIFI_REGISTERS 0x04 /* Registers */ -#define UNIFI_PHY_DMEM 0x10 /* PHY Data Memory */ -#define UNIFI_PHY_PMEM 0x11 /* PHY Program Memory */ -#define UNIFI_PHY_ROM 0x12 /* PHY ROM */ -#define UNIFI_MAC_DMEM 0x20 /* MAC Data Memory */ -#define UNIFI_MAC_PMEM 0x21 /* MAC Program Memory */ -#define UNIFI_MAC_ROM 0x22 /* MAC ROM */ -#define UNIFI_BT_DMEM 0x30 /* BT Data Memory */ -#define UNIFI_BT_PMEM 0x31 /* BT Program Memory */ -#define UNIFI_BT_ROM 0x32 /* BT ROM */ - -#define UNIFI_MAKE_GP(R, O) (((UNIFI_ ## R) << 24) | (O)) -#define UNIFI_GP_OFFSET(GP) ((GP) & 0xFFFFFF) -#define UNIFI_GP_SPACE(GP) (((GP) >> 24) & 0xFF) - -#endif /* __UNIFIHW_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_unifiversion.h b/drivers/staging/csr/csr_wifi_hip_unifiversion.h deleted file mode 100644 index d1c66783f32c..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_unifiversion.h +++ /dev/null @@ -1,30 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * FILE: unifiversion.h - * - * PURPOSE: - * Version information for the portable UniFi driver. - * - * --------------------------------------------------------------------------- - */ - -#ifndef __UNIFIVERSION_H__ -#define __UNIFIVERSION_H__ - -/* - * The minimum version of Host Interface Protocol required by the driver. - */ -#define UNIFI_HIP_MAJOR_VERSION 9 -#define UNIFI_HIP_MINOR_VERSION 1 - -#endif /* __UNIFIVERSION_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c deleted file mode 100644 index 050a15fbadf9..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ /dev/null @@ -1,1076 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * FILE: csr_wifi_hip_xbv.c - * - * PURPOSE: - * Routines for downloading firmware to UniFi. - * - * UniFi firmware files use a nested TLV (Tag-Length-Value) format. - * - * --------------------------------------------------------------------------- - */ -#include <linux/slab.h> - -#ifdef CSR_WIFI_XBV_TEST -/* Standalone test harness */ -#include "unifi_xbv.h" -#include "csr_wifi_hip_unifihw.h" -#else -/* Normal driver build */ -#include "csr_wifi_hip_unifiversion.h" -#include "csr_wifi_hip_card.h" -#define DBG_TAG(t) -#endif - -#include "csr_wifi_hip_xbv.h" - -#define STREAM_CHECKSUM 0x6d34 /* Sum of uint16s in each patch stream */ - -/* XBV sizes used in patch conversion - */ -#define PTDL_MAX_SIZE 2048 /* Max bytes allowed per PTDL */ -#define PTDL_HDR_SIZE (4 + 2 + 6 + 2) /* sizeof(fw_id, sec_len, patch_cmd, csum) */ - -/* Struct to represent a buffer for reading firmware file */ - -typedef struct -{ - void *dlpriv; - s32 ioffset; - fwreadfn_t iread; -} ct_t; - -/* Struct to represent a TLV field */ -typedef struct -{ - char t_name[4]; - u32 t_len; -} tag_t; - - -#define TAG_EQ(i, v) (((i)[0] == (v)[0]) && \ - ((i)[1] == (v)[1]) && \ - ((i)[2] == (v)[2]) && \ - ((i)[3] == (v)[3])) - -/* We create a small stack on the stack that contains an enum - * indicating the containing list segments, and the offset at which - * those lists end. This enables a lot more error checking. */ -typedef enum -{ - xbv_xbv1, - /*xbv_info,*/ - xbv_fw, - xbv_vers, - xbv_vand, - xbv_ptch, - xbv_other -} xbv_container; - -#define XBV_STACK_SIZE 6 -#define XBV_MAX_OFFS 0x7fffffff - -typedef struct -{ - struct - { - xbv_container container; - s32 ioffset_end; - } s[XBV_STACK_SIZE]; - u32 ptr; -} xbv_stack_t; - -static s32 read_tag(card_t *card, ct_t *ct, tag_t *tag); -static s32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len); -static s32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len); -static s32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack, - xbv_mode new_mode, xbv_container old_cont); -static s32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, - xbv_mode new_mode, xbv_container old_cont, - xbv_container new_cont, u32 ioff); - -static u32 write_uint16(void *buf, const u32 offset, - const u16 val); -static u32 write_uint32(void *buf, const u32 offset, - const u32 val); -static u32 write_bytes(void *buf, const u32 offset, - const u8 *data, const u32 len); -static u32 write_tag(void *buf, const u32 offset, - const char *tag_str); -static u32 write_chunk(void *buf, const u32 offset, - const char *tag_str, - const u32 payload_len); -static u16 calc_checksum(void *buf, const u32 offset, - const u32 bytes_len); -static u32 calc_patch_size(const xbv1_t *fwinfo); - -static u32 write_xbv_header(void *buf, const u32 offset, - const u32 file_payload_length); -static u32 write_ptch_header(void *buf, const u32 offset, - const u32 fw_id); -static u32 write_patchcmd(void *buf, const u32 offset, - const u32 dst_genaddr, const u16 len); -static u32 write_reset_ptdl(void *buf, const u32 offset, - const xbv1_t *fwinfo, u32 fw_id); -static u32 write_fwdl_to_ptdl(void *buf, const u32 offset, - fwreadfn_t readfn, const struct FWDL *fwdl, - const void *fw_buf, const u32 fw_id, - void *rdbuf); - -/* - * --------------------------------------------------------------------------- - * parse_xbv1 - * - * Scan the firmware file to find the TLVs we are interested in. - * Actions performed: - * - check we support the file format version in VERF - * Store these TLVs if we have a firmware image: - * - SLTP Symbol Lookup Table Pointer - * - FWDL firmware download segments - * - FWOL firmware overlay segment - * - VMEQ Register probe tests to verify matching h/w - * Store these TLVs if we have a patch file: - * - FWID the firmware build ID that this file patches - * - PTDL The actual patches - * - * The structure pointed to by fwinfo is cleared and - * 'fwinfo->mode' is set to 'unknown'. The 'fwinfo->mode' - * variable is set to 'firmware' or 'patch' once we know which - * sort of XBV file we have. - * - * Arguments: - * readfn Pointer to function to call to read from the file. - * dlpriv Opaque pointer arg to pass to readfn. - * fwinfo Pointer to fwinfo struct to fill in. - * - * Returns: - * CSR_RESULT_SUCCESS on success, CSR error code on failure - * --------------------------------------------------------------------------- - */ -CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo) -{ - ct_t ct; - tag_t tag; - xbv_stack_t stack; - - ct.dlpriv = dlpriv; - ct.ioffset = 0; - ct.iread = readfn; - - memset(fwinfo, 0, sizeof(xbv1_t)); - fwinfo->mode = xbv_unknown; - - /* File must start with XBV1 triplet */ - if (read_tag(card, &ct, &tag) <= 0) - { - unifi_error(NULL, "File is not UniFi firmware\n"); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - DBG_TAG(tag.t_name); - - if (!TAG_EQ(tag.t_name, "XBV1")) - { - unifi_error(NULL, "File is not UniFi firmware (%s)\n", tag.t_name); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - stack.ptr = 0; - stack.s[stack.ptr].container = xbv_xbv1; - stack.s[stack.ptr].ioffset_end = XBV_MAX_OFFS; - - /* Now scan the file */ - while (1) - { - s32 n; - - n = read_tag(card, &ct, &tag); - if (n < 0) - { - unifi_error(NULL, "No tag\n"); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - if (n == 0) - { - /* End of file */ - break; - } - - DBG_TAG(tag.t_name); - - /* File format version */ - if (TAG_EQ(tag.t_name, "VERF")) - { - u32 version; - - if (xbv_check(fwinfo, &stack, xbv_unknown, xbv_xbv1) || - (tag.t_len != 2) || - read_uint(card, &ct, &version, 2)) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - if (version != 0) - { - unifi_error(NULL, "Unsupported firmware file version: %d.%d\n", - version >> 8, version & 0xFF); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - } - else if (TAG_EQ(tag.t_name, "LIST")) - { - char name[4]; - u32 list_end; - - list_end = ct.ioffset + tag.t_len; - - if (read_bytes(card, &ct, name, 4)) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - DBG_TAG(name); - if (TAG_EQ(name, "FW ")) - { - if (xbv_push(fwinfo, &stack, xbv_firmware, xbv_xbv1, xbv_fw, list_end)) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - } - else if (TAG_EQ(name, "VERS")) - { - if (xbv_push(fwinfo, &stack, xbv_firmware, xbv_fw, xbv_vers, list_end) || - (fwinfo->vers.num_vand != 0)) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - } - else if (TAG_EQ(name, "VAND")) - { - struct VAND *vand; - - if (xbv_push(fwinfo, &stack, xbv_firmware, xbv_vers, xbv_vand, list_end) || - (fwinfo->vers.num_vand >= MAX_VAND)) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - /* Get a new VAND */ - vand = fwinfo->vand + fwinfo->vers.num_vand++; - - /* Fill it in */ - vand->first = fwinfo->num_vmeq; - vand->count = 0; - } - else if (TAG_EQ(name, "PTCH")) - { - if (xbv_push(fwinfo, &stack, xbv_patch, xbv_xbv1, xbv_ptch, list_end)) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - } - else - { - /* Skip over any other lists. We dont bother to push - * the new list type now as we would only pop it at - * the end of the outer loop. */ - ct.ioffset += tag.t_len - 4; - } - } - else if (TAG_EQ(tag.t_name, "SLTP")) - { - u32 addr; - - if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_fw) || - (tag.t_len != 4) || - (fwinfo->slut_addr != 0) || - read_uint(card, &ct, &addr, 4)) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - fwinfo->slut_addr = addr; - } - else if (TAG_EQ(tag.t_name, "FWDL")) - { - u32 addr; - struct FWDL *fwdl; - - if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_fw) || - (fwinfo->num_fwdl >= MAX_FWDL) || - (read_uint(card, &ct, &addr, 4))) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - fwdl = fwinfo->fwdl + fwinfo->num_fwdl++; - - fwdl->dl_size = tag.t_len - 4; - fwdl->dl_addr = addr; - fwdl->dl_offset = ct.ioffset; - - ct.ioffset += tag.t_len - 4; - } - else if (TAG_EQ(tag.t_name, "FWOV")) - { - if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_fw) || - (fwinfo->fwov.dl_size != 0) || - (fwinfo->fwov.dl_offset != 0)) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - fwinfo->fwov.dl_size = tag.t_len; - fwinfo->fwov.dl_offset = ct.ioffset; - - ct.ioffset += tag.t_len; - } - else if (TAG_EQ(tag.t_name, "VMEQ")) - { - u32 temp[3]; - struct VAND *vand; - struct VMEQ *vmeq; - - if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_vand) || - (fwinfo->num_vmeq >= MAX_VMEQ) || - (fwinfo->vers.num_vand == 0) || - (tag.t_len != 8) || - read_uint(card, &ct, &temp[0], 4) || - read_uint(card, &ct, &temp[1], 2) || - read_uint(card, &ct, &temp[2], 2)) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - /* Get the last VAND */ - vand = fwinfo->vand + (fwinfo->vers.num_vand - 1); - - /* Get a new VMEQ */ - vmeq = fwinfo->vmeq + fwinfo->num_vmeq++; - - /* Note that this VAND contains another VMEQ */ - vand->count++; - - /* Fill in the VMEQ */ - vmeq->addr = temp[0]; - vmeq->mask = (u16)temp[1]; - vmeq->value = (u16)temp[2]; - } - else if (TAG_EQ(tag.t_name, "FWID")) - { - u32 build_id; - - if (xbv_check(fwinfo, &stack, xbv_patch, xbv_ptch) || - (tag.t_len != 4) || - (fwinfo->build_id != 0) || - read_uint(card, &ct, &build_id, 4)) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - fwinfo->build_id = build_id; - } - else if (TAG_EQ(tag.t_name, "PTDL")) - { - struct PTDL *ptdl; - - if (xbv_check(fwinfo, &stack, xbv_patch, xbv_ptch) || - (fwinfo->num_ptdl >= MAX_PTDL)) - { - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - /* Allocate a new PTDL */ - ptdl = fwinfo->ptdl + fwinfo->num_ptdl++; - - ptdl->dl_size = tag.t_len; - ptdl->dl_offset = ct.ioffset; - - ct.ioffset += tag.t_len; - } - else - { - /* - * If we get here it is a tag we are not interested in, - * just skip over it. - */ - ct.ioffset += tag.t_len; - } - - /* Check to see if we are at the end of the currently stacked - * segment. We could finish more than one list at a time. */ - while (ct.ioffset >= stack.s[stack.ptr].ioffset_end) - { - if (ct.ioffset > stack.s[stack.ptr].ioffset_end) - { - unifi_error(NULL, - "XBV file has overrun stack'd segment %d (%d > %d)\n", - stack.ptr, ct.ioffset, stack.s[stack.ptr].ioffset_end); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - if (stack.ptr <= 0) - { - unifi_error(NULL, "XBV file has underrun stack pointer\n"); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - stack.ptr--; - } - } - - if (stack.ptr != 0) - { - unifi_error(NULL, "Last list of XBV is not complete.\n"); - return CSR_WIFI_HIP_RESULT_INVALID_VALUE; - } - - return CSR_RESULT_SUCCESS; -} /* xbv1_parse() */ - - -/* Check the the XBV file is of a consistant sort (either firmware or - * patch) and that we are in the correct containing list type. */ -static s32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack, - xbv_mode new_mode, xbv_container old_cont) -{ - /* If the new file mode is unknown the current packet could be in - * either (any) type of XBV file, and we cant make a decission at - * this time. */ - if (new_mode != xbv_unknown) - { - if (fwinfo->mode == xbv_unknown) - { - fwinfo->mode = new_mode; - } - else if (fwinfo->mode != new_mode) - { - return -1; - } - } - /* If the current stack top doesn't match what we expect then the - * file is corrupt. */ - if (stack->s[stack->ptr].container != old_cont) - { - return -1; - } - return 0; -} - - -/* Make checks as above and then enter a new list */ -static s32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack, - xbv_mode new_mode, xbv_container old_cont, - xbv_container new_cont, u32 new_ioff) -{ - if (xbv_check(fwinfo, stack, new_mode, old_cont)) - { - return -1; - } - - /* Check that our stack won't overflow. */ - if (stack->ptr >= (XBV_STACK_SIZE - 1)) - { - return -1; - } - - /* Add the new list element to the top of the stack. */ - stack->ptr++; - stack->s[stack->ptr].container = new_cont; - stack->s[stack->ptr].ioffset_end = new_ioff; - - return 0; -} - - -static u32 xbv2uint(u8 *ptr, s32 len) -{ - u32 u = 0; - s16 i; - - for (i = 0; i < len; i++) - { - u32 b; - b = ptr[i]; - u += b << (i * 8); - } - return u; -} - - -static s32 read_tag(card_t *card, ct_t *ct, tag_t *tag) -{ - u8 buf[8]; - s32 n; - - n = (*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, 8); - if (n <= 0) - { - return n; - } - - /* read the tag and length */ - if (n != 8) - { - return -1; - } - - /* get section tag */ - memcpy(tag->t_name, buf, 4); - - /* get section length */ - tag->t_len = xbv2uint(buf + 4, 4); - - ct->ioffset += 8; - - return 8; -} /* read_tag() */ - - -static s32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len) -{ - /* read the tag value */ - if ((*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, len) != (s32)len) - { - return -1; - } - - ct->ioffset += len; - - return 0; -} /* read_bytes() */ - - -static s32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len) -{ - u8 buf[4]; - - /* Integer cannot be more than 4 bytes */ - if (len > 4) - { - return -1; - } - - if (read_bytes(card, ct, buf, len)) - { - return -1; - } - - *u = xbv2uint(buf, len); - - return 0; -} /* read_uint() */ - - -static u32 write_uint16(void *buf, const u32 offset, const u16 val) -{ - u8 *dst = (u8 *)buf + offset; - *dst++ = (u8)(val & 0xff); /* LSB first */ - *dst = (u8)(val >> 8); - return sizeof(u16); -} - - -static u32 write_uint32(void *buf, const u32 offset, const u32 val) -{ - (void)write_uint16(buf, offset + 0, (u16)(val & 0xffff)); - (void)write_uint16(buf, offset + 2, (u16)(val >> 16)); - return sizeof(u32); -} - - -static u32 write_bytes(void *buf, const u32 offset, const u8 *data, const u32 len) -{ - u32 i; - u8 *dst = (u8 *)buf + offset; - - for (i = 0; i < len; i++) - { - *dst++ = *((u8 *)data + i); - } - return len; -} - - -static u32 write_tag(void *buf, const u32 offset, const char *tag_str) -{ - u8 *dst = (u8 *)buf + offset; - memcpy(dst, tag_str, 4); - return 4; -} - - -static u32 write_chunk(void *buf, const u32 offset, const char *tag_str, const u32 payload_len) -{ - u32 written = 0; - written += write_tag(buf, offset, tag_str); - written += write_uint32(buf, written + offset, (u32)payload_len); - - return written; -} - - -static u16 calc_checksum(void *buf, const u32 offset, const u32 bytes_len) -{ - u32 i; - u8 *src = (u8 *)buf + offset; - u16 sum = 0; - u16 val; - - for (i = 0; i < bytes_len / 2; i++) - { - /* Contents copied to file is LE, host might not be */ - val = (u16) * src++; /* LSB */ - val += (u16)(*src++) << 8; /* MSB */ - sum += val; - } - - /* Total of uint16s in the stream plus the stored check value - * should equal STREAM_CHECKSUM when decoded. - */ - return (STREAM_CHECKSUM - sum); -} - - -#define PTDL_RESET_DATA_SIZE 20 /* Size of reset vectors PTDL */ - -static u32 calc_patch_size(const xbv1_t *fwinfo) -{ - s16 i; - u32 size = 0; - - /* - * Work out how big an equivalent patch format file must be for this image. - * This only needs to be approximate, so long as it's large enough. - */ - if (fwinfo->mode != xbv_firmware) - { - return 0; - } - - /* Payload (which will get put into a series of PTDLs) */ - for (i = 0; i < fwinfo->num_fwdl; i++) - { - size += fwinfo->fwdl[i].dl_size; - } - - /* Another PTDL at the end containing reset vectors */ - size += PTDL_RESET_DATA_SIZE; - - /* PTDL headers. Add one for remainder, one for reset vectors */ - size += ((fwinfo->num_fwdl / PTDL_MAX_SIZE) + 2) * PTDL_HDR_SIZE; - - /* Another 1K sufficient to cover miscellaneous headers */ - size += 1024; - - return size; -} - - -static u32 write_xbv_header(void *buf, const u32 offset, const u32 file_payload_length) -{ - u32 written = 0; - - /* The length value given to the XBV chunk is the length of all subsequent - * contents of the file, excluding the 8 byte size of the XBV1 header itself - * (The added 6 bytes thus accounts for the size of the VERF) - */ - written += write_chunk(buf, offset + written, (char *)"XBV1", file_payload_length + 6); - - written += write_chunk(buf, offset + written, (char *)"VERF", 2); - written += write_uint16(buf, offset + written, 0); /* File version */ - - return written; -} - - -static u32 write_ptch_header(void *buf, const u32 offset, const u32 fw_id) -{ - u32 written = 0; - - /* LIST is written with a zero length, to be updated later */ - written += write_chunk(buf, offset + written, (char *)"LIST", 0); - written += write_tag(buf, offset + written, (char *)"PTCH"); /* List type */ - - written += write_chunk(buf, offset + written, (char *)"FWID", 4); - written += write_uint32(buf, offset + written, fw_id); - - - return written; -} - - -#define UF_REGION_PHY 1 -#define UF_REGION_MAC 2 -#define UF_MEMPUT_MAC 0x0000 -#define UF_MEMPUT_PHY 0x1000 - -static u32 write_patchcmd(void *buf, const u32 offset, const u32 dst_genaddr, const u16 len) -{ - u32 written = 0; - u32 region = (dst_genaddr >> 28); - u16 cmd_and_len = UF_MEMPUT_MAC; - - if (region == UF_REGION_PHY) - { - cmd_and_len = UF_MEMPUT_PHY; - } - else if (region != UF_REGION_MAC) - { - return 0; /* invalid */ - } - - /* Write the command and data length */ - cmd_and_len |= len; - written += write_uint16(buf, offset + written, cmd_and_len); - - /* Write the destination generic address */ - written += write_uint16(buf, offset + written, (u16)(dst_genaddr >> 16)); - written += write_uint16(buf, offset + written, (u16)(dst_genaddr & 0xffff)); - - /* The data payload should be appended to the command */ - return written; -} - - -static u32 write_fwdl_to_ptdl(void *buf, const u32 offset, fwreadfn_t readfn, - const struct FWDL *fwdl, const void *dlpriv, - const u32 fw_id, void *fw_buf) -{ - u32 written = 0; - s16 chunks = 0; - u32 left = fwdl->dl_size; /* Bytes left in this fwdl */ - u32 dl_addr = fwdl->dl_addr; /* Target address of fwdl image on XAP */ - u32 dl_offs = fwdl->dl_offset; /* Offset of fwdl image data in source */ - u16 csum; - u32 csum_start_offs; /* first offset to include in checksum */ - u32 sec_data_len; /* section data byte count */ - u32 sec_len; /* section data + header byte count */ - - /* FWDL maps to one or more PTDLs, as max size for a PTDL is 1K words */ - while (left) - { - /* Calculate amount to be transferred */ - sec_data_len = min_t(u32, left, PTDL_MAX_SIZE - PTDL_HDR_SIZE); - sec_len = sec_data_len + PTDL_HDR_SIZE; - - /* Write PTDL header + entire PTDL size */ - written += write_chunk(buf, offset + written, (char *)"PTDL", sec_len); - /* bug digest implies 4 bytes of padding here, but that seems wrong */ - - /* Checksum starts here */ - csum_start_offs = offset + written; - - /* Patch-chunk header: fw_id. Note that this is in XAP word order */ - written += write_uint16(buf, offset + written, (u16)(fw_id >> 16)); - written += write_uint16(buf, offset + written, (u16)(fw_id & 0xffff)); - - /* Patch-chunk header: section length in uint16s */ - written += write_uint16(buf, offset + written, (u16)(sec_len / 2)); - - - /* Write the appropriate patch command for the data's destination ptr */ - written += write_patchcmd(buf, offset + written, dl_addr, (u16)(sec_data_len / 2)); - - /* Write the data itself (limited to the max chunk length) */ - if (readfn(NULL, (void *)dlpriv, dl_offs, fw_buf, sec_data_len) < 0) - { - return 0; - } - - written += write_bytes(buf, - offset + written, - fw_buf, - sec_data_len); - - /* u16 checksum calculated over data written */ - csum = calc_checksum(buf, csum_start_offs, written - (csum_start_offs - offset)); - written += write_uint16(buf, offset + written, csum); - - left -= sec_data_len; - dl_addr += sec_data_len; - dl_offs += sec_data_len; - chunks++; - } - - return written; -} - - -#define SEC_CMD_LEN ((4 + 2) * 2) /* sizeof(cmd, vector) per XAP */ -#define PTDL_VEC_HDR_SIZE (4 + 2 + 2) /* sizeof(fw_id, sec_len, csum) */ -#define UF_MAC_START_VEC 0x00c00000 /* Start address of image on MAC */ -#define UF_PHY_START_VEC 0x00c00000 /* Start address of image on PHY */ -#define UF_MAC_START_CMD 0x6000 /* MAC "Set start address" command */ -#define UF_PHY_START_CMD 0x7000 /* PHY "Set start address" command */ - -static u32 write_reset_ptdl(void *buf, const u32 offset, const xbv1_t *fwinfo, u32 fw_id) -{ - u32 written = 0; - u16 csum; - u32 csum_start_offs; /* first offset to include in checksum */ - u32 sec_len; /* section data + header byte count */ - - sec_len = SEC_CMD_LEN + PTDL_VEC_HDR_SIZE; /* Total section byte length */ - - /* Write PTDL header + entire PTDL size */ - written += write_chunk(buf, offset + written, (char *)"PTDL", sec_len); - - /* Checksum starts here */ - csum_start_offs = offset + written; - - /* Patch-chunk header: fw_id. Note that this is in XAP word order */ - written += write_uint16(buf, offset + written, (u16)(fw_id >> 16)); - written += write_uint16(buf, offset + written, (u16)(fw_id & 0xffff)); - - /* Patch-chunk header: section length in uint16s */ - written += write_uint16(buf, offset + written, (u16)(sec_len / 2)); - - /* - * Restart addresses to be executed on subsequent loader restart command. - */ - - /* Setup the MAC start address, note word ordering */ - written += write_uint16(buf, offset + written, UF_MAC_START_CMD); - written += write_uint16(buf, offset + written, (UF_MAC_START_VEC >> 16)); - written += write_uint16(buf, offset + written, (UF_MAC_START_VEC & 0xffff)); - - /* Setup the PHY start address, note word ordering */ - written += write_uint16(buf, offset + written, UF_PHY_START_CMD); - written += write_uint16(buf, offset + written, (UF_PHY_START_VEC >> 16)); - written += write_uint16(buf, offset + written, (UF_PHY_START_VEC & 0xffff)); - - /* u16 checksum calculated over data written */ - csum = calc_checksum(buf, csum_start_offs, written - (csum_start_offs - offset)); - written += write_uint16(buf, offset + written, csum); - - return written; -} - - -/* - * --------------------------------------------------------------------------- - * read_slut - * - * desc - * - * Arguments: - * readfn Pointer to function to call to read from the file. - * dlpriv Opaque pointer arg to pass to readfn. - * addr Offset into firmware image of SLUT. - * fwinfo Pointer to fwinfo struct to fill in. - * - * Returns: - * Number of SLUT entries in the f/w, or -1 if the image was corrupt. - * --------------------------------------------------------------------------- - */ -s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo, - symbol_t *slut, u32 slut_len) -{ - s16 i; - s32 offset; - u32 magic; - u32 count = 0; - ct_t ct; - - if (fwinfo->mode != xbv_firmware) - { - return -1; - } - - /* Find the d/l segment containing the SLUT */ - /* This relies on the SLUT being entirely contained in one segment */ - offset = -1; - for (i = 0; i < fwinfo->num_fwdl; i++) - { - if ((fwinfo->slut_addr >= fwinfo->fwdl[i].dl_addr) && - (fwinfo->slut_addr < (fwinfo->fwdl[i].dl_addr + fwinfo->fwdl[i].dl_size))) - { - offset = fwinfo->fwdl[i].dl_offset + - (fwinfo->slut_addr - fwinfo->fwdl[i].dl_addr); - } - } - if (offset < 0) - { - return -1; - } - - ct.dlpriv = dlpriv; - ct.ioffset = offset; - ct.iread = readfn; - - if (read_uint(card, &ct, &magic, 2)) - { - return -1; - } - if (magic != SLUT_FINGERPRINT) - { - return -1; - } - - while (count < slut_len) - { - u32 id, obj; - - /* Read Symbol Id */ - if (read_uint(card, &ct, &id, 2)) - { - return -1; - } - - /* Check for end of table marker */ - if (id == CSR_SLT_END) - { - break; - } - - /* Read Symbol Value */ - if (read_uint(card, &ct, &obj, 4)) - { - return -1; - } - - slut[count].id = (u16)id; - slut[count].obj = obj; - count++; - } - - return count; -} /* read_slut() */ - - -/* - * --------------------------------------------------------------------------- - * xbv_to_patch - * - * Convert (the relevant parts of) a firmware xbv file into a patch xbv - * - * Arguments: - * card - * fw_buf - pointer to xbv firmware image - * fwinfo - structure describing the firmware image - * size - pointer to location into which size of f/w is written. - * - * Returns: - * Pointer to firmware image, or NULL on error. Caller must free this - * buffer via kfree() once it's finished with. - * - * Notes: - * The input fw_buf should have been checked via xbv1_parse prior to - * calling this function, so the input image is assumed valid. - * --------------------------------------------------------------------------- - */ -#define PTCH_LIST_SIZE 16 /* sizeof PTCH+FWID chunk in LIST header */ - -void* xbv_to_patch(card_t *card, fwreadfn_t readfn, - const void *fw_buf, const xbv1_t *fwinfo, u32 *size) -{ - void *patch_buf = NULL; - u32 patch_buf_size; - u32 payload_offs = 0; /* Start of XBV payload */ - s16 i; - u32 patch_offs = 0; - u32 list_len_offs = 0; /* Offset of PTDL LIST length parameter */ - u32 ptdl_start_offs = 0; /* Offset of first PTDL chunk */ - u32 fw_id; - void *rdbuf; - - if (!fw_buf || !fwinfo || !card) - { - return NULL; - } - - if (fwinfo->mode != xbv_firmware) - { - unifi_error(NULL, "Not a firmware file\n"); - return NULL; - } - - /* Pre-allocate read buffer for chunk conversion */ - rdbuf = kmalloc(PTDL_MAX_SIZE, GFP_KERNEL); - if (!rdbuf) - { - unifi_error(card, "Couldn't alloc conversion buffer\n"); - return NULL; - } - - /* Loader requires patch file's build ID to match the running firmware's */ - fw_id = card->build_id; - - /* Firmware XBV1 contains VERF, optional INFO, SLUT(s), FWDL(s) */ - /* Other chunks should get skipped. */ - /* VERF should be sanity-checked against chip version */ - - /* Patch XBV1 contains VERF, optional INFO, PTCH */ - /* PTCH contains FWID, optional INFO, PTDL(s), PTDL(start_vec) */ - /* Each FWDL is split into PTDLs (each is 1024 XAP words max) */ - /* Each PTDL contains running ROM f/w version, and checksum */ - /* MAC/PHY reset addresses (known) are added into a final PTDL */ - - /* The input image has already been parsed, and loaded into fwinfo, so we - * can use that to build the output image - */ - patch_buf_size = calc_patch_size(fwinfo); - - patch_buf = kmalloc(patch_buf_size, GFP_KERNEL); - if (!patch_buf) - { - kfree(rdbuf); - unifi_error(NULL, "Can't malloc buffer for patch conversion\n"); - return NULL; - } - - memset(patch_buf, 0xdd, patch_buf_size); - - /* Write XBV + VERF headers */ - patch_offs += write_xbv_header(patch_buf, patch_offs, 0); - payload_offs = patch_offs; - - /* Write patch (LIST) header */ - list_len_offs = patch_offs + 4; /* Save LIST.length offset for later update */ - patch_offs += write_ptch_header(patch_buf, patch_offs, fw_id); - - /* Save start offset of the PTDL chunks */ - ptdl_start_offs = patch_offs; - - /* Write LIST of firmware PTDL blocks */ - for (i = 0; i < fwinfo->num_fwdl; i++) - { - patch_offs += write_fwdl_to_ptdl(patch_buf, - patch_offs, - readfn, - &fwinfo->fwdl[i], - fw_buf, - fw_id, - rdbuf); - } - - /* Write restart-vector PTDL last */ - patch_offs += write_reset_ptdl(patch_buf, patch_offs, fwinfo, fw_id); - - /* Now the length is known, update the LIST.length */ - (void)write_uint32(patch_buf, list_len_offs, - (patch_offs - ptdl_start_offs) + PTCH_LIST_SIZE); - - /* Re write XBV headers just to fill in the correct file size */ - (void)write_xbv_header(patch_buf, 0, (patch_offs - payload_offs)); - - unifi_trace(card->ospriv, UDBG1, "XBV:PTCH size %u, fw_id %u\n", - patch_offs, fw_id); - if (size) - { - *size = patch_offs; - } - kfree(rdbuf); - - return patch_buf; -} - - diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.h b/drivers/staging/csr/csr_wifi_hip_xbv.h deleted file mode 100644 index 3c507235323d..000000000000 --- a/drivers/staging/csr/csr_wifi_hip_xbv.h +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* - * --------------------------------------------------------------------------- - * FILE: csr_wifi_hip_xbv.h - * - * PURPOSE: - * Definitions and declarations for code to read XBV files - the UniFi - * firmware download file format. - * - * --------------------------------------------------------------------------- - */ -#ifndef __XBV_H__ -#define __XBV_H__ - -#ifndef CSR_WIFI_XBV_TEST -/* Driver includes */ -#include "csr_wifi_hip_unifi.h" -#endif - - -struct VMEQ -{ - u32 addr; - u16 mask; - u16 value; -}; - -struct VAND -{ - u32 first; - u32 count; -}; - -struct VERS -{ - u32 num_vand; -}; - -struct FWDL -{ - u32 dl_addr; - u32 dl_size; - u32 dl_offset; -}; - -struct FWOV -{ - u32 dl_size; - u32 dl_offset; -}; - -struct PTDL -{ - u32 dl_size; - u32 dl_offset; -}; - -#define MAX_VMEQ 64 -#define MAX_VAND 64 -#define MAX_FWDL 256 -#define MAX_PTDL 256 - -/* An XBV1 file can either contain firmware or patches (at the - * moment). The 'mode' member of the xbv1_t structure tells us which - * one is the case. */ -typedef enum -{ - xbv_unknown, - xbv_firmware, - xbv_patch -} xbv_mode; - -typedef struct -{ - xbv_mode mode; - - /* Parts of a Firmware XBV1 */ - - struct VMEQ vmeq[MAX_VMEQ]; - u32 num_vmeq; - struct VAND vand[MAX_VAND]; - struct VERS vers; - - u32 slut_addr; - - /* F/W download image, possibly more than one part */ - struct FWDL fwdl[MAX_FWDL]; - s16 num_fwdl; - - /* F/W overlay image, add r not used */ - struct FWOV fwov; - - /* Parts of a Patch XBV1 */ - - u32 build_id; - - struct PTDL ptdl[MAX_PTDL]; - s16 num_ptdl; -} xbv1_t; - - -typedef s32 (*fwreadfn_t)(void *ospriv, void *dlpriv, u32 offset, void *buf, u32 len); - -CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo); -s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo, - symbol_t *slut, u32 slut_len); -void* xbv_to_patch(card_t *card, fwreadfn_t readfn, const void *fw_buf, const xbv1_t *fwinfo, - u32 *size); - -#endif /* __XBV_H__ */ diff --git a/drivers/staging/csr/csr_wifi_hostio_prim.h b/drivers/staging/csr/csr_wifi_hostio_prim.h deleted file mode 100644 index cfb3e272e359..000000000000 --- a/drivers/staging/csr/csr_wifi_hostio_prim.h +++ /dev/null @@ -1,18 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - - -#ifndef CSR_WIFI_HOSTIO_H -#define CSR_WIFI_HOSTIO_H - -#define CSR_WIFI_HOSTIO_PRIM 0x0453 - -#endif /* CSR_WIFI_HOSTIO_H */ - diff --git a/drivers/staging/csr/csr_wifi_lib.h b/drivers/staging/csr/csr_wifi_lib.h deleted file mode 100644 index 5fde0efb5dca..000000000000 --- a/drivers/staging/csr/csr_wifi_lib.h +++ /dev/null @@ -1,103 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ -#ifndef CSR_WIFI_LIB_H__ -#define CSR_WIFI_LIB_H__ - -#include "csr_wifi_fsm_event.h" - -/*----------------------------------------------------------------------------* - * CsrWifiFsmEventInit - * - * DESCRIPTION - * Macro to initialise the members of a CsrWifiFsmEvent. - *----------------------------------------------------------------------------*/ -#define CsrWifiFsmEventInit(evt, p_primtype, p_msgtype, p_dst, p_src) \ - (evt)->primtype = p_primtype; \ - (evt)->type = p_msgtype; \ - (evt)->destination = p_dst; \ - (evt)->source = p_src - - -/*----------------------------------------------------------------------------* - * CsrWifiEvent_struct - * - * DESCRIPTION - * Generic message creator. - * Allocates and fills in a message with the signature CsrWifiEvent - * - *----------------------------------------------------------------------------*/ -CsrWifiFsmEvent* CsrWifiEvent_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src); - -typedef struct -{ - CsrWifiFsmEvent common; - u8 value; -} CsrWifiEventCsrUint8; - -/*----------------------------------------------------------------------------* - * CsrWifiEventCsrUint8_struct - * - * DESCRIPTION - * Generic message creator. - * Allocates and fills in a message with the signature CsrWifiEventCsrUint8 - * - *----------------------------------------------------------------------------*/ -CsrWifiEventCsrUint8* CsrWifiEventCsrUint8_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, u8 value); - -typedef struct -{ - CsrWifiFsmEvent common; - u16 value; -} CsrWifiEventCsrUint16; - -/*----------------------------------------------------------------------------* - * CsrWifiEventCsrUint16_struct - * - * DESCRIPTION - * Generic message creator. - * Allocates and fills in a message with the signature CsrWifiEventCsrUint16 - * - *----------------------------------------------------------------------------*/ -CsrWifiEventCsrUint16* CsrWifiEventCsrUint16_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, u16 value); - -typedef struct -{ - CsrWifiFsmEvent common; - u32 value; -} CsrWifiEventCsrUint32; - -/*----------------------------------------------------------------------------* - * CsrWifiEventCsrUint32_struct - * - * DESCRIPTION - * Generic message creator. - * Allocates and fills in a message with the signature CsrWifiEventCsrUint32 - * - *----------------------------------------------------------------------------*/ -CsrWifiEventCsrUint32* CsrWifiEventCsrUint32_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, u32 value); - -typedef struct -{ - CsrWifiFsmEvent common; - u16 value16; - u8 value8; -} CsrWifiEventCsrUint16CsrUint8; - -/*----------------------------------------------------------------------------* - * CsrWifiEventCsrUint16CsrUint8_struct - * - * DESCRIPTION - * Generic message creator. - * Allocates and fills in a message with the signature CsrWifiEventCsrUint16CsrUint8 - * - *----------------------------------------------------------------------------*/ -CsrWifiEventCsrUint16CsrUint8* CsrWifiEventCsrUint16CsrUint8_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, u16 value16, u8 value8); - -#endif /* CSR_WIFI_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_msgconv.h b/drivers/staging/csr/csr_wifi_msgconv.h deleted file mode 100644 index f8b402947a09..000000000000 --- a/drivers/staging/csr/csr_wifi_msgconv.h +++ /dev/null @@ -1,49 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifndef CSR_WIFI_MSGCONV_H__ -#define CSR_WIFI_MSGCONV_H__ - -#include "csr_prim_defs.h" -#include "csr_sched.h" - -void CsrUint16SerBigEndian(u8 *ptr, size_t *len, u16 v); -void CsrUint24SerBigEndian(u8 *ptr, size_t *len, u32 v); -void CsrUint32SerBigEndian(u8 *ptr, size_t *len, u32 v); - -void CsrUint16DesBigEndian(u16 *v, u8 *buffer, size_t *offset); -void CsrUint24DesBigEndian(u32 *v, u8 *buffer, size_t *offset); -void CsrUint32DesBigEndian(u32 *v, u8 *buffer, size_t *offset); - -void CsrUint24Ser(u8 *ptr, size_t *len, u32 v); -void CsrUint24Des(u32 *v, u8 *buffer, size_t *offset); - - -size_t CsrWifiEventSizeof(void *msg); -u8* CsrWifiEventSer(u8 *ptr, size_t *len, void *msg); -void* CsrWifiEventDes(u8 *buffer, size_t length); - -size_t CsrWifiEventCsrUint8Sizeof(void *msg); -u8* CsrWifiEventCsrUint8Ser(u8 *ptr, size_t *len, void *msg); -void* CsrWifiEventCsrUint8Des(u8 *buffer, size_t length); - -size_t CsrWifiEventCsrUint16Sizeof(void *msg); -u8* CsrWifiEventCsrUint16Ser(u8 *ptr, size_t *len, void *msg); -void* CsrWifiEventCsrUint16Des(u8 *buffer, size_t length); - -size_t CsrWifiEventCsrUint32Sizeof(void *msg); -u8* CsrWifiEventCsrUint32Ser(u8 *ptr, size_t *len, void *msg); -void* CsrWifiEventCsrUint32Des(u8 *buffer, size_t length); - -size_t CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg); -u8* CsrWifiEventCsrUint16CsrUint8Ser(u8 *ptr, size_t *len, void *msg); -void* CsrWifiEventCsrUint16CsrUint8Des(u8 *buffer, size_t length); - -#endif /* CSR_WIFI_MSGCONV_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c deleted file mode 100644 index 0689d6f1cab1..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#include "csr_msgconv.h" -#include "csr_macro.h" - -#ifdef CSR_WIFI_NME_ENABLE -#ifdef CSR_WIFI_AP_ENABLE - -#ifdef CSR_LOG_ENABLE -#include "csr_log.h" -#endif - -#ifndef EXCLUDE_CSR_WIFI_NME_AP_MODULE -#include "csr_wifi_nme_ap_serialize.h" -#include "csr_wifi_nme_ap_prim.h" - -static CsrMsgConvMsgEntry csrwifinmeap_conv_lut[] = { - { CSR_WIFI_NME_AP_CONFIG_SET_REQ, CsrWifiNmeApConfigSetReqSizeof, CsrWifiNmeApConfigSetReqSer, CsrWifiNmeApConfigSetReqDes, CsrWifiNmeApConfigSetReqSerFree }, - { CSR_WIFI_NME_AP_WPS_REGISTER_REQ, CsrWifiNmeApWpsRegisterReqSizeof, CsrWifiNmeApWpsRegisterReqSer, CsrWifiNmeApWpsRegisterReqDes, CsrWifiNmeApWpsRegisterReqSerFree }, - { CSR_WIFI_NME_AP_START_REQ, CsrWifiNmeApStartReqSizeof, CsrWifiNmeApStartReqSer, CsrWifiNmeApStartReqDes, CsrWifiNmeApStartReqSerFree }, - { CSR_WIFI_NME_AP_STOP_REQ, CsrWifiNmeApStopReqSizeof, CsrWifiNmeApStopReqSer, CsrWifiNmeApStopReqDes, CsrWifiNmeApStopReqSerFree }, - { CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ, CsrWifiNmeApWmmParamUpdateReqSizeof, CsrWifiNmeApWmmParamUpdateReqSer, CsrWifiNmeApWmmParamUpdateReqDes, CsrWifiNmeApWmmParamUpdateReqSerFree }, - { CSR_WIFI_NME_AP_STA_REMOVE_REQ, CsrWifiNmeApStaRemoveReqSizeof, CsrWifiNmeApStaRemoveReqSer, CsrWifiNmeApStaRemoveReqDes, CsrWifiNmeApStaRemoveReqSerFree }, - { CSR_WIFI_NME_AP_CONFIG_SET_CFM, CsrWifiNmeApConfigSetCfmSizeof, CsrWifiNmeApConfigSetCfmSer, CsrWifiNmeApConfigSetCfmDes, CsrWifiNmeApConfigSetCfmSerFree }, - { CSR_WIFI_NME_AP_WPS_REGISTER_CFM, CsrWifiNmeApWpsRegisterCfmSizeof, CsrWifiNmeApWpsRegisterCfmSer, CsrWifiNmeApWpsRegisterCfmDes, CsrWifiNmeApWpsRegisterCfmSerFree }, - { CSR_WIFI_NME_AP_START_CFM, CsrWifiNmeApStartCfmSizeof, CsrWifiNmeApStartCfmSer, CsrWifiNmeApStartCfmDes, CsrWifiNmeApStartCfmSerFree }, - { CSR_WIFI_NME_AP_STOP_CFM, CsrWifiNmeApStopCfmSizeof, CsrWifiNmeApStopCfmSer, CsrWifiNmeApStopCfmDes, CsrWifiNmeApStopCfmSerFree }, - { CSR_WIFI_NME_AP_STOP_IND, CsrWifiNmeApStopIndSizeof, CsrWifiNmeApStopIndSer, CsrWifiNmeApStopIndDes, CsrWifiNmeApStopIndSerFree }, - { CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM, CsrWifiNmeApWmmParamUpdateCfmSizeof, CsrWifiNmeApWmmParamUpdateCfmSer, CsrWifiNmeApWmmParamUpdateCfmDes, CsrWifiNmeApWmmParamUpdateCfmSerFree }, - { CSR_WIFI_NME_AP_STATION_IND, CsrWifiNmeApStationIndSizeof, CsrWifiNmeApStationIndSer, CsrWifiNmeApStationIndDes, CsrWifiNmeApStationIndSerFree }, - - { 0, NULL, NULL, NULL, NULL }, -}; - -CsrMsgConvMsgEntry* CsrWifiNmeApConverterLookup(CsrMsgConvMsgEntry *ce, u16 msgType) -{ - if (msgType & CSR_PRIM_UPSTREAM) - { - u16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT; - if (idx < (CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT) && - csrwifinmeap_conv_lut[idx].msgType == msgType) - { - return &csrwifinmeap_conv_lut[idx]; - } - } - else - { - if (msgType < CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT && - csrwifinmeap_conv_lut[msgType].msgType == msgType) - { - return &csrwifinmeap_conv_lut[msgType]; - } - } - return NULL; -} - - -void CsrWifiNmeApConverterInit(void) -{ - CsrMsgConvInsert(CSR_WIFI_NME_AP_PRIM, csrwifinmeap_conv_lut); - CsrMsgConvCustomLookupRegister(CSR_WIFI_NME_AP_PRIM, CsrWifiNmeApConverterLookup); -} - - -#ifdef CSR_LOG_ENABLE -static const CsrLogPrimitiveInformation csrwifinmeap_conv_info = { - CSR_WIFI_NME_AP_PRIM, - (char *)"CSR_WIFI_NME_AP_PRIM", - csrwifinmeap_conv_lut -}; -const CsrLogPrimitiveInformation* CsrWifiNmeApTechInfoGet(void) -{ - return &csrwifinmeap_conv_info; -} - - -#endif /* CSR_LOG_ENABLE */ -#endif /* EXCLUDE_CSR_WIFI_NME_AP_MODULE */ -#endif /* CSR_WIFI_NME_ENABLE */ -#endif /* CSR_WIFI_AP_ENABLE */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.h b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.h deleted file mode 100644 index b89d7c7f8e21..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.h +++ /dev/null @@ -1,41 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_NME_AP_CONVERTER_INIT_H__ -#define CSR_WIFI_NME_AP_CONVERTER_INIT_H__ - -#ifndef CSR_WIFI_NME_ENABLE -#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_converter_init.h -#endif -#ifndef CSR_WIFI_AP_ENABLE -#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_converter_init.h -#endif - -#ifndef EXCLUDE_CSR_WIFI_NME_AP_MODULE - -#include "csr_msgconv.h" - -#ifdef CSR_LOG_ENABLE -#include "csr_log.h" - -extern const CsrLogPrimitiveInformation* CsrWifiNmeApTechInfoGet(void); -#endif /* CSR_LOG_ENABLE */ - -extern void CsrWifiNmeApConverterInit(void); - -#else /* EXCLUDE_CSR_WIFI_NME_AP_MODULE */ - -#define CsrWifiNmeApConverterInit() - -#endif /* EXCLUDE_CSR_WIFI_NME_AP_MODULE */ - -#endif /* CSR_WIFI_NME_AP_CONVERTER_INIT_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c deleted file mode 100644 index ab9358873ec3..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c +++ /dev/null @@ -1,84 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ -#include <linux/slab.h> -#include "csr_wifi_nme_ap_prim.h" -#include "csr_wifi_nme_ap_lib.h" - -/*----------------------------------------------------------------------------* - * NAME - * CsrWifiNmeApFreeDownstreamMessageContents - * - * DESCRIPTION - * - * - * PARAMETERS - * eventClass: only the value CSR_WIFI_NME_AP_PRIM will be handled - * message: the message to free - *----------------------------------------------------------------------------*/ -void CsrWifiNmeApFreeDownstreamMessageContents(u16 eventClass, void *message) -{ - if (eventClass != CSR_WIFI_NME_AP_PRIM) - { - return; - } - if (NULL == message) - { - return; - } - - switch (*((CsrWifiNmeApPrim *) message)) - { - case CSR_WIFI_NME_AP_CONFIG_SET_REQ: - { - CsrWifiNmeApConfigSetReq *p = (CsrWifiNmeApConfigSetReq *)message; - kfree(p->apMacConfig.macAddressList); - p->apMacConfig.macAddressList = NULL; - break; - } - case CSR_WIFI_NME_AP_START_REQ: - { - CsrWifiNmeApStartReq *p = (CsrWifiNmeApStartReq *)message; - switch (p->apCredentials.authType) - { - case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: - switch (p->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) - { - case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: - kfree(p->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); - p->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase = NULL; - break; - default: - break; - } - break; - default: - break; - } - { - u16 i3; - for (i3 = 0; i3 < p->p2pGoParam.operatingChanList.channelEntryListCount; i3++) - { - kfree(p->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel); - p->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = NULL; - } - } - kfree(p->p2pGoParam.operatingChanList.channelEntryList); - p->p2pGoParam.operatingChanList.channelEntryList = NULL; - break; - } - - default: - break; - } -} - - diff --git a/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c deleted file mode 100644 index 2786a6bbff97..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#include "csr_wifi_nme_ap_prim.h" -#include "csr_wifi_nme_ap_lib.h" - -/*----------------------------------------------------------------------------* - * NAME - * CsrWifiNmeApFreeUpstreamMessageContents - * - * DESCRIPTION - * - * - * PARAMETERS - * eventClass: only the value CSR_WIFI_NME_AP_PRIM will be handled - * message: the message to free - *----------------------------------------------------------------------------*/ -void CsrWifiNmeApFreeUpstreamMessageContents(u16 eventClass, void *message) -{ - if (eventClass != CSR_WIFI_NME_AP_PRIM) - { - return; - } - if (NULL == message) - { - return; - } -} - - diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h deleted file mode 100644 index 6d8df8366817..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_ap_lib.h +++ /dev/null @@ -1,495 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_NME_AP_LIB_H__ -#define CSR_WIFI_NME_AP_LIB_H__ - -#include "csr_sched.h" -#include "csr_macro.h" -#include "csr_msg_transport.h" - -#include "csr_wifi_lib.h" - -#include "csr_wifi_nme_ap_prim.h" -#include "csr_wifi_nme_task.h" - -#ifndef CSR_WIFI_NME_ENABLE -#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_lib.h -#endif -#ifndef CSR_WIFI_AP_ENABLE -#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_lib.h -#endif - -/*----------------------------------------------------------------------------* - * CsrWifiNmeApFreeUpstreamMessageContents - * - * DESCRIPTION - * Free the allocated memory in a CSR_WIFI_NME_AP upstream message. Does not - * free the message itself, and can only be used for upstream messages. - * - * PARAMETERS - * Deallocates the resources in a CSR_WIFI_NME_AP upstream message - *----------------------------------------------------------------------------*/ -void CsrWifiNmeApFreeUpstreamMessageContents(u16 eventClass, void *message); - -/*----------------------------------------------------------------------------* - * CsrWifiNmeApFreeDownstreamMessageContents - * - * DESCRIPTION - * Free the allocated memory in a CSR_WIFI_NME_AP downstream message. Does not - * free the message itself, and can only be used for downstream messages. - * - * PARAMETERS - * Deallocates the resources in a CSR_WIFI_NME_AP downstream message - *----------------------------------------------------------------------------*/ -void CsrWifiNmeApFreeDownstreamMessageContents(u16 eventClass, void *message); - -/******************************************************************************* - - NAME - CsrWifiNmeApConfigSetReqSend - - DESCRIPTION - This primitive passes AP configuration info for NME. This can be sent at - any time but will be acted upon when the AP is started again. This - information is common to both P2P GO and AP - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - apConfig - AP configuration for the NME. - apMacConfig - MAC configuration to be acted on when - CSR_WIFI_NME_AP_START.request is sent. - -*******************************************************************************/ -#define CsrWifiNmeApConfigSetReqCreate(msg__, dst__, src__, apConfig__, apMacConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApConfigSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_REQ, dst__, src__); \ - msg__->apConfig = (apConfig__); \ - msg__->apMacConfig = (apMacConfig__); - -#define CsrWifiNmeApConfigSetReqSendTo(dst__, src__, apConfig__, apMacConfig__) \ - { \ - CsrWifiNmeApConfigSetReq *msg__; \ - CsrWifiNmeApConfigSetReqCreate(msg__, dst__, src__, apConfig__, apMacConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApConfigSetReqSend(src__, apConfig__, apMacConfig__) \ - CsrWifiNmeApConfigSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, apConfig__, apMacConfig__) - -/******************************************************************************* - - NAME - CsrWifiNmeApConfigSetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Status of the request. - -*******************************************************************************/ -#define CsrWifiNmeApConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApConfigSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiNmeApConfigSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiNmeApConfigSetCfm *msg__; \ - CsrWifiNmeApConfigSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApConfigSetCfmSend(dst__, status__) \ - CsrWifiNmeApConfigSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiNmeApStaRemoveReqSend - - DESCRIPTION - This primitive disconnects a connected station. If keepBlocking is set to - TRUE, the station with the specified MAC address is not allowed to - connect. If the requested station is not already connected,it may be - blocked based on keepBlocking parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - staMacAddress - Mac Address of the station to be disconnected or blocked - keepBlocking - If TRUE, the station is blocked. If FALSE and the station is - connected, disconnect the station. If FALSE and the station - is not connected, no action is taken. - -*******************************************************************************/ -#define CsrWifiNmeApStaRemoveReqCreate(msg__, dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApStaRemoveReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STA_REMOVE_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->staMacAddress = (staMacAddress__); \ - msg__->keepBlocking = (keepBlocking__); - -#define CsrWifiNmeApStaRemoveReqSendTo(dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__) \ - { \ - CsrWifiNmeApStaRemoveReq *msg__; \ - CsrWifiNmeApStaRemoveReqCreate(msg__, dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApStaRemoveReqSend(src__, interfaceTag__, staMacAddress__, keepBlocking__) \ - CsrWifiNmeApStaRemoveReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, staMacAddress__, keepBlocking__) - -/******************************************************************************* - - NAME - CsrWifiNmeApStartReqSend - - DESCRIPTION - This primitive requests NME to started the AP operation. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface identifier; unique identifier of an interface - apType - AP Type specifies the Legacy AP or P2P GO operation - cloakSsid - Indicates whether the SSID should be cloaked (hidden and - not broadcast in beacon) or not - ssid - Service Set Identifier - ifIndex - Radio interface - channel - Channel number of the channel to use - apCredentials - Security credential configuration. - maxConnections - Maximum number of stations/P2P clients allowed - p2pGoParam - P2P specific GO parameters. - wpsEnabled - Indicates whether WPS should be enabled or not - -*******************************************************************************/ -#define CsrWifiNmeApStartReqCreate(msg__, dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApStartReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->apType = (apType__); \ - msg__->cloakSsid = (cloakSsid__); \ - msg__->ssid = (ssid__); \ - msg__->ifIndex = (ifIndex__); \ - msg__->channel = (channel__); \ - msg__->apCredentials = (apCredentials__); \ - msg__->maxConnections = (maxConnections__); \ - msg__->p2pGoParam = (p2pGoParam__); \ - msg__->wpsEnabled = (wpsEnabled__); - -#define CsrWifiNmeApStartReqSendTo(dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \ - { \ - CsrWifiNmeApStartReq *msg__; \ - CsrWifiNmeApStartReqCreate(msg__, dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApStartReqSend(src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \ - CsrWifiNmeApStartReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) - -/******************************************************************************* - - NAME - CsrWifiNmeApStartCfmSend - - DESCRIPTION - This primitive reports the result of CSR_WIFI_NME_AP_START.request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface identifier; unique identifier of an interface - status - Status of the request. - ssid - Service Set Identifier - -*******************************************************************************/ -#define CsrWifiNmeApStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ssid__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApStartCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->ssid = (ssid__); - -#define CsrWifiNmeApStartCfmSendTo(dst__, src__, interfaceTag__, status__, ssid__) \ - { \ - CsrWifiNmeApStartCfm *msg__; \ - CsrWifiNmeApStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ssid__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApStartCfmSend(dst__, interfaceTag__, status__, ssid__) \ - CsrWifiNmeApStartCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, ssid__) - -/******************************************************************************* - - NAME - CsrWifiNmeApStationIndSend - - DESCRIPTION - This primitive indicates that a station has joined or a previously joined - station has left the BSS/group - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - mediaStatus - Indicates whether the station is connected or - disconnected - peerMacAddress - MAC address of the station - peerDeviceAddress - P2P Device Address - -*******************************************************************************/ -#define CsrWifiNmeApStationIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApStationInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STATION_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->mediaStatus = (mediaStatus__); \ - msg__->peerMacAddress = (peerMacAddress__); \ - msg__->peerDeviceAddress = (peerDeviceAddress__); - -#define CsrWifiNmeApStationIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \ - { \ - CsrWifiNmeApStationInd *msg__; \ - CsrWifiNmeApStationIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApStationIndSend(dst__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \ - CsrWifiNmeApStationIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) - -/******************************************************************************* - - NAME - CsrWifiNmeApStopReqSend - - DESCRIPTION - This primitive requests NME to stop the AP operation. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface identifier; unique identifier of an interface - -*******************************************************************************/ -#define CsrWifiNmeApStopReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApStopReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiNmeApStopReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiNmeApStopReq *msg__; \ - CsrWifiNmeApStopReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApStopReqSend(src__, interfaceTag__) \ - CsrWifiNmeApStopReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiNmeApStopIndSend - - DESCRIPTION - Indicates that AP operation had stopped because of some unrecoverable - error after AP operation was started successfully. NME sends this signal - after failing to restart the AP operation internally following an error - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - apType - Reports AP Type (P2PGO or AP) - status - Error Status - -*******************************************************************************/ -#define CsrWifiNmeApStopIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApStopInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->apType = (apType__); \ - msg__->status = (status__); - -#define CsrWifiNmeApStopIndSendTo(dst__, src__, interfaceTag__, apType__, status__) \ - { \ - CsrWifiNmeApStopInd *msg__; \ - CsrWifiNmeApStopIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApStopIndSend(dst__, interfaceTag__, apType__, status__) \ - CsrWifiNmeApStopIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, apType__, status__) - -/******************************************************************************* - - NAME - CsrWifiNmeApStopCfmSend - - DESCRIPTION - This primitive confirms that the AP operation is stopped. NME shall send - this primitive in response to the request even if AP operation has - already been stopped - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface identifier; unique identifier of an interface - status - Status of the request. - -*******************************************************************************/ -#define CsrWifiNmeApStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApStopCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiNmeApStopCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiNmeApStopCfm *msg__; \ - CsrWifiNmeApStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApStopCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiNmeApStopCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiNmeApWmmParamUpdateReqSend - - DESCRIPTION - Application uses this primitive to update the WMM parameters - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - wmmApParams - WMM Access point parameters per access category. The array - index corresponds to the ACI - wmmApBcParams - WMM station parameters per access category to be advertised - in the beacons and probe response The array index - corresponds to the ACI - -*******************************************************************************/ -#define CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \ - memcpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \ - memcpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); - -#define CsrWifiNmeApWmmParamUpdateReqSendTo(dst__, src__, wmmApParams__, wmmApBcParams__) \ - { \ - CsrWifiNmeApWmmParamUpdateReq *msg__; \ - CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApWmmParamUpdateReqSend(src__, wmmApParams__, wmmApBcParams__) \ - CsrWifiNmeApWmmParamUpdateReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, wmmApParams__, wmmApBcParams__) - -/******************************************************************************* - - NAME - CsrWifiNmeApWmmParamUpdateCfmSend - - DESCRIPTION - A confirm for for the WMM parameters update - - PARAMETERS - queue - Destination Task Queue - status - Status of the request. - -*******************************************************************************/ -#define CsrWifiNmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiNmeApWmmParamUpdateCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiNmeApWmmParamUpdateCfm *msg__; \ - CsrWifiNmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApWmmParamUpdateCfmSend(dst__, status__) \ - CsrWifiNmeApWmmParamUpdateCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiNmeApWpsRegisterReqSend - - DESCRIPTION - This primitive allows the NME to accept the WPS registration from an - enrollee. Such registration procedure can be cancelled by sending - CSR_WIFI_NME_WPS_CANCEL.request. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an - interface - selectedDevicePasswordId - Selected password type - selectedConfigMethod - Selected WPS configuration method type - pin - PIN value. - Relevant if selected device password ID is PIN.4 - digit pin is passed by sending the pin digits in - pin[0]..pin[3] and rest of the contents filled - with '-'. - -*******************************************************************************/ -#define CsrWifiNmeApWpsRegisterReqCreate(msg__, dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApWpsRegisterReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->selectedDevicePasswordId = (selectedDevicePasswordId__); \ - msg__->selectedConfigMethod = (selectedConfigMethod__); \ - memcpy(msg__->pin, (pin__), sizeof(u8) * 8); - -#define CsrWifiNmeApWpsRegisterReqSendTo(dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \ - { \ - CsrWifiNmeApWpsRegisterReq *msg__; \ - CsrWifiNmeApWpsRegisterReqCreate(msg__, dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApWpsRegisterReqSend(src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \ - CsrWifiNmeApWpsRegisterReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) - -/******************************************************************************* - - NAME - CsrWifiNmeApWpsRegisterCfmSend - - DESCRIPTION - This primitive reports the result of WPS procedure. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface identifier; unique identifier of an interface - status - Status of the request. - -*******************************************************************************/ -#define CsrWifiNmeApWpsRegisterCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeApWpsRegisterCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiNmeApWpsRegisterCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiNmeApWpsRegisterCfm *msg__; \ - CsrWifiNmeApWpsRegisterCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \ - } - -#define CsrWifiNmeApWpsRegisterCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiNmeApWpsRegisterCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__) - -#endif /* CSR_WIFI_NME_AP_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_prim.h b/drivers/staging/csr/csr_wifi_nme_ap_prim.h deleted file mode 100644 index b32bdbc7e22f..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_ap_prim.h +++ /dev/null @@ -1,494 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_NME_AP_PRIM_H__ -#define CSR_WIFI_NME_AP_PRIM_H__ - -#include <linux/types.h> -#include "csr_prim_defs.h" -#include "csr_sched.h" -#include "csr_wifi_common.h" -#include "csr_result.h" -#include "csr_wifi_fsm_event.h" -#include "csr_wifi_sme_ap_prim.h" -#include "csr_wifi_nme_prim.h" - -#ifndef CSR_WIFI_NME_ENABLE -#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_prim.h -#endif -#ifndef CSR_WIFI_AP_ENABLE -#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_prim.h -#endif - -#define CSR_WIFI_NME_AP_PRIM (0x0426) - -typedef CsrPrim CsrWifiNmeApPrim; - - -/******************************************************************************* - - NAME - CsrWifiNmeApPersCredentialType - - DESCRIPTION - NME Credential Types - - VALUES - CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK - - Use PSK as credential. - CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE - - Use the specified passphrase as credential - -*******************************************************************************/ -typedef u8 CsrWifiNmeApPersCredentialType; -#define CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK ((CsrWifiNmeApPersCredentialType) 0x00) -#define CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE ((CsrWifiNmeApPersCredentialType) 0x01) - - -/******************************************************************************* - - NAME - CsrWifiNmeApConfig - - DESCRIPTION - Structure holding AP config data. - - MEMBERS - apGroupkeyTimeout - Access point group key timeout. - apStrictGtkRekey - Access point strict GTK rekey flag. If set TRUE, the AP - shall rekey GTK every time a connected STA leaves BSS. - apGmkTimeout - Access point GMK timeout - apResponseTimeout - Response timeout - apRetransLimit - Max allowed retransmissions - -*******************************************************************************/ -typedef struct -{ - u16 apGroupkeyTimeout; - u8 apStrictGtkRekey; - u16 apGmkTimeout; - u16 apResponseTimeout; - u8 apRetransLimit; -} CsrWifiNmeApConfig; - -/******************************************************************************* - - NAME - CsrWifiNmeApAuthPers - - DESCRIPTION - - MEMBERS - authSupport - Credential type value (as defined in the - enumeration type). - rsnCapabilities - RSN capabilities mask - wapiCapabilities - WAPI capabilities mask - pskOrPassphrase - Credential type value (as defined in the - enumeration type). - authPers_credentials - Union containing credentials which depends - on credentialType parameter. - authPers_credentialspsk - - authPers_credentialspassphrase - - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeApAuthSupportMask authSupport; - CsrWifiSmeApRsnCapabilitiesMask rsnCapabilities; - CsrWifiSmeApWapiCapabilitiesMask wapiCapabilities; - CsrWifiNmeApPersCredentialType pskOrPassphrase; - union { - CsrWifiNmePsk psk; - CsrWifiNmePassphrase passphrase; - } authPers_credentials; -} CsrWifiNmeApAuthPers; - -/******************************************************************************* - - NAME - CsrWifiNmeApCredentials - - DESCRIPTION - Structure containing the Credentials data. - - MEMBERS - authType - Authentication type - nmeAuthType - Authentication parameters - nmeAuthTypeopenSystemEmpty - - nmeAuthTypeauthwep - - nmeAuthTypeauthTypePersonal - - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeApAuthType authType; - union { - CsrWifiSmeEmpty openSystemEmpty; - CsrWifiSmeWepAuth authwep; - CsrWifiNmeApAuthPers authTypePersonal; - } nmeAuthType; -} CsrWifiNmeApCredentials; - - -/* Downstream */ -#define CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST (0x0000) - -#define CSR_WIFI_NME_AP_CONFIG_SET_REQ ((CsrWifiNmeApPrim) (0x0000 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_AP_WPS_REGISTER_REQ ((CsrWifiNmeApPrim) (0x0001 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_AP_START_REQ ((CsrWifiNmeApPrim) (0x0002 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_AP_STOP_REQ ((CsrWifiNmeApPrim) (0x0003 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ ((CsrWifiNmeApPrim) (0x0004 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_AP_STA_REMOVE_REQ ((CsrWifiNmeApPrim) (0x0005 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)) - - -#define CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_HIGHEST (0x0005 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST) - -/* Upstream */ -#define CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) - -#define CSR_WIFI_NME_AP_CONFIG_SET_CFM ((CsrWifiNmeApPrim)(0x0000 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_AP_WPS_REGISTER_CFM ((CsrWifiNmeApPrim)(0x0001 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_AP_START_CFM ((CsrWifiNmeApPrim)(0x0002 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_AP_STOP_CFM ((CsrWifiNmeApPrim)(0x0003 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_AP_STOP_IND ((CsrWifiNmeApPrim)(0x0004 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM ((CsrWifiNmeApPrim)(0x0005 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_AP_STATION_IND ((CsrWifiNmeApPrim)(0x0006 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)) - -#define CSR_WIFI_NME_AP_PRIM_UPSTREAM_HIGHEST (0x0006 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST) - -#define CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST) -#define CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT (CSR_WIFI_NME_AP_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST) - -/******************************************************************************* - - NAME - CsrWifiNmeApConfigSetReq - - DESCRIPTION - This primitive passes AP configuration info for NME. This can be sent at - any time but will be acted upon when the AP is started again. This - information is common to both P2P GO and AP - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - apConfig - AP configuration for the NME. - apMacConfig - MAC configuration to be acted on when - CSR_WIFI_NME_AP_START.request is sent. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiNmeApConfig apConfig; - CsrWifiSmeApMacConfig apMacConfig; -} CsrWifiNmeApConfigSetReq; - -/******************************************************************************* - - NAME - CsrWifiNmeApWpsRegisterReq - - DESCRIPTION - This primitive allows the NME to accept the WPS registration from an - enrollee. Such registration procedure can be cancelled by sending - CSR_WIFI_NME_WPS_CANCEL.request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an - interface - selectedDevicePasswordId - Selected password type - selectedConfigMethod - Selected WPS configuration method type - pin - PIN value. - Relevant if selected device password ID is PIN.4 - digit pin is passed by sending the pin digits in - pin[0]..pin[3] and rest of the contents filled - with '-'. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeWpsDpid selectedDevicePasswordId; - CsrWifiSmeWpsConfigType selectedConfigMethod; - u8 pin[8]; -} CsrWifiNmeApWpsRegisterReq; - -/******************************************************************************* - - NAME - CsrWifiNmeApStartReq - - DESCRIPTION - This primitive requests NME to started the AP operation. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface identifier; unique identifier of an interface - apType - AP Type specifies the Legacy AP or P2P GO operation - cloakSsid - Indicates whether the SSID should be cloaked (hidden and - not broadcast in beacon) or not - ssid - Service Set Identifier - ifIndex - Radio interface - channel - Channel number of the channel to use - apCredentials - Security credential configuration. - maxConnections - Maximum number of stations/P2P clients allowed - p2pGoParam - P2P specific GO parameters. - wpsEnabled - Indicates whether WPS should be enabled or not - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeApType apType; - u8 cloakSsid; - CsrWifiSsid ssid; - CsrWifiSmeRadioIF ifIndex; - u8 channel; - CsrWifiNmeApCredentials apCredentials; - u8 maxConnections; - CsrWifiSmeApP2pGoConfig p2pGoParam; - u8 wpsEnabled; -} CsrWifiNmeApStartReq; - -/******************************************************************************* - - NAME - CsrWifiNmeApStopReq - - DESCRIPTION - This primitive requests NME to stop the AP operation. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface identifier; unique identifier of an interface - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiNmeApStopReq; - -/******************************************************************************* - - NAME - CsrWifiNmeApWmmParamUpdateReq - - DESCRIPTION - Application uses this primitive to update the WMM parameters - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - wmmApParams - WMM Access point parameters per access category. The array - index corresponds to the ACI - wmmApBcParams - WMM station parameters per access category to be advertised - in the beacons and probe response The array index - corresponds to the ACI - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeWmmAcParams wmmApParams[4]; - CsrWifiSmeWmmAcParams wmmApBcParams[4]; -} CsrWifiNmeApWmmParamUpdateReq; - -/******************************************************************************* - - NAME - CsrWifiNmeApStaRemoveReq - - DESCRIPTION - This primitive disconnects a connected station. If keepBlocking is set to - TRUE, the station with the specified MAC address is not allowed to - connect. If the requested station is not already connected,it may be - blocked based on keepBlocking parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - staMacAddress - Mac Address of the station to be disconnected or blocked - keepBlocking - If TRUE, the station is blocked. If FALSE and the station is - connected, disconnect the station. If FALSE and the station - is not connected, no action is taken. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiMacAddress staMacAddress; - u8 keepBlocking; -} CsrWifiNmeApStaRemoveReq; - -/******************************************************************************* - - NAME - CsrWifiNmeApConfigSetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Status of the request. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiNmeApConfigSetCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeApWpsRegisterCfm - - DESCRIPTION - This primitive reports the result of WPS procedure. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface identifier; unique identifier of an interface - status - Status of the request. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiNmeApWpsRegisterCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeApStartCfm - - DESCRIPTION - This primitive reports the result of CSR_WIFI_NME_AP_START.request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface identifier; unique identifier of an interface - status - Status of the request. - ssid - Service Set Identifier - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSsid ssid; -} CsrWifiNmeApStartCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeApStopCfm - - DESCRIPTION - This primitive confirms that the AP operation is stopped. NME shall send - this primitive in response to the request even if AP operation has - already been stopped - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface identifier; unique identifier of an interface - status - Status of the request. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiNmeApStopCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeApStopInd - - DESCRIPTION - Indicates that AP operation had stopped because of some unrecoverable - error after AP operation was started successfully. NME sends this signal - after failing to restart the AP operation internally following an error - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - apType - Reports AP Type (P2PGO or AP) - status - Error Status - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeApType apType; - CsrResult status; -} CsrWifiNmeApStopInd; - -/******************************************************************************* - - NAME - CsrWifiNmeApWmmParamUpdateCfm - - DESCRIPTION - A confirm for for the WMM parameters update - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Status of the request. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiNmeApWmmParamUpdateCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeApStationInd - - DESCRIPTION - This primitive indicates that a station has joined or a previously joined - station has left the BSS/group - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - mediaStatus - Indicates whether the station is connected or - disconnected - peerMacAddress - MAC address of the station - peerDeviceAddress - P2P Device Address - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeMediaStatus mediaStatus; - CsrWifiMacAddress peerMacAddress; - CsrWifiMacAddress peerDeviceAddress; -} CsrWifiNmeApStationInd; - -#endif /* CSR_WIFI_NME_AP_PRIM_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_nme_ap_sef.c b/drivers/staging/csr/csr_wifi_nme_ap_sef.c deleted file mode 100644 index bfebb1529779..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_ap_sef.c +++ /dev/null @@ -1,30 +0,0 @@ -/***************************************************************************** - - FILE: csr_wifi_nme_sef.c - - (c) Cambridge Silicon Radio Limited 2010 - - Refer to LICENSE.txt included with this source for details - on the license terms. - - *****************************************************************************/ -#include "csr_wifi_nme_ap_sef.h" -#include "unifi_priv.h" - -void CsrWifiNmeApUpstreamStateHandlers(void* drvpriv, CsrWifiFsmEvent* msg) -{ - switch(msg->type) { - case CSR_WIFI_NME_AP_START_CFM: - CsrWifiNmeApStartCfmHandler(drvpriv, msg); - break; - case CSR_WIFI_NME_AP_STOP_CFM: - CsrWifiNmeApStopCfmHandler(drvpriv, msg); - break; - case CSR_WIFI_NME_AP_CONFIG_SET_CFM: - CsrWifiNmeApConfigSetCfmHandler(drvpriv, msg); - break; - default: - unifi_error(drvpriv, "CsrWifiNmeApUpstreamStateHandlers: unhandled NME_AP message type 0x%.4X\n", msg->type); - break; - } -} diff --git a/drivers/staging/csr/csr_wifi_nme_ap_sef.h b/drivers/staging/csr/csr_wifi_nme_ap_sef.h deleted file mode 100644 index 3daaa0944dba..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_ap_sef.h +++ /dev/null @@ -1,21 +0,0 @@ -/***************************************************************************** - FILE: csr_wifi_nme_sef.h - (c) Cambridge Silicon Radio Limited 2010 - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ -#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_NME_H__ -#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_NME_H__ - -#include "csr_wifi_nme_prim.h" - -void CsrWifiNmeApUpstreamStateHandlers(void* drvpriv, CsrWifiFsmEvent* msg); - - -extern void CsrWifiNmeApConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); -extern void CsrWifiNmeApStartCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); -extern void CsrWifiNmeApStopCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg); - -#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_NME_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c deleted file mode 100644 index 1a901a70d195..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ /dev/null @@ -1,909 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ -#include <linux/string.h> -#include <linux/slab.h> -#include "csr_msgconv.h" - -#ifdef CSR_WIFI_NME_ENABLE -#ifdef CSR_WIFI_AP_ENABLE - -#include "csr_wifi_nme_ap_prim.h" -#include "csr_wifi_nme_ap_serialize.h" - -void CsrWifiNmeApPfree(void *ptr) -{ - kfree(ptr); -} - - -size_t CsrWifiNmeApConfigSetReqSizeof(void *msg) -{ - CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 104) */ - bufferSize += 2; /* u16 primitive->apConfig.apGroupkeyTimeout */ - bufferSize += 1; /* u8 primitive->apConfig.apStrictGtkRekey */ - bufferSize += 2; /* u16 primitive->apConfig.apGmkTimeout */ - bufferSize += 2; /* u16 primitive->apConfig.apResponseTimeout */ - bufferSize += 1; /* u8 primitive->apConfig.apRetransLimit */ - bufferSize += 1; /* CsrWifiSmeApPhySupportMask primitive->apMacConfig.phySupportedBitmap */ - bufferSize += 2; /* u16 primitive->apMacConfig.beaconInterval */ - bufferSize += 1; /* u8 primitive->apMacConfig.dtimPeriod */ - bufferSize += 2; /* u16 primitive->apMacConfig.maxListenInterval */ - bufferSize += 1; /* u8 primitive->apMacConfig.supportedRatesCount */ - bufferSize += 20; /* u8 primitive->apMacConfig.supportedRates[20] */ - bufferSize += 1; /* CsrWifiSmePreambleType primitive->apMacConfig.preamble */ - bufferSize += 1; /* u8 primitive->apMacConfig.shortSlotTimeEnabled */ - bufferSize += 1; /* CsrWifiSmeCtsProtectionType primitive->apMacConfig.ctsProtectionType */ - bufferSize += 1; /* u8 primitive->apMacConfig.wmmEnabled */ - { - u16 i2; - for (i2 = 0; i2 < 4; i2++) - { - bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].cwMin */ - bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].cwMax */ - bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].aifs */ - bufferSize += 2; /* u16 primitive->apMacConfig.wmmApParams[i2].txopLimit */ - bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory */ - } - } - { - u16 i2; - for (i2 = 0; i2 < 4; i2++) - { - bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].cwMin */ - bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].cwMax */ - bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].aifs */ - bufferSize += 2; /* u16 primitive->apMacConfig.wmmApBcParams[i2].txopLimit */ - bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory */ - } - } - bufferSize += 1; /* CsrWifiSmeApAccessType primitive->apMacConfig.accessType */ - bufferSize += 1; /* u8 primitive->apMacConfig.macAddressListCount */ - { - u16 i2; - for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) - { - bufferSize += 6; /* u8 primitive->apMacConfig.macAddressList[i2].a[6] */ - } - } - bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.greenfieldSupported */ - bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.shortGi20MHz */ - bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.rxStbc */ - bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.rifsModeAllowed */ - bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.htProtection */ - bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.dualCtsProtection */ - return bufferSize; -} - - -u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->apConfig.apGroupkeyTimeout); - CsrUint8Ser(ptr, len, (u8) primitive->apConfig.apStrictGtkRekey); - CsrUint16Ser(ptr, len, (u16) primitive->apConfig.apGmkTimeout); - CsrUint16Ser(ptr, len, (u16) primitive->apConfig.apResponseTimeout); - CsrUint8Ser(ptr, len, (u8) primitive->apConfig.apRetransLimit); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.phySupportedBitmap); - CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.beaconInterval); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.dtimPeriod); - CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.maxListenInterval); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.supportedRatesCount); - CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.supportedRates, ((u16) (20))); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.preamble); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.shortSlotTimeEnabled); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.ctsProtectionType); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmEnabled); - { - u16 i2; - for (i2 = 0; i2 < 4; i2++) - { - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].cwMin); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].cwMax); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].aifs); - CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.wmmApParams[i2].txopLimit); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory); - } - } - { - u16 i2; - for (i2 = 0; i2 < 4; i2++) - { - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].cwMin); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].cwMax); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].aifs); - CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.wmmApBcParams[i2].txopLimit); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory); - } - } - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.accessType); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.macAddressListCount); - { - u16 i2; - for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.macAddressList[i2].a, ((u16) (6))); - } - } - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.greenfieldSupported); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.shortGi20MHz); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.rxStbc); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.rifsModeAllowed); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.htProtection); - CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.dualCtsProtection); - return(ptr); -} - - -void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiNmeApConfigSetReq *primitive = kmalloc(sizeof(CsrWifiNmeApConfigSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->apConfig.apGroupkeyTimeout, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apConfig.apStrictGtkRekey, buffer, &offset); - CsrUint16Des((u16 *) &primitive->apConfig.apGmkTimeout, buffer, &offset); - CsrUint16Des((u16 *) &primitive->apConfig.apResponseTimeout, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apConfig.apRetransLimit, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.phySupportedBitmap, buffer, &offset); - CsrUint16Des((u16 *) &primitive->apMacConfig.beaconInterval, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.dtimPeriod, buffer, &offset); - CsrUint16Des((u16 *) &primitive->apMacConfig.maxListenInterval, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.supportedRatesCount, buffer, &offset); - CsrMemCpyDes(primitive->apMacConfig.supportedRates, buffer, &offset, ((u16) (20))); - CsrUint8Des((u8 *) &primitive->apMacConfig.preamble, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.shortSlotTimeEnabled, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.ctsProtectionType, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.wmmEnabled, buffer, &offset); - { - u16 i2; - for (i2 = 0; i2 < 4; i2++) - { - CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].cwMin, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].cwMax, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].aifs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->apMacConfig.wmmApParams[i2].txopLimit, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory, buffer, &offset); - } - } - { - u16 i2; - for (i2 = 0; i2 < 4; i2++) - { - CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMin, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMax, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].aifs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->apMacConfig.wmmApBcParams[i2].txopLimit, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory, buffer, &offset); - } - } - CsrUint8Des((u8 *) &primitive->apMacConfig.accessType, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.macAddressListCount, buffer, &offset); - primitive->apMacConfig.macAddressList = NULL; - if (primitive->apMacConfig.macAddressListCount) - { - primitive->apMacConfig.macAddressList = kmalloc(sizeof(CsrWifiMacAddress) * primitive->apMacConfig.macAddressListCount, GFP_KERNEL); - } - { - u16 i2; - for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++) - { - CsrMemCpyDes(primitive->apMacConfig.macAddressList[i2].a, buffer, &offset, ((u16) (6))); - } - } - CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.greenfieldSupported, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.shortGi20MHz, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.rxStbc, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.rifsModeAllowed, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.htProtection, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.dualCtsProtection, buffer, &offset); - - return primitive; -} - - -void CsrWifiNmeApConfigSetReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) voidPrimitivePointer; - kfree(primitive->apMacConfig.macAddressList); - kfree(primitive); -} - - -size_t CsrWifiNmeApWpsRegisterReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiSmeWpsDpid primitive->selectedDevicePasswordId */ - bufferSize += 2; /* CsrWifiSmeWpsConfigType primitive->selectedConfigMethod */ - bufferSize += 8; /* u8 primitive->pin[8] */ - return bufferSize; -} - - -u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiNmeApWpsRegisterReq *primitive = (CsrWifiNmeApWpsRegisterReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->selectedDevicePasswordId); - CsrUint16Ser(ptr, len, (u16) primitive->selectedConfigMethod); - CsrMemCpySer(ptr, len, (const void *) primitive->pin, ((u16) (8))); - return(ptr); -} - - -void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, size_t length) -{ - CsrWifiNmeApWpsRegisterReq *primitive = kmalloc(sizeof(CsrWifiNmeApWpsRegisterReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->selectedDevicePasswordId, buffer, &offset); - CsrUint16Des((u16 *) &primitive->selectedConfigMethod, buffer, &offset); - CsrMemCpyDes(primitive->pin, buffer, &offset, ((u16) (8))); - - return primitive; -} - - -size_t CsrWifiNmeApStartReqSizeof(void *msg) -{ - CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 112) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiSmeApType primitive->apType */ - bufferSize += 1; /* u8 primitive->cloakSsid */ - bufferSize += 32; /* u8 primitive->ssid.ssid[32] */ - bufferSize += 1; /* u8 primitive->ssid.length */ - bufferSize += 1; /* CsrWifiSmeRadioIF primitive->ifIndex */ - bufferSize += 1; /* u8 primitive->channel */ - bufferSize += 1; /* CsrWifiSmeApAuthType primitive->apCredentials.authType */ - switch (primitive->apCredentials.authType) - { - case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM: - bufferSize += 1; /* u8 primitive->apCredentials.nmeAuthType.openSystemEmpty.empty */ - break; - case CSR_WIFI_SME_AP_AUTH_TYPE_WEP: - bufferSize += 1; /* CsrWifiSmeWepCredentialType primitive->apCredentials.nmeAuthType.authwep.wepKeyType */ - switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType) - { - case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: - bufferSize += 1; /* CsrWifiSmeWepAuthMode primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType */ - bufferSize += 1; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey */ - bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1[13] */ - bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2[13] */ - bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3[13] */ - bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4[13] */ - break; - case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: - bufferSize += 1; /* CsrWifiSmeWepAuthMode primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType */ - bufferSize += 1; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey */ - bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1[5] */ - bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2[5] */ - bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3[5] */ - bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4[5] */ - break; - default: - break; - } - break; - case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: - bufferSize += 1; /* CsrWifiSmeApAuthSupportMask primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport */ - bufferSize += 2; /* CsrWifiSmeApRsnCapabilitiesMask primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities */ - bufferSize += 2; /* CsrWifiSmeApWapiCapabilitiesMask primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities */ - bufferSize += 1; /* CsrWifiNmeApPersCredentialType primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase */ - switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) - { - case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: - bufferSize += 2; /* u16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode */ - bufferSize += 32; /* u8 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk[32] */ - break; - case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: - bufferSize += 2; /* u16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode */ - bufferSize += (primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase ? strlen(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase) : 0) + 1; /* char* primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase (0 byte len + 1 for NULL Term) */ - break; - default: - break; - } - break; - default: - break; - } - bufferSize += 1; /* u8 primitive->maxConnections */ - bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->p2pGoParam.groupCapability */ - bufferSize += 3; /* u8 primitive->p2pGoParam.operatingChanList.country[3] */ - bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryListCount */ - { - u16 i3; - for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) - { - bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass */ - bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount */ - bufferSize += primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel */ - } - } - bufferSize += 1; /* u8 primitive->p2pGoParam.opPsEnabled */ - bufferSize += 1; /* u8 primitive->p2pGoParam.ctWindow */ - bufferSize += 1; /* CsrWifiSmeP2pNoaConfigMethod primitive->p2pGoParam.noaConfigMethod */ - bufferSize += 1; /* u8 primitive->p2pGoParam.allowNoaWithNonP2pDevices */ - bufferSize += 1; /* u8 primitive->wpsEnabled */ - return bufferSize; -} - - -u8* CsrWifiNmeApStartReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->apType); - CsrUint8Ser(ptr, len, (u8) primitive->cloakSsid); - CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->ssid.length); - CsrUint8Ser(ptr, len, (u8) primitive->ifIndex); - CsrUint8Ser(ptr, len, (u8) primitive->channel); - CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.authType); - switch (primitive->apCredentials.authType) - { - case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM: - CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.openSystemEmpty.empty); - break; - case CSR_WIFI_SME_AP_AUTH_TYPE_WEP: - CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepKeyType); - switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType) - { - case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: - CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType); - CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, ((u16) (13))); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, ((u16) (13))); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, ((u16) (13))); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, ((u16) (13))); - break; - case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: - CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType); - CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, ((u16) (5))); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, ((u16) (5))); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, ((u16) (5))); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4, ((u16) (5))); - break; - default: - break; - } - break; - case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: - CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport); - CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities); - CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities); - CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase); - switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) - { - case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: - CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode); - CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk, ((u16) (32))); - break; - case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: - CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode); - CsrCharStringSer(ptr, len, primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); - break; - default: - break; - } - break; - default: - break; - } - CsrUint8Ser(ptr, len, (u8) primitive->maxConnections); - CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.groupCapability); - CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.country, ((u16) (3))); - CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryListCount); - { - u16 i3; - for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) - { - CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass); - CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount); - if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount) - { - CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, ((u16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); - } - } - } - CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.opPsEnabled); - CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.ctWindow); - CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.noaConfigMethod); - CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.allowNoaWithNonP2pDevices); - CsrUint8Ser(ptr, len, (u8) primitive->wpsEnabled); - return(ptr); -} - - -void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t length) -{ - CsrWifiNmeApStartReq *primitive = kmalloc(sizeof(CsrWifiNmeApStartReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apType, buffer, &offset); - CsrUint8Des((u8 *) &primitive->cloakSsid, buffer, &offset); - CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset); - CsrUint8Des((u8 *) &primitive->ifIndex, buffer, &offset); - CsrUint8Des((u8 *) &primitive->channel, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apCredentials.authType, buffer, &offset); - switch (primitive->apCredentials.authType) - { - case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM: - CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.openSystemEmpty.empty, buffer, &offset); - break; - case CSR_WIFI_SME_AP_AUTH_TYPE_WEP: - CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepKeyType, buffer, &offset); - switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType) - { - case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128: - CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey, buffer, &offset); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, buffer, &offset, ((u16) (13))); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, buffer, &offset, ((u16) (13))); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, buffer, &offset, ((u16) (13))); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, buffer, &offset, ((u16) (13))); - break; - case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64: - CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey, buffer, &offset); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, buffer, &offset, ((u16) (5))); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, buffer, &offset, ((u16) (5))); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, buffer, &offset, ((u16) (5))); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4, buffer, &offset, ((u16) (5))); - break; - default: - break; - } - break; - case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: - CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport, buffer, &offset); - CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities, buffer, &offset); - CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase, buffer, &offset); - switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) - { - case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK: - CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode, buffer, &offset); - CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk, buffer, &offset, ((u16) (32))); - break; - case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: - CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode, buffer, &offset); - CsrCharStringDes(&primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase, buffer, &offset); - break; - default: - break; - } - break; - default: - break; - } - CsrUint8Des((u8 *) &primitive->maxConnections, buffer, &offset); - CsrUint8Des((u8 *) &primitive->p2pGoParam.groupCapability, buffer, &offset); - CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.country, buffer, &offset, ((u16) (3))); - CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryListCount, buffer, &offset); - primitive->p2pGoParam.operatingChanList.channelEntryList = NULL; - if (primitive->p2pGoParam.operatingChanList.channelEntryListCount) - { - primitive->p2pGoParam.operatingChanList.channelEntryList = kmalloc(sizeof(CsrWifiSmeApP2pOperatingChanEntry) * primitive->p2pGoParam.operatingChanList.channelEntryListCount, GFP_KERNEL); - } - { - u16 i3; - for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) - { - CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass, buffer, &offset); - CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, buffer, &offset); - if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount) - { - primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = kmalloc(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, GFP_KERNEL); - CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, buffer, &offset, ((u16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); - } - else - { - primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = NULL; - } - } - } - CsrUint8Des((u8 *) &primitive->p2pGoParam.opPsEnabled, buffer, &offset); - CsrUint8Des((u8 *) &primitive->p2pGoParam.ctWindow, buffer, &offset); - CsrUint8Des((u8 *) &primitive->p2pGoParam.noaConfigMethod, buffer, &offset); - CsrUint8Des((u8 *) &primitive->p2pGoParam.allowNoaWithNonP2pDevices, buffer, &offset); - CsrUint8Des((u8 *) &primitive->wpsEnabled, buffer, &offset); - - return primitive; -} - - -void CsrWifiNmeApStartReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) voidPrimitivePointer; - switch (primitive->apCredentials.authType) - { - case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL: - switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase) - { - case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE: - kfree(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase); - break; - default: - break; - } - break; - default: - break; - } - { - u16 i3; - for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++) - { - kfree(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel); - } - } - kfree(primitive->p2pGoParam.operatingChanList.channelEntryList); - kfree(primitive); -} - - -size_t CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 51) */ - { - u16 i1; - for (i1 = 0; i1 < 4; i1++) - { - bufferSize += 1; /* u8 primitive->wmmApParams[i1].cwMin */ - bufferSize += 1; /* u8 primitive->wmmApParams[i1].cwMax */ - bufferSize += 1; /* u8 primitive->wmmApParams[i1].aifs */ - bufferSize += 2; /* u16 primitive->wmmApParams[i1].txopLimit */ - bufferSize += 1; /* u8 primitive->wmmApParams[i1].admissionControlMandatory */ - } - } - { - u16 i1; - for (i1 = 0; i1 < 4; i1++) - { - bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].cwMin */ - bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].cwMax */ - bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].aifs */ - bufferSize += 2; /* u16 primitive->wmmApBcParams[i1].txopLimit */ - bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].admissionControlMandatory */ - } - } - return bufferSize; -} - - -u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiNmeApWmmParamUpdateReq *primitive = (CsrWifiNmeApWmmParamUpdateReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - { - u16 i1; - for (i1 = 0; i1 < 4; i1++) - { - CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].cwMin); - CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].cwMax); - CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].aifs); - CsrUint16Ser(ptr, len, (u16) primitive->wmmApParams[i1].txopLimit); - CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].admissionControlMandatory); - } - } - { - u16 i1; - for (i1 = 0; i1 < 4; i1++) - { - CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].cwMin); - CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].cwMax); - CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].aifs); - CsrUint16Ser(ptr, len, (u16) primitive->wmmApBcParams[i1].txopLimit); - CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].admissionControlMandatory); - } - } - return(ptr); -} - - -void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, size_t length) -{ - CsrWifiNmeApWmmParamUpdateReq *primitive = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - { - u16 i1; - for (i1 = 0; i1 < 4; i1++) - { - CsrUint8Des((u8 *) &primitive->wmmApParams[i1].cwMin, buffer, &offset); - CsrUint8Des((u8 *) &primitive->wmmApParams[i1].cwMax, buffer, &offset); - CsrUint8Des((u8 *) &primitive->wmmApParams[i1].aifs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->wmmApParams[i1].txopLimit, buffer, &offset); - CsrUint8Des((u8 *) &primitive->wmmApParams[i1].admissionControlMandatory, buffer, &offset); - } - } - { - u16 i1; - for (i1 = 0; i1 < 4; i1++) - { - CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].cwMin, buffer, &offset); - CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].cwMax, buffer, &offset); - CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].aifs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->wmmApBcParams[i1].txopLimit, buffer, &offset); - CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].admissionControlMandatory, buffer, &offset); - } - } - - return primitive; -} - - -size_t CsrWifiNmeApStaRemoveReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 6; /* u8 primitive->staMacAddress.a[6] */ - bufferSize += 1; /* u8 primitive->keepBlocking */ - return bufferSize; -} - - -u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiNmeApStaRemoveReq *primitive = (CsrWifiNmeApStaRemoveReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->staMacAddress.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->keepBlocking); - return(ptr); -} - - -void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, size_t length) -{ - CsrWifiNmeApStaRemoveReq *primitive = kmalloc(sizeof(CsrWifiNmeApStaRemoveReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->staMacAddress.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->keepBlocking, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiNmeApWpsRegisterCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiNmeApWpsRegisterCfm *primitive = (CsrWifiNmeApWpsRegisterCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, size_t length) -{ - CsrWifiNmeApWpsRegisterCfm *primitive = kmalloc(sizeof(CsrWifiNmeApWpsRegisterCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiNmeApStartCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 40) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 32; /* u8 primitive->ssid.ssid[32] */ - bufferSize += 1; /* u8 primitive->ssid.length */ - return bufferSize; -} - - -u8* CsrWifiNmeApStartCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiNmeApStartCfm *primitive = (CsrWifiNmeApStartCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->ssid.length); - return(ptr); -} - - -void* CsrWifiNmeApStartCfmDes(u8 *buffer, size_t length) -{ - CsrWifiNmeApStartCfm *primitive = kmalloc(sizeof(CsrWifiNmeApStartCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiNmeApStopCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiNmeApStopCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiNmeApStopCfm *primitive = (CsrWifiNmeApStopCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiNmeApStopCfmDes(u8 *buffer, size_t length) -{ - CsrWifiNmeApStopCfm *primitive = kmalloc(sizeof(CsrWifiNmeApStopCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiNmeApStopIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiSmeApType primitive->apType */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiNmeApStopIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiNmeApStopInd *primitive = (CsrWifiNmeApStopInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->apType); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiNmeApStopIndDes(u8 *buffer, size_t length) -{ - CsrWifiNmeApStopInd *primitive = kmalloc(sizeof(CsrWifiNmeApStopInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->apType, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiNmeApStationIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiSmeMediaStatus primitive->mediaStatus */ - bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - bufferSize += 6; /* u8 primitive->peerDeviceAddress.a[6] */ - return bufferSize; -} - - -u8* CsrWifiNmeApStationIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiNmeApStationInd *primitive = (CsrWifiNmeApStationInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); - CsrMemCpySer(ptr, len, (const void *) primitive->peerDeviceAddress.a, ((u16) (6))); - return(ptr); -} - - -void* CsrWifiNmeApStationIndDes(u8 *buffer, size_t length) -{ - CsrWifiNmeApStationInd *primitive = kmalloc(sizeof(CsrWifiNmeApStationInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); - CsrMemCpyDes(primitive->peerDeviceAddress.a, buffer, &offset, ((u16) (6))); - - return primitive; -} - - -#endif /* CSR_WIFI_NME_ENABLE */ -#endif /* CSR_WIFI_AP_ENABLE */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h b/drivers/staging/csr/csr_wifi_nme_ap_serialize.h deleted file mode 100644 index c04585e72460..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h +++ /dev/null @@ -1,94 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_NME_AP_SERIALIZE_H__ -#define CSR_WIFI_NME_AP_SERIALIZE_H__ - -#include "csr_wifi_msgconv.h" - -#include "csr_wifi_nme_ap_prim.h" - -#ifndef CSR_WIFI_NME_ENABLE -#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_serialize.h -#endif -#ifndef CSR_WIFI_AP_ENABLE -#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_serialize.h -#endif - -extern void CsrWifiNmeApPfree(void *ptr); - -extern u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeApConfigSetReqSizeof(void *msg); -extern void CsrWifiNmeApConfigSetReqSerFree(void *msg); - -extern u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeApWpsRegisterReqSizeof(void *msg); -#define CsrWifiNmeApWpsRegisterReqSerFree CsrWifiNmeApPfree - -extern u8* CsrWifiNmeApStartReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeApStartReqSizeof(void *msg); -extern void CsrWifiNmeApStartReqSerFree(void *msg); - -#define CsrWifiNmeApStopReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiNmeApStopReqDes CsrWifiEventCsrUint16Des -#define CsrWifiNmeApStopReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiNmeApStopReqSerFree CsrWifiNmeApPfree - -extern u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg); -#define CsrWifiNmeApWmmParamUpdateReqSerFree CsrWifiNmeApPfree - -extern u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeApStaRemoveReqSizeof(void *msg); -#define CsrWifiNmeApStaRemoveReqSerFree CsrWifiNmeApPfree - -#define CsrWifiNmeApConfigSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiNmeApConfigSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiNmeApConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiNmeApConfigSetCfmSerFree CsrWifiNmeApPfree - -extern u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeApWpsRegisterCfmSizeof(void *msg); -#define CsrWifiNmeApWpsRegisterCfmSerFree CsrWifiNmeApPfree - -extern u8* CsrWifiNmeApStartCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeApStartCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeApStartCfmSizeof(void *msg); -#define CsrWifiNmeApStartCfmSerFree CsrWifiNmeApPfree - -extern u8* CsrWifiNmeApStopCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeApStopCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeApStopCfmSizeof(void *msg); -#define CsrWifiNmeApStopCfmSerFree CsrWifiNmeApPfree - -extern u8* CsrWifiNmeApStopIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeApStopIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeApStopIndSizeof(void *msg); -#define CsrWifiNmeApStopIndSerFree CsrWifiNmeApPfree - -#define CsrWifiNmeApWmmParamUpdateCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiNmeApWmmParamUpdateCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiNmeApWmmParamUpdateCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiNmeApWmmParamUpdateCfmSerFree CsrWifiNmeApPfree - -extern u8* CsrWifiNmeApStationIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeApStationIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeApStationIndSizeof(void *msg); -#define CsrWifiNmeApStationIndSerFree CsrWifiNmeApPfree - -#endif /* CSR_WIFI_NME_AP_SERIALIZE_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_converter_init.h b/drivers/staging/csr/csr_wifi_nme_converter_init.h deleted file mode 100644 index 85e6f5f57130..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_converter_init.h +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_NME_CONVERTER_INIT_H__ -#define CSR_WIFI_NME_CONVERTER_INIT_H__ - -#ifndef CSR_WIFI_NME_ENABLE -#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_converter_init.h -#endif - -#ifndef EXCLUDE_CSR_WIFI_NME_MODULE - -#include "csr_msgconv.h" - -#ifdef CSR_LOG_ENABLE -#include "csr_log.h" - -extern const CsrLogPrimitiveInformation* CsrWifiNmeTechInfoGet(void); -#endif /* CSR_LOG_ENABLE */ - -extern void CsrWifiNmeConverterInit(void); - -#else /* EXCLUDE_CSR_WIFI_NME_MODULE */ - -#define CsrWifiNmeConverterInit() - -#endif /* EXCLUDE_CSR_WIFI_NME_MODULE */ - -#endif /* CSR_WIFI_NME_CONVERTER_INIT_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_lib.h b/drivers/staging/csr/csr_wifi_nme_lib.h deleted file mode 100644 index 5a1f132009bf..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_lib.h +++ /dev/null @@ -1,991 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_NME_LIB_H__ -#define CSR_WIFI_NME_LIB_H__ - -#include "csr_sched.h" -#include "csr_macro.h" -#include "csr_msg_transport.h" - -#include "csr_wifi_lib.h" - -#include "csr_wifi_nme_prim.h" -#include "csr_wifi_nme_task.h" - - -#ifndef CSR_WIFI_NME_ENABLE -#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_lib.h -#endif - -/******************************************************************************* - - NAME - CsrWifiNmeConnectionStatusGetReqSend - - DESCRIPTION - Requests the current connection status of the NME. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -#define CsrWifiNmeConnectionStatusGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeConnectionStatusGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiNmeConnectionStatusGetReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiNmeConnectionStatusGetReq *msg__; \ - CsrWifiNmeConnectionStatusGetReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeConnectionStatusGetReqSend(src__, interfaceTag__) \ - CsrWifiNmeConnectionStatusGetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiNmeConnectionStatusGetCfmSend - - DESCRIPTION - Reports the connection status of the NME. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Indicates the success or otherwise of the requested - operation. - connectionStatus - NME current connection status - -*******************************************************************************/ -#define CsrWifiNmeConnectionStatusGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStatus__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeConnectionStatusGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->connectionStatus = (connectionStatus__); - -#define CsrWifiNmeConnectionStatusGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionStatus__) \ - { \ - CsrWifiNmeConnectionStatusGetCfm *msg__; \ - CsrWifiNmeConnectionStatusGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStatus__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeConnectionStatusGetCfmSend(dst__, interfaceTag__, status__, connectionStatus__) \ - CsrWifiNmeConnectionStatusGetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, connectionStatus__) - -/******************************************************************************* - - NAME - CsrWifiNmeEventMaskSetReqSend - - DESCRIPTION - The wireless manager application may register with the NME to receive - notification of interesting events. Indications will be sent only if the - wireless manager explicitly registers to be notified of that event. - indMask is a bit mask of values defined in CsrWifiNmeIndicationsMask. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - indMask - Set mask with values from CsrWifiNmeIndications - -*******************************************************************************/ -#define CsrWifiNmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeEventMaskSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_EVENT_MASK_SET_REQ, dst__, src__); \ - msg__->indMask = (indMask__); - -#define CsrWifiNmeEventMaskSetReqSendTo(dst__, src__, indMask__) \ - { \ - CsrWifiNmeEventMaskSetReq *msg__; \ - CsrWifiNmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeEventMaskSetReqSend(src__, indMask__) \ - CsrWifiNmeEventMaskSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, indMask__) - -/******************************************************************************* - - NAME - CsrWifiNmeEventMaskSetCfmSend - - DESCRIPTION - The NME calls the primitive to report the result of the request - primitive. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiNmeEventMaskSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeEventMaskSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_EVENT_MASK_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiNmeEventMaskSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiNmeEventMaskSetCfm *msg__; \ - CsrWifiNmeEventMaskSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeEventMaskSetCfmSend(dst__, status__) \ - CsrWifiNmeEventMaskSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileConnectReqSend - - DESCRIPTION - Requests the NME to attempt to connect to the specified profile. - Overrides any current connection attempt. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - profileIdentity - Identity (BSSID, SSID) of profile to be connected to. - It must match an existing profile in the NME. - -*******************************************************************************/ -#define CsrWifiNmeProfileConnectReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentity__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeProfileConnectReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_CONNECT_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->profileIdentity = (profileIdentity__); - -#define CsrWifiNmeProfileConnectReqSendTo(dst__, src__, interfaceTag__, profileIdentity__) \ - { \ - CsrWifiNmeProfileConnectReq *msg__; \ - CsrWifiNmeProfileConnectReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentity__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeProfileConnectReqSend(src__, interfaceTag__, profileIdentity__) \ - CsrWifiNmeProfileConnectReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, profileIdentity__) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileConnectCfmSend - - DESCRIPTION - Reports the status of the NME PROFILE CONNECT REQ. If unsuccessful the - connectAttempt parameters contain details of the APs that the NME - attempted to connect to before reporting the failure of the request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an - interface - status - Indicates the success or otherwise of the requested - operation. - connectAttemptsCount - This parameter is relevant only if - status!=CSR_WIFI_NME_STATUS_SUCCESS. - Number of connection attempt elements provided with - this primitive - connectAttempts - This parameter is relevant only if - status!=CSR_WIFI_NME_STATUS_SUCCESS. - Points to the list of connection attempt elements - provided with this primitive - Each element of the list provides information about - an AP on which the connection attempt was made and - the error that occurred during the attempt. - -*******************************************************************************/ -#define CsrWifiNmeProfileConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeProfileConnectCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_CONNECT_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->connectAttemptsCount = (connectAttemptsCount__); \ - msg__->connectAttempts = (connectAttempts__); - -#define CsrWifiNmeProfileConnectCfmSendTo(dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \ - { \ - CsrWifiNmeProfileConnectCfm *msg__; \ - CsrWifiNmeProfileConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeProfileConnectCfmSend(dst__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \ - CsrWifiNmeProfileConnectCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileDeleteAllReqSend - - DESCRIPTION - Deletes all profiles present in the NME, but does NOT modify the - preferred profile list. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiNmeProfileDeleteAllReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteAllReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ, dst__, src__); - -#define CsrWifiNmeProfileDeleteAllReqSendTo(dst__, src__) \ - { \ - CsrWifiNmeProfileDeleteAllReq *msg__; \ - CsrWifiNmeProfileDeleteAllReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeProfileDeleteAllReqSend(src__) \ - CsrWifiNmeProfileDeleteAllReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileDeleteAllCfmSend - - DESCRIPTION - Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ. - Returns always CSR_WIFI_NME_STATUS_SUCCESS. - - PARAMETERS - queue - Destination Task Queue - status - Indicates the success or otherwise of the requested operation, but - in this case it always set to success. - -*******************************************************************************/ -#define CsrWifiNmeProfileDeleteAllCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteAllCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_ALL_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiNmeProfileDeleteAllCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiNmeProfileDeleteAllCfm *msg__; \ - CsrWifiNmeProfileDeleteAllCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeProfileDeleteAllCfmSend(dst__, status__) \ - CsrWifiNmeProfileDeleteAllCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileDeleteReqSend - - DESCRIPTION - Will delete the profile with a matching identity, but does NOT modify the - preferred profile list. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - profileIdentity - Identity (BSSID, SSID) of profile to be deleted. - -*******************************************************************************/ -#define CsrWifiNmeProfileDeleteReqCreate(msg__, dst__, src__, profileIdentity__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_REQ, dst__, src__); \ - msg__->profileIdentity = (profileIdentity__); - -#define CsrWifiNmeProfileDeleteReqSendTo(dst__, src__, profileIdentity__) \ - { \ - CsrWifiNmeProfileDeleteReq *msg__; \ - CsrWifiNmeProfileDeleteReqCreate(msg__, dst__, src__, profileIdentity__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeProfileDeleteReqSend(src__, profileIdentity__) \ - CsrWifiNmeProfileDeleteReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, profileIdentity__) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileDeleteCfmSend - - DESCRIPTION - Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_REQ. - Returns CSR_WIFI_NME_STATUS_NOT_FOUND if there is no matching profile. - - PARAMETERS - queue - Destination Task Queue - status - Indicates the success or otherwise of the requested operation. - -*******************************************************************************/ -#define CsrWifiNmeProfileDeleteCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiNmeProfileDeleteCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiNmeProfileDeleteCfm *msg__; \ - CsrWifiNmeProfileDeleteCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeProfileDeleteCfmSend(dst__, status__) \ - CsrWifiNmeProfileDeleteCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileDisconnectIndSend - - DESCRIPTION - Indication generated from the NME (if an application subscribes to - receive it) that informs that application that the current profile - connection has disconnected. The indication will contain information - about APs that it attempted to maintain the connection via i.e. in the - case of failed roaming. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an - interface - connectAttemptsCount - Number of connection attempt elements provided with - this primitive - connectAttempts - Points to the list of connection attempt elements - provided with this primitive - Each element of the list provides information about - an AP on which the connection attempt was made and - the error occurred during the attempt. - -*******************************************************************************/ -#define CsrWifiNmeProfileDisconnectIndCreate(msg__, dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeProfileDisconnectInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DISCONNECT_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->connectAttemptsCount = (connectAttemptsCount__); \ - msg__->connectAttempts = (connectAttempts__); - -#define CsrWifiNmeProfileDisconnectIndSendTo(dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \ - { \ - CsrWifiNmeProfileDisconnectInd *msg__; \ - CsrWifiNmeProfileDisconnectIndCreate(msg__, dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeProfileDisconnectIndSend(dst__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \ - CsrWifiNmeProfileDisconnectIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, connectAttemptsCount__, connectAttempts__) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileOrderSetReqSend - - DESCRIPTION - Defines the preferred order that profiles present in the NME should be - used during the NME auto-connect behaviour. - If profileIdentitysCount == 0, it removes any existing preferred profile - list already present in the NME, effectively disabling the auto-connect - behaviour. - NOTE: Profile identities that do not match any profile stored in the NME - are ignored during the auto-connect procedure. - NOTE: during auto-connect the NME will only attempt to join an existing - adhoc network and it will never attempt to host an adhoc network; for - hosting and adhoc network, use CSR_WIFI_NME_PROFILE_CONNECT_REQ - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an - interface - profileIdentitysCount - The number of profiles identities in the list. - profileIdentitys - Points to the list of profile identities. - -*******************************************************************************/ -#define CsrWifiNmeProfileOrderSetReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeProfileOrderSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_ORDER_SET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->profileIdentitysCount = (profileIdentitysCount__); \ - msg__->profileIdentitys = (profileIdentitys__); - -#define CsrWifiNmeProfileOrderSetReqSendTo(dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \ - { \ - CsrWifiNmeProfileOrderSetReq *msg__; \ - CsrWifiNmeProfileOrderSetReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeProfileOrderSetReqSend(src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \ - CsrWifiNmeProfileOrderSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileOrderSetCfmSend - - DESCRIPTION - Confirmation to UNIFI_NME_PROFILE_ORDER_SET.request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Indicates the success or otherwise of the requested - operation. - -*******************************************************************************/ -#define CsrWifiNmeProfileOrderSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeProfileOrderSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_ORDER_SET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiNmeProfileOrderSetCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiNmeProfileOrderSetCfm *msg__; \ - CsrWifiNmeProfileOrderSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeProfileOrderSetCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiNmeProfileOrderSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileSetReqSend - - DESCRIPTION - Creates or updates an existing profile in the NME that matches the unique - identity of the profile. Each profile is identified by the combination of - BSSID and SSID. The profile contains all the required credentials for - attempting to connect to the network. Creating or updating a profile via - the NME PROFILE SET REQ does NOT add the profile to the preferred profile - list within the NME used for the NME auto-connect behaviour. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - profile - Specifies the identity and credentials of the network. - -*******************************************************************************/ -#define CsrWifiNmeProfileSetReqCreate(msg__, dst__, src__, profile__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeProfileSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_SET_REQ, dst__, src__); \ - msg__->profile = (profile__); - -#define CsrWifiNmeProfileSetReqSendTo(dst__, src__, profile__) \ - { \ - CsrWifiNmeProfileSetReq *msg__; \ - CsrWifiNmeProfileSetReqCreate(msg__, dst__, src__, profile__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeProfileSetReqSend(src__, profile__) \ - CsrWifiNmeProfileSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, profile__) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileSetCfmSend - - DESCRIPTION - Reports the status of the NME PROFILE SET REQ; the request will only fail - if the details specified in the profile contains an invalid combination - of parameters for example specifying the profile as cloaked but not - specifying the SSID. The NME doesn't limit the number of profiles that - may be created. The NME assumes that the entity configuring it is aware - of the appropriate limits. - - PARAMETERS - queue - Destination Task Queue - status - Indicates the success or otherwise of the requested operation. - -*******************************************************************************/ -#define CsrWifiNmeProfileSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeProfileSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiNmeProfileSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiNmeProfileSetCfm *msg__; \ - CsrWifiNmeProfileSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeProfileSetCfmSend(dst__, status__) \ - CsrWifiNmeProfileSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileUpdateIndSend - - DESCRIPTION - Indication generated from the NME (if an application subscribes to - receive it) that informs that application that the contained profile has - changed. - For example, either the credentials EAP-FAST PAC file or the session data - within the profile has changed. - It is up to the application whether it stores this updated profile or - not. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - profile - The identity and credentials of the network. - -*******************************************************************************/ -#define CsrWifiNmeProfileUpdateIndCreate(msg__, dst__, src__, interfaceTag__, profile__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeProfileUpdateInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_UPDATE_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->profile = (profile__); - -#define CsrWifiNmeProfileUpdateIndSendTo(dst__, src__, interfaceTag__, profile__) \ - { \ - CsrWifiNmeProfileUpdateInd *msg__; \ - CsrWifiNmeProfileUpdateIndCreate(msg__, dst__, src__, interfaceTag__, profile__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeProfileUpdateIndSend(dst__, interfaceTag__, profile__) \ - CsrWifiNmeProfileUpdateIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, profile__) - -/******************************************************************************* - - NAME - CsrWifiNmeSimGsmAuthIndSend - - DESCRIPTION - Indication generated from the NME (if an application subscribes to - receive it) that requests the UICC Manager to perform a GSM - authentication on behalf of the NME. This indication is generated when - the NME is attempting to connect to a profile configured for EAP-SIM. An - application MUST register to receive this indication for the NME to - support the EAP-SIM credential types. Otherwise the NME has no route to - obtain the information from the UICC. EAP-SIM authentication requires 2 - or 3 GSM authentication rounds and therefore 2 or 3 RANDS (GSM Random - Challenges) are included. - - PARAMETERS - queue - Destination Task Queue - randsLength - GSM RAND is 16 bytes long hence valid values are 32 (2 RANDS) - or 48 (3 RANDs). - rands - 2 or 3 RANDs values. - -*******************************************************************************/ -#define CsrWifiNmeSimGsmAuthIndCreate(msg__, dst__, src__, randsLength__, rands__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeSimGsmAuthInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_GSM_AUTH_IND, dst__, src__); \ - msg__->randsLength = (randsLength__); \ - msg__->rands = (rands__); - -#define CsrWifiNmeSimGsmAuthIndSendTo(dst__, src__, randsLength__, rands__) \ - { \ - CsrWifiNmeSimGsmAuthInd *msg__; \ - CsrWifiNmeSimGsmAuthIndCreate(msg__, dst__, src__, randsLength__, rands__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeSimGsmAuthIndSend(dst__, randsLength__, rands__) \ - CsrWifiNmeSimGsmAuthIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, randsLength__, rands__) - -/******************************************************************************* - - NAME - CsrWifiNmeSimGsmAuthResSend - - DESCRIPTION - Response from the application that received the NME SIM GSM AUTH IND. For - each GSM authentication round a GSM Ciphering key (Kc) and a signed - response (SRES) are produced. Since 2 or 3 GSM authentication rounds are - used the 2 or 3 Kc's obtained respectively are combined into one buffer - and similarly the 2 or 3 SRES's obtained are combined into another - buffer. The order of Kc values (SRES values respectively) in their buffer - is the same as that of their corresponding RAND values in the incoming - indication. - - PARAMETERS - status - Indicates the outcome of the requested operation: - STATUS_SUCCESS or STATUS_ERROR - kcsLength - Length in Bytes of Kc buffer. Legal values are: 16 or 24. - kcs - Kc buffer holding 2 or 3 Kc values. - sresLength - Length in Bytes of SRES buffer. Legal values are: 8 or 12. - sres - SRES buffer holding 2 or 3 SRES values. - -*******************************************************************************/ -#define CsrWifiNmeSimGsmAuthResCreate(msg__, dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeSimGsmAuthRes), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_GSM_AUTH_RES, dst__, src__); \ - msg__->status = (status__); \ - msg__->kcsLength = (kcsLength__); \ - msg__->kcs = (kcs__); \ - msg__->sresLength = (sresLength__); \ - msg__->sres = (sres__); - -#define CsrWifiNmeSimGsmAuthResSendTo(dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__) \ - { \ - CsrWifiNmeSimGsmAuthRes *msg__; \ - CsrWifiNmeSimGsmAuthResCreate(msg__, dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeSimGsmAuthResSend(src__, status__, kcsLength__, kcs__, sresLength__, sres__) \ - CsrWifiNmeSimGsmAuthResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, kcsLength__, kcs__, sresLength__, sres__) - -/******************************************************************************* - - NAME - CsrWifiNmeSimImsiGetIndSend - - DESCRIPTION - Indication generated from the NME (if an application subscribes to - receive it) that requests the IMSI and UICC type from the UICC Manager. - This indication is generated when the NME is attempting to connect to a - profile configured for EAP-SIM/AKA. An application MUST register to - receive this indication for the NME to support the EAP-SIM/AKA credential - types. Otherwise the NME has no route to obtain the information from the - UICC. - - PARAMETERS - queue - Destination Task Queue - -*******************************************************************************/ -#define CsrWifiNmeSimImsiGetIndCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeSimImsiGetInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_IMSI_GET_IND, dst__, src__); - -#define CsrWifiNmeSimImsiGetIndSendTo(dst__, src__) \ - { \ - CsrWifiNmeSimImsiGetInd *msg__; \ - CsrWifiNmeSimImsiGetIndCreate(msg__, dst__, src__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeSimImsiGetIndSend(dst__) \ - CsrWifiNmeSimImsiGetIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE) - -/******************************************************************************* - - NAME - CsrWifiNmeSimImsiGetResSend - - DESCRIPTION - Response from the application that received the NME SIM IMSI GET IND. - - PARAMETERS - status - Indicates the outcome of the requested operation: STATUS_SUCCESS - or STATUS_ERROR. - imsi - The value of the IMSI obtained from the UICC. - cardType - The UICC type (GSM only (SIM), UMTS only (USIM), Both). - -*******************************************************************************/ -#define CsrWifiNmeSimImsiGetResCreate(msg__, dst__, src__, status__, imsi__, cardType__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeSimImsiGetRes), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_IMSI_GET_RES, dst__, src__); \ - msg__->status = (status__); \ - msg__->imsi = (imsi__); \ - msg__->cardType = (cardType__); - -#define CsrWifiNmeSimImsiGetResSendTo(dst__, src__, status__, imsi__, cardType__) \ - { \ - CsrWifiNmeSimImsiGetRes *msg__; \ - CsrWifiNmeSimImsiGetResCreate(msg__, dst__, src__, status__, imsi__, cardType__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeSimImsiGetResSend(src__, status__, imsi__, cardType__) \ - CsrWifiNmeSimImsiGetResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, imsi__, cardType__) - -/******************************************************************************* - - NAME - CsrWifiNmeSimUmtsAuthIndSend - - DESCRIPTION - Indication generated from the NME (if an application subscribes to - receive it) that requests the UICC Manager to perform a UMTS - authentication on behalf of the NME. This indication is generated when - the NME is attempting to connect to a profile configured for EAP-AKA. An - application MUST register to receive this indication for the NME to - support the EAP-AKA credential types. Otherwise the NME has no route to - obtain the information from the USIM. EAP-AKA requires one UMTS - authentication round and therefore only one RAND and one AUTN values are - included. - - PARAMETERS - queue - Destination Task Queue - rand - UMTS RAND value. - autn - UMTS AUTN value. - -*******************************************************************************/ -#define CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeSimUmtsAuthInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_IND, dst__, src__); \ - memcpy(msg__->rand, (rand__), sizeof(u8) * 16); \ - memcpy(msg__->autn, (autn__), sizeof(u8) * 16); - -#define CsrWifiNmeSimUmtsAuthIndSendTo(dst__, src__, rand__, autn__) \ - { \ - CsrWifiNmeSimUmtsAuthInd *msg__; \ - CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeSimUmtsAuthIndSend(dst__, rand__, autn__) \ - CsrWifiNmeSimUmtsAuthIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, rand__, autn__) - -/******************************************************************************* - - NAME - CsrWifiNmeSimUmtsAuthResSend - - DESCRIPTION - Response from the application that received the NME SIM UMTS AUTH IND. - The values of umtsCipherKey, umtsIntegrityKey, resParameterLength and - resParameter are only meanigful when result = UMTS_AUTH_RESULT_SUCCESS. - The value of auts is only meaningful when - result=UMTS_AUTH_RESULT_SYNC_FAIL. - - PARAMETERS - status - Indicates the outcome of the requested operation: - STATUS_SUCCESS or STATUS_ERROR. - result - The result of UMTS authentication as performed by the - UICC which could be: Success, Authentication Reject or - Synchronisation Failure. For all these 3 outcomes the - value of status is success. - umtsCipherKey - The UMTS Cipher Key as calculated and returned by the - UICC. - umtsIntegrityKey - The UMTS Integrity Key as calculated and returned by - the UICC. - resParameterLength - The length (in bytes) of the RES parameter (min=4; max - = 16). - resParameter - The RES parameter as calculated and returned by the - UICC. - auts - The AUTS parameter as calculated and returned by the - UICC. - -*******************************************************************************/ -#define CsrWifiNmeSimUmtsAuthResCreate(msg__, dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeSimUmtsAuthRes), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_RES, dst__, src__); \ - msg__->status = (status__); \ - msg__->result = (result__); \ - memcpy(msg__->umtsCipherKey, (umtsCipherKey__), sizeof(u8) * 16); \ - memcpy(msg__->umtsIntegrityKey, (umtsIntegrityKey__), sizeof(u8) * 16); \ - msg__->resParameterLength = (resParameterLength__); \ - msg__->resParameter = (resParameter__); \ - memcpy(msg__->auts, (auts__), sizeof(u8) * 14); - -#define CsrWifiNmeSimUmtsAuthResSendTo(dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \ - { \ - CsrWifiNmeSimUmtsAuthRes *msg__; \ - CsrWifiNmeSimUmtsAuthResCreate(msg__, dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeSimUmtsAuthResSend(src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \ - CsrWifiNmeSimUmtsAuthResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) - -/******************************************************************************* - - NAME - CsrWifiNmeWpsCancelReqSend - - DESCRIPTION - Requests the NME to cancel any WPS procedure that it is currently - performing. This includes WPS registrar activities started because of - CSR_WIFI_NME_AP_REGISTER.request - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -#define CsrWifiNmeWpsCancelReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeWpsCancelReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CANCEL_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiNmeWpsCancelReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiNmeWpsCancelReq *msg__; \ - CsrWifiNmeWpsCancelReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeWpsCancelReqSend(src__, interfaceTag__) \ - CsrWifiNmeWpsCancelReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiNmeWpsCancelCfmSend - - DESCRIPTION - Reports the status of the NME WPS REQ, the request is always SUCCESSFUL. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Only returns CSR_WIFI_NME_STATUS_SUCCESS - -*******************************************************************************/ -#define CsrWifiNmeWpsCancelCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeWpsCancelCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CANCEL_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiNmeWpsCancelCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiNmeWpsCancelCfm *msg__; \ - CsrWifiNmeWpsCancelCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeWpsCancelCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiNmeWpsCancelCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiNmeWpsCfmSend - - DESCRIPTION - Reports the status of the NME WPS REQ. - If CSR_WIFI_NME_STATUS_SUCCESS, the profile parameter contains the - identity and credentials of the AP. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Indicates the success or otherwise of the requested - operation. - profile - This parameter is relevant only if - status==CSR_WIFI_NME_STATUS_SUCCESS. - The identity and credentials of the network. - -*******************************************************************************/ -#define CsrWifiNmeWpsCfmCreate(msg__, dst__, src__, interfaceTag__, status__, profile__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeWpsCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->profile = (profile__); - -#define CsrWifiNmeWpsCfmSendTo(dst__, src__, interfaceTag__, status__, profile__) \ - { \ - CsrWifiNmeWpsCfm *msg__; \ - CsrWifiNmeWpsCfmCreate(msg__, dst__, src__, interfaceTag__, status__, profile__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeWpsCfmSend(dst__, interfaceTag__, status__, profile__) \ - CsrWifiNmeWpsCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, profile__) - -/******************************************************************************* - - NAME - CsrWifiNmeWpsConfigSetReqSend - - DESCRIPTION - This primitive passes the WPS information for the device to NME. This may - be accepted only if no interface is active. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - wpsConfig - WPS config. - -*******************************************************************************/ -#define CsrWifiNmeWpsConfigSetReqCreate(msg__, dst__, src__, wpsConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeWpsConfigSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CONFIG_SET_REQ, dst__, src__); \ - msg__->wpsConfig = (wpsConfig__); - -#define CsrWifiNmeWpsConfigSetReqSendTo(dst__, src__, wpsConfig__) \ - { \ - CsrWifiNmeWpsConfigSetReq *msg__; \ - CsrWifiNmeWpsConfigSetReqCreate(msg__, dst__, src__, wpsConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeWpsConfigSetReqSend(src__, wpsConfig__) \ - CsrWifiNmeWpsConfigSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, wpsConfig__) - -/******************************************************************************* - - NAME - CsrWifiNmeWpsConfigSetCfmSend - - DESCRIPTION - Confirm. - - PARAMETERS - queue - Destination Task Queue - status - Status of the request. - -*******************************************************************************/ -#define CsrWifiNmeWpsConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeWpsConfigSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CONFIG_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiNmeWpsConfigSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiNmeWpsConfigSetCfm *msg__; \ - CsrWifiNmeWpsConfigSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeWpsConfigSetCfmSend(dst__, status__) \ - CsrWifiNmeWpsConfigSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiNmeWpsReqSend - - DESCRIPTION - Requests the NME to look for WPS enabled APs and attempt to perform WPS - to determine the appropriate security credentials to connect to the AP. - If the PIN == '00000000' then 'push button mode' is indicated, otherwise - the PIN has to match that of the AP. 4 digit pin is passed by sending the - pin digits in pin[0]..pin[3] and rest of the contents filled with '-'. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - pin - PIN value. - ssid - Service Set identifier - bssid - ID of Basic Service Set for which a WPS connection attempt is - being made. - -*******************************************************************************/ -#define CsrWifiNmeWpsReqCreate(msg__, dst__, src__, interfaceTag__, pin__, ssid__, bssid__) \ - msg__ = kmalloc(sizeof(CsrWifiNmeWpsReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - memcpy(msg__->pin, (pin__), sizeof(u8) * 8); \ - msg__->ssid = (ssid__); \ - msg__->bssid = (bssid__); - -#define CsrWifiNmeWpsReqSendTo(dst__, src__, interfaceTag__, pin__, ssid__, bssid__) \ - { \ - CsrWifiNmeWpsReq *msg__; \ - CsrWifiNmeWpsReqCreate(msg__, dst__, src__, interfaceTag__, pin__, ssid__, bssid__); \ - CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \ - } - -#define CsrWifiNmeWpsReqSend(src__, interfaceTag__, pin__, ssid__, bssid__) \ - CsrWifiNmeWpsReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, pin__, ssid__, bssid__) - -#endif /* CSR_WIFI_NME_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_nme_prim.h b/drivers/staging/csr/csr_wifi_nme_prim.h deleted file mode 100644 index 9a7927a117ea..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_prim.h +++ /dev/null @@ -1,1657 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_NME_PRIM_H__ -#define CSR_WIFI_NME_PRIM_H__ - -#include <linux/types.h> -#include "csr_prim_defs.h" -#include "csr_sched.h" -#include "csr_wifi_common.h" -#include "csr_result.h" -#include "csr_wifi_fsm_event.h" -#include "csr_wifi_sme_prim.h" - -#ifndef CSR_WIFI_NME_ENABLE -#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_prim.h -#endif - -#define CSR_WIFI_NME_PRIM (0x0424) - -typedef CsrPrim CsrWifiNmePrim; - -typedef void (*CsrWifiNmeFrameFreeFunction)(void *frame); - -/******************************************************************************* - - NAME - CsrWifiNmeAuthMode - - DESCRIPTION - WiFi Authentication Mode - - VALUES - CSR_WIFI_NME_AUTH_MODE_80211_OPEN - - Connects to an open system network (i.e. no authentication, - no encryption) or to a WEP enabled network. - CSR_WIFI_NME_AUTH_MODE_80211_SHARED - - Connect to a WEP enabled network. - CSR_WIFI_NME_AUTH_MODE_8021X_WPA - - Connects to a WPA Enterprise enabled network. - CSR_WIFI_NME_AUTH_MODE_8021X_WPAPSK - - Connects to a WPA with Pre-Shared Key enabled network. - CSR_WIFI_NME_AUTH_MODE_8021X_WPA2 - - Connects to a WPA2 Enterprise enabled network. - CSR_WIFI_NME_AUTH_MODE_8021X_WPA2PSK - - Connects to a WPA2 with Pre-Shared Key enabled network. - CSR_WIFI_NME_AUTH_MODE_8021X_CCKM - - Connects to a CCKM enabled network. - CSR_WIFI_NME_AUTH_MODE_WAPI_WAI - - Connects to a WAPI Enterprise enabled network. - CSR_WIFI_NME_AUTH_MODE_WAPI_WAIPSK - - Connects to a WAPI with Pre-Shared Key enabled network. - CSR_WIFI_NME_AUTH_MODE_8021X_OTHER1X - - For future use. - -*******************************************************************************/ -typedef u16 CsrWifiNmeAuthMode; -#define CSR_WIFI_NME_AUTH_MODE_80211_OPEN ((CsrWifiNmeAuthMode) 0x0001) -#define CSR_WIFI_NME_AUTH_MODE_80211_SHARED ((CsrWifiNmeAuthMode) 0x0002) -#define CSR_WIFI_NME_AUTH_MODE_8021X_WPA ((CsrWifiNmeAuthMode) 0x0004) -#define CSR_WIFI_NME_AUTH_MODE_8021X_WPAPSK ((CsrWifiNmeAuthMode) 0x0008) -#define CSR_WIFI_NME_AUTH_MODE_8021X_WPA2 ((CsrWifiNmeAuthMode) 0x0010) -#define CSR_WIFI_NME_AUTH_MODE_8021X_WPA2PSK ((CsrWifiNmeAuthMode) 0x0020) -#define CSR_WIFI_NME_AUTH_MODE_8021X_CCKM ((CsrWifiNmeAuthMode) 0x0040) -#define CSR_WIFI_NME_AUTH_MODE_WAPI_WAI ((CsrWifiNmeAuthMode) 0x0080) -#define CSR_WIFI_NME_AUTH_MODE_WAPI_WAIPSK ((CsrWifiNmeAuthMode) 0x0100) -#define CSR_WIFI_NME_AUTH_MODE_8021X_OTHER1X ((CsrWifiNmeAuthMode) 0x0200) - -/******************************************************************************* - - NAME - CsrWifiNmeBssType - - DESCRIPTION - Type of BSS - - VALUES - CSR_WIFI_NME_BSS_TYPE_INFRASTRUCTURE - - Infrastructure BSS type where access to the network is via - one or several Access Points. - CSR_WIFI_NME_BSS_TYPE_ADHOC - - Adhoc or Independent BSS Type where one Station acts as a - host and future stations can join the adhoc network without - needing an access point. - CSR_WIFI_NME_BSS_TYPE_RESERVED - - To be in sync with SME.This is not used. - CSR_WIFI_NME_BSS_TYPE_P2P - - P2P mode of operation. - -*******************************************************************************/ -typedef u8 CsrWifiNmeBssType; -#define CSR_WIFI_NME_BSS_TYPE_INFRASTRUCTURE ((CsrWifiNmeBssType) 0x00) -#define CSR_WIFI_NME_BSS_TYPE_ADHOC ((CsrWifiNmeBssType) 0x01) -#define CSR_WIFI_NME_BSS_TYPE_RESERVED ((CsrWifiNmeBssType) 0x02) -#define CSR_WIFI_NME_BSS_TYPE_P2P ((CsrWifiNmeBssType) 0x03) - -/******************************************************************************* - - NAME - CsrWifiNmeCcxOptionsMask - - DESCRIPTION - Enumeration type defining possible mask values for setting CCX options. - - VALUES - CSR_WIFI_NME_CCX_OPTION_NONE - No CCX option is set. - CSR_WIFI_NME_CCX_OPTION_CCKM - CCX option cckm is set. - -*******************************************************************************/ -typedef u8 CsrWifiNmeCcxOptionsMask; -#define CSR_WIFI_NME_CCX_OPTION_NONE ((CsrWifiNmeCcxOptionsMask) 0x00) -#define CSR_WIFI_NME_CCX_OPTION_CCKM ((CsrWifiNmeCcxOptionsMask) 0x01) - -/******************************************************************************* - - NAME - CsrWifiNmeConfigAction - - DESCRIPTION - - VALUES - CSR_WIFI_PIN_ENTRY_PUSH_BUTTON - - CSR_WIFI_PIN_ENTRY_DISPLAY_PIN - - CSR_WIFI_PIN_ENTRY_ENTER_PIN - - -*******************************************************************************/ -typedef u8 CsrWifiNmeConfigAction; -#define CSR_WIFI_PIN_ENTRY_PUSH_BUTTON ((CsrWifiNmeConfigAction) 0x00) -#define CSR_WIFI_PIN_ENTRY_DISPLAY_PIN ((CsrWifiNmeConfigAction) 0x01) -#define CSR_WIFI_PIN_ENTRY_ENTER_PIN ((CsrWifiNmeConfigAction) 0x02) - -/******************************************************************************* - - NAME - CsrWifiNmeConnectionStatus - - DESCRIPTION - Indicate the NME Connection Status when connecting or when disconnecting - - VALUES - CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTED - - NME is disconnected. - CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTING - - NME is in the process of connecting. - CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_AUTHENTICATING - - NME is in the authentication stage of a connection attempt. - CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTED - - NME is connected. - CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTING - - NME is in the process of disconnecting. - -*******************************************************************************/ -typedef u8 CsrWifiNmeConnectionStatus; -#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTED ((CsrWifiNmeConnectionStatus) 0x00) -#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTING ((CsrWifiNmeConnectionStatus) 0x01) -#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_AUTHENTICATING ((CsrWifiNmeConnectionStatus) 0x02) -#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTED ((CsrWifiNmeConnectionStatus) 0x03) -#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTING ((CsrWifiNmeConnectionStatus) 0x04) - -/******************************************************************************* - - NAME - CsrWifiNmeCredentialType - - DESCRIPTION - NME Credential Types - - VALUES - CSR_WIFI_NME_CREDENTIAL_TYPE_OPEN_SYSTEM - - Credential Type Open System. - CSR_WIFI_NME_CREDENTIAL_TYPE_WEP64 - - Credential Type WEP-64 - CSR_WIFI_NME_CREDENTIAL_TYPE_WEP128 - - Credential Type WEP-128 - CSR_WIFI_NME_CREDENTIAL_TYPE_WPA_PSK - - Credential Type WPA Pre-Shared Key - CSR_WIFI_NME_CREDENTIAL_TYPE_WPA_PASSPHRASE - - Credential Type WPA pass phrase - CSR_WIFI_NME_CREDENTIAL_TYPE_WPA2_PSK - - Credential Type WPA2 Pre-Shared Key. - CSR_WIFI_NME_CREDENTIAL_TYPE_WPA2_PASSPHRASE - - Credential Type WPA2 pass phrase - CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI_PSK - - Credential Type WAPI Pre-Shared Key. - CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI_PASSPHRASE - - Credential Type WAPI pass phrase - CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI - - Credential Type WAPI certificates - CSR_WIFI_NME_CREDENTIAL_TYPE_8021X - - Credential Type 802.1X: the associated type supports - FAST/LEAP/TLS/TTLS/PEAP/etc. - -*******************************************************************************/ -typedef u16 CsrWifiNmeCredentialType; -#define CSR_WIFI_NME_CREDENTIAL_TYPE_OPEN_SYSTEM ((CsrWifiNmeCredentialType) 0x0000) -#define CSR_WIFI_NME_CREDENTIAL_TYPE_WEP64 ((CsrWifiNmeCredentialType) 0x0001) -#define CSR_WIFI_NME_CREDENTIAL_TYPE_WEP128 ((CsrWifiNmeCredentialType) 0x0002) -#define CSR_WIFI_NME_CREDENTIAL_TYPE_WPA_PSK ((CsrWifiNmeCredentialType) 0x0003) -#define CSR_WIFI_NME_CREDENTIAL_TYPE_WPA_PASSPHRASE ((CsrWifiNmeCredentialType) 0x0004) -#define CSR_WIFI_NME_CREDENTIAL_TYPE_WPA2_PSK ((CsrWifiNmeCredentialType) 0x0005) -#define CSR_WIFI_NME_CREDENTIAL_TYPE_WPA2_PASSPHRASE ((CsrWifiNmeCredentialType) 0x0006) -#define CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI_PSK ((CsrWifiNmeCredentialType) 0x0007) -#define CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI_PASSPHRASE ((CsrWifiNmeCredentialType) 0x0008) -#define CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI ((CsrWifiNmeCredentialType) 0x0009) -#define CSR_WIFI_NME_CREDENTIAL_TYPE_8021X ((CsrWifiNmeCredentialType) 0x000A) - -/******************************************************************************* - - NAME - CsrWifiNmeEapMethod - - DESCRIPTION - Outer EAP method with possibly inner method. - - VALUES - CSR_WIFI_NME_EAP_METHOD_TLS - - EAP-TLS Method. - CSR_WIFI_NME_EAP_METHOD_TTLS_MSCHAPV2 - - EAP-TTLS Method with MSCHAPV2. - CSR_WIFI_NME_EAP_METHOD_PEAP_GTC - - EAP-PEAP Method with GTC. - CSR_WIFI_NME_EAP_METHOD_PEAP_MSCHAPV2 - - EAP-PEAP Method with MSCHAPV2. - CSR_WIFI_NME_EAP_METHOD_SIM - - EAP-SIM Method. - CSR_WIFI_NME_EAP_METHOD_AKA - - EAP-AKA Method. - CSR_WIFI_NME_EAP_METHOD_FAST_GTC - - EAP-FAST Method with GTC. - CSR_WIFI_NME_EAP_METHOD_FAST_MSCHAPV2 - - EAP-FAST Method with MSCHAPV2. - CSR_WIFI_NME_EAP_METHOD_LEAP - - EAP-LEAP Method. - -*******************************************************************************/ -typedef u16 CsrWifiNmeEapMethod; -#define CSR_WIFI_NME_EAP_METHOD_TLS ((CsrWifiNmeEapMethod) 0x0001) -#define CSR_WIFI_NME_EAP_METHOD_TTLS_MSCHAPV2 ((CsrWifiNmeEapMethod) 0x0002) -#define CSR_WIFI_NME_EAP_METHOD_PEAP_GTC ((CsrWifiNmeEapMethod) 0x0004) -#define CSR_WIFI_NME_EAP_METHOD_PEAP_MSCHAPV2 ((CsrWifiNmeEapMethod) 0x0008) -#define CSR_WIFI_NME_EAP_METHOD_SIM ((CsrWifiNmeEapMethod) 0x0010) -#define CSR_WIFI_NME_EAP_METHOD_AKA ((CsrWifiNmeEapMethod) 0x0020) -#define CSR_WIFI_NME_EAP_METHOD_FAST_GTC ((CsrWifiNmeEapMethod) 0x0040) -#define CSR_WIFI_NME_EAP_METHOD_FAST_MSCHAPV2 ((CsrWifiNmeEapMethod) 0x0080) -#define CSR_WIFI_NME_EAP_METHOD_LEAP ((CsrWifiNmeEapMethod) 0x0100) - -/******************************************************************************* - - NAME - CsrWifiNmeEncryption - - DESCRIPTION - WiFi Encryption method - - VALUES - CSR_WIFI_NME_ENCRYPTION_CIPHER_NONE - - No encryprion set. - CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 - - 40 bytes WEP key for peer to peer communication. - CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 - - 104 bytes WEP key for peer to peer communication. - CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_TKIP - - TKIP key for peer to peer communication. - CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_CCMP - - CCMP key for peer to peer communication. - CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 - - SMS4 key for peer to peer communication. - CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_WEP40 - - 40 bytes WEP key for broadcast messages. - CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_WEP104 - - 104 bytes WEP key for broadcast messages. - CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_TKIP - - TKIP key for broadcast messages. - CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_CCMP - - CCMP key for broadcast messages - CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_SMS4 - - SMS4 key for broadcast messages. - -*******************************************************************************/ -typedef u16 CsrWifiNmeEncryption; -#define CSR_WIFI_NME_ENCRYPTION_CIPHER_NONE ((CsrWifiNmeEncryption) 0x0000) -#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 ((CsrWifiNmeEncryption) 0x0001) -#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 ((CsrWifiNmeEncryption) 0x0002) -#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_TKIP ((CsrWifiNmeEncryption) 0x0004) -#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_CCMP ((CsrWifiNmeEncryption) 0x0008) -#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 ((CsrWifiNmeEncryption) 0x0010) -#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_WEP40 ((CsrWifiNmeEncryption) 0x0020) -#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_WEP104 ((CsrWifiNmeEncryption) 0x0040) -#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_TKIP ((CsrWifiNmeEncryption) 0x0080) -#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_CCMP ((CsrWifiNmeEncryption) 0x0100) -#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_SMS4 ((CsrWifiNmeEncryption) 0x0200) - -/******************************************************************************* - - NAME - CsrWifiNmeIndications - - DESCRIPTION - NME indications - - VALUES - CSR_WIFI_NME_INDICATIONS_IND_AP_STATION - - NME AP Station Indication. - CSR_WIFI_NME_INDICATIONS_IND_AP_STOP - - NME AP Stop Indication. - CSR_WIFI_NME_INDICATIONS_IND_SIM_UMTS_AUTH - - NME UMTS Authentication Indication. - CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_START - - NME P2P Group Start Indication. - CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_STATUS - - NME P2P Group Status Indication. - CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_ROLE - - NME P2P Group Role Indication. - CSR_WIFI_NME_INDICATIONS_IND_PROFILE_DISCONNECT - - NME Profile Disconnect Indication. - CSR_WIFI_NME_INDICATIONS_IND_PROFILE_UPDATE - - NME Profile Update Indication. - CSR_WIFI_NME_INDICATIONS_IND_SIM_IMSI_GET - - NME GET IMSI Indication. - CSR_WIFI_NME_INDICATIONS_IND_SIM_GSM_AUTH - - NME GSM Authentication Indication. - CSR_WIFI_NME_INDICATIONS_ALL - - Used to register for all available indications - -*******************************************************************************/ -typedef u32 CsrWifiNmeIndications; -#define CSR_WIFI_NME_INDICATIONS_IND_AP_STATION ((CsrWifiNmeIndications) 0x00100000) -#define CSR_WIFI_NME_INDICATIONS_IND_AP_STOP ((CsrWifiNmeIndications) 0x00200000) -#define CSR_WIFI_NME_INDICATIONS_IND_SIM_UMTS_AUTH ((CsrWifiNmeIndications) 0x01000000) -#define CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_START ((CsrWifiNmeIndications) 0x02000000) -#define CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_STATUS ((CsrWifiNmeIndications) 0x04000000) -#define CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_ROLE ((CsrWifiNmeIndications) 0x08000000) -#define CSR_WIFI_NME_INDICATIONS_IND_PROFILE_DISCONNECT ((CsrWifiNmeIndications) 0x10000000) -#define CSR_WIFI_NME_INDICATIONS_IND_PROFILE_UPDATE ((CsrWifiNmeIndications) 0x20000000) -#define CSR_WIFI_NME_INDICATIONS_IND_SIM_IMSI_GET ((CsrWifiNmeIndications) 0x40000000) -#define CSR_WIFI_NME_INDICATIONS_IND_SIM_GSM_AUTH ((CsrWifiNmeIndications) 0x80000000) -#define CSR_WIFI_NME_INDICATIONS_ALL ((CsrWifiNmeIndications) 0xFFFFFFFF) - -/******************************************************************************* - - NAME - CsrWifiNmeSecError - - DESCRIPTION - NME Security Errors - place holder for the security library abort reason - - VALUES - CSR_WIFI_NME_SEC_ERROR_SEC_ERROR_UNKNOWN - - Unknown Security Error. - -*******************************************************************************/ -typedef u8 CsrWifiNmeSecError; -#define CSR_WIFI_NME_SEC_ERROR_SEC_ERROR_UNKNOWN ((CsrWifiNmeSecError) 0x00) - -/******************************************************************************* - - NAME - CsrWifiNmeSimCardType - - DESCRIPTION - (U)SIM Card (or UICC) types - - VALUES - CSR_WIFI_NME_SIM_CARD_TYPE_2G - 2G SIM card, capable of performing GSM - authentication only. - CSR_WIFI_NME_SIM_CARD_TYPE_3G - UICC supporting USIM application, capable - of performing UMTS authentication only. - CSR_WIFI_NME_SIM_CARD_TYPE_2G3G - UICC supporting both USIM and SIM - applications, capable of performing both - UMTS and GSM authentications. - -*******************************************************************************/ -typedef u8 CsrWifiNmeSimCardType; -#define CSR_WIFI_NME_SIM_CARD_TYPE_2G ((CsrWifiNmeSimCardType) 0x01) -#define CSR_WIFI_NME_SIM_CARD_TYPE_3G ((CsrWifiNmeSimCardType) 0x02) -#define CSR_WIFI_NME_SIM_CARD_TYPE_2G3G ((CsrWifiNmeSimCardType) 0x03) - -/******************************************************************************* - - NAME - CsrWifiNmeUmtsAuthResult - - DESCRIPTION - Only relevant for UMTS Authentication. It indicates if the UICC has - successfully authenticated the network or otherwise. - - VALUES - CSR_WIFI_NME_UMTS_AUTH_RESULT_SUCCESS - - Successful outcome from USIM indicating that the card has - successfully authenticated the network. - CSR_WIFI_NME_UMTS_AUTH_RESULT_SYNC_FAIL - - Unsuccessful outcome from USIM indicating that the card is - requesting the network to synchronise and re-try again. If - no further request is received an NME timer will expire and - the authentication is aborted. - CSR_WIFI_NME_UMTS_AUTH_RESULT_REJECT - - Unsuccessful outcome from USIM indicating that the card has - rejected the network and that the authentication is - aborted. - -*******************************************************************************/ -typedef u8 CsrWifiNmeUmtsAuthResult; -#define CSR_WIFI_NME_UMTS_AUTH_RESULT_SUCCESS ((CsrWifiNmeUmtsAuthResult) 0x00) -#define CSR_WIFI_NME_UMTS_AUTH_RESULT_SYNC_FAIL ((CsrWifiNmeUmtsAuthResult) 0x01) -#define CSR_WIFI_NME_UMTS_AUTH_RESULT_REJECT ((CsrWifiNmeUmtsAuthResult) 0x02) - -/******************************************************************************* - - NAME - CsrWifiNmeWmmQosInfo - - DESCRIPTION - Defines bits for the QoS Info octect as defined in the WMM specification. - The values of this type are used across the NME/SME/Router API's and they - must be kept consistent with the corresponding types in the .xml of the - other interfaces - - VALUES - CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_ALL - - WMM AP may deliver all buffered frames. - CSR_WIFI_NME_WMM_QOS_INFO_AC_VO - - To enable the triggering and delivery of QoS Voice. - CSR_WIFI_NME_WMM_QOS_INFO_AC_VI - - To enable the triggering and delivery of QoS Video. - CSR_WIFI_NME_WMM_QOS_INFO_AC_BK - - To enable the triggering and delivery of QoS Background. - CSR_WIFI_NME_WMM_QOS_INFO_AC_BE - - To enable the triggering and delivery of QoS Best Effort. - CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_TWO - - WMM AP may deliver a maximum of 2 buffered frames per - Unscheduled Service Period (USP). - CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_FOUR - - WMM AP may deliver a maximum of 4 buffered frames per USP. - CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_SIX - - WMM AP may deliver a maximum of 6 buffered frames per USP. - -*******************************************************************************/ -typedef u8 CsrWifiNmeWmmQosInfo; -#define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_ALL ((CsrWifiNmeWmmQosInfo) 0x00) -#define CSR_WIFI_NME_WMM_QOS_INFO_AC_VO ((CsrWifiNmeWmmQosInfo) 0x01) -#define CSR_WIFI_NME_WMM_QOS_INFO_AC_VI ((CsrWifiNmeWmmQosInfo) 0x02) -#define CSR_WIFI_NME_WMM_QOS_INFO_AC_BK ((CsrWifiNmeWmmQosInfo) 0x04) -#define CSR_WIFI_NME_WMM_QOS_INFO_AC_BE ((CsrWifiNmeWmmQosInfo) 0x08) -#define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_TWO ((CsrWifiNmeWmmQosInfo) 0x20) -#define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_FOUR ((CsrWifiNmeWmmQosInfo) 0x40) -#define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_SIX ((CsrWifiNmeWmmQosInfo) 0x60) - - -/******************************************************************************* - - NAME - CsrWifiNmeEapMethodMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiNmeEapMethod. - -*******************************************************************************/ -typedef u16 CsrWifiNmeEapMethodMask; -/******************************************************************************* - - NAME - CsrWifiNmeEncryptionMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiNmeEncryption - -*******************************************************************************/ -typedef u16 CsrWifiNmeEncryptionMask; -/******************************************************************************* - - NAME - CsrWifiNmeIndicationsMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiNmeIndications - -*******************************************************************************/ -typedef u32 CsrWifiNmeIndicationsMask; -/******************************************************************************* - - NAME - CsrWifiNmeNmeIndicationsMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiNmeNmeIndications. - Used to overlap the unused portion of the unifi_IndicationsMask For NME - specific indications - -*******************************************************************************/ -typedef u32 CsrWifiNmeNmeIndicationsMask; -/******************************************************************************* - - NAME - CsrWifiNmeWmmQosInfoMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiNmeWmmQosInfo - -*******************************************************************************/ -typedef u8 CsrWifiNmeWmmQosInfoMask; - - -/******************************************************************************* - - NAME - CsrWifiNmeEmpty - - DESCRIPTION - Empty Structure to indicate that no credentials are available. - - MEMBERS - empty - Only element of the empty structure (always set to 0). - -*******************************************************************************/ -typedef struct -{ - u8 empty; -} CsrWifiNmeEmpty; - -/******************************************************************************* - - NAME - CsrWifiNmePassphrase - - DESCRIPTION - Structure holding the ASCII Pass Phrase data. - - MEMBERS - encryptionMode - Encryption type as defined in CsrWifiSmeEncryption. - passphrase - Pass phrase ASCII value. - -*******************************************************************************/ -typedef struct -{ - u16 encryptionMode; - char *passphrase; -} CsrWifiNmePassphrase; - -/******************************************************************************* - - NAME - CsrWifiNmePsk - - DESCRIPTION - Structure holding the Pre-Shared Key data. - - MEMBERS - encryptionMode - Encryption type as defined in CsrWifiSmeEncryption. - psk - Pre-Shared Key value. - -*******************************************************************************/ -typedef struct -{ - u16 encryptionMode; - u8 psk[32]; -} CsrWifiNmePsk; - -/******************************************************************************* - - NAME - CsrWifiNmeWapiCredentials - - DESCRIPTION - Structure holding WAPI credentials data. - - MEMBERS - certificateLength - Length in bytes of the following client certificate. - certificate - The actual client certificate data (if present). - DER/PEM format supported. - privateKeyLength - Length in bytes of the following private key. - privateKey - The actual private key. DER/PEM format. - caCertificateLength - Length in bytes of the following certificate authority - certificate. - caCertificate - The actual certificate authority certificate data. If - not supplied the received certificate authority - certificate is assumed to be validate, if present the - received certificate is validated against it. DER/PEM - format supported. - -*******************************************************************************/ -typedef struct -{ - u32 certificateLength; - u8 *certificate; - u16 privateKeyLength; - u8 *privateKey; - u32 caCertificateLength; - u8 *caCertificate; -} CsrWifiNmeWapiCredentials; - -/******************************************************************************* - - NAME - CsrWifiNmeConnectAttempt - - DESCRIPTION - Structure holding Connection attempt data. - - MEMBERS - bssid - Id of Basic Service Set connections attempt have been made - to. - status - Status returned to indicate the success or otherwise of the - connection attempt. - securityError - Security error status indicating the nature of the failure - to connect. - -*******************************************************************************/ -typedef struct -{ - CsrWifiMacAddress bssid; - CsrResult status; - CsrWifiNmeSecError securityError; -} CsrWifiNmeConnectAttempt; - -/******************************************************************************* - - NAME - CsrWifiNmeEapCredentials - - DESCRIPTION - Supports the use of multiple EAP methods via a single structure. The - methods required are indicated by the value set in the eapMethodMask - - MEMBERS - eapMethodMask - - Bit mask of supported EAP methods - Currently only supports the setting of one bit. - Required for all the EAP methods. - authMode - - Bit mask representing the authentication types that may be - supported by a suitable AP. An AP must support at least one - of the authentication types specified to be considered for - connection. Required for all EAP methods. - encryptionMode - - Bit mask representing the encryption types that may be - supported by a suitable AP. An AP must support a suitable - mix of the pairwise and group encryption types requested to - be considered for connection. Required for all EAP methods. - userName - - User name. Required for all EAP methods except: SIM or AKA. - userPassword - - User Password. Required for all EAP methods except: TLS, - SIM or AKA. - authServerUserIdentity - - Authentication server user Identity. Required for all EAP - methods except: TLS, SIM, AKA or FAST. - clientCertificateLength - - Length in bytes of the following client certificate (if - present). Only required for TLS. - clientCertificate - - The actual client certificate data (if present). Only - required for TLS. DER/PEM format supported. - certificateAuthorityCertificateLength - - Length in bytes of the following certificate authority - certificate (if present). Optional for TLS, TTLS, PEAP. - certificateAuthorityCertificate - - The actual certificate authority certificate data (if - present). If not supplied the received certificate - authority certificate is assumed to be valid, if present - the received certificate is validated against it. Optional - for TLS, TTLS, PEAP. DER/PEM format supported. - privateKeyLength - - Length in bytes of the following private key (if present). - Only required for TLS. - privateKey - - The actual private key (if present). Only required for TLS. - DER/PEM format, maybe password protected. - privateKeyPassword - - Optional password to protect the private key. - sessionLength - - Length in bytes of the following session field Supported - for all EAP methods except: SIM or AKA. - session - - Session information to support faster re-authentication. - Supported for all EAP methods except: SIM or AKA. - allowPacProvisioning - - If TRUE: PAC provisioning is allowed 'over-the_air'; - If FALSE: a PAC must be supplied. - Only required for FAST. - pacLength - - Length the following PAC field. If allowPacProvisioning is - FALSE then the PAC MUST be supplied (i.e. non-zero). Only - required for FAST. - pac - - The actual PAC data. If allowPacProvisioning is FALSE then - the PAC MUST be supplied. Only required for FAST. - pacPassword - - Optional password to protect the PAC. Only required for - FAST. - -*******************************************************************************/ -typedef struct -{ - CsrWifiNmeEapMethodMask eapMethodMask; - CsrWifiSmeAuthModeMask authMode; - CsrWifiNmeEncryptionMask encryptionMode; - char *userName; - char *userPassword; - char *authServerUserIdentity; - u32 clientCertificateLength; - u8 *clientCertificate; - u32 certificateAuthorityCertificateLength; - u8 *certificateAuthorityCertificate; - u16 privateKeyLength; - u8 *privateKey; - char *privateKeyPassword; - u32 sessionLength; - u8 *session; - u8 allowPacProvisioning; - u32 pacLength; - u8 *pac; - char *pacPassword; -} CsrWifiNmeEapCredentials; - -/******************************************************************************* - - NAME - CsrWifiNmePeerConfig - - DESCRIPTION - Structure holding Peer Config data. - - MEMBERS - p2pDeviceId - - groupCapabilityMask - - groupOwnerIntent - - -*******************************************************************************/ -typedef struct -{ - CsrWifiMacAddress p2pDeviceId; - CsrWifiSmeP2pGroupCapabilityMask groupCapabilityMask; - u8 groupOwnerIntent; -} CsrWifiNmePeerConfig; - -/******************************************************************************* - - NAME - CsrWifiNmeProfileIdentity - - DESCRIPTION - The identity of a profile is defined as the unique combination the BSSID - and SSID. - - MEMBERS - bssid - ID of Basic Service Set for or the P2pDevice address of the GO for - which a connection attempt was made. - ssid - Service Set Id. - -*******************************************************************************/ -typedef struct -{ - CsrWifiMacAddress bssid; - CsrWifiSsid ssid; -} CsrWifiNmeProfileIdentity; - -/******************************************************************************* - - NAME - CsrWifiNmeWep128Keys - - DESCRIPTION - Structure holding WEP Authentication Type and WEP keys that can be used - when using WEP128. - - MEMBERS - wepAuthType - Mask to select the WEP authentication type (Open or Shared) - selectedWepKey - Index to one of the four keys below indicating the - currently used WEP key. - key1 - Value for key number 1. - key2 - Value for key number 2. - key3 - Value for key number 3. - key4 - Value for key number 4. - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeAuthModeMask wepAuthType; - u8 selectedWepKey; - u8 key1[13]; - u8 key2[13]; - u8 key3[13]; - u8 key4[13]; -} CsrWifiNmeWep128Keys; - -/******************************************************************************* - - NAME - CsrWifiNmeWep64Keys - - DESCRIPTION - Structure for holding WEP Authentication Type and WEP keys that can be - used when using WEP64. - - MEMBERS - wepAuthType - Mask to select the WEP authentication type (Open or Shared) - selectedWepKey - Index to one of the four keys below indicating the - currently used WEP key. - key1 - Value for key number 1. - key2 - Value for key number 2. - key3 - Value for key number 3. - key4 - Value for key number 4. - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeAuthModeMask wepAuthType; - u8 selectedWepKey; - u8 key1[5]; - u8 key2[5]; - u8 key3[5]; - u8 key4[5]; -} CsrWifiNmeWep64Keys; - -/******************************************************************************* - - NAME - CsrWifiNmeCredentials - - DESCRIPTION - Structure containing the Credentials data. - - MEMBERS - credentialType - Credential type value (as defined in the - enumeration type). - credential - Union containing credentials which depends on - credentialType parameter. - credentialeap - - credentialwapiPassphrase - - credentialwpa2Passphrase - - credentialwpa2Psk - - credentialwapiPsk - - credentialwpaPassphrase - - credentialwapi - - credentialwep128Key - - credentialwpaPsk - - credentialopenSystem - - credentialwep64Key - - -*******************************************************************************/ -typedef struct -{ - CsrWifiNmeCredentialType credentialType; - union { - CsrWifiNmeEapCredentials eap; - CsrWifiNmePassphrase wapiPassphrase; - CsrWifiNmePassphrase wpa2Passphrase; - CsrWifiNmePsk wpa2Psk; - CsrWifiNmePsk wapiPsk; - CsrWifiNmePassphrase wpaPassphrase; - CsrWifiNmeWapiCredentials wapi; - CsrWifiNmeWep128Keys wep128Key; - CsrWifiNmePsk wpaPsk; - CsrWifiNmeEmpty openSystem; - CsrWifiNmeWep64Keys wep64Key; - } credential; -} CsrWifiNmeCredentials; - -/******************************************************************************* - - NAME - CsrWifiNmeProfile - - DESCRIPTION - Structure containing the Profile data. - - MEMBERS - profileIdentity - Profile Identity. - wmmQosInfoMask - Mask for WMM QoS information. - bssType - Type of BSS (Infrastructure or Adhoc). - channelNo - Channel Number. - ccxOptionsMask - Options mask for Cisco Compatible Extentions. - cloakedSsid - Flag to decide whether the SSID is cloaked (not - transmitted) or not. - credentials - Credentials data. - -*******************************************************************************/ -typedef struct -{ - CsrWifiNmeProfileIdentity profileIdentity; - CsrWifiNmeWmmQosInfoMask wmmQosInfoMask; - CsrWifiNmeBssType bssType; - u8 channelNo; - u8 ccxOptionsMask; - u8 cloakedSsid; - CsrWifiNmeCredentials credentials; -} CsrWifiNmeProfile; - - -/* Downstream */ -#define CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST (0x0000) - -#define CSR_WIFI_NME_PROFILE_SET_REQ ((CsrWifiNmePrim) (0x0000 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_PROFILE_DELETE_REQ ((CsrWifiNmePrim) (0x0001 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ ((CsrWifiNmePrim) (0x0002 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_PROFILE_ORDER_SET_REQ ((CsrWifiNmePrim) (0x0003 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_PROFILE_CONNECT_REQ ((CsrWifiNmePrim) (0x0004 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_WPS_REQ ((CsrWifiNmePrim) (0x0005 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_WPS_CANCEL_REQ ((CsrWifiNmePrim) (0x0006 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_CONNECTION_STATUS_GET_REQ ((CsrWifiNmePrim) (0x0007 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_SIM_IMSI_GET_RES ((CsrWifiNmePrim) (0x0008 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_SIM_GSM_AUTH_RES ((CsrWifiNmePrim) (0x0009 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_SIM_UMTS_AUTH_RES ((CsrWifiNmePrim) (0x000A + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_WPS_CONFIG_SET_REQ ((CsrWifiNmePrim) (0x000B + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_NME_EVENT_MASK_SET_REQ ((CsrWifiNmePrim) (0x000C + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)) - - -#define CSR_WIFI_NME_PRIM_DOWNSTREAM_HIGHEST (0x000C + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST) - -/* Upstream */ -#define CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) - -#define CSR_WIFI_NME_PROFILE_SET_CFM ((CsrWifiNmePrim)(0x0000 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_PROFILE_DELETE_CFM ((CsrWifiNmePrim)(0x0001 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_PROFILE_DELETE_ALL_CFM ((CsrWifiNmePrim)(0x0002 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_PROFILE_ORDER_SET_CFM ((CsrWifiNmePrim)(0x0003 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_PROFILE_CONNECT_CFM ((CsrWifiNmePrim)(0x0004 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_WPS_CFM ((CsrWifiNmePrim)(0x0005 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_WPS_CANCEL_CFM ((CsrWifiNmePrim)(0x0006 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_CONNECTION_STATUS_GET_CFM ((CsrWifiNmePrim)(0x0007 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_PROFILE_UPDATE_IND ((CsrWifiNmePrim)(0x0008 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_PROFILE_DISCONNECT_IND ((CsrWifiNmePrim)(0x0009 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_SIM_IMSI_GET_IND ((CsrWifiNmePrim)(0x000A + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_SIM_GSM_AUTH_IND ((CsrWifiNmePrim)(0x000B + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_SIM_UMTS_AUTH_IND ((CsrWifiNmePrim)(0x000C + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_WPS_CONFIG_SET_CFM ((CsrWifiNmePrim)(0x000D + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_NME_EVENT_MASK_SET_CFM ((CsrWifiNmePrim)(0x000E + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)) - -#define CSR_WIFI_NME_PRIM_UPSTREAM_HIGHEST (0x000E + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST) - -#define CSR_WIFI_NME_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_NME_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST) -#define CSR_WIFI_NME_PRIM_UPSTREAM_COUNT (CSR_WIFI_NME_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST) - -/******************************************************************************* - - NAME - CsrWifiNmeProfileSetReq - - DESCRIPTION - Creates or updates an existing profile in the NME that matches the unique - identity of the profile. Each profile is identified by the combination of - BSSID and SSID. The profile contains all the required credentials for - attempting to connect to the network. Creating or updating a profile via - the NME PROFILE SET REQ does NOT add the profile to the preferred profile - list within the NME used for the NME auto-connect behaviour. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - profile - Specifies the identity and credentials of the network. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiNmeProfile profile; -} CsrWifiNmeProfileSetReq; - -/******************************************************************************* - - NAME - CsrWifiNmeProfileDeleteReq - - DESCRIPTION - Will delete the profile with a matching identity, but does NOT modify the - preferred profile list. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - profileIdentity - Identity (BSSID, SSID) of profile to be deleted. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiNmeProfileIdentity profileIdentity; -} CsrWifiNmeProfileDeleteReq; - -/******************************************************************************* - - NAME - CsrWifiNmeProfileDeleteAllReq - - DESCRIPTION - Deletes all profiles present in the NME, but does NOT modify the - preferred profile list. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiNmeProfileDeleteAllReq; - -/******************************************************************************* - - NAME - CsrWifiNmeProfileOrderSetReq - - DESCRIPTION - Defines the preferred order that profiles present in the NME should be - used during the NME auto-connect behaviour. - If profileIdentitysCount == 0, it removes any existing preferred profile - list already present in the NME, effectively disabling the auto-connect - behaviour. - NOTE: Profile identities that do not match any profile stored in the NME - are ignored during the auto-connect procedure. - NOTE: during auto-connect the NME will only attempt to join an existing - adhoc network and it will never attempt to host an adhoc network; for - hosting and adhoc network, use CSR_WIFI_NME_PROFILE_CONNECT_REQ - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an - interface - profileIdentitysCount - The number of profiles identities in the list. - profileIdentitys - Points to the list of profile identities. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 profileIdentitysCount; - CsrWifiNmeProfileIdentity *profileIdentitys; -} CsrWifiNmeProfileOrderSetReq; - -/******************************************************************************* - - NAME - CsrWifiNmeProfileConnectReq - - DESCRIPTION - Requests the NME to attempt to connect to the specified profile. - Overrides any current connection attempt. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - profileIdentity - Identity (BSSID, SSID) of profile to be connected to. - It must match an existing profile in the NME. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiNmeProfileIdentity profileIdentity; -} CsrWifiNmeProfileConnectReq; - -/******************************************************************************* - - NAME - CsrWifiNmeWpsReq - - DESCRIPTION - Requests the NME to look for WPS enabled APs and attempt to perform WPS - to determine the appropriate security credentials to connect to the AP. - If the PIN == '00000000' then 'push button mode' is indicated, otherwise - the PIN has to match that of the AP. 4 digit pin is passed by sending the - pin digits in pin[0]..pin[3] and rest of the contents filled with '-'. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - pin - PIN value. - ssid - Service Set identifier - bssid - ID of Basic Service Set for which a WPS connection attempt is - being made. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 pin[8]; - CsrWifiSsid ssid; - CsrWifiMacAddress bssid; -} CsrWifiNmeWpsReq; - -/******************************************************************************* - - NAME - CsrWifiNmeWpsCancelReq - - DESCRIPTION - Requests the NME to cancel any WPS procedure that it is currently - performing. This includes WPS registrar activities started because of - CSR_WIFI_NME_AP_REGISTER.request - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiNmeWpsCancelReq; - -/******************************************************************************* - - NAME - CsrWifiNmeConnectionStatusGetReq - - DESCRIPTION - Requests the current connection status of the NME. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiNmeConnectionStatusGetReq; - -/******************************************************************************* - - NAME - CsrWifiNmeSimImsiGetRes - - DESCRIPTION - Response from the application that received the NME SIM IMSI GET IND. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Indicates the outcome of the requested operation: STATUS_SUCCESS - or STATUS_ERROR. - imsi - The value of the IMSI obtained from the UICC. - cardType - The UICC type (GSM only (SIM), UMTS only (USIM), Both). - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - char *imsi; - CsrWifiNmeSimCardType cardType; -} CsrWifiNmeSimImsiGetRes; - -/******************************************************************************* - - NAME - CsrWifiNmeSimGsmAuthRes - - DESCRIPTION - Response from the application that received the NME SIM GSM AUTH IND. For - each GSM authentication round a GSM Ciphering key (Kc) and a signed - response (SRES) are produced. Since 2 or 3 GSM authentication rounds are - used the 2 or 3 Kc's obtained respectively are combined into one buffer - and similarly the 2 or 3 SRES's obtained are combined into another - buffer. The order of Kc values (SRES values respectively) in their buffer - is the same as that of their corresponding RAND values in the incoming - indication. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Indicates the outcome of the requested operation: - STATUS_SUCCESS or STATUS_ERROR - kcsLength - Length in Bytes of Kc buffer. Legal values are: 16 or 24. - kcs - Kc buffer holding 2 or 3 Kc values. - sresLength - Length in Bytes of SRES buffer. Legal values are: 8 or 12. - sres - SRES buffer holding 2 or 3 SRES values. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - u8 kcsLength; - u8 *kcs; - u8 sresLength; - u8 *sres; -} CsrWifiNmeSimGsmAuthRes; - -/******************************************************************************* - - NAME - CsrWifiNmeSimUmtsAuthRes - - DESCRIPTION - Response from the application that received the NME SIM UMTS AUTH IND. - The values of umtsCipherKey, umtsIntegrityKey, resParameterLength and - resParameter are only meanigful when result = UMTS_AUTH_RESULT_SUCCESS. - The value of auts is only meaningful when - result=UMTS_AUTH_RESULT_SYNC_FAIL. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Indicates the outcome of the requested operation: - STATUS_SUCCESS or STATUS_ERROR. - result - The result of UMTS authentication as performed by the - UICC which could be: Success, Authentication Reject or - Synchronisation Failure. For all these 3 outcomes the - value of status is success. - umtsCipherKey - The UMTS Cipher Key as calculated and returned by the - UICC. - umtsIntegrityKey - The UMTS Integrity Key as calculated and returned by - the UICC. - resParameterLength - The length (in bytes) of the RES parameter (min=4; max - = 16). - resParameter - The RES parameter as calculated and returned by the - UICC. - auts - The AUTS parameter as calculated and returned by the - UICC. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiNmeUmtsAuthResult result; - u8 umtsCipherKey[16]; - u8 umtsIntegrityKey[16]; - u8 resParameterLength; - u8 *resParameter; - u8 auts[14]; -} CsrWifiNmeSimUmtsAuthRes; - -/******************************************************************************* - - NAME - CsrWifiNmeWpsConfigSetReq - - DESCRIPTION - This primitive passes the WPS information for the device to NME. This may - be accepted only if no interface is active. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - wpsConfig - WPS config. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeWpsConfig wpsConfig; -} CsrWifiNmeWpsConfigSetReq; - -/******************************************************************************* - - NAME - CsrWifiNmeEventMaskSetReq - - DESCRIPTION - The wireless manager application may register with the NME to receive - notification of interesting events. Indications will be sent only if the - wireless manager explicitly registers to be notified of that event. - indMask is a bit mask of values defined in CsrWifiNmeIndicationsMask. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - indMask - Set mask with values from CsrWifiNmeIndications - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiNmeIndicationsMask indMask; -} CsrWifiNmeEventMaskSetReq; - -/******************************************************************************* - - NAME - CsrWifiNmeProfileSetCfm - - DESCRIPTION - Reports the status of the NME PROFILE SET REQ; the request will only fail - if the details specified in the profile contains an invalid combination - of parameters for example specifying the profile as cloaked but not - specifying the SSID. The NME doesn't limit the number of profiles that - may be created. The NME assumes that the entity configuring it is aware - of the appropriate limits. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Indicates the success or otherwise of the requested operation. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiNmeProfileSetCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeProfileDeleteCfm - - DESCRIPTION - Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_REQ. - Returns CSR_WIFI_NME_STATUS_NOT_FOUND if there is no matching profile. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Indicates the success or otherwise of the requested operation. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiNmeProfileDeleteCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeProfileDeleteAllCfm - - DESCRIPTION - Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ. - Returns always CSR_WIFI_NME_STATUS_SUCCESS. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Indicates the success or otherwise of the requested operation, but - in this case it always set to success. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiNmeProfileDeleteAllCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeProfileOrderSetCfm - - DESCRIPTION - Confirmation to UNIFI_NME_PROFILE_ORDER_SET.request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Indicates the success or otherwise of the requested - operation. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiNmeProfileOrderSetCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeProfileConnectCfm - - DESCRIPTION - Reports the status of the NME PROFILE CONNECT REQ. If unsuccessful the - connectAttempt parameters contain details of the APs that the NME - attempted to connect to before reporting the failure of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an - interface - status - Indicates the success or otherwise of the requested - operation. - connectAttemptsCount - This parameter is relevant only if - status!=CSR_WIFI_NME_STATUS_SUCCESS. - Number of connection attempt elements provided with - this primitive - connectAttempts - This parameter is relevant only if - status!=CSR_WIFI_NME_STATUS_SUCCESS. - Points to the list of connection attempt elements - provided with this primitive - Each element of the list provides information about - an AP on which the connection attempt was made and - the error that occurred during the attempt. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - u8 connectAttemptsCount; - CsrWifiNmeConnectAttempt *connectAttempts; -} CsrWifiNmeProfileConnectCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeWpsCfm - - DESCRIPTION - Reports the status of the NME WPS REQ. - If CSR_WIFI_NME_STATUS_SUCCESS, the profile parameter contains the - identity and credentials of the AP. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Indicates the success or otherwise of the requested - operation. - profile - This parameter is relevant only if - status==CSR_WIFI_NME_STATUS_SUCCESS. - The identity and credentials of the network. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiNmeProfile profile; -} CsrWifiNmeWpsCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeWpsCancelCfm - - DESCRIPTION - Reports the status of the NME WPS REQ, the request is always SUCCESSFUL. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Only returns CSR_WIFI_NME_STATUS_SUCCESS - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiNmeWpsCancelCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeConnectionStatusGetCfm - - DESCRIPTION - Reports the connection status of the NME. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Indicates the success or otherwise of the requested - operation. - connectionStatus - NME current connection status - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiNmeConnectionStatus connectionStatus; -} CsrWifiNmeConnectionStatusGetCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeProfileUpdateInd - - DESCRIPTION - Indication generated from the NME (if an application subscribes to - receive it) that informs that application that the contained profile has - changed. - For example, either the credentials EAP-FAST PAC file or the session data - within the profile has changed. - It is up to the application whether it stores this updated profile or - not. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - profile - The identity and credentials of the network. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiNmeProfile profile; -} CsrWifiNmeProfileUpdateInd; - -/******************************************************************************* - - NAME - CsrWifiNmeProfileDisconnectInd - - DESCRIPTION - Indication generated from the NME (if an application subscribes to - receive it) that informs that application that the current profile - connection has disconnected. The indication will contain information - about APs that it attempted to maintain the connection via i.e. in the - case of failed roaming. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an - interface - connectAttemptsCount - Number of connection attempt elements provided with - this primitive - connectAttempts - Points to the list of connection attempt elements - provided with this primitive - Each element of the list provides information about - an AP on which the connection attempt was made and - the error occurred during the attempt. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 connectAttemptsCount; - CsrWifiNmeConnectAttempt *connectAttempts; -} CsrWifiNmeProfileDisconnectInd; - -/******************************************************************************* - - NAME - CsrWifiNmeSimImsiGetInd - - DESCRIPTION - Indication generated from the NME (if an application subscribes to - receive it) that requests the IMSI and UICC type from the UICC Manager. - This indication is generated when the NME is attempting to connect to a - profile configured for EAP-SIM/AKA. An application MUST register to - receive this indication for the NME to support the EAP-SIM/AKA credential - types. Otherwise the NME has no route to obtain the information from the - UICC. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiNmeSimImsiGetInd; - -/******************************************************************************* - - NAME - CsrWifiNmeSimGsmAuthInd - - DESCRIPTION - Indication generated from the NME (if an application subscribes to - receive it) that requests the UICC Manager to perform a GSM - authentication on behalf of the NME. This indication is generated when - the NME is attempting to connect to a profile configured for EAP-SIM. An - application MUST register to receive this indication for the NME to - support the EAP-SIM credential types. Otherwise the NME has no route to - obtain the information from the UICC. EAP-SIM authentication requires 2 - or 3 GSM authentication rounds and therefore 2 or 3 RANDS (GSM Random - Challenges) are included. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - randsLength - GSM RAND is 16 bytes long hence valid values are 32 (2 RANDS) - or 48 (3 RANDs). - rands - 2 or 3 RANDs values. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u8 randsLength; - u8 *rands; -} CsrWifiNmeSimGsmAuthInd; - -/******************************************************************************* - - NAME - CsrWifiNmeSimUmtsAuthInd - - DESCRIPTION - Indication generated from the NME (if an application subscribes to - receive it) that requests the UICC Manager to perform a UMTS - authentication on behalf of the NME. This indication is generated when - the NME is attempting to connect to a profile configured for EAP-AKA. An - application MUST register to receive this indication for the NME to - support the EAP-AKA credential types. Otherwise the NME has no route to - obtain the information from the USIM. EAP-AKA requires one UMTS - authentication round and therefore only one RAND and one AUTN values are - included. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - rand - UMTS RAND value. - autn - UMTS AUTN value. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u8 rand[16]; - u8 autn[16]; -} CsrWifiNmeSimUmtsAuthInd; - -/******************************************************************************* - - NAME - CsrWifiNmeWpsConfigSetCfm - - DESCRIPTION - Confirm. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Status of the request. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiNmeWpsConfigSetCfm; - -/******************************************************************************* - - NAME - CsrWifiNmeEventMaskSetCfm - - DESCRIPTION - The NME calls the primitive to report the result of the request - primitive. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiNmeEventMaskSetCfm; - -#endif /* CSR_WIFI_NME_PRIM_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_nme_serialize.h b/drivers/staging/csr/csr_wifi_nme_serialize.h deleted file mode 100644 index ebac484419cf..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_serialize.h +++ /dev/null @@ -1,166 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_NME_SERIALIZE_H__ -#define CSR_WIFI_NME_SERIALIZE_H__ - -#include "csr_wifi_msgconv.h" -#include "csr_wifi_nme_prim.h" - -#ifndef CSR_WIFI_NME_ENABLE -#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_serialize.h -#endif - -extern void CsrWifiNmePfree(void *ptr); - -extern u8* CsrWifiNmeProfileSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeProfileSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeProfileSetReqSizeof(void *msg); -extern void CsrWifiNmeProfileSetReqSerFree(void *msg); - -extern u8* CsrWifiNmeProfileDeleteReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeProfileDeleteReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeProfileDeleteReqSizeof(void *msg); -#define CsrWifiNmeProfileDeleteReqSerFree CsrWifiNmePfree - -#define CsrWifiNmeProfileDeleteAllReqSer CsrWifiEventSer -#define CsrWifiNmeProfileDeleteAllReqDes CsrWifiEventDes -#define CsrWifiNmeProfileDeleteAllReqSizeof CsrWifiEventSizeof -#define CsrWifiNmeProfileDeleteAllReqSerFree CsrWifiNmePfree - -extern u8* CsrWifiNmeProfileOrderSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeProfileOrderSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeProfileOrderSetReqSizeof(void *msg); -extern void CsrWifiNmeProfileOrderSetReqSerFree(void *msg); - -extern u8* CsrWifiNmeProfileConnectReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeProfileConnectReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeProfileConnectReqSizeof(void *msg); -#define CsrWifiNmeProfileConnectReqSerFree CsrWifiNmePfree - -extern u8* CsrWifiNmeWpsReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeWpsReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeWpsReqSizeof(void *msg); -#define CsrWifiNmeWpsReqSerFree CsrWifiNmePfree - -#define CsrWifiNmeWpsCancelReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiNmeWpsCancelReqDes CsrWifiEventCsrUint16Des -#define CsrWifiNmeWpsCancelReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiNmeWpsCancelReqSerFree CsrWifiNmePfree - -#define CsrWifiNmeConnectionStatusGetReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiNmeConnectionStatusGetReqDes CsrWifiEventCsrUint16Des -#define CsrWifiNmeConnectionStatusGetReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiNmeConnectionStatusGetReqSerFree CsrWifiNmePfree - -extern u8* CsrWifiNmeSimImsiGetResSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeSimImsiGetResDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeSimImsiGetResSizeof(void *msg); -extern void CsrWifiNmeSimImsiGetResSerFree(void *msg); - -extern u8* CsrWifiNmeSimGsmAuthResSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeSimGsmAuthResDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeSimGsmAuthResSizeof(void *msg); -extern void CsrWifiNmeSimGsmAuthResSerFree(void *msg); - -extern u8* CsrWifiNmeSimUmtsAuthResSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeSimUmtsAuthResDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeSimUmtsAuthResSizeof(void *msg); -extern void CsrWifiNmeSimUmtsAuthResSerFree(void *msg); - -extern u8* CsrWifiNmeWpsConfigSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeWpsConfigSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeWpsConfigSetReqSizeof(void *msg); -extern void CsrWifiNmeWpsConfigSetReqSerFree(void *msg); - -#define CsrWifiNmeEventMaskSetReqSer CsrWifiEventCsrUint32Ser -#define CsrWifiNmeEventMaskSetReqDes CsrWifiEventCsrUint32Des -#define CsrWifiNmeEventMaskSetReqSizeof CsrWifiEventCsrUint32Sizeof -#define CsrWifiNmeEventMaskSetReqSerFree CsrWifiNmePfree - -#define CsrWifiNmeProfileSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiNmeProfileSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiNmeProfileSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiNmeProfileSetCfmSerFree CsrWifiNmePfree - -#define CsrWifiNmeProfileDeleteCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiNmeProfileDeleteCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiNmeProfileDeleteCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiNmeProfileDeleteCfmSerFree CsrWifiNmePfree - -#define CsrWifiNmeProfileDeleteAllCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiNmeProfileDeleteAllCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiNmeProfileDeleteAllCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiNmeProfileDeleteAllCfmSerFree CsrWifiNmePfree - -extern u8* CsrWifiNmeProfileOrderSetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeProfileOrderSetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeProfileOrderSetCfmSizeof(void *msg); -#define CsrWifiNmeProfileOrderSetCfmSerFree CsrWifiNmePfree - -extern u8* CsrWifiNmeProfileConnectCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeProfileConnectCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeProfileConnectCfmSizeof(void *msg); -extern void CsrWifiNmeProfileConnectCfmSerFree(void *msg); - -extern u8* CsrWifiNmeWpsCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeWpsCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeWpsCfmSizeof(void *msg); -extern void CsrWifiNmeWpsCfmSerFree(void *msg); - -extern u8* CsrWifiNmeWpsCancelCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeWpsCancelCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeWpsCancelCfmSizeof(void *msg); -#define CsrWifiNmeWpsCancelCfmSerFree CsrWifiNmePfree - -extern u8* CsrWifiNmeConnectionStatusGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeConnectionStatusGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeConnectionStatusGetCfmSizeof(void *msg); -#define CsrWifiNmeConnectionStatusGetCfmSerFree CsrWifiNmePfree - -extern u8* CsrWifiNmeProfileUpdateIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeProfileUpdateIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeProfileUpdateIndSizeof(void *msg); -extern void CsrWifiNmeProfileUpdateIndSerFree(void *msg); - -extern u8* CsrWifiNmeProfileDisconnectIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeProfileDisconnectIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeProfileDisconnectIndSizeof(void *msg); -extern void CsrWifiNmeProfileDisconnectIndSerFree(void *msg); - -#define CsrWifiNmeSimImsiGetIndSer CsrWifiEventSer -#define CsrWifiNmeSimImsiGetIndDes CsrWifiEventDes -#define CsrWifiNmeSimImsiGetIndSizeof CsrWifiEventSizeof -#define CsrWifiNmeSimImsiGetIndSerFree CsrWifiNmePfree - -extern u8* CsrWifiNmeSimGsmAuthIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeSimGsmAuthIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeSimGsmAuthIndSizeof(void *msg); -extern void CsrWifiNmeSimGsmAuthIndSerFree(void *msg); - -extern u8* CsrWifiNmeSimUmtsAuthIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiNmeSimUmtsAuthIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiNmeSimUmtsAuthIndSizeof(void *msg); -#define CsrWifiNmeSimUmtsAuthIndSerFree CsrWifiNmePfree - -#define CsrWifiNmeWpsConfigSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiNmeWpsConfigSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiNmeWpsConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiNmeWpsConfigSetCfmSerFree CsrWifiNmePfree - -#define CsrWifiNmeEventMaskSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiNmeEventMaskSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiNmeEventMaskSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiNmeEventMaskSetCfmSerFree CsrWifiNmePfree - -#endif /* CSR_WIFI_NME_SERIALIZE_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_nme_task.h b/drivers/staging/csr/csr_wifi_nme_task.h deleted file mode 100644 index 84e973a59bb2..000000000000 --- a/drivers/staging/csr/csr_wifi_nme_task.h +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_NME_TASK_H__ -#define CSR_WIFI_NME_TASK_H__ - -#include <linux/types.h> -#include "csr_sched.h" - -#ifndef CSR_WIFI_NME_ENABLE -#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_task.h -#endif - -#define CSR_WIFI_NME_LOG_ID 0x1203FFFF -extern CsrSchedQid CSR_WIFI_NME_IFACEQUEUE; - -#endif /* CSR_WIFI_NME_TASK_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_private_common.h b/drivers/staging/csr/csr_wifi_private_common.h deleted file mode 100644 index ee3bd51b934a..000000000000 --- a/drivers/staging/csr/csr_wifi_private_common.h +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifndef CSR_WIFI_PRIVATE_COMMON_H__ -#define CSR_WIFI_PRIVATE_COMMON_H__ - -/** - * @brief maximum number of STAs allowed to be connected - * - * @par Description - * min & max Beacon Interval - */ -#define CSR_WIFI_AP_MAX_ASSOC_STA 8 - -/** Number of only b rates */ -#define CSR_WIFI_SME_AP_MAX_ONLY_B_RATES 4 - - -/** Number of mandatory b rates */ -#define CSR_WIFI_SME_AP_MAX_MANDATORY_B_RATES 2 - - -/** Number of mandatory bg rates */ -#define CSR_WIFI_SME_AP_MAX_MANDATORY_BG_RATES 4 - - -/** Number of bg rates */ -#define CSR_WIFI_SME_AP_MAX_BG_RATES 12 - - -/** Number of no b only g rates */ -#define CSR_WIFI_SME_AP_MAX_NO_B_ONLY_G_RATES 8 - - -/** Number of mandatory g rates */ -#define CSR_WIFI_SME_AP_MAX_MANDATORY_G_RATES 7 - - -/* Number of g mandatory rates */ -#define CSR_WIFI_SME_AP_G_MANDATORY_RATES_NUM 7 - - -/* Number of b mandatory rates */ -#define CSR_WIFI_SME_AP_B_MANDATORY_RATES_NUM 2 - - -/* Number of b/g mandatory rates */ -#define CSR_WIFI_SME_AP_BG_MANDATORY_RATES_NUM 4 - - -/* The maximum allowed length of SSID */ -#define CSR_WIFI_SME_AP_SSID_MAX_LENGTH 32 - -/* Refer 8.4.2.27 RSN element - we support TKIP, WPA2, WAPI and PSK only, no pmkid, group cipher suite */ -#define CSR_WIFI_SME_RSN_PACKED_SIZE (1 + 1 + 2 + 4 + 2 + 4 * 2 + 2 + 4 * 1 + 2 + 24) - -/* Refer 7.3.2.9 (ISO/IEC 8802-11:2006) WAPI element - we support WAPI PSK only, no bkid, group cipher suite */ -#define CSR_WIFI_SME_WAPI_PACKED_SIZE (1 + 1 + 2 + 2 + 4 * 1 + 2 + 4 * 1 + 4 + 2 + 24) - - -/* Common structure for NME and SME to maintain Interface mode*/ -typedef u8 CsrWifiInterfaceMode; -#define CSR_WIFI_MODE_NONE ((CsrWifiInterfaceMode) 0xFF) -#define CSR_WIFI_MODE_STA ((CsrWifiInterfaceMode) 0x00) -#define CSR_WIFI_MODE_AP ((CsrWifiInterfaceMode) 0x01) -#define CSR_WIFI_MODE_P2P_DEVICE ((CsrWifiInterfaceMode) 0x02) -#define CSR_WIFI_MODE_P2P_CLI ((CsrWifiInterfaceMode) 0x03) -#define CSR_WIFI_MODE_P2P_GO ((CsrWifiInterfaceMode) 0x04) -#define CSR_WIFI_MODE_AMP ((CsrWifiInterfaceMode) 0x05) -#define CSR_WIFI_MODE_WPS_ENROLLEE ((CsrWifiInterfaceMode) 0x06) -#define CSR_WIFI_MODE_IBSS ((CsrWifiInterfaceMode) 0x07) - -#endif - diff --git a/drivers/staging/csr/csr_wifi_result.h b/drivers/staging/csr/csr_wifi_result.h deleted file mode 100644 index 3c394c7e5fa9..000000000000 --- a/drivers/staging/csr/csr_wifi_result.h +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifndef CSR_WIFI_RESULT_H__ -#define CSR_WIFI_RESULT_H__ - -#include "csr_result.h" - -/* THIS FILE SHOULD CONTAIN ONLY RESULT CODES */ - -/* Result Codes */ -#define CSR_WIFI_HIP_RESULT_INVALID_VALUE ((CsrResult) 1) /* Invalid argument value */ -#define CSR_WIFI_HIP_RESULT_NO_DEVICE ((CsrResult) 2) /* The specified device is no longer present */ -#define CSR_WIFI_HIP_RESULT_NO_SPACE ((CsrResult) 3) /* A queue or buffer is full */ -#define CSR_WIFI_HIP_RESULT_NO_MEMORY ((CsrResult) 4) /* Fatal error, no memory */ -#define CSR_WIFI_HIP_RESULT_RANGE ((CsrResult) 5) /* Request exceeds the range of a file or a buffer */ -#define CSR_WIFI_HIP_RESULT_NOT_FOUND ((CsrResult) 6) /* A file (typically a f/w patch) is not found */ - -#endif /* CSR_WIFI_RESULT_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_router_converter_init.c b/drivers/staging/csr/csr_wifi_router_converter_init.c deleted file mode 100644 index 775c013d0514..000000000000 --- a/drivers/staging/csr/csr_wifi_router_converter_init.c +++ /dev/null @@ -1,82 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#include "csr_msgconv.h" -#include "csr_macro.h" - - -#ifdef CSR_LOG_ENABLE -#include "csr_log.h" -#endif - -#ifndef EXCLUDE_CSR_WIFI_ROUTER_MODULE -#include "csr_wifi_router_serialize.h" -#include "csr_wifi_router_prim.h" - -static CsrMsgConvMsgEntry csrwifirouter_conv_lut[] = { - { CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ, CsrWifiRouterMaPacketSubscribeReqSizeof, CsrWifiRouterMaPacketSubscribeReqSer, CsrWifiRouterMaPacketSubscribeReqDes, CsrWifiRouterMaPacketSubscribeReqSerFree }, - { CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ, CsrWifiRouterMaPacketUnsubscribeReqSizeof, CsrWifiRouterMaPacketUnsubscribeReqSer, CsrWifiRouterMaPacketUnsubscribeReqDes, CsrWifiRouterMaPacketUnsubscribeReqSerFree }, - { CSR_WIFI_ROUTER_MA_PACKET_REQ, CsrWifiRouterMaPacketReqSizeof, CsrWifiRouterMaPacketReqSer, CsrWifiRouterMaPacketReqDes, CsrWifiRouterMaPacketReqSerFree }, - { CSR_WIFI_ROUTER_MA_PACKET_RES, CsrWifiRouterMaPacketResSizeof, CsrWifiRouterMaPacketResSer, CsrWifiRouterMaPacketResDes, CsrWifiRouterMaPacketResSerFree }, - { CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ, CsrWifiRouterMaPacketCancelReqSizeof, CsrWifiRouterMaPacketCancelReqSer, CsrWifiRouterMaPacketCancelReqDes, CsrWifiRouterMaPacketCancelReqSerFree }, - { CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM, CsrWifiRouterMaPacketSubscribeCfmSizeof, CsrWifiRouterMaPacketSubscribeCfmSer, CsrWifiRouterMaPacketSubscribeCfmDes, CsrWifiRouterMaPacketSubscribeCfmSerFree }, - { CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM, CsrWifiRouterMaPacketUnsubscribeCfmSizeof, CsrWifiRouterMaPacketUnsubscribeCfmSer, CsrWifiRouterMaPacketUnsubscribeCfmDes, CsrWifiRouterMaPacketUnsubscribeCfmSerFree }, - { CSR_WIFI_ROUTER_MA_PACKET_CFM, CsrWifiRouterMaPacketCfmSizeof, CsrWifiRouterMaPacketCfmSer, CsrWifiRouterMaPacketCfmDes, CsrWifiRouterMaPacketCfmSerFree }, - { CSR_WIFI_ROUTER_MA_PACKET_IND, CsrWifiRouterMaPacketIndSizeof, CsrWifiRouterMaPacketIndSer, CsrWifiRouterMaPacketIndDes, CsrWifiRouterMaPacketIndSerFree }, - - { 0, NULL, NULL, NULL, NULL }, -}; - -CsrMsgConvMsgEntry* CsrWifiRouterConverterLookup(CsrMsgConvMsgEntry *ce, u16 msgType) -{ - if (msgType & CSR_PRIM_UPSTREAM) - { - u16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT; - if (idx < (CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT) && - csrwifirouter_conv_lut[idx].msgType == msgType) - { - return &csrwifirouter_conv_lut[idx]; - } - } - else - { - if (msgType < CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT && - csrwifirouter_conv_lut[msgType].msgType == msgType) - { - return &csrwifirouter_conv_lut[msgType]; - } - } - return NULL; -} - - -void CsrWifiRouterConverterInit(void) -{ - CsrMsgConvInsert(CSR_WIFI_ROUTER_PRIM, csrwifirouter_conv_lut); - CsrMsgConvCustomLookupRegister(CSR_WIFI_ROUTER_PRIM, CsrWifiRouterConverterLookup); -} - - -#ifdef CSR_LOG_ENABLE -static const CsrLogPrimitiveInformation csrwifirouter_conv_info = { - CSR_WIFI_ROUTER_PRIM, - (char *)"CSR_WIFI_ROUTER_PRIM", - csrwifirouter_conv_lut -}; -const CsrLogPrimitiveInformation* CsrWifiRouterTechInfoGet(void) -{ - return &csrwifirouter_conv_info; -} - - -#endif /* CSR_LOG_ENABLE */ -#endif /* EXCLUDE_CSR_WIFI_ROUTER_MODULE */ diff --git a/drivers/staging/csr/csr_wifi_router_converter_init.h b/drivers/staging/csr/csr_wifi_router_converter_init.h deleted file mode 100644 index 478327b75c18..000000000000 --- a/drivers/staging/csr/csr_wifi_router_converter_init.h +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_ROUTER_CONVERTER_INIT_H__ -#define CSR_WIFI_ROUTER_CONVERTER_INIT_H__ - -#ifndef EXCLUDE_CSR_WIFI_ROUTER_MODULE - -#include "csr_msgconv.h" - -#ifdef CSR_LOG_ENABLE -#include "csr_log.h" - -extern const CsrLogPrimitiveInformation* CsrWifiRouterTechInfoGet(void); -#endif /* CSR_LOG_ENABLE */ - -extern void CsrWifiRouterConverterInit(void); - -#else /* EXCLUDE_CSR_WIFI_ROUTER_MODULE */ - -#define CsrWifiRouterConverterInit() - -#endif /* EXCLUDE_CSR_WIFI_ROUTER_MODULE */ - -#endif /* CSR_WIFI_ROUTER_CONVERTER_INIT_H__ */ diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c deleted file mode 100644 index a02e307e5a88..000000000000 --- a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c +++ /dev/null @@ -1,134 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#include "csr_msgconv.h" -#include "csr_macro.h" - -#ifdef CSR_LOG_ENABLE -#include "csr_log.h" -#endif - -#ifndef EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE -#include "csr_wifi_router_ctrl_serialize.h" -#include "csr_wifi_router_ctrl_prim.h" - -static CsrMsgConvMsgEntry csrwifirouterctrl_conv_lut[] = { - { CSR_WIFI_ROUTER_CTRL_CONFIGURE_POWER_MODE_REQ, CsrWifiRouterCtrlConfigurePowerModeReqSizeof, CsrWifiRouterCtrlConfigurePowerModeReqSer, CsrWifiRouterCtrlConfigurePowerModeReqDes, CsrWifiRouterCtrlConfigurePowerModeReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_HIP_REQ, CsrWifiRouterCtrlHipReqSizeof, CsrWifiRouterCtrlHipReqSer, CsrWifiRouterCtrlHipReqDes, CsrWifiRouterCtrlHipReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_REQ, CsrWifiRouterCtrlMediaStatusReqSizeof, CsrWifiRouterCtrlMediaStatusReqSer, CsrWifiRouterCtrlMediaStatusReqDes, CsrWifiRouterCtrlMediaStatusReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES, CsrWifiRouterCtrlMulticastAddressResSizeof, CsrWifiRouterCtrlMulticastAddressResSer, CsrWifiRouterCtrlMulticastAddressResDes, CsrWifiRouterCtrlMulticastAddressResSerFree }, - { CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_REQ, CsrWifiRouterCtrlPortConfigureReqSizeof, CsrWifiRouterCtrlPortConfigureReqSer, CsrWifiRouterCtrlPortConfigureReqDes, CsrWifiRouterCtrlPortConfigureReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_REQ, CsrWifiRouterCtrlQosControlReqSizeof, CsrWifiRouterCtrlQosControlReqSer, CsrWifiRouterCtrlQosControlReqDes, CsrWifiRouterCtrlQosControlReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_SUSPEND_RES, CsrWifiRouterCtrlSuspendResSizeof, CsrWifiRouterCtrlSuspendResSer, CsrWifiRouterCtrlSuspendResDes, CsrWifiRouterCtrlSuspendResSerFree }, - { CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ, CsrWifiRouterCtrlTclasAddReqSizeof, CsrWifiRouterCtrlTclasAddReqSer, CsrWifiRouterCtrlTclasAddReqDes, CsrWifiRouterCtrlTclasAddReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_RESUME_RES, CsrWifiRouterCtrlResumeResSizeof, CsrWifiRouterCtrlResumeResSer, CsrWifiRouterCtrlResumeResDes, CsrWifiRouterCtrlResumeResSerFree }, - { CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_REQ, CsrWifiRouterCtrlRawSdioDeinitialiseReqSizeof, CsrWifiRouterCtrlRawSdioDeinitialiseReqSer, CsrWifiRouterCtrlRawSdioDeinitialiseReqDes, CsrWifiRouterCtrlRawSdioDeinitialiseReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_REQ, CsrWifiRouterCtrlRawSdioInitialiseReqSizeof, CsrWifiRouterCtrlRawSdioInitialiseReqSer, CsrWifiRouterCtrlRawSdioInitialiseReqDes, CsrWifiRouterCtrlRawSdioInitialiseReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ, CsrWifiRouterCtrlTclasDelReqSizeof, CsrWifiRouterCtrlTclasDelReqSer, CsrWifiRouterCtrlTclasDelReqDes, CsrWifiRouterCtrlTclasDelReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_TRAFFIC_CLASSIFICATION_REQ, CsrWifiRouterCtrlTrafficClassificationReqSizeof, CsrWifiRouterCtrlTrafficClassificationReqSer, CsrWifiRouterCtrlTrafficClassificationReqDes, CsrWifiRouterCtrlTrafficClassificationReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_REQ, CsrWifiRouterCtrlTrafficConfigReqSizeof, CsrWifiRouterCtrlTrafficConfigReqSer, CsrWifiRouterCtrlTrafficConfigReqDes, CsrWifiRouterCtrlTrafficConfigReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_WIFI_OFF_REQ, CsrWifiRouterCtrlWifiOffReqSizeof, CsrWifiRouterCtrlWifiOffReqSer, CsrWifiRouterCtrlWifiOffReqDes, CsrWifiRouterCtrlWifiOffReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_WIFI_OFF_RES, CsrWifiRouterCtrlWifiOffResSizeof, CsrWifiRouterCtrlWifiOffResSer, CsrWifiRouterCtrlWifiOffResDes, CsrWifiRouterCtrlWifiOffResSerFree }, - { CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ, CsrWifiRouterCtrlWifiOnReqSizeof, CsrWifiRouterCtrlWifiOnReqSer, CsrWifiRouterCtrlWifiOnReqDes, CsrWifiRouterCtrlWifiOnReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES, CsrWifiRouterCtrlWifiOnResSizeof, CsrWifiRouterCtrlWifiOnResSer, CsrWifiRouterCtrlWifiOnResDes, CsrWifiRouterCtrlWifiOnResSerFree }, - { CSR_WIFI_ROUTER_CTRL_M4_TRANSMIT_REQ, CsrWifiRouterCtrlM4TransmitReqSizeof, CsrWifiRouterCtrlM4TransmitReqSer, CsrWifiRouterCtrlM4TransmitReqDes, CsrWifiRouterCtrlM4TransmitReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_MODE_SET_REQ, CsrWifiRouterCtrlModeSetReqSizeof, CsrWifiRouterCtrlModeSetReqSer, CsrWifiRouterCtrlModeSetReqDes, CsrWifiRouterCtrlModeSetReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_PEER_ADD_REQ, CsrWifiRouterCtrlPeerAddReqSizeof, CsrWifiRouterCtrlPeerAddReqSer, CsrWifiRouterCtrlPeerAddReqDes, CsrWifiRouterCtrlPeerAddReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_PEER_DEL_REQ, CsrWifiRouterCtrlPeerDelReqSizeof, CsrWifiRouterCtrlPeerDelReqSer, CsrWifiRouterCtrlPeerDelReqDes, CsrWifiRouterCtrlPeerDelReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_REQ, CsrWifiRouterCtrlPeerUpdateReqSizeof, CsrWifiRouterCtrlPeerUpdateReqSer, CsrWifiRouterCtrlPeerUpdateReqDes, CsrWifiRouterCtrlPeerUpdateReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ, CsrWifiRouterCtrlCapabilitiesReqSizeof, CsrWifiRouterCtrlCapabilitiesReqSer, CsrWifiRouterCtrlCapabilitiesReqDes, CsrWifiRouterCtrlCapabilitiesReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ, CsrWifiRouterCtrlBlockAckEnableReqSizeof, CsrWifiRouterCtrlBlockAckEnableReqSer, CsrWifiRouterCtrlBlockAckEnableReqDes, CsrWifiRouterCtrlBlockAckEnableReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ, CsrWifiRouterCtrlBlockAckDisableReqSizeof, CsrWifiRouterCtrlBlockAckDisableReqSer, CsrWifiRouterCtrlBlockAckDisableReqDes, CsrWifiRouterCtrlBlockAckDisableReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ, CsrWifiRouterCtrlWapiRxPktReqSizeof, CsrWifiRouterCtrlWapiRxPktReqSer, CsrWifiRouterCtrlWapiRxPktReqDes, CsrWifiRouterCtrlWapiRxPktReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ, CsrWifiRouterCtrlWapiMulticastFilterReqSizeof, CsrWifiRouterCtrlWapiMulticastFilterReqSer, CsrWifiRouterCtrlWapiMulticastFilterReqDes, CsrWifiRouterCtrlWapiMulticastFilterReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ, CsrWifiRouterCtrlWapiUnicastFilterReqSizeof, CsrWifiRouterCtrlWapiUnicastFilterReqSer, CsrWifiRouterCtrlWapiUnicastFilterReqDes, CsrWifiRouterCtrlWapiUnicastFilterReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ, CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof, CsrWifiRouterCtrlWapiUnicastTxPktReqSer, CsrWifiRouterCtrlWapiUnicastTxPktReqDes, CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_WAPI_FILTER_REQ, CsrWifiRouterCtrlWapiFilterReqSizeof, CsrWifiRouterCtrlWapiFilterReqSer, CsrWifiRouterCtrlWapiFilterReqDes, CsrWifiRouterCtrlWapiFilterReqSerFree }, - { CSR_WIFI_ROUTER_CTRL_HIP_IND, CsrWifiRouterCtrlHipIndSizeof, CsrWifiRouterCtrlHipIndSer, CsrWifiRouterCtrlHipIndDes, CsrWifiRouterCtrlHipIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND, CsrWifiRouterCtrlMulticastAddressIndSizeof, CsrWifiRouterCtrlMulticastAddressIndSer, CsrWifiRouterCtrlMulticastAddressIndDes, CsrWifiRouterCtrlMulticastAddressIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_CFM, CsrWifiRouterCtrlPortConfigureCfmSizeof, CsrWifiRouterCtrlPortConfigureCfmSer, CsrWifiRouterCtrlPortConfigureCfmDes, CsrWifiRouterCtrlPortConfigureCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_RESUME_IND, CsrWifiRouterCtrlResumeIndSizeof, CsrWifiRouterCtrlResumeIndSer, CsrWifiRouterCtrlResumeIndDes, CsrWifiRouterCtrlResumeIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_SUSPEND_IND, CsrWifiRouterCtrlSuspendIndSizeof, CsrWifiRouterCtrlSuspendIndSer, CsrWifiRouterCtrlSuspendIndDes, CsrWifiRouterCtrlSuspendIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_CFM, CsrWifiRouterCtrlTclasAddCfmSizeof, CsrWifiRouterCtrlTclasAddCfmSer, CsrWifiRouterCtrlTclasAddCfmDes, CsrWifiRouterCtrlTclasAddCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_CFM, CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof, CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer, CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes, CsrWifiRouterCtrlRawSdioDeinitialiseCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_CFM, CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof, CsrWifiRouterCtrlRawSdioInitialiseCfmSer, CsrWifiRouterCtrlRawSdioInitialiseCfmDes, CsrWifiRouterCtrlRawSdioInitialiseCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_CFM, CsrWifiRouterCtrlTclasDelCfmSizeof, CsrWifiRouterCtrlTclasDelCfmSer, CsrWifiRouterCtrlTclasDelCfmDes, CsrWifiRouterCtrlTclasDelCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_TRAFFIC_PROTOCOL_IND, CsrWifiRouterCtrlTrafficProtocolIndSizeof, CsrWifiRouterCtrlTrafficProtocolIndSer, CsrWifiRouterCtrlTrafficProtocolIndDes, CsrWifiRouterCtrlTrafficProtocolIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_TRAFFIC_SAMPLE_IND, CsrWifiRouterCtrlTrafficSampleIndSizeof, CsrWifiRouterCtrlTrafficSampleIndSer, CsrWifiRouterCtrlTrafficSampleIndDes, CsrWifiRouterCtrlTrafficSampleIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_WIFI_OFF_IND, CsrWifiRouterCtrlWifiOffIndSizeof, CsrWifiRouterCtrlWifiOffIndSer, CsrWifiRouterCtrlWifiOffIndDes, CsrWifiRouterCtrlWifiOffIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_WIFI_OFF_CFM, CsrWifiRouterCtrlWifiOffCfmSizeof, CsrWifiRouterCtrlWifiOffCfmSer, CsrWifiRouterCtrlWifiOffCfmDes, CsrWifiRouterCtrlWifiOffCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND, CsrWifiRouterCtrlWifiOnIndSizeof, CsrWifiRouterCtrlWifiOnIndSer, CsrWifiRouterCtrlWifiOnIndDes, CsrWifiRouterCtrlWifiOnIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_WIFI_ON_CFM, CsrWifiRouterCtrlWifiOnCfmSizeof, CsrWifiRouterCtrlWifiOnCfmSer, CsrWifiRouterCtrlWifiOnCfmDes, CsrWifiRouterCtrlWifiOnCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_M4_READY_TO_SEND_IND, CsrWifiRouterCtrlM4ReadyToSendIndSizeof, CsrWifiRouterCtrlM4ReadyToSendIndSer, CsrWifiRouterCtrlM4ReadyToSendIndDes, CsrWifiRouterCtrlM4ReadyToSendIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_M4_TRANSMITTED_IND, CsrWifiRouterCtrlM4TransmittedIndSizeof, CsrWifiRouterCtrlM4TransmittedIndSer, CsrWifiRouterCtrlM4TransmittedIndDes, CsrWifiRouterCtrlM4TransmittedIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_MIC_FAILURE_IND, CsrWifiRouterCtrlMicFailureIndSizeof, CsrWifiRouterCtrlMicFailureIndSer, CsrWifiRouterCtrlMicFailureIndDes, CsrWifiRouterCtrlMicFailureIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_CONNECTED_IND, CsrWifiRouterCtrlConnectedIndSizeof, CsrWifiRouterCtrlConnectedIndSer, CsrWifiRouterCtrlConnectedIndDes, CsrWifiRouterCtrlConnectedIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_PEER_ADD_CFM, CsrWifiRouterCtrlPeerAddCfmSizeof, CsrWifiRouterCtrlPeerAddCfmSer, CsrWifiRouterCtrlPeerAddCfmDes, CsrWifiRouterCtrlPeerAddCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_PEER_DEL_CFM, CsrWifiRouterCtrlPeerDelCfmSizeof, CsrWifiRouterCtrlPeerDelCfmSer, CsrWifiRouterCtrlPeerDelCfmDes, CsrWifiRouterCtrlPeerDelCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_UNEXPECTED_FRAME_IND, CsrWifiRouterCtrlUnexpectedFrameIndSizeof, CsrWifiRouterCtrlUnexpectedFrameIndSer, CsrWifiRouterCtrlUnexpectedFrameIndDes, CsrWifiRouterCtrlUnexpectedFrameIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_CFM, CsrWifiRouterCtrlPeerUpdateCfmSizeof, CsrWifiRouterCtrlPeerUpdateCfmSer, CsrWifiRouterCtrlPeerUpdateCfmDes, CsrWifiRouterCtrlPeerUpdateCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_CAPABILITIES_CFM, CsrWifiRouterCtrlCapabilitiesCfmSizeof, CsrWifiRouterCtrlCapabilitiesCfmSer, CsrWifiRouterCtrlCapabilitiesCfmDes, CsrWifiRouterCtrlCapabilitiesCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_CFM, CsrWifiRouterCtrlBlockAckEnableCfmSizeof, CsrWifiRouterCtrlBlockAckEnableCfmSer, CsrWifiRouterCtrlBlockAckEnableCfmDes, CsrWifiRouterCtrlBlockAckEnableCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM, CsrWifiRouterCtrlBlockAckDisableCfmSizeof, CsrWifiRouterCtrlBlockAckDisableCfmSer, CsrWifiRouterCtrlBlockAckDisableCfmDes, CsrWifiRouterCtrlBlockAckDisableCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND, CsrWifiRouterCtrlBlockAckErrorIndSizeof, CsrWifiRouterCtrlBlockAckErrorIndSer, CsrWifiRouterCtrlBlockAckErrorIndDes, CsrWifiRouterCtrlBlockAckErrorIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND, CsrWifiRouterCtrlStaInactiveIndSizeof, CsrWifiRouterCtrlStaInactiveIndSer, CsrWifiRouterCtrlStaInactiveIndDes, CsrWifiRouterCtrlStaInactiveIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND, CsrWifiRouterCtrlWapiRxMicCheckIndSizeof, CsrWifiRouterCtrlWapiRxMicCheckIndSer, CsrWifiRouterCtrlWapiRxMicCheckIndDes, CsrWifiRouterCtrlWapiRxMicCheckIndSerFree }, - { CSR_WIFI_ROUTER_CTRL_MODE_SET_CFM, CsrWifiRouterCtrlModeSetCfmSizeof, CsrWifiRouterCtrlModeSetCfmSer, CsrWifiRouterCtrlModeSetCfmDes, CsrWifiRouterCtrlModeSetCfmSerFree }, - { CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND, CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof, CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer, CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes, CsrWifiRouterCtrlWapiUnicastTxEncryptIndSerFree }, - - { 0, NULL, NULL, NULL, NULL }, -}; - -CsrMsgConvMsgEntry* CsrWifiRouterCtrlConverterLookup(CsrMsgConvMsgEntry *ce, u16 msgType) -{ - if (msgType & CSR_PRIM_UPSTREAM) - { - u16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT; - if (idx < (CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT) && - csrwifirouterctrl_conv_lut[idx].msgType == msgType) - { - return &csrwifirouterctrl_conv_lut[idx]; - } - } - else - { - if (msgType < CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT && - csrwifirouterctrl_conv_lut[msgType].msgType == msgType) - { - return &csrwifirouterctrl_conv_lut[msgType]; - } - } - return NULL; -} - - -void CsrWifiRouterCtrlConverterInit(void) -{ - CsrMsgConvInsert(CSR_WIFI_ROUTER_CTRL_PRIM, csrwifirouterctrl_conv_lut); - CsrMsgConvCustomLookupRegister(CSR_WIFI_ROUTER_CTRL_PRIM, CsrWifiRouterCtrlConverterLookup); -} - - -#ifdef CSR_LOG_ENABLE -static const CsrLogPrimitiveInformation csrwifirouterctrl_conv_info = { - CSR_WIFI_ROUTER_CTRL_PRIM, - (char *)"CSR_WIFI_ROUTER_CTRL_PRIM", - csrwifirouterctrl_conv_lut -}; -const CsrLogPrimitiveInformation* CsrWifiRouterCtrlTechInfoGet(void) -{ - return &csrwifirouterctrl_conv_info; -} - - -#endif /* CSR_LOG_ENABLE */ -#endif /* EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE */ diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h deleted file mode 100644 index c98458912825..000000000000 --- a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_ROUTER_CTRL_CONVERTER_INIT_H__ -#define CSR_WIFI_ROUTER_CTRL_CONVERTER_INIT_H__ - -#ifndef EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE - -#include "csr_msgconv.h" - -#ifdef CSR_LOG_ENABLE -#include "csr_log.h" - -extern const CsrLogPrimitiveInformation* CsrWifiRouterCtrlTechInfoGet(void); -#endif /* CSR_LOG_ENABLE */ - -extern void CsrWifiRouterCtrlConverterInit(void); - -#else /* EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE */ - -#define CsrWifiRouterCtrlConverterInit() - -#endif /* EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE */ - -#endif /* CSR_WIFI_ROUTER_CTRL_CONVERTER_INIT_H__ */ diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c deleted file mode 100644 index 7fa85fb4d6c0..000000000000 --- a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c +++ /dev/null @@ -1,108 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ -#include <linux/slab.h> -#include "csr_wifi_router_ctrl_prim.h" -#include "csr_wifi_router_ctrl_lib.h" - -/*----------------------------------------------------------------------------* - * NAME - * CsrWifiRouterCtrlFreeDownstreamMessageContents - * - * DESCRIPTION - * - * - * PARAMETERS - * eventClass: only the value CSR_WIFI_ROUTER_CTRL_PRIM will be handled - * message: the message to free - *----------------------------------------------------------------------------*/ -void CsrWifiRouterCtrlFreeDownstreamMessageContents(u16 eventClass, void *message) -{ - if (eventClass != CSR_WIFI_ROUTER_CTRL_PRIM) - { - return; - } - if (NULL == message) - { - return; - } - - switch (*((CsrWifiRouterCtrlPrim *) message)) - { - case CSR_WIFI_ROUTER_CTRL_HIP_REQ: - { - CsrWifiRouterCtrlHipReq *p = (CsrWifiRouterCtrlHipReq *)message; - kfree(p->mlmeCommand); - p->mlmeCommand = NULL; - kfree(p->dataRef1); - p->dataRef1 = NULL; - kfree(p->dataRef2); - p->dataRef2 = NULL; - break; - } - case CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES: - { - CsrWifiRouterCtrlMulticastAddressRes *p = (CsrWifiRouterCtrlMulticastAddressRes *)message; - kfree(p->getAddresses); - p->getAddresses = NULL; - break; - } - case CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ: - { - CsrWifiRouterCtrlTclasAddReq *p = (CsrWifiRouterCtrlTclasAddReq *)message; - kfree(p->tclas); - p->tclas = NULL; - break; - } - case CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ: - { - CsrWifiRouterCtrlTclasDelReq *p = (CsrWifiRouterCtrlTclasDelReq *)message; - kfree(p->tclas); - p->tclas = NULL; - break; - } - case CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ: - { - CsrWifiRouterCtrlWifiOnReq *p = (CsrWifiRouterCtrlWifiOnReq *)message; - kfree(p->data); - p->data = NULL; - break; - } - case CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES: - { - CsrWifiRouterCtrlWifiOnRes *p = (CsrWifiRouterCtrlWifiOnRes *)message; - kfree(p->smeVersions.smeBuild); - p->smeVersions.smeBuild = NULL; - break; - } - case CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ: - { - CsrWifiRouterCtrlWapiRxPktReq *p = (CsrWifiRouterCtrlWapiRxPktReq *)message; - kfree(p->signal); - p->signal = NULL; - kfree(p->data); - p->data = NULL; - break; - } - case CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ: - { - CsrWifiRouterCtrlWapiUnicastTxPktReq *p = (CsrWifiRouterCtrlWapiUnicastTxPktReq *)message; - kfree(p->data); - p->data = NULL; - break; - } - - default: - break; - } -} - - diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c deleted file mode 100644 index 954b3defc49c..000000000000 --- a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c +++ /dev/null @@ -1,87 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ -#include <linux/slab.h> -#include "csr_wifi_router_ctrl_prim.h" -#include "csr_wifi_router_ctrl_lib.h" - -/*----------------------------------------------------------------------------* - * NAME - * CsrWifiRouterCtrlFreeUpstreamMessageContents - * - * DESCRIPTION - * - * - * PARAMETERS - * eventClass: only the value CSR_WIFI_ROUTER_CTRL_PRIM will be handled - * message: the message to free - *----------------------------------------------------------------------------*/ -void CsrWifiRouterCtrlFreeUpstreamMessageContents(u16 eventClass, void *message) -{ - if (eventClass != CSR_WIFI_ROUTER_CTRL_PRIM) - { - return; - } - if (NULL == message) - { - return; - } - - switch (*((CsrWifiRouterCtrlPrim *) message)) - { - case CSR_WIFI_ROUTER_CTRL_HIP_IND: - { - CsrWifiRouterCtrlHipInd *p = (CsrWifiRouterCtrlHipInd *)message; - kfree(p->mlmeCommand); - p->mlmeCommand = NULL; - kfree(p->dataRef1); - p->dataRef1 = NULL; - kfree(p->dataRef2); - p->dataRef2 = NULL; - break; - } - case CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND: - { - CsrWifiRouterCtrlMulticastAddressInd *p = (CsrWifiRouterCtrlMulticastAddressInd *)message; - kfree(p->setAddresses); - p->setAddresses = NULL; - break; - } - case CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND: - { - CsrWifiRouterCtrlWifiOnInd *p = (CsrWifiRouterCtrlWifiOnInd *)message; - kfree(p->versions.routerBuild); - p->versions.routerBuild = NULL; - break; - } - case CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND: - { - CsrWifiRouterCtrlWapiRxMicCheckInd *p = (CsrWifiRouterCtrlWapiRxMicCheckInd *)message; - kfree(p->signal); - p->signal = NULL; - kfree(p->data); - p->data = NULL; - break; - } - case CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND: - { - CsrWifiRouterCtrlWapiUnicastTxEncryptInd *p = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *)message; - kfree(p->data); - p->data = NULL; - break; - } - - default: - break; - } -} - - diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h deleted file mode 100644 index f235153c42af..000000000000 --- a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h +++ /dev/null @@ -1,2082 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_ROUTER_CTRL_LIB_H__ -#define CSR_WIFI_ROUTER_CTRL_LIB_H__ - -#include "csr_sched.h" -#include "csr_macro.h" -#include "csr_msg_transport.h" - -#include "csr_wifi_lib.h" - -#include "csr_wifi_router_ctrl_prim.h" -#include "csr_wifi_router_task.h" - -/*----------------------------------------------------------------------------* - * CsrWifiRouterCtrlFreeUpstreamMessageContents - * - * DESCRIPTION - * Free the allocated memory in a CSR_WIFI_ROUTER_CTRL upstream message. Does not - * free the message itself, and can only be used for upstream messages. - * - * PARAMETERS - * Deallocates the resources in a CSR_WIFI_ROUTER_CTRL upstream message - *----------------------------------------------------------------------------*/ -void CsrWifiRouterCtrlFreeUpstreamMessageContents(u16 eventClass, void *message); - -/*----------------------------------------------------------------------------* - * CsrWifiRouterCtrlFreeDownstreamMessageContents - * - * DESCRIPTION - * Free the allocated memory in a CSR_WIFI_ROUTER_CTRL downstream message. Does not - * free the message itself, and can only be used for downstream messages. - * - * PARAMETERS - * Deallocates the resources in a CSR_WIFI_ROUTER_CTRL downstream message - *----------------------------------------------------------------------------*/ -void CsrWifiRouterCtrlFreeDownstreamMessageContents(u16 eventClass, void *message); - -/*----------------------------------------------------------------------------* - * Enum to string functions - *----------------------------------------------------------------------------*/ -const char* CsrWifiRouterCtrlBlockAckRoleToString(CsrWifiRouterCtrlBlockAckRole value); -const char* CsrWifiRouterCtrlControlIndicationToString(CsrWifiRouterCtrlControlIndication value); -const char* CsrWifiRouterCtrlListActionToString(CsrWifiRouterCtrlListAction value); -const char* CsrWifiRouterCtrlLowPowerModeToString(CsrWifiRouterCtrlLowPowerMode value); -const char* CsrWifiRouterCtrlMediaStatusToString(CsrWifiRouterCtrlMediaStatus value); -const char* CsrWifiRouterCtrlModeToString(CsrWifiRouterCtrlMode value); -const char* CsrWifiRouterCtrlPeerStatusToString(CsrWifiRouterCtrlPeerStatus value); -const char* CsrWifiRouterCtrlPortActionToString(CsrWifiRouterCtrlPortAction value); -const char* CsrWifiRouterCtrlPowersaveTypeToString(CsrWifiRouterCtrlPowersaveType value); -const char* CsrWifiRouterCtrlProtocolDirectionToString(CsrWifiRouterCtrlProtocolDirection value); -const char* CsrWifiRouterCtrlQoSControlToString(CsrWifiRouterCtrlQoSControl value); -const char* CsrWifiRouterCtrlQueueConfigToString(CsrWifiRouterCtrlQueueConfig value); -const char* CsrWifiRouterCtrlTrafficConfigTypeToString(CsrWifiRouterCtrlTrafficConfigType value); -const char* CsrWifiRouterCtrlTrafficPacketTypeToString(CsrWifiRouterCtrlTrafficPacketType value); -const char* CsrWifiRouterCtrlTrafficTypeToString(CsrWifiRouterCtrlTrafficType value); - - -/*----------------------------------------------------------------------------* - * CsrPrim Type toString function. - * Converts a message type to the String name of the Message - *----------------------------------------------------------------------------*/ -const char* CsrWifiRouterCtrlPrimTypeToString(CsrPrim msgType); - -/*----------------------------------------------------------------------------* - * Lookup arrays for PrimType name Strings - *----------------------------------------------------------------------------*/ -extern const char *CsrWifiRouterCtrlUpstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT]; -extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT]; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlBlockAckDisableReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - macAddress - - trafficStreamID - - role - - -*******************************************************************************/ -#define CsrWifiRouterCtrlBlockAckDisableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckDisableReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->macAddress = (macAddress__); \ - msg__->trafficStreamID = (trafficStreamID__); \ - msg__->role = (role__); - -#define CsrWifiRouterCtrlBlockAckDisableReqSendTo(dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__) \ - { \ - CsrWifiRouterCtrlBlockAckDisableReq *msg__; \ - CsrWifiRouterCtrlBlockAckDisableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlBlockAckDisableReqSend(src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__) \ - CsrWifiRouterCtrlBlockAckDisableReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlBlockAckDisableCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlBlockAckDisableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckDisableCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlBlockAckDisableCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \ - { \ - CsrWifiRouterCtrlBlockAckDisableCfm *msg__; \ - CsrWifiRouterCtrlBlockAckDisableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlBlockAckDisableCfmSend(dst__, clientData__, interfaceTag__, status__) \ - CsrWifiRouterCtrlBlockAckDisableCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlBlockAckEnableReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - macAddress - - trafficStreamID - - role - - bufferSize - - timeout - - ssn - - -*******************************************************************************/ -#define CsrWifiRouterCtrlBlockAckEnableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckEnableReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->macAddress = (macAddress__); \ - msg__->trafficStreamID = (trafficStreamID__); \ - msg__->role = (role__); \ - msg__->bufferSize = (bufferSize__); \ - msg__->timeout = (timeout__); \ - msg__->ssn = (ssn__); - -#define CsrWifiRouterCtrlBlockAckEnableReqSendTo(dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__) \ - { \ - CsrWifiRouterCtrlBlockAckEnableReq *msg__; \ - CsrWifiRouterCtrlBlockAckEnableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlBlockAckEnableReqSend(src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__) \ - CsrWifiRouterCtrlBlockAckEnableReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlBlockAckEnableCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlBlockAckEnableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckEnableCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlBlockAckEnableCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \ - { \ - CsrWifiRouterCtrlBlockAckEnableCfm *msg__; \ - CsrWifiRouterCtrlBlockAckEnableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlBlockAckEnableCfmSend(dst__, clientData__, interfaceTag__, status__) \ - CsrWifiRouterCtrlBlockAckEnableCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlBlockAckErrorIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - trafficStreamID - - peerMacAddress - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlBlockAckErrorIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckErrorInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->trafficStreamID = (trafficStreamID__); \ - msg__->peerMacAddress = (peerMacAddress__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlBlockAckErrorIndSendTo(dst__, src__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__) \ - { \ - CsrWifiRouterCtrlBlockAckErrorInd *msg__; \ - CsrWifiRouterCtrlBlockAckErrorIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlBlockAckErrorIndSend(dst__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__) \ - CsrWifiRouterCtrlBlockAckErrorIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlCapabilitiesReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - clientData - - -*******************************************************************************/ -#define CsrWifiRouterCtrlCapabilitiesReqCreate(msg__, dst__, src__, clientData__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlCapabilitiesReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ, dst__, src__); \ - msg__->clientData = (clientData__); - -#define CsrWifiRouterCtrlCapabilitiesReqSendTo(dst__, src__, clientData__) \ - { \ - CsrWifiRouterCtrlCapabilitiesReq *msg__; \ - CsrWifiRouterCtrlCapabilitiesReqCreate(msg__, dst__, src__, clientData__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlCapabilitiesReqSend(src__, clientData__) \ - CsrWifiRouterCtrlCapabilitiesReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlCapabilitiesCfmSend - - DESCRIPTION - The router sends this primitive to confirm the size of the queues of the - HIP. - - PARAMETERS - queue - Destination Task Queue - clientData - - commandQueueSize - Size of command queue - trafficQueueSize - Size of traffic queue (per AC) - -*******************************************************************************/ -#define CsrWifiRouterCtrlCapabilitiesCfmCreate(msg__, dst__, src__, clientData__, commandQueueSize__, trafficQueueSize__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlCapabilitiesCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CAPABILITIES_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->commandQueueSize = (commandQueueSize__); \ - msg__->trafficQueueSize = (trafficQueueSize__); - -#define CsrWifiRouterCtrlCapabilitiesCfmSendTo(dst__, src__, clientData__, commandQueueSize__, trafficQueueSize__) \ - { \ - CsrWifiRouterCtrlCapabilitiesCfm *msg__; \ - CsrWifiRouterCtrlCapabilitiesCfmCreate(msg__, dst__, src__, clientData__, commandQueueSize__, trafficQueueSize__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlCapabilitiesCfmSend(dst__, clientData__, commandQueueSize__, trafficQueueSize__) \ - CsrWifiRouterCtrlCapabilitiesCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, commandQueueSize__, trafficQueueSize__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlConfigurePowerModeReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - clientData - - mode - - wakeHost - - -*******************************************************************************/ -#define CsrWifiRouterCtrlConfigurePowerModeReqCreate(msg__, dst__, src__, clientData__, mode__, wakeHost__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlConfigurePowerModeReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CONFIGURE_POWER_MODE_REQ, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->mode = (mode__); \ - msg__->wakeHost = (wakeHost__); - -#define CsrWifiRouterCtrlConfigurePowerModeReqSendTo(dst__, src__, clientData__, mode__, wakeHost__) \ - { \ - CsrWifiRouterCtrlConfigurePowerModeReq *msg__; \ - CsrWifiRouterCtrlConfigurePowerModeReqCreate(msg__, dst__, src__, clientData__, mode__, wakeHost__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlConfigurePowerModeReqSend(src__, clientData__, mode__, wakeHost__) \ - CsrWifiRouterCtrlConfigurePowerModeReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, mode__, wakeHost__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlConnectedIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - peerMacAddress - - peerStatus - - -*******************************************************************************/ -#define CsrWifiRouterCtrlConnectedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlConnectedInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CONNECTED_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->peerMacAddress = (peerMacAddress__); \ - msg__->peerStatus = (peerStatus__); - -#define CsrWifiRouterCtrlConnectedIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__) \ - { \ - CsrWifiRouterCtrlConnectedInd *msg__; \ - CsrWifiRouterCtrlConnectedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlConnectedIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__) \ - CsrWifiRouterCtrlConnectedIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__, peerStatus__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlHipReqSend - - DESCRIPTION - This primitive is used for transferring MLME messages to the HIP. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - mlmeCommandLength - Length of the MLME signal - mlmeCommand - Pointer to the MLME signal - dataRef1Length - Length of the dataRef1 bulk data - dataRef1 - Pointer to the bulk data 1 - dataRef2Length - Length of the dataRef2 bulk data - dataRef2 - Pointer to the bulk data 2 - -*******************************************************************************/ -#define CsrWifiRouterCtrlHipReqCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlHipReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_HIP_REQ, dst__, src__); \ - msg__->mlmeCommandLength = (mlmeCommandLength__); \ - msg__->mlmeCommand = (mlmeCommand__); \ - msg__->dataRef1Length = (dataRef1Length__); \ - msg__->dataRef1 = (dataRef1__); \ - msg__->dataRef2Length = (dataRef2Length__); \ - msg__->dataRef2 = (dataRef2__); - -#define CsrWifiRouterCtrlHipReqSendTo(dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ - { \ - CsrWifiRouterCtrlHipReq *msg__; \ - CsrWifiRouterCtrlHipReqCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlHipReqSend(src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ - CsrWifiRouterCtrlHipReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlHipIndSend - - DESCRIPTION - This primitive is used for transferring MLME messages from the HIP. - - PARAMETERS - queue - Destination Task Queue - mlmeCommandLength - Length of the MLME signal - mlmeCommand - Pointer to the MLME signal - dataRef1Length - Length of the dataRef1 bulk data - dataRef1 - Pointer to the bulk data 1 - dataRef2Length - Length of the dataRef2 bulk data - dataRef2 - Pointer to the bulk data 2 - -*******************************************************************************/ -#define CsrWifiRouterCtrlHipIndCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlHipInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_HIP_IND, dst__, src__); \ - msg__->mlmeCommandLength = (mlmeCommandLength__); \ - msg__->mlmeCommand = (mlmeCommand__); \ - msg__->dataRef1Length = (dataRef1Length__); \ - msg__->dataRef1 = (dataRef1__); \ - msg__->dataRef2Length = (dataRef2Length__); \ - msg__->dataRef2 = (dataRef2__); - -#define CsrWifiRouterCtrlHipIndSendTo(dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ - { \ - CsrWifiRouterCtrlHipInd *msg__; \ - CsrWifiRouterCtrlHipIndCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlHipIndSend(dst__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \ - CsrWifiRouterCtrlHipIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlM4ReadyToSendIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - peerMacAddress - - -*******************************************************************************/ -#define CsrWifiRouterCtrlM4ReadyToSendIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlM4ReadyToSendInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_M4_READY_TO_SEND_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->peerMacAddress = (peerMacAddress__); - -#define CsrWifiRouterCtrlM4ReadyToSendIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \ - { \ - CsrWifiRouterCtrlM4ReadyToSendInd *msg__; \ - CsrWifiRouterCtrlM4ReadyToSendIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlM4ReadyToSendIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__) \ - CsrWifiRouterCtrlM4ReadyToSendIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlM4TransmitReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - -*******************************************************************************/ -#define CsrWifiRouterCtrlM4TransmitReqCreate(msg__, dst__, src__, interfaceTag__, clientData__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlM4TransmitReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_M4_TRANSMIT_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); - -#define CsrWifiRouterCtrlM4TransmitReqSendTo(dst__, src__, interfaceTag__, clientData__) \ - { \ - CsrWifiRouterCtrlM4TransmitReq *msg__; \ - CsrWifiRouterCtrlM4TransmitReqCreate(msg__, dst__, src__, interfaceTag__, clientData__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlM4TransmitReqSend(src__, interfaceTag__, clientData__) \ - CsrWifiRouterCtrlM4TransmitReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlM4TransmittedIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - peerMacAddress - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlM4TransmittedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlM4TransmittedInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_M4_TRANSMITTED_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->peerMacAddress = (peerMacAddress__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlM4TransmittedIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__, status__) \ - { \ - CsrWifiRouterCtrlM4TransmittedInd *msg__; \ - CsrWifiRouterCtrlM4TransmittedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlM4TransmittedIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__, status__) \ - CsrWifiRouterCtrlM4TransmittedIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlMediaStatusReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - mediaStatus - - -*******************************************************************************/ -#define CsrWifiRouterCtrlMediaStatusReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mediaStatus__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlMediaStatusReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->mediaStatus = (mediaStatus__); - -#define CsrWifiRouterCtrlMediaStatusReqSendTo(dst__, src__, interfaceTag__, clientData__, mediaStatus__) \ - { \ - CsrWifiRouterCtrlMediaStatusReq *msg__; \ - CsrWifiRouterCtrlMediaStatusReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mediaStatus__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlMediaStatusReqSend(src__, interfaceTag__, clientData__, mediaStatus__) \ - CsrWifiRouterCtrlMediaStatusReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, mediaStatus__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlMicFailureIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - peerMacAddress - - unicastPdu - - -*******************************************************************************/ -#define CsrWifiRouterCtrlMicFailureIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlMicFailureInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MIC_FAILURE_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->peerMacAddress = (peerMacAddress__); \ - msg__->unicastPdu = (unicastPdu__); - -#define CsrWifiRouterCtrlMicFailureIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__) \ - { \ - CsrWifiRouterCtrlMicFailureInd *msg__; \ - CsrWifiRouterCtrlMicFailureIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlMicFailureIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__) \ - CsrWifiRouterCtrlMicFailureIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlModeSetReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - mode - - bssid - BSSID of the network the device is going to be a part - of - protection - Set to TRUE if encryption is enabled for the - connection/broadcast frames - intraBssDistEnabled - If set to TRUE, intra BSS destribution will be - enabled. If set to FALSE, any unicast PDU which does - not have the RA as the the local MAC address, shall be - ignored. This field is interpreted by the receive if - mode is set to CSR_WIFI_ROUTER_CTRL_MODE_P2PGO - -*******************************************************************************/ -#define CsrWifiRouterCtrlModeSetReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlModeSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MODE_SET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->mode = (mode__); \ - msg__->bssid = (bssid__); \ - msg__->protection = (protection__); \ - msg__->intraBssDistEnabled = (intraBssDistEnabled__); - -#define CsrWifiRouterCtrlModeSetReqSendTo(dst__, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__) \ - { \ - CsrWifiRouterCtrlModeSetReq *msg__; \ - CsrWifiRouterCtrlModeSetReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlModeSetReqSend(src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__) \ - CsrWifiRouterCtrlModeSetReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlModeSetCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - mode - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlModeSetCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, mode__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlModeSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MODE_SET_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->mode = (mode__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlModeSetCfmSendTo(dst__, src__, clientData__, interfaceTag__, mode__, status__) \ - { \ - CsrWifiRouterCtrlModeSetCfm *msg__; \ - CsrWifiRouterCtrlModeSetCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, mode__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlModeSetCfmSend(dst__, clientData__, interfaceTag__, mode__, status__) \ - CsrWifiRouterCtrlModeSetCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, mode__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlMulticastAddressIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - action - - setAddressesCount - - setAddresses - - -*******************************************************************************/ -#define CsrWifiRouterCtrlMulticastAddressIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlMulticastAddressInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->action = (action__); \ - msg__->setAddressesCount = (setAddressesCount__); \ - msg__->setAddresses = (setAddresses__); - -#define CsrWifiRouterCtrlMulticastAddressIndSendTo(dst__, src__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ - { \ - CsrWifiRouterCtrlMulticastAddressInd *msg__; \ - CsrWifiRouterCtrlMulticastAddressIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlMulticastAddressIndSend(dst__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ - CsrWifiRouterCtrlMulticastAddressIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlMulticastAddressResSend - - DESCRIPTION - - PARAMETERS - interfaceTag - - clientData - - status - - action - - getAddressesCount - - getAddresses - - -*******************************************************************************/ -#define CsrWifiRouterCtrlMulticastAddressResCreate(msg__, dst__, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlMulticastAddressRes), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->status = (status__); \ - msg__->action = (action__); \ - msg__->getAddressesCount = (getAddressesCount__); \ - msg__->getAddresses = (getAddresses__); - -#define CsrWifiRouterCtrlMulticastAddressResSendTo(dst__, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__) \ - { \ - CsrWifiRouterCtrlMulticastAddressRes *msg__; \ - CsrWifiRouterCtrlMulticastAddressResCreate(msg__, dst__, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlMulticastAddressResSend(src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__) \ - CsrWifiRouterCtrlMulticastAddressResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerAddReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - peerMacAddress - - associationId - - staInfo - - -*******************************************************************************/ -#define CsrWifiRouterCtrlPeerAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerAddReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_ADD_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->peerMacAddress = (peerMacAddress__); \ - msg__->associationId = (associationId__); \ - msg__->staInfo = (staInfo__); - -#define CsrWifiRouterCtrlPeerAddReqSendTo(dst__, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__) \ - { \ - CsrWifiRouterCtrlPeerAddReq *msg__; \ - CsrWifiRouterCtrlPeerAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlPeerAddReqSend(src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__) \ - CsrWifiRouterCtrlPeerAddReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerAddCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - peerMacAddress - - peerRecordHandle - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlPeerAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerAddCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_ADD_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->peerMacAddress = (peerMacAddress__); \ - msg__->peerRecordHandle = (peerRecordHandle__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlPeerAddCfmSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__) \ - { \ - CsrWifiRouterCtrlPeerAddCfm *msg__; \ - CsrWifiRouterCtrlPeerAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlPeerAddCfmSend(dst__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__) \ - CsrWifiRouterCtrlPeerAddCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerDelReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - peerRecordHandle - - -*******************************************************************************/ -#define CsrWifiRouterCtrlPeerDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerDelReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_DEL_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->peerRecordHandle = (peerRecordHandle__); - -#define CsrWifiRouterCtrlPeerDelReqSendTo(dst__, src__, interfaceTag__, clientData__, peerRecordHandle__) \ - { \ - CsrWifiRouterCtrlPeerDelReq *msg__; \ - CsrWifiRouterCtrlPeerDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlPeerDelReqSend(src__, interfaceTag__, clientData__, peerRecordHandle__) \ - CsrWifiRouterCtrlPeerDelReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, peerRecordHandle__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerDelCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlPeerDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerDelCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_DEL_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlPeerDelCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \ - { \ - CsrWifiRouterCtrlPeerDelCfm *msg__; \ - CsrWifiRouterCtrlPeerDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlPeerDelCfmSend(dst__, clientData__, interfaceTag__, status__) \ - CsrWifiRouterCtrlPeerDelCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerUpdateReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - peerRecordHandle - - powersaveMode - - -*******************************************************************************/ -#define CsrWifiRouterCtrlPeerUpdateReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerUpdateReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->peerRecordHandle = (peerRecordHandle__); \ - msg__->powersaveMode = (powersaveMode__); - -#define CsrWifiRouterCtrlPeerUpdateReqSendTo(dst__, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__) \ - { \ - CsrWifiRouterCtrlPeerUpdateReq *msg__; \ - CsrWifiRouterCtrlPeerUpdateReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlPeerUpdateReqSend(src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__) \ - CsrWifiRouterCtrlPeerUpdateReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerUpdateCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlPeerUpdateCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerUpdateCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlPeerUpdateCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \ - { \ - CsrWifiRouterCtrlPeerUpdateCfm *msg__; \ - CsrWifiRouterCtrlPeerUpdateCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlPeerUpdateCfmSend(dst__, clientData__, interfaceTag__, status__) \ - CsrWifiRouterCtrlPeerUpdateCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPortConfigureReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - uncontrolledPortAction - - controlledPortAction - - macAddress - - setProtection - - -*******************************************************************************/ -#define CsrWifiRouterCtrlPortConfigureReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPortConfigureReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->uncontrolledPortAction = (uncontrolledPortAction__); \ - msg__->controlledPortAction = (controlledPortAction__); \ - msg__->macAddress = (macAddress__); \ - msg__->setProtection = (setProtection__); - -#define CsrWifiRouterCtrlPortConfigureReqSendTo(dst__, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__) \ - { \ - CsrWifiRouterCtrlPortConfigureReq *msg__; \ - CsrWifiRouterCtrlPortConfigureReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlPortConfigureReqSend(src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__) \ - CsrWifiRouterCtrlPortConfigureReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPortConfigureCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - status - - macAddress - - -*******************************************************************************/ -#define CsrWifiRouterCtrlPortConfigureCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__, macAddress__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPortConfigureCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->macAddress = (macAddress__); - -#define CsrWifiRouterCtrlPortConfigureCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__, macAddress__) \ - { \ - CsrWifiRouterCtrlPortConfigureCfm *msg__; \ - CsrWifiRouterCtrlPortConfigureCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__, macAddress__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlPortConfigureCfmSend(dst__, clientData__, interfaceTag__, status__, macAddress__) \ - CsrWifiRouterCtrlPortConfigureCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__, macAddress__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlQosControlReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - control - - queueConfig - - -*******************************************************************************/ -#define CsrWifiRouterCtrlQosControlReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, control__, queueConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlQosControlReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->control = (control__); \ - msg__->queueConfig = (queueConfig__); - -#define CsrWifiRouterCtrlQosControlReqSendTo(dst__, src__, interfaceTag__, clientData__, control__, queueConfig__) \ - { \ - CsrWifiRouterCtrlQosControlReq *msg__; \ - CsrWifiRouterCtrlQosControlReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, control__, queueConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlQosControlReqSend(src__, interfaceTag__, clientData__, control__, queueConfig__) \ - CsrWifiRouterCtrlQosControlReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, control__, queueConfig__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlRawSdioDeinitialiseReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - clientData - - -*******************************************************************************/ -#define CsrWifiRouterCtrlRawSdioDeinitialiseReqCreate(msg__, dst__, src__, clientData__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_REQ, dst__, src__); \ - msg__->clientData = (clientData__); - -#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSendTo(dst__, src__, clientData__) \ - { \ - CsrWifiRouterCtrlRawSdioDeinitialiseReq *msg__; \ - CsrWifiRouterCtrlRawSdioDeinitialiseReqCreate(msg__, dst__, src__, clientData__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSend(src__, clientData__) \ - CsrWifiRouterCtrlRawSdioDeinitialiseReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlRawSdioDeinitialiseCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - result - - -*******************************************************************************/ -#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmCreate(msg__, dst__, src__, clientData__, result__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->result = (result__); - -#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmSendTo(dst__, src__, clientData__, result__) \ - { \ - CsrWifiRouterCtrlRawSdioDeinitialiseCfm *msg__; \ - CsrWifiRouterCtrlRawSdioDeinitialiseCfmCreate(msg__, dst__, src__, clientData__, result__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmSend(dst__, clientData__, result__) \ - CsrWifiRouterCtrlRawSdioDeinitialiseCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, result__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlRawSdioInitialiseReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - clientData - - -*******************************************************************************/ -#define CsrWifiRouterCtrlRawSdioInitialiseReqCreate(msg__, dst__, src__, clientData__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_REQ, dst__, src__); \ - msg__->clientData = (clientData__); - -#define CsrWifiRouterCtrlRawSdioInitialiseReqSendTo(dst__, src__, clientData__) \ - { \ - CsrWifiRouterCtrlRawSdioInitialiseReq *msg__; \ - CsrWifiRouterCtrlRawSdioInitialiseReqCreate(msg__, dst__, src__, clientData__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlRawSdioInitialiseReqSend(src__, clientData__) \ - CsrWifiRouterCtrlRawSdioInitialiseReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlRawSdioInitialiseCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - result - - byteRead - - byteWrite - - firmwareDownload - - reset - - coreDumpPrepare - - byteBlockRead - - gpRead16 - - gpWrite16 - - -*******************************************************************************/ -#define CsrWifiRouterCtrlRawSdioInitialiseCfmCreate(msg__, dst__, src__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->result = (result__); \ - msg__->byteRead = (byteRead__); \ - msg__->byteWrite = (byteWrite__); \ - msg__->firmwareDownload = (firmwareDownload__); \ - msg__->reset = (reset__); \ - msg__->coreDumpPrepare = (coreDumpPrepare__); \ - msg__->byteBlockRead = (byteBlockRead__); \ - msg__->gpRead16 = (gpRead16__); \ - msg__->gpWrite16 = (gpWrite16__); - -#define CsrWifiRouterCtrlRawSdioInitialiseCfmSendTo(dst__, src__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__) \ - { \ - CsrWifiRouterCtrlRawSdioInitialiseCfm *msg__; \ - CsrWifiRouterCtrlRawSdioInitialiseCfmCreate(msg__, dst__, src__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlRawSdioInitialiseCfmSend(dst__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__) \ - CsrWifiRouterCtrlRawSdioInitialiseCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlResumeIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - powerMaintained - - -*******************************************************************************/ -#define CsrWifiRouterCtrlResumeIndCreate(msg__, dst__, src__, clientData__, powerMaintained__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlResumeInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RESUME_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->powerMaintained = (powerMaintained__); - -#define CsrWifiRouterCtrlResumeIndSendTo(dst__, src__, clientData__, powerMaintained__) \ - { \ - CsrWifiRouterCtrlResumeInd *msg__; \ - CsrWifiRouterCtrlResumeIndCreate(msg__, dst__, src__, clientData__, powerMaintained__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlResumeIndSend(dst__, clientData__, powerMaintained__) \ - CsrWifiRouterCtrlResumeIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, powerMaintained__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlResumeResSend - - DESCRIPTION - - PARAMETERS - clientData - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlResumeResCreate(msg__, dst__, src__, clientData__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlResumeRes), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RESUME_RES, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlResumeResSendTo(dst__, src__, clientData__, status__) \ - { \ - CsrWifiRouterCtrlResumeRes *msg__; \ - CsrWifiRouterCtrlResumeResCreate(msg__, dst__, src__, clientData__, status__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlResumeResSend(src__, clientData__, status__) \ - CsrWifiRouterCtrlResumeResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlStaInactiveIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - staAddress - - -*******************************************************************************/ -#define CsrWifiRouterCtrlStaInactiveIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, staAddress__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlStaInactiveInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->staAddress = (staAddress__); - -#define CsrWifiRouterCtrlStaInactiveIndSendTo(dst__, src__, clientData__, interfaceTag__, staAddress__) \ - { \ - CsrWifiRouterCtrlStaInactiveInd *msg__; \ - CsrWifiRouterCtrlStaInactiveIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, staAddress__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlStaInactiveIndSend(dst__, clientData__, interfaceTag__, staAddress__) \ - CsrWifiRouterCtrlStaInactiveIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, staAddress__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlSuspendIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - hardSuspend - - d3Suspend - - -*******************************************************************************/ -#define CsrWifiRouterCtrlSuspendIndCreate(msg__, dst__, src__, clientData__, hardSuspend__, d3Suspend__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlSuspendInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_SUSPEND_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->hardSuspend = (hardSuspend__); \ - msg__->d3Suspend = (d3Suspend__); - -#define CsrWifiRouterCtrlSuspendIndSendTo(dst__, src__, clientData__, hardSuspend__, d3Suspend__) \ - { \ - CsrWifiRouterCtrlSuspendInd *msg__; \ - CsrWifiRouterCtrlSuspendIndCreate(msg__, dst__, src__, clientData__, hardSuspend__, d3Suspend__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlSuspendIndSend(dst__, clientData__, hardSuspend__, d3Suspend__) \ - CsrWifiRouterCtrlSuspendIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, hardSuspend__, d3Suspend__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlSuspendResSend - - DESCRIPTION - - PARAMETERS - clientData - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlSuspendResCreate(msg__, dst__, src__, clientData__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlSuspendRes), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_SUSPEND_RES, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlSuspendResSendTo(dst__, src__, clientData__, status__) \ - { \ - CsrWifiRouterCtrlSuspendRes *msg__; \ - CsrWifiRouterCtrlSuspendResCreate(msg__, dst__, src__, clientData__, status__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlSuspendResSend(src__, clientData__, status__) \ - CsrWifiRouterCtrlSuspendResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTclasAddReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - tclasLength - - tclas - - -*******************************************************************************/ -#define CsrWifiRouterCtrlTclasAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTclasAddReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->tclasLength = (tclasLength__); \ - msg__->tclas = (tclas__); - -#define CsrWifiRouterCtrlTclasAddReqSendTo(dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ - { \ - CsrWifiRouterCtrlTclasAddReq *msg__; \ - CsrWifiRouterCtrlTclasAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlTclasAddReqSend(src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ - CsrWifiRouterCtrlTclasAddReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, tclasLength__, tclas__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTclasAddCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlTclasAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTclasAddCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlTclasAddCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \ - { \ - CsrWifiRouterCtrlTclasAddCfm *msg__; \ - CsrWifiRouterCtrlTclasAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlTclasAddCfmSend(dst__, clientData__, interfaceTag__, status__) \ - CsrWifiRouterCtrlTclasAddCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTclasDelReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - tclasLength - - tclas - - -*******************************************************************************/ -#define CsrWifiRouterCtrlTclasDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTclasDelReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->tclasLength = (tclasLength__); \ - msg__->tclas = (tclas__); - -#define CsrWifiRouterCtrlTclasDelReqSendTo(dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ - { \ - CsrWifiRouterCtrlTclasDelReq *msg__; \ - CsrWifiRouterCtrlTclasDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlTclasDelReqSend(src__, interfaceTag__, clientData__, tclasLength__, tclas__) \ - CsrWifiRouterCtrlTclasDelReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, tclasLength__, tclas__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTclasDelCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlTclasDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTclasDelCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlTclasDelCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \ - { \ - CsrWifiRouterCtrlTclasDelCfm *msg__; \ - CsrWifiRouterCtrlTclasDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlTclasDelCfmSend(dst__, clientData__, interfaceTag__, status__) \ - CsrWifiRouterCtrlTclasDelCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficClassificationReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - trafficType - - period - - -*******************************************************************************/ -#define CsrWifiRouterCtrlTrafficClassificationReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficType__, period__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTrafficClassificationReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_CLASSIFICATION_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->trafficType = (trafficType__); \ - msg__->period = (period__); - -#define CsrWifiRouterCtrlTrafficClassificationReqSendTo(dst__, src__, interfaceTag__, clientData__, trafficType__, period__) \ - { \ - CsrWifiRouterCtrlTrafficClassificationReq *msg__; \ - CsrWifiRouterCtrlTrafficClassificationReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficType__, period__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlTrafficClassificationReqSend(src__, interfaceTag__, clientData__, trafficType__, period__) \ - CsrWifiRouterCtrlTrafficClassificationReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, trafficType__, period__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficConfigReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - clientData - - trafficConfigType - - config - - -*******************************************************************************/ -#define CsrWifiRouterCtrlTrafficConfigReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficConfigType__, config__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTrafficConfigReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->clientData = (clientData__); \ - msg__->trafficConfigType = (trafficConfigType__); \ - msg__->config = (config__); - -#define CsrWifiRouterCtrlTrafficConfigReqSendTo(dst__, src__, interfaceTag__, clientData__, trafficConfigType__, config__) \ - { \ - CsrWifiRouterCtrlTrafficConfigReq *msg__; \ - CsrWifiRouterCtrlTrafficConfigReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficConfigType__, config__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlTrafficConfigReqSend(src__, interfaceTag__, clientData__, trafficConfigType__, config__) \ - CsrWifiRouterCtrlTrafficConfigReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, trafficConfigType__, config__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficProtocolIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - packetType - - direction - - srcAddress - - -*******************************************************************************/ -#define CsrWifiRouterCtrlTrafficProtocolIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTrafficProtocolInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_PROTOCOL_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->packetType = (packetType__); \ - msg__->direction = (direction__); \ - msg__->srcAddress = (srcAddress__); - -#define CsrWifiRouterCtrlTrafficProtocolIndSendTo(dst__, src__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__) \ - { \ - CsrWifiRouterCtrlTrafficProtocolInd *msg__; \ - CsrWifiRouterCtrlTrafficProtocolIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlTrafficProtocolIndSend(dst__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__) \ - CsrWifiRouterCtrlTrafficProtocolIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, packetType__, direction__, srcAddress__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficSampleIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - stats - - -*******************************************************************************/ -#define CsrWifiRouterCtrlTrafficSampleIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, stats__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTrafficSampleInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_SAMPLE_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->stats = (stats__); - -#define CsrWifiRouterCtrlTrafficSampleIndSendTo(dst__, src__, clientData__, interfaceTag__, stats__) \ - { \ - CsrWifiRouterCtrlTrafficSampleInd *msg__; \ - CsrWifiRouterCtrlTrafficSampleIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, stats__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlTrafficSampleIndSend(dst__, clientData__, interfaceTag__, stats__) \ - CsrWifiRouterCtrlTrafficSampleIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, stats__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlUnexpectedFrameIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - peerMacAddress - - -*******************************************************************************/ -#define CsrWifiRouterCtrlUnexpectedFrameIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlUnexpectedFrameInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_UNEXPECTED_FRAME_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->peerMacAddress = (peerMacAddress__); - -#define CsrWifiRouterCtrlUnexpectedFrameIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \ - { \ - CsrWifiRouterCtrlUnexpectedFrameInd *msg__; \ - CsrWifiRouterCtrlUnexpectedFrameIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlUnexpectedFrameIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__) \ - CsrWifiRouterCtrlUnexpectedFrameIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiFilterReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - isWapiConnected - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWapiFilterReqCreate(msg__, dst__, src__, interfaceTag__, isWapiConnected__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiFilterReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_FILTER_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->isWapiConnected = (isWapiConnected__); - -#define CsrWifiRouterCtrlWapiFilterReqSendTo(dst__, src__, interfaceTag__, isWapiConnected__) \ - { \ - CsrWifiRouterCtrlWapiFilterReq *msg__; \ - CsrWifiRouterCtrlWapiFilterReqCreate(msg__, dst__, src__, interfaceTag__, isWapiConnected__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWapiFilterReqSend(src__, interfaceTag__, isWapiConnected__) \ - CsrWifiRouterCtrlWapiFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, isWapiConnected__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiMulticastFilterReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWapiMulticastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiMulticastFilterReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlWapiMulticastFilterReqSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiRouterCtrlWapiMulticastFilterReq *msg__; \ - CsrWifiRouterCtrlWapiMulticastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWapiMulticastFilterReqSend(src__, interfaceTag__, status__) \ - CsrWifiRouterCtrlWapiMulticastFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiRxMicCheckIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - signalLength - - signal - - dataLength - - data - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWapiRxMicCheckIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiRxMicCheckInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->signalLength = (signalLength__); \ - msg__->signal = (signal__); \ - msg__->dataLength = (dataLength__); \ - msg__->data = (data__); - -#define CsrWifiRouterCtrlWapiRxMicCheckIndSendTo(dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ - { \ - CsrWifiRouterCtrlWapiRxMicCheckInd *msg__; \ - CsrWifiRouterCtrlWapiRxMicCheckIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWapiRxMicCheckIndSend(dst__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ - CsrWifiRouterCtrlWapiRxMicCheckIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiRxPktReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - signalLength - - signal - - dataLength - - data - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWapiRxPktReqCreate(msg__, dst__, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiRxPktReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->signalLength = (signalLength__); \ - msg__->signal = (signal__); \ - msg__->dataLength = (dataLength__); \ - msg__->data = (data__); - -#define CsrWifiRouterCtrlWapiRxPktReqSendTo(dst__, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ - { \ - CsrWifiRouterCtrlWapiRxPktReq *msg__; \ - CsrWifiRouterCtrlWapiRxPktReqCreate(msg__, dst__, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWapiRxPktReqSend(src__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \ - CsrWifiRouterCtrlWapiRxPktReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiUnicastFilterReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWapiUnicastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastFilterReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlWapiUnicastFilterReqSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiRouterCtrlWapiUnicastFilterReq *msg__; \ - CsrWifiRouterCtrlWapiUnicastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWapiUnicastFilterReqSend(src__, interfaceTag__, status__) \ - CsrWifiRouterCtrlWapiUnicastFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - interfaceTag - - dataLength - - data - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWapiUnicastTxEncryptIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, dataLength__, data__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxEncryptInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->dataLength = (dataLength__); \ - msg__->data = (data__); - -#define CsrWifiRouterCtrlWapiUnicastTxEncryptIndSendTo(dst__, src__, clientData__, interfaceTag__, dataLength__, data__) \ - { \ - CsrWifiRouterCtrlWapiUnicastTxEncryptInd *msg__; \ - CsrWifiRouterCtrlWapiUnicastTxEncryptIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, dataLength__, data__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend(dst__, clientData__, interfaceTag__, dataLength__, data__) \ - CsrWifiRouterCtrlWapiUnicastTxEncryptIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, dataLength__, data__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiUnicastTxPktReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - dataLength - - data - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWapiUnicastTxPktReqCreate(msg__, dst__, src__, interfaceTag__, dataLength__, data__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxPktReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->dataLength = (dataLength__); \ - msg__->data = (data__); - -#define CsrWifiRouterCtrlWapiUnicastTxPktReqSendTo(dst__, src__, interfaceTag__, dataLength__, data__) \ - { \ - CsrWifiRouterCtrlWapiUnicastTxPktReq *msg__; \ - CsrWifiRouterCtrlWapiUnicastTxPktReqCreate(msg__, dst__, src__, interfaceTag__, dataLength__, data__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWapiUnicastTxPktReqSend(src__, interfaceTag__, dataLength__, data__) \ - CsrWifiRouterCtrlWapiUnicastTxPktReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, dataLength__, data__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOffReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - clientData - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWifiOffReqCreate(msg__, dst__, src__, clientData__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOffReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_REQ, dst__, src__); \ - msg__->clientData = (clientData__); - -#define CsrWifiRouterCtrlWifiOffReqSendTo(dst__, src__, clientData__) \ - { \ - CsrWifiRouterCtrlWifiOffReq *msg__; \ - CsrWifiRouterCtrlWifiOffReqCreate(msg__, dst__, src__, clientData__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWifiOffReqSend(src__, clientData__) \ - CsrWifiRouterCtrlWifiOffReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOffIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - controlIndication - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWifiOffIndCreate(msg__, dst__, src__, clientData__, controlIndication__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOffInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->controlIndication = (controlIndication__); - -#define CsrWifiRouterCtrlWifiOffIndSendTo(dst__, src__, clientData__, controlIndication__) \ - { \ - CsrWifiRouterCtrlWifiOffInd *msg__; \ - CsrWifiRouterCtrlWifiOffIndCreate(msg__, dst__, src__, clientData__, controlIndication__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWifiOffIndSend(dst__, clientData__, controlIndication__) \ - CsrWifiRouterCtrlWifiOffIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, controlIndication__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOffResSend - - DESCRIPTION - - PARAMETERS - clientData - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWifiOffResCreate(msg__, dst__, src__, clientData__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOffRes), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_RES, dst__, src__); \ - msg__->clientData = (clientData__); - -#define CsrWifiRouterCtrlWifiOffResSendTo(dst__, src__, clientData__) \ - { \ - CsrWifiRouterCtrlWifiOffRes *msg__; \ - CsrWifiRouterCtrlWifiOffResCreate(msg__, dst__, src__, clientData__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWifiOffResSend(src__, clientData__) \ - CsrWifiRouterCtrlWifiOffResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOffCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWifiOffCfmCreate(msg__, dst__, src__, clientData__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOffCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_CFM, dst__, src__); \ - msg__->clientData = (clientData__); - -#define CsrWifiRouterCtrlWifiOffCfmSendTo(dst__, src__, clientData__) \ - { \ - CsrWifiRouterCtrlWifiOffCfm *msg__; \ - CsrWifiRouterCtrlWifiOffCfmCreate(msg__, dst__, src__, clientData__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWifiOffCfmSend(dst__, clientData__) \ - CsrWifiRouterCtrlWifiOffCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOnReqSend - - DESCRIPTION - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - clientData - - dataLength - Number of bytes in the buffer pointed to by 'data' - data - Pointer to the buffer containing 'dataLength' bytes - -*******************************************************************************/ -#define CsrWifiRouterCtrlWifiOnReqCreate(msg__, dst__, src__, clientData__, dataLength__, data__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->dataLength = (dataLength__); \ - msg__->data = (data__); - -#define CsrWifiRouterCtrlWifiOnReqSendTo(dst__, src__, clientData__, dataLength__, data__) \ - { \ - CsrWifiRouterCtrlWifiOnReq *msg__; \ - CsrWifiRouterCtrlWifiOnReqCreate(msg__, dst__, src__, clientData__, dataLength__, data__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWifiOnReqSend(src__, clientData__, dataLength__, data__) \ - CsrWifiRouterCtrlWifiOnReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, dataLength__, data__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOnIndSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - status - - versions - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWifiOnIndCreate(msg__, dst__, src__, clientData__, status__, versions__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->status = (status__); \ - msg__->versions = (versions__); - -#define CsrWifiRouterCtrlWifiOnIndSendTo(dst__, src__, clientData__, status__, versions__) \ - { \ - CsrWifiRouterCtrlWifiOnInd *msg__; \ - CsrWifiRouterCtrlWifiOnIndCreate(msg__, dst__, src__, clientData__, status__, versions__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWifiOnIndSend(dst__, clientData__, status__, versions__) \ - CsrWifiRouterCtrlWifiOnIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, status__, versions__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOnResSend - - DESCRIPTION - - PARAMETERS - clientData - - status - - numInterfaceAddress - - stationMacAddress - array size 1 MUST match CSR_WIFI_NUM_INTERFACES - smeVersions - - scheduledInterrupt - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWifiOnResCreate(msg__, dst__, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnRes), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->status = (status__); \ - msg__->numInterfaceAddress = (numInterfaceAddress__); \ - memcpy(msg__->stationMacAddress, (stationMacAddress__), sizeof(CsrWifiMacAddress) * 2); \ - msg__->smeVersions = (smeVersions__); \ - msg__->scheduledInterrupt = (scheduledInterrupt__); - -#define CsrWifiRouterCtrlWifiOnResSendTo(dst__, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__) \ - { \ - CsrWifiRouterCtrlWifiOnRes *msg__; \ - CsrWifiRouterCtrlWifiOnResCreate(msg__, dst__, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWifiOnResSend(src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__) \ - CsrWifiRouterCtrlWifiOnResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOnCfmSend - - DESCRIPTION - - PARAMETERS - queue - Destination Task Queue - clientData - - status - - -*******************************************************************************/ -#define CsrWifiRouterCtrlWifiOnCfmCreate(msg__, dst__, src__, clientData__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_CFM, dst__, src__); \ - msg__->clientData = (clientData__); \ - msg__->status = (status__); - -#define CsrWifiRouterCtrlWifiOnCfmSendTo(dst__, src__, clientData__, status__) \ - { \ - CsrWifiRouterCtrlWifiOnCfm *msg__; \ - CsrWifiRouterCtrlWifiOnCfmCreate(msg__, dst__, src__, clientData__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \ - } - -#define CsrWifiRouterCtrlWifiOnCfmSend(dst__, clientData__, status__) \ - CsrWifiRouterCtrlWifiOnCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, status__) - -#endif /* CSR_WIFI_ROUTER_CTRL_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h deleted file mode 100644 index 1312a335dd76..000000000000 --- a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h +++ /dev/null @@ -1,2113 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_ROUTER_CTRL_PRIM_H__ -#define CSR_WIFI_ROUTER_CTRL_PRIM_H__ - -#include <linux/types.h> -#include "csr_prim_defs.h" -#include "csr_sched.h" -#include "csr_wifi_common.h" -#include "csr_result.h" -#include "csr_wifi_fsm_event.h" - -#define CSR_WIFI_ROUTER_CTRL_PRIM (0x0401) - -typedef CsrPrim CsrWifiRouterCtrlPrim; - -typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteWrite)(u8 func, u32 address, u8 data); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteRead)(u8 func, u32 address, u8 *pdata); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioFirmwareDownload)(u32 length, const u8 *pdata); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioReset)(void); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioCoreDumpPrepare)(u8 suspendSme); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteBlockRead)(u8 func, u32 address, u8 *pdata, u32 length); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpRead16)(u8 func, u32 address, u16 *pdata); -typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpWrite16)(u8 func, u32 address, u16 data); - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlBlockAckRole - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR - - - CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT - - - -*******************************************************************************/ -typedef u8 CsrWifiRouterCtrlBlockAckRole; -#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR ((CsrWifiRouterCtrlBlockAckRole) 0x00) -#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT ((CsrWifiRouterCtrlBlockAckRole) 0x01) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlControlIndication - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_ERROR - - - CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_EXIT - - - CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_USER_REQUESTED - - - -*******************************************************************************/ -typedef u8 CsrWifiRouterCtrlControlIndication; -#define CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_ERROR ((CsrWifiRouterCtrlControlIndication) 0x01) -#define CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_EXIT ((CsrWifiRouterCtrlControlIndication) 0x02) -#define CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_USER_REQUESTED ((CsrWifiRouterCtrlControlIndication) 0x03) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlListAction - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_LIST_ACTION_GET - - - CSR_WIFI_ROUTER_CTRL_LIST_ACTION_ADD - - - CSR_WIFI_ROUTER_CTRL_LIST_ACTION_REMOVE - - - CSR_WIFI_ROUTER_CTRL_LIST_ACTION_FLUSH - - - -*******************************************************************************/ -typedef u8 CsrWifiRouterCtrlListAction; -#define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_GET ((CsrWifiRouterCtrlListAction) 0x00) -#define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_ADD ((CsrWifiRouterCtrlListAction) 0x01) -#define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_REMOVE ((CsrWifiRouterCtrlListAction) 0x02) -#define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_FLUSH ((CsrWifiRouterCtrlListAction) 0x03) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlLowPowerMode - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_DISABLED - - - CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_ENABLED - - - -*******************************************************************************/ -typedef u16 CsrWifiRouterCtrlLowPowerMode; -#define CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_DISABLED ((CsrWifiRouterCtrlLowPowerMode) 0x0000) -#define CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_ENABLED ((CsrWifiRouterCtrlLowPowerMode) 0x0001) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlMediaStatus - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_CONNECTED - - - CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_DISCONNECTED - - - -*******************************************************************************/ -typedef u8 CsrWifiRouterCtrlMediaStatus; -#define CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_CONNECTED ((CsrWifiRouterCtrlMediaStatus) 0x00) -#define CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_DISCONNECTED ((CsrWifiRouterCtrlMediaStatus) 0x01) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlMode - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_MODE_NONE - - CSR_WIFI_ROUTER_CTRL_MODE_IBSS - - CSR_WIFI_ROUTER_CTRL_MODE_STA - - CSR_WIFI_ROUTER_CTRL_MODE_AP - - CSR_WIFI_ROUTER_CTRL_MODE_MONITOR - - CSR_WIFI_ROUTER_CTRL_MODE_AMP - - CSR_WIFI_ROUTER_CTRL_MODE_P2P - - CSR_WIFI_ROUTER_CTRL_MODE_P2PGO - - CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI - - -*******************************************************************************/ -typedef u8 CsrWifiRouterCtrlMode; -#define CSR_WIFI_ROUTER_CTRL_MODE_NONE ((CsrWifiRouterCtrlMode) 0x00) -#define CSR_WIFI_ROUTER_CTRL_MODE_IBSS ((CsrWifiRouterCtrlMode) 0x01) -#define CSR_WIFI_ROUTER_CTRL_MODE_STA ((CsrWifiRouterCtrlMode) 0x02) -#define CSR_WIFI_ROUTER_CTRL_MODE_AP ((CsrWifiRouterCtrlMode) 0x03) -#define CSR_WIFI_ROUTER_CTRL_MODE_MONITOR ((CsrWifiRouterCtrlMode) 0x04) -#define CSR_WIFI_ROUTER_CTRL_MODE_AMP ((CsrWifiRouterCtrlMode) 0x05) -#define CSR_WIFI_ROUTER_CTRL_MODE_P2P ((CsrWifiRouterCtrlMode) 0x06) -#define CSR_WIFI_ROUTER_CTRL_MODE_P2PGO ((CsrWifiRouterCtrlMode) 0x07) -#define CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI ((CsrWifiRouterCtrlMode) 0x08) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerStatus - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE - - - CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE - - - CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED - - - -*******************************************************************************/ -typedef u8 CsrWifiRouterCtrlPeerStatus; -#define CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE ((CsrWifiRouterCtrlPeerStatus) 0x00) -#define CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE ((CsrWifiRouterCtrlPeerStatus) 0x01) -#define CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED ((CsrWifiRouterCtrlPeerStatus) 0x02) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPortAction - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN - - - CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD - - - CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK - - - -*******************************************************************************/ -typedef u16 CsrWifiRouterCtrlPortAction; -#define CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN ((CsrWifiRouterCtrlPortAction) 0x0000) -#define CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD ((CsrWifiRouterCtrlPortAction) 0x0001) -#define CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK ((CsrWifiRouterCtrlPortAction) 0x0002) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPowersaveType - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_AC_BK_PS_INFO_PRESENT - - If set, AC BK PS info is present in b4 and b5 - CSR_WIFI_ROUTER_CTRL_AC_BE_PS_INFO_PRESENT - - If set, AC BE PS info is present in b6 and b7 - CSR_WIFI_ROUTER_CTRL_AC_VI_PS_INFO_PRESENT - - If set, AC VI PS info is present in b8 and b9 - CSR_WIFI_ROUTER_CTRL_AC_VO_PS_INFO_PRESENT - - If set, AC VO PS info is present in b10 and b11 - CSR_WIFI_ROUTER_CTRL_AC_BK_TRIGGER_ENABLED - - - CSR_WIFI_ROUTER_CTRL_AC_BK_DELIVERY_ENABLED - - - CSR_WIFI_ROUTER_CTRL_AC_BE_TRIGGER_ENABLED - - - CSR_WIFI_ROUTER_CTRL_AC_BE_DELIVERY_ENABLED - - - CSR_WIFI_ROUTER_CTRL_AC_VI_TRIGGER_ENABLED - - - CSR_WIFI_ROUTER_CTRL_AC_VI_DELIVERY_ENABLED - - - CSR_WIFI_ROUTER_CTRL_AC_VO_TRIGGER_ENABLED - - - CSR_WIFI_ROUTER_CTRL_AC_VO_DELIVERY_ENABLED - - - -*******************************************************************************/ -typedef u16 CsrWifiRouterCtrlPowersaveType; -#define CSR_WIFI_ROUTER_CTRL_AC_BK_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0001) -#define CSR_WIFI_ROUTER_CTRL_AC_BE_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0002) -#define CSR_WIFI_ROUTER_CTRL_AC_VI_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0004) -#define CSR_WIFI_ROUTER_CTRL_AC_VO_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0008) -#define CSR_WIFI_ROUTER_CTRL_AC_BK_TRIGGER_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0010) -#define CSR_WIFI_ROUTER_CTRL_AC_BK_DELIVERY_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0020) -#define CSR_WIFI_ROUTER_CTRL_AC_BE_TRIGGER_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0040) -#define CSR_WIFI_ROUTER_CTRL_AC_BE_DELIVERY_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0080) -#define CSR_WIFI_ROUTER_CTRL_AC_VI_TRIGGER_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0100) -#define CSR_WIFI_ROUTER_CTRL_AC_VI_DELIVERY_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0200) -#define CSR_WIFI_ROUTER_CTRL_AC_VO_TRIGGER_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0400) -#define CSR_WIFI_ROUTER_CTRL_AC_VO_DELIVERY_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0800) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlProtocolDirection - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX - - - CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX - - - -*******************************************************************************/ -typedef u16 CsrWifiRouterCtrlProtocolDirection; -#define CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX ((CsrWifiRouterCtrlProtocolDirection) 0x0000) -#define CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX ((CsrWifiRouterCtrlProtocolDirection) 0x0001) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlQoSControl - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_OFF - - - CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_WMM_ON - - - CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_80211_ON - - - -*******************************************************************************/ -typedef u16 CsrWifiRouterCtrlQoSControl; -#define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_OFF ((CsrWifiRouterCtrlQoSControl) 0x0000) -#define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_WMM_ON ((CsrWifiRouterCtrlQoSControl) 0x0001) -#define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_80211_ON ((CsrWifiRouterCtrlQoSControl) 0x0002) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlQueueConfig - - DESCRIPTION - Defines which Queues are enabled for use. - - VALUES - CSR_WIFI_ROUTER_CTRL_QUEUE_BE_ENABLE - - - CSR_WIFI_ROUTER_CTRL_QUEUE_BK_ENABLE - - - CSR_WIFI_ROUTER_CTRL_QUEUE_VI_ENABLE - - - CSR_WIFI_ROUTER_CTRL_QUEUE_VO_ENABLE - - - -*******************************************************************************/ -typedef u8 CsrWifiRouterCtrlQueueConfig; -#define CSR_WIFI_ROUTER_CTRL_QUEUE_BE_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x01) -#define CSR_WIFI_ROUTER_CTRL_QUEUE_BK_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x02) -#define CSR_WIFI_ROUTER_CTRL_QUEUE_VI_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x04) -#define CSR_WIFI_ROUTER_CTRL_QUEUE_VO_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x08) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficConfigType - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET - - - CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER - - - CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_CLS - - - -*******************************************************************************/ -typedef u16 CsrWifiRouterCtrlTrafficConfigType; -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET ((CsrWifiRouterCtrlTrafficConfigType) 0x0000) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER ((CsrWifiRouterCtrlTrafficConfigType) 0x0001) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_CLS ((CsrWifiRouterCtrlTrafficConfigType) 0x0002) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficPacketType - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE - - - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL - - - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP - - - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP_ACK - - - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP - - - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET - - - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM - - - CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ALL - - - -*******************************************************************************/ -typedef u16 CsrWifiRouterCtrlTrafficPacketType; -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE ((CsrWifiRouterCtrlTrafficPacketType) 0x0000) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL ((CsrWifiRouterCtrlTrafficPacketType) 0x0001) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP ((CsrWifiRouterCtrlTrafficPacketType) 0x0002) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP_ACK ((CsrWifiRouterCtrlTrafficPacketType) 0x0004) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP ((CsrWifiRouterCtrlTrafficPacketType) 0x0008) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET ((CsrWifiRouterCtrlTrafficPacketType) 0x0010) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM ((CsrWifiRouterCtrlTrafficPacketType) 0x0020) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ALL ((CsrWifiRouterCtrlTrafficPacketType) 0x00FF) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficType - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_OCCASIONAL - - - CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_BURSTY - - - CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_PERIODIC - - - CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_CONTINUOUS - - - -*******************************************************************************/ -typedef u8 CsrWifiRouterCtrlTrafficType; -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_OCCASIONAL ((CsrWifiRouterCtrlTrafficType) 0x00) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_BURSTY ((CsrWifiRouterCtrlTrafficType) 0x01) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_PERIODIC ((CsrWifiRouterCtrlTrafficType) 0x02) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_CONTINUOUS ((CsrWifiRouterCtrlTrafficType) 0x03) - - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerRecordHandle - - DESCRIPTION - -*******************************************************************************/ -typedef u32 CsrWifiRouterCtrlPeerRecordHandle; -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPowersaveTypeMask - - DESCRIPTION - Mask type for use with the values defined by - CsrWifiRouterCtrlPowersaveType - -*******************************************************************************/ -typedef u16 CsrWifiRouterCtrlPowersaveTypeMask; -/******************************************************************************* - - NAME - CsrWifiRouterCtrlQueueConfigMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiRouterCtrlQueueConfig - -*******************************************************************************/ -typedef u8 CsrWifiRouterCtrlQueueConfigMask; -/******************************************************************************* - - NAME - CsrWifiRouterCtrlRequestorInfo - - DESCRIPTION - -*******************************************************************************/ -typedef u16 CsrWifiRouterCtrlRequestorInfo; -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficStreamId - - DESCRIPTION - -*******************************************************************************/ -typedef u8 CsrWifiRouterCtrlTrafficStreamId; - - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlSmeVersions - - DESCRIPTION - - MEMBERS - firmwarePatch - - smeBuild - - smeHip - - -*******************************************************************************/ -typedef struct -{ - u32 firmwarePatch; - char *smeBuild; - u32 smeHip; -} CsrWifiRouterCtrlSmeVersions; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlStaInfo - - DESCRIPTION - - MEMBERS - wmmOrQosEnabled - - powersaveMode - - maxSpLength - - listenIntervalInTus - - -*******************************************************************************/ -typedef struct -{ - u8 wmmOrQosEnabled; - CsrWifiRouterCtrlPowersaveTypeMask powersaveMode; - u8 maxSpLength; - u16 listenIntervalInTus; -} CsrWifiRouterCtrlStaInfo; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficFilter - - DESCRIPTION - - MEMBERS - etherType - - ipType - - udpSourcePort - - udpDestPort - - -*******************************************************************************/ -typedef struct -{ - u32 etherType; - u8 ipType; - u32 udpSourcePort; - u32 udpDestPort; -} CsrWifiRouterCtrlTrafficFilter; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficStats - - DESCRIPTION - - MEMBERS - rxMeanRate - Mean rx data rate over the interval - rxFramesNum - Keep number of Rx frames per second, for CYCLE_3. - txFramesNum - Keep number of Tx frames per second, for CYCLE_3. - rxBytesCount - Keep calculated Rx throughput per second, for CYCLE_2. - txBytesCount - Keep calculated Tx throughput per second, for CYCLE_2. - intervals - array size 11 MUST match TA_INTERVALS_NUM - -*******************************************************************************/ -typedef struct -{ - u32 rxMeanRate; - u32 rxFramesNum; - u32 txFramesNum; - u32 rxBytesCount; - u32 txBytesCount; - u8 intervals[11]; -} CsrWifiRouterCtrlTrafficStats; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlVersions - - DESCRIPTION - - MEMBERS - chipId - - chipVersion - - firmwareBuild - - firmwareHip - - routerBuild - - routerHip - - -*******************************************************************************/ -typedef struct -{ - u32 chipId; - u32 chipVersion; - u32 firmwareBuild; - u32 firmwareHip; - char *routerBuild; - u32 routerHip; -} CsrWifiRouterCtrlVersions; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficConfig - - DESCRIPTION - - MEMBERS - packetFilter - - customFilter - - -*******************************************************************************/ -typedef struct -{ - u16 packetFilter; - CsrWifiRouterCtrlTrafficFilter customFilter; -} CsrWifiRouterCtrlTrafficConfig; - - -/* Downstream */ -#define CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST (0x0000) - -#define CSR_WIFI_ROUTER_CTRL_CONFIGURE_POWER_MODE_REQ ((CsrWifiRouterCtrlPrim) (0x0000 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_HIP_REQ ((CsrWifiRouterCtrlPrim) (0x0001 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_REQ ((CsrWifiRouterCtrlPrim) (0x0002 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES ((CsrWifiRouterCtrlPrim) (0x0003 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_REQ ((CsrWifiRouterCtrlPrim) (0x0004 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_REQ ((CsrWifiRouterCtrlPrim) (0x0005 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_SUSPEND_RES ((CsrWifiRouterCtrlPrim) (0x0006 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ ((CsrWifiRouterCtrlPrim) (0x0007 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_RESUME_RES ((CsrWifiRouterCtrlPrim) (0x0008 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_REQ ((CsrWifiRouterCtrlPrim) (0x0009 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_REQ ((CsrWifiRouterCtrlPrim) (0x000A + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ ((CsrWifiRouterCtrlPrim) (0x000B + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CLASSIFICATION_REQ ((CsrWifiRouterCtrlPrim) (0x000C + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_REQ ((CsrWifiRouterCtrlPrim) (0x000D + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WIFI_OFF_REQ ((CsrWifiRouterCtrlPrim) (0x000E + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WIFI_OFF_RES ((CsrWifiRouterCtrlPrim) (0x000F + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ ((CsrWifiRouterCtrlPrim) (0x0010 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES ((CsrWifiRouterCtrlPrim) (0x0011 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_M4_TRANSMIT_REQ ((CsrWifiRouterCtrlPrim) (0x0012 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_MODE_SET_REQ ((CsrWifiRouterCtrlPrim) (0x0013 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_PEER_ADD_REQ ((CsrWifiRouterCtrlPrim) (0x0014 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_PEER_DEL_REQ ((CsrWifiRouterCtrlPrim) (0x0015 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_REQ ((CsrWifiRouterCtrlPrim) (0x0016 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ ((CsrWifiRouterCtrlPrim) (0x0017 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ ((CsrWifiRouterCtrlPrim) (0x0018 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ ((CsrWifiRouterCtrlPrim) (0x0019 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ ((CsrWifiRouterCtrlPrim) (0x001A + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ ((CsrWifiRouterCtrlPrim) (0x001B + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ ((CsrWifiRouterCtrlPrim) (0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ ((CsrWifiRouterCtrlPrim) (0x001D + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WAPI_FILTER_REQ ((CsrWifiRouterCtrlPrim) (0x001E + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)) - - -#define CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_HIGHEST (0x001E + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST) - -/* Upstream */ -#define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) - -#define CSR_WIFI_ROUTER_CTRL_HIP_IND ((CsrWifiRouterCtrlPrim)(0x0000 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND ((CsrWifiRouterCtrlPrim)(0x0001 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_CFM ((CsrWifiRouterCtrlPrim)(0x0002 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_RESUME_IND ((CsrWifiRouterCtrlPrim)(0x0003 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_SUSPEND_IND ((CsrWifiRouterCtrlPrim)(0x0004 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_CFM ((CsrWifiRouterCtrlPrim)(0x0005 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_CFM ((CsrWifiRouterCtrlPrim)(0x0006 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_CFM ((CsrWifiRouterCtrlPrim)(0x0007 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_CFM ((CsrWifiRouterCtrlPrim)(0x0008 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PROTOCOL_IND ((CsrWifiRouterCtrlPrim)(0x0009 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_SAMPLE_IND ((CsrWifiRouterCtrlPrim)(0x000A + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WIFI_OFF_IND ((CsrWifiRouterCtrlPrim)(0x000B + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WIFI_OFF_CFM ((CsrWifiRouterCtrlPrim)(0x000C + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND ((CsrWifiRouterCtrlPrim)(0x000D + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WIFI_ON_CFM ((CsrWifiRouterCtrlPrim)(0x000E + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_M4_READY_TO_SEND_IND ((CsrWifiRouterCtrlPrim)(0x000F + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_M4_TRANSMITTED_IND ((CsrWifiRouterCtrlPrim)(0x0010 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_MIC_FAILURE_IND ((CsrWifiRouterCtrlPrim)(0x0011 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_CONNECTED_IND ((CsrWifiRouterCtrlPrim)(0x0012 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_PEER_ADD_CFM ((CsrWifiRouterCtrlPrim)(0x0013 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_PEER_DEL_CFM ((CsrWifiRouterCtrlPrim)(0x0014 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_UNEXPECTED_FRAME_IND ((CsrWifiRouterCtrlPrim)(0x0015 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_CFM ((CsrWifiRouterCtrlPrim)(0x0016 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_CAPABILITIES_CFM ((CsrWifiRouterCtrlPrim)(0x0017 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_CFM ((CsrWifiRouterCtrlPrim)(0x0018 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM ((CsrWifiRouterCtrlPrim)(0x0019 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND ((CsrWifiRouterCtrlPrim)(0x001A + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND ((CsrWifiRouterCtrlPrim)(0x001B + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND ((CsrWifiRouterCtrlPrim)(0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_MODE_SET_CFM ((CsrWifiRouterCtrlPrim)(0x001D + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND ((CsrWifiRouterCtrlPrim)(0x001E + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)) - -#define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_HIGHEST (0x001E + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST) - -#define CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST) -#define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT (CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST) - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlConfigurePowerModeReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - mode - - wakeHost - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiRouterCtrlLowPowerMode mode; - u8 wakeHost; -} CsrWifiRouterCtrlConfigurePowerModeReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlHipReq - - DESCRIPTION - This primitive is used for transferring MLME messages to the HIP. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - mlmeCommandLength - Length of the MLME signal - mlmeCommand - Pointer to the MLME signal - dataRef1Length - Length of the dataRef1 bulk data - dataRef1 - Pointer to the bulk data 1 - dataRef2Length - Length of the dataRef2 bulk data - dataRef2 - Pointer to the bulk data 2 - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 mlmeCommandLength; - u8 *mlmeCommand; - u16 dataRef1Length; - u8 *dataRef1; - u16 dataRef2Length; - u8 *dataRef2; -} CsrWifiRouterCtrlHipReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlMediaStatusReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - mediaStatus - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiRouterCtrlMediaStatus mediaStatus; -} CsrWifiRouterCtrlMediaStatusReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlMulticastAddressRes - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - status - - action - - getAddressesCount - - getAddresses - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrResult status; - CsrWifiRouterCtrlListAction action; - u8 getAddressesCount; - CsrWifiMacAddress *getAddresses; -} CsrWifiRouterCtrlMulticastAddressRes; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPortConfigureReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - uncontrolledPortAction - - controlledPortAction - - macAddress - - setProtection - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiRouterCtrlPortAction uncontrolledPortAction; - CsrWifiRouterCtrlPortAction controlledPortAction; - CsrWifiMacAddress macAddress; - u8 setProtection; -} CsrWifiRouterCtrlPortConfigureReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlQosControlReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - control - - queueConfig - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiRouterCtrlQoSControl control; - CsrWifiRouterCtrlQueueConfigMask queueConfig; -} CsrWifiRouterCtrlQosControlReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlSuspendRes - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrResult status; -} CsrWifiRouterCtrlSuspendRes; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTclasAddReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - tclasLength - - tclas - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 tclasLength; - u8 *tclas; -} CsrWifiRouterCtrlTclasAddReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlResumeRes - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrResult status; -} CsrWifiRouterCtrlResumeRes; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlRawSdioDeinitialiseReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; -} CsrWifiRouterCtrlRawSdioDeinitialiseReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlRawSdioInitialiseReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; -} CsrWifiRouterCtrlRawSdioInitialiseReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTclasDelReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - tclasLength - - tclas - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 tclasLength; - u8 *tclas; -} CsrWifiRouterCtrlTclasDelReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficClassificationReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - trafficType - - period - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiRouterCtrlTrafficType trafficType; - u16 period; -} CsrWifiRouterCtrlTrafficClassificationReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficConfigReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - trafficConfigType - - config - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiRouterCtrlTrafficConfigType trafficConfigType; - CsrWifiRouterCtrlTrafficConfig config; -} CsrWifiRouterCtrlTrafficConfigReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOffReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; -} CsrWifiRouterCtrlWifiOffReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOffRes - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; -} CsrWifiRouterCtrlWifiOffRes; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOnReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - dataLength - Number of bytes in the buffer pointed to by 'data' - data - Pointer to the buffer containing 'dataLength' bytes - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u32 dataLength; - u8 *data; -} CsrWifiRouterCtrlWifiOnReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOnRes - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - status - - numInterfaceAddress - - stationMacAddress - array size 1 MUST match CSR_WIFI_NUM_INTERFACES - smeVersions - - scheduledInterrupt - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrResult status; - u16 numInterfaceAddress; - CsrWifiMacAddress stationMacAddress[2]; - CsrWifiRouterCtrlSmeVersions smeVersions; - u8 scheduledInterrupt; -} CsrWifiRouterCtrlWifiOnRes; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlM4TransmitReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; -} CsrWifiRouterCtrlM4TransmitReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlModeSetReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - mode - - bssid - BSSID of the network the device is going to be a part - of - protection - Set to TRUE if encryption is enabled for the - connection/broadcast frames - intraBssDistEnabled - If set to TRUE, intra BSS destribution will be - enabled. If set to FALSE, any unicast PDU which does - not have the RA as the the local MAC address, shall be - ignored. This field is interpreted by the receive if - mode is set to CSR_WIFI_ROUTER_CTRL_MODE_P2PGO - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiRouterCtrlMode mode; - CsrWifiMacAddress bssid; - u8 protection; - u8 intraBssDistEnabled; -} CsrWifiRouterCtrlModeSetReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerAddReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - peerMacAddress - - associationId - - staInfo - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiMacAddress peerMacAddress; - u16 associationId; - CsrWifiRouterCtrlStaInfo staInfo; -} CsrWifiRouterCtrlPeerAddReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerDelReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - peerRecordHandle - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiRouterCtrlPeerRecordHandle peerRecordHandle; -} CsrWifiRouterCtrlPeerDelReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerUpdateReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - peerRecordHandle - - powersaveMode - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiRouterCtrlPeerRecordHandle peerRecordHandle; - CsrWifiRouterCtrlPowersaveTypeMask powersaveMode; -} CsrWifiRouterCtrlPeerUpdateReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlCapabilitiesReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; -} CsrWifiRouterCtrlCapabilitiesReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlBlockAckEnableReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - macAddress - - trafficStreamID - - role - - bufferSize - - timeout - - ssn - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiMacAddress macAddress; - CsrWifiRouterCtrlTrafficStreamId trafficStreamID; - CsrWifiRouterCtrlBlockAckRole role; - u16 bufferSize; - u16 timeout; - u16 ssn; -} CsrWifiRouterCtrlBlockAckEnableReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlBlockAckDisableReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - clientData - - macAddress - - trafficStreamID - - role - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiMacAddress macAddress; - CsrWifiRouterCtrlTrafficStreamId trafficStreamID; - CsrWifiRouterCtrlBlockAckRole role; -} CsrWifiRouterCtrlBlockAckDisableReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiRxPktReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - signalLength - - signal - - dataLength - - data - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u16 signalLength; - u8 *signal; - u16 dataLength; - u8 *data; -} CsrWifiRouterCtrlWapiRxPktReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiMulticastFilterReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 status; -} CsrWifiRouterCtrlWapiMulticastFilterReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiUnicastFilterReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 status; -} CsrWifiRouterCtrlWapiUnicastFilterReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiUnicastTxPktReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - dataLength - - data - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u16 dataLength; - u8 *data; -} CsrWifiRouterCtrlWapiUnicastTxPktReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiFilterReq - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - isWapiConnected - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 isWapiConnected; -} CsrWifiRouterCtrlWapiFilterReq; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlHipInd - - DESCRIPTION - This primitive is used for transferring MLME messages from the HIP. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - mlmeCommandLength - Length of the MLME signal - mlmeCommand - Pointer to the MLME signal - dataRef1Length - Length of the dataRef1 bulk data - dataRef1 - Pointer to the bulk data 1 - dataRef2Length - Length of the dataRef2 bulk data - dataRef2 - Pointer to the bulk data 2 - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 mlmeCommandLength; - u8 *mlmeCommand; - u16 dataRef1Length; - u8 *dataRef1; - u16 dataRef2Length; - u8 *dataRef2; -} CsrWifiRouterCtrlHipInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlMulticastAddressInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - action - - setAddressesCount - - setAddresses - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrWifiRouterCtrlListAction action; - u8 setAddressesCount; - CsrWifiMacAddress *setAddresses; -} CsrWifiRouterCtrlMulticastAddressInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPortConfigureCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - status - - macAddress - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrResult status; - CsrWifiMacAddress macAddress; -} CsrWifiRouterCtrlPortConfigureCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlResumeInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - powerMaintained - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u8 powerMaintained; -} CsrWifiRouterCtrlResumeInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlSuspendInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - hardSuspend - - d3Suspend - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u8 hardSuspend; - u8 d3Suspend; -} CsrWifiRouterCtrlSuspendInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTclasAddCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrResult status; -} CsrWifiRouterCtrlTclasAddCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlRawSdioDeinitialiseCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - result - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrResult result; -} CsrWifiRouterCtrlRawSdioDeinitialiseCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlRawSdioInitialiseCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - result - - byteRead - - byteWrite - - firmwareDownload - - reset - - coreDumpPrepare - - byteBlockRead - - gpRead16 - - gpWrite16 - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrResult result; - CsrWifiRouterCtrlRawSdioByteRead byteRead; - CsrWifiRouterCtrlRawSdioByteWrite byteWrite; - CsrWifiRouterCtrlRawSdioFirmwareDownload firmwareDownload; - CsrWifiRouterCtrlRawSdioReset reset; - CsrWifiRouterCtrlRawSdioCoreDumpPrepare coreDumpPrepare; - CsrWifiRouterCtrlRawSdioByteBlockRead byteBlockRead; - CsrWifiRouterCtrlRawSdioGpRead16 gpRead16; - CsrWifiRouterCtrlRawSdioGpWrite16 gpWrite16; -} CsrWifiRouterCtrlRawSdioInitialiseCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTclasDelCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrResult status; -} CsrWifiRouterCtrlTclasDelCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficProtocolInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - packetType - - direction - - srcAddress - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrWifiRouterCtrlTrafficPacketType packetType; - CsrWifiRouterCtrlProtocolDirection direction; - CsrWifiMacAddress srcAddress; -} CsrWifiRouterCtrlTrafficProtocolInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlTrafficSampleInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - stats - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrWifiRouterCtrlTrafficStats stats; -} CsrWifiRouterCtrlTrafficSampleInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOffInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - controlIndication - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrWifiRouterCtrlControlIndication controlIndication; -} CsrWifiRouterCtrlWifiOffInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOffCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; -} CsrWifiRouterCtrlWifiOffCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOnInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - status - - versions - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrResult status; - CsrWifiRouterCtrlVersions versions; -} CsrWifiRouterCtrlWifiOnInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWifiOnCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - CsrResult status; -} CsrWifiRouterCtrlWifiOnCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlM4ReadyToSendInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - peerMacAddress - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrWifiMacAddress peerMacAddress; -} CsrWifiRouterCtrlM4ReadyToSendInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlM4TransmittedInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - peerMacAddress - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrWifiMacAddress peerMacAddress; - CsrResult status; -} CsrWifiRouterCtrlM4TransmittedInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlMicFailureInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - peerMacAddress - - unicastPdu - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrWifiMacAddress peerMacAddress; - u8 unicastPdu; -} CsrWifiRouterCtrlMicFailureInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlConnectedInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - peerMacAddress - - peerStatus - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrWifiMacAddress peerMacAddress; - CsrWifiRouterCtrlPeerStatus peerStatus; -} CsrWifiRouterCtrlConnectedInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerAddCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - peerMacAddress - - peerRecordHandle - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrWifiMacAddress peerMacAddress; - CsrWifiRouterCtrlPeerRecordHandle peerRecordHandle; - CsrResult status; -} CsrWifiRouterCtrlPeerAddCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerDelCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrResult status; -} CsrWifiRouterCtrlPeerDelCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlUnexpectedFrameInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - peerMacAddress - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrWifiMacAddress peerMacAddress; -} CsrWifiRouterCtrlUnexpectedFrameInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlPeerUpdateCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrResult status; -} CsrWifiRouterCtrlPeerUpdateCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlCapabilitiesCfm - - DESCRIPTION - The router sends this primitive to confirm the size of the queues of the - HIP. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - commandQueueSize - Size of command queue - trafficQueueSize - Size of traffic queue (per AC) - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 commandQueueSize; - u16 trafficQueueSize; -} CsrWifiRouterCtrlCapabilitiesCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlBlockAckEnableCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrResult status; -} CsrWifiRouterCtrlBlockAckEnableCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlBlockAckDisableCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrResult status; -} CsrWifiRouterCtrlBlockAckDisableCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlBlockAckErrorInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - trafficStreamID - - peerMacAddress - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrWifiRouterCtrlTrafficStreamId trafficStreamID; - CsrWifiMacAddress peerMacAddress; - CsrResult status; -} CsrWifiRouterCtrlBlockAckErrorInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlStaInactiveInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - staAddress - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrWifiMacAddress staAddress; -} CsrWifiRouterCtrlStaInactiveInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiRxMicCheckInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - signalLength - - signal - - dataLength - - data - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - u16 signalLength; - u8 *signal; - u16 dataLength; - u8 *data; -} CsrWifiRouterCtrlWapiRxMicCheckInd; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlModeSetCfm - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - mode - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - CsrWifiRouterCtrlMode mode; - CsrResult status; -} CsrWifiRouterCtrlModeSetCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterCtrlWapiUnicastTxEncryptInd - - DESCRIPTION - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - clientData - - interfaceTag - - dataLength - - data - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiRouterCtrlRequestorInfo clientData; - u16 interfaceTag; - u16 dataLength; - u8 *data; -} CsrWifiRouterCtrlWapiUnicastTxEncryptInd; - -#endif /* CSR_WIFI_ROUTER_CTRL_PRIM_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_sef.c b/drivers/staging/csr/csr_wifi_router_ctrl_sef.c deleted file mode 100644 index 99cf93061d1b..000000000000 --- a/drivers/staging/csr/csr_wifi_router_ctrl_sef.c +++ /dev/null @@ -1,46 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - Confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - - *****************************************************************************/ -#include "csr_wifi_router_ctrl_sef.h" - -const CsrWifiRouterCtrlStateHandlerType - CsrWifiRouterCtrlDownstreamStateHandlers - [CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT] = { - /* 0x0000 */ CsrWifiRouterCtrlConfigurePowerModeReqHandler, - /* 0x0001 */ CsrWifiRouterCtrlHipReqHandler, - /* 0x0002 */ CsrWifiRouterCtrlMediaStatusReqHandler, - /* 0x0003 */ CsrWifiRouterCtrlMulticastAddressResHandler, - /* 0x0004 */ CsrWifiRouterCtrlPortConfigureReqHandler, - /* 0x0005 */ CsrWifiRouterCtrlQosControlReqHandler, - /* 0x0006 */ CsrWifiRouterCtrlSuspendResHandler, - /* 0x0007 */ CsrWifiRouterCtrlTclasAddReqHandler, - /* 0x0008 */ CsrWifiRouterCtrlResumeResHandler, - /* 0x0009 */ CsrWifiRouterCtrlRawSdioDeinitialiseReqHandler, - /* 0x000A */ CsrWifiRouterCtrlRawSdioInitialiseReqHandler, - /* 0x000B */ CsrWifiRouterCtrlTclasDelReqHandler, - /* 0x000C */ CsrWifiRouterCtrlTrafficClassificationReqHandler, - /* 0x000D */ CsrWifiRouterCtrlTrafficConfigReqHandler, - /* 0x000E */ CsrWifiRouterCtrlWifiOffReqHandler, - /* 0x000F */ CsrWifiRouterCtrlWifiOffResHandler, - /* 0x0010 */ CsrWifiRouterCtrlWifiOnReqHandler, - /* 0x0011 */ CsrWifiRouterCtrlWifiOnResHandler, - /* 0x0012 */ CsrWifiRouterCtrlM4TransmitReqHandler, - /* 0x0013 */ CsrWifiRouterCtrlModeSetReqHandler, - /* 0x0014 */ CsrWifiRouterCtrlPeerAddReqHandler, - /* 0x0015 */ CsrWifiRouterCtrlPeerDelReqHandler, - /* 0x0016 */ CsrWifiRouterCtrlPeerUpdateReqHandler, - /* 0x0017 */ CsrWifiRouterCtrlCapabilitiesReqHandler, - /* 0x0018 */ CsrWifiRouterCtrlBlockAckEnableReqHandler, - /* 0x0019 */ CsrWifiRouterCtrlBlockAckDisableReqHandler, - /* 0x001A */ CsrWifiRouterCtrlWapiRxPktReqHandler, - /* 0x001B */ CsrWifiRouterCtrlWapiMulticastFilterReqHandler, - /* 0x001C */ CsrWifiRouterCtrlWapiUnicastFilterReqHandler, - /* 0x001D */ CsrWifiRouterCtrlWapiUnicastTxPktReqHandler, - /* 0x001E */ CsrWifiRouterCtrlWapiFilterReqHandler, -}; diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_sef.h b/drivers/staging/csr/csr_wifi_router_ctrl_sef.h deleted file mode 100644 index 2fb4937bc909..000000000000 --- a/drivers/staging/csr/csr_wifi_router_ctrl_sef.h +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - Confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - - *****************************************************************************/ -#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_CTRL_H__ -#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_CTRL_H__ - -#include "csr_wifi_router_ctrl_prim.h" - - typedef void (*CsrWifiRouterCtrlStateHandlerType)(void* drvpriv, CsrWifiFsmEvent* msg); - - extern const CsrWifiRouterCtrlStateHandlerType CsrWifiRouterCtrlDownstreamStateHandlers[CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT]; - - extern void CsrWifiRouterCtrlConfigurePowerModeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlMediaStatusReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlMulticastAddressResHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlPortConfigureReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlQosControlReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlSuspendResHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlTclasAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlResumeResHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlRawSdioDeinitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlRawSdioInitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlTclasDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlTrafficClassificationReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlTrafficConfigReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlWifiOffReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlWifiOffResHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlWifiOnReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlM4TransmitReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlModeSetReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlPeerAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlPeerDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlPeerUpdateReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlCapabilitiesReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlBlockAckEnableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlBlockAckDisableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlWapiMulticastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlWapiRxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlWapiUnicastTxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlWapiUnicastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterCtrlWapiFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - -#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_CTRL_H__ */ diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c deleted file mode 100644 index 3eda1b66b336..000000000000 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c +++ /dev/null @@ -1,2591 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ -#include <linux/string.h> -#include <linux/slab.h> -#include "csr_msgconv.h" -#include "csr_wifi_router_ctrl_prim.h" -#include "csr_wifi_router_ctrl_serialize.h" - -void CsrWifiRouterCtrlPfree(void *ptr) -{ - kfree(ptr); -} - - -size_t CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrWifiRouterCtrlLowPowerMode primitive->mode */ - bufferSize += 1; /* u8 primitive->wakeHost */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlConfigurePowerModeReq *primitive = (CsrWifiRouterCtrlConfigurePowerModeReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->mode); - CsrUint8Ser(ptr, len, (u8) primitive->wakeHost); - return(ptr); -} - - -void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlConfigurePowerModeReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlConfigurePowerModeReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mode, buffer, &offset); - CsrUint8Des((u8 *) &primitive->wakeHost, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlHipReqSizeof(void *msg) -{ - CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ - bufferSize += 2; /* u16 primitive->mlmeCommandLength */ - bufferSize += primitive->mlmeCommandLength; /* u8 primitive->mlmeCommand */ - bufferSize += 2; /* u16 primitive->dataRef1Length */ - bufferSize += primitive->dataRef1Length; /* u8 primitive->dataRef1 */ - bufferSize += 2; /* u16 primitive->dataRef2Length */ - bufferSize += primitive->dataRef2Length; /* u8 primitive->dataRef2 */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->mlmeCommandLength); - if (primitive->mlmeCommandLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->mlmeCommand, ((u16) (primitive->mlmeCommandLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->dataRef1Length); - if (primitive->dataRef1Length) - { - CsrMemCpySer(ptr, len, (const void *) primitive->dataRef1, ((u16) (primitive->dataRef1Length))); - } - CsrUint16Ser(ptr, len, (u16) primitive->dataRef2Length); - if (primitive->dataRef2Length) - { - CsrMemCpySer(ptr, len, (const void *) primitive->dataRef2, ((u16) (primitive->dataRef2Length))); - } - return(ptr); -} - - -void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlHipReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlHipReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mlmeCommandLength, buffer, &offset); - if (primitive->mlmeCommandLength) - { - primitive->mlmeCommand = kmalloc(primitive->mlmeCommandLength, GFP_KERNEL); - CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((u16) (primitive->mlmeCommandLength))); - } - else - { - primitive->mlmeCommand = NULL; - } - CsrUint16Des((u16 *) &primitive->dataRef1Length, buffer, &offset); - if (primitive->dataRef1Length) - { - primitive->dataRef1 = kmalloc(primitive->dataRef1Length, GFP_KERNEL); - CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((u16) (primitive->dataRef1Length))); - } - else - { - primitive->dataRef1 = NULL; - } - CsrUint16Des((u16 *) &primitive->dataRef2Length, buffer, &offset); - if (primitive->dataRef2Length) - { - primitive->dataRef2 = kmalloc(primitive->dataRef2Length, GFP_KERNEL); - CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((u16) (primitive->dataRef2Length))); - } - else - { - primitive->dataRef2 = NULL; - } - - return primitive; -} - - -void CsrWifiRouterCtrlHipReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *) voidPrimitivePointer; - kfree(primitive->mlmeCommand); - kfree(primitive->dataRef1); - kfree(primitive->dataRef2); - kfree(primitive); -} - - -size_t CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 1; /* CsrWifiRouterCtrlMediaStatus primitive->mediaStatus */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlMediaStatusReq *primitive = (CsrWifiRouterCtrlMediaStatusReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus); - return(ptr); -} - - -void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlMediaStatusReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlMediaStatusReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg) -{ - CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrWifiRouterCtrlListAction primitive->action */ - bufferSize += 1; /* u8 primitive->getAddressesCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->getAddressesCount; i1++) - { - bufferSize += 6; /* u8 primitive->getAddresses[i1].a[6] */ - } - } - return bufferSize; -} - - -u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->action); - CsrUint8Ser(ptr, len, (u8) primitive->getAddressesCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->getAddressesCount; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((u16) (6))); - } - } - return(ptr); -} - - -void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlMulticastAddressRes *primitive = kmalloc(sizeof(CsrWifiRouterCtrlMulticastAddressRes), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->action, buffer, &offset); - CsrUint8Des((u8 *) &primitive->getAddressesCount, buffer, &offset); - primitive->getAddresses = NULL; - if (primitive->getAddressesCount) - { - primitive->getAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->getAddressesCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->getAddressesCount; i1++) - { - CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((u16) (6))); - } - } - - return primitive; -} - - -void CsrWifiRouterCtrlMulticastAddressResSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *) voidPrimitivePointer; - kfree(primitive->getAddresses); - kfree(primitive); -} - - -size_t CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrWifiRouterCtrlPortAction primitive->uncontrolledPortAction */ - bufferSize += 2; /* CsrWifiRouterCtrlPortAction primitive->controlledPortAction */ - bufferSize += 6; /* u8 primitive->macAddress.a[6] */ - bufferSize += 1; /* u8 primitive->setProtection */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlPortConfigureReq *primitive = (CsrWifiRouterCtrlPortConfigureReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->uncontrolledPortAction); - CsrUint16Ser(ptr, len, (u16) primitive->controlledPortAction); - CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->setProtection); - return(ptr); -} - - -void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlPortConfigureReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPortConfigureReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->uncontrolledPortAction, buffer, &offset); - CsrUint16Des((u16 *) &primitive->controlledPortAction, buffer, &offset); - CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->setProtection, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlQosControlReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrWifiRouterCtrlQoSControl primitive->control */ - bufferSize += 1; /* CsrWifiRouterCtrlQueueConfigMask primitive->queueConfig */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlQosControlReq *primitive = (CsrWifiRouterCtrlQosControlReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->control); - CsrUint8Ser(ptr, len, (u8) primitive->queueConfig); - return(ptr); -} - - -void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlQosControlReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlQosControlReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->control, buffer, &offset); - CsrUint8Des((u8 *) &primitive->queueConfig, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlSuspendResSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlSuspendRes *primitive = (CsrWifiRouterCtrlSuspendRes *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlSuspendRes *primitive = kmalloc(sizeof(CsrWifiRouterCtrlSuspendRes), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlTclasAddReqSizeof(void *msg) -{ - CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->tclasLength */ - bufferSize += primitive->tclasLength; /* u8 primitive->tclas */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->tclasLength); - if (primitive->tclasLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((u16) (primitive->tclasLength))); - } - return(ptr); -} - - -void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlTclasAddReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTclasAddReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->tclasLength, buffer, &offset); - if (primitive->tclasLength) - { - primitive->tclas = kmalloc(primitive->tclasLength, GFP_KERNEL); - CsrMemCpyDes(primitive->tclas, buffer, &offset, ((u16) (primitive->tclasLength))); - } - else - { - primitive->tclas = NULL; - } - - return primitive; -} - - -void CsrWifiRouterCtrlTclasAddReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *) voidPrimitivePointer; - kfree(primitive->tclas); - kfree(primitive); -} - - -size_t CsrWifiRouterCtrlResumeResSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlResumeRes *primitive = (CsrWifiRouterCtrlResumeRes *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlResumeRes *primitive = kmalloc(sizeof(CsrWifiRouterCtrlResumeRes), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlTclasDelReqSizeof(void *msg) -{ - CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->tclasLength */ - bufferSize += primitive->tclasLength; /* u8 primitive->tclas */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->tclasLength); - if (primitive->tclasLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((u16) (primitive->tclasLength))); - } - return(ptr); -} - - -void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlTclasDelReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTclasDelReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->tclasLength, buffer, &offset); - if (primitive->tclasLength) - { - primitive->tclas = kmalloc(primitive->tclasLength, GFP_KERNEL); - CsrMemCpyDes(primitive->tclas, buffer, &offset, ((u16) (primitive->tclasLength))); - } - else - { - primitive->tclas = NULL; - } - - return primitive; -} - - -void CsrWifiRouterCtrlTclasDelReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *) voidPrimitivePointer; - kfree(primitive->tclas); - kfree(primitive); -} - - -size_t CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 1; /* CsrWifiRouterCtrlTrafficType primitive->trafficType */ - bufferSize += 2; /* u16 primitive->period */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlTrafficClassificationReq *primitive = (CsrWifiRouterCtrlTrafficClassificationReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint8Ser(ptr, len, (u8) primitive->trafficType); - CsrUint16Ser(ptr, len, (u16) primitive->period); - return(ptr); -} - - -void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlTrafficClassificationReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTrafficClassificationReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint8Des((u8 *) &primitive->trafficType, buffer, &offset); - CsrUint16Des((u16 *) &primitive->period, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 24) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrWifiRouterCtrlTrafficConfigType primitive->trafficConfigType */ - bufferSize += 2; /* u16 primitive->config.packetFilter */ - bufferSize += 4; /* u32 primitive->config.customFilter.etherType */ - bufferSize += 1; /* u8 primitive->config.customFilter.ipType */ - bufferSize += 4; /* u32 primitive->config.customFilter.udpSourcePort */ - bufferSize += 4; /* u32 primitive->config.customFilter.udpDestPort */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlTrafficConfigReq *primitive = (CsrWifiRouterCtrlTrafficConfigReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->trafficConfigType); - CsrUint16Ser(ptr, len, (u16) primitive->config.packetFilter); - CsrUint32Ser(ptr, len, (u32) primitive->config.customFilter.etherType); - CsrUint8Ser(ptr, len, (u8) primitive->config.customFilter.ipType); - CsrUint32Ser(ptr, len, (u32) primitive->config.customFilter.udpSourcePort); - CsrUint32Ser(ptr, len, (u32) primitive->config.customFilter.udpDestPort); - return(ptr); -} - - -void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlTrafficConfigReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTrafficConfigReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->trafficConfigType, buffer, &offset); - CsrUint16Des((u16 *) &primitive->config.packetFilter, buffer, &offset); - CsrUint32Des((u32 *) &primitive->config.customFilter.etherType, buffer, &offset); - CsrUint8Des((u8 *) &primitive->config.customFilter.ipType, buffer, &offset); - CsrUint32Des((u32 *) &primitive->config.customFilter.udpSourcePort, buffer, &offset); - CsrUint32Des((u32 *) &primitive->config.customFilter.udpDestPort, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlWifiOnReqSizeof(void *msg) -{ - CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 4; /* u32 primitive->dataLength */ - bufferSize += primitive->dataLength; /* u8 primitive->data */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint32Ser(ptr, len, (u32) primitive->dataLength); - if (primitive->dataLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); - } - return(ptr); -} - - -void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlWifiOnReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint32Des((u32 *) &primitive->dataLength, buffer, &offset); - if (primitive->dataLength) - { - primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); - CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); - } - else - { - primitive->data = NULL; - } - - return primitive; -} - - -void CsrWifiRouterCtrlWifiOnReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *) voidPrimitivePointer; - kfree(primitive->data); - kfree(primitive); -} - - -size_t CsrWifiRouterCtrlWifiOnResSizeof(void *msg) -{ - CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 30) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* u16 primitive->numInterfaceAddress */ - { - u16 i1; - for (i1 = 0; i1 < 2; i1++) - { - bufferSize += 6; /* u8 primitive->stationMacAddress[i1].a[6] */ - } - } - bufferSize += 4; /* u32 primitive->smeVersions.firmwarePatch */ - bufferSize += (primitive->smeVersions.smeBuild ? strlen(primitive->smeVersions.smeBuild) : 0) + 1; /* char* primitive->smeVersions.smeBuild (0 byte len + 1 for NULL Term) */ - bufferSize += 4; /* u32 primitive->smeVersions.smeHip */ - bufferSize += 1; /* u8 primitive->scheduledInterrupt */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint16Ser(ptr, len, (u16) primitive->numInterfaceAddress); - { - u16 i1; - for (i1 = 0; i1 < 2; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->stationMacAddress[i1].a, ((u16) (6))); - } - } - CsrUint32Ser(ptr, len, (u32) primitive->smeVersions.firmwarePatch); - CsrCharStringSer(ptr, len, primitive->smeVersions.smeBuild); - CsrUint32Ser(ptr, len, (u32) primitive->smeVersions.smeHip); - CsrUint8Ser(ptr, len, (u8) primitive->scheduledInterrupt); - return(ptr); -} - - -void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlWifiOnRes *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnRes), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint16Des((u16 *) &primitive->numInterfaceAddress, buffer, &offset); - { - u16 i1; - for (i1 = 0; i1 < 2; i1++) - { - CsrMemCpyDes(primitive->stationMacAddress[i1].a, buffer, &offset, ((u16) (6))); - } - } - CsrUint32Des((u32 *) &primitive->smeVersions.firmwarePatch, buffer, &offset); - CsrCharStringDes(&primitive->smeVersions.smeBuild, buffer, &offset); - CsrUint32Des((u32 *) &primitive->smeVersions.smeHip, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scheduledInterrupt, buffer, &offset); - - return primitive; -} - - -void CsrWifiRouterCtrlWifiOnResSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) voidPrimitivePointer; - kfree(primitive->smeVersions.smeBuild); - kfree(primitive); -} - - -size_t CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlM4TransmitReq *primitive = (CsrWifiRouterCtrlM4TransmitReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - return(ptr); -} - - -void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlM4TransmitReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlM4TransmitReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlModeSetReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 16) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 1; /* CsrWifiRouterCtrlMode primitive->mode */ - bufferSize += 6; /* u8 primitive->bssid.a[6] */ - bufferSize += 1; /* u8 primitive->protection */ - bufferSize += 1; /* u8 primitive->intraBssDistEnabled */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlModeSetReq *primitive = (CsrWifiRouterCtrlModeSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint8Ser(ptr, len, (u8) primitive->mode); - CsrMemCpySer(ptr, len, (const void *) primitive->bssid.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->protection); - CsrUint8Ser(ptr, len, (u8) primitive->intraBssDistEnabled); - return(ptr); -} - - -void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlModeSetReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlModeSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint8Des((u8 *) &primitive->mode, buffer, &offset); - CsrMemCpyDes(primitive->bssid.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->protection, buffer, &offset); - CsrUint8Des((u8 *) &primitive->intraBssDistEnabled, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlPeerAddReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - bufferSize += 2; /* u16 primitive->associationId */ - bufferSize += 1; /* u8 primitive->staInfo.wmmOrQosEnabled */ - bufferSize += 2; /* CsrWifiRouterCtrlPowersaveTypeMask primitive->staInfo.powersaveMode */ - bufferSize += 1; /* u8 primitive->staInfo.maxSpLength */ - bufferSize += 2; /* u16 primitive->staInfo.listenIntervalInTus */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlPeerAddReq *primitive = (CsrWifiRouterCtrlPeerAddReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->associationId); - CsrUint8Ser(ptr, len, (u8) primitive->staInfo.wmmOrQosEnabled); - CsrUint16Ser(ptr, len, (u16) primitive->staInfo.powersaveMode); - CsrUint8Ser(ptr, len, (u8) primitive->staInfo.maxSpLength); - CsrUint16Ser(ptr, len, (u16) primitive->staInfo.listenIntervalInTus); - return(ptr); -} - - -void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlPeerAddReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerAddReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->associationId, buffer, &offset); - CsrUint8Des((u8 *) &primitive->staInfo.wmmOrQosEnabled, buffer, &offset); - CsrUint16Des((u16 *) &primitive->staInfo.powersaveMode, buffer, &offset); - CsrUint8Des((u8 *) &primitive->staInfo.maxSpLength, buffer, &offset); - CsrUint16Des((u16 *) &primitive->staInfo.listenIntervalInTus, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlPeerDelReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlPeerDelReq *primitive = (CsrWifiRouterCtrlPeerDelReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint32Ser(ptr, len, (u32) primitive->peerRecordHandle); - return(ptr); -} - - -void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlPeerDelReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerDelReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint32Des((u32 *) &primitive->peerRecordHandle, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */ - bufferSize += 2; /* CsrWifiRouterCtrlPowersaveTypeMask primitive->powersaveMode */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlPeerUpdateReq *primitive = (CsrWifiRouterCtrlPeerUpdateReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint32Ser(ptr, len, (u32) primitive->peerRecordHandle); - CsrUint16Ser(ptr, len, (u16) primitive->powersaveMode); - return(ptr); -} - - -void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlPeerUpdateReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerUpdateReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint32Des((u32 *) &primitive->peerRecordHandle, buffer, &offset); - CsrUint16Des((u16 *) &primitive->powersaveMode, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 6; /* u8 primitive->macAddress.a[6] */ - bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */ - bufferSize += 1; /* CsrWifiRouterCtrlBlockAckRole primitive->role */ - bufferSize += 2; /* u16 primitive->bufferSize */ - bufferSize += 2; /* u16 primitive->timeout */ - bufferSize += 2; /* u16 primitive->ssn */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlBlockAckEnableReq *primitive = (CsrWifiRouterCtrlBlockAckEnableReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->trafficStreamID); - CsrUint8Ser(ptr, len, (u8) primitive->role); - CsrUint16Ser(ptr, len, (u16) primitive->bufferSize); - CsrUint16Ser(ptr, len, (u16) primitive->timeout); - CsrUint16Ser(ptr, len, (u16) primitive->ssn); - return(ptr); -} - - -void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlBlockAckEnableReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckEnableReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->trafficStreamID, buffer, &offset); - CsrUint8Des((u8 *) &primitive->role, buffer, &offset); - CsrUint16Des((u16 *) &primitive->bufferSize, buffer, &offset); - CsrUint16Des((u16 *) &primitive->timeout, buffer, &offset); - CsrUint16Des((u16 *) &primitive->ssn, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 6; /* u8 primitive->macAddress.a[6] */ - bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */ - bufferSize += 1; /* CsrWifiRouterCtrlBlockAckRole primitive->role */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlBlockAckDisableReq *primitive = (CsrWifiRouterCtrlBlockAckDisableReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->trafficStreamID); - CsrUint8Ser(ptr, len, (u8) primitive->role); - return(ptr); -} - - -void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlBlockAckDisableReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckDisableReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->trafficStreamID, buffer, &offset); - CsrUint8Des((u8 *) &primitive->role, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg) -{ - CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* u16 primitive->signalLength */ - bufferSize += primitive->signalLength; /* u8 primitive->signal */ - bufferSize += 2; /* u16 primitive->dataLength */ - bufferSize += primitive->dataLength; /* u8 primitive->data */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->signalLength); - if (primitive->signalLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->signal, ((u16) (primitive->signalLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->dataLength); - if (primitive->dataLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); - } - return(ptr); -} - - -void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlWapiRxPktReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWapiRxPktReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->signalLength, buffer, &offset); - if (primitive->signalLength) - { - primitive->signal = kmalloc(primitive->signalLength, GFP_KERNEL); - CsrMemCpyDes(primitive->signal, buffer, &offset, ((u16) (primitive->signalLength))); - } - else - { - primitive->signal = NULL; - } - CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset); - if (primitive->dataLength) - { - primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); - CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); - } - else - { - primitive->data = NULL; - } - - return primitive; -} - - -void CsrWifiRouterCtrlWapiRxPktReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *) voidPrimitivePointer; - kfree(primitive->signal); - kfree(primitive->data); - kfree(primitive); -} - - -size_t CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg) -{ - CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* u16 primitive->dataLength */ - bufferSize += primitive->dataLength; /* u8 primitive->data */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->dataLength); - if (primitive->dataLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); - } - return(ptr); -} - - -void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxPktReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset); - if (primitive->dataLength) - { - primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); - CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); - } - else - { - primitive->data = NULL; - } - - return primitive; -} - - -void CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) voidPrimitivePointer; - kfree(primitive->data); - kfree(primitive); -} - - -size_t CsrWifiRouterCtrlHipIndSizeof(void *msg) -{ - CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ - bufferSize += 2; /* u16 primitive->mlmeCommandLength */ - bufferSize += primitive->mlmeCommandLength; /* u8 primitive->mlmeCommand */ - bufferSize += 2; /* u16 primitive->dataRef1Length */ - bufferSize += primitive->dataRef1Length; /* u8 primitive->dataRef1 */ - bufferSize += 2; /* u16 primitive->dataRef2Length */ - bufferSize += primitive->dataRef2Length; /* u8 primitive->dataRef2 */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->mlmeCommandLength); - if (primitive->mlmeCommandLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->mlmeCommand, ((u16) (primitive->mlmeCommandLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->dataRef1Length); - if (primitive->dataRef1Length) - { - CsrMemCpySer(ptr, len, (const void *) primitive->dataRef1, ((u16) (primitive->dataRef1Length))); - } - CsrUint16Ser(ptr, len, (u16) primitive->dataRef2Length); - if (primitive->dataRef2Length) - { - CsrMemCpySer(ptr, len, (const void *) primitive->dataRef2, ((u16) (primitive->dataRef2Length))); - } - return(ptr); -} - - -void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlHipInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlHipInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mlmeCommandLength, buffer, &offset); - if (primitive->mlmeCommandLength) - { - primitive->mlmeCommand = kmalloc(primitive->mlmeCommandLength, GFP_KERNEL); - CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((u16) (primitive->mlmeCommandLength))); - } - else - { - primitive->mlmeCommand = NULL; - } - CsrUint16Des((u16 *) &primitive->dataRef1Length, buffer, &offset); - if (primitive->dataRef1Length) - { - primitive->dataRef1 = kmalloc(primitive->dataRef1Length, GFP_KERNEL); - CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((u16) (primitive->dataRef1Length))); - } - else - { - primitive->dataRef1 = NULL; - } - CsrUint16Des((u16 *) &primitive->dataRef2Length, buffer, &offset); - if (primitive->dataRef2Length) - { - primitive->dataRef2 = kmalloc(primitive->dataRef2Length, GFP_KERNEL); - CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((u16) (primitive->dataRef2Length))); - } - else - { - primitive->dataRef2 = NULL; - } - - return primitive; -} - - -void CsrWifiRouterCtrlHipIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) voidPrimitivePointer; - kfree(primitive->mlmeCommand); - kfree(primitive->dataRef1); - kfree(primitive->dataRef2); - kfree(primitive); -} - - -size_t CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg) -{ - CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiRouterCtrlListAction primitive->action */ - bufferSize += 1; /* u8 primitive->setAddressesCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->setAddressesCount; i1++) - { - bufferSize += 6; /* u8 primitive->setAddresses[i1].a[6] */ - } - } - return bufferSize; -} - - -u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->action); - CsrUint8Ser(ptr, len, (u8) primitive->setAddressesCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->setAddressesCount; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((u16) (6))); - } - } - return(ptr); -} - - -void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlMulticastAddressInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlMulticastAddressInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->action, buffer, &offset); - CsrUint8Des((u8 *) &primitive->setAddressesCount, buffer, &offset); - primitive->setAddresses = NULL; - if (primitive->setAddressesCount) - { - primitive->setAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->setAddressesCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->setAddressesCount; i1++) - { - CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((u16) (6))); - } - } - - return primitive; -} - - -void CsrWifiRouterCtrlMulticastAddressIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *) voidPrimitivePointer; - kfree(primitive->setAddresses); - kfree(primitive); -} - - -size_t CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 6; /* u8 primitive->macAddress.a[6] */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlPortConfigureCfm *primitive = (CsrWifiRouterCtrlPortConfigureCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((u16) (6))); - return(ptr); -} - - -void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlPortConfigureCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPortConfigureCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((u16) (6))); - - return primitive; -} - - -size_t CsrWifiRouterCtrlSuspendIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 1; /* u8 primitive->hardSuspend */ - bufferSize += 1; /* u8 primitive->d3Suspend */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlSuspendInd *primitive = (CsrWifiRouterCtrlSuspendInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint8Ser(ptr, len, (u8) primitive->hardSuspend); - CsrUint8Ser(ptr, len, (u8) primitive->d3Suspend); - return(ptr); -} - - -void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlSuspendInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlSuspendInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint8Des((u8 *) &primitive->hardSuspend, buffer, &offset); - CsrUint8Des((u8 *) &primitive->d3Suspend, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlTclasAddCfm *primitive = (CsrWifiRouterCtrlTclasAddCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlTclasAddCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTclasAddCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrResult primitive->result */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioDeinitialiseCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->result); - return(ptr); -} - - -void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->result, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 39) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrResult primitive->result */ - bufferSize += 4; /* CsrWifiRouterCtrlRawSdioByteRead primitive->byteRead */ - bufferSize += 4; /* CsrWifiRouterCtrlRawSdioByteWrite primitive->byteWrite */ - bufferSize += 4; /* CsrWifiRouterCtrlRawSdioFirmwareDownload primitive->firmwareDownload */ - bufferSize += 4; /* CsrWifiRouterCtrlRawSdioReset primitive->reset */ - bufferSize += 4; /* CsrWifiRouterCtrlRawSdioCoreDumpPrepare primitive->coreDumpPrepare */ - bufferSize += 4; /* CsrWifiRouterCtrlRawSdioByteBlockRead primitive->byteBlockRead */ - bufferSize += 4; /* CsrWifiRouterCtrlRawSdioGpRead16 primitive->gpRead16 */ - bufferSize += 4; /* CsrWifiRouterCtrlRawSdioGpWrite16 primitive->gpWrite16 */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioInitialiseCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->result); - CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->byteRead */ - CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->byteWrite */ - CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->firmwareDownload */ - CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->reset */ - CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->coreDumpPrepare */ - CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->byteBlockRead */ - CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->gpRead16 */ - CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->gpWrite16 */ - return(ptr); -} - - -void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->result, buffer, &offset); - primitive->byteRead = NULL; /* Special for Function Pointers... */ - offset += 4; - primitive->byteWrite = NULL; /* Special for Function Pointers... */ - offset += 4; - primitive->firmwareDownload = NULL; /* Special for Function Pointers... */ - offset += 4; - primitive->reset = NULL; /* Special for Function Pointers... */ - offset += 4; - primitive->coreDumpPrepare = NULL; /* Special for Function Pointers... */ - offset += 4; - primitive->byteBlockRead = NULL; /* Special for Function Pointers... */ - offset += 4; - primitive->gpRead16 = NULL; /* Special for Function Pointers... */ - offset += 4; - primitive->gpWrite16 = NULL; /* Special for Function Pointers... */ - offset += 4; - - return primitive; -} - - -size_t CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlTclasDelCfm *primitive = (CsrWifiRouterCtrlTclasDelCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlTclasDelCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTclasDelCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrWifiRouterCtrlTrafficPacketType primitive->packetType */ - bufferSize += 2; /* CsrWifiRouterCtrlProtocolDirection primitive->direction */ - bufferSize += 6; /* u8 primitive->srcAddress.a[6] */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlTrafficProtocolInd *primitive = (CsrWifiRouterCtrlTrafficProtocolInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->packetType); - CsrUint16Ser(ptr, len, (u16) primitive->direction); - CsrMemCpySer(ptr, len, (const void *) primitive->srcAddress.a, ((u16) (6))); - return(ptr); -} - - -void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlTrafficProtocolInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTrafficProtocolInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->packetType, buffer, &offset); - CsrUint16Des((u16 *) &primitive->direction, buffer, &offset); - CsrMemCpyDes(primitive->srcAddress.a, buffer, &offset, ((u16) (6))); - - return primitive; -} - - -size_t CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 38) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 4; /* u32 primitive->stats.rxMeanRate */ - bufferSize += 4; /* u32 primitive->stats.rxFramesNum */ - bufferSize += 4; /* u32 primitive->stats.txFramesNum */ - bufferSize += 4; /* u32 primitive->stats.rxBytesCount */ - bufferSize += 4; /* u32 primitive->stats.txBytesCount */ - bufferSize += 11; /* u8 primitive->stats.intervals[11] */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlTrafficSampleInd *primitive = (CsrWifiRouterCtrlTrafficSampleInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint32Ser(ptr, len, (u32) primitive->stats.rxMeanRate); - CsrUint32Ser(ptr, len, (u32) primitive->stats.rxFramesNum); - CsrUint32Ser(ptr, len, (u32) primitive->stats.txFramesNum); - CsrUint32Ser(ptr, len, (u32) primitive->stats.rxBytesCount); - CsrUint32Ser(ptr, len, (u32) primitive->stats.txBytesCount); - CsrMemCpySer(ptr, len, (const void *) primitive->stats.intervals, ((u16) (11))); - return(ptr); -} - - -void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlTrafficSampleInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTrafficSampleInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint32Des((u32 *) &primitive->stats.rxMeanRate, buffer, &offset); - CsrUint32Des((u32 *) &primitive->stats.rxFramesNum, buffer, &offset); - CsrUint32Des((u32 *) &primitive->stats.txFramesNum, buffer, &offset); - CsrUint32Des((u32 *) &primitive->stats.rxBytesCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->stats.txBytesCount, buffer, &offset); - CsrMemCpyDes(primitive->stats.intervals, buffer, &offset, ((u16) (11))); - - return primitive; -} - - -size_t CsrWifiRouterCtrlWifiOnIndSizeof(void *msg) -{ - CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 27) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 4; /* u32 primitive->versions.chipId */ - bufferSize += 4; /* u32 primitive->versions.chipVersion */ - bufferSize += 4; /* u32 primitive->versions.firmwareBuild */ - bufferSize += 4; /* u32 primitive->versions.firmwareHip */ - bufferSize += (primitive->versions.routerBuild ? strlen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ - bufferSize += 4; /* u32 primitive->versions.routerHip */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint32Ser(ptr, len, (u32) primitive->versions.chipId); - CsrUint32Ser(ptr, len, (u32) primitive->versions.chipVersion); - CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwareBuild); - CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwareHip); - CsrCharStringSer(ptr, len, primitive->versions.routerBuild); - CsrUint32Ser(ptr, len, (u32) primitive->versions.routerHip); - return(ptr); -} - - -void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlWifiOnInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint32Des((u32 *) &primitive->versions.chipId, buffer, &offset); - CsrUint32Des((u32 *) &primitive->versions.chipVersion, buffer, &offset); - CsrUint32Des((u32 *) &primitive->versions.firmwareBuild, buffer, &offset); - CsrUint32Des((u32 *) &primitive->versions.firmwareHip, buffer, &offset); - CsrCharStringDes(&primitive->versions.routerBuild, buffer, &offset); - CsrUint32Des((u32 *) &primitive->versions.routerHip, buffer, &offset); - - return primitive; -} - - -void CsrWifiRouterCtrlWifiOnIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *) voidPrimitivePointer; - kfree(primitive->versions.routerBuild); - kfree(primitive); -} - - -size_t CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlWifiOnCfm *primitive = (CsrWifiRouterCtrlWifiOnCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlWifiOnCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlM4ReadyToSendInd *primitive = (CsrWifiRouterCtrlM4ReadyToSendInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); - return(ptr); -} - - -void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlM4ReadyToSendInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlM4ReadyToSendInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); - - return primitive; -} - - -size_t CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlM4TransmittedInd *primitive = (CsrWifiRouterCtrlM4TransmittedInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlM4TransmittedInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlM4TransmittedInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlMicFailureIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - bufferSize += 1; /* u8 primitive->unicastPdu */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlMicFailureInd *primitive = (CsrWifiRouterCtrlMicFailureInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->unicastPdu); - return(ptr); -} - - -void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlMicFailureInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlMicFailureInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->unicastPdu, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlConnectedIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - bufferSize += 1; /* CsrWifiRouterCtrlPeerStatus primitive->peerStatus */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlConnectedInd *primitive = (CsrWifiRouterCtrlConnectedInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->peerStatus); - return(ptr); -} - - -void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlConnectedInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlConnectedInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->peerStatus, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 19) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlPeerAddCfm *primitive = (CsrWifiRouterCtrlPeerAddCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); - CsrUint32Ser(ptr, len, (u32) primitive->peerRecordHandle); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlPeerAddCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerAddCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); - CsrUint32Des((u32 *) &primitive->peerRecordHandle, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlPeerDelCfm *primitive = (CsrWifiRouterCtrlPeerDelCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlPeerDelCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerDelCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlUnexpectedFrameInd *primitive = (CsrWifiRouterCtrlUnexpectedFrameInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); - return(ptr); -} - - -void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlUnexpectedFrameInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlUnexpectedFrameInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); - - return primitive; -} - - -size_t CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlPeerUpdateCfm *primitive = (CsrWifiRouterCtrlPeerUpdateCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlPeerUpdateCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerUpdateCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->commandQueueSize */ - bufferSize += 2; /* u16 primitive->trafficQueueSize */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlCapabilitiesCfm *primitive = (CsrWifiRouterCtrlCapabilitiesCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->commandQueueSize); - CsrUint16Ser(ptr, len, (u16) primitive->trafficQueueSize); - return(ptr); -} - - -void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlCapabilitiesCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlCapabilitiesCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->commandQueueSize, buffer, &offset); - CsrUint16Des((u16 *) &primitive->trafficQueueSize, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlBlockAckEnableCfm *primitive = (CsrWifiRouterCtrlBlockAckEnableCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlBlockAckEnableCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckEnableCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlBlockAckDisableCfm *primitive = (CsrWifiRouterCtrlBlockAckDisableCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlBlockAckDisableCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckDisableCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 16) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */ - bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlBlockAckErrorInd *primitive = (CsrWifiRouterCtrlBlockAckErrorInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->trafficStreamID); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlBlockAckErrorInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckErrorInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->trafficStreamID, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 6; /* u8 primitive->staAddress.a[6] */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlStaInactiveInd *primitive = (CsrWifiRouterCtrlStaInactiveInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->staAddress.a, ((u16) (6))); - return(ptr); -} - - -void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlStaInactiveInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlStaInactiveInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->staAddress.a, buffer, &offset, ((u16) (6))); - - return primitive; -} - - -size_t CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg) -{ - CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* u16 primitive->signalLength */ - bufferSize += primitive->signalLength; /* u8 primitive->signal */ - bufferSize += 2; /* u16 primitive->dataLength */ - bufferSize += primitive->dataLength; /* u8 primitive->data */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->signalLength); - if (primitive->signalLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->signal, ((u16) (primitive->signalLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->dataLength); - if (primitive->dataLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); - } - return(ptr); -} - - -void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWapiRxMicCheckInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->signalLength, buffer, &offset); - if (primitive->signalLength) - { - primitive->signal = kmalloc(primitive->signalLength, GFP_KERNEL); - CsrMemCpyDes(primitive->signal, buffer, &offset, ((u16) (primitive->signalLength))); - } - else - { - primitive->signal = NULL; - } - CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset); - if (primitive->dataLength) - { - primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); - CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); - } - else - { - primitive->data = NULL; - } - - return primitive; -} - - -void CsrWifiRouterCtrlWapiRxMicCheckIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *) voidPrimitivePointer; - kfree(primitive->signal); - kfree(primitive->data); - kfree(primitive); -} - - -size_t CsrWifiRouterCtrlModeSetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiRouterCtrlMode primitive->mode */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlModeSetCfm *primitive = (CsrWifiRouterCtrlModeSetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->mode); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlModeSetCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlModeSetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->mode, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg) -{ - CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* u16 primitive->dataLength */ - bufferSize += primitive->dataLength; /* u8 primitive->data */ - return bufferSize; -} - - -u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->clientData); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->dataLength); - if (primitive->dataLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); - } - return(ptr); -} - - -void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxEncryptInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset); - if (primitive->dataLength) - { - primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); - CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); - } - else - { - primitive->data = NULL; - } - - return primitive; -} - - -void CsrWifiRouterCtrlWapiUnicastTxEncryptIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) voidPrimitivePointer; - kfree(primitive->data); - kfree(primitive); -} - - diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h deleted file mode 100644 index c9048386cfcb..000000000000 --- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h +++ /dev/null @@ -1,333 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__ -#define CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__ - -#include "csr_wifi_msgconv.h" - -#include "csr_wifi_router_ctrl_prim.h" - -extern void CsrWifiRouterCtrlPfree(void *ptr); - -extern u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg); -#define CsrWifiRouterCtrlConfigurePowerModeReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlHipReqSizeof(void *msg); -extern void CsrWifiRouterCtrlHipReqSerFree(void *msg); - -extern u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg); -#define CsrWifiRouterCtrlMediaStatusReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg); -extern void CsrWifiRouterCtrlMulticastAddressResSerFree(void *msg); - -extern u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg); -#define CsrWifiRouterCtrlPortConfigureReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlQosControlReqSizeof(void *msg); -#define CsrWifiRouterCtrlQosControlReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlSuspendResSizeof(void *msg); -#define CsrWifiRouterCtrlSuspendResSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlTclasAddReqSizeof(void *msg); -extern void CsrWifiRouterCtrlTclasAddReqSerFree(void *msg); - -extern u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlResumeResSizeof(void *msg); -#define CsrWifiRouterCtrlResumeResSerFree CsrWifiRouterCtrlPfree - -#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiRouterCtrlRawSdioDeinitialiseReqDes CsrWifiEventCsrUint16Des -#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSerFree CsrWifiRouterCtrlPfree - -#define CsrWifiRouterCtrlRawSdioInitialiseReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiRouterCtrlRawSdioInitialiseReqDes CsrWifiEventCsrUint16Des -#define CsrWifiRouterCtrlRawSdioInitialiseReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiRouterCtrlRawSdioInitialiseReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlTclasDelReqSizeof(void *msg); -extern void CsrWifiRouterCtrlTclasDelReqSerFree(void *msg); - -extern u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg); -#define CsrWifiRouterCtrlTrafficClassificationReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg); -#define CsrWifiRouterCtrlTrafficConfigReqSerFree CsrWifiRouterCtrlPfree - -#define CsrWifiRouterCtrlWifiOffReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiRouterCtrlWifiOffReqDes CsrWifiEventCsrUint16Des -#define CsrWifiRouterCtrlWifiOffReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiRouterCtrlWifiOffReqSerFree CsrWifiRouterCtrlPfree - -#define CsrWifiRouterCtrlWifiOffResSer CsrWifiEventCsrUint16Ser -#define CsrWifiRouterCtrlWifiOffResDes CsrWifiEventCsrUint16Des -#define CsrWifiRouterCtrlWifiOffResSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiRouterCtrlWifiOffResSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlWifiOnReqSizeof(void *msg); -extern void CsrWifiRouterCtrlWifiOnReqSerFree(void *msg); - -extern u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlWifiOnResSizeof(void *msg); -extern void CsrWifiRouterCtrlWifiOnResSerFree(void *msg); - -extern u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg); -#define CsrWifiRouterCtrlM4TransmitReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlModeSetReqSizeof(void *msg); -#define CsrWifiRouterCtrlModeSetReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlPeerAddReqSizeof(void *msg); -#define CsrWifiRouterCtrlPeerAddReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlPeerDelReqSizeof(void *msg); -#define CsrWifiRouterCtrlPeerDelReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg); -#define CsrWifiRouterCtrlPeerUpdateReqSerFree CsrWifiRouterCtrlPfree - -#define CsrWifiRouterCtrlCapabilitiesReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiRouterCtrlCapabilitiesReqDes CsrWifiEventCsrUint16Des -#define CsrWifiRouterCtrlCapabilitiesReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiRouterCtrlCapabilitiesReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg); -#define CsrWifiRouterCtrlBlockAckEnableReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg); -#define CsrWifiRouterCtrlBlockAckDisableReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg); -extern void CsrWifiRouterCtrlWapiRxPktReqSerFree(void *msg); - -#define CsrWifiRouterCtrlWapiMulticastFilterReqSer CsrWifiEventCsrUint16CsrUint8Ser -#define CsrWifiRouterCtrlWapiMulticastFilterReqDes CsrWifiEventCsrUint16CsrUint8Des -#define CsrWifiRouterCtrlWapiMulticastFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof -#define CsrWifiRouterCtrlWapiMulticastFilterReqSerFree CsrWifiRouterCtrlPfree - -#define CsrWifiRouterCtrlWapiUnicastFilterReqSer CsrWifiEventCsrUint16CsrUint8Ser -#define CsrWifiRouterCtrlWapiUnicastFilterReqDes CsrWifiEventCsrUint16CsrUint8Des -#define CsrWifiRouterCtrlWapiUnicastFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof -#define CsrWifiRouterCtrlWapiUnicastFilterReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg); -extern void CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree(void *msg); - -#define CsrWifiRouterCtrlWapiFilterReqSer CsrWifiEventCsrUint16CsrUint8Ser -#define CsrWifiRouterCtrlWapiFilterReqDes CsrWifiEventCsrUint16CsrUint8Des -#define CsrWifiRouterCtrlWapiFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof -#define CsrWifiRouterCtrlWapiFilterReqSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlHipIndSizeof(void *msg); -extern void CsrWifiRouterCtrlHipIndSerFree(void *msg); - -extern u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg); -extern void CsrWifiRouterCtrlMulticastAddressIndSerFree(void *msg); - -extern u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg); -#define CsrWifiRouterCtrlPortConfigureCfmSerFree CsrWifiRouterCtrlPfree - -#define CsrWifiRouterCtrlResumeIndSer CsrWifiEventCsrUint16CsrUint8Ser -#define CsrWifiRouterCtrlResumeIndDes CsrWifiEventCsrUint16CsrUint8Des -#define CsrWifiRouterCtrlResumeIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof -#define CsrWifiRouterCtrlResumeIndSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlSuspendIndSizeof(void *msg); -#define CsrWifiRouterCtrlSuspendIndSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg); -#define CsrWifiRouterCtrlTclasAddCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg); -#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg); -#define CsrWifiRouterCtrlRawSdioInitialiseCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg); -#define CsrWifiRouterCtrlTclasDelCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg); -#define CsrWifiRouterCtrlTrafficProtocolIndSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg); -#define CsrWifiRouterCtrlTrafficSampleIndSerFree CsrWifiRouterCtrlPfree - -#define CsrWifiRouterCtrlWifiOffIndSer CsrWifiEventCsrUint16CsrUint8Ser -#define CsrWifiRouterCtrlWifiOffIndDes CsrWifiEventCsrUint16CsrUint8Des -#define CsrWifiRouterCtrlWifiOffIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof -#define CsrWifiRouterCtrlWifiOffIndSerFree CsrWifiRouterCtrlPfree - -#define CsrWifiRouterCtrlWifiOffCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiRouterCtrlWifiOffCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiRouterCtrlWifiOffCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiRouterCtrlWifiOffCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlWifiOnIndSizeof(void *msg); -extern void CsrWifiRouterCtrlWifiOnIndSerFree(void *msg); - -extern u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg); -#define CsrWifiRouterCtrlWifiOnCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg); -#define CsrWifiRouterCtrlM4ReadyToSendIndSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg); -#define CsrWifiRouterCtrlM4TransmittedIndSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlMicFailureIndSizeof(void *msg); -#define CsrWifiRouterCtrlMicFailureIndSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlConnectedIndSizeof(void *msg); -#define CsrWifiRouterCtrlConnectedIndSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg); -#define CsrWifiRouterCtrlPeerAddCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg); -#define CsrWifiRouterCtrlPeerDelCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg); -#define CsrWifiRouterCtrlUnexpectedFrameIndSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg); -#define CsrWifiRouterCtrlPeerUpdateCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg); -#define CsrWifiRouterCtrlCapabilitiesCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg); -#define CsrWifiRouterCtrlBlockAckEnableCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg); -#define CsrWifiRouterCtrlBlockAckDisableCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg); -#define CsrWifiRouterCtrlBlockAckErrorIndSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg); -#define CsrWifiRouterCtrlStaInactiveIndSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg); -extern void CsrWifiRouterCtrlWapiRxMicCheckIndSerFree(void *msg); - -extern u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlModeSetCfmSizeof(void *msg); -#define CsrWifiRouterCtrlModeSetCfmSerFree CsrWifiRouterCtrlPfree - -extern u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg); -extern void CsrWifiRouterCtrlWapiUnicastTxEncryptIndSerFree(void *msg); - -#endif /* CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c deleted file mode 100644 index c4badc565a91..000000000000 --- a/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c +++ /dev/null @@ -1,53 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ -#include <linux/slab.h> -#include "csr_wifi_router_prim.h" -#include "csr_wifi_router_lib.h" - -/*----------------------------------------------------------------------------* - * NAME - * CsrWifiRouterFreeDownstreamMessageContents - * - * DESCRIPTION - * - * - * PARAMETERS - * eventClass: only the value CSR_WIFI_ROUTER_PRIM will be handled - * message: the message to free - *----------------------------------------------------------------------------*/ -void CsrWifiRouterFreeDownstreamMessageContents(u16 eventClass, void *message) -{ - if (eventClass != CSR_WIFI_ROUTER_PRIM) - { - return; - } - if (NULL == message) - { - return; - } - - switch (*((CsrWifiRouterPrim *) message)) - { - case CSR_WIFI_ROUTER_MA_PACKET_REQ: - { - CsrWifiRouterMaPacketReq *p = (CsrWifiRouterMaPacketReq *)message; - kfree(p->frame); - p->frame = NULL; - break; - } - - default: - break; - } -} - - diff --git a/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c deleted file mode 100644 index 4cd126338e27..000000000000 --- a/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c +++ /dev/null @@ -1,47 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ -#include <linux/slab.h> -#include "csr_wifi_router_prim.h" -#include "csr_wifi_router_lib.h" - -/*----------------------------------------------------------------------------* - * NAME - * CsrWifiRouterFreeUpstreamMessageContents - * - * DESCRIPTION - * - * - * PARAMETERS - * eventClass: only the value CSR_WIFI_ROUTER_PRIM will be handled - * message: the message to free - *----------------------------------------------------------------------------*/ -void CsrWifiRouterFreeUpstreamMessageContents(u16 eventClass, void *message) -{ - if (eventClass != CSR_WIFI_ROUTER_PRIM) - return; - if (NULL == message) - return; - switch (*((CsrWifiRouterPrim *) message)) { - case CSR_WIFI_ROUTER_MA_PACKET_IND: - { - CsrWifiRouterMaPacketInd *p = - (CsrWifiRouterMaPacketInd *) message; - kfree(p->frame); - p->frame = NULL; - break; - } - default: - break; - } -} - - diff --git a/drivers/staging/csr/csr_wifi_router_lib.h b/drivers/staging/csr/csr_wifi_router_lib.h deleted file mode 100644 index b0477c413aae..000000000000 --- a/drivers/staging/csr/csr_wifi_router_lib.h +++ /dev/null @@ -1,417 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_ROUTER_LIB_H__ -#define CSR_WIFI_ROUTER_LIB_H__ - -#include "csr_sched.h" -#include "csr_macro.h" -#include "csr_msg_transport.h" - -#include "csr_wifi_lib.h" - -#include "csr_wifi_router_prim.h" -#include "csr_wifi_router_task.h" - -/*----------------------------------------------------------------------------* - * CsrWifiRouterFreeUpstreamMessageContents - * - * DESCRIPTION - * Free the allocated memory in a CSR_WIFI_ROUTER upstream message. Does not - * free the message itself, and can only be used for upstream messages. - * - * PARAMETERS - * Deallocates the resources in a CSR_WIFI_ROUTER upstream message - *----------------------------------------------------------------------------*/ -void CsrWifiRouterFreeUpstreamMessageContents(u16 eventClass, void *message); - -/*----------------------------------------------------------------------------* - * CsrWifiRouterFreeDownstreamMessageContents - * - * DESCRIPTION - * Free the allocated memory in a CSR_WIFI_ROUTER downstream message. Does not - * free the message itself, and can only be used for downstream messages. - * - * PARAMETERS - * Deallocates the resources in a CSR_WIFI_ROUTER downstream message - *----------------------------------------------------------------------------*/ -void CsrWifiRouterFreeDownstreamMessageContents(u16 eventClass, void *message); - -/*----------------------------------------------------------------------------* - * Enum to string functions - *----------------------------------------------------------------------------*/ -const char* CsrWifiRouterAppTypeToString(CsrWifiRouterAppType value); -const char* CsrWifiRouterEncapsulationToString(CsrWifiRouterEncapsulation value); -const char* CsrWifiRouterOuiToString(CsrWifiRouterOui value); -const char* CsrWifiRouterPriorityToString(CsrWifiRouterPriority value); - - -/*----------------------------------------------------------------------------* - * CsrPrim Type toString function. - * Converts a message type to the String name of the Message - *----------------------------------------------------------------------------*/ -const char* CsrWifiRouterPrimTypeToString(CsrPrim msgType); - -/*----------------------------------------------------------------------------* - * Lookup arrays for PrimType name Strings - *----------------------------------------------------------------------------*/ -extern const char *CsrWifiRouterUpstreamPrimNames[CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT]; -extern const char *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT]; - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketCancelReqSend - - DESCRIPTION - This primitive is used to request cancellation of a previously send - CsrWifiRouterMaPacketReq. - The frame may already have been transmitted so there is no guarantees - that the CsrWifiRouterMaPacketCancelReq actually cancels the transmission - of the frame in question. - If the cancellation fails, the Router will send, if required, - CsrWifiRouterMaPacketCfm. - If the cancellation succeeds, the Router will not send - CsrWifiRouterMaPacketCfm. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - hostTag - The hostTag for the frame, which should be cancelled. - priority - Priority of the frame, which should be cancelled - peerMacAddress - Destination MAC address of the frame, which should be - cancelled - -*******************************************************************************/ -#define CsrWifiRouterMaPacketCancelReqCreate(msg__, dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketCancelReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->hostTag = (hostTag__); \ - msg__->priority = (priority__); \ - msg__->peerMacAddress = (peerMacAddress__); - -#define CsrWifiRouterMaPacketCancelReqSendTo(dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \ - { \ - CsrWifiRouterMaPacketCancelReq *msg__; \ - CsrWifiRouterMaPacketCancelReqCreate(msg__, dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ - } - -#define CsrWifiRouterMaPacketCancelReqSend(src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \ - CsrWifiRouterMaPacketCancelReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketReqSend - - DESCRIPTION - A task sends this primitive to transmit a frame. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - subscriptionHandle - The handle of the subscription - frameLength - Length of the frame to be sent in bytes - frame - Pointer to the frame to be sent - freeFunction - Pointer to function to be used to free the frame - priority - Priority of the frame, which should be sent - hostTag - An application shall set the bits b31..b28 using one of - the CSR_WIFI_ROUTER_APP_TYPE_* masks. Bits b0..b27 can - be used by the requestor without any restrictions, but - the hostTag shall be unique so the hostTag for - CSR_WIFI_ROUTER_APP _TYPE_OTHER should be constructured - in the following way [ CSR_WIFI_ROUTER_APP_TYPE_OTHER - (4 bits) | SubscriptionHandle (8 bits) | Sequence no. - (20 bits) ]. If the hostTag is not unique, the - behaviour of the system is unpredicatable with respect - to data/management frame transfer. - cfmRequested - Indicates if the requestor needs a confirm for packet - requests sent under this subscription. If set to TRUE, - the router will send a confirm, else it will not send - any confirm - -*******************************************************************************/ -#define CsrWifiRouterMaPacketReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->subscriptionHandle = (subscriptionHandle__); \ - msg__->frameLength = (frameLength__); \ - msg__->frame = (frame__); \ - msg__->freeFunction = (freeFunction__); \ - msg__->priority = (priority__); \ - msg__->hostTag = (hostTag__); \ - msg__->cfmRequested = (cfmRequested__); - -#define CsrWifiRouterMaPacketReqSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \ - { \ - CsrWifiRouterMaPacketReq *msg__; \ - CsrWifiRouterMaPacketReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ - } - -#define CsrWifiRouterMaPacketReqSend(src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \ - CsrWifiRouterMaPacketReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketIndSend - - DESCRIPTION - The router sends the primitive to a subscribed task when it receives a - frame matching the subscription. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - subscriptionHandle - The handle of the subscription - result - Status of the operation - frameLength - Length of the received frame in bytes - frame - Pointer to the received frame - freeFunction - Pointer to function to be used to free the frame - rssi - Received signal strength indication in dBm - snr - Signal to Noise Ratio - rate - Transmission/Reception rate - -*******************************************************************************/ -#define CsrWifiRouterMaPacketIndCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->subscriptionHandle = (subscriptionHandle__); \ - msg__->result = (result__); \ - msg__->frameLength = (frameLength__); \ - msg__->frame = (frame__); \ - msg__->freeFunction = (freeFunction__); \ - msg__->rssi = (rssi__); \ - msg__->snr = (snr__); \ - msg__->rate = (rate__); - -#define CsrWifiRouterMaPacketIndSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \ - { \ - CsrWifiRouterMaPacketInd *msg__; \ - CsrWifiRouterMaPacketIndCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ - } - -#define CsrWifiRouterMaPacketIndSend(dst__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \ - CsrWifiRouterMaPacketIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketResSend - - DESCRIPTION - A task send this primitive to confirm the reception of the received - frame. - - PARAMETERS - interfaceTag - Interface Identifier; unique identifier of an interface - subscriptionHandle - The handle of the subscription - result - Status of the operation - -*******************************************************************************/ -#define CsrWifiRouterMaPacketResCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketRes), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_RES, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->subscriptionHandle = (subscriptionHandle__); \ - msg__->result = (result__); - -#define CsrWifiRouterMaPacketResSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, result__) \ - { \ - CsrWifiRouterMaPacketRes *msg__; \ - CsrWifiRouterMaPacketResCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ - } - -#define CsrWifiRouterMaPacketResSend(src__, interfaceTag__, subscriptionHandle__, result__) \ - CsrWifiRouterMaPacketResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, subscriptionHandle__, result__) - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketCfmSend - - DESCRIPTION - The router sends the primitive to confirm the result of the transmission - of the packet of the corresponding CSR_WIFI_ROUTER MA_PACKET_REQ request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - result - Status of the operation - hostTag - The hostTrag will match the hostTag sent in the request. - rate - Transmission/Reception rate - -*******************************************************************************/ -#define CsrWifiRouterMaPacketCfmCreate(msg__, dst__, src__, interfaceTag__, result__, hostTag__, rate__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->result = (result__); \ - msg__->hostTag = (hostTag__); \ - msg__->rate = (rate__); - -#define CsrWifiRouterMaPacketCfmSendTo(dst__, src__, interfaceTag__, result__, hostTag__, rate__) \ - { \ - CsrWifiRouterMaPacketCfm *msg__; \ - CsrWifiRouterMaPacketCfmCreate(msg__, dst__, src__, interfaceTag__, result__, hostTag__, rate__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ - } - -#define CsrWifiRouterMaPacketCfmSend(dst__, interfaceTag__, result__, hostTag__, rate__) \ - CsrWifiRouterMaPacketCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, result__, hostTag__, rate__) - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketSubscribeReqSend - - DESCRIPTION - A task can use this primitive to subscribe for a particular OUI/protocol - and transmit and receive frames matching the subscription. - NOTE: Multiple subscriptions for a given protocol and OUI will result in - the first subscription receiving the data and not the subsequent - subscriptions. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - encapsulation - Specifies the encapsulation type, which will be used for the - subscription - protocol - Together with the OUI, specifies the protocol, which a task - wants to subscribe to - oui - Specifies the OUI for the protocol, which a task wants to - subscribe to - -*******************************************************************************/ -#define CsrWifiRouterMaPacketSubscribeReqCreate(msg__, dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->encapsulation = (encapsulation__); \ - msg__->protocol = (protocol__); \ - msg__->oui = (oui__); - -#define CsrWifiRouterMaPacketSubscribeReqSendTo(dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__) \ - { \ - CsrWifiRouterMaPacketSubscribeReq *msg__; \ - CsrWifiRouterMaPacketSubscribeReqCreate(msg__, dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ - } - -#define CsrWifiRouterMaPacketSubscribeReqSend(src__, interfaceTag__, encapsulation__, protocol__, oui__) \ - CsrWifiRouterMaPacketSubscribeReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, encapsulation__, protocol__, oui__) - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketSubscribeCfmSend - - DESCRIPTION - The router sends this primitive to confirm the result of the - subscription. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - subscriptionHandle - Handle to the subscription - This handle must be used in all subsequent requests - status - Status of the operation - allocOffset - Size of the offset for the frames of the subscription - -*******************************************************************************/ -#define CsrWifiRouterMaPacketSubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->subscriptionHandle = (subscriptionHandle__); \ - msg__->status = (status__); \ - msg__->allocOffset = (allocOffset__); - -#define CsrWifiRouterMaPacketSubscribeCfmSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \ - { \ - CsrWifiRouterMaPacketSubscribeCfm *msg__; \ - CsrWifiRouterMaPacketSubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ - } - -#define CsrWifiRouterMaPacketSubscribeCfmSend(dst__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \ - CsrWifiRouterMaPacketSubscribeCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, subscriptionHandle__, status__, allocOffset__) - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketUnsubscribeReqSend - - DESCRIPTION - A task sends this primitive to unsubscribe a subscription - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - subscriptionHandle - The handle of the subscription - -*******************************************************************************/ -#define CsrWifiRouterMaPacketUnsubscribeReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketUnsubscribeReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->subscriptionHandle = (subscriptionHandle__); - -#define CsrWifiRouterMaPacketUnsubscribeReqSendTo(dst__, src__, interfaceTag__, subscriptionHandle__) \ - { \ - CsrWifiRouterMaPacketUnsubscribeReq *msg__; \ - CsrWifiRouterMaPacketUnsubscribeReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__); \ - CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ - } - -#define CsrWifiRouterMaPacketUnsubscribeReqSend(src__, interfaceTag__, subscriptionHandle__) \ - CsrWifiRouterMaPacketUnsubscribeReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, subscriptionHandle__) - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketUnsubscribeCfmSend - - DESCRIPTION - The router sends this primitive to confirm the result of the - unsubscription. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Status of the operation - -*******************************************************************************/ -#define CsrWifiRouterMaPacketUnsubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiRouterMaPacketUnsubscribeCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiRouterMaPacketUnsubscribeCfm *msg__; \ - CsrWifiRouterMaPacketUnsubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \ - } - -#define CsrWifiRouterMaPacketUnsubscribeCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiRouterMaPacketUnsubscribeCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, status__) - -#endif /* CSR_WIFI_ROUTER_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_router_prim.h b/drivers/staging/csr/csr_wifi_router_prim.h deleted file mode 100644 index c52344b51f2f..000000000000 --- a/drivers/staging/csr/csr_wifi_router_prim.h +++ /dev/null @@ -1,421 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_ROUTER_PRIM_H__ -#define CSR_WIFI_ROUTER_PRIM_H__ - -#include <linux/types.h> -#include "csr_prim_defs.h" -#include "csr_sched.h" -#include "csr_wifi_common.h" -#include "csr_result.h" -#include "csr_wifi_fsm_event.h" - -#define CSR_WIFI_ROUTER_PRIM (0x0400) - -typedef CsrPrim CsrWifiRouterPrim; - -typedef void (*CsrWifiRouterFrameFreeFunction)(void *frame); - -/******************************************************************************* - - NAME - CsrWifiRouterAppType - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_APP_TYPE_SME - - CSR_WIFI_ROUTER_APP_TYPE_PAL - - CSR_WIFI_ROUTER_APP_TYPE_NME - - CSR_WIFI_ROUTER_APP_TYPE_OTHER - - -*******************************************************************************/ -typedef u8 CsrWifiRouterAppType; -#define CSR_WIFI_ROUTER_APP_TYPE_SME ((CsrWifiRouterAppType) 0x0) -#define CSR_WIFI_ROUTER_APP_TYPE_PAL ((CsrWifiRouterAppType) 0x1) -#define CSR_WIFI_ROUTER_APP_TYPE_NME ((CsrWifiRouterAppType) 0x2) -#define CSR_WIFI_ROUTER_APP_TYPE_OTHER ((CsrWifiRouterAppType) 0x3) - -/******************************************************************************* - - NAME - CsrWifiRouterEncapsulation - - DESCRIPTION - Indicates the type of encapsulation used for the subscription - - VALUES - CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET - - Ethernet encapsulation - CSR_WIFI_ROUTER_ENCAPSULATION_LLC_SNAP - - LLC/SNAP encapsulation - -*******************************************************************************/ -typedef u8 CsrWifiRouterEncapsulation; -#define CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET ((CsrWifiRouterEncapsulation) 0x00) -#define CSR_WIFI_ROUTER_ENCAPSULATION_LLC_SNAP ((CsrWifiRouterEncapsulation) 0x01) - -/******************************************************************************* - - NAME - CsrWifiRouterOui - - DESCRIPTION - - VALUES - CSR_WIFI_ROUTER_OUI_RFC_1042 - - CSR_WIFI_ROUTER_OUI_BT - - -*******************************************************************************/ -typedef u32 CsrWifiRouterOui; -#define CSR_WIFI_ROUTER_OUI_RFC_1042 ((CsrWifiRouterOui) 0x000000) -#define CSR_WIFI_ROUTER_OUI_BT ((CsrWifiRouterOui) 0x001958) - -/******************************************************************************* - - NAME - CsrWifiRouterPriority - - DESCRIPTION - As defined in the IEEE 802.11 standards - - VALUES - CSR_WIFI_ROUTER_PRIORITY_QOS_UP0 - - See IEEE 802.11 Standard - CSR_WIFI_ROUTER_PRIORITY_QOS_UP1 - - See IEEE 802.11 Standard - CSR_WIFI_ROUTER_PRIORITY_QOS_UP2 - - See IEEE 802.11 Standard - CSR_WIFI_ROUTER_PRIORITY_QOS_UP3 - - See IEEE 802.11 Standard - CSR_WIFI_ROUTER_PRIORITY_QOS_UP4 - - See IEEE 802.11 Standard - CSR_WIFI_ROUTER_PRIORITY_QOS_UP5 - - See IEEE 802.11 Standard - CSR_WIFI_ROUTER_PRIORITY_QOS_UP6 - - See IEEE 802.11 Standard - CSR_WIFI_ROUTER_PRIORITY_QOS_UP7 - - See IEEE 802.11 Standard - CSR_WIFI_ROUTER_PRIORITY_CONTENTION - - See IEEE 802.11 Standard - CSR_WIFI_ROUTER_PRIORITY_MANAGEMENT - - See IEEE 802.11 Standard - -*******************************************************************************/ -typedef u16 CsrWifiRouterPriority; -#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP0 ((CsrWifiRouterPriority) 0x0000) -#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP1 ((CsrWifiRouterPriority) 0x0001) -#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP2 ((CsrWifiRouterPriority) 0x0002) -#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP3 ((CsrWifiRouterPriority) 0x0003) -#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP4 ((CsrWifiRouterPriority) 0x0004) -#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP5 ((CsrWifiRouterPriority) 0x0005) -#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP6 ((CsrWifiRouterPriority) 0x0006) -#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP7 ((CsrWifiRouterPriority) 0x0007) -#define CSR_WIFI_ROUTER_PRIORITY_CONTENTION ((CsrWifiRouterPriority) 0x8000) -#define CSR_WIFI_ROUTER_PRIORITY_MANAGEMENT ((CsrWifiRouterPriority) 0x8010) - - -/* Downstream */ -#define CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST (0x0000) - -#define CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ ((CsrWifiRouterPrim) (0x0000 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ ((CsrWifiRouterPrim) (0x0001 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_MA_PACKET_REQ ((CsrWifiRouterPrim) (0x0002 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_MA_PACKET_RES ((CsrWifiRouterPrim) (0x0003 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ ((CsrWifiRouterPrim) (0x0004 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)) - - -#define CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_HIGHEST (0x0004 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST) - -/* Upstream */ -#define CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) - -#define CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM ((CsrWifiRouterPrim)(0x0000 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM ((CsrWifiRouterPrim)(0x0001 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_MA_PACKET_CFM ((CsrWifiRouterPrim)(0x0002 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_ROUTER_MA_PACKET_IND ((CsrWifiRouterPrim)(0x0003 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST)) - -#define CSR_WIFI_ROUTER_PRIM_UPSTREAM_HIGHEST (0x0003 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST) - -#define CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST) -#define CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT (CSR_WIFI_ROUTER_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST) - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketSubscribeReq - - DESCRIPTION - A task can use this primitive to subscribe for a particular OUI/protocol - and transmit and receive frames matching the subscription. - NOTE: Multiple subscriptions for a given protocol and OUI will result in - the first subscription receiving the data and not the subsequent - subscriptions. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - encapsulation - Specifies the encapsulation type, which will be used for the - subscription - protocol - Together with the OUI, specifies the protocol, which a task - wants to subscribe to - oui - Specifies the OUI for the protocol, which a task wants to - subscribe to - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiRouterEncapsulation encapsulation; - u16 protocol; - u32 oui; -} CsrWifiRouterMaPacketSubscribeReq; - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketUnsubscribeReq - - DESCRIPTION - A task sends this primitive to unsubscribe a subscription - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - subscriptionHandle - The handle of the subscription - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 subscriptionHandle; -} CsrWifiRouterMaPacketUnsubscribeReq; - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketReq - - DESCRIPTION - A task sends this primitive to transmit a frame. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - subscriptionHandle - The handle of the subscription - frameLength - Length of the frame to be sent in bytes - frame - Pointer to the frame to be sent - freeFunction - Pointer to function to be used to free the frame - priority - Priority of the frame, which should be sent - hostTag - An application shall set the bits b31..b28 using one of - the CSR_WIFI_ROUTER_APP_TYPE_* masks. Bits b0..b27 can - be used by the requestor without any restrictions, but - the hostTag shall be unique so the hostTag for - CSR_WIFI_ROUTER_APP _TYPE_OTHER should be constructured - in the following way [ CSR_WIFI_ROUTER_APP_TYPE_OTHER - (4 bits) | SubscriptionHandle (8 bits) | Sequence no. - (20 bits) ]. If the hostTag is not unique, the - behaviour of the system is unpredicatable with respect - to data/management frame transfer. - cfmRequested - Indicates if the requestor needs a confirm for packet - requests sent under this subscription. If set to TRUE, - the router will send a confirm, else it will not send - any confirm - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 subscriptionHandle; - u16 frameLength; - u8 *frame; - CsrWifiRouterFrameFreeFunction freeFunction; - CsrWifiRouterPriority priority; - u32 hostTag; - u8 cfmRequested; -} CsrWifiRouterMaPacketReq; - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketRes - - DESCRIPTION - A task send this primitive to confirm the reception of the received - frame. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - subscriptionHandle - The handle of the subscription - result - Status of the operation - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 subscriptionHandle; - CsrResult result; -} CsrWifiRouterMaPacketRes; - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketCancelReq - - DESCRIPTION - This primitive is used to request cancellation of a previously send - CsrWifiRouterMaPacketReq. - The frame may already have been transmitted so there is no guarantees - that the CsrWifiRouterMaPacketCancelReq actually cancels the transmission - of the frame in question. - If the cancellation fails, the Router will send, if required, - CsrWifiRouterMaPacketCfm. - If the cancellation succeeds, the Router will not send - CsrWifiRouterMaPacketCfm. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - hostTag - The hostTag for the frame, which should be cancelled. - priority - Priority of the frame, which should be cancelled - peerMacAddress - Destination MAC address of the frame, which should be - cancelled - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u32 hostTag; - CsrWifiRouterPriority priority; - CsrWifiMacAddress peerMacAddress; -} CsrWifiRouterMaPacketCancelReq; - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketSubscribeCfm - - DESCRIPTION - The router sends this primitive to confirm the result of the - subscription. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - subscriptionHandle - Handle to the subscription - This handle must be used in all subsequent requests - status - Status of the operation - allocOffset - Size of the offset for the frames of the subscription - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 subscriptionHandle; - CsrResult status; - u16 allocOffset; -} CsrWifiRouterMaPacketSubscribeCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketUnsubscribeCfm - - DESCRIPTION - The router sends this primitive to confirm the result of the - unsubscription. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Status of the operation - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiRouterMaPacketUnsubscribeCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketCfm - - DESCRIPTION - The router sends the primitive to confirm the result of the transmission - of the packet of the corresponding CSR_WIFI_ROUTER MA_PACKET_REQ request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - result - Status of the operation - hostTag - The hostTrag will match the hostTag sent in the request. - rate - Transmission/Reception rate - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult result; - u32 hostTag; - u16 rate; -} CsrWifiRouterMaPacketCfm; - -/******************************************************************************* - - NAME - CsrWifiRouterMaPacketInd - - DESCRIPTION - The router sends the primitive to a subscribed task when it receives a - frame matching the subscription. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - subscriptionHandle - The handle of the subscription - result - Status of the operation - frameLength - Length of the received frame in bytes - frame - Pointer to the received frame - freeFunction - Pointer to function to be used to free the frame - rssi - Received signal strength indication in dBm - snr - Signal to Noise Ratio - rate - Transmission/Reception rate - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 subscriptionHandle; - CsrResult result; - u16 frameLength; - u8 *frame; - CsrWifiRouterFrameFreeFunction freeFunction; - s16 rssi; - s16 snr; - u16 rate; -} CsrWifiRouterMaPacketInd; - -#endif /* CSR_WIFI_ROUTER_PRIM_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_router_sef.c b/drivers/staging/csr/csr_wifi_router_sef.c deleted file mode 100644 index 45a10fb77296..000000000000 --- a/drivers/staging/csr/csr_wifi_router_sef.c +++ /dev/null @@ -1,19 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - Confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - - *****************************************************************************/ -#include "csr_wifi_router_sef.h" - -const CsrWifiRouterStateHandlerType CsrWifiRouterDownstreamStateHandlers[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT] = -{ - /* 0x0000 */ CsrWifiRouterMaPacketSubscribeReqHandler, - /* 0x0001 */ CsrWifiRouterMaPacketUnsubscribeReqHandler, - /* 0x0002 */ CsrWifiRouterMaPacketReqHandler, - /* 0x0003 */ CsrWifiRouterMaPacketResHandler, - /* 0x0004 */ CsrWifiRouterMaPacketCancelReqHandler, -}; diff --git a/drivers/staging/csr/csr_wifi_router_sef.h b/drivers/staging/csr/csr_wifi_router_sef.h deleted file mode 100644 index 86692c7780c9..000000000000 --- a/drivers/staging/csr/csr_wifi_router_sef.h +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - Confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - - *****************************************************************************/ -#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__ -#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__ - -#include "csr_wifi_router_prim.h" - - typedef void (*CsrWifiRouterStateHandlerType)(void* drvpriv, CsrWifiFsmEvent* msg); - - extern const CsrWifiRouterStateHandlerType CsrWifiRouterDownstreamStateHandlers[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT]; - - extern void CsrWifiRouterMaPacketSubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterMaPacketUnsubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterMaPacketResHandler(void* drvpriv, CsrWifiFsmEvent* msg); - extern void CsrWifiRouterMaPacketCancelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg); - -#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__ */ diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c deleted file mode 100644 index 4eccf5d6c289..000000000000 --- a/drivers/staging/csr/csr_wifi_router_serialize.c +++ /dev/null @@ -1,418 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ -#include <linux/slab.h> -#include "csr_msgconv.h" -#include "csr_wifi_router_prim.h" -#include "csr_wifi_router_serialize.h" - -void CsrWifiRouterPfree(void *ptr) -{ - kfree(ptr); -} - - -size_t CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiRouterEncapsulation primitive->encapsulation */ - bufferSize += 2; /* u16 primitive->protocol */ - bufferSize += 4; /* u32 primitive->oui */ - return bufferSize; -} - - -u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->encapsulation); - CsrUint16Ser(ptr, len, (u16) primitive->protocol); - CsrUint32Ser(ptr, len, (u32) primitive->oui); - return(ptr); -} - - -void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterMaPacketSubscribeReq *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->encapsulation, buffer, &offset); - CsrUint16Des((u16 *) &primitive->protocol, buffer, &offset); - CsrUint32Des((u32 *) &primitive->oui, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterMaPacketReqSizeof(void *msg) -{ - CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 20) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* u8 primitive->subscriptionHandle */ - bufferSize += 2; /* u16 primitive->frameLength */ - bufferSize += primitive->frameLength; /* u8 primitive->frame */ - bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */ - bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */ - bufferSize += 4; /* u32 primitive->hostTag */ - bufferSize += 1; /* u8 primitive->cfmRequested */ - return bufferSize; -} - - -u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle); - CsrUint16Ser(ptr, len, (u16) primitive->frameLength); - if (primitive->frameLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((u16) (primitive->frameLength))); - } - CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */ - CsrUint16Ser(ptr, len, (u16) primitive->priority); - CsrUint32Ser(ptr, len, (u32) primitive->hostTag); - CsrUint8Ser(ptr, len, (u8) primitive->cfmRequested); - return(ptr); -} - - -void* CsrWifiRouterMaPacketReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterMaPacketReq *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset); - CsrUint16Des((u16 *) &primitive->frameLength, buffer, &offset); - if (primitive->frameLength) - { - primitive->frame = kmalloc(primitive->frameLength, GFP_KERNEL); - CsrMemCpyDes(primitive->frame, buffer, &offset, ((u16) (primitive->frameLength))); - } - else - { - primitive->frame = NULL; - } - primitive->freeFunction = NULL; /* Special for Function Pointers... */ - offset += 4; - CsrUint16Des((u16 *) &primitive->priority, buffer, &offset); - CsrUint32Des((u32 *) &primitive->hostTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->cfmRequested, buffer, &offset); - - return primitive; -} - - -void CsrWifiRouterMaPacketReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) voidPrimitivePointer; - kfree(primitive->frame); - kfree(primitive); -} - - -size_t CsrWifiRouterMaPacketResSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* u8 primitive->subscriptionHandle */ - bufferSize += 2; /* CsrResult primitive->result */ - return bufferSize; -} - - -u8* CsrWifiRouterMaPacketResSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle); - CsrUint16Ser(ptr, len, (u16) primitive->result); - return(ptr); -} - - -void* CsrWifiRouterMaPacketResDes(u8 *buffer, size_t length) -{ - CsrWifiRouterMaPacketRes *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketRes), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset); - CsrUint16Des((u16 *) &primitive->result, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterMaPacketCancelReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 4; /* u32 primitive->hostTag */ - bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */ - bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - return bufferSize; -} - - -u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint32Ser(ptr, len, (u32) primitive->hostTag); - CsrUint16Ser(ptr, len, (u16) primitive->priority); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); - return(ptr); -} - - -void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, size_t length) -{ - CsrWifiRouterMaPacketCancelReq *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketCancelReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint32Des((u32 *) &primitive->hostTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->priority, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); - - return primitive; -} - - -size_t CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* u8 primitive->subscriptionHandle */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* u16 primitive->allocOffset */ - return bufferSize; -} - - -u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint16Ser(ptr, len, (u16) primitive->allocOffset); - return(ptr); -} - - -void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterMaPacketSubscribeCfm *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint16Des((u16 *) &primitive->allocOffset, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterMaPacketUnsubscribeCfm *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterMaPacketCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->result */ - bufferSize += 4; /* u32 primitive->hostTag */ - bufferSize += 2; /* u16 primitive->rate */ - return bufferSize; -} - - -u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->result); - CsrUint32Ser(ptr, len, (u32) primitive->hostTag); - CsrUint16Ser(ptr, len, (u16) primitive->rate); - return(ptr); -} - - -void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, size_t length) -{ - CsrWifiRouterMaPacketCfm *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->result, buffer, &offset); - CsrUint32Des((u32 *) &primitive->hostTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->rate, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiRouterMaPacketIndSizeof(void *msg) -{ - CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* u8 primitive->subscriptionHandle */ - bufferSize += 2; /* CsrResult primitive->result */ - bufferSize += 2; /* u16 primitive->frameLength */ - bufferSize += primitive->frameLength; /* u8 primitive->frame */ - bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */ - bufferSize += 2; /* s16 primitive->rssi */ - bufferSize += 2; /* s16 primitive->snr */ - bufferSize += 2; /* u16 primitive->rate */ - return bufferSize; -} - - -u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle); - CsrUint16Ser(ptr, len, (u16) primitive->result); - CsrUint16Ser(ptr, len, (u16) primitive->frameLength); - if (primitive->frameLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((u16) (primitive->frameLength))); - } - CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */ - CsrUint16Ser(ptr, len, (u16) primitive->rssi); - CsrUint16Ser(ptr, len, (u16) primitive->snr); - CsrUint16Ser(ptr, len, (u16) primitive->rate); - return(ptr); -} - - -void* CsrWifiRouterMaPacketIndDes(u8 *buffer, size_t length) -{ - CsrWifiRouterMaPacketInd *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset); - CsrUint16Des((u16 *) &primitive->result, buffer, &offset); - CsrUint16Des((u16 *) &primitive->frameLength, buffer, &offset); - if (primitive->frameLength) - { - primitive->frame = kmalloc(primitive->frameLength, GFP_KERNEL); - CsrMemCpyDes(primitive->frame, buffer, &offset, ((u16) (primitive->frameLength))); - } - else - { - primitive->frame = NULL; - } - primitive->freeFunction = NULL; /* Special for Function Pointers... */ - offset += 4; - CsrUint16Des((u16 *) &primitive->rssi, buffer, &offset); - CsrUint16Des((u16 *) &primitive->snr, buffer, &offset); - CsrUint16Des((u16 *) &primitive->rate, buffer, &offset); - - return primitive; -} - - -void CsrWifiRouterMaPacketIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) voidPrimitivePointer; - kfree(primitive->frame); - kfree(primitive); -} - - diff --git a/drivers/staging/csr/csr_wifi_router_serialize.h b/drivers/staging/csr/csr_wifi_router_serialize.h deleted file mode 100644 index 94ccdac5606f..000000000000 --- a/drivers/staging/csr/csr_wifi_router_serialize.h +++ /dev/null @@ -1,67 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_ROUTER_SERIALIZE_H__ -#define CSR_WIFI_ROUTER_SERIALIZE_H__ - -#include "csr_wifi_msgconv.h" -#include "csr_wifi_router_prim.h" - -extern void CsrWifiRouterPfree(void *ptr); - -extern u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg); -#define CsrWifiRouterMaPacketSubscribeReqSerFree CsrWifiRouterPfree - -#define CsrWifiRouterMaPacketUnsubscribeReqSer CsrWifiEventCsrUint16CsrUint8Ser -#define CsrWifiRouterMaPacketUnsubscribeReqDes CsrWifiEventCsrUint16CsrUint8Des -#define CsrWifiRouterMaPacketUnsubscribeReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof -#define CsrWifiRouterMaPacketUnsubscribeReqSerFree CsrWifiRouterPfree - -extern u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterMaPacketReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterMaPacketReqSizeof(void *msg); -extern void CsrWifiRouterMaPacketReqSerFree(void *msg); - -extern u8* CsrWifiRouterMaPacketResSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterMaPacketResDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterMaPacketResSizeof(void *msg); -#define CsrWifiRouterMaPacketResSerFree CsrWifiRouterPfree - -extern u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterMaPacketCancelReqSizeof(void *msg); -#define CsrWifiRouterMaPacketCancelReqSerFree CsrWifiRouterPfree - -extern u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg); -#define CsrWifiRouterMaPacketSubscribeCfmSerFree CsrWifiRouterPfree - -extern u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg); -#define CsrWifiRouterMaPacketUnsubscribeCfmSerFree CsrWifiRouterPfree - -extern u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterMaPacketCfmSizeof(void *msg); -#define CsrWifiRouterMaPacketCfmSerFree CsrWifiRouterPfree - -extern u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, size_t *len, void *msg); -extern void* CsrWifiRouterMaPacketIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiRouterMaPacketIndSizeof(void *msg); -extern void CsrWifiRouterMaPacketIndSerFree(void *msg); - -#endif /* CSR_WIFI_ROUTER_SERIALIZE_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_router_task.h b/drivers/staging/csr/csr_wifi_router_task.h deleted file mode 100644 index 9ba892f34e6d..000000000000 --- a/drivers/staging/csr/csr_wifi_router_task.h +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_ROUTER_TASK_H__ -#define CSR_WIFI_ROUTER_TASK_H__ - -#include "csr_sched.h" - -#define CSR_WIFI_ROUTER_LOG_ID 0x1201FFFF -extern CsrSchedQid CSR_WIFI_ROUTER_IFACEQUEUE; -void CsrWifiRouterInit(void **gash); -void CsrWifiRouterDeinit(void **gash); -void CsrWifiRouterHandler(void **gash); - -#endif /* CSR_WIFI_ROUTER_TASK_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_router_transport.c b/drivers/staging/csr/csr_wifi_router_transport.c deleted file mode 100644 index e905ead9389b..000000000000 --- a/drivers/staging/csr/csr_wifi_router_transport.c +++ /dev/null @@ -1,199 +0,0 @@ -/** @file router_transport.c - * - * - * Copyright (C) Cambridge Silicon Radio Ltd 2006-2010. All rights reserved. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - ****************************************************************************/ - -#include "unifi_priv.h" - -#include "csr_sched.h" -#include "csr_msgconv.h" - -#include "sme_userspace.h" - -#include "csr_wifi_hostio_prim.h" -#include "csr_wifi_router_lib.h" -#include "csr_wifi_router_sef.h" -#include "csr_wifi_router_converter_init.h" -#include "csr_wifi_router_ctrl_lib.h" -#include "csr_wifi_router_ctrl_sef.h" -#include "csr_wifi_router_ctrl_converter_init.h" -#include "csr_wifi_sme_prim.h" -#include "csr_wifi_sme_sef.h" -#include "csr_wifi_sme_converter_init.h" -#ifdef CSR_SUPPORT_WEXT -#ifdef CSR_SUPPORT_WEXT_AP -#include "csr_wifi_nme_ap_prim.h" -#include "csr_wifi_nme_ap_sef.h" -#include "csr_wifi_nme_ap_converter_init.h" -#endif -#endif - -static unifi_priv_t *drvpriv = NULL; -void CsrWifiRouterTransportInit(unifi_priv_t *priv) -{ - unifi_trace(priv, UDBG1, "CsrWifiRouterTransportInit: \n"); - - drvpriv = priv; - (void)CsrMsgConvInit(); - CsrWifiRouterConverterInit(); - CsrWifiRouterCtrlConverterInit(); - CsrWifiSmeConverterInit(); -#ifdef CSR_SUPPORT_WEXT -#ifdef CSR_SUPPORT_WEXT_AP - CsrWifiNmeApConverterInit(); -#endif -#endif -} - -void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, size_t bufferLength) -{ - CsrMsgConvMsgEntry* msgEntry; - u16 primType; - CsrSchedQid src; - CsrSchedQid dest; - u16 msgType; - size_t offset = 0; - CsrWifiFsmEvent* msg; - - /* Decode the prim and message type */ - CsrUint16Des(&primType, buffer, &offset); - CsrUint16Des(&src, buffer, &offset); - CsrUint16Des(&dest, buffer, &offset); - CsrUint16Des(&msgType, buffer, &offset); - offset -= 2; /* Adjust as the Deserialise Function will read this as well */ - - unifi_trace(priv, UDBG4, "CsrWifiRouterTransportRecv: primType=0x%.4X, msgType=0x%.4X, bufferLength=%d\n", - primType, msgType, bufferLength); - - /* Special handling for HOSTIO messages.... */ - if (primType == CSR_WIFI_HOSTIO_PRIM) - { - CsrWifiRouterCtrlHipReq req = {{CSR_WIFI_ROUTER_CTRL_HIP_REQ, CSR_WIFI_ROUTER_CTRL_PRIM, dest, src, NULL}, 0, NULL, 0, NULL, 0, NULL}; - - req.mlmeCommandLength = bufferLength; - req.mlmeCommand = buffer; - - offset += 8;/* Skip the id, src, dest and slot number */ - CsrUint16Des(&req.dataRef1Length, buffer, &offset); - offset += 2; /* Skip the slot number */ - CsrUint16Des(&req.dataRef2Length, buffer, &offset); - - if (req.dataRef1Length) - { - u16 dr1Offset = (bufferLength - req.dataRef2Length) - req.dataRef1Length; - req.dataRef1 = &buffer[dr1Offset]; - } - - if (req.dataRef2Length) - { - u16 dr2Offset = bufferLength - req.dataRef2Length; - req.dataRef2 = &buffer[dr2Offset]; - } - - /* Copy the hip data but strip off the prim type */ - req.mlmeCommandLength -= (req.dataRef1Length + req.dataRef2Length + 6); - req.mlmeCommand = &buffer[6]; - - CsrWifiRouterCtrlHipReqHandler(priv, &req.common); - return; - } - - msgEntry = CsrMsgConvFindEntry(primType, msgType); - if (!msgEntry) - { - unifi_error(priv, "CsrWifiRouterTransportDeserialiseAndSend can not process the message. primType=0x%.4X, msgType=0x%.4X\n", - primType, msgType); - dump(buffer, bufferLength); - return; - } - - msg = (CsrWifiFsmEvent*)(msgEntry->deserFunc)(&buffer[offset], bufferLength - offset); - - msg->primtype = primType; - msg->type = msgType; - msg->source = src; - msg->destination = dest; - - switch(primType) - { - case CSR_WIFI_ROUTER_CTRL_PRIM: - CsrWifiRouterCtrlDownstreamStateHandlers[msg->type - CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST](priv, msg); - CsrWifiRouterCtrlFreeDownstreamMessageContents(CSR_WIFI_ROUTER_CTRL_PRIM, msg); - break; - case CSR_WIFI_ROUTER_PRIM: - CsrWifiRouterDownstreamStateHandlers[msg->type - CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST](priv, msg); - CsrWifiRouterFreeDownstreamMessageContents(CSR_WIFI_ROUTER_PRIM, msg); - break; - case CSR_WIFI_SME_PRIM: - CsrWifiSmeUpstreamStateHandlers[msg->type - CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST](priv, msg); - CsrWifiSmeFreeUpstreamMessageContents(CSR_WIFI_SME_PRIM, msg); - break; -#ifdef CSR_SUPPORT_WEXT -#ifdef CSR_SUPPORT_WEXT_AP - case CSR_WIFI_NME_AP_PRIM: - CsrWifiNmeApUpstreamStateHandlers(priv, msg); - CsrWifiNmeApFreeUpstreamMessageContents(CSR_WIFI_NME_AP_PRIM, msg); - break; -#endif -#endif - default: - unifi_error(priv, "CsrWifiRouterTransportDeserialiseAndSend unhandled prim type 0x%.4X\n", primType); - break; - } - kfree(msg); -} - -static void CsrWifiRouterTransportSerialiseAndSend(u16 primType, void* msg) -{ - CsrWifiFsmEvent* evt = (CsrWifiFsmEvent*)msg; - CsrMsgConvMsgEntry* msgEntry; - size_t msgSize; - size_t encodeBufferLen = 0; - size_t offset = 0; - u8* encodeBuffer; - - unifi_trace(drvpriv, UDBG4, "CsrWifiRouterTransportSerialiseAndSend: primType=0x%.4X, msgType=0x%.4X\n", - primType, evt->type); - - msgEntry = CsrMsgConvFindEntry(primType, evt->type); - if (!msgEntry) - { - unifi_error(drvpriv, "CsrWifiRouterTransportSerialiseAndSend can not process the message. primType=0x%.4X, msgType=0x%.4X\n", - primType, evt->type); - return; - } - - msgSize = 6 + (msgEntry->sizeofFunc)((void*)msg); - - encodeBuffer = kmalloc(msgSize, GFP_KERNEL); - - /* Encode PrimType */ - CsrUint16Ser(encodeBuffer, &encodeBufferLen, primType); - CsrUint16Ser(encodeBuffer, &encodeBufferLen, evt->source); - CsrUint16Ser(encodeBuffer, &encodeBufferLen, evt->destination); - - (void)(msgEntry->serFunc)(&encodeBuffer[encodeBufferLen], &offset, msg); - encodeBufferLen += offset; - - uf_sme_queue_message(drvpriv, encodeBuffer, encodeBufferLen); - - /* Do not use msgEntry->freeFunc because the memory is owned by the driver */ - kfree(msg); -} - -#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER) -void CsrSchedMessagePutStringLog(CsrSchedQid q, u16 mi, void *mv, u32 line, char *file) -#else -void CsrSchedMessagePut(CsrSchedQid q, u16 mi, void *mv) -#endif -{ - CsrWifiFsmEvent* evt = (CsrWifiFsmEvent*)mv; - evt->destination = q; - CsrWifiRouterTransportSerialiseAndSend(mi, mv); -} - diff --git a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c deleted file mode 100644 index dd93d0061190..000000000000 --- a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c +++ /dev/null @@ -1,256 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include <linux/module.h> -#include <linux/slab.h> -#include "csr_macro.h" -#include "csr_msgconv.h" -#include "csr_wifi_msgconv.h" -#include "csr_wifi_lib.h" - -void CsrUint24Des(u32 *v, u8 *buffer, size_t *offset) -{ - u32 val; - - val = ((buffer[(*offset) + 2] << 16) | - (buffer[(*offset) + 1] << 8) | - (buffer[(*offset)])); - - *offset += 3; - *v = val; -} - - -/* Big endian :e.g WSC, TCLAS */ -void CsrUint16DesBigEndian(u16 *v, u8 *buffer, size_t *offset) -{ - u16 val; - - val = (buffer[(*offset)] << 8) | (buffer[(*offset) + 1]); - *offset += 2; - - *v = val; -} - - -void CsrUint24DesBigEndian(u32 *v, u8 *buffer, size_t *offset) -{ - u32 val; - - val = ((buffer[(*offset)] << 16) | - (buffer[(*offset) + 1] << 8) | - (buffer[(*offset) + 2])); - - *offset += 3; - *v = val; -} - - -void CsrUint32DesBigEndian(u32 *v, u8 *buffer, size_t *offset) -{ - u32 val; - - val = ((buffer[(*offset)] << 24) | - (buffer[(*offset) + 1] << 16) | - (buffer[(*offset) + 2] << 8) | - (buffer[(*offset) + 3])); - - *offset += 4; - *v = val; -} - - -void CsrUint24Ser(u8 *ptr, size_t *len, u32 v) -{ - ptr[(*len) + 2] = (u8)((v & 0x00ff0000) >> 16); - ptr[(*len) + 1] = (u8)((v & 0x0000ff00) >> 8); - ptr[(*len)] = (u8)((v & 0x000000ff)); - - *len += 3; -} - - -/* Big endian :e.g WSC, TCLAS */ -void CsrUint16SerBigEndian(u8 *ptr, size_t *len, u16 v) -{ - ptr[(*len)] = (u8)((v & 0xff00) >> 8); - ptr[(*len) + 1] = (u8)((v & 0x00ff)); - - *len += 2; -} - - -void CsrUint32SerBigEndian(u8 *ptr, size_t *len, u32 v) -{ - ptr[(*len)] = (u8)((v & 0xff000000) >> 24); - ptr[(*len) + 1] = (u8)((v & 0x00ff0000) >> 16); - ptr[(*len) + 2] = (u8)((v & 0x0000ff00) >> 8); - ptr[(*len) + 3] = (u8)((v & 0x000000ff)); - - *len += 4; -} - - -void CsrUint24SerBigEndian(u8 *ptr, size_t *len, u32 v) -{ - ptr[(*len)] = (u8)((v & 0x00ff0000) >> 16); - ptr[(*len) + 1] = (u8)((v & 0x0000ff00) >> 8); - ptr[(*len) + 2] = (u8)((v & 0x000000ff)); - - *len += 3; -} - - -size_t CsrWifiEventSizeof(void *msg) -{ - return 2; -} -EXPORT_SYMBOL_GPL(CsrWifiEventSizeof); - -u8* CsrWifiEventSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiFsmEvent *primitive = (CsrWifiFsmEvent *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->type); - return(ptr); -} -EXPORT_SYMBOL_GPL(CsrWifiEventSer); - -void* CsrWifiEventDes(u8 *buffer, size_t length) -{ - CsrWifiFsmEvent *primitive = kmalloc(sizeof(CsrWifiFsmEvent), GFP_KERNEL); - size_t offset = 0; - CsrUint16Des(&primitive->type, buffer, &offset); - - return primitive; -} -EXPORT_SYMBOL_GPL(CsrWifiEventDes); - -size_t CsrWifiEventCsrUint8Sizeof(void *msg) -{ - return 3; -} -EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Sizeof); - -u8* CsrWifiEventCsrUint8Ser(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiEventCsrUint8 *primitive = (CsrWifiEventCsrUint8 *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, primitive->value); - return(ptr); -} -EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Ser); - - -void* CsrWifiEventCsrUint8Des(u8 *buffer, size_t length) -{ - CsrWifiEventCsrUint8 *primitive = kmalloc(sizeof(CsrWifiEventCsrUint8), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des(&primitive->value, buffer, &offset); - - return primitive; -} -EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Des); - - -size_t CsrWifiEventCsrUint16Sizeof(void *msg) -{ - return 4; -} -EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Sizeof); - - -u8* CsrWifiEventCsrUint16Ser(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiEventCsrUint16 *primitive = (CsrWifiEventCsrUint16 *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, primitive->value); - return(ptr); -} -EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Ser); - -void* CsrWifiEventCsrUint16Des(u8 *buffer, size_t length) -{ - CsrWifiEventCsrUint16 *primitive = kmalloc(sizeof(CsrWifiEventCsrUint16), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des(&primitive->value, buffer, &offset); - - return primitive; -} -EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Des); - - -size_t CsrWifiEventCsrUint32Sizeof(void *msg) -{ - return 6; -} -EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Sizeof); - -u8* CsrWifiEventCsrUint32Ser(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiEventCsrUint32 *primitive = (CsrWifiEventCsrUint32 *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint32Ser(ptr, len, primitive->value); - return(ptr); -} -EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Ser); - - -void* CsrWifiEventCsrUint32Des(u8 *buffer, size_t length) -{ - CsrWifiEventCsrUint32 *primitive = kmalloc(sizeof(CsrWifiEventCsrUint32), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint32Des(&primitive->value, buffer, &offset); - - return primitive; -} -EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Des); - -size_t CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg) -{ - return 5; -} -EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Sizeof); - -u8* CsrWifiEventCsrUint16CsrUint8Ser(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiEventCsrUint16CsrUint8 *primitive = (CsrWifiEventCsrUint16CsrUint8 *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, primitive->value16); - CsrUint8Ser(ptr, len, primitive->value8); - return(ptr); -} -EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Ser); - - -void* CsrWifiEventCsrUint16CsrUint8Des(u8 *buffer, size_t length) -{ - CsrWifiEventCsrUint16CsrUint8 *primitive = kmalloc(sizeof(CsrWifiEventCsrUint16CsrUint8), GFP_KERNEL); - - size_t offset = 0; - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des(&primitive->value16, buffer, &offset); - CsrUint8Des(&primitive->value8, buffer, &offset); - - return primitive; -} -EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Des); - - diff --git a/drivers/staging/csr/csr_wifi_sme_ap_lib.h b/drivers/staging/csr/csr_wifi_sme_ap_lib.h deleted file mode 100644 index 48ea9143f591..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_ap_lib.h +++ /dev/null @@ -1,774 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_SME_AP_LIB_H__ -#define CSR_WIFI_SME_AP_LIB_H__ - -#include "csr_sched.h" -#include "csr_macro.h" -#include "csr_msg_transport.h" - -#include "csr_wifi_lib.h" - -#include "csr_wifi_sme_ap_prim.h" -#include "csr_wifi_sme_task.h" - -#ifndef CSR_WIFI_AP_ENABLE -#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_sme_ap_lib.h -#endif - -/*----------------------------------------------------------------------------* - * CsrWifiSmeApFreeUpstreamMessageContents - * - * DESCRIPTION - * Free the allocated memory in a CSR_WIFI_SME_AP upstream message. Does not - * free the message itself, and can only be used for upstream messages. - * - * PARAMETERS - * Deallocates the resources in a CSR_WIFI_SME_AP upstream message - *----------------------------------------------------------------------------*/ -void CsrWifiSmeApFreeUpstreamMessageContents(u16 eventClass, void *message); - -/*----------------------------------------------------------------------------* - * CsrWifiSmeApFreeDownstreamMessageContents - * - * DESCRIPTION - * Free the allocated memory in a CSR_WIFI_SME_AP downstream message. Does not - * free the message itself, and can only be used for downstream messages. - * - * PARAMETERS - * Deallocates the resources in a CSR_WIFI_SME_AP downstream message - *----------------------------------------------------------------------------*/ -void CsrWifiSmeApFreeDownstreamMessageContents(u16 eventClass, void *message); - -/*----------------------------------------------------------------------------* - * Enum to string functions - *----------------------------------------------------------------------------*/ -const char* CsrWifiSmeApAccessTypeToString(CsrWifiSmeApAccessType value); -const char* CsrWifiSmeApAuthSupportToString(CsrWifiSmeApAuthSupport value); -const char* CsrWifiSmeApAuthTypeToString(CsrWifiSmeApAuthType value); -const char* CsrWifiSmeApDirectionToString(CsrWifiSmeApDirection value); -const char* CsrWifiSmeApPhySupportToString(CsrWifiSmeApPhySupport value); -const char* CsrWifiSmeApTypeToString(CsrWifiSmeApType value); - - -/*----------------------------------------------------------------------------* - * CsrPrim Type toString function. - * Converts a message type to the String name of the Message - *----------------------------------------------------------------------------*/ -const char* CsrWifiSmeApPrimTypeToString(CsrPrim msgType); - -/*----------------------------------------------------------------------------* - * Lookup arrays for PrimType name Strings - *----------------------------------------------------------------------------*/ -extern const char *CsrWifiSmeApUpstreamPrimNames[CSR_WIFI_SME_AP_PRIM_UPSTREAM_COUNT]; -extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_COUNT]; - -/******************************************************************************* - - NAME - CsrWifiSmeApActiveBaGetReqSend - - DESCRIPTION - This primitive used to retrieve information related to the active block - ack sessions - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - -*******************************************************************************/ -#define CsrWifiSmeApActiveBaGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApActiveBaGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ACTIVE_BA_GET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiSmeApActiveBaGetReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiSmeApActiveBaGetReq *msg__; \ - CsrWifiSmeApActiveBaGetReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApActiveBaGetReqSend(src__, interfaceTag__) \ - CsrWifiSmeApActiveBaGetReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiSmeApActiveBaGetCfmSend - - DESCRIPTION - This primitive carries the information related to the active ba sessions - - PARAMETERS - queue - Destination Task Queue - interfaceTag - - status - Reports the result of the request - activeBaCount - Number of active block ack session - activeBaSessions - Points to a buffer containing an array of - CsrWifiSmeApBaSession structures. - -*******************************************************************************/ -#define CsrWifiSmeApActiveBaGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApActiveBaGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ACTIVE_BA_GET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->activeBaCount = (activeBaCount__); \ - msg__->activeBaSessions = (activeBaSessions__); - -#define CsrWifiSmeApActiveBaGetCfmSendTo(dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \ - { \ - CsrWifiSmeApActiveBaGetCfm *msg__; \ - CsrWifiSmeApActiveBaGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApActiveBaGetCfmSend(dst__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \ - CsrWifiSmeApActiveBaGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, activeBaCount__, activeBaSessions__) - -/******************************************************************************* - - NAME - CsrWifiSmeApBaDeleteReqSend - - DESCRIPTION - This primitive is used to delete an active block ack session - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - reason - - baSession - BA session to be deleted - -*******************************************************************************/ -#define CsrWifiSmeApBaDeleteReqCreate(msg__, dst__, src__, interfaceTag__, reason__, baSession__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApBaDeleteReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BA_DELETE_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->reason = (reason__); \ - msg__->baSession = (baSession__); - -#define CsrWifiSmeApBaDeleteReqSendTo(dst__, src__, interfaceTag__, reason__, baSession__) \ - { \ - CsrWifiSmeApBaDeleteReq *msg__; \ - CsrWifiSmeApBaDeleteReqCreate(msg__, dst__, src__, interfaceTag__, reason__, baSession__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApBaDeleteReqSend(src__, interfaceTag__, reason__, baSession__) \ - CsrWifiSmeApBaDeleteReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, reason__, baSession__) - -/******************************************************************************* - - NAME - CsrWifiSmeApBaDeleteCfmSend - - DESCRIPTION - This primitive confirms the BA is deleted - - PARAMETERS - queue - Destination Task Queue - interfaceTag - - status - Reports the result of the request - baSession - deleted BA session - -*******************************************************************************/ -#define CsrWifiSmeApBaDeleteCfmCreate(msg__, dst__, src__, interfaceTag__, status__, baSession__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApBaDeleteCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BA_DELETE_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->baSession = (baSession__); - -#define CsrWifiSmeApBaDeleteCfmSendTo(dst__, src__, interfaceTag__, status__, baSession__) \ - { \ - CsrWifiSmeApBaDeleteCfm *msg__; \ - CsrWifiSmeApBaDeleteCfmCreate(msg__, dst__, src__, interfaceTag__, status__, baSession__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApBaDeleteCfmSend(dst__, interfaceTag__, status__, baSession__) \ - CsrWifiSmeApBaDeleteCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, baSession__) - -/******************************************************************************* - - NAME - CsrWifiSmeApBeaconingStartReqSend - - DESCRIPTION - This primitive requests the SME to start AP or GO functionality - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - initialPresence - Set to 0, if Not in a group fomration phase, set to 1 , - during group formation phase - apType - apType : Legacy AP or P2PGO - cloakSsid - cloakSsid flag. - ssid - ssid. - ifIndex - Radio Interface - channel - channel. - maxConnections - Maximum Stations + P2PClients allowed - apCredentials - AP security credeitals used to advertise in beacon /probe - response - smeApConfig - AP configuration - p2pGoParam - P2P specific GO parameters. Ignored if it is a leagacy AP - -*******************************************************************************/ -#define CsrWifiSmeApBeaconingStartReqCreate(msg__, dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStartReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_START_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->initialPresence = (initialPresence__); \ - msg__->apType = (apType__); \ - msg__->cloakSsid = (cloakSsid__); \ - msg__->ssid = (ssid__); \ - msg__->ifIndex = (ifIndex__); \ - msg__->channel = (channel__); \ - msg__->maxConnections = (maxConnections__); \ - msg__->apCredentials = (apCredentials__); \ - msg__->smeApConfig = (smeApConfig__); \ - msg__->p2pGoParam = (p2pGoParam__); - -#define CsrWifiSmeApBeaconingStartReqSendTo(dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \ - { \ - CsrWifiSmeApBeaconingStartReq *msg__; \ - CsrWifiSmeApBeaconingStartReqCreate(msg__, dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApBeaconingStartReqSend(src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \ - CsrWifiSmeApBeaconingStartReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) - -/******************************************************************************* - - NAME - CsrWifiSmeApBeaconingStartCfmSend - - DESCRIPTION - This primitive confirms the completion of the request along with the - status - - PARAMETERS - queue - Destination Task Queue - interfaceTag - - status - - secIeLength - - secIe - - -*******************************************************************************/ -#define CsrWifiSmeApBeaconingStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, secIeLength__, secIe__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStartCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_START_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->secIeLength = (secIeLength__); \ - msg__->secIe = (secIe__); - -#define CsrWifiSmeApBeaconingStartCfmSendTo(dst__, src__, interfaceTag__, status__, secIeLength__, secIe__) \ - { \ - CsrWifiSmeApBeaconingStartCfm *msg__; \ - CsrWifiSmeApBeaconingStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, secIeLength__, secIe__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApBeaconingStartCfmSend(dst__, interfaceTag__, status__, secIeLength__, secIe__) \ - CsrWifiSmeApBeaconingStartCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, secIeLength__, secIe__) - -/******************************************************************************* - - NAME - CsrWifiSmeApBeaconingStopReqSend - - DESCRIPTION - This primitive requests the SME to STOP AP or P2PGO operation - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - -*******************************************************************************/ -#define CsrWifiSmeApBeaconingStopReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStopReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_STOP_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiSmeApBeaconingStopReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiSmeApBeaconingStopReq *msg__; \ - CsrWifiSmeApBeaconingStopReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApBeaconingStopReqSend(src__, interfaceTag__) \ - CsrWifiSmeApBeaconingStopReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiSmeApBeaconingStopCfmSend - - DESCRIPTION - This primitive confirms AP or P2PGO operation is terminated - - PARAMETERS - queue - Destination Task Queue - interfaceTag - - status - - -*******************************************************************************/ -#define CsrWifiSmeApBeaconingStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStopCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_STOP_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiSmeApBeaconingStopCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiSmeApBeaconingStopCfm *msg__; \ - CsrWifiSmeApBeaconingStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApBeaconingStopCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiSmeApBeaconingStopCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeApErrorIndSend - - DESCRIPTION - This primitve is sent by SME to indicate some error in AP operationi - after AP operations were started successfully and continuing the AP - operation may lead to undesired behaviour. It is the responsibility of - the upper layers to stop AP operation if needed - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Range 0-1 - apType - - status - Contains the error status - -*******************************************************************************/ -#define CsrWifiSmeApErrorIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApErrorInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ERROR_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->apType = (apType__); \ - msg__->status = (status__); - -#define CsrWifiSmeApErrorIndSendTo(dst__, src__, interfaceTag__, apType__, status__) \ - { \ - CsrWifiSmeApErrorInd *msg__; \ - CsrWifiSmeApErrorIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApErrorIndSend(dst__, interfaceTag__, apType__, status__) \ - CsrWifiSmeApErrorIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, apType__, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeApStaConnectStartIndSend - - DESCRIPTION - This primitive indicates that a stations request to join the group/BSS is - accepted - - PARAMETERS - queue - Destination Task Queue - interfaceTag - - peerMacAddress - - -*******************************************************************************/ -#define CsrWifiSmeApStaConnectStartIndCreate(msg__, dst__, src__, interfaceTag__, peerMacAddress__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApStaConnectStartInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_CONNECT_START_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->peerMacAddress = (peerMacAddress__); - -#define CsrWifiSmeApStaConnectStartIndSendTo(dst__, src__, interfaceTag__, peerMacAddress__) \ - { \ - CsrWifiSmeApStaConnectStartInd *msg__; \ - CsrWifiSmeApStaConnectStartIndCreate(msg__, dst__, src__, interfaceTag__, peerMacAddress__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApStaConnectStartIndSend(dst__, interfaceTag__, peerMacAddress__) \ - CsrWifiSmeApStaConnectStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, peerMacAddress__) - -/******************************************************************************* - - NAME - CsrWifiSmeApStaDisconnectReqSend - - DESCRIPTION - This primitive tells SME to deauth ot disassociate a particular station - within BSS - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - deauthReason - - disassocReason - - peerMacaddress - - keepBlocking - If TRUE, the station is blocked. If FALSE and the station - is connected, disconnect the station. If FALSE and the - station is not connected, no action is taken. - -*******************************************************************************/ -#define CsrWifiSmeApStaDisconnectReqCreate(msg__, dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApStaDisconnectReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_DISCONNECT_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->deauthReason = (deauthReason__); \ - msg__->disassocReason = (disassocReason__); \ - msg__->peerMacaddress = (peerMacaddress__); \ - msg__->keepBlocking = (keepBlocking__); - -#define CsrWifiSmeApStaDisconnectReqSendTo(dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \ - { \ - CsrWifiSmeApStaDisconnectReq *msg__; \ - CsrWifiSmeApStaDisconnectReqCreate(msg__, dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApStaDisconnectReqSend(src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \ - CsrWifiSmeApStaDisconnectReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) - -/******************************************************************************* - - NAME - CsrWifiSmeApStaDisconnectCfmSend - - DESCRIPTION - This primitive confirms the station is disconnected - - PARAMETERS - queue - Destination Task Queue - interfaceTag - - status - - peerMacaddress - - -*******************************************************************************/ -#define CsrWifiSmeApStaDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, peerMacaddress__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApStaDisconnectCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_DISCONNECT_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->peerMacaddress = (peerMacaddress__); - -#define CsrWifiSmeApStaDisconnectCfmSendTo(dst__, src__, interfaceTag__, status__, peerMacaddress__) \ - { \ - CsrWifiSmeApStaDisconnectCfm *msg__; \ - CsrWifiSmeApStaDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, peerMacaddress__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApStaDisconnectCfmSend(dst__, interfaceTag__, status__, peerMacaddress__) \ - CsrWifiSmeApStaDisconnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, peerMacaddress__) - -/******************************************************************************* - - NAME - CsrWifiSmeApStaNotifyIndSend - - DESCRIPTION - This primitive indicates that a station has joined or a previously joined - station has left the BSS/group - - PARAMETERS - queue - Destination Task Queue - interfaceTag - - mediaStatus - - peerMacAddress - - peerDeviceAddress - - disassocReason - - deauthReason - - WpsRegistration - - secIeLength - - secIe - - groupKeyId - - seqNumber - - -*******************************************************************************/ -#define CsrWifiSmeApStaNotifyIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApStaNotifyInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_NOTIFY_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->mediaStatus = (mediaStatus__); \ - msg__->peerMacAddress = (peerMacAddress__); \ - msg__->peerDeviceAddress = (peerDeviceAddress__); \ - msg__->disassocReason = (disassocReason__); \ - msg__->deauthReason = (deauthReason__); \ - msg__->WpsRegistration = (WpsRegistration__); \ - msg__->secIeLength = (secIeLength__); \ - msg__->secIe = (secIe__); \ - msg__->groupKeyId = (groupKeyId__); \ - memcpy(msg__->seqNumber, (seqNumber__), sizeof(u16) * 8); - -#define CsrWifiSmeApStaNotifyIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \ - { \ - CsrWifiSmeApStaNotifyInd *msg__; \ - CsrWifiSmeApStaNotifyIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApStaNotifyIndSend(dst__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \ - CsrWifiSmeApStaNotifyIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) - -/******************************************************************************* - - NAME - CsrWifiSmeApWmmParamUpdateReqSend - - DESCRIPTION - Application uses this primitive to update the WMM parameters on the fly - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - wmmApParams - WMM parameters to be used for local firmware queue - configuration - wmmApBcParams - WMM parameters to be advertised in beacon/probe response - -*******************************************************************************/ -#define CsrWifiSmeApWmmParamUpdateReqCreate(msg__, dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApWmmParamUpdateReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - memcpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \ - memcpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); - -#define CsrWifiSmeApWmmParamUpdateReqSendTo(dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \ - { \ - CsrWifiSmeApWmmParamUpdateReq *msg__; \ - CsrWifiSmeApWmmParamUpdateReqCreate(msg__, dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApWmmParamUpdateReqSend(src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \ - CsrWifiSmeApWmmParamUpdateReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) - -/******************************************************************************* - - NAME - CsrWifiSmeApWmmParamUpdateCfmSend - - DESCRIPTION - A confirm for CSR_WIFI_SME_AP_WMM_PARAM_UPDATE.request - - PARAMETERS - queue - Destination Task Queue - interfaceTag - - status - - -*******************************************************************************/ -#define CsrWifiSmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApWmmParamUpdateCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiSmeApWmmParamUpdateCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiSmeApWmmParamUpdateCfm *msg__; \ - CsrWifiSmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApWmmParamUpdateCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiSmeApWmmParamUpdateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeApWpsConfigurationReqSend - - DESCRIPTION - This primitive passes the WPS information for the device to SME. This may - be accepted only if no interface is active. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - wpsConfig - WPS config. - -*******************************************************************************/ -#define CsrWifiSmeApWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApWpsConfigurationReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_CONFIGURATION_REQ, dst__, src__); \ - msg__->wpsConfig = (wpsConfig__); - -#define CsrWifiSmeApWpsConfigurationReqSendTo(dst__, src__, wpsConfig__) \ - { \ - CsrWifiSmeApWpsConfigurationReq *msg__; \ - CsrWifiSmeApWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApWpsConfigurationReqSend(src__, wpsConfig__) \ - CsrWifiSmeApWpsConfigurationReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, wpsConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeApWpsConfigurationCfmSend - - DESCRIPTION - Confirm. - - PARAMETERS - queue - Destination Task Queue - status - Status of the request. - -*******************************************************************************/ -#define CsrWifiSmeApWpsConfigurationCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApWpsConfigurationCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_CONFIGURATION_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeApWpsConfigurationCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeApWpsConfigurationCfm *msg__; \ - CsrWifiSmeApWpsConfigurationCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApWpsConfigurationCfmSend(dst__, status__) \ - CsrWifiSmeApWpsConfigurationCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeApWpsRegistrationFinishedReqSend - - DESCRIPTION - This primitive tells SME that WPS registration procedure has finished - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - -*******************************************************************************/ -#define CsrWifiSmeApWpsRegistrationFinishedReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiSmeApWpsRegistrationFinishedReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiSmeApWpsRegistrationFinishedReq *msg__; \ - CsrWifiSmeApWpsRegistrationFinishedReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApWpsRegistrationFinishedReqSend(src__, interfaceTag__) \ - CsrWifiSmeApWpsRegistrationFinishedReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiSmeApWpsRegistrationFinishedCfmSend - - DESCRIPTION - A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_FINISHED.request - - PARAMETERS - queue - Destination Task Queue - interfaceTag - - status - - -*******************************************************************************/ -#define CsrWifiSmeApWpsRegistrationFinishedCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiSmeApWpsRegistrationFinishedCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiSmeApWpsRegistrationFinishedCfm *msg__; \ - CsrWifiSmeApWpsRegistrationFinishedCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApWpsRegistrationFinishedCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiSmeApWpsRegistrationFinishedCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeApWpsRegistrationStartedReqSend - - DESCRIPTION - This primitive tells SME that WPS registration procedure has started - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - - SelectedDevicePasswordId - - SelectedconfigMethod - - -*******************************************************************************/ -#define CsrWifiSmeApWpsRegistrationStartedReqCreate(msg__, dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationStartedReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->SelectedDevicePasswordId = (SelectedDevicePasswordId__); \ - msg__->SelectedconfigMethod = (SelectedconfigMethod__); - -#define CsrWifiSmeApWpsRegistrationStartedReqSendTo(dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \ - { \ - CsrWifiSmeApWpsRegistrationStartedReq *msg__; \ - CsrWifiSmeApWpsRegistrationStartedReqCreate(msg__, dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApWpsRegistrationStartedReqSend(src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \ - CsrWifiSmeApWpsRegistrationStartedReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) - -/******************************************************************************* - - NAME - CsrWifiSmeApWpsRegistrationStartedCfmSend - - DESCRIPTION - A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_STARTED.request - - PARAMETERS - queue - Destination Task Queue - interfaceTag - - status - - -*******************************************************************************/ -#define CsrWifiSmeApWpsRegistrationStartedCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationStartedCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiSmeApWpsRegistrationStartedCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiSmeApWpsRegistrationStartedCfm *msg__; \ - CsrWifiSmeApWpsRegistrationStartedCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \ - } - -#define CsrWifiSmeApWpsRegistrationStartedCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiSmeApWpsRegistrationStartedCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) - - -#endif /* CSR_WIFI_SME_AP_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_sme_ap_prim.h b/drivers/staging/csr/csr_wifi_sme_ap_prim.h deleted file mode 100644 index 3c4bcbc16126..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_ap_prim.h +++ /dev/null @@ -1,1030 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_SME_AP_PRIM_H__ -#define CSR_WIFI_SME_AP_PRIM_H__ - -#include "csr_prim_defs.h" -#include "csr_sched.h" -#include "csr_wifi_common.h" -#include "csr_result.h" -#include "csr_wifi_fsm_event.h" -#include "csr_wifi_sme_prim.h" - -#ifndef CSR_WIFI_AP_ENABLE -#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_sme_ap_prim.h -#endif - -#define CSR_WIFI_SME_AP_PRIM (0x0407) - -typedef CsrPrim CsrWifiSmeApPrim; - - -/******************************************************************************* - - NAME - CsrWifiSmeApAccessType - - DESCRIPTION - Allow or deny STAs based on MAC address - - VALUES - CSR_WIFI_AP_ACCESS_TYPE_NONE - None - CSR_WIFI_AP_ACCESS_TYPE_ALLOW - Allow only if MAC address is from the list - CSR_WIFI_AP_ACCESS_TYPE_DENY - Disallow if MAC address is from the list - -*******************************************************************************/ -typedef u8 CsrWifiSmeApAccessType; -#define CSR_WIFI_AP_ACCESS_TYPE_NONE ((CsrWifiSmeApAccessType) 0x00) -#define CSR_WIFI_AP_ACCESS_TYPE_ALLOW ((CsrWifiSmeApAccessType) 0x01) -#define CSR_WIFI_AP_ACCESS_TYPE_DENY ((CsrWifiSmeApAccessType) 0x02) - -/******************************************************************************* - - NAME - CsrWifiSmeApAuthSupport - - DESCRIPTION - Define bits for AP authentication support - - VALUES - CSR_WIFI_SME_RSN_AUTH_WPAPSK - RSN WPA-PSK Support - CSR_WIFI_SME_RSN_AUTH_WPA2PSK - RSN WPA2-PSK Support - CSR_WIFI_SME_AUTH_WAPIPSK - WAPI-PSK Support - -*******************************************************************************/ -typedef u8 CsrWifiSmeApAuthSupport; -#define CSR_WIFI_SME_RSN_AUTH_WPAPSK ((CsrWifiSmeApAuthSupport) 0x01) -#define CSR_WIFI_SME_RSN_AUTH_WPA2PSK ((CsrWifiSmeApAuthSupport) 0x02) -#define CSR_WIFI_SME_AUTH_WAPIPSK ((CsrWifiSmeApAuthSupport) 0x04) - -/******************************************************************************* - - NAME - CsrWifiSmeApAuthType - - DESCRIPTION - Definition of the SME AP Authentication Options - - VALUES - CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM - - Open authentication - CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL - - Personal authentication using a passphrase or a pre-shared - key. - CSR_WIFI_SME_AP_AUTH_TYPE_WEP - - WEP authentication. This can be either open or shared key - -*******************************************************************************/ -typedef u8 CsrWifiSmeApAuthType; -#define CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM ((CsrWifiSmeApAuthType) 0x00) -#define CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL ((CsrWifiSmeApAuthType) 0x01) -#define CSR_WIFI_SME_AP_AUTH_TYPE_WEP ((CsrWifiSmeApAuthType) 0x02) - -/******************************************************************************* - - NAME - CsrWifiSmeApDirection - - DESCRIPTION - Definition of Direction - - VALUES - CSR_WIFI_AP_DIRECTION_RECEIPIENT - Receipient - CSR_WIFI_AP_DIRECTION_ORIGINATOR - Originator - -*******************************************************************************/ -typedef u8 CsrWifiSmeApDirection; -#define CSR_WIFI_AP_DIRECTION_RECEIPIENT ((CsrWifiSmeApDirection) 0x00) -#define CSR_WIFI_AP_DIRECTION_ORIGINATOR ((CsrWifiSmeApDirection) 0x01) - -/******************************************************************************* - - NAME - CsrWifiSmeApPhySupport - - DESCRIPTION - Define bits for CsrWifiSmeApPhySupportMask - - VALUES - CSR_WIFI_SME_AP_PHY_SUPPORT_A - 802.11a. It is not supported in the current - release. - CSR_WIFI_SME_AP_PHY_SUPPORT_B - 802.11b - CSR_WIFI_SME_AP_PHY_SUPPORT_G - 802.11g - CSR_WIFI_SME_AP_PHY_SUPPORT_N - 802.11n - -*******************************************************************************/ -typedef u8 CsrWifiSmeApPhySupport; -#define CSR_WIFI_SME_AP_PHY_SUPPORT_A ((CsrWifiSmeApPhySupport) 0x01) -#define CSR_WIFI_SME_AP_PHY_SUPPORT_B ((CsrWifiSmeApPhySupport) 0x02) -#define CSR_WIFI_SME_AP_PHY_SUPPORT_G ((CsrWifiSmeApPhySupport) 0x04) -#define CSR_WIFI_SME_AP_PHY_SUPPORT_N ((CsrWifiSmeApPhySupport) 0x08) - -/******************************************************************************* - - NAME - CsrWifiSmeApType - - DESCRIPTION - Definition of AP types - - VALUES - CSR_WIFI_AP_TYPE_LEGACY - Legacy AP - CSR_WIFI_AP_TYPE_P2P - P2P Group Owner(GO) - -*******************************************************************************/ -typedef u8 CsrWifiSmeApType; -#define CSR_WIFI_AP_TYPE_LEGACY ((CsrWifiSmeApType) 0x00) -#define CSR_WIFI_AP_TYPE_P2P ((CsrWifiSmeApType) 0x01) - - -/******************************************************************************* - - NAME - CsrWifiSmeApAuthSupportMask - - DESCRIPTION - See CsrWifiSmeApAuthSupport for bit definitions - -*******************************************************************************/ -typedef u8 CsrWifiSmeApAuthSupportMask; -/******************************************************************************* - - NAME - CsrWifiSmeApPhySupportMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiSmeApPhySupport - -*******************************************************************************/ -typedef u8 CsrWifiSmeApPhySupportMask; -/******************************************************************************* - - NAME - CsrWifiSmeApRsnCapabilities - - DESCRIPTION - Set to 0 for the current release - -*******************************************************************************/ -typedef u16 CsrWifiSmeApRsnCapabilities; -/******************************************************************************* - - NAME - CsrWifiSmeApRsnCapabilitiesMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiSmeApRsnCapabilities - -*******************************************************************************/ -typedef u16 CsrWifiSmeApRsnCapabilitiesMask; -/******************************************************************************* - - NAME - CsrWifiSmeApWapiCapabilities - - DESCRIPTION - Ignored by the stack as WAPI is not supported for AP operations in the - current release - -*******************************************************************************/ -typedef u16 CsrWifiSmeApWapiCapabilities; -/******************************************************************************* - - NAME - CsrWifiSmeApWapiCapabilitiesMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiSmeApWapiCapabilities - -*******************************************************************************/ -typedef u16 CsrWifiSmeApWapiCapabilitiesMask; - - -/******************************************************************************* - - NAME - CsrWifiSmeApHtParams - - DESCRIPTION - Structure holding HT parameters - - MEMBERS - greenfieldSupported - Indicates if the AP supports Htgreenfield operation - subject to the chip capability. If the chip does not - support Htgreenfield operation, this parameter will be - ignored. - NOTE: if shortGi20MHz is set to TRUE and the chip - supports short GI operation for 20MHz this field will - be be ignored and the AP will not support Htgreenfield - operation. - NOTE: This field is ignored by the Wi-Fi stack for the - current release. It implies that AP does not support - greenfield operation. - shortGi20MHz - Indicates if the AP support short GI operation for - 20MHz subject to the chip capability.If the chip does - not support short GI for 20MHz, this parameter is - ignored - rxStbc - Support for STBC for receive. 0 => No support for STBC - , 1=> Use STBC for Rx - rifsModeAllowed - RIFS Mode is allowed to protect overlapping non-HT BSS - htProtection - Deprecated - dualCtsProtection - Dual CTS Protection enabled - -*******************************************************************************/ -typedef struct -{ - u8 greenfieldSupported; - u8 shortGi20MHz; - u8 rxStbc; - u8 rifsModeAllowed; - u8 htProtection; - u8 dualCtsProtection; -} CsrWifiSmeApHtParams; - -/******************************************************************************* - - NAME - CsrWifiSmeApP2pOperatingChanEntry - - DESCRIPTION - - MEMBERS - operatingClass - Channel operating class - operatingChannelCount - Number of channels in this entry - operatingChannel - List of channels - -*******************************************************************************/ -typedef struct -{ - u8 operatingClass; - u8 operatingChannelCount; - u8 *operatingChannel; -} CsrWifiSmeApP2pOperatingChanEntry; - -/******************************************************************************* - - NAME - CsrWifiSmeApP2pOperatingChanList - - DESCRIPTION - This structure contains the lists of P2P operating channels - - MEMBERS - country - Country - channelEntryListCount - Number of entries - channelEntryList - List of entries - -*******************************************************************************/ -typedef struct -{ - u8 country[3]; - u8 channelEntryListCount; - CsrWifiSmeApP2pOperatingChanEntry *channelEntryList; -} CsrWifiSmeApP2pOperatingChanList; - -/******************************************************************************* - - NAME - CsrWifiSmeApAuthPers - - DESCRIPTION - - MEMBERS - authSupport - - encryptionModeMask - - rsnCapabilities - - wapiCapabilities - - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeApAuthSupportMask authSupport; - CsrWifiSmeEncryptionMask encryptionModeMask; - CsrWifiSmeApRsnCapabilitiesMask rsnCapabilities; - CsrWifiSmeApWapiCapabilitiesMask wapiCapabilities; -} CsrWifiSmeApAuthPers; - -/******************************************************************************* - - NAME - CsrWifiSmeApBaSession - - DESCRIPTION - - MEMBERS - peerMacAddress - Indicates MAC address of the peer station - tid - Specifies the TID of the MSDUs for which this Block Ack has - been set up. Range: 0-15 - direction - Specifies if the AP is the originator or the recipient of - the data stream that uses the Block Ack. - -*******************************************************************************/ -typedef struct -{ - CsrWifiMacAddress peerMacAddress; - u8 tid; - CsrWifiSmeApDirection direction; -} CsrWifiSmeApBaSession; - -/******************************************************************************* - - NAME - CsrWifiSmeApMacConfig - - DESCRIPTION - Structure holding AP MAC configuration. - - MEMBERS - phySupportedBitmap - Indicates supported physical layers - beaconInterval - Beacon interval in terms of TUs - dtimPeriod - DTIM period in terms of number of beacon intervals - maxListenInterval - Maximum allowed listen interval as number of beacon - intervals - supportedRatesCount - Number of supported rates. Range : 0 to 20 - supportedRates - List of supportedRates. A rate is specied in the - units of 500kbps. An entry for a basic rate shall - have the MSB set to 1. - preamble - Preamble to be advertised in beacons and probe - responses - shortSlotTimeEnabled - TRUE indicates the AP shall use short slot time if - all the stations use short slot operation. - ctsProtectionType - CTS protection to be used - wmmEnabled - Indicate whether WMM is enabled or not. If set to - FALSE,the WMM parameters shall be ignored by the - receiver. - wmmApParams - WMM parameters to be used for local firmware queue - configuration. Array index corresponds to the ACI. - wmmApBcParams - WMM parameters to be advertised in beacon/probe - response. Array index corresponds to the ACI - accessType - Specifies whether the MAC addresses from the list - should be allowed or denied - macAddressListCount - Number of MAC addresses - macAddressList - List of MAC addresses - apHtParams - AP HT parameters. The stack shall use these - parameters only if phySupportedBitmap indicates - support for IEEE 802.11n - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeApPhySupportMask phySupportedBitmap; - u16 beaconInterval; - u8 dtimPeriod; - u16 maxListenInterval; - u8 supportedRatesCount; - u8 supportedRates[20]; - CsrWifiSmePreambleType preamble; - u8 shortSlotTimeEnabled; - CsrWifiSmeCtsProtectionType ctsProtectionType; - u8 wmmEnabled; - CsrWifiSmeWmmAcParams wmmApParams[4]; - CsrWifiSmeWmmAcParams wmmApBcParams[4]; - CsrWifiSmeApAccessType accessType; - u8 macAddressListCount; - CsrWifiMacAddress *macAddressList; - CsrWifiSmeApHtParams apHtParams; -} CsrWifiSmeApMacConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeApP2pGoConfig - - DESCRIPTION - - MEMBERS - groupCapability - Indicates the P2P group capabilities - operatingChanList - List of operating channels in the order of - decreasing priority. It may contain channel - entry/entries not supported by the wifi stack. - These shall be filtered out by the wifi stack - opPsEnabled - Indicates whether opportunistic power save can - be used. - Note: This parameter is ignored by the WiFi - stack for the current release - ctWindow - Define Client Traffic window to be used in terms - of number of TUs. Range: 0 to 127. - Note: This parameter is ignored by the WiFi - stack for the current release. - noaConfigMethod - Notice of Absence configuration method. - Note: This parameter is ignored by the WiFi - stack for the current release. - allowNoaWithNonP2pDevices - Indicates if NOA should be allowed if non P2P - devices are connected. If allowed the non P2P - devices may suffer in throughput. - Note: This parameter is ignored by the WiFi - stack for the current release. - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeP2pGroupCapabilityMask groupCapability; - CsrWifiSmeApP2pOperatingChanList operatingChanList; - u8 opPsEnabled; - u8 ctWindow; - CsrWifiSmeP2pNoaConfigMethod noaConfigMethod; - u8 allowNoaWithNonP2pDevices; -} CsrWifiSmeApP2pGoConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeApCredentials - - DESCRIPTION - - MEMBERS - authType - - smeAuthType - - smeAuthTypeopenSystemEmpty - - smeAuthTypeauthwep - - smeAuthTypeauthPers - - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeApAuthType authType; - union { - CsrWifiSmeEmpty openSystemEmpty; - CsrWifiSmeWepAuth authwep; - CsrWifiSmeApAuthPers authPers; - } smeAuthType; -} CsrWifiSmeApCredentials; - -/******************************************************************************* - - NAME - CsrWifiSmeApSecConfig - - DESCRIPTION - - MEMBERS - apCredentials - - wpsEnabled - - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeApCredentials apCredentials; - u8 wpsEnabled; -} CsrWifiSmeApSecConfig; - - -/* Downstream */ -#define CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST (0x0000) - -#define CSR_WIFI_SME_AP_BEACONING_START_REQ ((CsrWifiSmeApPrim) (0x0000 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_BEACONING_STOP_REQ ((CsrWifiSmeApPrim) (0x0001 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_REQ ((CsrWifiSmeApPrim) (0x0002 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_REQ ((CsrWifiSmeApPrim) (0x0003 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_REQ ((CsrWifiSmeApPrim) (0x0004 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_STA_DISCONNECT_REQ ((CsrWifiSmeApPrim) (0x0005 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_WPS_CONFIGURATION_REQ ((CsrWifiSmeApPrim) (0x0006 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_ACTIVE_BA_GET_REQ ((CsrWifiSmeApPrim) (0x0007 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_BA_DELETE_REQ ((CsrWifiSmeApPrim) (0x0008 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)) - - -#define CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_HIGHEST (0x0008 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST) - -/* Upstream */ -#define CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) - -#define CSR_WIFI_SME_AP_BEACONING_START_CFM ((CsrWifiSmeApPrim)(0x0000 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_BEACONING_STOP_CFM ((CsrWifiSmeApPrim)(0x0001 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_STA_NOTIFY_IND ((CsrWifiSmeApPrim)(0x0002 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_STA_CONNECT_START_IND ((CsrWifiSmeApPrim)(0x0003 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_CFM ((CsrWifiSmeApPrim)(0x0004 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_CFM ((CsrWifiSmeApPrim)(0x0005 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_CFM ((CsrWifiSmeApPrim)(0x0006 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_STA_DISCONNECT_CFM ((CsrWifiSmeApPrim)(0x0007 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_WPS_CONFIGURATION_CFM ((CsrWifiSmeApPrim)(0x0008 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_ERROR_IND ((CsrWifiSmeApPrim)(0x0009 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_ACTIVE_BA_GET_CFM ((CsrWifiSmeApPrim)(0x000A + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AP_BA_DELETE_CFM ((CsrWifiSmeApPrim)(0x000B + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)) - -#define CSR_WIFI_SME_AP_PRIM_UPSTREAM_HIGHEST (0x000B + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST) - -#define CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST) -#define CSR_WIFI_SME_AP_PRIM_UPSTREAM_COUNT (CSR_WIFI_SME_AP_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST) - -/******************************************************************************* - - NAME - CsrWifiSmeApBeaconingStartReq - - DESCRIPTION - This primitive requests the SME to start AP or GO functionality - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - initialPresence - Set to 0, if Not in a group fomration phase, set to 1 , - during group formation phase - apType - apType : Legacy AP or P2PGO - cloakSsid - cloakSsid flag. - ssid - ssid. - ifIndex - Radio Interface - channel - channel. - maxConnections - Maximum Stations + P2PClients allowed - apCredentials - AP security credeitals used to advertise in beacon /probe - response - smeApConfig - AP configuration - p2pGoParam - P2P specific GO parameters. Ignored if it is a leagacy AP - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 initialPresence; - CsrWifiSmeApType apType; - u8 cloakSsid; - CsrWifiSsid ssid; - CsrWifiSmeRadioIF ifIndex; - u8 channel; - u8 maxConnections; - CsrWifiSmeApSecConfig apCredentials; - CsrWifiSmeApMacConfig smeApConfig; - CsrWifiSmeApP2pGoConfig p2pGoParam; -} CsrWifiSmeApBeaconingStartReq; - -/******************************************************************************* - - NAME - CsrWifiSmeApBeaconingStopReq - - DESCRIPTION - This primitive requests the SME to STOP AP or P2PGO operation - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiSmeApBeaconingStopReq; - -/******************************************************************************* - - NAME - CsrWifiSmeApWpsRegistrationStartedReq - - DESCRIPTION - This primitive tells SME that WPS registration procedure has started - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - SelectedDevicePasswordId - - SelectedconfigMethod - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeWpsDpid SelectedDevicePasswordId; - CsrWifiSmeWpsConfigType SelectedconfigMethod; -} CsrWifiSmeApWpsRegistrationStartedReq; - -/******************************************************************************* - - NAME - CsrWifiSmeApWpsRegistrationFinishedReq - - DESCRIPTION - This primitive tells SME that WPS registration procedure has finished - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiSmeApWpsRegistrationFinishedReq; - -/******************************************************************************* - - NAME - CsrWifiSmeApWmmParamUpdateReq - - DESCRIPTION - Application uses this primitive to update the WMM parameters on the fly - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - wmmApParams - WMM parameters to be used for local firmware queue - configuration - wmmApBcParams - WMM parameters to be advertised in beacon/probe response - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeWmmAcParams wmmApParams[4]; - CsrWifiSmeWmmAcParams wmmApBcParams[4]; -} CsrWifiSmeApWmmParamUpdateReq; - -/******************************************************************************* - - NAME - CsrWifiSmeApStaDisconnectReq - - DESCRIPTION - This primitive tells SME to deauth ot disassociate a particular station - within BSS - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - deauthReason - - disassocReason - - peerMacaddress - - keepBlocking - If TRUE, the station is blocked. If FALSE and the station - is connected, disconnect the station. If FALSE and the - station is not connected, no action is taken. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeIEEE80211Reason deauthReason; - CsrWifiSmeIEEE80211Reason disassocReason; - CsrWifiMacAddress peerMacaddress; - u8 keepBlocking; -} CsrWifiSmeApStaDisconnectReq; - -/******************************************************************************* - - NAME - CsrWifiSmeApWpsConfigurationReq - - DESCRIPTION - This primitive passes the WPS information for the device to SME. This may - be accepted only if no interface is active. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - wpsConfig - WPS config. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeWpsConfig wpsConfig; -} CsrWifiSmeApWpsConfigurationReq; - -/******************************************************************************* - - NAME - CsrWifiSmeApActiveBaGetReq - - DESCRIPTION - This primitive used to retrieve information related to the active block - ack sessions - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiSmeApActiveBaGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeApBaDeleteReq - - DESCRIPTION - This primitive is used to delete an active block ack session - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - reason - - baSession - BA session to be deleted - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeIEEE80211Reason reason; - CsrWifiSmeApBaSession baSession; -} CsrWifiSmeApBaDeleteReq; - -/******************************************************************************* - - NAME - CsrWifiSmeApBeaconingStartCfm - - DESCRIPTION - This primitive confirms the completion of the request along with the - status - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - status - - secIeLength - - secIe - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - u16 secIeLength; - u8 *secIe; -} CsrWifiSmeApBeaconingStartCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeApBeaconingStopCfm - - DESCRIPTION - This primitive confirms AP or P2PGO operation is terminated - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiSmeApBeaconingStopCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeApStaNotifyInd - - DESCRIPTION - This primitive indicates that a station has joined or a previously joined - station has left the BSS/group - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - mediaStatus - - peerMacAddress - - peerDeviceAddress - - disassocReason - - deauthReason - - WpsRegistration - - secIeLength - - secIe - - groupKeyId - - seqNumber - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeMediaStatus mediaStatus; - CsrWifiMacAddress peerMacAddress; - CsrWifiMacAddress peerDeviceAddress; - CsrWifiSmeIEEE80211Reason disassocReason; - CsrWifiSmeIEEE80211Reason deauthReason; - CsrWifiSmeWpsRegistration WpsRegistration; - u8 secIeLength; - u8 *secIe; - u8 groupKeyId; - u16 seqNumber[8]; -} CsrWifiSmeApStaNotifyInd; - -/******************************************************************************* - - NAME - CsrWifiSmeApStaConnectStartInd - - DESCRIPTION - This primitive indicates that a stations request to join the group/BSS is - accepted - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - peerMacAddress - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiMacAddress peerMacAddress; -} CsrWifiSmeApStaConnectStartInd; - -/******************************************************************************* - - NAME - CsrWifiSmeApWpsRegistrationStartedCfm - - DESCRIPTION - A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_STARTED.request - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiSmeApWpsRegistrationStartedCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeApWpsRegistrationFinishedCfm - - DESCRIPTION - A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_FINISHED.request - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiSmeApWpsRegistrationFinishedCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeApWmmParamUpdateCfm - - DESCRIPTION - A confirm for CSR_WIFI_SME_AP_WMM_PARAM_UPDATE.request - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - status - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiSmeApWmmParamUpdateCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeApStaDisconnectCfm - - DESCRIPTION - This primitive confirms the station is disconnected - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - status - - peerMacaddress - - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiMacAddress peerMacaddress; -} CsrWifiSmeApStaDisconnectCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeApWpsConfigurationCfm - - DESCRIPTION - Confirm. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Status of the request. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeApWpsConfigurationCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeApErrorInd - - DESCRIPTION - This primitve is sent by SME to indicate some error in AP operationi - after AP operations were started successfully and continuing the AP - operation may lead to undesired behaviour. It is the responsibility of - the upper layers to stop AP operation if needed - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Range 0-1 - apType - - status - Contains the error status - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeApType apType; - CsrResult status; -} CsrWifiSmeApErrorInd; - -/******************************************************************************* - - NAME - CsrWifiSmeApActiveBaGetCfm - - DESCRIPTION - This primitive carries the information related to the active ba sessions - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - status - Reports the result of the request - activeBaCount - Number of active block ack session - activeBaSessions - Points to a buffer containing an array of - CsrWifiSmeApBaSession structures. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - u16 activeBaCount; - CsrWifiSmeApBaSession *activeBaSessions; -} CsrWifiSmeApActiveBaGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeApBaDeleteCfm - - DESCRIPTION - This primitive confirms the BA is deleted - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - - status - Reports the result of the request - baSession - deleted BA session - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeApBaSession baSession; -} CsrWifiSmeApBaDeleteCfm; - - -#endif /* CSR_WIFI_SME_AP_PRIM_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_sme_converter_init.c b/drivers/staging/csr/csr_wifi_sme_converter_init.c deleted file mode 100644 index 31835f06bbc2..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_converter_init.c +++ /dev/null @@ -1,201 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#include "csr_msgconv.h" -#include "csr_macro.h" - - -#ifdef CSR_LOG_ENABLE -#include "csr_log.h" -#endif - -#ifndef EXCLUDE_CSR_WIFI_SME_MODULE -#include "csr_wifi_sme_serialize.h" -#include "csr_wifi_sme_prim.h" - -static CsrMsgConvMsgEntry csrwifisme_conv_lut[] = { - { CSR_WIFI_SME_ACTIVATE_REQ, CsrWifiSmeActivateReqSizeof, CsrWifiSmeActivateReqSer, CsrWifiSmeActivateReqDes, CsrWifiSmeActivateReqSerFree }, - { CSR_WIFI_SME_ADHOC_CONFIG_GET_REQ, CsrWifiSmeAdhocConfigGetReqSizeof, CsrWifiSmeAdhocConfigGetReqSer, CsrWifiSmeAdhocConfigGetReqDes, CsrWifiSmeAdhocConfigGetReqSerFree }, - { CSR_WIFI_SME_ADHOC_CONFIG_SET_REQ, CsrWifiSmeAdhocConfigSetReqSizeof, CsrWifiSmeAdhocConfigSetReqSer, CsrWifiSmeAdhocConfigSetReqDes, CsrWifiSmeAdhocConfigSetReqSerFree }, - { CSR_WIFI_SME_BLACKLIST_REQ, CsrWifiSmeBlacklistReqSizeof, CsrWifiSmeBlacklistReqSer, CsrWifiSmeBlacklistReqDes, CsrWifiSmeBlacklistReqSerFree }, - { CSR_WIFI_SME_CALIBRATION_DATA_GET_REQ, CsrWifiSmeCalibrationDataGetReqSizeof, CsrWifiSmeCalibrationDataGetReqSer, CsrWifiSmeCalibrationDataGetReqDes, CsrWifiSmeCalibrationDataGetReqSerFree }, - { CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ, CsrWifiSmeCalibrationDataSetReqSizeof, CsrWifiSmeCalibrationDataSetReqSer, CsrWifiSmeCalibrationDataSetReqDes, CsrWifiSmeCalibrationDataSetReqSerFree }, - { CSR_WIFI_SME_CCX_CONFIG_GET_REQ, CsrWifiSmeCcxConfigGetReqSizeof, CsrWifiSmeCcxConfigGetReqSer, CsrWifiSmeCcxConfigGetReqDes, CsrWifiSmeCcxConfigGetReqSerFree }, - { CSR_WIFI_SME_CCX_CONFIG_SET_REQ, CsrWifiSmeCcxConfigSetReqSizeof, CsrWifiSmeCcxConfigSetReqSer, CsrWifiSmeCcxConfigSetReqDes, CsrWifiSmeCcxConfigSetReqSerFree }, - { CSR_WIFI_SME_COEX_CONFIG_GET_REQ, CsrWifiSmeCoexConfigGetReqSizeof, CsrWifiSmeCoexConfigGetReqSer, CsrWifiSmeCoexConfigGetReqDes, CsrWifiSmeCoexConfigGetReqSerFree }, - { CSR_WIFI_SME_COEX_CONFIG_SET_REQ, CsrWifiSmeCoexConfigSetReqSizeof, CsrWifiSmeCoexConfigSetReqSer, CsrWifiSmeCoexConfigSetReqDes, CsrWifiSmeCoexConfigSetReqSerFree }, - { CSR_WIFI_SME_COEX_INFO_GET_REQ, CsrWifiSmeCoexInfoGetReqSizeof, CsrWifiSmeCoexInfoGetReqSer, CsrWifiSmeCoexInfoGetReqDes, CsrWifiSmeCoexInfoGetReqSerFree }, - { CSR_WIFI_SME_CONNECT_REQ, CsrWifiSmeConnectReqSizeof, CsrWifiSmeConnectReqSer, CsrWifiSmeConnectReqDes, CsrWifiSmeConnectReqSerFree }, - { CSR_WIFI_SME_CONNECTION_CONFIG_GET_REQ, CsrWifiSmeConnectionConfigGetReqSizeof, CsrWifiSmeConnectionConfigGetReqSer, CsrWifiSmeConnectionConfigGetReqDes, CsrWifiSmeConnectionConfigGetReqSerFree }, - { CSR_WIFI_SME_CONNECTION_INFO_GET_REQ, CsrWifiSmeConnectionInfoGetReqSizeof, CsrWifiSmeConnectionInfoGetReqSer, CsrWifiSmeConnectionInfoGetReqDes, CsrWifiSmeConnectionInfoGetReqSerFree }, - { CSR_WIFI_SME_CONNECTION_STATS_GET_REQ, CsrWifiSmeConnectionStatsGetReqSizeof, CsrWifiSmeConnectionStatsGetReqSer, CsrWifiSmeConnectionStatsGetReqDes, CsrWifiSmeConnectionStatsGetReqSerFree }, - { CSR_WIFI_SME_DEACTIVATE_REQ, CsrWifiSmeDeactivateReqSizeof, CsrWifiSmeDeactivateReqSer, CsrWifiSmeDeactivateReqDes, CsrWifiSmeDeactivateReqSerFree }, - { CSR_WIFI_SME_DISCONNECT_REQ, CsrWifiSmeDisconnectReqSizeof, CsrWifiSmeDisconnectReqSer, CsrWifiSmeDisconnectReqDes, CsrWifiSmeDisconnectReqSerFree }, - { CSR_WIFI_SME_EVENT_MASK_SET_REQ, CsrWifiSmeEventMaskSetReqSizeof, CsrWifiSmeEventMaskSetReqSer, CsrWifiSmeEventMaskSetReqDes, CsrWifiSmeEventMaskSetReqSerFree }, - { CSR_WIFI_SME_HOST_CONFIG_GET_REQ, CsrWifiSmeHostConfigGetReqSizeof, CsrWifiSmeHostConfigGetReqSer, CsrWifiSmeHostConfigGetReqDes, CsrWifiSmeHostConfigGetReqSerFree }, - { CSR_WIFI_SME_HOST_CONFIG_SET_REQ, CsrWifiSmeHostConfigSetReqSizeof, CsrWifiSmeHostConfigSetReqSer, CsrWifiSmeHostConfigSetReqDes, CsrWifiSmeHostConfigSetReqSerFree }, - { CSR_WIFI_SME_KEY_REQ, CsrWifiSmeKeyReqSizeof, CsrWifiSmeKeyReqSer, CsrWifiSmeKeyReqDes, CsrWifiSmeKeyReqSerFree }, - { CSR_WIFI_SME_LINK_QUALITY_GET_REQ, CsrWifiSmeLinkQualityGetReqSizeof, CsrWifiSmeLinkQualityGetReqSer, CsrWifiSmeLinkQualityGetReqDes, CsrWifiSmeLinkQualityGetReqSerFree }, - { CSR_WIFI_SME_MIB_CONFIG_GET_REQ, CsrWifiSmeMibConfigGetReqSizeof, CsrWifiSmeMibConfigGetReqSer, CsrWifiSmeMibConfigGetReqDes, CsrWifiSmeMibConfigGetReqSerFree }, - { CSR_WIFI_SME_MIB_CONFIG_SET_REQ, CsrWifiSmeMibConfigSetReqSizeof, CsrWifiSmeMibConfigSetReqSer, CsrWifiSmeMibConfigSetReqDes, CsrWifiSmeMibConfigSetReqSerFree }, - { CSR_WIFI_SME_MIB_GET_NEXT_REQ, CsrWifiSmeMibGetNextReqSizeof, CsrWifiSmeMibGetNextReqSer, CsrWifiSmeMibGetNextReqDes, CsrWifiSmeMibGetNextReqSerFree }, - { CSR_WIFI_SME_MIB_GET_REQ, CsrWifiSmeMibGetReqSizeof, CsrWifiSmeMibGetReqSer, CsrWifiSmeMibGetReqDes, CsrWifiSmeMibGetReqSerFree }, - { CSR_WIFI_SME_MIB_SET_REQ, CsrWifiSmeMibSetReqSizeof, CsrWifiSmeMibSetReqSer, CsrWifiSmeMibSetReqDes, CsrWifiSmeMibSetReqSerFree }, - { CSR_WIFI_SME_MULTICAST_ADDRESS_REQ, CsrWifiSmeMulticastAddressReqSizeof, CsrWifiSmeMulticastAddressReqSer, CsrWifiSmeMulticastAddressReqDes, CsrWifiSmeMulticastAddressReqSerFree }, - { CSR_WIFI_SME_PACKET_FILTER_SET_REQ, CsrWifiSmePacketFilterSetReqSizeof, CsrWifiSmePacketFilterSetReqSer, CsrWifiSmePacketFilterSetReqDes, CsrWifiSmePacketFilterSetReqSerFree }, - { CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_REQ, CsrWifiSmePermanentMacAddressGetReqSizeof, CsrWifiSmePermanentMacAddressGetReqSer, CsrWifiSmePermanentMacAddressGetReqDes, CsrWifiSmePermanentMacAddressGetReqSerFree }, - { CSR_WIFI_SME_PMKID_REQ, CsrWifiSmePmkidReqSizeof, CsrWifiSmePmkidReqSer, CsrWifiSmePmkidReqDes, CsrWifiSmePmkidReqSerFree }, - { CSR_WIFI_SME_POWER_CONFIG_GET_REQ, CsrWifiSmePowerConfigGetReqSizeof, CsrWifiSmePowerConfigGetReqSer, CsrWifiSmePowerConfigGetReqDes, CsrWifiSmePowerConfigGetReqSerFree }, - { CSR_WIFI_SME_POWER_CONFIG_SET_REQ, CsrWifiSmePowerConfigSetReqSizeof, CsrWifiSmePowerConfigSetReqSer, CsrWifiSmePowerConfigSetReqDes, CsrWifiSmePowerConfigSetReqSerFree }, - { CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_REQ, CsrWifiSmeRegulatoryDomainInfoGetReqSizeof, CsrWifiSmeRegulatoryDomainInfoGetReqSer, CsrWifiSmeRegulatoryDomainInfoGetReqDes, CsrWifiSmeRegulatoryDomainInfoGetReqSerFree }, - { CSR_WIFI_SME_ROAMING_CONFIG_GET_REQ, CsrWifiSmeRoamingConfigGetReqSizeof, CsrWifiSmeRoamingConfigGetReqSer, CsrWifiSmeRoamingConfigGetReqDes, CsrWifiSmeRoamingConfigGetReqSerFree }, - { CSR_WIFI_SME_ROAMING_CONFIG_SET_REQ, CsrWifiSmeRoamingConfigSetReqSizeof, CsrWifiSmeRoamingConfigSetReqSer, CsrWifiSmeRoamingConfigSetReqDes, CsrWifiSmeRoamingConfigSetReqSerFree }, - { CSR_WIFI_SME_SCAN_CONFIG_GET_REQ, CsrWifiSmeScanConfigGetReqSizeof, CsrWifiSmeScanConfigGetReqSer, CsrWifiSmeScanConfigGetReqDes, CsrWifiSmeScanConfigGetReqSerFree }, - { CSR_WIFI_SME_SCAN_CONFIG_SET_REQ, CsrWifiSmeScanConfigSetReqSizeof, CsrWifiSmeScanConfigSetReqSer, CsrWifiSmeScanConfigSetReqDes, CsrWifiSmeScanConfigSetReqSerFree }, - { CSR_WIFI_SME_SCAN_FULL_REQ, CsrWifiSmeScanFullReqSizeof, CsrWifiSmeScanFullReqSer, CsrWifiSmeScanFullReqDes, CsrWifiSmeScanFullReqSerFree }, - { CSR_WIFI_SME_SCAN_RESULTS_FLUSH_REQ, CsrWifiSmeScanResultsFlushReqSizeof, CsrWifiSmeScanResultsFlushReqSer, CsrWifiSmeScanResultsFlushReqDes, CsrWifiSmeScanResultsFlushReqSerFree }, - { CSR_WIFI_SME_SCAN_RESULTS_GET_REQ, CsrWifiSmeScanResultsGetReqSizeof, CsrWifiSmeScanResultsGetReqSer, CsrWifiSmeScanResultsGetReqDes, CsrWifiSmeScanResultsGetReqSerFree }, - { CSR_WIFI_SME_SME_STA_CONFIG_GET_REQ, CsrWifiSmeSmeStaConfigGetReqSizeof, CsrWifiSmeSmeStaConfigGetReqSer, CsrWifiSmeSmeStaConfigGetReqDes, CsrWifiSmeSmeStaConfigGetReqSerFree }, - { CSR_WIFI_SME_SME_STA_CONFIG_SET_REQ, CsrWifiSmeSmeStaConfigSetReqSizeof, CsrWifiSmeSmeStaConfigSetReqSer, CsrWifiSmeSmeStaConfigSetReqDes, CsrWifiSmeSmeStaConfigSetReqSerFree }, - { CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_REQ, CsrWifiSmeStationMacAddressGetReqSizeof, CsrWifiSmeStationMacAddressGetReqSer, CsrWifiSmeStationMacAddressGetReqDes, CsrWifiSmeStationMacAddressGetReqSerFree }, - { CSR_WIFI_SME_TSPEC_REQ, CsrWifiSmeTspecReqSizeof, CsrWifiSmeTspecReqSer, CsrWifiSmeTspecReqDes, CsrWifiSmeTspecReqSerFree }, - { CSR_WIFI_SME_VERSIONS_GET_REQ, CsrWifiSmeVersionsGetReqSizeof, CsrWifiSmeVersionsGetReqSer, CsrWifiSmeVersionsGetReqDes, CsrWifiSmeVersionsGetReqSerFree }, - { CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ, CsrWifiSmeWifiFlightmodeReqSizeof, CsrWifiSmeWifiFlightmodeReqSer, CsrWifiSmeWifiFlightmodeReqDes, CsrWifiSmeWifiFlightmodeReqSerFree }, - { CSR_WIFI_SME_WIFI_OFF_REQ, CsrWifiSmeWifiOffReqSizeof, CsrWifiSmeWifiOffReqSer, CsrWifiSmeWifiOffReqDes, CsrWifiSmeWifiOffReqSerFree }, - { CSR_WIFI_SME_WIFI_ON_REQ, CsrWifiSmeWifiOnReqSizeof, CsrWifiSmeWifiOnReqSer, CsrWifiSmeWifiOnReqDes, CsrWifiSmeWifiOnReqSerFree }, - { CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ, CsrWifiSmeCloakedSsidsSetReqSizeof, CsrWifiSmeCloakedSsidsSetReqSer, CsrWifiSmeCloakedSsidsSetReqDes, CsrWifiSmeCloakedSsidsSetReqSerFree }, - { CSR_WIFI_SME_CLOAKED_SSIDS_GET_REQ, CsrWifiSmeCloakedSsidsGetReqSizeof, CsrWifiSmeCloakedSsidsGetReqSer, CsrWifiSmeCloakedSsidsGetReqDes, CsrWifiSmeCloakedSsidsGetReqSerFree }, - { CSR_WIFI_SME_SME_COMMON_CONFIG_GET_REQ, CsrWifiSmeSmeCommonConfigGetReqSizeof, CsrWifiSmeSmeCommonConfigGetReqSer, CsrWifiSmeSmeCommonConfigGetReqDes, CsrWifiSmeSmeCommonConfigGetReqSerFree }, - { CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ, CsrWifiSmeSmeCommonConfigSetReqSizeof, CsrWifiSmeSmeCommonConfigSetReqSer, CsrWifiSmeSmeCommonConfigSetReqDes, CsrWifiSmeSmeCommonConfigSetReqSerFree }, - { CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ, CsrWifiSmeInterfaceCapabilityGetReqSizeof, CsrWifiSmeInterfaceCapabilityGetReqSer, CsrWifiSmeInterfaceCapabilityGetReqDes, CsrWifiSmeInterfaceCapabilityGetReqSerFree }, - { CSR_WIFI_SME_WPS_CONFIGURATION_REQ, CsrWifiSmeWpsConfigurationReqSizeof, CsrWifiSmeWpsConfigurationReqSer, CsrWifiSmeWpsConfigurationReqDes, CsrWifiSmeWpsConfigurationReqSerFree }, - { CSR_WIFI_SME_SET_REQ, CsrWifiSmeSetReqSizeof, CsrWifiSmeSetReqSer, CsrWifiSmeSetReqDes, CsrWifiSmeSetReqSerFree }, - { CSR_WIFI_SME_ACTIVATE_CFM, CsrWifiSmeActivateCfmSizeof, CsrWifiSmeActivateCfmSer, CsrWifiSmeActivateCfmDes, CsrWifiSmeActivateCfmSerFree }, - { CSR_WIFI_SME_ADHOC_CONFIG_GET_CFM, CsrWifiSmeAdhocConfigGetCfmSizeof, CsrWifiSmeAdhocConfigGetCfmSer, CsrWifiSmeAdhocConfigGetCfmDes, CsrWifiSmeAdhocConfigGetCfmSerFree }, - { CSR_WIFI_SME_ADHOC_CONFIG_SET_CFM, CsrWifiSmeAdhocConfigSetCfmSizeof, CsrWifiSmeAdhocConfigSetCfmSer, CsrWifiSmeAdhocConfigSetCfmDes, CsrWifiSmeAdhocConfigSetCfmSerFree }, - { CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND, CsrWifiSmeAssociationCompleteIndSizeof, CsrWifiSmeAssociationCompleteIndSer, CsrWifiSmeAssociationCompleteIndDes, CsrWifiSmeAssociationCompleteIndSerFree }, - { CSR_WIFI_SME_ASSOCIATION_START_IND, CsrWifiSmeAssociationStartIndSizeof, CsrWifiSmeAssociationStartIndSer, CsrWifiSmeAssociationStartIndDes, CsrWifiSmeAssociationStartIndSerFree }, - { CSR_WIFI_SME_BLACKLIST_CFM, CsrWifiSmeBlacklistCfmSizeof, CsrWifiSmeBlacklistCfmSer, CsrWifiSmeBlacklistCfmDes, CsrWifiSmeBlacklistCfmSerFree }, - { CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM, CsrWifiSmeCalibrationDataGetCfmSizeof, CsrWifiSmeCalibrationDataGetCfmSer, CsrWifiSmeCalibrationDataGetCfmDes, CsrWifiSmeCalibrationDataGetCfmSerFree }, - { CSR_WIFI_SME_CALIBRATION_DATA_SET_CFM, CsrWifiSmeCalibrationDataSetCfmSizeof, CsrWifiSmeCalibrationDataSetCfmSer, CsrWifiSmeCalibrationDataSetCfmDes, CsrWifiSmeCalibrationDataSetCfmSerFree }, - { CSR_WIFI_SME_CCX_CONFIG_GET_CFM, CsrWifiSmeCcxConfigGetCfmSizeof, CsrWifiSmeCcxConfigGetCfmSer, CsrWifiSmeCcxConfigGetCfmDes, CsrWifiSmeCcxConfigGetCfmSerFree }, - { CSR_WIFI_SME_CCX_CONFIG_SET_CFM, CsrWifiSmeCcxConfigSetCfmSizeof, CsrWifiSmeCcxConfigSetCfmSer, CsrWifiSmeCcxConfigSetCfmDes, CsrWifiSmeCcxConfigSetCfmSerFree }, - { CSR_WIFI_SME_COEX_CONFIG_GET_CFM, CsrWifiSmeCoexConfigGetCfmSizeof, CsrWifiSmeCoexConfigGetCfmSer, CsrWifiSmeCoexConfigGetCfmDes, CsrWifiSmeCoexConfigGetCfmSerFree }, - { CSR_WIFI_SME_COEX_CONFIG_SET_CFM, CsrWifiSmeCoexConfigSetCfmSizeof, CsrWifiSmeCoexConfigSetCfmSer, CsrWifiSmeCoexConfigSetCfmDes, CsrWifiSmeCoexConfigSetCfmSerFree }, - { CSR_WIFI_SME_COEX_INFO_GET_CFM, CsrWifiSmeCoexInfoGetCfmSizeof, CsrWifiSmeCoexInfoGetCfmSer, CsrWifiSmeCoexInfoGetCfmDes, CsrWifiSmeCoexInfoGetCfmSerFree }, - { CSR_WIFI_SME_CONNECT_CFM, CsrWifiSmeConnectCfmSizeof, CsrWifiSmeConnectCfmSer, CsrWifiSmeConnectCfmDes, CsrWifiSmeConnectCfmSerFree }, - { CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM, CsrWifiSmeConnectionConfigGetCfmSizeof, CsrWifiSmeConnectionConfigGetCfmSer, CsrWifiSmeConnectionConfigGetCfmDes, CsrWifiSmeConnectionConfigGetCfmSerFree }, - { CSR_WIFI_SME_CONNECTION_INFO_GET_CFM, CsrWifiSmeConnectionInfoGetCfmSizeof, CsrWifiSmeConnectionInfoGetCfmSer, CsrWifiSmeConnectionInfoGetCfmDes, CsrWifiSmeConnectionInfoGetCfmSerFree }, - { CSR_WIFI_SME_CONNECTION_QUALITY_IND, CsrWifiSmeConnectionQualityIndSizeof, CsrWifiSmeConnectionQualityIndSer, CsrWifiSmeConnectionQualityIndDes, CsrWifiSmeConnectionQualityIndSerFree }, - { CSR_WIFI_SME_CONNECTION_STATS_GET_CFM, CsrWifiSmeConnectionStatsGetCfmSizeof, CsrWifiSmeConnectionStatsGetCfmSer, CsrWifiSmeConnectionStatsGetCfmDes, CsrWifiSmeConnectionStatsGetCfmSerFree }, - { CSR_WIFI_SME_DEACTIVATE_CFM, CsrWifiSmeDeactivateCfmSizeof, CsrWifiSmeDeactivateCfmSer, CsrWifiSmeDeactivateCfmDes, CsrWifiSmeDeactivateCfmSerFree }, - { CSR_WIFI_SME_DISCONNECT_CFM, CsrWifiSmeDisconnectCfmSizeof, CsrWifiSmeDisconnectCfmSer, CsrWifiSmeDisconnectCfmDes, CsrWifiSmeDisconnectCfmSerFree }, - { CSR_WIFI_SME_EVENT_MASK_SET_CFM, CsrWifiSmeEventMaskSetCfmSizeof, CsrWifiSmeEventMaskSetCfmSer, CsrWifiSmeEventMaskSetCfmDes, CsrWifiSmeEventMaskSetCfmSerFree }, - { CSR_WIFI_SME_HOST_CONFIG_GET_CFM, CsrWifiSmeHostConfigGetCfmSizeof, CsrWifiSmeHostConfigGetCfmSer, CsrWifiSmeHostConfigGetCfmDes, CsrWifiSmeHostConfigGetCfmSerFree }, - { CSR_WIFI_SME_HOST_CONFIG_SET_CFM, CsrWifiSmeHostConfigSetCfmSizeof, CsrWifiSmeHostConfigSetCfmSer, CsrWifiSmeHostConfigSetCfmDes, CsrWifiSmeHostConfigSetCfmSerFree }, - { CSR_WIFI_SME_IBSS_STATION_IND, CsrWifiSmeIbssStationIndSizeof, CsrWifiSmeIbssStationIndSer, CsrWifiSmeIbssStationIndDes, CsrWifiSmeIbssStationIndSerFree }, - { CSR_WIFI_SME_KEY_CFM, CsrWifiSmeKeyCfmSizeof, CsrWifiSmeKeyCfmSer, CsrWifiSmeKeyCfmDes, CsrWifiSmeKeyCfmSerFree }, - { CSR_WIFI_SME_LINK_QUALITY_GET_CFM, CsrWifiSmeLinkQualityGetCfmSizeof, CsrWifiSmeLinkQualityGetCfmSer, CsrWifiSmeLinkQualityGetCfmDes, CsrWifiSmeLinkQualityGetCfmSerFree }, - { CSR_WIFI_SME_MEDIA_STATUS_IND, CsrWifiSmeMediaStatusIndSizeof, CsrWifiSmeMediaStatusIndSer, CsrWifiSmeMediaStatusIndDes, CsrWifiSmeMediaStatusIndSerFree }, - { CSR_WIFI_SME_MIB_CONFIG_GET_CFM, CsrWifiSmeMibConfigGetCfmSizeof, CsrWifiSmeMibConfigGetCfmSer, CsrWifiSmeMibConfigGetCfmDes, CsrWifiSmeMibConfigGetCfmSerFree }, - { CSR_WIFI_SME_MIB_CONFIG_SET_CFM, CsrWifiSmeMibConfigSetCfmSizeof, CsrWifiSmeMibConfigSetCfmSer, CsrWifiSmeMibConfigSetCfmDes, CsrWifiSmeMibConfigSetCfmSerFree }, - { CSR_WIFI_SME_MIB_GET_CFM, CsrWifiSmeMibGetCfmSizeof, CsrWifiSmeMibGetCfmSer, CsrWifiSmeMibGetCfmDes, CsrWifiSmeMibGetCfmSerFree }, - { CSR_WIFI_SME_MIB_GET_NEXT_CFM, CsrWifiSmeMibGetNextCfmSizeof, CsrWifiSmeMibGetNextCfmSer, CsrWifiSmeMibGetNextCfmDes, CsrWifiSmeMibGetNextCfmSerFree }, - { CSR_WIFI_SME_MIB_SET_CFM, CsrWifiSmeMibSetCfmSizeof, CsrWifiSmeMibSetCfmSer, CsrWifiSmeMibSetCfmDes, CsrWifiSmeMibSetCfmSerFree }, - { CSR_WIFI_SME_MIC_FAILURE_IND, CsrWifiSmeMicFailureIndSizeof, CsrWifiSmeMicFailureIndSer, CsrWifiSmeMicFailureIndDes, CsrWifiSmeMicFailureIndSerFree }, - { CSR_WIFI_SME_MULTICAST_ADDRESS_CFM, CsrWifiSmeMulticastAddressCfmSizeof, CsrWifiSmeMulticastAddressCfmSer, CsrWifiSmeMulticastAddressCfmDes, CsrWifiSmeMulticastAddressCfmSerFree }, - { CSR_WIFI_SME_PACKET_FILTER_SET_CFM, CsrWifiSmePacketFilterSetCfmSizeof, CsrWifiSmePacketFilterSetCfmSer, CsrWifiSmePacketFilterSetCfmDes, CsrWifiSmePacketFilterSetCfmSerFree }, - { CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_CFM, CsrWifiSmePermanentMacAddressGetCfmSizeof, CsrWifiSmePermanentMacAddressGetCfmSer, CsrWifiSmePermanentMacAddressGetCfmDes, CsrWifiSmePermanentMacAddressGetCfmSerFree }, - { CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND, CsrWifiSmePmkidCandidateListIndSizeof, CsrWifiSmePmkidCandidateListIndSer, CsrWifiSmePmkidCandidateListIndDes, CsrWifiSmePmkidCandidateListIndSerFree }, - { CSR_WIFI_SME_PMKID_CFM, CsrWifiSmePmkidCfmSizeof, CsrWifiSmePmkidCfmSer, CsrWifiSmePmkidCfmDes, CsrWifiSmePmkidCfmSerFree }, - { CSR_WIFI_SME_POWER_CONFIG_GET_CFM, CsrWifiSmePowerConfigGetCfmSizeof, CsrWifiSmePowerConfigGetCfmSer, CsrWifiSmePowerConfigGetCfmDes, CsrWifiSmePowerConfigGetCfmSerFree }, - { CSR_WIFI_SME_POWER_CONFIG_SET_CFM, CsrWifiSmePowerConfigSetCfmSizeof, CsrWifiSmePowerConfigSetCfmSer, CsrWifiSmePowerConfigSetCfmDes, CsrWifiSmePowerConfigSetCfmSerFree }, - { CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_CFM, CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof, CsrWifiSmeRegulatoryDomainInfoGetCfmSer, CsrWifiSmeRegulatoryDomainInfoGetCfmDes, CsrWifiSmeRegulatoryDomainInfoGetCfmSerFree }, - { CSR_WIFI_SME_ROAM_COMPLETE_IND, CsrWifiSmeRoamCompleteIndSizeof, CsrWifiSmeRoamCompleteIndSer, CsrWifiSmeRoamCompleteIndDes, CsrWifiSmeRoamCompleteIndSerFree }, - { CSR_WIFI_SME_ROAM_START_IND, CsrWifiSmeRoamStartIndSizeof, CsrWifiSmeRoamStartIndSer, CsrWifiSmeRoamStartIndDes, CsrWifiSmeRoamStartIndSerFree }, - { CSR_WIFI_SME_ROAMING_CONFIG_GET_CFM, CsrWifiSmeRoamingConfigGetCfmSizeof, CsrWifiSmeRoamingConfigGetCfmSer, CsrWifiSmeRoamingConfigGetCfmDes, CsrWifiSmeRoamingConfigGetCfmSerFree }, - { CSR_WIFI_SME_ROAMING_CONFIG_SET_CFM, CsrWifiSmeRoamingConfigSetCfmSizeof, CsrWifiSmeRoamingConfigSetCfmSer, CsrWifiSmeRoamingConfigSetCfmDes, CsrWifiSmeRoamingConfigSetCfmSerFree }, - { CSR_WIFI_SME_SCAN_CONFIG_GET_CFM, CsrWifiSmeScanConfigGetCfmSizeof, CsrWifiSmeScanConfigGetCfmSer, CsrWifiSmeScanConfigGetCfmDes, CsrWifiSmeScanConfigGetCfmSerFree }, - { CSR_WIFI_SME_SCAN_CONFIG_SET_CFM, CsrWifiSmeScanConfigSetCfmSizeof, CsrWifiSmeScanConfigSetCfmSer, CsrWifiSmeScanConfigSetCfmDes, CsrWifiSmeScanConfigSetCfmSerFree }, - { CSR_WIFI_SME_SCAN_FULL_CFM, CsrWifiSmeScanFullCfmSizeof, CsrWifiSmeScanFullCfmSer, CsrWifiSmeScanFullCfmDes, CsrWifiSmeScanFullCfmSerFree }, - { CSR_WIFI_SME_SCAN_RESULT_IND, CsrWifiSmeScanResultIndSizeof, CsrWifiSmeScanResultIndSer, CsrWifiSmeScanResultIndDes, CsrWifiSmeScanResultIndSerFree }, - { CSR_WIFI_SME_SCAN_RESULTS_FLUSH_CFM, CsrWifiSmeScanResultsFlushCfmSizeof, CsrWifiSmeScanResultsFlushCfmSer, CsrWifiSmeScanResultsFlushCfmDes, CsrWifiSmeScanResultsFlushCfmSerFree }, - { CSR_WIFI_SME_SCAN_RESULTS_GET_CFM, CsrWifiSmeScanResultsGetCfmSizeof, CsrWifiSmeScanResultsGetCfmSer, CsrWifiSmeScanResultsGetCfmDes, CsrWifiSmeScanResultsGetCfmSerFree }, - { CSR_WIFI_SME_SME_STA_CONFIG_GET_CFM, CsrWifiSmeSmeStaConfigGetCfmSizeof, CsrWifiSmeSmeStaConfigGetCfmSer, CsrWifiSmeSmeStaConfigGetCfmDes, CsrWifiSmeSmeStaConfigGetCfmSerFree }, - { CSR_WIFI_SME_SME_STA_CONFIG_SET_CFM, CsrWifiSmeSmeStaConfigSetCfmSizeof, CsrWifiSmeSmeStaConfigSetCfmSer, CsrWifiSmeSmeStaConfigSetCfmDes, CsrWifiSmeSmeStaConfigSetCfmSerFree }, - { CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_CFM, CsrWifiSmeStationMacAddressGetCfmSizeof, CsrWifiSmeStationMacAddressGetCfmSer, CsrWifiSmeStationMacAddressGetCfmDes, CsrWifiSmeStationMacAddressGetCfmSerFree }, - { CSR_WIFI_SME_TSPEC_IND, CsrWifiSmeTspecIndSizeof, CsrWifiSmeTspecIndSer, CsrWifiSmeTspecIndDes, CsrWifiSmeTspecIndSerFree }, - { CSR_WIFI_SME_TSPEC_CFM, CsrWifiSmeTspecCfmSizeof, CsrWifiSmeTspecCfmSer, CsrWifiSmeTspecCfmDes, CsrWifiSmeTspecCfmSerFree }, - { CSR_WIFI_SME_VERSIONS_GET_CFM, CsrWifiSmeVersionsGetCfmSizeof, CsrWifiSmeVersionsGetCfmSer, CsrWifiSmeVersionsGetCfmDes, CsrWifiSmeVersionsGetCfmSerFree }, - { CSR_WIFI_SME_WIFI_FLIGHTMODE_CFM, CsrWifiSmeWifiFlightmodeCfmSizeof, CsrWifiSmeWifiFlightmodeCfmSer, CsrWifiSmeWifiFlightmodeCfmDes, CsrWifiSmeWifiFlightmodeCfmSerFree }, - { CSR_WIFI_SME_WIFI_OFF_IND, CsrWifiSmeWifiOffIndSizeof, CsrWifiSmeWifiOffIndSer, CsrWifiSmeWifiOffIndDes, CsrWifiSmeWifiOffIndSerFree }, - { CSR_WIFI_SME_WIFI_OFF_CFM, CsrWifiSmeWifiOffCfmSizeof, CsrWifiSmeWifiOffCfmSer, CsrWifiSmeWifiOffCfmDes, CsrWifiSmeWifiOffCfmSerFree }, - { CSR_WIFI_SME_WIFI_ON_CFM, CsrWifiSmeWifiOnCfmSizeof, CsrWifiSmeWifiOnCfmSer, CsrWifiSmeWifiOnCfmDes, CsrWifiSmeWifiOnCfmSerFree }, - { CSR_WIFI_SME_CLOAKED_SSIDS_SET_CFM, CsrWifiSmeCloakedSsidsSetCfmSizeof, CsrWifiSmeCloakedSsidsSetCfmSer, CsrWifiSmeCloakedSsidsSetCfmDes, CsrWifiSmeCloakedSsidsSetCfmSerFree }, - { CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM, CsrWifiSmeCloakedSsidsGetCfmSizeof, CsrWifiSmeCloakedSsidsGetCfmSer, CsrWifiSmeCloakedSsidsGetCfmDes, CsrWifiSmeCloakedSsidsGetCfmSerFree }, - { CSR_WIFI_SME_WIFI_ON_IND, CsrWifiSmeWifiOnIndSizeof, CsrWifiSmeWifiOnIndSer, CsrWifiSmeWifiOnIndDes, CsrWifiSmeWifiOnIndSerFree }, - { CSR_WIFI_SME_SME_COMMON_CONFIG_GET_CFM, CsrWifiSmeSmeCommonConfigGetCfmSizeof, CsrWifiSmeSmeCommonConfigGetCfmSer, CsrWifiSmeSmeCommonConfigGetCfmDes, CsrWifiSmeSmeCommonConfigGetCfmSerFree }, - { CSR_WIFI_SME_SME_COMMON_CONFIG_SET_CFM, CsrWifiSmeSmeCommonConfigSetCfmSizeof, CsrWifiSmeSmeCommonConfigSetCfmSer, CsrWifiSmeSmeCommonConfigSetCfmDes, CsrWifiSmeSmeCommonConfigSetCfmSerFree }, - { CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM, CsrWifiSmeInterfaceCapabilityGetCfmSizeof, CsrWifiSmeInterfaceCapabilityGetCfmSer, CsrWifiSmeInterfaceCapabilityGetCfmDes, CsrWifiSmeInterfaceCapabilityGetCfmSerFree }, - { CSR_WIFI_SME_ERROR_IND, CsrWifiSmeErrorIndSizeof, CsrWifiSmeErrorIndSer, CsrWifiSmeErrorIndDes, CsrWifiSmeErrorIndSerFree }, - { CSR_WIFI_SME_INFO_IND, CsrWifiSmeInfoIndSizeof, CsrWifiSmeInfoIndSer, CsrWifiSmeInfoIndDes, CsrWifiSmeInfoIndSerFree }, - { CSR_WIFI_SME_CORE_DUMP_IND, CsrWifiSmeCoreDumpIndSizeof, CsrWifiSmeCoreDumpIndSer, CsrWifiSmeCoreDumpIndDes, CsrWifiSmeCoreDumpIndSerFree }, - { CSR_WIFI_SME_AMP_STATUS_CHANGE_IND, CsrWifiSmeAmpStatusChangeIndSizeof, CsrWifiSmeAmpStatusChangeIndSer, CsrWifiSmeAmpStatusChangeIndDes, CsrWifiSmeAmpStatusChangeIndSerFree }, - { CSR_WIFI_SME_WPS_CONFIGURATION_CFM, CsrWifiSmeWpsConfigurationCfmSizeof, CsrWifiSmeWpsConfigurationCfmSer, CsrWifiSmeWpsConfigurationCfmDes, CsrWifiSmeWpsConfigurationCfmSerFree }, - - { 0, NULL, NULL, NULL, NULL }, -}; - -CsrMsgConvMsgEntry* CsrWifiSmeConverterLookup(CsrMsgConvMsgEntry *ce, u16 msgType) -{ - if (msgType & CSR_PRIM_UPSTREAM) - { - u16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT; - if (idx < (CSR_WIFI_SME_PRIM_UPSTREAM_COUNT + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT) && - csrwifisme_conv_lut[idx].msgType == msgType) - { - return &csrwifisme_conv_lut[idx]; - } - } - else - { - if (msgType < CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT && - csrwifisme_conv_lut[msgType].msgType == msgType) - { - return &csrwifisme_conv_lut[msgType]; - } - } - return NULL; -} - - -void CsrWifiSmeConverterInit(void) -{ - CsrMsgConvInsert(CSR_WIFI_SME_PRIM, csrwifisme_conv_lut); - CsrMsgConvCustomLookupRegister(CSR_WIFI_SME_PRIM, CsrWifiSmeConverterLookup); -} - - -#ifdef CSR_LOG_ENABLE -static const CsrLogPrimitiveInformation csrwifisme_conv_info = { - CSR_WIFI_SME_PRIM, - (char *)"CSR_WIFI_SME_PRIM", - csrwifisme_conv_lut -}; -const CsrLogPrimitiveInformation* CsrWifiSmeTechInfoGet(void) -{ - return &csrwifisme_conv_info; -} - - -#endif /* CSR_LOG_ENABLE */ -#endif /* EXCLUDE_CSR_WIFI_SME_MODULE */ diff --git a/drivers/staging/csr/csr_wifi_sme_converter_init.h b/drivers/staging/csr/csr_wifi_sme_converter_init.h deleted file mode 100644 index ba5e4b44bb6b..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_converter_init.h +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_SME_CONVERTER_INIT_H__ -#define CSR_WIFI_SME_CONVERTER_INIT_H__ - -#ifndef EXCLUDE_CSR_WIFI_SME_MODULE - -#include "csr_msgconv.h" - -#ifdef CSR_LOG_ENABLE -#include "csr_log.h" - -extern const CsrLogPrimitiveInformation* CsrWifiSmeTechInfoGet(void); -#endif /* CSR_LOG_ENABLE */ - -extern void CsrWifiSmeConverterInit(void); - -#else /* EXCLUDE_CSR_WIFI_SME_MODULE */ - -#define CsrWifiSmeConverterInit() - -#endif /* EXCLUDE_CSR_WIFI_SME_MODULE */ - -#endif /* CSR_WIFI_SME_CONVERTER_INIT_H__ */ diff --git a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c deleted file mode 100644 index 03b5ddb22cd7..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c +++ /dev/null @@ -1,187 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ -#include <linux/slab.h> -#include "csr_wifi_sme_prim.h" -#include "csr_wifi_sme_lib.h" - -/*----------------------------------------------------------------------------* - * NAME - * CsrWifiSmeFreeDownstreamMessageContents - * - * DESCRIPTION - * - * - * PARAMETERS - * eventClass: only the value CSR_WIFI_SME_PRIM will be handled - * message: the message to free - *----------------------------------------------------------------------------*/ -void CsrWifiSmeFreeDownstreamMessageContents(u16 eventClass, void *message) -{ - if (eventClass != CSR_WIFI_SME_PRIM) - { - return; - } - if (NULL == message) - { - return; - } - - switch (*((CsrWifiSmePrim *) message)) - { - case CSR_WIFI_SME_BLACKLIST_REQ: - { - CsrWifiSmeBlacklistReq *p = (CsrWifiSmeBlacklistReq *)message; - kfree(p->setAddresses); - p->setAddresses = NULL; - break; - } - case CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ: - { - CsrWifiSmeCalibrationDataSetReq *p = (CsrWifiSmeCalibrationDataSetReq *)message; - kfree(p->calibrationData); - p->calibrationData = NULL; - break; - } - case CSR_WIFI_SME_CONNECT_REQ: - { - CsrWifiSmeConnectReq *p = (CsrWifiSmeConnectReq *)message; - kfree(p->connectionConfig.mlmeAssociateReqInformationElements); - p->connectionConfig.mlmeAssociateReqInformationElements = NULL; - break; - } - case CSR_WIFI_SME_MIB_GET_NEXT_REQ: - { - CsrWifiSmeMibGetNextReq *p = (CsrWifiSmeMibGetNextReq *)message; - kfree(p->mibAttribute); - p->mibAttribute = NULL; - break; - } - case CSR_WIFI_SME_MIB_GET_REQ: - { - CsrWifiSmeMibGetReq *p = (CsrWifiSmeMibGetReq *)message; - kfree(p->mibAttribute); - p->mibAttribute = NULL; - break; - } - case CSR_WIFI_SME_MIB_SET_REQ: - { - CsrWifiSmeMibSetReq *p = (CsrWifiSmeMibSetReq *)message; - kfree(p->mibAttribute); - p->mibAttribute = NULL; - break; - } - case CSR_WIFI_SME_MULTICAST_ADDRESS_REQ: - { - CsrWifiSmeMulticastAddressReq *p = (CsrWifiSmeMulticastAddressReq *)message; - kfree(p->setAddresses); - p->setAddresses = NULL; - break; - } - case CSR_WIFI_SME_PACKET_FILTER_SET_REQ: - { - CsrWifiSmePacketFilterSetReq *p = (CsrWifiSmePacketFilterSetReq *)message; - kfree(p->filter); - p->filter = NULL; - break; - } - case CSR_WIFI_SME_PMKID_REQ: - { - CsrWifiSmePmkidReq *p = (CsrWifiSmePmkidReq *)message; - kfree(p->setPmkids); - p->setPmkids = NULL; - break; - } - case CSR_WIFI_SME_SCAN_CONFIG_SET_REQ: - { - CsrWifiSmeScanConfigSetReq *p = (CsrWifiSmeScanConfigSetReq *)message; - kfree(p->scanConfig.passiveChannelList); - p->scanConfig.passiveChannelList = NULL; - break; - } - case CSR_WIFI_SME_SCAN_FULL_REQ: - { - CsrWifiSmeScanFullReq *p = (CsrWifiSmeScanFullReq *)message; - kfree(p->ssid); - p->ssid = NULL; - kfree(p->channelList); - p->channelList = NULL; - kfree(p->probeIe); - p->probeIe = NULL; - break; - } - case CSR_WIFI_SME_TSPEC_REQ: - { - CsrWifiSmeTspecReq *p = (CsrWifiSmeTspecReq *)message; - kfree(p->tspec); - p->tspec = NULL; - kfree(p->tclas); - p->tclas = NULL; - break; - } - case CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ: - { - CsrWifiSmeWifiFlightmodeReq *p = (CsrWifiSmeWifiFlightmodeReq *)message; - { - u16 i1; - for (i1 = 0; i1 < p->mibFilesCount; i1++) - { - kfree(p->mibFiles[i1].data); - p->mibFiles[i1].data = NULL; - } - } - kfree(p->mibFiles); - p->mibFiles = NULL; - break; - } - case CSR_WIFI_SME_WIFI_ON_REQ: - { - CsrWifiSmeWifiOnReq *p = (CsrWifiSmeWifiOnReq *)message; - { - u16 i1; - for (i1 = 0; i1 < p->mibFilesCount; i1++) - { - kfree(p->mibFiles[i1].data); - p->mibFiles[i1].data = NULL; - } - } - kfree(p->mibFiles); - p->mibFiles = NULL; - break; - } - case CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ: - { - CsrWifiSmeCloakedSsidsSetReq *p = (CsrWifiSmeCloakedSsidsSetReq *)message; - kfree(p->cloakedSsids.cloakedSsids); - p->cloakedSsids.cloakedSsids = NULL; - break; - } - case CSR_WIFI_SME_WPS_CONFIGURATION_REQ: - { - CsrWifiSmeWpsConfigurationReq *p = (CsrWifiSmeWpsConfigurationReq *)message; - kfree(p->wpsConfig.secondaryDeviceType); - p->wpsConfig.secondaryDeviceType = NULL; - break; - } - case CSR_WIFI_SME_SET_REQ: - { - CsrWifiSmeSetReq *p = (CsrWifiSmeSetReq *)message; - kfree(p->data); - p->data = NULL; - break; - } - - default: - break; - } -} - - diff --git a/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c deleted file mode 100644 index c04767baaa5b..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c +++ /dev/null @@ -1,275 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ -#include <linux/slab.h> -#include "csr_wifi_sme_prim.h" -#include "csr_wifi_sme_lib.h" - -/*----------------------------------------------------------------------------* - * NAME - * CsrWifiSmeFreeUpstreamMessageContents - * - * DESCRIPTION - * - * - * PARAMETERS - * eventClass: only the value CSR_WIFI_SME_PRIM will be handled - * message: the message to free - *----------------------------------------------------------------------------*/ -void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message) -{ - if (eventClass != CSR_WIFI_SME_PRIM) - { - return; - } - if (NULL == message) - { - return; - } - - switch (*((CsrWifiSmePrim *) message)) - { - case CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND: - { - CsrWifiSmeAssociationCompleteInd *p = (CsrWifiSmeAssociationCompleteInd *)message; - kfree(p->connectionInfo.beaconFrame); - p->connectionInfo.beaconFrame = NULL; - kfree(p->connectionInfo.associationReqFrame); - p->connectionInfo.associationReqFrame = NULL; - kfree(p->connectionInfo.associationRspFrame); - p->connectionInfo.associationRspFrame = NULL; - kfree(p->connectionInfo.assocScanInfoElements); - p->connectionInfo.assocScanInfoElements = NULL; - kfree(p->connectionInfo.assocReqInfoElements); - p->connectionInfo.assocReqInfoElements = NULL; - kfree(p->connectionInfo.assocRspInfoElements); - p->connectionInfo.assocRspInfoElements = NULL; - break; - } - case CSR_WIFI_SME_BLACKLIST_CFM: - { - CsrWifiSmeBlacklistCfm *p = (CsrWifiSmeBlacklistCfm *)message; - kfree(p->getAddresses); - p->getAddresses = NULL; - break; - } - case CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM: - { - CsrWifiSmeCalibrationDataGetCfm *p = (CsrWifiSmeCalibrationDataGetCfm *)message; - kfree(p->calibrationData); - p->calibrationData = NULL; - break; - } - case CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM: - { - CsrWifiSmeConnectionConfigGetCfm *p = (CsrWifiSmeConnectionConfigGetCfm *)message; - kfree(p->connectionConfig.mlmeAssociateReqInformationElements); - p->connectionConfig.mlmeAssociateReqInformationElements = NULL; - break; - } - case CSR_WIFI_SME_CONNECTION_INFO_GET_CFM: - { - CsrWifiSmeConnectionInfoGetCfm *p = (CsrWifiSmeConnectionInfoGetCfm *)message; - kfree(p->connectionInfo.beaconFrame); - p->connectionInfo.beaconFrame = NULL; - kfree(p->connectionInfo.associationReqFrame); - p->connectionInfo.associationReqFrame = NULL; - kfree(p->connectionInfo.associationRspFrame); - p->connectionInfo.associationRspFrame = NULL; - kfree(p->connectionInfo.assocScanInfoElements); - p->connectionInfo.assocScanInfoElements = NULL; - kfree(p->connectionInfo.assocReqInfoElements); - p->connectionInfo.assocReqInfoElements = NULL; - kfree(p->connectionInfo.assocRspInfoElements); - p->connectionInfo.assocRspInfoElements = NULL; - break; - } - case CSR_WIFI_SME_MEDIA_STATUS_IND: - { - CsrWifiSmeMediaStatusInd *p = (CsrWifiSmeMediaStatusInd *)message; - kfree(p->connectionInfo.beaconFrame); - p->connectionInfo.beaconFrame = NULL; - kfree(p->connectionInfo.associationReqFrame); - p->connectionInfo.associationReqFrame = NULL; - kfree(p->connectionInfo.associationRspFrame); - p->connectionInfo.associationRspFrame = NULL; - kfree(p->connectionInfo.assocScanInfoElements); - p->connectionInfo.assocScanInfoElements = NULL; - kfree(p->connectionInfo.assocReqInfoElements); - p->connectionInfo.assocReqInfoElements = NULL; - kfree(p->connectionInfo.assocRspInfoElements); - p->connectionInfo.assocRspInfoElements = NULL; - break; - } - case CSR_WIFI_SME_MIB_GET_CFM: - { - CsrWifiSmeMibGetCfm *p = (CsrWifiSmeMibGetCfm *)message; - kfree(p->mibAttribute); - p->mibAttribute = NULL; - break; - } - case CSR_WIFI_SME_MIB_GET_NEXT_CFM: - { - CsrWifiSmeMibGetNextCfm *p = (CsrWifiSmeMibGetNextCfm *)message; - kfree(p->mibAttribute); - p->mibAttribute = NULL; - break; - } - case CSR_WIFI_SME_MULTICAST_ADDRESS_CFM: - { - CsrWifiSmeMulticastAddressCfm *p = (CsrWifiSmeMulticastAddressCfm *)message; - kfree(p->getAddresses); - p->getAddresses = NULL; - break; - } - case CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND: - { - CsrWifiSmePmkidCandidateListInd *p = (CsrWifiSmePmkidCandidateListInd *)message; - kfree(p->pmkidCandidates); - p->pmkidCandidates = NULL; - break; - } - case CSR_WIFI_SME_PMKID_CFM: - { - CsrWifiSmePmkidCfm *p = (CsrWifiSmePmkidCfm *)message; - kfree(p->getPmkids); - p->getPmkids = NULL; - break; - } - case CSR_WIFI_SME_SCAN_CONFIG_GET_CFM: - { - CsrWifiSmeScanConfigGetCfm *p = (CsrWifiSmeScanConfigGetCfm *)message; - kfree(p->scanConfig.passiveChannelList); - p->scanConfig.passiveChannelList = NULL; - break; - } - case CSR_WIFI_SME_SCAN_RESULT_IND: - { - CsrWifiSmeScanResultInd *p = (CsrWifiSmeScanResultInd *)message; - kfree(p->result.informationElements); - p->result.informationElements = NULL; - switch (p->result.p2pDeviceRole) - { - case CSR_WIFI_SME_P2P_ROLE_GO: - { - u16 i4; - for (i4 = 0; i4 < p->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) - { - kfree(p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); - p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; - } - } - kfree(p->result.deviceInfo.groupInfo.p2PClientInfo); - p->result.deviceInfo.groupInfo.p2PClientInfo = NULL; - break; - case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - kfree(p->result.deviceInfo.standalonedevInfo.secDeviceType); - p->result.deviceInfo.standalonedevInfo.secDeviceType = NULL; - break; - default: - break; - } - break; - } - case CSR_WIFI_SME_SCAN_RESULTS_GET_CFM: - { - CsrWifiSmeScanResultsGetCfm *p = (CsrWifiSmeScanResultsGetCfm *)message; - { - u16 i1; - for (i1 = 0; i1 < p->scanResultsCount; i1++) - { - kfree(p->scanResults[i1].informationElements); - p->scanResults[i1].informationElements = NULL; - switch (p->scanResults[i1].p2pDeviceRole) - { - case CSR_WIFI_SME_P2P_ROLE_GO: - { - u16 i4; - for (i4 = 0; i4 < p->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) - { - kfree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); - p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; - } - } - kfree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo); - p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = NULL; - break; - case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - kfree(p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType); - p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = NULL; - break; - default: - break; - } - } - } - kfree(p->scanResults); - p->scanResults = NULL; - break; - } - case CSR_WIFI_SME_TSPEC_IND: - { - CsrWifiSmeTspecInd *p = (CsrWifiSmeTspecInd *)message; - kfree(p->tspec); - p->tspec = NULL; - break; - } - case CSR_WIFI_SME_TSPEC_CFM: - { - CsrWifiSmeTspecCfm *p = (CsrWifiSmeTspecCfm *)message; - kfree(p->tspec); - p->tspec = NULL; - break; - } - case CSR_WIFI_SME_VERSIONS_GET_CFM: - { - CsrWifiSmeVersionsGetCfm *p = (CsrWifiSmeVersionsGetCfm *)message; - kfree(p->versions.routerBuild); - p->versions.routerBuild = NULL; - kfree(p->versions.smeBuild); - p->versions.smeBuild = NULL; - break; - } - case CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM: - { - CsrWifiSmeCloakedSsidsGetCfm *p = (CsrWifiSmeCloakedSsidsGetCfm *)message; - kfree(p->cloakedSsids.cloakedSsids); - p->cloakedSsids.cloakedSsids = NULL; - break; - } - case CSR_WIFI_SME_ERROR_IND: - { - CsrWifiSmeErrorInd *p = (CsrWifiSmeErrorInd *)message; - kfree(p->errorMessage); - p->errorMessage = NULL; - break; - } - case CSR_WIFI_SME_INFO_IND: - { - CsrWifiSmeInfoInd *p = (CsrWifiSmeInfoInd *)message; - kfree(p->infoMessage); - p->infoMessage = NULL; - break; - } - case CSR_WIFI_SME_CORE_DUMP_IND: - { - CsrWifiSmeCoreDumpInd *p = (CsrWifiSmeCoreDumpInd *)message; - kfree(p->data); - p->data = NULL; - break; - } - - default: - break; - } -} - - diff --git a/drivers/staging/csr/csr_wifi_sme_lib.h b/drivers/staging/csr/csr_wifi_sme_lib.h deleted file mode 100644 index 53cf1268286e..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_lib.h +++ /dev/null @@ -1,4303 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_SME_LIB_H__ -#define CSR_WIFI_SME_LIB_H__ - -#include "csr_sched.h" -#include "csr_macro.h" -#include "csr_msg_transport.h" - -#include "csr_wifi_lib.h" - -#include "csr_wifi_sme_prim.h" -#include "csr_wifi_sme_task.h" - - -#ifndef CSR_WIFI_SME_LIB_DESTINATION_QUEUE -# ifdef CSR_WIFI_NME_ENABLE -# include "csr_wifi_nme_task.h" -# define CSR_WIFI_SME_LIB_DESTINATION_QUEUE CSR_WIFI_NME_IFACEQUEUE -# else -# define CSR_WIFI_SME_LIB_DESTINATION_QUEUE CSR_WIFI_SME_IFACEQUEUE -# endif -#endif - -/*----------------------------------------------------------------------------* - * CsrWifiSmeFreeUpstreamMessageContents - * - * DESCRIPTION - * Free the allocated memory in a CSR_WIFI_SME upstream message. Does not - * free the message itself, and can only be used for upstream messages. - * - * PARAMETERS - * Deallocates the resources in a CSR_WIFI_SME upstream message - *----------------------------------------------------------------------------*/ -void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message); - -/*----------------------------------------------------------------------------* - * CsrWifiSmeFreeDownstreamMessageContents - * - * DESCRIPTION - * Free the allocated memory in a CSR_WIFI_SME downstream message. Does not - * free the message itself, and can only be used for downstream messages. - * - * PARAMETERS - * Deallocates the resources in a CSR_WIFI_SME downstream message - *----------------------------------------------------------------------------*/ -void CsrWifiSmeFreeDownstreamMessageContents(u16 eventClass, void *message); - -/*----------------------------------------------------------------------------* - * Enum to string functions - *----------------------------------------------------------------------------*/ -const char* CsrWifiSme80211NetworkTypeToString(CsrWifiSme80211NetworkType value); -const char* CsrWifiSme80211PrivacyModeToString(CsrWifiSme80211PrivacyMode value); -const char* CsrWifiSme80211dTrustLevelToString(CsrWifiSme80211dTrustLevel value); -const char* CsrWifiSmeAmpStatusToString(CsrWifiSmeAmpStatus value); -const char* CsrWifiSmeAuthModeToString(CsrWifiSmeAuthMode value); -const char* CsrWifiSmeBasicUsabilityToString(CsrWifiSmeBasicUsability value); -const char* CsrWifiSmeBssTypeToString(CsrWifiSmeBssType value); -const char* CsrWifiSmeCoexSchemeToString(CsrWifiSmeCoexScheme value); -const char* CsrWifiSmeControlIndicationToString(CsrWifiSmeControlIndication value); -const char* CsrWifiSmeCtsProtectionTypeToString(CsrWifiSmeCtsProtectionType value); -const char* CsrWifiSmeD3AutoScanModeToString(CsrWifiSmeD3AutoScanMode value); -const char* CsrWifiSmeEncryptionToString(CsrWifiSmeEncryption value); -const char* CsrWifiSmeFirmwareDriverInterfaceToString(CsrWifiSmeFirmwareDriverInterface value); -const char* CsrWifiSmeHostPowerModeToString(CsrWifiSmeHostPowerMode value); -const char* CsrWifiSmeIEEE80211ReasonToString(CsrWifiSmeIEEE80211Reason value); -const char* CsrWifiSmeIEEE80211ResultToString(CsrWifiSmeIEEE80211Result value); -const char* CsrWifiSmeIndicationsToString(CsrWifiSmeIndications value); -const char* CsrWifiSmeKeyTypeToString(CsrWifiSmeKeyType value); -const char* CsrWifiSmeListActionToString(CsrWifiSmeListAction value); -const char* CsrWifiSmeMediaStatusToString(CsrWifiSmeMediaStatus value); -const char* CsrWifiSmeP2pCapabilityToString(CsrWifiSmeP2pCapability value); -const char* CsrWifiSmeP2pGroupCapabilityToString(CsrWifiSmeP2pGroupCapability value); -const char* CsrWifiSmeP2pNoaConfigMethodToString(CsrWifiSmeP2pNoaConfigMethod value); -const char* CsrWifiSmeP2pRoleToString(CsrWifiSmeP2pRole value); -const char* CsrWifiSmeP2pStatusToString(CsrWifiSmeP2pStatus value); -const char* CsrWifiSmePacketFilterModeToString(CsrWifiSmePacketFilterMode value); -const char* CsrWifiSmePowerSaveLevelToString(CsrWifiSmePowerSaveLevel value); -const char* CsrWifiSmePreambleTypeToString(CsrWifiSmePreambleType value); -const char* CsrWifiSmeRadioIFToString(CsrWifiSmeRadioIF value); -const char* CsrWifiSmeRegulatoryDomainToString(CsrWifiSmeRegulatoryDomain value); -const char* CsrWifiSmeRoamReasonToString(CsrWifiSmeRoamReason value); -const char* CsrWifiSmeScanTypeToString(CsrWifiSmeScanType value); -const char* CsrWifiSmeTrafficTypeToString(CsrWifiSmeTrafficType value); -const char* CsrWifiSmeTspecCtrlToString(CsrWifiSmeTspecCtrl value); -const char* CsrWifiSmeTspecResultCodeToString(CsrWifiSmeTspecResultCode value); -const char* CsrWifiSmeWepAuthModeToString(CsrWifiSmeWepAuthMode value); -const char* CsrWifiSmeWepCredentialTypeToString(CsrWifiSmeWepCredentialType value); -const char* CsrWifiSmeWmmModeToString(CsrWifiSmeWmmMode value); -const char* CsrWifiSmeWmmQosInfoToString(CsrWifiSmeWmmQosInfo value); -const char* CsrWifiSmeWpsConfigTypeToString(CsrWifiSmeWpsConfigType value); -const char* CsrWifiSmeWpsDeviceCategoryToString(CsrWifiSmeWpsDeviceCategory value); -const char* CsrWifiSmeWpsDeviceSubCategoryToString(CsrWifiSmeWpsDeviceSubCategory value); -const char* CsrWifiSmeWpsDpidToString(CsrWifiSmeWpsDpid value); -const char* CsrWifiSmeWpsRegistrationToString(CsrWifiSmeWpsRegistration value); - - -/*----------------------------------------------------------------------------* - * CsrPrim Type toString function. - * Converts a message type to the String name of the Message - *----------------------------------------------------------------------------*/ -const char* CsrWifiSmePrimTypeToString(CsrPrim msgType); - -/*----------------------------------------------------------------------------* - * Lookup arrays for PrimType name Strings - *----------------------------------------------------------------------------*/ -extern const char *CsrWifiSmeUpstreamPrimNames[CSR_WIFI_SME_PRIM_UPSTREAM_COUNT]; -extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT]; - -/******************************************************************************* - - NAME - CsrWifiSmeActivateReqSend - - DESCRIPTION - The WMA sends this primitive to activate the SME. - The WMA must activate the SME before it can send any other primitive. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeActivateReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeActivateReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ACTIVATE_REQ, dst__, src__); - -#define CsrWifiSmeActivateReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeActivateReq *msg__; \ - CsrWifiSmeActivateReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeActivateReqSend(src__) \ - CsrWifiSmeActivateReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeActivateCfmSend - - DESCRIPTION - The SME sends this primitive when the activation is complete. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeActivateCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeActivateCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ACTIVATE_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeActivateCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeActivateCfm *msg__; \ - CsrWifiSmeActivateCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeActivateCfmSend(dst__, status__) \ - CsrWifiSmeActivateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeAdhocConfigGetReqSend - - DESCRIPTION - This primitive gets the value of the adHocConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeAdhocConfigGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_GET_REQ, dst__, src__); - -#define CsrWifiSmeAdhocConfigGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeAdhocConfigGetReq *msg__; \ - CsrWifiSmeAdhocConfigGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeAdhocConfigGetReqSend(src__) \ - CsrWifiSmeAdhocConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeAdhocConfigGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - adHocConfig - Contains the values used when starting an Ad-hoc (IBSS) - connection. - -*******************************************************************************/ -#define CsrWifiSmeAdhocConfigGetCfmCreate(msg__, dst__, src__, status__, adHocConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->adHocConfig = (adHocConfig__); - -#define CsrWifiSmeAdhocConfigGetCfmSendTo(dst__, src__, status__, adHocConfig__) \ - { \ - CsrWifiSmeAdhocConfigGetCfm *msg__; \ - CsrWifiSmeAdhocConfigGetCfmCreate(msg__, dst__, src__, status__, adHocConfig__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeAdhocConfigGetCfmSend(dst__, status__, adHocConfig__) \ - CsrWifiSmeAdhocConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, adHocConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeAdhocConfigSetReqSend - - DESCRIPTION - This primitive sets the value of the adHocConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - adHocConfig - Sets the values to use when starting an ad hoc network. - -*******************************************************************************/ -#define CsrWifiSmeAdhocConfigSetReqCreate(msg__, dst__, src__, adHocConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_SET_REQ, dst__, src__); \ - msg__->adHocConfig = (adHocConfig__); - -#define CsrWifiSmeAdhocConfigSetReqSendTo(dst__, src__, adHocConfig__) \ - { \ - CsrWifiSmeAdhocConfigSetReq *msg__; \ - CsrWifiSmeAdhocConfigSetReqCreate(msg__, dst__, src__, adHocConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeAdhocConfigSetReqSend(src__, adHocConfig__) \ - CsrWifiSmeAdhocConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, adHocConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeAdhocConfigSetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeAdhocConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeAdhocConfigSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeAdhocConfigSetCfm *msg__; \ - CsrWifiSmeAdhocConfigSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeAdhocConfigSetCfmSend(dst__, status__) \ - CsrWifiSmeAdhocConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeAmpStatusChangeIndSend - - DESCRIPTION - Indication of change to AMP activity. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface on which the AMP activity changed. - ampStatus - The new status of AMP activity.Range: {AMP_ACTIVE, - AMP_INACTIVE}. - -*******************************************************************************/ -#define CsrWifiSmeAmpStatusChangeIndCreate(msg__, dst__, src__, interfaceTag__, ampStatus__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeAmpStatusChangeInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_AMP_STATUS_CHANGE_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->ampStatus = (ampStatus__); - -#define CsrWifiSmeAmpStatusChangeIndSendTo(dst__, src__, interfaceTag__, ampStatus__) \ - { \ - CsrWifiSmeAmpStatusChangeInd *msg__; \ - CsrWifiSmeAmpStatusChangeIndCreate(msg__, dst__, src__, interfaceTag__, ampStatus__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeAmpStatusChangeIndSend(dst__, interfaceTag__, ampStatus__) \ - CsrWifiSmeAmpStatusChangeIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, ampStatus__) - -/******************************************************************************* - - NAME - CsrWifiSmeAssociationCompleteIndSend - - DESCRIPTION - The SME will send this primitive to all the tasks that have registered to - receive it whenever it completes an attempt to associate with an AP. If - the association was successful, status will be set to - CSR_WIFI_SME_STATUS_SUCCESS, otherwise status and deauthReason shall be - set to appropriate error codes. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the association procedure - connectionInfo - This parameter is relevant only if result is - CSR_WIFI_SME_STATUS_SUCCESS: - it points to the connection information for the new network - deauthReason - This parameter is relevant only if result is not - CSR_WIFI_SME_STATUS_SUCCESS: - if the AP deauthorised the station, it gives the reason of - the deauthorization - -*******************************************************************************/ -#define CsrWifiSmeAssociationCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeAssociationCompleteInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->connectionInfo = (connectionInfo__); \ - msg__->deauthReason = (deauthReason__); - -#define CsrWifiSmeAssociationCompleteIndSendTo(dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__) \ - { \ - CsrWifiSmeAssociationCompleteInd *msg__; \ - CsrWifiSmeAssociationCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeAssociationCompleteIndSend(dst__, interfaceTag__, status__, connectionInfo__, deauthReason__) \ - CsrWifiSmeAssociationCompleteIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionInfo__, deauthReason__) - -/******************************************************************************* - - NAME - CsrWifiSmeAssociationStartIndSend - - DESCRIPTION - The SME will send this primitive to all the tasks that have registered to - receive it whenever it begins an attempt to associate with an AP. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - address - BSSID of the associating network - ssid - Service Set identifier of the associating network - -*******************************************************************************/ -#define CsrWifiSmeAssociationStartIndCreate(msg__, dst__, src__, interfaceTag__, address__, ssid__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeAssociationStartInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ASSOCIATION_START_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->address = (address__); \ - msg__->ssid = (ssid__); - -#define CsrWifiSmeAssociationStartIndSendTo(dst__, src__, interfaceTag__, address__, ssid__) \ - { \ - CsrWifiSmeAssociationStartInd *msg__; \ - CsrWifiSmeAssociationStartIndCreate(msg__, dst__, src__, interfaceTag__, address__, ssid__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeAssociationStartIndSend(dst__, interfaceTag__, address__, ssid__) \ - CsrWifiSmeAssociationStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, address__, ssid__) - -/******************************************************************************* - - NAME - CsrWifiSmeBlacklistReqSend - - DESCRIPTION - The wireless manager application should call this primitive to notify the - driver of any networks that should not be connected to. The interface - allows the wireless manager application to query, add, remove, and flush - the BSSIDs that the driver may not connect or roam to. - When this primitive adds to the black list the BSSID to which the SME is - currently connected, the SME will try to roam, if applicable, to another - BSSID in the same ESS; if the roaming procedure fails, the SME will - disconnect. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - action - The value of the CsrWifiSmeListAction parameter instructs - the driver to modify or provide the list of blacklisted - networks. - setAddressCount - Number of BSSIDs sent with this primitive - setAddresses - Pointer to the list of BBSIDs sent with the primitive, set - to NULL if none is sent. - -*******************************************************************************/ -#define CsrWifiSmeBlacklistReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeBlacklistReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_BLACKLIST_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->action = (action__); \ - msg__->setAddressCount = (setAddressCount__); \ - msg__->setAddresses = (setAddresses__); - -#define CsrWifiSmeBlacklistReqSendTo(dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \ - { \ - CsrWifiSmeBlacklistReq *msg__; \ - CsrWifiSmeBlacklistReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeBlacklistReqSend(src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \ - CsrWifiSmeBlacklistReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, setAddressCount__, setAddresses__) - -/******************************************************************************* - - NAME - CsrWifiSmeBlacklistCfmSend - - DESCRIPTION - The SME will call this primitive when the action on the blacklist has - completed. For a GET action, this primitive also reports the list of - BBSIDs in the blacklist. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - action - Action in the request - getAddressCount - This parameter is only relevant if action is - CSR_WIFI_SME_LIST_ACTION_GET: - number of BSSIDs sent with this primitive - getAddresses - Pointer to the list of BBSIDs sent with the primitive, set - to NULL if none is sent. - -*******************************************************************************/ -#define CsrWifiSmeBlacklistCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeBlacklistCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_BLACKLIST_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->action = (action__); \ - msg__->getAddressCount = (getAddressCount__); \ - msg__->getAddresses = (getAddresses__); - -#define CsrWifiSmeBlacklistCfmSendTo(dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \ - { \ - CsrWifiSmeBlacklistCfm *msg__; \ - CsrWifiSmeBlacklistCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeBlacklistCfmSend(dst__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \ - CsrWifiSmeBlacklistCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) - -/******************************************************************************* - - NAME - CsrWifiSmeCalibrationDataGetReqSend - - DESCRIPTION - This primitive retrieves the Wi-Fi radio calibration data. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeCalibrationDataGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_GET_REQ, dst__, src__); - -#define CsrWifiSmeCalibrationDataGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeCalibrationDataGetReq *msg__; \ - CsrWifiSmeCalibrationDataGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCalibrationDataGetReqSend(src__) \ - CsrWifiSmeCalibrationDataGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeCalibrationDataGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - calibrationDataLength - Number of bytes in the buffer pointed by - calibrationData - calibrationData - Pointer to a buffer of length calibrationDataLength - containing the calibration data - -*******************************************************************************/ -#define CsrWifiSmeCalibrationDataGetCfmCreate(msg__, dst__, src__, status__, calibrationDataLength__, calibrationData__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->calibrationDataLength = (calibrationDataLength__); \ - msg__->calibrationData = (calibrationData__); - -#define CsrWifiSmeCalibrationDataGetCfmSendTo(dst__, src__, status__, calibrationDataLength__, calibrationData__) \ - { \ - CsrWifiSmeCalibrationDataGetCfm *msg__; \ - CsrWifiSmeCalibrationDataGetCfmCreate(msg__, dst__, src__, status__, calibrationDataLength__, calibrationData__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCalibrationDataGetCfmSend(dst__, status__, calibrationDataLength__, calibrationData__) \ - CsrWifiSmeCalibrationDataGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, calibrationDataLength__, calibrationData__) - -/******************************************************************************* - - NAME - CsrWifiSmeCalibrationDataSetReqSend - - DESCRIPTION - This primitive sets the Wi-Fi radio calibration data. - The usage of the primitive with proper calibration data will avoid - time-consuming configuration after power-up. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - calibrationDataLength - Number of bytes in the buffer pointed by - calibrationData - calibrationData - Pointer to a buffer of length calibrationDataLength - containing the calibration data - -*******************************************************************************/ -#define CsrWifiSmeCalibrationDataSetReqCreate(msg__, dst__, src__, calibrationDataLength__, calibrationData__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ, dst__, src__); \ - msg__->calibrationDataLength = (calibrationDataLength__); \ - msg__->calibrationData = (calibrationData__); - -#define CsrWifiSmeCalibrationDataSetReqSendTo(dst__, src__, calibrationDataLength__, calibrationData__) \ - { \ - CsrWifiSmeCalibrationDataSetReq *msg__; \ - CsrWifiSmeCalibrationDataSetReqCreate(msg__, dst__, src__, calibrationDataLength__, calibrationData__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCalibrationDataSetReqSend(src__, calibrationDataLength__, calibrationData__) \ - CsrWifiSmeCalibrationDataSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, calibrationDataLength__, calibrationData__) - -/******************************************************************************* - - NAME - CsrWifiSmeCalibrationDataSetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeCalibrationDataSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeCalibrationDataSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeCalibrationDataSetCfm *msg__; \ - CsrWifiSmeCalibrationDataSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCalibrationDataSetCfmSend(dst__, status__) \ - CsrWifiSmeCalibrationDataSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeCcxConfigGetReqSend - - DESCRIPTION - This primitive gets the value of the CcxConfig parameter. - CURRENTLY NOT SUPPORTED. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -#define CsrWifiSmeCcxConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_GET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiSmeCcxConfigGetReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiSmeCcxConfigGetReq *msg__; \ - CsrWifiSmeCcxConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCcxConfigGetReqSend(src__, interfaceTag__) \ - CsrWifiSmeCcxConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiSmeCcxConfigGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - ccxConfig - Currently not supported - -*******************************************************************************/ -#define CsrWifiSmeCcxConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ccxConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_GET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->ccxConfig = (ccxConfig__); - -#define CsrWifiSmeCcxConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, ccxConfig__) \ - { \ - CsrWifiSmeCcxConfigGetCfm *msg__; \ - CsrWifiSmeCcxConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ccxConfig__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCcxConfigGetCfmSend(dst__, interfaceTag__, status__, ccxConfig__) \ - CsrWifiSmeCcxConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, ccxConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeCcxConfigSetReqSend - - DESCRIPTION - This primitive sets the value of the CcxConfig parameter. - CURRENTLY NOT SUPPORTED. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - ccxConfig - Currently not supported - -*******************************************************************************/ -#define CsrWifiSmeCcxConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, ccxConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_SET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->ccxConfig = (ccxConfig__); - -#define CsrWifiSmeCcxConfigSetReqSendTo(dst__, src__, interfaceTag__, ccxConfig__) \ - { \ - CsrWifiSmeCcxConfigSetReq *msg__; \ - CsrWifiSmeCcxConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, ccxConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCcxConfigSetReqSend(src__, interfaceTag__, ccxConfig__) \ - CsrWifiSmeCcxConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, ccxConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeCcxConfigSetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeCcxConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_SET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiSmeCcxConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiSmeCcxConfigSetCfm *msg__; \ - CsrWifiSmeCcxConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCcxConfigSetCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiSmeCcxConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeCloakedSsidsGetReqSend - - DESCRIPTION - This primitive gets the value of the CloakedSsids parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeCloakedSsidsGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_GET_REQ, dst__, src__); - -#define CsrWifiSmeCloakedSsidsGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeCloakedSsidsGetReq *msg__; \ - CsrWifiSmeCloakedSsidsGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCloakedSsidsGetReqSend(src__) \ - CsrWifiSmeCloakedSsidsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeCloakedSsidsGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - cloakedSsids - Reports list of cloaked SSIDs that are explicitly scanned for - by the driver - -*******************************************************************************/ -#define CsrWifiSmeCloakedSsidsGetCfmCreate(msg__, dst__, src__, status__, cloakedSsids__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->cloakedSsids = (cloakedSsids__); - -#define CsrWifiSmeCloakedSsidsGetCfmSendTo(dst__, src__, status__, cloakedSsids__) \ - { \ - CsrWifiSmeCloakedSsidsGetCfm *msg__; \ - CsrWifiSmeCloakedSsidsGetCfmCreate(msg__, dst__, src__, status__, cloakedSsids__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCloakedSsidsGetCfmSend(dst__, status__, cloakedSsids__) \ - CsrWifiSmeCloakedSsidsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, cloakedSsids__) - -/******************************************************************************* - - NAME - CsrWifiSmeCloakedSsidsSetReqSend - - DESCRIPTION - This primitive sets the list of cloaked SSIDs for which the WMA possesses - profiles. - When the driver detects a cloaked AP, the SME will explicitly scan for it - using the list of cloaked SSIDs provided it, and, if the scan succeeds, - it will report the AP to the WMA either via CSR_WIFI_SME_SCAN_RESULT_IND - (if registered) or via CSR_WIFI_SCAN_RESULT_GET_CFM. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - cloakedSsids - Sets the list of cloaked SSIDs - -*******************************************************************************/ -#define CsrWifiSmeCloakedSsidsSetReqCreate(msg__, dst__, src__, cloakedSsids__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ, dst__, src__); \ - msg__->cloakedSsids = (cloakedSsids__); - -#define CsrWifiSmeCloakedSsidsSetReqSendTo(dst__, src__, cloakedSsids__) \ - { \ - CsrWifiSmeCloakedSsidsSetReq *msg__; \ - CsrWifiSmeCloakedSsidsSetReqCreate(msg__, dst__, src__, cloakedSsids__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCloakedSsidsSetReqSend(src__, cloakedSsids__) \ - CsrWifiSmeCloakedSsidsSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, cloakedSsids__) - -/******************************************************************************* - - NAME - CsrWifiSmeCloakedSsidsSetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeCloakedSsidsSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeCloakedSsidsSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeCloakedSsidsSetCfm *msg__; \ - CsrWifiSmeCloakedSsidsSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCloakedSsidsSetCfmSend(dst__, status__) \ - CsrWifiSmeCloakedSsidsSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeCoexConfigGetReqSend - - DESCRIPTION - This primitive gets the value of the CoexConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeCoexConfigGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_GET_REQ, dst__, src__); - -#define CsrWifiSmeCoexConfigGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeCoexConfigGetReq *msg__; \ - CsrWifiSmeCoexConfigGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCoexConfigGetReqSend(src__) \ - CsrWifiSmeCoexConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeCoexConfigGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - coexConfig - Reports the parameters used to configure the coexistence - behaviour - -*******************************************************************************/ -#define CsrWifiSmeCoexConfigGetCfmCreate(msg__, dst__, src__, status__, coexConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->coexConfig = (coexConfig__); - -#define CsrWifiSmeCoexConfigGetCfmSendTo(dst__, src__, status__, coexConfig__) \ - { \ - CsrWifiSmeCoexConfigGetCfm *msg__; \ - CsrWifiSmeCoexConfigGetCfmCreate(msg__, dst__, src__, status__, coexConfig__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCoexConfigGetCfmSend(dst__, status__, coexConfig__) \ - CsrWifiSmeCoexConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, coexConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeCoexConfigSetReqSend - - DESCRIPTION - This primitive sets the value of the CoexConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - coexConfig - Configures the coexistence behaviour - -*******************************************************************************/ -#define CsrWifiSmeCoexConfigSetReqCreate(msg__, dst__, src__, coexConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_SET_REQ, dst__, src__); \ - msg__->coexConfig = (coexConfig__); - -#define CsrWifiSmeCoexConfigSetReqSendTo(dst__, src__, coexConfig__) \ - { \ - CsrWifiSmeCoexConfigSetReq *msg__; \ - CsrWifiSmeCoexConfigSetReqCreate(msg__, dst__, src__, coexConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCoexConfigSetReqSend(src__, coexConfig__) \ - CsrWifiSmeCoexConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, coexConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeCoexConfigSetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeCoexConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeCoexConfigSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeCoexConfigSetCfm *msg__; \ - CsrWifiSmeCoexConfigSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCoexConfigSetCfmSend(dst__, status__) \ - CsrWifiSmeCoexConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeCoexInfoGetReqSend - - DESCRIPTION - This primitive gets the value of the CoexInfo parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeCoexInfoGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCoexInfoGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_INFO_GET_REQ, dst__, src__); - -#define CsrWifiSmeCoexInfoGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeCoexInfoGetReq *msg__; \ - CsrWifiSmeCoexInfoGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCoexInfoGetReqSend(src__) \ - CsrWifiSmeCoexInfoGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeCoexInfoGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - coexInfo - Reports information and state related to coexistence. - -*******************************************************************************/ -#define CsrWifiSmeCoexInfoGetCfmCreate(msg__, dst__, src__, status__, coexInfo__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCoexInfoGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_INFO_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->coexInfo = (coexInfo__); - -#define CsrWifiSmeCoexInfoGetCfmSendTo(dst__, src__, status__, coexInfo__) \ - { \ - CsrWifiSmeCoexInfoGetCfm *msg__; \ - CsrWifiSmeCoexInfoGetCfmCreate(msg__, dst__, src__, status__, coexInfo__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCoexInfoGetCfmSend(dst__, status__, coexInfo__) \ - CsrWifiSmeCoexInfoGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, coexInfo__) - -/******************************************************************************* - - NAME - CsrWifiSmeConnectReqSend - - DESCRIPTION - The wireless manager application calls this primitive to start the - process of joining an 802.11 wireless network or to start an ad hoc - network. - The structure pointed by connectionConfig contains parameters describing - the network to join or, in case of an ad hoc network, to host or join. - The SME will select a network, perform the IEEE 802.11 Join, Authenticate - and Associate exchanges. - The SME selects the networks from the current scan list that match both - the SSID and BSSID, however either or both of these may be the wildcard - value. Using this rule, the following operations are possible: - * To connect to a network by name, specify the SSID and set the BSSID to - 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF. If there are two or more networks visible, - the SME will select the one with the strongest signal. - * To connect to a specific network, specify the BSSID. The SSID is - optional, but if given it must match the SSID of the network. An empty - SSID may be specified by setting the SSID length to zero. Please note - that if the BSSID is specified (i.e. not equal to 0xFF 0xFF 0xFF 0xFF - 0xFF 0xFF), the SME will not attempt to roam if signal conditions become - poor, even if there is an alternative AP with an SSID that matches the - current network SSID. - * To connect to any network matching the other parameters (i.e. security, - etc), set the SSID length to zero and set the BSSID to 0xFF 0xFF 0xFF - 0xFF 0xFF 0xFF. In this case, the SME will order all available networks - by their signal strengths and will iterate through this list until it - successfully connects. - NOTE: Specifying the BSSID will restrict the selection to one specific - network. If SSID and BSSID are given, they must both match the network - for it to be selected. To select a network based on the SSID only, the - wireless manager application must set the BSSID to 0xFF 0xFF 0xFF 0xFF - 0xFF 0xFF. - The SME will try to connect to each network that matches the provided - parameters, one by one, until it succeeds or has tried unsuccessfully - with all the matching networks. - If there is no network that matches the parameters and the request allows - to host an ad hoc network, the SME will advertise a new ad hoc network - instead. - If the SME cannot connect, it will notify the failure in the confirm. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - connectionConfig - Describes the candidate network to join or to host. - -*******************************************************************************/ -#define CsrWifiSmeConnectReqCreate(msg__, dst__, src__, interfaceTag__, connectionConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeConnectReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECT_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->connectionConfig = (connectionConfig__); - -#define CsrWifiSmeConnectReqSendTo(dst__, src__, interfaceTag__, connectionConfig__) \ - { \ - CsrWifiSmeConnectReq *msg__; \ - CsrWifiSmeConnectReqCreate(msg__, dst__, src__, interfaceTag__, connectionConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeConnectReqSend(src__, interfaceTag__, connectionConfig__) \ - CsrWifiSmeConnectReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, connectionConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeConnectCfmSend - - DESCRIPTION - The SME calls this primitive when the connection exchange is complete or - all connection attempts fail. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request. - CSR_WIFI_SME_STATUS_NOT_FOUND: all attempts by the SME to - locate the requested AP failed - -*******************************************************************************/ -#define CsrWifiSmeConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeConnectCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECT_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiSmeConnectCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiSmeConnectCfm *msg__; \ - CsrWifiSmeConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeConnectCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiSmeConnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionConfigGetReqSend - - DESCRIPTION - This primitive gets the value of the ConnectionConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -#define CsrWifiSmeConnectionConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeConnectionConfigGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_CONFIG_GET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiSmeConnectionConfigGetReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiSmeConnectionConfigGetReq *msg__; \ - CsrWifiSmeConnectionConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeConnectionConfigGetReqSend(src__, interfaceTag__) \ - CsrWifiSmeConnectionConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionConfigGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - connectionConfig - Parameters used by the SME for selecting a network - -*******************************************************************************/ -#define CsrWifiSmeConnectionConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeConnectionConfigGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->connectionConfig = (connectionConfig__); - -#define CsrWifiSmeConnectionConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionConfig__) \ - { \ - CsrWifiSmeConnectionConfigGetCfm *msg__; \ - CsrWifiSmeConnectionConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionConfig__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeConnectionConfigGetCfmSend(dst__, interfaceTag__, status__, connectionConfig__) \ - CsrWifiSmeConnectionConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionInfoGetReqSend - - DESCRIPTION - This primitive gets the value of the ConnectionInfo parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -#define CsrWifiSmeConnectionInfoGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeConnectionInfoGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_INFO_GET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiSmeConnectionInfoGetReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiSmeConnectionInfoGetReq *msg__; \ - CsrWifiSmeConnectionInfoGetReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeConnectionInfoGetReqSend(src__, interfaceTag__) \ - CsrWifiSmeConnectionInfoGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionInfoGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - connectionInfo - Information about the current connection - -*******************************************************************************/ -#define CsrWifiSmeConnectionInfoGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeConnectionInfoGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_INFO_GET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->connectionInfo = (connectionInfo__); - -#define CsrWifiSmeConnectionInfoGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionInfo__) \ - { \ - CsrWifiSmeConnectionInfoGetCfm *msg__; \ - CsrWifiSmeConnectionInfoGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeConnectionInfoGetCfmSend(dst__, interfaceTag__, status__, connectionInfo__) \ - CsrWifiSmeConnectionInfoGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionInfo__) - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionQualityIndSend - - DESCRIPTION - The SME sends this primitive to all the tasks that have registered to - receive it whenever the value of the current connection quality - parameters change by more than a certain configurable amount. - The wireless manager application may configure the trigger thresholds for - this indication using the field in smeConfig parameter of - CSR_WIFI_SME_SME_CONFIG_SET_REQ. - Connection quality messages can be suppressed by setting both thresholds - to zero. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - linkQuality - Indicates the quality of the link - -*******************************************************************************/ -#define CsrWifiSmeConnectionQualityIndCreate(msg__, dst__, src__, interfaceTag__, linkQuality__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeConnectionQualityInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_QUALITY_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->linkQuality = (linkQuality__); - -#define CsrWifiSmeConnectionQualityIndSendTo(dst__, src__, interfaceTag__, linkQuality__) \ - { \ - CsrWifiSmeConnectionQualityInd *msg__; \ - CsrWifiSmeConnectionQualityIndCreate(msg__, dst__, src__, interfaceTag__, linkQuality__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeConnectionQualityIndSend(dst__, interfaceTag__, linkQuality__) \ - CsrWifiSmeConnectionQualityIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, linkQuality__) - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionStatsGetReqSend - - DESCRIPTION - This primitive gets the value of the ConnectionStats parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -#define CsrWifiSmeConnectionStatsGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeConnectionStatsGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_STATS_GET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiSmeConnectionStatsGetReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiSmeConnectionStatsGetReq *msg__; \ - CsrWifiSmeConnectionStatsGetReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeConnectionStatsGetReqSend(src__, interfaceTag__) \ - CsrWifiSmeConnectionStatsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionStatsGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - connectionStats - Statistics for current connection. - -*******************************************************************************/ -#define CsrWifiSmeConnectionStatsGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStats__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeConnectionStatsGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_STATS_GET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->connectionStats = (connectionStats__); - -#define CsrWifiSmeConnectionStatsGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionStats__) \ - { \ - CsrWifiSmeConnectionStatsGetCfm *msg__; \ - CsrWifiSmeConnectionStatsGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStats__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeConnectionStatsGetCfmSend(dst__, interfaceTag__, status__, connectionStats__) \ - CsrWifiSmeConnectionStatsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionStats__) - -/******************************************************************************* - - NAME - CsrWifiSmeCoreDumpIndSend - - DESCRIPTION - The SME will send this primitive to all the tasks that have registered to - receive Wi-Fi Chip core dump data. - The core dump data may be fragmented and sent using more than one - indication. - To indicate that all the data has been sent, the last indication contains - a 'length' of 0 and 'data' of NULL. - - PARAMETERS - queue - Destination Task Queue - dataLength - Number of bytes in the buffer pointed to by 'data' - data - Pointer to the buffer containing 'dataLength' bytes of core - dump data - -*******************************************************************************/ -#define CsrWifiSmeCoreDumpIndCreate(msg__, dst__, src__, dataLength__, data__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeCoreDumpInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CORE_DUMP_IND, dst__, src__); \ - msg__->dataLength = (dataLength__); \ - msg__->data = (data__); - -#define CsrWifiSmeCoreDumpIndSendTo(dst__, src__, dataLength__, data__) \ - { \ - CsrWifiSmeCoreDumpInd *msg__; \ - CsrWifiSmeCoreDumpIndCreate(msg__, dst__, src__, dataLength__, data__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeCoreDumpIndSend(dst__, dataLength__, data__) \ - CsrWifiSmeCoreDumpIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, dataLength__, data__) - -/******************************************************************************* - - NAME - CsrWifiSmeDeactivateReqSend - - DESCRIPTION - The WMA sends this primitive to deactivate the SME. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeDeactivateReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeDeactivateReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DEACTIVATE_REQ, dst__, src__); - -#define CsrWifiSmeDeactivateReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeDeactivateReq *msg__; \ - CsrWifiSmeDeactivateReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeDeactivateReqSend(src__) \ - CsrWifiSmeDeactivateReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeDeactivateCfmSend - - DESCRIPTION - The SME sends this primitive when the deactivation is complete. - The WMA cannot send any more primitives until it actives the SME again - sending another CSR_WIFI_SME_ACTIVATE_REQ. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeDeactivateCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeDeactivateCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DEACTIVATE_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeDeactivateCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeDeactivateCfm *msg__; \ - CsrWifiSmeDeactivateCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeDeactivateCfmSend(dst__, status__) \ - CsrWifiSmeDeactivateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeDisconnectReqSend - - DESCRIPTION - The wireless manager application may disconnect from the current network - by calling this primitive - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -#define CsrWifiSmeDisconnectReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeDisconnectReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DISCONNECT_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiSmeDisconnectReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiSmeDisconnectReq *msg__; \ - CsrWifiSmeDisconnectReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeDisconnectReqSend(src__, interfaceTag__) \ - CsrWifiSmeDisconnectReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiSmeDisconnectCfmSend - - DESCRIPTION - On reception of CSR_WIFI_SME_DISCONNECT_REQ the SME will perform a - disconnect operation, sending a CsrWifiSmeMediaStatusInd with - CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED and then call this primitive when - disconnection is complete. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeDisconnectCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DISCONNECT_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiSmeDisconnectCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiSmeDisconnectCfm *msg__; \ - CsrWifiSmeDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeDisconnectCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiSmeDisconnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeErrorIndSend - - DESCRIPTION - Important error message indicating a error of some importance - - PARAMETERS - queue - Destination Task Queue - errorMessage - Contains the error message. - -*******************************************************************************/ -#define CsrWifiSmeErrorIndCreate(msg__, dst__, src__, errorMessage__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeErrorInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ERROR_IND, dst__, src__); \ - msg__->errorMessage = (errorMessage__); - -#define CsrWifiSmeErrorIndSendTo(dst__, src__, errorMessage__) \ - { \ - CsrWifiSmeErrorInd *msg__; \ - CsrWifiSmeErrorIndCreate(msg__, dst__, src__, errorMessage__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeErrorIndSend(dst__, errorMessage__) \ - CsrWifiSmeErrorIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, errorMessage__) - -/******************************************************************************* - - NAME - CsrWifiSmeEventMaskSetReqSend - - DESCRIPTION - The wireless manager application may register with the SME to receive - notification of interesting events. Indications will be sent only if the - wireless manager explicitly registers to be notified of that event. - indMask is a bit mask of values defined in CsrWifiSmeIndicationsMask. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - indMask - Set mask with values from CsrWifiSmeIndications - -*******************************************************************************/ -#define CsrWifiSmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeEventMaskSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_EVENT_MASK_SET_REQ, dst__, src__); \ - msg__->indMask = (indMask__); - -#define CsrWifiSmeEventMaskSetReqSendTo(dst__, src__, indMask__) \ - { \ - CsrWifiSmeEventMaskSetReq *msg__; \ - CsrWifiSmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeEventMaskSetReqSend(src__, indMask__) \ - CsrWifiSmeEventMaskSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, indMask__) - -/******************************************************************************* - - NAME - CsrWifiSmeEventMaskSetCfmSend - - DESCRIPTION - The SME calls the primitive to report the result of the request - primitive. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeEventMaskSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeEventMaskSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_EVENT_MASK_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeEventMaskSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeEventMaskSetCfm *msg__; \ - CsrWifiSmeEventMaskSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeEventMaskSetCfmSend(dst__, status__) \ - CsrWifiSmeEventMaskSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeHostConfigGetReqSend - - DESCRIPTION - This primitive gets the value of the hostConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -#define CsrWifiSmeHostConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_GET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiSmeHostConfigGetReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiSmeHostConfigGetReq *msg__; \ - CsrWifiSmeHostConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeHostConfigGetReqSend(src__, interfaceTag__) \ - CsrWifiSmeHostConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiSmeHostConfigGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - hostConfig - Current host power state. - -*******************************************************************************/ -#define CsrWifiSmeHostConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, hostConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_GET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->hostConfig = (hostConfig__); - -#define CsrWifiSmeHostConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, hostConfig__) \ - { \ - CsrWifiSmeHostConfigGetCfm *msg__; \ - CsrWifiSmeHostConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, hostConfig__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeHostConfigGetCfmSend(dst__, interfaceTag__, status__, hostConfig__) \ - CsrWifiSmeHostConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, hostConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeHostConfigSetReqSend - - DESCRIPTION - This primitive sets the value of the hostConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - hostConfig - Communicates a change of host power state (for example, on - mains power, on battery power etc) and of the periodicity of - traffic data - -*******************************************************************************/ -#define CsrWifiSmeHostConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, hostConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_SET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->hostConfig = (hostConfig__); - -#define CsrWifiSmeHostConfigSetReqSendTo(dst__, src__, interfaceTag__, hostConfig__) \ - { \ - CsrWifiSmeHostConfigSetReq *msg__; \ - CsrWifiSmeHostConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, hostConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeHostConfigSetReqSend(src__, interfaceTag__, hostConfig__) \ - CsrWifiSmeHostConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, hostConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeHostConfigSetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeHostConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_SET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiSmeHostConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiSmeHostConfigSetCfm *msg__; \ - CsrWifiSmeHostConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeHostConfigSetCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiSmeHostConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeIbssStationIndSend - - DESCRIPTION - The SME will send this primitive to indicate that a station has joined or - left the ad-hoc network. - - PARAMETERS - queue - Destination Task Queue - address - MAC address of the station that has joined or left - isconnected - TRUE if the station joined, FALSE if the station left - -*******************************************************************************/ -#define CsrWifiSmeIbssStationIndCreate(msg__, dst__, src__, address__, isconnected__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeIbssStationInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_IBSS_STATION_IND, dst__, src__); \ - msg__->address = (address__); \ - msg__->isconnected = (isconnected__); - -#define CsrWifiSmeIbssStationIndSendTo(dst__, src__, address__, isconnected__) \ - { \ - CsrWifiSmeIbssStationInd *msg__; \ - CsrWifiSmeIbssStationIndCreate(msg__, dst__, src__, address__, isconnected__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeIbssStationIndSend(dst__, address__, isconnected__) \ - CsrWifiSmeIbssStationIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, address__, isconnected__) - -/******************************************************************************* - - NAME - CsrWifiSmeInfoIndSend - - DESCRIPTION - Message indicating a some info about current activity. Mostly of interest - in testing but may be useful in the field. - - PARAMETERS - queue - Destination Task Queue - infoMessage - Contains the message. - -*******************************************************************************/ -#define CsrWifiSmeInfoIndCreate(msg__, dst__, src__, infoMessage__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeInfoInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INFO_IND, dst__, src__); \ - msg__->infoMessage = (infoMessage__); - -#define CsrWifiSmeInfoIndSendTo(dst__, src__, infoMessage__) \ - { \ - CsrWifiSmeInfoInd *msg__; \ - CsrWifiSmeInfoIndCreate(msg__, dst__, src__, infoMessage__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeInfoIndSend(dst__, infoMessage__) \ - CsrWifiSmeInfoIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, infoMessage__) - -/******************************************************************************* - - NAME - CsrWifiSmeInterfaceCapabilityGetReqSend - - DESCRIPTION - The Wireless Manager calls this primitive to ask the SME for the - capabilities of the supported interfaces - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeInterfaceCapabilityGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeInterfaceCapabilityGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ, dst__, src__); - -#define CsrWifiSmeInterfaceCapabilityGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeInterfaceCapabilityGetReq *msg__; \ - CsrWifiSmeInterfaceCapabilityGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeInterfaceCapabilityGetReqSend(src__) \ - CsrWifiSmeInterfaceCapabilityGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeInterfaceCapabilityGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Result of the request - numInterfaces - Number of the interfaces supported - capBitmap - Points to the list of capabilities bitmaps provided for each - interface. - The bits represent the following capabilities: - -bits 7 to 4-Reserved - -bit 3-AMP - -bit 2-P2P - -bit 1-AP - -bit 0-STA - -*******************************************************************************/ -#define CsrWifiSmeInterfaceCapabilityGetCfmCreate(msg__, dst__, src__, status__, numInterfaces__, capBitmap__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->numInterfaces = (numInterfaces__); \ - memcpy(msg__->capBitmap, (capBitmap__), sizeof(u8) * 2); - -#define CsrWifiSmeInterfaceCapabilityGetCfmSendTo(dst__, src__, status__, numInterfaces__, capBitmap__) \ - { \ - CsrWifiSmeInterfaceCapabilityGetCfm *msg__; \ - CsrWifiSmeInterfaceCapabilityGetCfmCreate(msg__, dst__, src__, status__, numInterfaces__, capBitmap__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeInterfaceCapabilityGetCfmSend(dst__, status__, numInterfaces__, capBitmap__) \ - CsrWifiSmeInterfaceCapabilityGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, numInterfaces__, capBitmap__) - -/******************************************************************************* - - NAME - CsrWifiSmeKeyReqSend - - DESCRIPTION - The wireless manager application calls this primitive to add or remove - keys that the chip should use for encryption of data. - The interface allows the wireless manager application to add and remove - keys according to the specified action. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - action - The value of the CsrWifiSmeListAction parameter instructs the - driver to modify or provide the list of keys. - CSR_WIFI_SME_LIST_ACTION_GET is not supported here. - key - Key to be added or removed - -*******************************************************************************/ -#define CsrWifiSmeKeyReqCreate(msg__, dst__, src__, interfaceTag__, action__, key__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeKeyReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_KEY_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->action = (action__); \ - msg__->key = (key__); - -#define CsrWifiSmeKeyReqSendTo(dst__, src__, interfaceTag__, action__, key__) \ - { \ - CsrWifiSmeKeyReq *msg__; \ - CsrWifiSmeKeyReqCreate(msg__, dst__, src__, interfaceTag__, action__, key__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeKeyReqSend(src__, interfaceTag__, action__, key__) \ - CsrWifiSmeKeyReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, key__) - -/******************************************************************************* - - NAME - CsrWifiSmeKeyCfmSend - - DESCRIPTION - The SME calls the primitive to report the result of the request - primitive. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - action - Action in the request - keyType - Type of the key added/deleted - peerMacAddress - Peer MAC Address of the key added/deleted - -*******************************************************************************/ -#define CsrWifiSmeKeyCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeKeyCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_KEY_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->action = (action__); \ - msg__->keyType = (keyType__); \ - msg__->peerMacAddress = (peerMacAddress__); - -#define CsrWifiSmeKeyCfmSendTo(dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \ - { \ - CsrWifiSmeKeyCfm *msg__; \ - CsrWifiSmeKeyCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeKeyCfmSend(dst__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \ - CsrWifiSmeKeyCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, keyType__, peerMacAddress__) - -/******************************************************************************* - - NAME - CsrWifiSmeLinkQualityGetReqSend - - DESCRIPTION - This primitive gets the value of the LinkQuality parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -#define CsrWifiSmeLinkQualityGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeLinkQualityGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_LINK_QUALITY_GET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiSmeLinkQualityGetReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiSmeLinkQualityGetReq *msg__; \ - CsrWifiSmeLinkQualityGetReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeLinkQualityGetReqSend(src__, interfaceTag__) \ - CsrWifiSmeLinkQualityGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiSmeLinkQualityGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - linkQuality - Indicates the quality of the link - -*******************************************************************************/ -#define CsrWifiSmeLinkQualityGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, linkQuality__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeLinkQualityGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_LINK_QUALITY_GET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->linkQuality = (linkQuality__); - -#define CsrWifiSmeLinkQualityGetCfmSendTo(dst__, src__, interfaceTag__, status__, linkQuality__) \ - { \ - CsrWifiSmeLinkQualityGetCfm *msg__; \ - CsrWifiSmeLinkQualityGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, linkQuality__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeLinkQualityGetCfmSend(dst__, interfaceTag__, status__, linkQuality__) \ - CsrWifiSmeLinkQualityGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, linkQuality__) - -/******************************************************************************* - - NAME - CsrWifiSmeMediaStatusIndSend - - DESCRIPTION - The SME sends this primitive to all the tasks that have registered to - receive it when a network connection is established, lost or has moved to - another AP. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - mediaStatus - Indicates the media status - connectionInfo - This parameter is relevant only if the mediaStatus is - CSR_WIFI_SME_MEDIA_STATUS_CONNECTED: - it points to the connection information for the new network - disassocReason - This parameter is relevant only if the mediaStatus is - CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED: - if a disassociation has occurred it gives the reason of the - disassociation - deauthReason - This parameter is relevant only if the mediaStatus is - CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED: - if a deauthentication has occurred it gives the reason of - the deauthentication - -*******************************************************************************/ -#define CsrWifiSmeMediaStatusIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMediaStatusInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MEDIA_STATUS_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->mediaStatus = (mediaStatus__); \ - msg__->connectionInfo = (connectionInfo__); \ - msg__->disassocReason = (disassocReason__); \ - msg__->deauthReason = (deauthReason__); - -#define CsrWifiSmeMediaStatusIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \ - { \ - CsrWifiSmeMediaStatusInd *msg__; \ - CsrWifiSmeMediaStatusIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMediaStatusIndSend(dst__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \ - CsrWifiSmeMediaStatusIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) - -/******************************************************************************* - - NAME - CsrWifiSmeMibConfigGetReqSend - - DESCRIPTION - This primitive gets the value of the MibConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeMibConfigGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_GET_REQ, dst__, src__); - -#define CsrWifiSmeMibConfigGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeMibConfigGetReq *msg__; \ - CsrWifiSmeMibConfigGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMibConfigGetReqSend(src__) \ - CsrWifiSmeMibConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeMibConfigGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - mibConfig - Reports various IEEE 802.11 attributes as currently configured - -*******************************************************************************/ -#define CsrWifiSmeMibConfigGetCfmCreate(msg__, dst__, src__, status__, mibConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->mibConfig = (mibConfig__); - -#define CsrWifiSmeMibConfigGetCfmSendTo(dst__, src__, status__, mibConfig__) \ - { \ - CsrWifiSmeMibConfigGetCfm *msg__; \ - CsrWifiSmeMibConfigGetCfmCreate(msg__, dst__, src__, status__, mibConfig__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMibConfigGetCfmSend(dst__, status__, mibConfig__) \ - CsrWifiSmeMibConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, mibConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeMibConfigSetReqSend - - DESCRIPTION - This primitive sets the value of the MibConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - mibConfig - Conveys the desired value of various IEEE 802.11 attributes as - currently configured - -*******************************************************************************/ -#define CsrWifiSmeMibConfigSetReqCreate(msg__, dst__, src__, mibConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_SET_REQ, dst__, src__); \ - msg__->mibConfig = (mibConfig__); - -#define CsrWifiSmeMibConfigSetReqSendTo(dst__, src__, mibConfig__) \ - { \ - CsrWifiSmeMibConfigSetReq *msg__; \ - CsrWifiSmeMibConfigSetReqCreate(msg__, dst__, src__, mibConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMibConfigSetReqSend(src__, mibConfig__) \ - CsrWifiSmeMibConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeMibConfigSetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeMibConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeMibConfigSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeMibConfigSetCfm *msg__; \ - CsrWifiSmeMibConfigSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMibConfigSetCfmSend(dst__, status__) \ - CsrWifiSmeMibConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeMibGetCfmSend - - DESCRIPTION - The SME calls this primitive to return the requested MIB variable values. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - mibAttributeLength - Length of mibAttribute - mibAttribute - Points to the VarBind or VarBindList containing the - names and values of the MIB variables requested - -*******************************************************************************/ -#define CsrWifiSmeMibGetCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMibGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->mibAttributeLength = (mibAttributeLength__); \ - msg__->mibAttribute = (mibAttribute__); - -#define CsrWifiSmeMibGetCfmSendTo(dst__, src__, status__, mibAttributeLength__, mibAttribute__) \ - { \ - CsrWifiSmeMibGetCfm *msg__; \ - CsrWifiSmeMibGetCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMibGetCfmSend(dst__, status__, mibAttributeLength__, mibAttribute__) \ - CsrWifiSmeMibGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, mibAttributeLength__, mibAttribute__) - -/******************************************************************************* - - NAME - CsrWifiSmeMibGetNextReqSend - - DESCRIPTION - To read a sequence of MIB parameters, for example a table, call this - primitive to find the name of the next MIB variable - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - mibAttributeLength - Length of mibAttribute - mibAttribute - Points to a VarBind or VarBindList containing the - name(s) of the MIB variable(s) to search from. - -*******************************************************************************/ -#define CsrWifiSmeMibGetNextReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMibGetNextReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_NEXT_REQ, dst__, src__); \ - msg__->mibAttributeLength = (mibAttributeLength__); \ - msg__->mibAttribute = (mibAttribute__); - -#define CsrWifiSmeMibGetNextReqSendTo(dst__, src__, mibAttributeLength__, mibAttribute__) \ - { \ - CsrWifiSmeMibGetNextReq *msg__; \ - CsrWifiSmeMibGetNextReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMibGetNextReqSend(src__, mibAttributeLength__, mibAttribute__) \ - CsrWifiSmeMibGetNextReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibAttributeLength__, mibAttribute__) - -/******************************************************************************* - - NAME - CsrWifiSmeMibGetNextCfmSend - - DESCRIPTION - The SME calls this primitive to return the requested MIB name(s). - The wireless manager application can then read the value of the MIB - variable using CSR_WIFI_SME_MIB_GET_REQ, using the names provided. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - mibAttributeLength - Length of mibAttribute - mibAttribute - Points to a VarBind or VarBindList containing the - name(s) of the MIB variable(s) lexicographically - following the name(s) given in the request - -*******************************************************************************/ -#define CsrWifiSmeMibGetNextCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMibGetNextCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_NEXT_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->mibAttributeLength = (mibAttributeLength__); \ - msg__->mibAttribute = (mibAttribute__); - -#define CsrWifiSmeMibGetNextCfmSendTo(dst__, src__, status__, mibAttributeLength__, mibAttribute__) \ - { \ - CsrWifiSmeMibGetNextCfm *msg__; \ - CsrWifiSmeMibGetNextCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMibGetNextCfmSend(dst__, status__, mibAttributeLength__, mibAttribute__) \ - CsrWifiSmeMibGetNextCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, mibAttributeLength__, mibAttribute__) - -/******************************************************************************* - - NAME - CsrWifiSmeMibGetReqSend - - DESCRIPTION - The wireless manager application calls this primitive to retrieve one or - more MIB variables. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - mibAttributeLength - Length of mibAttribute - mibAttribute - Points to the VarBind or VarBindList containing the - names of the MIB variables to be retrieved - -*******************************************************************************/ -#define CsrWifiSmeMibGetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMibGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_REQ, dst__, src__); \ - msg__->mibAttributeLength = (mibAttributeLength__); \ - msg__->mibAttribute = (mibAttribute__); - -#define CsrWifiSmeMibGetReqSendTo(dst__, src__, mibAttributeLength__, mibAttribute__) \ - { \ - CsrWifiSmeMibGetReq *msg__; \ - CsrWifiSmeMibGetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMibGetReqSend(src__, mibAttributeLength__, mibAttribute__) \ - CsrWifiSmeMibGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibAttributeLength__, mibAttribute__) - -/******************************************************************************* - - NAME - CsrWifiSmeMibSetReqSend - - DESCRIPTION - The SME provides raw access to the MIB on the chip, which may be used by - some configuration or diagnostic utilities, but is not normally needed by - the wireless manager application. - The MIB access functions use BER encoded names (OID) of the MIB - parameters and BER encoded values, as described in the chip Host - Interface Protocol Specification. - The MIB parameters are described in 'Wi-Fi 5.0.0 Management Information - Base Reference Guide'. - The wireless manager application calls this primitive to set one or more - MIB variables - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - mibAttributeLength - Length of mibAttribute - mibAttribute - Points to the VarBind or VarBindList containing the - names and values of the MIB variables to set - -*******************************************************************************/ -#define CsrWifiSmeMibSetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMibSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_SET_REQ, dst__, src__); \ - msg__->mibAttributeLength = (mibAttributeLength__); \ - msg__->mibAttribute = (mibAttribute__); - -#define CsrWifiSmeMibSetReqSendTo(dst__, src__, mibAttributeLength__, mibAttribute__) \ - { \ - CsrWifiSmeMibSetReq *msg__; \ - CsrWifiSmeMibSetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMibSetReqSend(src__, mibAttributeLength__, mibAttribute__) \ - CsrWifiSmeMibSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibAttributeLength__, mibAttribute__) - -/******************************************************************************* - - NAME - CsrWifiSmeMibSetCfmSend - - DESCRIPTION - The SME calls the primitive to report the result of the set primitive. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeMibSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMibSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeMibSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeMibSetCfm *msg__; \ - CsrWifiSmeMibSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMibSetCfmSend(dst__, status__) \ - CsrWifiSmeMibSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeMicFailureIndSend - - DESCRIPTION - The SME sends this primitive to all the tasks that have registered to - receive it whenever the chip firmware reports a MIC failure. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - secondFailure - TRUE if this indication is for a second failure in 60 - seconds - count - The number of MIC failure events since the connection was - established - address - MAC address of the transmitter that caused the MIC failure - keyType - Type of key for which the failure occurred - -*******************************************************************************/ -#define CsrWifiSmeMicFailureIndCreate(msg__, dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMicFailureInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIC_FAILURE_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->secondFailure = (secondFailure__); \ - msg__->count = (count__); \ - msg__->address = (address__); \ - msg__->keyType = (keyType__); - -#define CsrWifiSmeMicFailureIndSendTo(dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__) \ - { \ - CsrWifiSmeMicFailureInd *msg__; \ - CsrWifiSmeMicFailureIndCreate(msg__, dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMicFailureIndSend(dst__, interfaceTag__, secondFailure__, count__, address__, keyType__) \ - CsrWifiSmeMicFailureIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, secondFailure__, count__, address__, keyType__) - -/******************************************************************************* - - NAME - CsrWifiSmeMulticastAddressReqSend - - DESCRIPTION - The wireless manager application calls this primitive to specify the - multicast addresses which the chip should recognise. The interface allows - the wireless manager application to query, add, remove and flush the - multicast addresses for the network interface according to the specified - action. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - action - The value of the CsrWifiSmeListAction parameter - instructs the driver to modify or provide the list of - MAC addresses. - setAddressesCount - Number of MAC addresses sent with the primitive - setAddresses - Pointer to the list of MAC Addresses sent with the - primitive, set to NULL if none is sent. - -*******************************************************************************/ -#define CsrWifiSmeMulticastAddressReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMulticastAddressReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MULTICAST_ADDRESS_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->action = (action__); \ - msg__->setAddressesCount = (setAddressesCount__); \ - msg__->setAddresses = (setAddresses__); - -#define CsrWifiSmeMulticastAddressReqSendTo(dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ - { \ - CsrWifiSmeMulticastAddressReq *msg__; \ - CsrWifiSmeMulticastAddressReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMulticastAddressReqSend(src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \ - CsrWifiSmeMulticastAddressReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) - -/******************************************************************************* - - NAME - CsrWifiSmeMulticastAddressCfmSend - - DESCRIPTION - The SME will call this primitive when the operation is complete. For a - GET action, this primitive reports the current list of MAC addresses. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - action - Action in the request - getAddressesCount - This parameter is only relevant if action is - CSR_WIFI_SME_LIST_ACTION_GET: - number of MAC addresses sent with the primitive - getAddresses - Pointer to the list of MAC Addresses sent with the - primitive, set to NULL if none is sent. - -*******************************************************************************/ -#define CsrWifiSmeMulticastAddressCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeMulticastAddressCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MULTICAST_ADDRESS_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->action = (action__); \ - msg__->getAddressesCount = (getAddressesCount__); \ - msg__->getAddresses = (getAddresses__); - -#define CsrWifiSmeMulticastAddressCfmSendTo(dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \ - { \ - CsrWifiSmeMulticastAddressCfm *msg__; \ - CsrWifiSmeMulticastAddressCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeMulticastAddressCfmSend(dst__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \ - CsrWifiSmeMulticastAddressCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) - -/******************************************************************************* - - NAME - CsrWifiSmePacketFilterSetReqSend - - DESCRIPTION - The wireless manager application should call this primitive to enable or - disable filtering of broadcast packets: uninteresting broadcast packets - will be dropped by the Wi-Fi chip, instead of passing them up to the - host. - This has the advantage of saving power in the host application processor - as it removes the need to process unwanted packets. - All broadcast packets are filtered according to the filter and the filter - mode provided, except ARP packets, which are filtered using - arpFilterAddress. - Filters are not cumulative: only the parameters specified in the most - recent successful request are significant. - For more information, see 'UniFi Firmware API Specification'. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - filterLength - Length of the filter in bytes. - filterLength=0 disables the filter previously set - filter - Points to the first byte of the filter provided, if any. - This shall include zero or more instance of the - information elements of one of these types - * Traffic Classification (TCLAS) elements - * WMM-SA TCLAS elements - mode - Specifies whether the filter selects or excludes packets - matching the filter - arpFilterAddress - IPv4 address to be used for filtering the ARP packets. - * If the specified address is the IPv4 broadcast address - (255.255.255.255), all ARP packets are reported to the - host, - * If the specified address is NOT the IPv4 broadcast - address, only ARP packets with the specified address in - the Source or Target Protocol Address fields are reported - to the host - -*******************************************************************************/ -#define CsrWifiSmePacketFilterSetReqCreate(msg__, dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \ - msg__ = kmalloc(sizeof(CsrWifiSmePacketFilterSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PACKET_FILTER_SET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->filterLength = (filterLength__); \ - msg__->filter = (filter__); \ - msg__->mode = (mode__); \ - msg__->arpFilterAddress = (arpFilterAddress__); - -#define CsrWifiSmePacketFilterSetReqSendTo(dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \ - { \ - CsrWifiSmePacketFilterSetReq *msg__; \ - CsrWifiSmePacketFilterSetReqCreate(msg__, dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmePacketFilterSetReqSend(src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \ - CsrWifiSmePacketFilterSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) - -/******************************************************************************* - - NAME - CsrWifiSmePacketFilterSetCfmSend - - DESCRIPTION - The SME calls the primitive to report the result of the set primitive. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmePacketFilterSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmePacketFilterSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PACKET_FILTER_SET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiSmePacketFilterSetCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiSmePacketFilterSetCfm *msg__; \ - CsrWifiSmePacketFilterSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmePacketFilterSetCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiSmePacketFilterSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiSmePermanentMacAddressGetReqSend - - DESCRIPTION - This primitive retrieves the MAC address stored in EEPROM - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmePermanentMacAddressGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmePermanentMacAddressGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_REQ, dst__, src__); - -#define CsrWifiSmePermanentMacAddressGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmePermanentMacAddressGetReq *msg__; \ - CsrWifiSmePermanentMacAddressGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmePermanentMacAddressGetReqSend(src__) \ - CsrWifiSmePermanentMacAddressGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmePermanentMacAddressGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - permanentMacAddress - MAC address stored in the EEPROM - -*******************************************************************************/ -#define CsrWifiSmePermanentMacAddressGetCfmCreate(msg__, dst__, src__, status__, permanentMacAddress__) \ - msg__ = kmalloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->permanentMacAddress = (permanentMacAddress__); - -#define CsrWifiSmePermanentMacAddressGetCfmSendTo(dst__, src__, status__, permanentMacAddress__) \ - { \ - CsrWifiSmePermanentMacAddressGetCfm *msg__; \ - CsrWifiSmePermanentMacAddressGetCfmCreate(msg__, dst__, src__, status__, permanentMacAddress__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmePermanentMacAddressGetCfmSend(dst__, status__, permanentMacAddress__) \ - CsrWifiSmePermanentMacAddressGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, permanentMacAddress__) - -/******************************************************************************* - - NAME - CsrWifiSmePmkidCandidateListIndSend - - DESCRIPTION - The SME will send this primitive to all the tasks that have registered to - receive it when a new network supporting preauthentication and/or PMK - caching is seen. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an - interface - pmkidCandidatesCount - Number of PMKID candidates provided - pmkidCandidates - Points to the first PMKID candidate - -*******************************************************************************/ -#define CsrWifiSmePmkidCandidateListIndCreate(msg__, dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \ - msg__ = kmalloc(sizeof(CsrWifiSmePmkidCandidateListInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->pmkidCandidatesCount = (pmkidCandidatesCount__); \ - msg__->pmkidCandidates = (pmkidCandidates__); - -#define CsrWifiSmePmkidCandidateListIndSendTo(dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \ - { \ - CsrWifiSmePmkidCandidateListInd *msg__; \ - CsrWifiSmePmkidCandidateListIndCreate(msg__, dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmePmkidCandidateListIndSend(dst__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \ - CsrWifiSmePmkidCandidateListIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) - -/******************************************************************************* - - NAME - CsrWifiSmePmkidReqSend - - DESCRIPTION - The wireless manager application calls this primitive to request an - operation on the SME PMKID list. - The action argument specifies the operation to perform. - When the connection is complete, the wireless manager application may - then send and receive EAPOL packets to complete WPA or WPA2 - authentication if appropriate. - The wireless manager application can then pass the resulting encryption - keys using this primitive. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - action - The value of the CsrWifiSmeListAction parameter instructs - the driver to modify or provide the list of PMKIDs. - setPmkidsCount - Number of PMKIDs sent with the primitive - setPmkids - Pointer to the list of PMKIDs sent with the primitive, set - to NULL if none is sent. - -*******************************************************************************/ -#define CsrWifiSmePmkidReqCreate(msg__, dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \ - msg__ = kmalloc(sizeof(CsrWifiSmePmkidReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->action = (action__); \ - msg__->setPmkidsCount = (setPmkidsCount__); \ - msg__->setPmkids = (setPmkids__); - -#define CsrWifiSmePmkidReqSendTo(dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \ - { \ - CsrWifiSmePmkidReq *msg__; \ - CsrWifiSmePmkidReqCreate(msg__, dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmePmkidReqSend(src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \ - CsrWifiSmePmkidReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) - -/******************************************************************************* - - NAME - CsrWifiSmePmkidCfmSend - - DESCRIPTION - The SME will call this primitive when the operation is complete. For a - GET action, this primitive reports the current list of PMKIDs - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - action - Action in the request - getPmkidsCount - This parameter is only relevant if action is - CSR_WIFI_SME_LIST_ACTION_GET: - number of PMKIDs sent with the primitive - getPmkids - Pointer to the list of PMKIDs sent with the primitive, set - to NULL if none is sent. - -*******************************************************************************/ -#define CsrWifiSmePmkidCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \ - msg__ = kmalloc(sizeof(CsrWifiSmePmkidCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->action = (action__); \ - msg__->getPmkidsCount = (getPmkidsCount__); \ - msg__->getPmkids = (getPmkids__); - -#define CsrWifiSmePmkidCfmSendTo(dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \ - { \ - CsrWifiSmePmkidCfm *msg__; \ - CsrWifiSmePmkidCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmePmkidCfmSend(dst__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \ - CsrWifiSmePmkidCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) - -/******************************************************************************* - - NAME - CsrWifiSmePowerConfigGetReqSend - - DESCRIPTION - This primitive gets the value of the PowerConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmePowerConfigGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_GET_REQ, dst__, src__); - -#define CsrWifiSmePowerConfigGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmePowerConfigGetReq *msg__; \ - CsrWifiSmePowerConfigGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmePowerConfigGetReqSend(src__) \ - CsrWifiSmePowerConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmePowerConfigGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - powerConfig - Returns the current parameters for the power configuration of - the firmware - -*******************************************************************************/ -#define CsrWifiSmePowerConfigGetCfmCreate(msg__, dst__, src__, status__, powerConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->powerConfig = (powerConfig__); - -#define CsrWifiSmePowerConfigGetCfmSendTo(dst__, src__, status__, powerConfig__) \ - { \ - CsrWifiSmePowerConfigGetCfm *msg__; \ - CsrWifiSmePowerConfigGetCfmCreate(msg__, dst__, src__, status__, powerConfig__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmePowerConfigGetCfmSend(dst__, status__, powerConfig__) \ - CsrWifiSmePowerConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, powerConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmePowerConfigSetReqSend - - DESCRIPTION - This primitive sets the value of the PowerConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - powerConfig - Power saving configuration - -*******************************************************************************/ -#define CsrWifiSmePowerConfigSetReqCreate(msg__, dst__, src__, powerConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_SET_REQ, dst__, src__); \ - msg__->powerConfig = (powerConfig__); - -#define CsrWifiSmePowerConfigSetReqSendTo(dst__, src__, powerConfig__) \ - { \ - CsrWifiSmePowerConfigSetReq *msg__; \ - CsrWifiSmePowerConfigSetReqCreate(msg__, dst__, src__, powerConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmePowerConfigSetReqSend(src__, powerConfig__) \ - CsrWifiSmePowerConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, powerConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmePowerConfigSetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmePowerConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmePowerConfigSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmePowerConfigSetCfm *msg__; \ - CsrWifiSmePowerConfigSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmePowerConfigSetCfmSend(dst__, status__) \ - CsrWifiSmePowerConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeRegulatoryDomainInfoGetReqSend - - DESCRIPTION - This primitive gets the value of the RegulatoryDomainInfo parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeRegulatoryDomainInfoGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_REQ, dst__, src__); - -#define CsrWifiSmeRegulatoryDomainInfoGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeRegulatoryDomainInfoGetReq *msg__; \ - CsrWifiSmeRegulatoryDomainInfoGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeRegulatoryDomainInfoGetReqSend(src__) \ - CsrWifiSmeRegulatoryDomainInfoGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeRegulatoryDomainInfoGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - regDomInfo - Reports information and state related to regulatory domain - operation. - -*******************************************************************************/ -#define CsrWifiSmeRegulatoryDomainInfoGetCfmCreate(msg__, dst__, src__, status__, regDomInfo__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->regDomInfo = (regDomInfo__); - -#define CsrWifiSmeRegulatoryDomainInfoGetCfmSendTo(dst__, src__, status__, regDomInfo__) \ - { \ - CsrWifiSmeRegulatoryDomainInfoGetCfm *msg__; \ - CsrWifiSmeRegulatoryDomainInfoGetCfmCreate(msg__, dst__, src__, status__, regDomInfo__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeRegulatoryDomainInfoGetCfmSend(dst__, status__, regDomInfo__) \ - CsrWifiSmeRegulatoryDomainInfoGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, regDomInfo__) - -/******************************************************************************* - - NAME - CsrWifiSmeRoamCompleteIndSend - - DESCRIPTION - The SME will send this primitive to all the tasks that have registered to - receive it whenever it completes an attempt to roam to an AP. If the roam - attempt was successful, status will be set to CSR_WIFI_SME_SUCCESS, - otherwise it shall be set to the appropriate error code. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the roaming procedure - -*******************************************************************************/ -#define CsrWifiSmeRoamCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeRoamCompleteInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAM_COMPLETE_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiSmeRoamCompleteIndSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiSmeRoamCompleteInd *msg__; \ - CsrWifiSmeRoamCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeRoamCompleteIndSend(dst__, interfaceTag__, status__) \ - CsrWifiSmeRoamCompleteIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeRoamStartIndSend - - DESCRIPTION - The SME will send this primitive to all the tasks that have registered to - receive it whenever it begins an attempt to roam to an AP. - If the wireless manager application connect request specified the SSID - and the BSSID was set to the broadcast address (0xFF 0xFF 0xFF 0xFF 0xFF - 0xFF), the SME monitors the signal quality and maintains a list of - candidates to roam to. When the signal quality of the current connection - falls below a threshold, and there is a candidate with better quality, - the SME will attempt to the candidate AP. - If the roaming procedure succeeds, the SME will also issue a Media - Connect indication to inform the wireless manager application of the - change. - NOTE: to prevent the SME from initiating roaming the WMA must specify the - BSSID in the connection request; this forces the SME to connect only to - that AP. - The wireless manager application can obtain statistics for roaming - purposes using CSR_WIFI_SME_CONNECTION_QUALITY_IND and - CSR_WIFI_SME_CONNECTION_STATS_GET_REQ. - When the wireless manager application wishes to roam to another AP, it - must issue a connection request specifying the BSSID of the desired AP. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - roamReason - Indicates the reason for starting the roaming procedure - reason80211 - Indicates the reason for deauthentication or disassociation - -*******************************************************************************/ -#define CsrWifiSmeRoamStartIndCreate(msg__, dst__, src__, interfaceTag__, roamReason__, reason80211__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeRoamStartInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAM_START_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->roamReason = (roamReason__); \ - msg__->reason80211 = (reason80211__); - -#define CsrWifiSmeRoamStartIndSendTo(dst__, src__, interfaceTag__, roamReason__, reason80211__) \ - { \ - CsrWifiSmeRoamStartInd *msg__; \ - CsrWifiSmeRoamStartIndCreate(msg__, dst__, src__, interfaceTag__, roamReason__, reason80211__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeRoamStartIndSend(dst__, interfaceTag__, roamReason__, reason80211__) \ - CsrWifiSmeRoamStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, roamReason__, reason80211__) - -/******************************************************************************* - - NAME - CsrWifiSmeRoamingConfigGetReqSend - - DESCRIPTION - This primitive gets the value of the RoamingConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -#define CsrWifiSmeRoamingConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_GET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiSmeRoamingConfigGetReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiSmeRoamingConfigGetReq *msg__; \ - CsrWifiSmeRoamingConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeRoamingConfigGetReqSend(src__, interfaceTag__) \ - CsrWifiSmeRoamingConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiSmeRoamingConfigGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - roamingConfig - Reports the roaming behaviour of the driver and firmware - -*******************************************************************************/ -#define CsrWifiSmeRoamingConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, roamingConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_GET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->roamingConfig = (roamingConfig__); - -#define CsrWifiSmeRoamingConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, roamingConfig__) \ - { \ - CsrWifiSmeRoamingConfigGetCfm *msg__; \ - CsrWifiSmeRoamingConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, roamingConfig__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeRoamingConfigGetCfmSend(dst__, interfaceTag__, status__, roamingConfig__) \ - CsrWifiSmeRoamingConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, roamingConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeRoamingConfigSetReqSend - - DESCRIPTION - This primitive sets the value of the RoamingConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - roamingConfig - Desired roaming behaviour values - -*******************************************************************************/ -#define CsrWifiSmeRoamingConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, roamingConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_SET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->roamingConfig = (roamingConfig__); - -#define CsrWifiSmeRoamingConfigSetReqSendTo(dst__, src__, interfaceTag__, roamingConfig__) \ - { \ - CsrWifiSmeRoamingConfigSetReq *msg__; \ - CsrWifiSmeRoamingConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, roamingConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeRoamingConfigSetReqSend(src__, interfaceTag__, roamingConfig__) \ - CsrWifiSmeRoamingConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, roamingConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeRoamingConfigSetCfmSend - - DESCRIPTION - This primitive sets the value of the RoamingConfig parameter. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeRoamingConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_SET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiSmeRoamingConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiSmeRoamingConfigSetCfm *msg__; \ - CsrWifiSmeRoamingConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeRoamingConfigSetCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiSmeRoamingConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeScanConfigGetReqSend - - DESCRIPTION - This primitive gets the value of the ScanConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeScanConfigGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_GET_REQ, dst__, src__); - -#define CsrWifiSmeScanConfigGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeScanConfigGetReq *msg__; \ - CsrWifiSmeScanConfigGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeScanConfigGetReqSend(src__) \ - CsrWifiSmeScanConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeScanConfigGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - scanConfig - Returns the current parameters for the autonomous scanning - behaviour of the firmware - -*******************************************************************************/ -#define CsrWifiSmeScanConfigGetCfmCreate(msg__, dst__, src__, status__, scanConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->scanConfig = (scanConfig__); - -#define CsrWifiSmeScanConfigGetCfmSendTo(dst__, src__, status__, scanConfig__) \ - { \ - CsrWifiSmeScanConfigGetCfm *msg__; \ - CsrWifiSmeScanConfigGetCfmCreate(msg__, dst__, src__, status__, scanConfig__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeScanConfigGetCfmSend(dst__, status__, scanConfig__) \ - CsrWifiSmeScanConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, scanConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeScanConfigSetReqSend - - DESCRIPTION - This primitive sets the value of the ScanConfig parameter. - The SME normally configures the firmware to perform autonomous scanning - without involving the host. - The firmware passes beacon / probe response or indicates loss of beacon - on certain changes of state, for example: - * A new AP is seen for the first time - * An AP is no longer visible - * The signal strength of an AP changes by more than a certain amount, as - configured by the thresholds in the scanConfig parameter - In addition to the autonomous scan, the wireless manager application may - request a scan at any time using CSR_WIFI_SME_SCAN_FULL_REQ. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - scanConfig - Reports the configuration for the autonomous scanning behaviour - of the firmware - -*******************************************************************************/ -#define CsrWifiSmeScanConfigSetReqCreate(msg__, dst__, src__, scanConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_SET_REQ, dst__, src__); \ - msg__->scanConfig = (scanConfig__); - -#define CsrWifiSmeScanConfigSetReqSendTo(dst__, src__, scanConfig__) \ - { \ - CsrWifiSmeScanConfigSetReq *msg__; \ - CsrWifiSmeScanConfigSetReqCreate(msg__, dst__, src__, scanConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeScanConfigSetReqSend(src__, scanConfig__) \ - CsrWifiSmeScanConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, scanConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeScanConfigSetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeScanConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeScanConfigSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeScanConfigSetCfm *msg__; \ - CsrWifiSmeScanConfigSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeScanConfigSetCfmSend(dst__, status__) \ - CsrWifiSmeScanConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeScanFullReqSend - - DESCRIPTION - The wireless manager application should call this primitive to request a - full scan. - Channels are scanned actively or passively according to the requirement - set by regulatory domain. - If the SME receives this primitive while a full scan is going on, the new - request is buffered and it will be served after the current full scan is - completed. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - ssidCount - Number of SSIDs provided. - If it is 0, the SME will attempt to detect any network - ssid - Points to the first SSID provided, if any. - bssid - BSS identifier. - If it is equal to FF-FF-FF-FF-FF, the SME will listen for - messages from any BSS. - If it is different from FF-FF-FF-FF-FF and any SSID is - provided, one SSID must match the network of the BSS. - forceScan - Forces the scan even if the SME is in a state which would - normally prevent it (e.g. autonomous scan is running). - bssType - Type of BSS to scan for - scanType - Type of scan to perform - channelListCount - Number of channels provided. - If it is 0, the SME will initiate a scan of all the - supported channels that are permitted by the current - regulatory domain. - channelList - Points to the first channel , or NULL if channelListCount - is zero. - probeIeLength - Length of the information element in bytes to be sent - with the probe message. - probeIe - Points to the first byte of the information element to be - sent with the probe message. - -*******************************************************************************/ -#define CsrWifiSmeScanFullReqCreate(msg__, dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeScanFullReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_FULL_REQ, dst__, src__); \ - msg__->ssidCount = (ssidCount__); \ - msg__->ssid = (ssid__); \ - msg__->bssid = (bssid__); \ - msg__->forceScan = (forceScan__); \ - msg__->bssType = (bssType__); \ - msg__->scanType = (scanType__); \ - msg__->channelListCount = (channelListCount__); \ - msg__->channelList = (channelList__); \ - msg__->probeIeLength = (probeIeLength__); \ - msg__->probeIe = (probeIe__); - -#define CsrWifiSmeScanFullReqSendTo(dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \ - { \ - CsrWifiSmeScanFullReq *msg__; \ - CsrWifiSmeScanFullReqCreate(msg__, dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeScanFullReqSend(src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \ - CsrWifiSmeScanFullReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) - -/******************************************************************************* - - NAME - CsrWifiSmeScanFullCfmSend - - DESCRIPTION - The SME calls this primitive when the results from the scan are - available. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeScanFullCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeScanFullCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_FULL_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeScanFullCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeScanFullCfm *msg__; \ - CsrWifiSmeScanFullCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeScanFullCfmSend(dst__, status__) \ - CsrWifiSmeScanFullCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeScanResultIndSend - - DESCRIPTION - The SME sends this primitive to all the tasks that have registered to - receive it whenever a scan indication is received from the firmware. - - PARAMETERS - queue - Destination Task Queue - result - Points to a buffer containing a scan result. - -*******************************************************************************/ -#define CsrWifiSmeScanResultIndCreate(msg__, dst__, src__, result__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeScanResultInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULT_IND, dst__, src__); \ - msg__->result = (result__); - -#define CsrWifiSmeScanResultIndSendTo(dst__, src__, result__) \ - { \ - CsrWifiSmeScanResultInd *msg__; \ - CsrWifiSmeScanResultIndCreate(msg__, dst__, src__, result__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeScanResultIndSend(dst__, result__) \ - CsrWifiSmeScanResultIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, result__) - -/******************************************************************************* - - NAME - CsrWifiSmeScanResultsFlushReqSend - - DESCRIPTION - The Wireless Manager calls this primitive to ask the SME to delete all - scan results from its cache, except for the scan result of any currently - connected network. - As scan results are received by the SME from the firmware, they are - cached in the SME memory. - Any time the Wireless Manager requests scan results, they are returned - from the SME internal cache. - For some applications it may be desirable to clear this cache prior to - requesting that a scan be performed; this will ensure that the cache then - only contains the networks detected in the most recent scan. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeScanResultsFlushReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsFlushReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_FLUSH_REQ, dst__, src__); - -#define CsrWifiSmeScanResultsFlushReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeScanResultsFlushReq *msg__; \ - CsrWifiSmeScanResultsFlushReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeScanResultsFlushReqSend(src__) \ - CsrWifiSmeScanResultsFlushReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeScanResultsFlushCfmSend - - DESCRIPTION - The SME will call this primitive when the cache has been cleared. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeScanResultsFlushCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsFlushCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_FLUSH_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeScanResultsFlushCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeScanResultsFlushCfm *msg__; \ - CsrWifiSmeScanResultsFlushCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeScanResultsFlushCfmSend(dst__, status__) \ - CsrWifiSmeScanResultsFlushCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeScanResultsGetReqSend - - DESCRIPTION - The wireless manager application calls this primitive to retrieve the - current set of scan results, either after receiving a successful - CSR_WIFI_SME_SCAN_FULL_CFM, or to get autonomous scan results. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeScanResultsGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_GET_REQ, dst__, src__); - -#define CsrWifiSmeScanResultsGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeScanResultsGetReq *msg__; \ - CsrWifiSmeScanResultsGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeScanResultsGetReqSend(src__) \ - CsrWifiSmeScanResultsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeScanResultsGetCfmSend - - DESCRIPTION - The SME sends this primitive to provide the current set of scan results. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - scanResultsCount - Number of scan results - scanResults - Points to a buffer containing an array of - CsrWifiSmeScanResult structures. - -*******************************************************************************/ -#define CsrWifiSmeScanResultsGetCfmCreate(msg__, dst__, src__, status__, scanResultsCount__, scanResults__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->scanResultsCount = (scanResultsCount__); \ - msg__->scanResults = (scanResults__); - -#define CsrWifiSmeScanResultsGetCfmSendTo(dst__, src__, status__, scanResultsCount__, scanResults__) \ - { \ - CsrWifiSmeScanResultsGetCfm *msg__; \ - CsrWifiSmeScanResultsGetCfmCreate(msg__, dst__, src__, status__, scanResultsCount__, scanResults__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeScanResultsGetCfmSend(dst__, status__, scanResultsCount__, scanResults__) \ - CsrWifiSmeScanResultsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, scanResultsCount__, scanResults__) - -/******************************************************************************* - - NAME - CsrWifiSmeSetReqSend - - DESCRIPTION - Used to pass custom data to the SME. Format is the same as 802.11 Info - Elements => | Id | Length | Data - 1) Cmanr Test Mode "Id:0 Length:1 Data:0x00 = OFF 0x01 = ON" "0x00 0x01 - (0x00|0x01)" - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - dataLength - Number of bytes in the buffer pointed to by 'data' - data - Pointer to the buffer containing 'dataLength' bytes - -*******************************************************************************/ -#define CsrWifiSmeSetReqCreate(msg__, dst__, src__, dataLength__, data__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SET_REQ, dst__, src__); \ - msg__->dataLength = (dataLength__); \ - msg__->data = (data__); - -#define CsrWifiSmeSetReqSendTo(dst__, src__, dataLength__, data__) \ - { \ - CsrWifiSmeSetReq *msg__; \ - CsrWifiSmeSetReqCreate(msg__, dst__, src__, dataLength__, data__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeSetReqSend(src__, dataLength__, data__) \ - CsrWifiSmeSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, dataLength__, data__) - -/******************************************************************************* - - NAME - CsrWifiSmeSmeCommonConfigGetReqSend - - DESCRIPTION - This primitive gets the value of the Sme common parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeSmeCommonConfigGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_GET_REQ, dst__, src__); - -#define CsrWifiSmeSmeCommonConfigGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeSmeCommonConfigGetReq *msg__; \ - CsrWifiSmeSmeCommonConfigGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeSmeCommonConfigGetReqSend(src__) \ - CsrWifiSmeSmeCommonConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeSmeCommonConfigGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - deviceConfig - Configuration options in the SME - -*******************************************************************************/ -#define CsrWifiSmeSmeCommonConfigGetCfmCreate(msg__, dst__, src__, status__, deviceConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->deviceConfig = (deviceConfig__); - -#define CsrWifiSmeSmeCommonConfigGetCfmSendTo(dst__, src__, status__, deviceConfig__) \ - { \ - CsrWifiSmeSmeCommonConfigGetCfm *msg__; \ - CsrWifiSmeSmeCommonConfigGetCfmCreate(msg__, dst__, src__, status__, deviceConfig__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeSmeCommonConfigGetCfmSend(dst__, status__, deviceConfig__) \ - CsrWifiSmeSmeCommonConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, deviceConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeSmeCommonConfigSetReqSend - - DESCRIPTION - This primitive sets the value of the Sme common. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - deviceConfig - Configuration options in the SME - -*******************************************************************************/ -#define CsrWifiSmeSmeCommonConfigSetReqCreate(msg__, dst__, src__, deviceConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ, dst__, src__); \ - msg__->deviceConfig = (deviceConfig__); - -#define CsrWifiSmeSmeCommonConfigSetReqSendTo(dst__, src__, deviceConfig__) \ - { \ - CsrWifiSmeSmeCommonConfigSetReq *msg__; \ - CsrWifiSmeSmeCommonConfigSetReqCreate(msg__, dst__, src__, deviceConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeSmeCommonConfigSetReqSend(src__, deviceConfig__) \ - CsrWifiSmeSmeCommonConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, deviceConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeSmeCommonConfigSetCfmSend - - DESCRIPTION - Reports the result of the request - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeSmeCommonConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_SET_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeSmeCommonConfigSetCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeSmeCommonConfigSetCfm *msg__; \ - CsrWifiSmeSmeCommonConfigSetCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeSmeCommonConfigSetCfmSend(dst__, status__) \ - CsrWifiSmeSmeCommonConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeSmeStaConfigGetReqSend - - DESCRIPTION - This primitive gets the value of the SmeStaConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -#define CsrWifiSmeSmeStaConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_GET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); - -#define CsrWifiSmeSmeStaConfigGetReqSendTo(dst__, src__, interfaceTag__) \ - { \ - CsrWifiSmeSmeStaConfigGetReq *msg__; \ - CsrWifiSmeSmeStaConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeSmeStaConfigGetReqSend(src__, interfaceTag__) \ - CsrWifiSmeSmeStaConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__) - -/******************************************************************************* - - NAME - CsrWifiSmeSmeStaConfigGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - smeConfig - Current SME Station Parameters - -*******************************************************************************/ -#define CsrWifiSmeSmeStaConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, smeConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_GET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->smeConfig = (smeConfig__); - -#define CsrWifiSmeSmeStaConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, smeConfig__) \ - { \ - CsrWifiSmeSmeStaConfigGetCfm *msg__; \ - CsrWifiSmeSmeStaConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, smeConfig__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeSmeStaConfigGetCfmSend(dst__, interfaceTag__, status__, smeConfig__) \ - CsrWifiSmeSmeStaConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, smeConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeSmeStaConfigSetReqSend - - DESCRIPTION - This primitive sets the value of the SmeConfig parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - smeConfig - SME Station Parameters to be set - -*******************************************************************************/ -#define CsrWifiSmeSmeStaConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, smeConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_SET_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->smeConfig = (smeConfig__); - -#define CsrWifiSmeSmeStaConfigSetReqSendTo(dst__, src__, interfaceTag__, smeConfig__) \ - { \ - CsrWifiSmeSmeStaConfigSetReq *msg__; \ - CsrWifiSmeSmeStaConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, smeConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeSmeStaConfigSetReqSend(src__, interfaceTag__, smeConfig__) \ - CsrWifiSmeSmeStaConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, smeConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeSmeStaConfigSetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeSmeStaConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_SET_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); - -#define CsrWifiSmeSmeStaConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \ - { \ - CsrWifiSmeSmeStaConfigSetCfm *msg__; \ - CsrWifiSmeSmeStaConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeSmeStaConfigSetCfmSend(dst__, interfaceTag__, status__) \ - CsrWifiSmeSmeStaConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeStationMacAddressGetReqSend - - DESCRIPTION - This primitives is used to retrieve the current MAC address used by the - station. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeStationMacAddressGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeStationMacAddressGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_REQ, dst__, src__); - -#define CsrWifiSmeStationMacAddressGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeStationMacAddressGetReq *msg__; \ - CsrWifiSmeStationMacAddressGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeStationMacAddressGetReqSend(src__) \ - CsrWifiSmeStationMacAddressGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeStationMacAddressGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - stationMacAddress - Current MAC address of the station. - -*******************************************************************************/ -#define CsrWifiSmeStationMacAddressGetCfmCreate(msg__, dst__, src__, status__, stationMacAddress__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeStationMacAddressGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - memcpy(msg__->stationMacAddress, (stationMacAddress__), sizeof(CsrWifiMacAddress) * 2); - -#define CsrWifiSmeStationMacAddressGetCfmSendTo(dst__, src__, status__, stationMacAddress__) \ - { \ - CsrWifiSmeStationMacAddressGetCfm *msg__; \ - CsrWifiSmeStationMacAddressGetCfmCreate(msg__, dst__, src__, status__, stationMacAddress__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeStationMacAddressGetCfmSend(dst__, status__, stationMacAddress__) \ - CsrWifiSmeStationMacAddressGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, stationMacAddress__) - -/******************************************************************************* - - NAME - CsrWifiSmeTspecReqSend - - DESCRIPTION - The wireless manager application should call this primitive to use the - TSPEC feature. - The chip supports the use of TSPECs and TCLAS for the use of IEEE - 802.11/WMM Quality of Service features. - The API allows the wireless manager application to supply a correctly - formatted TSPEC and TCLAS pair to the driver. - After performing basic validation, the driver negotiates the installation - of the TSPEC with the AP as defined by the 802.11 specification. - The driver retains all TSPEC and TCLAS pairs until they are specifically - removed. - It is not compulsory for a TSPEC to have a TCLAS (NULL is used to - indicate that no TCLAS is supplied), while a TCLASS always require a - TSPEC. - The format of the TSPEC element is specified in 'WMM (including WMM Power - Save) Specification - Version 1.1' and 'ANSI/IEEE Std 802.11-REVmb/D3.0'. - For more information, see 'UniFi Configuring WMM and WMM-PS'. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - interfaceTag - Interface Identifier; unique identifier of an interface - action - Specifies the action to be carried out on the list of TSPECs. - CSR_WIFI_SME_LIST_ACTION_FLUSH is not applicable here. - transactionId - Unique Transaction ID for the TSPEC, as assigned by the - driver - strict - If it set to false, allows the SME to perform automatic - TSPEC negotiation - ctrlMask - Additional TSPEC configuration for CCX. - Set mask with values from CsrWifiSmeTspecCtrl. - CURRENTLY NOT SUPPORTED - tspecLength - Length of the TSPEC. - tspec - Points to the first byte of the TSPEC - tclasLength - Length of the TCLAS. - If it is equal to 0, no TCLASS is provided for the TSPEC - tclas - Points to the first byte of the TCLAS, if any. - -*******************************************************************************/ -#define CsrWifiSmeTspecReqCreate(msg__, dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeTspecReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_REQ, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->action = (action__); \ - msg__->transactionId = (transactionId__); \ - msg__->strict = (strict__); \ - msg__->ctrlMask = (ctrlMask__); \ - msg__->tspecLength = (tspecLength__); \ - msg__->tspec = (tspec__); \ - msg__->tclasLength = (tclasLength__); \ - msg__->tclas = (tclas__); - -#define CsrWifiSmeTspecReqSendTo(dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \ - { \ - CsrWifiSmeTspecReq *msg__; \ - CsrWifiSmeTspecReqCreate(msg__, dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeTspecReqSend(src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \ - CsrWifiSmeTspecReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) - -/******************************************************************************* - - NAME - CsrWifiSmeTspecIndSend - - DESCRIPTION - The SME will send this primitive to all the task that have registered to - receive it when a status change in the TSPEC occurs. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - transactionId - Unique Transaction ID for the TSPEC, as assigned by the - driver - tspecResultCode - Specifies the TSPEC operation requested by the peer - station - tspecLength - Length of the TSPEC. - tspec - Points to the first byte of the TSPEC - -*******************************************************************************/ -#define CsrWifiSmeTspecIndCreate(msg__, dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeTspecInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_IND, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->transactionId = (transactionId__); \ - msg__->tspecResultCode = (tspecResultCode__); \ - msg__->tspecLength = (tspecLength__); \ - msg__->tspec = (tspec__); - -#define CsrWifiSmeTspecIndSendTo(dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ - { \ - CsrWifiSmeTspecInd *msg__; \ - CsrWifiSmeTspecIndCreate(msg__, dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeTspecIndSend(dst__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ - CsrWifiSmeTspecIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) - -/******************************************************************************* - - NAME - CsrWifiSmeTspecCfmSend - - DESCRIPTION - The SME calls the primitive to report the result of the TSpec primitive - request. - - PARAMETERS - queue - Destination Task Queue - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - transactionId - Unique Transaction ID for the TSPEC, as assigned by the - driver - tspecResultCode - Specifies the result of the negotiated TSPEC operation - tspecLength - Length of the TSPEC. - tspec - Points to the first byte of the TSPEC - -*******************************************************************************/ -#define CsrWifiSmeTspecCfmCreate(msg__, dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeTspecCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_CFM, dst__, src__); \ - msg__->interfaceTag = (interfaceTag__); \ - msg__->status = (status__); \ - msg__->transactionId = (transactionId__); \ - msg__->tspecResultCode = (tspecResultCode__); \ - msg__->tspecLength = (tspecLength__); \ - msg__->tspec = (tspec__); - -#define CsrWifiSmeTspecCfmSendTo(dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ - { \ - CsrWifiSmeTspecCfm *msg__; \ - CsrWifiSmeTspecCfmCreate(msg__, dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeTspecCfmSend(dst__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \ - CsrWifiSmeTspecCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) - -/******************************************************************************* - - NAME - CsrWifiSmeVersionsGetReqSend - - DESCRIPTION - This primitive gets the value of the Versions parameter. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeVersionsGetReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeVersionsGetReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_VERSIONS_GET_REQ, dst__, src__); - -#define CsrWifiSmeVersionsGetReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeVersionsGetReq *msg__; \ - CsrWifiSmeVersionsGetReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeVersionsGetReqSend(src__) \ - CsrWifiSmeVersionsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeVersionsGetCfmSend - - DESCRIPTION - This primitive reports the result of the request. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - versions - Version IDs of the product - -*******************************************************************************/ -#define CsrWifiSmeVersionsGetCfmCreate(msg__, dst__, src__, status__, versions__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeVersionsGetCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_VERSIONS_GET_CFM, dst__, src__); \ - msg__->status = (status__); \ - msg__->versions = (versions__); - -#define CsrWifiSmeVersionsGetCfmSendTo(dst__, src__, status__, versions__) \ - { \ - CsrWifiSmeVersionsGetCfm *msg__; \ - CsrWifiSmeVersionsGetCfmCreate(msg__, dst__, src__, status__, versions__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeVersionsGetCfmSend(dst__, status__, versions__) \ - CsrWifiSmeVersionsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, versions__) - -/******************************************************************************* - - NAME - CsrWifiSmeWifiFlightmodeReqSend - - DESCRIPTION - The wireless manager application may call this primitive on boot-up of - the platform to ensure that the chip is placed in a mode that prevents - any emission of RF energy. - This primitive is an alternative to CSR_WIFI_SME_WIFI_ON_REQ. - As in CSR_WIFI_SME_WIFI_ON_REQ, it causes the download of the patch file - (if any) and the programming of the initial MIB settings (if supplied by - the WMA), but it also ensures that the chip is left in its lowest - possible power-mode with the radio subsystems disabled. - This feature is useful on platforms where power cannot be removed from - the chip (leaving the chip not initialised will cause it to consume more - power so calling this function ensures that the chip is initialised into - a low power mode but without entering a state where it could emit any RF - energy). - NOTE: this primitive does not cause the Wi-Fi to change state: Wi-Fi - stays conceptually off. Configuration primitives can be sent after - CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ and the configuration will be maintained. - Requests that require the state of the Wi-Fi to be ON will return - CSR_WIFI_SME_STATUS_WIFI_OFF in their confirms. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - address - Optionally specifies a station MAC address. - In normal use, the manager should set the address to 0xFF - 0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use - the MAC address in the MIB. - mibFilesCount - Number of provided data blocks with initial MIB values - mibFiles - Points to the first data block with initial MIB values. - These data blocks are typically the contents of the provided - files ufmib.dat and localmib.dat, available from the host - file system, if they exist. - These files typically contain radio tuning and calibration - values. - More values can be created using the Host Tools. - -*******************************************************************************/ -#define CsrWifiSmeWifiFlightmodeReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeWifiFlightmodeReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ, dst__, src__); \ - msg__->address = (address__); \ - msg__->mibFilesCount = (mibFilesCount__); \ - msg__->mibFiles = (mibFiles__); - -#define CsrWifiSmeWifiFlightmodeReqSendTo(dst__, src__, address__, mibFilesCount__, mibFiles__) \ - { \ - CsrWifiSmeWifiFlightmodeReq *msg__; \ - CsrWifiSmeWifiFlightmodeReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeWifiFlightmodeReqSend(src__, address__, mibFilesCount__, mibFiles__) \ - CsrWifiSmeWifiFlightmodeReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, address__, mibFilesCount__, mibFiles__) - -/******************************************************************************* - - NAME - CsrWifiSmeWifiFlightmodeCfmSend - - DESCRIPTION - The SME calls this primitive when the chip is initialised for low power - mode and with the radio subsystem disabled. To leave flight mode, and - enable Wi-Fi, the wireless manager application should call - CSR_WIFI_SME_WIFI_ON_REQ. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeWifiFlightmodeCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeWifiFlightmodeCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_FLIGHTMODE_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeWifiFlightmodeCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeWifiFlightmodeCfm *msg__; \ - CsrWifiSmeWifiFlightmodeCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeWifiFlightmodeCfmSend(dst__, status__) \ - CsrWifiSmeWifiFlightmodeCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeWifiOffReqSend - - DESCRIPTION - The wireless manager application calls this primitive to turn off the - chip, thus saving power when Wi-Fi is not in use. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - -*******************************************************************************/ -#define CsrWifiSmeWifiOffReqCreate(msg__, dst__, src__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeWifiOffReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_REQ, dst__, src__); - -#define CsrWifiSmeWifiOffReqSendTo(dst__, src__) \ - { \ - CsrWifiSmeWifiOffReq *msg__; \ - CsrWifiSmeWifiOffReqCreate(msg__, dst__, src__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeWifiOffReqSend(src__) \ - CsrWifiSmeWifiOffReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__) - -/******************************************************************************* - - NAME - CsrWifiSmeWifiOffIndSend - - DESCRIPTION - The SME sends this primitive to all the tasks that have registered to - receive it to report that the chip has been turned off. - - PARAMETERS - queue - Destination Task Queue - reason - Indicates the reason why the Wi-Fi has been switched off. - -*******************************************************************************/ -#define CsrWifiSmeWifiOffIndCreate(msg__, dst__, src__, reason__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeWifiOffInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_IND, dst__, src__); \ - msg__->reason = (reason__); - -#define CsrWifiSmeWifiOffIndSendTo(dst__, src__, reason__) \ - { \ - CsrWifiSmeWifiOffInd *msg__; \ - CsrWifiSmeWifiOffIndCreate(msg__, dst__, src__, reason__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeWifiOffIndSend(dst__, reason__) \ - CsrWifiSmeWifiOffIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, reason__) - -/******************************************************************************* - - NAME - CsrWifiSmeWifiOffCfmSend - - DESCRIPTION - After receiving CSR_WIFI_SME_WIFI_OFF_REQ, if the chip is connected to a - network, the SME will perform a disconnect operation, will send a - CSR_WIFI_SME_MEDIA_STATUS_IND with - CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED, and then will call - CSR_WIFI_SME_WIFI_OFF_CFM when the chip is off. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeWifiOffCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeWifiOffCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeWifiOffCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeWifiOffCfm *msg__; \ - CsrWifiSmeWifiOffCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeWifiOffCfmSend(dst__, status__) \ - CsrWifiSmeWifiOffCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeWifiOnReqSend - - DESCRIPTION - The wireless manager application calls this primitive to turn on the - Wi-Fi chip. - If the Wi-Fi chip is currently off, the SME turns the Wi-Fi chip on, - downloads the patch file (if any), and programs the initial MIB settings - (if supplied by the WMA). - The patch file is not provided with the SME API; its downloading is - automatic and handled internally by the system. - The MIB settings, when provided, override the default values that the - firmware loads from EEPROM. - If the Wi-Fi chip is already on, the SME takes no action and returns a - successful status in the confirm. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - address - Optionally specifies a station MAC address. - In normal use, the manager should set the address to 0xFF - 0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use - the MAC address in the MIB - mibFilesCount - Number of provided data blocks with initial MIB values - mibFiles - Points to the first data block with initial MIB values. - These data blocks are typically the contents of the provided - files ufmib.dat and localmib.dat, available from the host - file system, if they exist. - These files typically contain radio tuning and calibration - values. - More values can be created using the Host Tools. - -*******************************************************************************/ -#define CsrWifiSmeWifiOnReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeWifiOnReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_REQ, dst__, src__); \ - msg__->address = (address__); \ - msg__->mibFilesCount = (mibFilesCount__); \ - msg__->mibFiles = (mibFiles__); - -#define CsrWifiSmeWifiOnReqSendTo(dst__, src__, address__, mibFilesCount__, mibFiles__) \ - { \ - CsrWifiSmeWifiOnReq *msg__; \ - CsrWifiSmeWifiOnReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeWifiOnReqSend(src__, address__, mibFilesCount__, mibFiles__) \ - CsrWifiSmeWifiOnReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, address__, mibFilesCount__, mibFiles__) - -/******************************************************************************* - - NAME - CsrWifiSmeWifiOnIndSend - - DESCRIPTION - The SME sends this primitive to all tasks that have registered to receive - it once the chip becomes available and ready to use. - - PARAMETERS - queue - Destination Task Queue - address - Current MAC address - -*******************************************************************************/ -#define CsrWifiSmeWifiOnIndCreate(msg__, dst__, src__, address__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeWifiOnInd), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_IND, dst__, src__); \ - msg__->address = (address__); - -#define CsrWifiSmeWifiOnIndSendTo(dst__, src__, address__) \ - { \ - CsrWifiSmeWifiOnInd *msg__; \ - CsrWifiSmeWifiOnIndCreate(msg__, dst__, src__, address__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeWifiOnIndSend(dst__, address__) \ - CsrWifiSmeWifiOnIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, address__) - -/******************************************************************************* - - NAME - CsrWifiSmeWifiOnCfmSend - - DESCRIPTION - The SME sends this primitive to the task that has sent the request once - the chip has been initialised and is available for use. - - PARAMETERS - queue - Destination Task Queue - status - Reports the result of the request - -*******************************************************************************/ -#define CsrWifiSmeWifiOnCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeWifiOnCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeWifiOnCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeWifiOnCfm *msg__; \ - CsrWifiSmeWifiOnCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeWifiOnCfmSend(dst__, status__) \ - CsrWifiSmeWifiOnCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -/******************************************************************************* - - NAME - CsrWifiSmeWpsConfigurationReqSend - - DESCRIPTION - This primitive passes the WPS information for the device to SME. This may - be accepted only if no interface is active. - - PARAMETERS - queue - Message Source Task Queue (Cfm's will be sent to this Queue) - wpsConfig - WPS config. - -*******************************************************************************/ -#define CsrWifiSmeWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeWpsConfigurationReq), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WPS_CONFIGURATION_REQ, dst__, src__); \ - msg__->wpsConfig = (wpsConfig__); - -#define CsrWifiSmeWpsConfigurationReqSendTo(dst__, src__, wpsConfig__) \ - { \ - CsrWifiSmeWpsConfigurationReq *msg__; \ - CsrWifiSmeWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__); \ - CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeWpsConfigurationReqSend(src__, wpsConfig__) \ - CsrWifiSmeWpsConfigurationReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, wpsConfig__) - -/******************************************************************************* - - NAME - CsrWifiSmeWpsConfigurationCfmSend - - DESCRIPTION - Confirm. - - PARAMETERS - queue - Destination Task Queue - status - Status of the request. - -*******************************************************************************/ -#define CsrWifiSmeWpsConfigurationCfmCreate(msg__, dst__, src__, status__) \ - msg__ = kmalloc(sizeof(CsrWifiSmeWpsConfigurationCfm), GFP_KERNEL); \ - CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WPS_CONFIGURATION_CFM, dst__, src__); \ - msg__->status = (status__); - -#define CsrWifiSmeWpsConfigurationCfmSendTo(dst__, src__, status__) \ - { \ - CsrWifiSmeWpsConfigurationCfm *msg__; \ - CsrWifiSmeWpsConfigurationCfmCreate(msg__, dst__, src__, status__); \ - CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \ - } - -#define CsrWifiSmeWpsConfigurationCfmSend(dst__, status__) \ - CsrWifiSmeWpsConfigurationCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__) - -#endif /* CSR_WIFI_SME_LIB_H__ */ diff --git a/drivers/staging/csr/csr_wifi_sme_prim.h b/drivers/staging/csr/csr_wifi_sme_prim.h deleted file mode 100644 index 17ec79c77e54..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_prim.h +++ /dev/null @@ -1,6510 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_SME_PRIM_H__ -#define CSR_WIFI_SME_PRIM_H__ - -#include <linux/types.h> -#include "csr_prim_defs.h" -#include "csr_sched.h" -#include "csr_wifi_common.h" -#include "csr_result.h" -#include "csr_wifi_fsm_event.h" - -#define CSR_WIFI_SME_PRIM (0x0404) - -typedef CsrPrim CsrWifiSmePrim; - - -/******************************************************************************* - - NAME - CsrWifiSme80211NetworkType - - DESCRIPTION - Indicates the physical layer of the network - - VALUES - CSR_WIFI_SME_80211_NETWORK_TYPE_DS - - Direct-sequence spread spectrum - CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM24 - - Orthogonal Frequency Division Multiplexing at 2.4 GHz - CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM5 - - Orthogonal Frequency Division Multiplexing at 5 GHz - CSR_WIFI_SME_80211_NETWORK_TYPE_AUTO - - Automatic - -*******************************************************************************/ -typedef u8 CsrWifiSme80211NetworkType; -#define CSR_WIFI_SME_80211_NETWORK_TYPE_DS ((CsrWifiSme80211NetworkType) 0x00) -#define CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM24 ((CsrWifiSme80211NetworkType) 0x01) -#define CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM5 ((CsrWifiSme80211NetworkType) 0x02) -#define CSR_WIFI_SME_80211_NETWORK_TYPE_AUTO ((CsrWifiSme80211NetworkType) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSme80211PrivacyMode - - DESCRIPTION - Bits to enable or disable the privacy mode - - VALUES - CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED - - Privacy mode is enabled: use of WEP for confidentiality is - required. - CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED - - Privacy mode is disabled - -*******************************************************************************/ -typedef u8 CsrWifiSme80211PrivacyMode; -#define CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED ((CsrWifiSme80211PrivacyMode) 0x00) -#define CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED ((CsrWifiSme80211PrivacyMode) 0x01) - -/******************************************************************************* - - NAME - CsrWifiSme80211dTrustLevel - - DESCRIPTION - Level of trust for the information coming from the network - - VALUES - CSR_WIFI_SME_80211D_TRUST_LEVEL_STRICT - - Start with passive scanning and only accept country IE for - updating channel lists - CSR_WIFI_SME_80211D_TRUST_LEVEL_ADJUNCT - - As above plus accept adjunct technology location - information - CSR_WIFI_SME_80211D_TRUST_LEVEL_BSS - - As above accept plus receiving channel from infrastructure - networks - CSR_WIFI_SME_80211D_TRUST_LEVEL_IBSS - - As above accept plus receiving channel from the ad hoc - networks - CSR_WIFI_SME_80211D_TRUST_LEVEL_MIB - - Start with active scanning with list of active channels - from the MIB and accept as above - CSR_WIFI_SME_80211D_TRUST_LEVEL_DISABLED - - Start with active scanning with list of active channels - from the MIB and ignore any channel information from the - network - -*******************************************************************************/ -typedef u8 CsrWifiSme80211dTrustLevel; -#define CSR_WIFI_SME_80211D_TRUST_LEVEL_STRICT ((CsrWifiSme80211dTrustLevel) 0x01) -#define CSR_WIFI_SME_80211D_TRUST_LEVEL_ADJUNCT ((CsrWifiSme80211dTrustLevel) 0x02) -#define CSR_WIFI_SME_80211D_TRUST_LEVEL_BSS ((CsrWifiSme80211dTrustLevel) 0x03) -#define CSR_WIFI_SME_80211D_TRUST_LEVEL_IBSS ((CsrWifiSme80211dTrustLevel) 0x04) -#define CSR_WIFI_SME_80211D_TRUST_LEVEL_MIB ((CsrWifiSme80211dTrustLevel) 0x05) -#define CSR_WIFI_SME_80211D_TRUST_LEVEL_DISABLED ((CsrWifiSme80211dTrustLevel) 0x06) - -/******************************************************************************* - - NAME - CsrWifiSmeAmpStatus - - DESCRIPTION - AMP Current Status - - VALUES - CSR_WIFI_SME_AMP_ACTIVE - AMP ACTIVE. - CSR_WIFI_SME_AMP_INACTIVE - AMP INACTIVE - -*******************************************************************************/ -typedef u8 CsrWifiSmeAmpStatus; -#define CSR_WIFI_SME_AMP_ACTIVE ((CsrWifiSmeAmpStatus) 0x00) -#define CSR_WIFI_SME_AMP_INACTIVE ((CsrWifiSmeAmpStatus) 0x01) - -/******************************************************************************* - - NAME - CsrWifiSmeAuthMode - - DESCRIPTION - Define bits for CsrWifiSmeAuthMode - - VALUES - CSR_WIFI_SME_AUTH_MODE_80211_OPEN - - Connects to an open system network (i.e. no authentication, - no encryption) or to a WEP enabled network. - CSR_WIFI_SME_AUTH_MODE_80211_SHARED - - Connect to a WEP enabled network. - CSR_WIFI_SME_AUTH_MODE_8021X_WPA - - Connects to a WPA Enterprise enabled network. - CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK - - Connects to a WPA with Pre-Shared Key enabled network. - CSR_WIFI_SME_AUTH_MODE_8021X_WPA2 - - Connects to a WPA2 Enterprise enabled network. - CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK - - Connects to a WPA2 with Pre-Shared Key enabled network. - CSR_WIFI_SME_AUTH_MODE_8021X_CCKM - - Connects to a CCKM enabled network. - CSR_WIFI_SME_AUTH_MODE_WAPI_WAI - - Connects to a WAPI Enterprise enabled network. - CSR_WIFI_SME_AUTH_MODE_WAPI_WAIPSK - - Connects to a WAPI with Pre-Shared Key enabled network. - CSR_WIFI_SME_AUTH_MODE_8021X_OTHER1X - - For future use. - -*******************************************************************************/ -typedef u16 CsrWifiSmeAuthMode; -#define CSR_WIFI_SME_AUTH_MODE_80211_OPEN ((CsrWifiSmeAuthMode) 0x0001) -#define CSR_WIFI_SME_AUTH_MODE_80211_SHARED ((CsrWifiSmeAuthMode) 0x0002) -#define CSR_WIFI_SME_AUTH_MODE_8021X_WPA ((CsrWifiSmeAuthMode) 0x0004) -#define CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK ((CsrWifiSmeAuthMode) 0x0008) -#define CSR_WIFI_SME_AUTH_MODE_8021X_WPA2 ((CsrWifiSmeAuthMode) 0x0010) -#define CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK ((CsrWifiSmeAuthMode) 0x0020) -#define CSR_WIFI_SME_AUTH_MODE_8021X_CCKM ((CsrWifiSmeAuthMode) 0x0040) -#define CSR_WIFI_SME_AUTH_MODE_WAPI_WAI ((CsrWifiSmeAuthMode) 0x0080) -#define CSR_WIFI_SME_AUTH_MODE_WAPI_WAIPSK ((CsrWifiSmeAuthMode) 0x0100) -#define CSR_WIFI_SME_AUTH_MODE_8021X_OTHER1X ((CsrWifiSmeAuthMode) 0x0200) - -/******************************************************************************* - - NAME - CsrWifiSmeBasicUsability - - DESCRIPTION - Indicates the usability level of a channel - - VALUES - CSR_WIFI_SME_BASIC_USABILITY_UNUSABLE - - Not usable; connection not recommended - CSR_WIFI_SME_BASIC_USABILITY_POOR - - Poor quality; connect only if nothing better is available - CSR_WIFI_SME_BASIC_USABILITY_SATISFACTORY - - Quality is satisfactory - CSR_WIFI_SME_BASIC_USABILITY_NOT_CONNECTED - - Not connected - -*******************************************************************************/ -typedef u8 CsrWifiSmeBasicUsability; -#define CSR_WIFI_SME_BASIC_USABILITY_UNUSABLE ((CsrWifiSmeBasicUsability) 0x00) -#define CSR_WIFI_SME_BASIC_USABILITY_POOR ((CsrWifiSmeBasicUsability) 0x01) -#define CSR_WIFI_SME_BASIC_USABILITY_SATISFACTORY ((CsrWifiSmeBasicUsability) 0x02) -#define CSR_WIFI_SME_BASIC_USABILITY_NOT_CONNECTED ((CsrWifiSmeBasicUsability) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSmeBssType - - DESCRIPTION - Indicates the BSS type - - VALUES - CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE - - Infrastructure BSS. - CSR_WIFI_SME_BSS_TYPE_ADHOC - - Ad hoc or Independent BSS. - CSR_WIFI_SME_BSS_TYPE_ANY_BSS - - Specifies any type of BSS - CSR_WIFI_SME_BSS_TYPE_P2P - - Specifies P2P - -*******************************************************************************/ -typedef u8 CsrWifiSmeBssType; -#define CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE ((CsrWifiSmeBssType) 0x00) -#define CSR_WIFI_SME_BSS_TYPE_ADHOC ((CsrWifiSmeBssType) 0x01) -#define CSR_WIFI_SME_BSS_TYPE_ANY_BSS ((CsrWifiSmeBssType) 0x02) -#define CSR_WIFI_SME_BSS_TYPE_P2P ((CsrWifiSmeBssType) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSmeCoexScheme - - DESCRIPTION - Options for the coexistence signalling - Same as MibValues - - VALUES - CSR_WIFI_SME_COEX_SCHEME_DISABLED - - The coexistence signalling is disabled - CSR_WIFI_SME_COEX_SCHEME_CSR - - Basic CSR coexistence signalling - CSR_WIFI_SME_COEX_SCHEME_CSR_CHANNEL - - Full CSR coexistence signalling - CSR_WIFI_SME_COEX_SCHEME_PTA - - Packet Traffic Arbitrator coexistence signalling - -*******************************************************************************/ -typedef u8 CsrWifiSmeCoexScheme; -#define CSR_WIFI_SME_COEX_SCHEME_DISABLED ((CsrWifiSmeCoexScheme) 0x00) -#define CSR_WIFI_SME_COEX_SCHEME_CSR ((CsrWifiSmeCoexScheme) 0x01) -#define CSR_WIFI_SME_COEX_SCHEME_CSR_CHANNEL ((CsrWifiSmeCoexScheme) 0x02) -#define CSR_WIFI_SME_COEX_SCHEME_PTA ((CsrWifiSmeCoexScheme) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSmeControlIndication - - DESCRIPTION - Indicates the reason why the Wi-Fi has been switched off. - The values of this type are used across the NME/SME/Router API's and they - must be kept consistent with the corresponding types in the .xml of the - ottherinterfaces - - VALUES - CSR_WIFI_SME_CONTROL_INDICATION_ERROR - - An unrecoverable error (for example, an unrecoverable SDIO - error) has occurred. - The wireless manager application should reinitialise the - chip by calling CSR_WIFI_SME_WIFI_ON_REQ. - CSR_WIFI_SME_CONTROL_INDICATION_EXIT - - The chip became unavailable due to an external action, for - example, when a plug-in card is ejected or the driver is - unloaded. - CSR_WIFI_SME_CONTROL_INDICATION_USER_REQUESTED - - The Wi-Fi has been switched off as the wireless manager - application has sent CSR_WIFI_SME_WIFI_OFF_REQ - -*******************************************************************************/ -typedef u8 CsrWifiSmeControlIndication; -#define CSR_WIFI_SME_CONTROL_INDICATION_ERROR ((CsrWifiSmeControlIndication) 0x01) -#define CSR_WIFI_SME_CONTROL_INDICATION_EXIT ((CsrWifiSmeControlIndication) 0x02) -#define CSR_WIFI_SME_CONTROL_INDICATION_USER_REQUESTED ((CsrWifiSmeControlIndication) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSmeCtsProtectionType - - DESCRIPTION - SME CTS Protection Types - - VALUES - CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC - - AP CTS Protection automatic based on non-ERP station in own - BSS or neighbouring BSS on the same channel based on OLBC. - This requires monitoring of beacons from other APs. - CSR_WIFI_SME_CTS_PROTECTION_FORCE_ENABLED - - AP CTS Protection Force enabled - CSR_WIFI_SME_CTS_PROTECTION_FORCE_DISABLED - - AP CTS Protection Force disabled. - CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC_NO_OLBC - - AP CTS Protection automatic without considering OLBC but - considering non-ERP station in the own BSS Valid only if AP - is configured to work in 802.11bg or 802.11g mode otherwise - this option specifies the same behaviour as AUTOMATIC - -*******************************************************************************/ -typedef u8 CsrWifiSmeCtsProtectionType; -#define CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC ((CsrWifiSmeCtsProtectionType) 0x00) -#define CSR_WIFI_SME_CTS_PROTECTION_FORCE_ENABLED ((CsrWifiSmeCtsProtectionType) 0x01) -#define CSR_WIFI_SME_CTS_PROTECTION_FORCE_DISABLED ((CsrWifiSmeCtsProtectionType) 0x02) -#define CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC_NO_OLBC ((CsrWifiSmeCtsProtectionType) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSmeD3AutoScanMode - - DESCRIPTION - Autonomous scan status while in D3 suspended period - - VALUES - CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSON - - Autonomous scan stays on - CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSOFF - - Autonomous scan is switched off - CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSAUTO - - Automatically select autoscanning behaviour. - CURRENTLY NOT SUPPORTED - -*******************************************************************************/ -typedef u8 CsrWifiSmeD3AutoScanMode; -#define CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSON ((CsrWifiSmeD3AutoScanMode) 0x00) -#define CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSOFF ((CsrWifiSmeD3AutoScanMode) 0x01) -#define CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSAUTO ((CsrWifiSmeD3AutoScanMode) 0x02) - -/******************************************************************************* - - NAME - CsrWifiSmeEncryption - - DESCRIPTION - Defines bits for CsrWifiSmeEncryption - For a WEP enabled network, the caller must specify the correct - combination of flags in the encryptionModeMask. - - VALUES - CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE - - No encryption set - CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 - - Selects 40 byte key WEP for unicast communication - CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 - - Selects 104 byte key WEP for unicast communication - CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_TKIP - - Selects TKIP for unicast communication - CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_CCMP - - Selects CCMP for unicast communication - CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 - - Selects SMS4 for unicast communication - CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40 - - Selects 40 byte key WEP for broadcast messages - CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104 - - Selects 104 byte key WEP for broadcast messages - CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP - - Selects a TKIP for broadcast messages - CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP - - Selects CCMP for broadcast messages - CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_SMS4 - - Selects SMS4 for broadcast messages - -*******************************************************************************/ -typedef u16 CsrWifiSmeEncryption; -#define CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE ((CsrWifiSmeEncryption) 0x0000) -#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 ((CsrWifiSmeEncryption) 0x0001) -#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 ((CsrWifiSmeEncryption) 0x0002) -#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_TKIP ((CsrWifiSmeEncryption) 0x0004) -#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_CCMP ((CsrWifiSmeEncryption) 0x0008) -#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 ((CsrWifiSmeEncryption) 0x0010) -#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40 ((CsrWifiSmeEncryption) 0x0020) -#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104 ((CsrWifiSmeEncryption) 0x0040) -#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP ((CsrWifiSmeEncryption) 0x0080) -#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP ((CsrWifiSmeEncryption) 0x0100) -#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_SMS4 ((CsrWifiSmeEncryption) 0x0200) - -/******************************************************************************* - - NAME - CsrWifiSmeFirmwareDriverInterface - - DESCRIPTION - Type of communication between Host and Firmware - - VALUES - CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_UNIT_DATA_INTERFACE - - No preformated header. NOT SUPPORTED in the current release - CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_PACKET_INTERFACE - - Preformated IEEE 802.11 header for user plane - -*******************************************************************************/ -typedef u8 CsrWifiSmeFirmwareDriverInterface; -#define CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_UNIT_DATA_INTERFACE ((CsrWifiSmeFirmwareDriverInterface) 0x00) -#define CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_PACKET_INTERFACE ((CsrWifiSmeFirmwareDriverInterface) 0x01) - -/******************************************************************************* - - NAME - CsrWifiSmeHostPowerMode - - DESCRIPTION - Defines the power mode - - VALUES - CSR_WIFI_SME_HOST_POWER_MODE_ACTIVE - - Host device is running on external power. - CSR_WIFI_SME_HOST_POWER_MODE_POWER_SAVE - - Host device is running on (internal) battery power. - CSR_WIFI_SME_HOST_POWER_MODE_FULL_POWER_SAVE - - For future use. - -*******************************************************************************/ -typedef u8 CsrWifiSmeHostPowerMode; -#define CSR_WIFI_SME_HOST_POWER_MODE_ACTIVE ((CsrWifiSmeHostPowerMode) 0x00) -#define CSR_WIFI_SME_HOST_POWER_MODE_POWER_SAVE ((CsrWifiSmeHostPowerMode) 0x01) -#define CSR_WIFI_SME_HOST_POWER_MODE_FULL_POWER_SAVE ((CsrWifiSmeHostPowerMode) 0x02) - -/******************************************************************************* - - NAME - CsrWifiSmeIEEE80211Reason - - DESCRIPTION - As definined in the IEEE 802.11 standards - - VALUES - CSR_WIFI_SME_IEEE80211_REASON_SUCCESS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_UNSPECIFIED_REASON - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_AUTHENTICATION_NOT_VALID - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_DEAUTHENTICATED_LEAVE_BSS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_INACTIVITY - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_AP_OVERLOAD - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_CLASS_2FRAME_ERROR - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_CLASS_3FRAME_ERROR - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_LEAVE_BSS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_ASSOCIATION_NOT_AUTHENTICATED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_POWER_CAPABILITY - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_SUPPORTED_CHANNELS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_INVALID_INFORMATION_ELEMENT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_MICHAEL_MIC_FAILURE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_FOURWAY_HANDSHAKE_TIMEOUT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_HANDSHAKE_ELEMENT_DIFFERENT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_INVALID_GROUP_CIPHER - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_INVALID_PAIRWISE_CIPHER - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_INVALID_AKMP - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_UNSUPPORTED_RSN_IEVERSION - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_INVALID_RSN_IECAPABILITIES - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_DOT1X_AUTH_FAILED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_CIPHER_REJECTED_BY_POLICY - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_SERVICE_CHANGE_PRECLUDES_TS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_QOS_UNSPECIFIED_REASON - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_QOS_INSUFFICIENT_BANDWIDTH - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_QOS_EXCESSIVE_NOT_ACK - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_QOS_TXOPLIMIT_EXCEEDED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_QSTA_LEAVING - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_END_TS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_END_DLS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_END_BA - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_TS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_BA - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_DLS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_TIMEOUT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_STAKEY_MISMATCH - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_UNICAST_KEY_NEGOTIATION_TIMEOUT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_MULTICAST_KEY_ANNOUNCEMENT_TIMEOUT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_INCOMPATIBLE_UNICAST_KEY_NEGOTIATION_IE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_INVALID_MULTICAST_CIPHER - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_INVALID_UNICAST_CIPHER - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_UNSUPPORTED_WAPI_IE_VERSION - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_INVALID_WAPI_CAPABILITY_IE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_REASON_WAI_CERTIFICATE_AUTHENTICATION_FAILED - - See IEEE 802.11 Standard - -*******************************************************************************/ -typedef u16 CsrWifiSmeIEEE80211Reason; -#define CSR_WIFI_SME_IEEE80211_REASON_SUCCESS ((CsrWifiSmeIEEE80211Reason) 0x0000) -#define CSR_WIFI_SME_IEEE80211_REASON_UNSPECIFIED_REASON ((CsrWifiSmeIEEE80211Reason) 0x0001) -#define CSR_WIFI_SME_IEEE80211_REASON_AUTHENTICATION_NOT_VALID ((CsrWifiSmeIEEE80211Reason) 0x0002) -#define CSR_WIFI_SME_IEEE80211_REASON_DEAUTHENTICATED_LEAVE_BSS ((CsrWifiSmeIEEE80211Reason) 0x0003) -#define CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_INACTIVITY ((CsrWifiSmeIEEE80211Reason) 0x0004) -#define CSR_WIFI_SME_IEEE80211_REASON_AP_OVERLOAD ((CsrWifiSmeIEEE80211Reason) 0x0005) -#define CSR_WIFI_SME_IEEE80211_REASON_CLASS_2FRAME_ERROR ((CsrWifiSmeIEEE80211Reason) 0x0006) -#define CSR_WIFI_SME_IEEE80211_REASON_CLASS_3FRAME_ERROR ((CsrWifiSmeIEEE80211Reason) 0x0007) -#define CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_LEAVE_BSS ((CsrWifiSmeIEEE80211Reason) 0x0008) -#define CSR_WIFI_SME_IEEE80211_REASON_ASSOCIATION_NOT_AUTHENTICATED ((CsrWifiSmeIEEE80211Reason) 0x0009) -#define CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_POWER_CAPABILITY ((CsrWifiSmeIEEE80211Reason) 0x000a) -#define CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_SUPPORTED_CHANNELS ((CsrWifiSmeIEEE80211Reason) 0x000b) -#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_INFORMATION_ELEMENT ((CsrWifiSmeIEEE80211Reason) 0x000d) -#define CSR_WIFI_SME_IEEE80211_REASON_MICHAEL_MIC_FAILURE ((CsrWifiSmeIEEE80211Reason) 0x000e) -#define CSR_WIFI_SME_IEEE80211_REASON_FOURWAY_HANDSHAKE_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0x000f) -#define CSR_WIFI_SME_IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0x0010) -#define CSR_WIFI_SME_IEEE80211_REASON_HANDSHAKE_ELEMENT_DIFFERENT ((CsrWifiSmeIEEE80211Reason) 0x0011) -#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_GROUP_CIPHER ((CsrWifiSmeIEEE80211Reason) 0x0012) -#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_PAIRWISE_CIPHER ((CsrWifiSmeIEEE80211Reason) 0x0013) -#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_AKMP ((CsrWifiSmeIEEE80211Reason) 0x0014) -#define CSR_WIFI_SME_IEEE80211_REASON_UNSUPPORTED_RSN_IEVERSION ((CsrWifiSmeIEEE80211Reason) 0x0015) -#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_RSN_IECAPABILITIES ((CsrWifiSmeIEEE80211Reason) 0x0016) -#define CSR_WIFI_SME_IEEE80211_REASON_DOT1X_AUTH_FAILED ((CsrWifiSmeIEEE80211Reason) 0x0017) -#define CSR_WIFI_SME_IEEE80211_REASON_CIPHER_REJECTED_BY_POLICY ((CsrWifiSmeIEEE80211Reason) 0x0018) -#define CSR_WIFI_SME_IEEE80211_REASON_SERVICE_CHANGE_PRECLUDES_TS ((CsrWifiSmeIEEE80211Reason) 0x001F) -#define CSR_WIFI_SME_IEEE80211_REASON_QOS_UNSPECIFIED_REASON ((CsrWifiSmeIEEE80211Reason) 0x0020) -#define CSR_WIFI_SME_IEEE80211_REASON_QOS_INSUFFICIENT_BANDWIDTH ((CsrWifiSmeIEEE80211Reason) 0x0021) -#define CSR_WIFI_SME_IEEE80211_REASON_QOS_EXCESSIVE_NOT_ACK ((CsrWifiSmeIEEE80211Reason) 0x0022) -#define CSR_WIFI_SME_IEEE80211_REASON_QOS_TXOPLIMIT_EXCEEDED ((CsrWifiSmeIEEE80211Reason) 0x0023) -#define CSR_WIFI_SME_IEEE80211_REASON_QSTA_LEAVING ((CsrWifiSmeIEEE80211Reason) 0x0024) -#define CSR_WIFI_SME_IEEE80211_REASON_END_TS ((CsrWifiSmeIEEE80211Reason) 0x0025) -#define CSR_WIFI_SME_IEEE80211_REASON_END_DLS ((CsrWifiSmeIEEE80211Reason) 0x0025) -#define CSR_WIFI_SME_IEEE80211_REASON_END_BA ((CsrWifiSmeIEEE80211Reason) 0x0025) -#define CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_TS ((CsrWifiSmeIEEE80211Reason) 0x0026) -#define CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_BA ((CsrWifiSmeIEEE80211Reason) 0x0026) -#define CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_DLS ((CsrWifiSmeIEEE80211Reason) 0x0026) -#define CSR_WIFI_SME_IEEE80211_REASON_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0x0027) -#define CSR_WIFI_SME_IEEE80211_REASON_STAKEY_MISMATCH ((CsrWifiSmeIEEE80211Reason) 0x002d) -#define CSR_WIFI_SME_IEEE80211_REASON_UNICAST_KEY_NEGOTIATION_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0xf019) -#define CSR_WIFI_SME_IEEE80211_REASON_MULTICAST_KEY_ANNOUNCEMENT_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0xf01a) -#define CSR_WIFI_SME_IEEE80211_REASON_INCOMPATIBLE_UNICAST_KEY_NEGOTIATION_IE ((CsrWifiSmeIEEE80211Reason) 0xf01b) -#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_MULTICAST_CIPHER ((CsrWifiSmeIEEE80211Reason) 0xf01c) -#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_UNICAST_CIPHER ((CsrWifiSmeIEEE80211Reason) 0xf01d) -#define CSR_WIFI_SME_IEEE80211_REASON_UNSUPPORTED_WAPI_IE_VERSION ((CsrWifiSmeIEEE80211Reason) 0xf01e) -#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_WAPI_CAPABILITY_IE ((CsrWifiSmeIEEE80211Reason) 0xf01f) -#define CSR_WIFI_SME_IEEE80211_REASON_WAI_CERTIFICATE_AUTHENTICATION_FAILED ((CsrWifiSmeIEEE80211Reason) 0xf020) - -/******************************************************************************* - - NAME - CsrWifiSmeIEEE80211Result - - DESCRIPTION - As definined in the IEEE 802.11 standards - - VALUES - CSR_WIFI_SME_IEEE80211_RESULT_SUCCESS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_FAILURE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CAPABILITIES_MISMATCH - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REASSOCIATION_DENIED_NO_ASSOCIATION - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_EXTERNAL_REASON - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AUTHENTICATION_MISMATCH - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_INVALID_AUTHENTICATION_SEQUENCE_NUMBER - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CHALLENGE_FAILURE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AUTHENTICATION_TIMEOUT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AP_OUT_OF_MEMORY - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_BASIC_RATES_MISMATCH - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SHORT_PREAMBLE_REQUIRED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_PBCC_MODULATION_REQUIRED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CHANNEL_AGILITY_REQUIRED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SPECTRUM_MANAGEMENT_REQUIRED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_POWER_CAPABILITY_UNACCEPTABLE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SUPPORTED_CHANNELS_UNACCEPTABLE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SHORT_SLOT_REQUIRED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_DSSS_OFDMREQUIRED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_NO_HT_SUPPORT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_R0KH_UNREACHABLE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_PCO_TRANSITION_SUPPORT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_ASSOCIATION_REQUEST_REJECTED_TEMPORARILY - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_ROBUST_MANAGEMENT_FRAME_POLICY_VIOLATION - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_FAILURE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AP_BANDWIDTH_INSUFFICIENT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_POOR_OPERATING_CHANNEL - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_QOS_REQUIRED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_REASON_UNSPECIFIED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_INVALID_PARAMETERS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_WITH_SUGGESTED_TSPEC_CHANGES - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_IE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_GROUP_CIPHER - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_PAIRWISE_CIPHER - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_AKMP - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_UNSUPPORTED_RSN_VERSION - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_RSN_CAPABILITY - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_SECURITY_POLICY - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_FOR_DELAY_PERIOD - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_NOT_ALLOWED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_NOT_PRESENT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_NOT_QSTA - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_LISTEN_INTERVAL_TOO_LARGE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_INVALID_FT_ACTION_FRAME_COUNT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_INVALID_PMKID - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_INVALID_MDIE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_INVALID_FTIE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_QOS_FAILURE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_WRONG_POLICY - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_INSUFFICIENT_BANDWIDTH - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_INVALID_TSPEC_PARAMETERS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_TIMEOUT - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_TOO_MANY_SIMULTANEOUS_REQUESTS - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_BSS_ALREADY_STARTED_OR_JOINED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_NOT_SUPPORTED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_TRANSMISSION_FAILURE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_NOT_AUTHENTICATED - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_RESET_REQUIRED_BEFORE_START - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_LM_INFO_UNAVAILABLE - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_INVALID_UNICAST_CIPHER - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_INVALID_MULTICAST_CIPHER - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_UNSUPPORTED_WAPI_IE_VERSION - - See IEEE 802.11 Standard - CSR_WIFI_SME_IEEE80211_RESULT_INVALID_WAPI_CAPABILITY_IE - - See IEEE 802.11 Standard - -*******************************************************************************/ -typedef u16 CsrWifiSmeIEEE80211Result; -#define CSR_WIFI_SME_IEEE80211_RESULT_SUCCESS ((CsrWifiSmeIEEE80211Result) 0x0000) -#define CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_FAILURE ((CsrWifiSmeIEEE80211Result) 0x0001) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CAPABILITIES_MISMATCH ((CsrWifiSmeIEEE80211Result) 0x000a) -#define CSR_WIFI_SME_IEEE80211_RESULT_REASSOCIATION_DENIED_NO_ASSOCIATION ((CsrWifiSmeIEEE80211Result) 0x000b) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_EXTERNAL_REASON ((CsrWifiSmeIEEE80211Result) 0x000c) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AUTHENTICATION_MISMATCH ((CsrWifiSmeIEEE80211Result) 0x000d) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_INVALID_AUTHENTICATION_SEQUENCE_NUMBER ((CsrWifiSmeIEEE80211Result) 0x000e) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CHALLENGE_FAILURE ((CsrWifiSmeIEEE80211Result) 0x000f) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AUTHENTICATION_TIMEOUT ((CsrWifiSmeIEEE80211Result) 0x0010) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AP_OUT_OF_MEMORY ((CsrWifiSmeIEEE80211Result) 0x0011) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_BASIC_RATES_MISMATCH ((CsrWifiSmeIEEE80211Result) 0x0012) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SHORT_PREAMBLE_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0013) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_PBCC_MODULATION_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0014) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CHANNEL_AGILITY_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0015) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SPECTRUM_MANAGEMENT_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0016) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_POWER_CAPABILITY_UNACCEPTABLE ((CsrWifiSmeIEEE80211Result) 0x0017) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SUPPORTED_CHANNELS_UNACCEPTABLE ((CsrWifiSmeIEEE80211Result) 0x0018) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SHORT_SLOT_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0019) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_DSSS_OFDMREQUIRED ((CsrWifiSmeIEEE80211Result) 0x001a) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_NO_HT_SUPPORT ((CsrWifiSmeIEEE80211Result) 0x001b) -#define CSR_WIFI_SME_IEEE80211_RESULT_R0KH_UNREACHABLE ((CsrWifiSmeIEEE80211Result) 0x001c) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_PCO_TRANSITION_SUPPORT ((CsrWifiSmeIEEE80211Result) 0x001d) -#define CSR_WIFI_SME_IEEE80211_RESULT_ASSOCIATION_REQUEST_REJECTED_TEMPORARILY ((CsrWifiSmeIEEE80211Result) 0x001e) -#define CSR_WIFI_SME_IEEE80211_RESULT_ROBUST_MANAGEMENT_FRAME_POLICY_VIOLATION ((CsrWifiSmeIEEE80211Result) 0x001f) -#define CSR_WIFI_SME_IEEE80211_RESULT_FAILURE ((CsrWifiSmeIEEE80211Result) 0x0020) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AP_BANDWIDTH_INSUFFICIENT ((CsrWifiSmeIEEE80211Result) 0x0021) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_POOR_OPERATING_CHANNEL ((CsrWifiSmeIEEE80211Result) 0x0022) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_QOS_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0023) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_REASON_UNSPECIFIED ((CsrWifiSmeIEEE80211Result) 0x0025) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED ((CsrWifiSmeIEEE80211Result) 0x0025) -#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_PARAMETERS ((CsrWifiSmeIEEE80211Result) 0x0026) -#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_WITH_SUGGESTED_TSPEC_CHANGES ((CsrWifiSmeIEEE80211Result) 0x0027) -#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_IE ((CsrWifiSmeIEEE80211Result) 0x0028) -#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_GROUP_CIPHER ((CsrWifiSmeIEEE80211Result) 0x0029) -#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_PAIRWISE_CIPHER ((CsrWifiSmeIEEE80211Result) 0x002a) -#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_AKMP ((CsrWifiSmeIEEE80211Result) 0x002b) -#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_UNSUPPORTED_RSN_VERSION ((CsrWifiSmeIEEE80211Result) 0x002c) -#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_RSN_CAPABILITY ((CsrWifiSmeIEEE80211Result) 0x002d) -#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_SECURITY_POLICY ((CsrWifiSmeIEEE80211Result) 0x002e) -#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_FOR_DELAY_PERIOD ((CsrWifiSmeIEEE80211Result) 0x002f) -#define CSR_WIFI_SME_IEEE80211_RESULT_NOT_ALLOWED ((CsrWifiSmeIEEE80211Result) 0x0030) -#define CSR_WIFI_SME_IEEE80211_RESULT_NOT_PRESENT ((CsrWifiSmeIEEE80211Result) 0x0031) -#define CSR_WIFI_SME_IEEE80211_RESULT_NOT_QSTA ((CsrWifiSmeIEEE80211Result) 0x0032) -#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_LISTEN_INTERVAL_TOO_LARGE ((CsrWifiSmeIEEE80211Result) 0x0033) -#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_FT_ACTION_FRAME_COUNT ((CsrWifiSmeIEEE80211Result) 0x0034) -#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_PMKID ((CsrWifiSmeIEEE80211Result) 0x0035) -#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_MDIE ((CsrWifiSmeIEEE80211Result) 0x0036) -#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_FTIE ((CsrWifiSmeIEEE80211Result) 0x0037) -#define CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_QOS_FAILURE ((CsrWifiSmeIEEE80211Result) 0x00c8) -#define CSR_WIFI_SME_IEEE80211_RESULT_WRONG_POLICY ((CsrWifiSmeIEEE80211Result) 0x00c9) -#define CSR_WIFI_SME_IEEE80211_RESULT_INSUFFICIENT_BANDWIDTH ((CsrWifiSmeIEEE80211Result) 0x00ca) -#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_TSPEC_PARAMETERS ((CsrWifiSmeIEEE80211Result) 0x00cb) -#define CSR_WIFI_SME_IEEE80211_RESULT_TIMEOUT ((CsrWifiSmeIEEE80211Result) 0x8000) -#define CSR_WIFI_SME_IEEE80211_RESULT_TOO_MANY_SIMULTANEOUS_REQUESTS ((CsrWifiSmeIEEE80211Result) 0x8001) -#define CSR_WIFI_SME_IEEE80211_RESULT_BSS_ALREADY_STARTED_OR_JOINED ((CsrWifiSmeIEEE80211Result) 0x8002) -#define CSR_WIFI_SME_IEEE80211_RESULT_NOT_SUPPORTED ((CsrWifiSmeIEEE80211Result) 0x8003) -#define CSR_WIFI_SME_IEEE80211_RESULT_TRANSMISSION_FAILURE ((CsrWifiSmeIEEE80211Result) 0x8004) -#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_NOT_AUTHENTICATED ((CsrWifiSmeIEEE80211Result) 0x8005) -#define CSR_WIFI_SME_IEEE80211_RESULT_RESET_REQUIRED_BEFORE_START ((CsrWifiSmeIEEE80211Result) 0x8006) -#define CSR_WIFI_SME_IEEE80211_RESULT_LM_INFO_UNAVAILABLE ((CsrWifiSmeIEEE80211Result) 0x8007) -#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_UNICAST_CIPHER ((CsrWifiSmeIEEE80211Result) 0xf02f) -#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_MULTICAST_CIPHER ((CsrWifiSmeIEEE80211Result) 0xf030) -#define CSR_WIFI_SME_IEEE80211_RESULT_UNSUPPORTED_WAPI_IE_VERSION ((CsrWifiSmeIEEE80211Result) 0xf031) -#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_WAPI_CAPABILITY_IE ((CsrWifiSmeIEEE80211Result) 0xf032) - -/******************************************************************************* - - NAME - CsrWifiSmeIndications - - DESCRIPTION - Defines bits for CsrWifiSmeIndicationsMask - - VALUES - CSR_WIFI_SME_INDICATIONS_NONE - - Used to cancel the registrations for receiving indications - CSR_WIFI_SME_INDICATIONS_WIFIOFF - - Used to register for CSR_WIFI_SME_WIFI_OFF_IND events - CSR_WIFI_SME_INDICATIONS_SCANRESULT - - Used to register for CSR_WIFI_SME_SCAN_RESULT_IND events - CSR_WIFI_SME_INDICATIONS_CONNECTIONQUALITY - - Used to register for CSR_WIFI_SME_CONNECTION_QUALITY_IND - events - CSR_WIFI_SME_INDICATIONS_MEDIASTATUS - - Used to register for CSR_WIFI_SME_MEDIA_STATUS_IND events - CSR_WIFI_SME_INDICATIONS_MICFAILURE - - Used to register for CSR_WIFI_SME_MICFAILURE_IND events - CSR_WIFI_SME_INDICATIONS_PMKIDCANDIDATELIST - - Used to register for CSR_WIFI_SME_PMKIDCANDIDATE_LIST_IND - events - CSR_WIFI_SME_INDICATIONS_TSPEC - - Used to register for CSR_WIFI_SME_TSPEC_IND events - CSR_WIFI_SME_INDICATIONS_ROAMSTART - - Used to register for CSR_WIFI_SME_ROAM_START_IND events - CSR_WIFI_SME_INDICATIONS_ROAMCOMPLETE - - Used to register for CSR_WIFI_SME_ROAM_COMPLETE_IND events - CSR_WIFI_SME_INDICATIONS_ASSOCIATIONSTART - - Used to register for CSR_WIFI_SME_ASSOCIATION_START_IND - events - CSR_WIFI_SME_INDICATIONS_ASSOCIATIONCOMPLETE - - Used to register for CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND - events - CSR_WIFI_SME_INDICATIONS_IBSSSTATION - - Used to register for CSR_WIFI_SME_IBSS_STATION_IND events - CSR_WIFI_SME_INDICATIONS_WIFION - - Used to register for CSR_WIFI_SME_WIFI_ON_IND events - CSR_WIFI_SME_INDICATIONS_ERROR - - Used to register for CSR_WIFI_SME_ERROR_IND events - CSR_WIFI_SME_INDICATIONS_INFO - - Used to register for CSR_WIFI_SME_INFO_IND events - CSR_WIFI_SME_INDICATIONS_COREDUMP - - Used to register for CSR_WIFI_SME_CORE_DUMP_IND events - CSR_WIFI_SME_INDICATIONS_ALL - - Used to register for all available indications - -*******************************************************************************/ -typedef u32 CsrWifiSmeIndications; -#define CSR_WIFI_SME_INDICATIONS_NONE ((CsrWifiSmeIndications) 0x00000000) -#define CSR_WIFI_SME_INDICATIONS_WIFIOFF ((CsrWifiSmeIndications) 0x00000001) -#define CSR_WIFI_SME_INDICATIONS_SCANRESULT ((CsrWifiSmeIndications) 0x00000002) -#define CSR_WIFI_SME_INDICATIONS_CONNECTIONQUALITY ((CsrWifiSmeIndications) 0x00000004) -#define CSR_WIFI_SME_INDICATIONS_MEDIASTATUS ((CsrWifiSmeIndications) 0x00000008) -#define CSR_WIFI_SME_INDICATIONS_MICFAILURE ((CsrWifiSmeIndications) 0x00000010) -#define CSR_WIFI_SME_INDICATIONS_PMKIDCANDIDATELIST ((CsrWifiSmeIndications) 0x00000020) -#define CSR_WIFI_SME_INDICATIONS_TSPEC ((CsrWifiSmeIndications) 0x00000040) -#define CSR_WIFI_SME_INDICATIONS_ROAMSTART ((CsrWifiSmeIndications) 0x00000080) -#define CSR_WIFI_SME_INDICATIONS_ROAMCOMPLETE ((CsrWifiSmeIndications) 0x00000100) -#define CSR_WIFI_SME_INDICATIONS_ASSOCIATIONSTART ((CsrWifiSmeIndications) 0x00000200) -#define CSR_WIFI_SME_INDICATIONS_ASSOCIATIONCOMPLETE ((CsrWifiSmeIndications) 0x00000400) -#define CSR_WIFI_SME_INDICATIONS_IBSSSTATION ((CsrWifiSmeIndications) 0x00000800) -#define CSR_WIFI_SME_INDICATIONS_WIFION ((CsrWifiSmeIndications) 0x00001000) -#define CSR_WIFI_SME_INDICATIONS_ERROR ((CsrWifiSmeIndications) 0x00002000) -#define CSR_WIFI_SME_INDICATIONS_INFO ((CsrWifiSmeIndications) 0x00004000) -#define CSR_WIFI_SME_INDICATIONS_COREDUMP ((CsrWifiSmeIndications) 0x00008000) -#define CSR_WIFI_SME_INDICATIONS_ALL ((CsrWifiSmeIndications) 0xFFFFFFFF) - -/******************************************************************************* - - NAME - CsrWifiSmeKeyType - - DESCRIPTION - Indicates the type of the key - - VALUES - CSR_WIFI_SME_KEY_TYPE_GROUP - Key for broadcast communication - CSR_WIFI_SME_KEY_TYPE_PAIRWISE - Key for unicast communication - CSR_WIFI_SME_KEY_TYPE_STAKEY - Key for direct link communication to - another station in infrastructure networks - CSR_WIFI_SME_KEY_TYPE_IGTK - Integrity Group Temporal Key - CSR_WIFI_SME_KEY_TYPE_CCKM - Key for Cisco Centralized Key Management - -*******************************************************************************/ -typedef u8 CsrWifiSmeKeyType; -#define CSR_WIFI_SME_KEY_TYPE_GROUP ((CsrWifiSmeKeyType) 0x00) -#define CSR_WIFI_SME_KEY_TYPE_PAIRWISE ((CsrWifiSmeKeyType) 0x01) -#define CSR_WIFI_SME_KEY_TYPE_STAKEY ((CsrWifiSmeKeyType) 0x02) -#define CSR_WIFI_SME_KEY_TYPE_IGTK ((CsrWifiSmeKeyType) 0x03) -#define CSR_WIFI_SME_KEY_TYPE_CCKM ((CsrWifiSmeKeyType) 0x04) - -/******************************************************************************* - - NAME - CsrWifiSmeListAction - - DESCRIPTION - Identifies the type of action to be performed on a list of items - The values of this type are used across the NME/SME/Router API's and they - must be kept consistent with the corresponding types in the .xml of the - ottherinterfaces - - VALUES - CSR_WIFI_SME_LIST_ACTION_GET - Retrieve the current list of items - CSR_WIFI_SME_LIST_ACTION_ADD - Add one or more items - CSR_WIFI_SME_LIST_ACTION_REMOVE - Remove one or more items - CSR_WIFI_SME_LIST_ACTION_FLUSH - Remove all items - -*******************************************************************************/ -typedef u8 CsrWifiSmeListAction; -#define CSR_WIFI_SME_LIST_ACTION_GET ((CsrWifiSmeListAction) 0x00) -#define CSR_WIFI_SME_LIST_ACTION_ADD ((CsrWifiSmeListAction) 0x01) -#define CSR_WIFI_SME_LIST_ACTION_REMOVE ((CsrWifiSmeListAction) 0x02) -#define CSR_WIFI_SME_LIST_ACTION_FLUSH ((CsrWifiSmeListAction) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSmeMediaStatus - - DESCRIPTION - Indicates the connection status - The values of this type are used across the NME/SME/Router API's and they - must be kept consistent with the corresponding types in the .xml of the - ottherinterfaces - - VALUES - CSR_WIFI_SME_MEDIA_STATUS_CONNECTED - - Value CSR_WIFI_SME_MEDIA_STATUS_CONNECTED can happen in two - situations: - * A network connection is established. Specifically, this is - when the MLME_ASSOCIATION completes or the first peer - relationship is established in an IBSS. In a WPA/WPA2 - network, this indicates that the stack is ready to perform - the 4-way handshake or 802.1x authentication if CSR NME - security library is not used. If CSR NME security library - is used this indicates, completion of 4way handshake or - 802.1x authentication - * The SME roams to another AP on the same ESS - During the AP operation, it indicates that the peer station - is connected to the AP and is ready for data transfer. - CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED - - Value CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED can happen in - two situations: - * when the connection to a network is lost and there is no - alternative on the same ESS to roam to - * when a CSR_WIFI_SME_DISCONNECT_REQ request is issued - During AP or P2PGO operation, it indicates that the peer - station has disconnected from the AP - -*******************************************************************************/ -typedef u8 CsrWifiSmeMediaStatus; -#define CSR_WIFI_SME_MEDIA_STATUS_CONNECTED ((CsrWifiSmeMediaStatus) 0x00) -#define CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED ((CsrWifiSmeMediaStatus) 0x01) - -/******************************************************************************* - - NAME - CsrWifiSmeP2pCapability - - DESCRIPTION - Defines P2P Device Capabilities - - VALUES - CSR_WIFI_SME_P2P_SERVICE_DISCOVERY_CAPABILITY - - This field is set to 1 if the P2P Device supports Service - Discovery, and to 0 otherwise - CSR_WIFI_SME_P2P_CLIENT_DISCOVERABILITY_CAPABILITY - - This field is set to 1 when the P2P Device supports P2P - Client Discoverability, and to 0 otherwise. - CSR_WIFI_SME_P2P_CONCURRENT_OPERATION_CAPABILITY - - This field is set to 1 when the P2P Device supports - Concurrent Operation with WLAN, and to 0 otherwise. - CSR_WIFI_SME_P2P_MANAGED_DEVICE_CAPABILITY - - This field is set to 1 when the P2P interface of the P2P - Device is capable of being managed by the WLAN - (infrastructure network) based on P2P coexistence - parameters, and to 0 otherwise - CSR_WIFI_SME_P2P_INVITAION_CAPABILITY - - This field is set to 1 if the P2P Device is capable of - processing P2P Invitation Procedure signaling, and to 0 - otherwise. - -*******************************************************************************/ -typedef u8 CsrWifiSmeP2pCapability; -#define CSR_WIFI_SME_P2P_SERVICE_DISCOVERY_CAPABILITY ((CsrWifiSmeP2pCapability) 0x01) -#define CSR_WIFI_SME_P2P_CLIENT_DISCOVERABILITY_CAPABILITY ((CsrWifiSmeP2pCapability) 0x02) -#define CSR_WIFI_SME_P2P_CONCURRENT_OPERATION_CAPABILITY ((CsrWifiSmeP2pCapability) 0x04) -#define CSR_WIFI_SME_P2P_MANAGED_DEVICE_CAPABILITY ((CsrWifiSmeP2pCapability) 0x08) -#define CSR_WIFI_SME_P2P_INVITAION_CAPABILITY ((CsrWifiSmeP2pCapability) 0x20) - -/******************************************************************************* - - NAME - CsrWifiSmeP2pGroupCapability - - DESCRIPTION - Define bits for P2P Group Capability - - VALUES - CSR_WIFI_P2P_GRP_CAP_GO - - Indicates if the local device has become a GO after GO - negotiation - CSR_WIFI_P2P_GRP_CAP_PERSISTENT - - Persistent group - CSR_WIFI_P2P_GRP_CAP_INTRABSS_DIST - - Intra-BSS data distribution support - CSR_WIFI_P2P_GRP_CAP_CROSS_CONN - - Support of cross connection - CSR_WIFI_P2P_GRP_CAP_PERSISTENT_RECONNECT - - Support of persistent reconnect - -*******************************************************************************/ -typedef u8 CsrWifiSmeP2pGroupCapability; -#define CSR_WIFI_P2P_GRP_CAP_GO ((CsrWifiSmeP2pGroupCapability) 0x01) -#define CSR_WIFI_P2P_GRP_CAP_PERSISTENT ((CsrWifiSmeP2pGroupCapability) 0x02) -#define CSR_WIFI_P2P_GRP_CAP_INTRABSS_DIST ((CsrWifiSmeP2pGroupCapability) 0x08) -#define CSR_WIFI_P2P_GRP_CAP_CROSS_CONN ((CsrWifiSmeP2pGroupCapability) 0x10) -#define CSR_WIFI_P2P_GRP_CAP_PERSISTENT_RECONNECT ((CsrWifiSmeP2pGroupCapability) 0x20) - -/******************************************************************************* - - NAME - CsrWifiSmeP2pNoaConfigMethod - - DESCRIPTION - Notice of Absece Configuration - - VALUES - CSR_WIFI_P2P_NOA_NONE - Do not use NOA - CSR_WIFI_P2P_NOA_AUTONOMOUS - NOA based on the traffic analysis - CSR_WIFI_P2P_NOA_USER_DEFINED - NOA as specified by the user - -*******************************************************************************/ -typedef u8 CsrWifiSmeP2pNoaConfigMethod; -#define CSR_WIFI_P2P_NOA_NONE ((CsrWifiSmeP2pNoaConfigMethod) 0x00) -#define CSR_WIFI_P2P_NOA_AUTONOMOUS ((CsrWifiSmeP2pNoaConfigMethod) 0x01) -#define CSR_WIFI_P2P_NOA_USER_DEFINED ((CsrWifiSmeP2pNoaConfigMethod) 0x02) - -/******************************************************************************* - - NAME - CsrWifiSmeP2pRole - - DESCRIPTION - Definition of roles for a P2P Device - - VALUES - CSR_WIFI_SME_P2P_ROLE_NONE - A non-P2PDevice device - CSR_WIFI_SME_P2P_ROLE_STANDALONE - A Standalone P2P device - CSR_WIFI_SME_P2P_ROLE_GO - Role Assumed is that of a Group Owner - within a P2P Group - CSR_WIFI_SME_P2P_ROLE_CLI - Role Assumed is that of a P2P Client - within a P2P Group - -*******************************************************************************/ -typedef u8 CsrWifiSmeP2pRole; -#define CSR_WIFI_SME_P2P_ROLE_NONE ((CsrWifiSmeP2pRole) 0x00) -#define CSR_WIFI_SME_P2P_ROLE_STANDALONE ((CsrWifiSmeP2pRole) 0x01) -#define CSR_WIFI_SME_P2P_ROLE_GO ((CsrWifiSmeP2pRole) 0x02) -#define CSR_WIFI_SME_P2P_ROLE_CLI ((CsrWifiSmeP2pRole) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSmeP2pStatus - - DESCRIPTION - This data type enumerates the outcome of P2P procedure - - VALUES - CSR_WIFI_SME_P2P_STATUS_SUCCESS - - Success - CSR_WIFI_SME_P2P_STATUS_FAIL_INFO_UNAVAILABLE - - Fail; information is currently unavailable - CSR_WIFI_SME_P2P_STATUS_FAIL_INCOMPATIBLE_PARAM - - Fail; incompatible parameters - CSR_WIFI_SME_P2P_STATUS_FAIL_LIMIT_REACHED - - Fail; limit reached - CSR_WIFI_SME_P2P_STATUS_FAIL_INVALID_PARAM - - Fail; invalid parameters - CSR_WIFI_SME_P2P_STATUS_FAIL_ACCOMODATE - - Fail; unable to accommodate request - CSR_WIFI_SME_P2P_STATUS_FAIL_PREV_ERROR - - Fail; previous protocol error, or disruptive behavior - CSR_WIFI_SME_P2P_STATUS_FAIL_COMMON_CHANNELS - - Fail; no common channels - CSR_WIFI_SME_P2P_STATUS_FAIL_UNKNOWN_GROUP - - Fail; unknown P2P Group - CSR_WIFI_SME_P2P_STATUS_FAIL_GO_INTENT - - Fail: both P2P Devices indicated an Intent of 15 in Group - Owner Negotiation - CSR_WIFI_SME_P2P_STATUS_FAIL_PROVISION_METHOD_INCOMPATIBLE - - Fail; incompatible provisioning method - CSR_WIFI_SME_P2P_STATUS_FAIL_REJECT - - Fail: rejected by user - CSR_WIFI_SME_P2P_STATUS_FAIL_RESERVED - - Fail; Status Reserved - -*******************************************************************************/ -typedef u8 CsrWifiSmeP2pStatus; -#define CSR_WIFI_SME_P2P_STATUS_SUCCESS ((CsrWifiSmeP2pStatus) 0x00) -#define CSR_WIFI_SME_P2P_STATUS_FAIL_INFO_UNAVAILABLE ((CsrWifiSmeP2pStatus) 0x01) -#define CSR_WIFI_SME_P2P_STATUS_FAIL_INCOMPATIBLE_PARAM ((CsrWifiSmeP2pStatus) 0x02) -#define CSR_WIFI_SME_P2P_STATUS_FAIL_LIMIT_REACHED ((CsrWifiSmeP2pStatus) 0x03) -#define CSR_WIFI_SME_P2P_STATUS_FAIL_INVALID_PARAM ((CsrWifiSmeP2pStatus) 0x04) -#define CSR_WIFI_SME_P2P_STATUS_FAIL_ACCOMODATE ((CsrWifiSmeP2pStatus) 0x05) -#define CSR_WIFI_SME_P2P_STATUS_FAIL_PREV_ERROR ((CsrWifiSmeP2pStatus) 0x06) -#define CSR_WIFI_SME_P2P_STATUS_FAIL_COMMON_CHANNELS ((CsrWifiSmeP2pStatus) 0x07) -#define CSR_WIFI_SME_P2P_STATUS_FAIL_UNKNOWN_GROUP ((CsrWifiSmeP2pStatus) 0x08) -#define CSR_WIFI_SME_P2P_STATUS_FAIL_GO_INTENT ((CsrWifiSmeP2pStatus) 0x09) -#define CSR_WIFI_SME_P2P_STATUS_FAIL_PROVISION_METHOD_INCOMPATIBLE ((CsrWifiSmeP2pStatus) 0x0A) -#define CSR_WIFI_SME_P2P_STATUS_FAIL_REJECT ((CsrWifiSmeP2pStatus) 0x0B) -#define CSR_WIFI_SME_P2P_STATUS_FAIL_RESERVED ((CsrWifiSmeP2pStatus) 0xFF) - -/******************************************************************************* - - NAME - CsrWifiSmePacketFilterMode - - DESCRIPTION - Options for the filter mode parameter. - The Values here match the HIP interface - - VALUES - CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_OUT - - Broadcast packets are always reported to the host unless - they match at least one of the specified TCLAS IEs. - CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_IN - - Broadcast packets are reported to the host only if they - match at least one of the specified TCLAS IEs. - -*******************************************************************************/ -typedef u8 CsrWifiSmePacketFilterMode; -#define CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_OUT ((CsrWifiSmePacketFilterMode) 0x00) -#define CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_IN ((CsrWifiSmePacketFilterMode) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSmePowerSaveLevel - - DESCRIPTION - Power Save Level options as defined in the IEEE 802.11 standards - First 3 values are set to match the mlme PowerManagementMode - - VALUES - CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW - No power save: the driver will remain - active at all times - CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH - Enter power save after all packets in - the queues are transmitted and received - CSR_WIFI_SME_POWER_SAVE_LEVEL_MED - Enter power save after all packets in - the queues are transmitted and received - and a further configurable delay - (default 1s) has elapsed - CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO - The SME will decide when to enter power - save mode according to the traffic - analysis - -*******************************************************************************/ -typedef u8 CsrWifiSmePowerSaveLevel; -#define CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW ((CsrWifiSmePowerSaveLevel) 0x00) -#define CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH ((CsrWifiSmePowerSaveLevel) 0x01) -#define CSR_WIFI_SME_POWER_SAVE_LEVEL_MED ((CsrWifiSmePowerSaveLevel) 0x02) -#define CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO ((CsrWifiSmePowerSaveLevel) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSmePreambleType - - DESCRIPTION - SME Preamble Types - - VALUES - CSR_WIFI_SME_USE_LONG_PREAMBLE - Use legacy (long) preamble - CSR_WIFI_SME_USE_SHORT_PREAMBLE - Use short PPDU format - -*******************************************************************************/ -typedef u8 CsrWifiSmePreambleType; -#define CSR_WIFI_SME_USE_LONG_PREAMBLE ((CsrWifiSmePreambleType) 0x00) -#define CSR_WIFI_SME_USE_SHORT_PREAMBLE ((CsrWifiSmePreambleType) 0x01) - -/******************************************************************************* - - NAME - CsrWifiSmeRadioIF - - DESCRIPTION - Indicates the frequency - - VALUES - CSR_WIFI_SME_RADIO_IF_GHZ_2_4 - Indicates the 2.4 GHZ frequency - CSR_WIFI_SME_RADIO_IF_GHZ_5_0 - Future use: currently not supported - CSR_WIFI_SME_RADIO_IF_BOTH - Future use: currently not supported - -*******************************************************************************/ -typedef u8 CsrWifiSmeRadioIF; -#define CSR_WIFI_SME_RADIO_IF_GHZ_2_4 ((CsrWifiSmeRadioIF) 0x01) -#define CSR_WIFI_SME_RADIO_IF_GHZ_5_0 ((CsrWifiSmeRadioIF) 0x02) -#define CSR_WIFI_SME_RADIO_IF_BOTH ((CsrWifiSmeRadioIF) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSmeRegulatoryDomain - - DESCRIPTION - Indicates the regulatory domain as defined in IEEE 802.11 standards - - VALUES - CSR_WIFI_SME_REGULATORY_DOMAIN_OTHER - - See IEEE 802.11 Standard - CSR_WIFI_SME_REGULATORY_DOMAIN_FCC - - See IEEE 802.11 Standard - CSR_WIFI_SME_REGULATORY_DOMAIN_IC - - See IEEE 802.11 Standard - CSR_WIFI_SME_REGULATORY_DOMAIN_ETSI - - See IEEE 802.11 Standard - CSR_WIFI_SME_REGULATORY_DOMAIN_SPAIN - - See IEEE 802.11 Standard - CSR_WIFI_SME_REGULATORY_DOMAIN_FRANCE - - See IEEE 802.11 Standard - CSR_WIFI_SME_REGULATORY_DOMAIN_JAPAN - - See IEEE 802.11 Standard - CSR_WIFI_SME_REGULATORY_DOMAIN_JAPANBIS - - See IEEE 802.11 Standard - CSR_WIFI_SME_REGULATORY_DOMAIN_CHINA - - See IEEE 802.11 Standard - CSR_WIFI_SME_REGULATORY_DOMAIN_CHINABIS - - See IEEE 802.11 Standard - CSR_WIFI_SME_REGULATORY_DOMAIN_NONE - - See IEEE 802.11 Standard - -*******************************************************************************/ -typedef u8 CsrWifiSmeRegulatoryDomain; -#define CSR_WIFI_SME_REGULATORY_DOMAIN_OTHER ((CsrWifiSmeRegulatoryDomain) 0x00) -#define CSR_WIFI_SME_REGULATORY_DOMAIN_FCC ((CsrWifiSmeRegulatoryDomain) 0x10) -#define CSR_WIFI_SME_REGULATORY_DOMAIN_IC ((CsrWifiSmeRegulatoryDomain) 0x20) -#define CSR_WIFI_SME_REGULATORY_DOMAIN_ETSI ((CsrWifiSmeRegulatoryDomain) 0x30) -#define CSR_WIFI_SME_REGULATORY_DOMAIN_SPAIN ((CsrWifiSmeRegulatoryDomain) 0x31) -#define CSR_WIFI_SME_REGULATORY_DOMAIN_FRANCE ((CsrWifiSmeRegulatoryDomain) 0x32) -#define CSR_WIFI_SME_REGULATORY_DOMAIN_JAPAN ((CsrWifiSmeRegulatoryDomain) 0x40) -#define CSR_WIFI_SME_REGULATORY_DOMAIN_JAPANBIS ((CsrWifiSmeRegulatoryDomain) 0x41) -#define CSR_WIFI_SME_REGULATORY_DOMAIN_CHINA ((CsrWifiSmeRegulatoryDomain) 0x50) -#define CSR_WIFI_SME_REGULATORY_DOMAIN_CHINABIS ((CsrWifiSmeRegulatoryDomain) 0x51) -#define CSR_WIFI_SME_REGULATORY_DOMAIN_NONE ((CsrWifiSmeRegulatoryDomain) 0xFF) - -/******************************************************************************* - - NAME - CsrWifiSmeRoamReason - - DESCRIPTION - Indicates the reason for roaming - - VALUES - CSR_WIFI_SME_ROAM_REASON_BEACONLOST - - The station cannot receive the beacon signal any more - CSR_WIFI_SME_ROAM_REASON_DISASSOCIATED - - The station has been disassociated - CSR_WIFI_SME_ROAM_REASON_DEAUTHENTICATED - - The station has been deauthenticated - CSR_WIFI_SME_ROAM_REASON_BETTERAPFOUND - - A better AP has been found - -*******************************************************************************/ -typedef u8 CsrWifiSmeRoamReason; -#define CSR_WIFI_SME_ROAM_REASON_BEACONLOST ((CsrWifiSmeRoamReason) 0x00) -#define CSR_WIFI_SME_ROAM_REASON_DISASSOCIATED ((CsrWifiSmeRoamReason) 0x01) -#define CSR_WIFI_SME_ROAM_REASON_DEAUTHENTICATED ((CsrWifiSmeRoamReason) 0x02) -#define CSR_WIFI_SME_ROAM_REASON_BETTERAPFOUND ((CsrWifiSmeRoamReason) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSmeScanType - - DESCRIPTION - Identifies the type of scan to be performed - - VALUES - CSR_WIFI_SME_SCAN_TYPE_ALL - Scan actively or passively according to the - regulatory domain restrictions - CSR_WIFI_SME_SCAN_TYPE_ACTIVE - Scan actively only: send probes and listen - for answers - CSR_WIFI_SME_SCAN_TYPE_PASSIVE - Scan passively only: listen for beacon - messages - -*******************************************************************************/ -typedef u8 CsrWifiSmeScanType; -#define CSR_WIFI_SME_SCAN_TYPE_ALL ((CsrWifiSmeScanType) 0x00) -#define CSR_WIFI_SME_SCAN_TYPE_ACTIVE ((CsrWifiSmeScanType) 0x01) -#define CSR_WIFI_SME_SCAN_TYPE_PASSIVE ((CsrWifiSmeScanType) 0x02) - -/******************************************************************************* - - NAME - CsrWifiSmeTrafficType - - DESCRIPTION - Identifies the type of traffic going on on the connection. - The values of this type are used across the NME/SME/Router API's and they - must be kept consistent with the corresponding types in the .xml of the - ottherinterfaces - - VALUES - CSR_WIFI_SME_TRAFFIC_TYPE_OCCASIONAL - - During the last 30 seconds there were fewer than 20 packets - per seconds in each second in both directions - CSR_WIFI_SME_TRAFFIC_TYPE_BURSTY - - During the last 30 seconds there was at least one second - during which more than 20 packets were received in either - direction - CSR_WIFI_SME_TRAFFIC_TYPE_PERIODIC - - During the last 5 seconds there were at least 10 packets - received each second and a defined period for the traffic - can be recognized - CSR_WIFI_SME_TRAFFIC_TYPE_CONTINUOUS - - During the last 5 seconds there were at least 20 packets - received each second in either direction - -*******************************************************************************/ -typedef u8 CsrWifiSmeTrafficType; -#define CSR_WIFI_SME_TRAFFIC_TYPE_OCCASIONAL ((CsrWifiSmeTrafficType) 0x00) -#define CSR_WIFI_SME_TRAFFIC_TYPE_BURSTY ((CsrWifiSmeTrafficType) 0x01) -#define CSR_WIFI_SME_TRAFFIC_TYPE_PERIODIC ((CsrWifiSmeTrafficType) 0x02) -#define CSR_WIFI_SME_TRAFFIC_TYPE_CONTINUOUS ((CsrWifiSmeTrafficType) 0x03) - -/******************************************************************************* - - NAME - CsrWifiSmeTspecCtrl - - DESCRIPTION - Defines bits for CsrWifiSmeTspecCtrlMask for additional CCX configuration. - CURRENTLY NOT SUPPORTED. - - VALUES - CSR_WIFI_SME_TSPEC_CTRL_STRICT - - No automatic negotiation - CSR_WIFI_SME_TSPEC_CTRL_CCX_SIGNALLING - - Signalling TSPEC - CSR_WIFI_SME_TSPEC_CTRL_CCX_VOICE - - Voice traffic TSPEC - -*******************************************************************************/ -typedef u8 CsrWifiSmeTspecCtrl; -#define CSR_WIFI_SME_TSPEC_CTRL_STRICT ((CsrWifiSmeTspecCtrl) 0x01) -#define CSR_WIFI_SME_TSPEC_CTRL_CCX_SIGNALLING ((CsrWifiSmeTspecCtrl) 0x02) -#define CSR_WIFI_SME_TSPEC_CTRL_CCX_VOICE ((CsrWifiSmeTspecCtrl) 0x04) - -/******************************************************************************* - - NAME - CsrWifiSmeTspecResultCode - - DESCRIPTION - Defines the result of the TSPEC exchanges with the AP - - VALUES - CSR_WIFI_SME_TSPEC_RESULT_SUCCESS - - TSPEC command has been processed correctly - CSR_WIFI_SME_TSPEC_RESULT_UNSPECIFIED_QOS_FAILURE - - The Access Point reported a failure - CSR_WIFI_SME_TSPEC_RESULT_FAILURE - - Internal failure in the SME - CSR_WIFI_SME_TSPEC_RESULT_INVALID_TSPEC_PARAMETERS - - The TSPEC parameters are invalid - CSR_WIFI_SME_TSPEC_RESULT_INVALID_TCLAS_PARAMETERS - - The TCLASS parameters are invalid - CSR_WIFI_SME_TSPEC_RESULT_INSUFFICIENT_BANDWIDTH - - As specified by the WMM Spec - CSR_WIFI_SME_TSPEC_RESULT_WRONG_POLICY - - As specified by the WMM Spec - CSR_WIFI_SME_TSPEC_RESULT_REJECTED_WITH_SUGGESTED_CHANGES - - As specified by the WMM Spec - CSR_WIFI_SME_TSPEC_RESULT_TIMEOUT - - The TSPEC negotiation timed out - CSR_WIFI_SME_TSPEC_RESULT_NOT_SUPPORTED - - The Access Point does not support the TSPEC - CSR_WIFI_SME_TSPEC_RESULT_IE_LENGTH_INCORRECT - - The length of the TSPEC is not correct - CSR_WIFI_SME_TSPEC_RESULT_INVALID_TRANSACTION_ID - - The TSPEC transaction id is not in the list - CSR_WIFI_SME_TSPEC_RESULT_INSTALLED - - The TSPEC has been installed and it is now active. - CSR_WIFI_SME_TSPEC_RESULT_TID_ALREADY_INSTALLED - - The Traffic ID has already been installed - CSR_WIFI_SME_TSPEC_RESULT_TSPEC_REMOTELY_DELETED - - The AP has deleted the TSPEC - -*******************************************************************************/ -typedef u8 CsrWifiSmeTspecResultCode; -#define CSR_WIFI_SME_TSPEC_RESULT_SUCCESS ((CsrWifiSmeTspecResultCode) 0x00) -#define CSR_WIFI_SME_TSPEC_RESULT_UNSPECIFIED_QOS_FAILURE ((CsrWifiSmeTspecResultCode) 0x01) -#define CSR_WIFI_SME_TSPEC_RESULT_FAILURE ((CsrWifiSmeTspecResultCode) 0x02) -#define CSR_WIFI_SME_TSPEC_RESULT_INVALID_TSPEC_PARAMETERS ((CsrWifiSmeTspecResultCode) 0x05) -#define CSR_WIFI_SME_TSPEC_RESULT_INVALID_TCLAS_PARAMETERS ((CsrWifiSmeTspecResultCode) 0x06) -#define CSR_WIFI_SME_TSPEC_RESULT_INSUFFICIENT_BANDWIDTH ((CsrWifiSmeTspecResultCode) 0x07) -#define CSR_WIFI_SME_TSPEC_RESULT_WRONG_POLICY ((CsrWifiSmeTspecResultCode) 0x08) -#define CSR_WIFI_SME_TSPEC_RESULT_REJECTED_WITH_SUGGESTED_CHANGES ((CsrWifiSmeTspecResultCode) 0x09) -#define CSR_WIFI_SME_TSPEC_RESULT_TIMEOUT ((CsrWifiSmeTspecResultCode) 0x0D) -#define CSR_WIFI_SME_TSPEC_RESULT_NOT_SUPPORTED ((CsrWifiSmeTspecResultCode) 0x0E) -#define CSR_WIFI_SME_TSPEC_RESULT_IE_LENGTH_INCORRECT ((CsrWifiSmeTspecResultCode) 0x10) -#define CSR_WIFI_SME_TSPEC_RESULT_INVALID_TRANSACTION_ID ((CsrWifiSmeTspecResultCode) 0x11) -#define CSR_WIFI_SME_TSPEC_RESULT_INSTALLED ((CsrWifiSmeTspecResultCode) 0x12) -#define CSR_WIFI_SME_TSPEC_RESULT_TID_ALREADY_INSTALLED ((CsrWifiSmeTspecResultCode) 0x13) -#define CSR_WIFI_SME_TSPEC_RESULT_TSPEC_REMOTELY_DELETED ((CsrWifiSmeTspecResultCode) 0x14) - -/******************************************************************************* - - NAME - CsrWifiSmeWepAuthMode - - DESCRIPTION - Define bits for CsrWifiSmeWepAuthMode - - VALUES - CSR_WIFI_SME_WEP_AUTH_MODE_OPEN - Open-WEP enabled network - CSR_WIFI_SME_WEP_AUTH_MODE_SHARED - Shared-key WEP enabled network. - -*******************************************************************************/ -typedef u8 CsrWifiSmeWepAuthMode; -#define CSR_WIFI_SME_WEP_AUTH_MODE_OPEN ((CsrWifiSmeWepAuthMode) 0x00) -#define CSR_WIFI_SME_WEP_AUTH_MODE_SHARED ((CsrWifiSmeWepAuthMode) 0x01) - -/******************************************************************************* - - NAME - CsrWifiSmeWepCredentialType - - DESCRIPTION - Definition of types of WEP Credentials - - VALUES - CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64 - - WEP 64 credential - CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128 - - WEP 128 credential - -*******************************************************************************/ -typedef u8 CsrWifiSmeWepCredentialType; -#define CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64 ((CsrWifiSmeWepCredentialType) 0x00) -#define CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128 ((CsrWifiSmeWepCredentialType) 0x01) - -/******************************************************************************* - - NAME - CsrWifiSmeWmmMode - - DESCRIPTION - Defines bits for CsrWifiSmeWmmModeMask: enable/disable WMM features. - - VALUES - CSR_WIFI_SME_WMM_MODE_DISABLED - Disables the WMM features. - CSR_WIFI_SME_WMM_MODE_AC_ENABLED - Enables support for WMM-AC. - CSR_WIFI_SME_WMM_MODE_PS_ENABLED - Enables support for WMM Power Save. - CSR_WIFI_SME_WMM_MODE_SA_ENABLED - Currently not supported - CSR_WIFI_SME_WMM_MODE_ENABLED - Enables support for all currently - available WMM features. - -*******************************************************************************/ -typedef u8 CsrWifiSmeWmmMode; -#define CSR_WIFI_SME_WMM_MODE_DISABLED ((CsrWifiSmeWmmMode) 0x00) -#define CSR_WIFI_SME_WMM_MODE_AC_ENABLED ((CsrWifiSmeWmmMode) 0x01) -#define CSR_WIFI_SME_WMM_MODE_PS_ENABLED ((CsrWifiSmeWmmMode) 0x02) -#define CSR_WIFI_SME_WMM_MODE_SA_ENABLED ((CsrWifiSmeWmmMode) 0x04) -#define CSR_WIFI_SME_WMM_MODE_ENABLED ((CsrWifiSmeWmmMode) 0xFF) - -/******************************************************************************* - - NAME - CsrWifiSmeWmmQosInfo - - DESCRIPTION - Defines bits for the QoS Info Octect as defined in the WMM specification. - The first four values define one bit each that can be set or cleared. - Each of the last four values define all the remaining 4 bits and only one - of them at the time shall be used. - For more information, see 'WMM (including WMM Power Save) Specification - - Version 1.1' and 'UniFi Configuring WMM and WMM-PS, Application Note'. - - VALUES - CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_ALL - - WMM AP may deliver all buffered frames - CSR_WIFI_SME_WMM_QOS_INFO_AC_VO - - Enable UAPSD(both trigger and delivery) for Voice Access - Category - CSR_WIFI_SME_WMM_QOS_INFO_AC_VI - - Enable UAPSD(both trigger and delivery) for Video Access - Category - CSR_WIFI_SME_WMM_QOS_INFO_AC_BK - - Enable UAPSD(both trigger and delivery) for Background - Access Category - CSR_WIFI_SME_WMM_QOS_INFO_AC_BE - - Enable UAPSD(both trigger and delivery) for Best Effort - Access Category - CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_TWO - - WMM AP may deliver a maximum of 2 buffered frames (MSDUs - and MMPDUs) per USP - CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_FOUR - - WMM AP may deliver a maximum of 4 buffered frames (MSDUs - and MMPDUs) per USP - CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_SIX - - WMM AP may deliver a maximum of 6 buffered frames (MSDUs - and MMPDUs) per USP - -*******************************************************************************/ -typedef u8 CsrWifiSmeWmmQosInfo; -#define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_ALL ((CsrWifiSmeWmmQosInfo) 0x00) -#define CSR_WIFI_SME_WMM_QOS_INFO_AC_VO ((CsrWifiSmeWmmQosInfo) 0x01) -#define CSR_WIFI_SME_WMM_QOS_INFO_AC_VI ((CsrWifiSmeWmmQosInfo) 0x02) -#define CSR_WIFI_SME_WMM_QOS_INFO_AC_BK ((CsrWifiSmeWmmQosInfo) 0x04) -#define CSR_WIFI_SME_WMM_QOS_INFO_AC_BE ((CsrWifiSmeWmmQosInfo) 0x08) -#define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_TWO ((CsrWifiSmeWmmQosInfo) 0x20) -#define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_FOUR ((CsrWifiSmeWmmQosInfo) 0x40) -#define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_SIX ((CsrWifiSmeWmmQosInfo) 0x60) - -/******************************************************************************* - - NAME - CsrWifiSmeWpsConfigType - - DESCRIPTION - WPS config methods supported/used by a device - - VALUES - CSR_WIFI_WPS_CONFIG_LABEL - - Label - CSR_WIFI_WPS_CONFIG_DISPLAY - - Display - CSR_WIFI_WPS_CONFIG_EXT_NFC - - External NFC : Not supported in this release - CSR_WIFI_WPS_CONFIG_INT_NFC - - Internal NFC : Not supported in this release - CSR_WIFI_WPS_CONFIG_NFC_IFACE - - NFC interface : Not supported in this release - CSR_WIFI_WPS_CONFIG_PBC - - PBC - CSR_WIFI_WPS_CONFIG_KEYPAD - - KeyPad - CSR_WIFI_WPS_CONFIG_VIRTUAL_PBC - - PBC through software user interface - CSR_WIFI_WPS_CONFIG_PHYSICAL_PBC - - Physical PBC - CSR_WIFI_WPS_CONFIG_VIRTUAL_DISPLAY - - Virtual Display : via html config page etc - CSR_WIFI_WPS_CONFIG_PHYSICAL_DISPLAY - - Physical Display : Attached to the device - -*******************************************************************************/ -typedef u16 CsrWifiSmeWpsConfigType; -#define CSR_WIFI_WPS_CONFIG_LABEL ((CsrWifiSmeWpsConfigType) 0x0004) -#define CSR_WIFI_WPS_CONFIG_DISPLAY ((CsrWifiSmeWpsConfigType) 0x0008) -#define CSR_WIFI_WPS_CONFIG_EXT_NFC ((CsrWifiSmeWpsConfigType) 0x0010) -#define CSR_WIFI_WPS_CONFIG_INT_NFC ((CsrWifiSmeWpsConfigType) 0x0020) -#define CSR_WIFI_WPS_CONFIG_NFC_IFACE ((CsrWifiSmeWpsConfigType) 0x0040) -#define CSR_WIFI_WPS_CONFIG_PBC ((CsrWifiSmeWpsConfigType) 0x0080) -#define CSR_WIFI_WPS_CONFIG_KEYPAD ((CsrWifiSmeWpsConfigType) 0x0100) -#define CSR_WIFI_WPS_CONFIG_VIRTUAL_PBC ((CsrWifiSmeWpsConfigType) 0x0280) -#define CSR_WIFI_WPS_CONFIG_PHYSICAL_PBC ((CsrWifiSmeWpsConfigType) 0x0480) -#define CSR_WIFI_WPS_CONFIG_VIRTUAL_DISPLAY ((CsrWifiSmeWpsConfigType) 0x2008) -#define CSR_WIFI_WPS_CONFIG_PHYSICAL_DISPLAY ((CsrWifiSmeWpsConfigType) 0x4008) - -/******************************************************************************* - - NAME - CsrWifiSmeWpsDeviceCategory - - DESCRIPTION - Wps Primary Device Types - - VALUES - CSR_WIFI_SME_WPS_CATEGORY_UNSPECIFIED - - Unspecified. - CSR_WIFI_SME_WPS_CATEGORY_COMPUTER - - Computer. - CSR_WIFI_SME_WPS_CATEGORY_INPUT_DEV - - Input device - CSR_WIFI_SME_WPS_CATEGORY_PRT_SCAN_FX_CP - - Printer Scanner Fax Copier etc - CSR_WIFI_SME_WPS_CATEGORY_CAMERA - - Camera - CSR_WIFI_SME_WPS_CATEGORY_STORAGE - - Storage - CSR_WIFI_SME_WPS_CATEGORY_NET_INFRA - - Net Infra - CSR_WIFI_SME_WPS_CATEGORY_DISPLAY - - Display - CSR_WIFI_SME_WPS_CATEGORY_MULTIMEDIA - - Multimedia - CSR_WIFI_SME_WPS_CATEGORY_GAMING - - Gaming. - CSR_WIFI_SME_WPS_CATEGORY_TELEPHONE - - Telephone. - CSR_WIFI_SME_WPS_CATEGORY_AUDIO - - Audio - CSR_WIFI_SME_WPS_CATEOARY_OTHERS - - Others. - -*******************************************************************************/ -typedef u8 CsrWifiSmeWpsDeviceCategory; -#define CSR_WIFI_SME_WPS_CATEGORY_UNSPECIFIED ((CsrWifiSmeWpsDeviceCategory) 0x00) -#define CSR_WIFI_SME_WPS_CATEGORY_COMPUTER ((CsrWifiSmeWpsDeviceCategory) 0x01) -#define CSR_WIFI_SME_WPS_CATEGORY_INPUT_DEV ((CsrWifiSmeWpsDeviceCategory) 0x02) -#define CSR_WIFI_SME_WPS_CATEGORY_PRT_SCAN_FX_CP ((CsrWifiSmeWpsDeviceCategory) 0x03) -#define CSR_WIFI_SME_WPS_CATEGORY_CAMERA ((CsrWifiSmeWpsDeviceCategory) 0x04) -#define CSR_WIFI_SME_WPS_CATEGORY_STORAGE ((CsrWifiSmeWpsDeviceCategory) 0x05) -#define CSR_WIFI_SME_WPS_CATEGORY_NET_INFRA ((CsrWifiSmeWpsDeviceCategory) 0x06) -#define CSR_WIFI_SME_WPS_CATEGORY_DISPLAY ((CsrWifiSmeWpsDeviceCategory) 0x07) -#define CSR_WIFI_SME_WPS_CATEGORY_MULTIMEDIA ((CsrWifiSmeWpsDeviceCategory) 0x08) -#define CSR_WIFI_SME_WPS_CATEGORY_GAMING ((CsrWifiSmeWpsDeviceCategory) 0x09) -#define CSR_WIFI_SME_WPS_CATEGORY_TELEPHONE ((CsrWifiSmeWpsDeviceCategory) 0x0A) -#define CSR_WIFI_SME_WPS_CATEGORY_AUDIO ((CsrWifiSmeWpsDeviceCategory) 0x0B) -#define CSR_WIFI_SME_WPS_CATEOARY_OTHERS ((CsrWifiSmeWpsDeviceCategory) 0xFF) - -/******************************************************************************* - - NAME - CsrWifiSmeWpsDeviceSubCategory - - DESCRIPTION - Wps Secondary Device Types - - VALUES - CSR_WIFI_SME_WPS_SUB_CATEGORY_UNSPECIFIED - - Unspecied - CSR_WIFI_SME_WPS_STORAGE_SUB_CATEGORY_NAS - - Network Associated Storage - CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_PRNTR - - Printer or print server - CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_WM - - Windows mobile - CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_TUNER - - Audio tuner/receiver - CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_DIG_STL - - Digital still camera - CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_AP - - Access Point - CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_TV - - TV. - CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_DAR - - DAR. - CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_KEYBD - - Keyboard. - CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_PC - - PC. - CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_XBOX - - Xbox. - CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_SCNR - - Scanner - CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_SERVER - - Server - CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_ROUTER - - Router - CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_PVR - - PVR - CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_SPEAKER - - Speaker - CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_FP_SM - - Feature phone - Single mode - CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_VIDEO - - Video camera - CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_PIC_FRM - - Picture frame - CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_XBOX_360 - - Xbox360 - CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_MOUSE - - Mouse - CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_SWITCH - - Switch - CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_PMP - - Portable music player - CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_JOYSTK - - Joy stick - CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_PLAY_STN - - Play-station - CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_MED_CENT - - Media Center - CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_MCX - - MCX - CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_FP_DM - - Feature phone - Dual mode - CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_WEB - - Web camera - CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_FAX - - Fax - CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_PROJECTOR - - Projector - CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_TRKBL - - Track Ball - CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_ST_BOX - - Set-Top-Box - CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_GATEWAY - - GateWay. - CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_SECURITY - - Security camera - CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_ULTRA_MOB_PC - - Ultra mobile PC. - CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_CONSOLE - - Game console/Game console adapter - CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_CPR - - Copier - CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_HEADSET - - Headset(headphones + microphone) - CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_SP_SM - - Smart phone - Single mode - CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_MONITOR - - Monitor. - CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_GAME_CTRL - - Game control. - CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_ALL - - All-in-One - CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_MEDIA - - Media Server/Media Adapter/Media Extender - CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_SP_DM - - Smart phone - Dual mode - CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_PORT_DEV - - Portable gaming device - CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_HEADPHONE - - Headphone. - CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_NOTEBOOK - - Notebook. - CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_REMOTE - - Remote control - CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_MIC - - Microphone - CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_DESKTOP - - Desktop. - CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_VP - - Portable video player - CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_MID - - Mobile internet device - CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_TOUCH_SCRN - - Touch screen - CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_BIOMET_RDR - - Biometric reader - CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_NETBOOK - - Netbook - CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_BRCD_RDR - - Bar code reader. - -*******************************************************************************/ -typedef u8 CsrWifiSmeWpsDeviceSubCategory; -#define CSR_WIFI_SME_WPS_SUB_CATEGORY_UNSPECIFIED ((CsrWifiSmeWpsDeviceSubCategory) 0x00) -#define CSR_WIFI_SME_WPS_STORAGE_SUB_CATEGORY_NAS ((CsrWifiSmeWpsDeviceSubCategory) 0x01) -#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_PRNTR ((CsrWifiSmeWpsDeviceSubCategory) 0x01) -#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_WM ((CsrWifiSmeWpsDeviceSubCategory) 0x01) -#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_TUNER ((CsrWifiSmeWpsDeviceSubCategory) 0x01) -#define CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_DIG_STL ((CsrWifiSmeWpsDeviceSubCategory) 0x01) -#define CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_AP ((CsrWifiSmeWpsDeviceSubCategory) 0x01) -#define CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_TV ((CsrWifiSmeWpsDeviceSubCategory) 0x01) -#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_DAR ((CsrWifiSmeWpsDeviceSubCategory) 0x01) -#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_KEYBD ((CsrWifiSmeWpsDeviceSubCategory) 0x01) -#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_PC ((CsrWifiSmeWpsDeviceSubCategory) 0x01) -#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_XBOX ((CsrWifiSmeWpsDeviceSubCategory) 0x01) -#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_SCNR ((CsrWifiSmeWpsDeviceSubCategory) 0x02) -#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_SERVER ((CsrWifiSmeWpsDeviceSubCategory) 0x02) -#define CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_ROUTER ((CsrWifiSmeWpsDeviceSubCategory) 0x02) -#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_PVR ((CsrWifiSmeWpsDeviceSubCategory) 0x02) -#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_SPEAKER ((CsrWifiSmeWpsDeviceSubCategory) 0x02) -#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_FP_SM ((CsrWifiSmeWpsDeviceSubCategory) 0x02) -#define CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_VIDEO ((CsrWifiSmeWpsDeviceSubCategory) 0x02) -#define CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_PIC_FRM ((CsrWifiSmeWpsDeviceSubCategory) 0x02) -#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_XBOX_360 ((CsrWifiSmeWpsDeviceSubCategory) 0x02) -#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_MOUSE ((CsrWifiSmeWpsDeviceSubCategory) 0x02) -#define CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_SWITCH ((CsrWifiSmeWpsDeviceSubCategory) 0x03) -#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_PMP ((CsrWifiSmeWpsDeviceSubCategory) 0x03) -#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_JOYSTK ((CsrWifiSmeWpsDeviceSubCategory) 0x03) -#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_PLAY_STN ((CsrWifiSmeWpsDeviceSubCategory) 0x03) -#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_MED_CENT ((CsrWifiSmeWpsDeviceSubCategory) 0x03) -#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_MCX ((CsrWifiSmeWpsDeviceSubCategory) 0x03) -#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_FP_DM ((CsrWifiSmeWpsDeviceSubCategory) 0x03) -#define CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_WEB ((CsrWifiSmeWpsDeviceSubCategory) 0x03) -#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_FAX ((CsrWifiSmeWpsDeviceSubCategory) 0x03) -#define CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_PROJECTOR ((CsrWifiSmeWpsDeviceSubCategory) 0x03) -#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_TRKBL ((CsrWifiSmeWpsDeviceSubCategory) 0x04) -#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_ST_BOX ((CsrWifiSmeWpsDeviceSubCategory) 0x04) -#define CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_GATEWAY ((CsrWifiSmeWpsDeviceSubCategory) 0x04) -#define CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_SECURITY ((CsrWifiSmeWpsDeviceSubCategory) 0x04) -#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_ULTRA_MOB_PC ((CsrWifiSmeWpsDeviceSubCategory) 0x04) -#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_CONSOLE ((CsrWifiSmeWpsDeviceSubCategory) 0x04) -#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_CPR ((CsrWifiSmeWpsDeviceSubCategory) 0x04) -#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_HEADSET ((CsrWifiSmeWpsDeviceSubCategory) 0x04) -#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_SP_SM ((CsrWifiSmeWpsDeviceSubCategory) 0x04) -#define CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_MONITOR ((CsrWifiSmeWpsDeviceSubCategory) 0x04) -#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_GAME_CTRL ((CsrWifiSmeWpsDeviceSubCategory) 0x05) -#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_ALL ((CsrWifiSmeWpsDeviceSubCategory) 0x05) -#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_MEDIA ((CsrWifiSmeWpsDeviceSubCategory) 0x05) -#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_SP_DM ((CsrWifiSmeWpsDeviceSubCategory) 0x05) -#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_PORT_DEV ((CsrWifiSmeWpsDeviceSubCategory) 0x05) -#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_HEADPHONE ((CsrWifiSmeWpsDeviceSubCategory) 0x05) -#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_NOTEBOOK ((CsrWifiSmeWpsDeviceSubCategory) 0x05) -#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_REMOTE ((CsrWifiSmeWpsDeviceSubCategory) 0x06) -#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_MIC ((CsrWifiSmeWpsDeviceSubCategory) 0x06) -#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_DESKTOP ((CsrWifiSmeWpsDeviceSubCategory) 0x06) -#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_VP ((CsrWifiSmeWpsDeviceSubCategory) 0x06) -#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_MID ((CsrWifiSmeWpsDeviceSubCategory) 0x07) -#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_TOUCH_SCRN ((CsrWifiSmeWpsDeviceSubCategory) 0x07) -#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_BIOMET_RDR ((CsrWifiSmeWpsDeviceSubCategory) 0x08) -#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_NETBOOK ((CsrWifiSmeWpsDeviceSubCategory) 0x08) -#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_BRCD_RDR ((CsrWifiSmeWpsDeviceSubCategory) 0x09) - -/******************************************************************************* - - NAME - CsrWifiSmeWpsDpid - - DESCRIPTION - Device Password ID for the chosen config method - - VALUES - CSR_WIFI_SME_WPS_DPID_PIN - PIN - CSR_WIFI_SME_WPS_DPID_USER - User specified : Used only during P2P GO - negotiation procedure - CSR_WIFI_SME_WPS_DPID_MACHINE - Machine specified i: Not used in this - release - CSR_WIFI_SME_WPS_DPID_REKEY - Rekey : Not used in this release - CSR_WIFI_SME_WPS_DPID_PBC - PBC - CSR_WIFI_SME_WPS_DPID_REGISTRAR - Registrar specified : Used only in P2P Go - negotiation procedure - -*******************************************************************************/ -typedef u16 CsrWifiSmeWpsDpid; -#define CSR_WIFI_SME_WPS_DPID_PIN ((CsrWifiSmeWpsDpid) 0x0000) -#define CSR_WIFI_SME_WPS_DPID_USER ((CsrWifiSmeWpsDpid) 0x0001) -#define CSR_WIFI_SME_WPS_DPID_MACHINE ((CsrWifiSmeWpsDpid) 0x0002) -#define CSR_WIFI_SME_WPS_DPID_REKEY ((CsrWifiSmeWpsDpid) 0x0003) -#define CSR_WIFI_SME_WPS_DPID_PBC ((CsrWifiSmeWpsDpid) 0x0004) -#define CSR_WIFI_SME_WPS_DPID_REGISTRAR ((CsrWifiSmeWpsDpid) 0x0005) - -/******************************************************************************* - - NAME - CsrWifiSmeWpsRegistration - - DESCRIPTION - - VALUES - CSR_WIFI_SME_WPS_REG_NOT_REQUIRED - No encryption set - CSR_WIFI_SME_WPS_REG_REQUIRED - No encryption set - CSR_WIFI_SME_WPS_REG_UNKNOWN - No encryption set - -*******************************************************************************/ -typedef u8 CsrWifiSmeWpsRegistration; -#define CSR_WIFI_SME_WPS_REG_NOT_REQUIRED ((CsrWifiSmeWpsRegistration) 0x00) -#define CSR_WIFI_SME_WPS_REG_REQUIRED ((CsrWifiSmeWpsRegistration) 0x01) -#define CSR_WIFI_SME_WPS_REG_UNKNOWN ((CsrWifiSmeWpsRegistration) 0x02) - - -/******************************************************************************* - - NAME - CsrWifiSmeAuthModeMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiSmeAuthMode - -*******************************************************************************/ -typedef u16 CsrWifiSmeAuthModeMask; -/******************************************************************************* - - NAME - CsrWifiSmeEncryptionMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiSmeEncryption - -*******************************************************************************/ -typedef u16 CsrWifiSmeEncryptionMask; -/******************************************************************************* - - NAME - CsrWifiSmeIndicationsMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiSmeIndications - -*******************************************************************************/ -typedef u32 CsrWifiSmeIndicationsMask; -/******************************************************************************* - - NAME - CsrWifiSmeP2pCapabilityMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiSmeP2pCapability - -*******************************************************************************/ -typedef u8 CsrWifiSmeP2pCapabilityMask; -/******************************************************************************* - - NAME - CsrWifiSmeP2pGroupCapabilityMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiSmeP2pGroupCapability - -*******************************************************************************/ -typedef u8 CsrWifiSmeP2pGroupCapabilityMask; -/******************************************************************************* - - NAME - CsrWifiSmeTspecCtrlMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiSmeTspecCtrl - -*******************************************************************************/ -typedef u8 CsrWifiSmeTspecCtrlMask; -/******************************************************************************* - - NAME - CsrWifiSmeWmmModeMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiSmeWmmMode - -*******************************************************************************/ -typedef u8 CsrWifiSmeWmmModeMask; -/******************************************************************************* - - NAME - CsrWifiSmeWmmQosInfoMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiSmeWmmQosInfo - -*******************************************************************************/ -typedef u8 CsrWifiSmeWmmQosInfoMask; -/******************************************************************************* - - NAME - CsrWifiSmeWpsConfigTypeMask - - DESCRIPTION - Mask type for use with the values defined by CsrWifiSmeWpsConfigType - -*******************************************************************************/ -typedef u16 CsrWifiSmeWpsConfigTypeMask; - - -/******************************************************************************* - - NAME - CsrWifiSmeAdHocConfig - - DESCRIPTION - Defines values to use when starting an Ad-hoc (IBSS) network. - - MEMBERS - atimWindowTu - ATIM window specified for IBSS - beaconPeriodTu - Interval between beacon packets - joinOnlyAttempts - Maximum number of attempts to join an ad-hoc network. - The default value is 1. - Set to 0 for infinite attempts. - joinAttemptIntervalMs - Time between scans for joining the requested IBSS. - -*******************************************************************************/ -typedef struct -{ - u16 atimWindowTu; - u16 beaconPeriodTu; - u16 joinOnlyAttempts; - u16 joinAttemptIntervalMs; -} CsrWifiSmeAdHocConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeAvailabilityConfig - - DESCRIPTION - - MEMBERS - listenChannel - - availabilityDuration - - avalabilityPeriod - - -*******************************************************************************/ -typedef struct -{ - u8 listenChannel; - u16 availabilityDuration; - u16 avalabilityPeriod; -} CsrWifiSmeAvailabilityConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeCcxConfig - - DESCRIPTION - This type is reserved for future use and should not be used. - - MEMBERS - keepAliveTimeMs - NOT USED - apRoamingEnabled - NOT USED - measurementsMask - NOT USED - ccxRadioMgtEnabled - NOT USED - -*******************************************************************************/ -typedef struct -{ - u8 keepAliveTimeMs; - u8 apRoamingEnabled; - u8 measurementsMask; - u8 ccxRadioMgtEnabled; -} CsrWifiSmeCcxConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeCoexConfig - - DESCRIPTION - Parameters for the coexistence behaviour. - - MEMBERS - coexEnableSchemeManagement - Enables the Coexistence Management Scheme - coexPeriodicWakeHost - If TRUE the firmware wakes up the host - periodically according to the traffic - period and latency parameters; the host - will then send the data to transmit only - when woken up. - If FALSE, the firmware does not wake up the - host and the host will send the data to - transmit to the firmware whenever there is - data to transmit - coexTrafficBurstyLatencyMs - Period of awakening for the firmware used - when bursty traffic is detected - coexTrafficContinuousLatencyMs - Period of awakening for the firmware used - when continuous traffic is detected - coexObexBlackoutDurationMs - Blackout Duration when a Obex Connection is - used - coexObexBlackoutPeriodMs - Blackout Period when a Obex Connection is - used - coexA2dpBrBlackoutDurationMs - Blackout Duration when a Basic Rate A2DP - Connection streaming data - coexA2dpBrBlackoutPeriodMs - Blackout Period when a Basic Rate A2DP - Connection streaming data - coexA2dpEdrBlackoutDurationMs - Blackout Duration when an Enhanced Data - Rate A2DP Connection streaming data - coexA2dpEdrBlackoutPeriodMs - Blackout Period when an Enhanced Data Rate - A2DP Connection streaming data - coexPagingBlackoutDurationMs - Blackout Duration when a BT page is active - coexPagingBlackoutPeriodMs - Blackout Period when a BT page is active - coexInquiryBlackoutDurationMs - Blackout Duration when a BT inquiry is - active - coexInquiryBlackoutPeriodMs - Blackout Period when a BT inquiry is active - -*******************************************************************************/ -typedef struct -{ - u8 coexEnableSchemeManagement; - u8 coexPeriodicWakeHost; - u16 coexTrafficBurstyLatencyMs; - u16 coexTrafficContinuousLatencyMs; - u16 coexObexBlackoutDurationMs; - u16 coexObexBlackoutPeriodMs; - u16 coexA2dpBrBlackoutDurationMs; - u16 coexA2dpBrBlackoutPeriodMs; - u16 coexA2dpEdrBlackoutDurationMs; - u16 coexA2dpEdrBlackoutPeriodMs; - u16 coexPagingBlackoutDurationMs; - u16 coexPagingBlackoutPeriodMs; - u16 coexInquiryBlackoutDurationMs; - u16 coexInquiryBlackoutPeriodMs; -} CsrWifiSmeCoexConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionStats - - DESCRIPTION - Indicates the statistics of the connection. - The dot11 fields are defined in the Annex D of the IEEE 802.11 standard. - - MEMBERS - unifiTxDataRate - - The bit rate currently in use for transmissions of unicast - data frames; a data rate in units of 500kbit/s. - On an infrastructure BSS, this is the data rate used in - communicating with the associated access point; if there is - none, an error is returned. - On an IBSS, this is the data rate used for the last - transmission of a unicast data frame to any station in the - IBSS. If no such transmission has been made, an error is - returned. - unifiRxDataRate - - As above for receiving data - dot11RetryCount - - See IEEE 802.11 Standard - dot11MultipleRetryCount - - See IEEE 802.11 Standard - dot11AckFailureCount - - See IEEE 802.11 Standard - dot11FrameDuplicateCount - - See IEEE 802.11 Standard - dot11FcsErrorCount - - See IEEE 802.11 Standard - dot11RtsSuccessCount - - See IEEE 802.11 Standard - dot11RtsFailureCount - - See IEEE 802.11 Standard - dot11FailedCount - - See IEEE 802.11 Standard - dot11TransmittedFragmentCount - - See IEEE 802.11 Standard - dot11TransmittedFrameCount - - See IEEE 802.11 Standard - dot11WepExcludedCount - - See IEEE 802.11 Standard - dot11WepIcvErrorCount - - See IEEE 802.11 Standard - dot11WepUndecryptableCount - - See IEEE 802.11 Standard - dot11MulticastReceivedFrameCount - - See IEEE 802.11 Standard - dot11MulticastTransmittedFrameCount - - See IEEE 802.11 Standard - dot11ReceivedFragmentCount - - See IEEE 802.11 Standard - dot11Rsna4WayHandshakeFailures - - See IEEE 802.11 Standard - dot11RsnaTkipCounterMeasuresInvoked - - See IEEE 802.11 Standard - dot11RsnaStatsTkipLocalMicFailures - - See IEEE 802.11 Standard - dot11RsnaStatsTkipReplays - - See IEEE 802.11 Standard - dot11RsnaStatsTkipIcvErrors - - See IEEE 802.11 Standard - dot11RsnaStatsCcmpReplays - - See IEEE 802.11 Standard - dot11RsnaStatsCcmpDecryptErrors - - See IEEE 802.11 Standard - -*******************************************************************************/ -typedef struct -{ - u8 unifiTxDataRate; - u8 unifiRxDataRate; - u32 dot11RetryCount; - u32 dot11MultipleRetryCount; - u32 dot11AckFailureCount; - u32 dot11FrameDuplicateCount; - u32 dot11FcsErrorCount; - u32 dot11RtsSuccessCount; - u32 dot11RtsFailureCount; - u32 dot11FailedCount; - u32 dot11TransmittedFragmentCount; - u32 dot11TransmittedFrameCount; - u32 dot11WepExcludedCount; - u32 dot11WepIcvErrorCount; - u32 dot11WepUndecryptableCount; - u32 dot11MulticastReceivedFrameCount; - u32 dot11MulticastTransmittedFrameCount; - u32 dot11ReceivedFragmentCount; - u32 dot11Rsna4WayHandshakeFailures; - u32 dot11RsnaTkipCounterMeasuresInvoked; - u32 dot11RsnaStatsTkipLocalMicFailures; - u32 dot11RsnaStatsTkipReplays; - u32 dot11RsnaStatsTkipIcvErrors; - u32 dot11RsnaStatsCcmpReplays; - u32 dot11RsnaStatsCcmpDecryptErrors; -} CsrWifiSmeConnectionStats; - -/******************************************************************************* - - NAME - CsrWifiSmeDataBlock - - DESCRIPTION - Holds a generic data block to be passed through the interface - - MEMBERS - length - Length of the data block - data - Points to the first byte of the data block - -*******************************************************************************/ -typedef struct -{ - u16 length; - u8 *data; -} CsrWifiSmeDataBlock; - -/******************************************************************************* - - NAME - CsrWifiSmeEmpty - - DESCRIPTION - Empty Structure to indicate that no parameters are available. - - MEMBERS - empty - Only element of the empty structure (always set to 0). - -*******************************************************************************/ -typedef struct -{ - u8 empty; -} CsrWifiSmeEmpty; - -/******************************************************************************* - - NAME - CsrWifiSmeLinkQuality - - DESCRIPTION - Indicates the quality of the link - - MEMBERS - unifiRssi - Indicates the received signal strength indication of the link in - dBm - unifiSnr - Indicates the signal to noise ratio of the link in dB - -*******************************************************************************/ -typedef struct -{ - s16 unifiRssi; - s16 unifiSnr; -} CsrWifiSmeLinkQuality; - -/******************************************************************************* - - NAME - CsrWifiSmeMibConfig - - DESCRIPTION - Allows low level configuration in the chip. - - MEMBERS - unifiFixMaxTxDataRate - This attribute is used in combination with - unifiFixTxDataRate. If it is FALSE, then - unifiFixTxDataRate specifies a specific data - rate to use. If it is TRUE, unifiFixTxDataRate - instead specifies a maximum data rate. - unifiFixTxDataRate - Transmit rate for unicast data. - See MIB description for more details - dot11RtsThreshold - See IEEE 802.11 Standard - dot11FragmentationThreshold - See IEEE 802.11 Standard - dot11CurrentTxPowerLevel - See IEEE 802.11 Standard - -*******************************************************************************/ -typedef struct -{ - u8 unifiFixMaxTxDataRate; - u8 unifiFixTxDataRate; - u16 dot11RtsThreshold; - u16 dot11FragmentationThreshold; - u16 dot11CurrentTxPowerLevel; -} CsrWifiSmeMibConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeP2pProfileIdentity - - DESCRIPTION - Details to be filled in - - MEMBERS - listenChannel - - availabilityDuration - - avalabilityPeriod - - -*******************************************************************************/ -typedef struct -{ - u8 listenChannel; - u16 availabilityDuration; - u16 avalabilityPeriod; -} CsrWifiSmeP2pProfileIdentity; - -/******************************************************************************* - - NAME - CsrWifiSmePmkid - - DESCRIPTION - Defines a PMKID association with BSS - - MEMBERS - bssid - BSS identifier - pmkid - PMKID - -*******************************************************************************/ -typedef struct -{ - CsrWifiMacAddress bssid; - u8 pmkid[16]; -} CsrWifiSmePmkid; - -/******************************************************************************* - - NAME - CsrWifiSmePmkidCandidate - - DESCRIPTION - Information for a PMKID candidate - - MEMBERS - bssid - BSS identifier - preAuthAllowed - Indicates whether preauthentication is allowed - -*******************************************************************************/ -typedef struct -{ - CsrWifiMacAddress bssid; - u8 preAuthAllowed; -} CsrWifiSmePmkidCandidate; - -/******************************************************************************* - - NAME - CsrWifiSmePmkidList - - DESCRIPTION - NOT USED - Used in the Sync access API - - MEMBERS - pmkidsCount - Number of PMKIDs in the list - pmkids - Points to the first PMKID in the list - -*******************************************************************************/ -typedef struct -{ - u8 pmkidsCount; - CsrWifiSmePmkid *pmkids; -} CsrWifiSmePmkidList; - -/******************************************************************************* - - NAME - CsrWifiSmeRegulatoryDomainInfo - - DESCRIPTION - Regulatory domain options. - - MEMBERS - dot11MultiDomainCapabilityImplemented - - TRUE is the multi domain capability is implemented - dot11MultiDomainCapabilityEnabled - - TRUE is the multi domain capability is enabled - currentRegulatoryDomain - - Current regulatory domain - currentCountryCode - - Current country code as defined by the IEEE 802.11 - standards - -*******************************************************************************/ -typedef struct -{ - u8 dot11MultiDomainCapabilityImplemented; - u8 dot11MultiDomainCapabilityEnabled; - CsrWifiSmeRegulatoryDomain currentRegulatoryDomain; - u8 currentCountryCode[2]; -} CsrWifiSmeRegulatoryDomainInfo; - -/******************************************************************************* - - NAME - CsrWifiSmeRoamingBandData - - DESCRIPTION - Thresholds to define one usability level category for the received signal - - MEMBERS - rssiHighThreshold - Received Signal Strength Indication upper bound in dBm - for the usability level - rssiLowThreshold - Received Signal Strength Indication lower bound in dBm - for the usability level - snrHighThreshold - Signal to Noise Ratio upper bound in dB for the - usability level - snrLowThreshold - Signal to Noise Ratio lower bound in dB for the - usability level - -*******************************************************************************/ -typedef struct -{ - s16 rssiHighThreshold; - s16 rssiLowThreshold; - s16 snrHighThreshold; - s16 snrLowThreshold; -} CsrWifiSmeRoamingBandData; - -/******************************************************************************* - - NAME - CsrWifiSmeScanConfigData - - DESCRIPTION - Configures the scanning behaviour of the driver and firmware - - MEMBERS - intervalSeconds - All the channels will be scanned once in this time - interval. - If connected, the channel scans are spread across - the interval. - If disconnected, all the channels will be scanned - together - validitySeconds - How long the scan result are cached - minActiveChannelTimeTu - Minimum time of listening on a channel being - actively scanned before leaving if no probe - responses or beacon frames have been received - maxActiveChannelTimeTu - Maximum time of listening on a channel being - actively scanned - minPassiveChannelTimeTu - Minimum time of listening on a channel being - passive scanned before leaving if no beacon frames - have been received - maxPassiveChannelTimeTu - Maximum time of listening on a channel being - passively scanned - -*******************************************************************************/ -typedef struct -{ - u16 intervalSeconds; - u16 validitySeconds; - u16 minActiveChannelTimeTu; - u16 maxActiveChannelTimeTu; - u16 minPassiveChannelTimeTu; - u16 maxPassiveChannelTimeTu; -} CsrWifiSmeScanConfigData; - -/******************************************************************************* - - NAME - CsrWifiSmeTsfTime - - DESCRIPTION - Time stamp representation - - MEMBERS - data - TSF Bytes - -*******************************************************************************/ -typedef struct -{ - u8 data[8]; -} CsrWifiSmeTsfTime; - -/******************************************************************************* - - NAME - CsrWifiSmeVersions - - DESCRIPTION - Reports version information for the chip, the firmware and the driver and - the SME. - - MEMBERS - chipId - Chip ID - chipVersion - Chip version ID - firmwareBuild - Firmware Rom build number - firmwarePatch - Firmware Patch build number (if applicable) - firmwareHip - Firmware HIP protocol version number - routerBuild - Router build number - routerHip - Router HIP protocol version number - smeBuild - SME build number - smeHip - SME HIP protocol version number - -*******************************************************************************/ -typedef struct -{ - u32 chipId; - u32 chipVersion; - u32 firmwareBuild; - u32 firmwarePatch; - u32 firmwareHip; - char *routerBuild; - u32 routerHip; - char *smeBuild; - u32 smeHip; -} CsrWifiSmeVersions; - -/******************************************************************************* - - NAME - CsrWifiSmeWmmAcParams - - DESCRIPTION - Structure holding WMM AC params data. - - MEMBERS - cwMin - Exponent for the calculation of CWmin. Range: 0 - to 15 - cwMax - Exponent for the calculation of CWmax. Range: 0 - to15 - aifs - Arbitration Inter Frame Spacing in terms of - number of timeslots. Range 2 to 15 - txopLimit - TXOP Limit in the units of 32 microseconds - admissionControlMandatory - Indicates whether the admission control is - mandatory or not. Current release does not - support admission control , hence shall be set - to FALSE. - -*******************************************************************************/ -typedef struct -{ - u8 cwMin; - u8 cwMax; - u8 aifs; - u16 txopLimit; - u8 admissionControlMandatory; -} CsrWifiSmeWmmAcParams; - -/******************************************************************************* - - NAME - CsrWifiSmeWpsDeviceType - - DESCRIPTION - Structure holding AP WPS device type data. - - MEMBERS - deviceDetails - category , sub category etc - -*******************************************************************************/ -typedef struct -{ - u8 deviceDetails[8]; -} CsrWifiSmeWpsDeviceType; - -/******************************************************************************* - - NAME - CsrWifiSmeWpsDeviceTypeCommon - - DESCRIPTION - - MEMBERS - spportWps - - deviceType - - -*******************************************************************************/ -typedef struct -{ - u8 spportWps; - u8 deviceType; -} CsrWifiSmeWpsDeviceTypeCommon; - -/******************************************************************************* - - NAME - CsrWifiSmeWpsInfo - - DESCRIPTION - - MEMBERS - version - - configMethods - - devicePassworId - - -*******************************************************************************/ -typedef struct -{ - u16 version; - u16 configMethods; - u16 devicePassworId; -} CsrWifiSmeWpsInfo; - -/******************************************************************************* - - NAME - CsrWifiSmeCloakedSsidConfig - - DESCRIPTION - List of cloaked SSIDs . - - MEMBERS - cloakedSsidsCount - Number of cloaked SSID - cloakedSsids - Points to the first byte of the first SSID provided - -*******************************************************************************/ -typedef struct -{ - u8 cloakedSsidsCount; - CsrWifiSsid *cloakedSsids; -} CsrWifiSmeCloakedSsidConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeCoexInfo - - DESCRIPTION - Information and state related to coexistence. - - MEMBERS - hasTrafficData - TRUE if any Wi-Fi traffic is detected - currentTrafficType - Current type of traffic - currentPeriodMs - Period of the traffic as detected by the traffic - analysis. - If the traffic is not periodic, it is set to 0. - currentPowerSave - Current power save level - currentCoexPeriodMs - Period of awakening for the firmware used when - periodic traffic is detected. - If the traffic is not periodic, it is set to 0. - currentCoexLatencyMs - Period of awakening for the firmware used when - non-periodic traffic is detected - hasBtDevice - TRUE if there is a Bluetooth device connected - currentBlackoutDurationUs - Current blackout duration for protecting - Bluetooth - currentBlackoutPeriodUs - Current blackout period - currentCoexScheme - Defines the scheme for the coexistence - signalling - -*******************************************************************************/ -typedef struct -{ - u8 hasTrafficData; - CsrWifiSmeTrafficType currentTrafficType; - u16 currentPeriodMs; - CsrWifiSmePowerSaveLevel currentPowerSave; - u16 currentCoexPeriodMs; - u16 currentCoexLatencyMs; - u8 hasBtDevice; - u32 currentBlackoutDurationUs; - u32 currentBlackoutPeriodUs; - CsrWifiSmeCoexScheme currentCoexScheme; -} CsrWifiSmeCoexInfo; - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionConfig - - DESCRIPTION - Specifies the parameters that the SME should use in selecting a network. - - MEMBERS - ssid - - Service Set identifier - bssid - - BSS identifier - bssType - - Indicates the type of BSS - ifIndex - - Indicates the radio interface - privacyMode - - Specifies whether the privacy mode is enabled or disabled. - authModeMask - - Sets the authentication options that the SME can use while - associating to the AP - Set mask with values from CsrWifiSmeAuthMode - encryptionModeMask - - Sets the encryption options that the SME can use while - associating to the AP - Set mask with values from CsrWifiSmeEncryption - mlmeAssociateReqInformationElementsLength - - Length in bytes of information elements to be sent in the - Association Request. - mlmeAssociateReqInformationElements - - Points to the first byte of the information elements, if - any. - wmmQosInfo - - This parameter allows the driver's WMM behaviour to be - configured. - To enable support for WMM, use - CSR_WIFI_SME_SME_CONFIG_SET_REQ with the - CSR_WIFI_SME_WMM_MODE_AC_ENABLED bit set in wmmModeMask - field in smeConfig parameter. - Set mask with values from CsrWifiSmeWmmQosInfo - adhocJoinOnly - - This parameter is relevant only if bssType is NOT set to - CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE: - if TRUE the SME will only try to join an ad-hoc network if - there is one already established; - if FALSE the SME will try to join an ad-hoc network if - there is one already established or it will try to - establish a new one - adhocChannel - - This parameter is relevant only if bssType is NOT set to - CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE: - it indicates the channel to use joining an ad hoc network. - Setting this to 0 causes the SME to select a channel from - those permitted in the regulatory domain. - -*******************************************************************************/ -typedef struct -{ - CsrWifiSsid ssid; - CsrWifiMacAddress bssid; - CsrWifiSmeBssType bssType; - CsrWifiSmeRadioIF ifIndex; - CsrWifiSme80211PrivacyMode privacyMode; - CsrWifiSmeAuthModeMask authModeMask; - CsrWifiSmeEncryptionMask encryptionModeMask; - u16 mlmeAssociateReqInformationElementsLength; - u8 *mlmeAssociateReqInformationElements; - CsrWifiSmeWmmQosInfoMask wmmQosInfo; - u8 adhocJoinOnly; - u8 adhocChannel; -} CsrWifiSmeConnectionConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionInfo - - DESCRIPTION - Parameters that the SME should use in selecting a network - - MEMBERS - ssid - Service set identifier - bssid - BSS identifier - networkType80211 - Physical layer used for the connection - channelNumber - Channel number - channelFrequency - Channel frequency - authMode - Authentication mode used for the connection - pairwiseCipher - Encryption type for peer to peer communication - groupCipher - Encryption type for broadcast and multicast - communication - ifIndex - Indicates the radio interface - atimWindowTu - ATIM window specified for IBSS - beaconPeriodTu - Interval between beacon packets - reassociation - Indicates whether a reassociation occurred - beaconFrameLength - Indicates the number of bytes of the beacon - frame - beaconFrame - Points at the first byte of the beacon frame - associationReqFrameLength - Indicates the number of bytes of the - association request frame - associationReqFrame - Points at the first byte of the association - request frame - associationRspFrameLength - Indicates the number of bytes of the - association response frame - associationRspFrame - Points at the first byte of the association - response frame - assocScanInfoElementsLength - Indicates the number of bytes in the buffer - pointed by assocScanInfoElements - assocScanInfoElements - Pointer to the buffer containing the - information elements of the probe response - received after the probe requests sent before - attempting to authenticate to the network - assocReqCapabilities - Reports the content of the Capability - information element as specified in the - association request. - assocReqListenIntervalTu - Listen Interval specified in the association - request - assocReqApAddress - AP address to which the association requests - has been sent - assocReqInfoElementsLength - Indicates the number of bytes of the - association request information elements - assocReqInfoElements - Points at the first byte of the association - request information elements - assocRspResult - Result reported in the association response - assocRspCapabilityInfo - Reports the content of the Capability - information element as received in the - association response. - assocRspAssociationId - Reports the association ID received in the - association response. - assocRspInfoElementsLength - Indicates the number of bytes of the - association response information elements - assocRspInfoElements - Points at the first byte of the association - response information elements - -*******************************************************************************/ -typedef struct -{ - CsrWifiSsid ssid; - CsrWifiMacAddress bssid; - CsrWifiSme80211NetworkType networkType80211; - u8 channelNumber; - u16 channelFrequency; - CsrWifiSmeAuthMode authMode; - CsrWifiSmeEncryption pairwiseCipher; - CsrWifiSmeEncryption groupCipher; - CsrWifiSmeRadioIF ifIndex; - u16 atimWindowTu; - u16 beaconPeriodTu; - u8 reassociation; - u16 beaconFrameLength; - u8 *beaconFrame; - u16 associationReqFrameLength; - u8 *associationReqFrame; - u16 associationRspFrameLength; - u8 *associationRspFrame; - u16 assocScanInfoElementsLength; - u8 *assocScanInfoElements; - u16 assocReqCapabilities; - u16 assocReqListenIntervalTu; - CsrWifiMacAddress assocReqApAddress; - u16 assocReqInfoElementsLength; - u8 *assocReqInfoElements; - CsrWifiSmeIEEE80211Result assocRspResult; - u16 assocRspCapabilityInfo; - u16 assocRspAssociationId; - u16 assocRspInfoElementsLength; - u8 *assocRspInfoElements; -} CsrWifiSmeConnectionInfo; - -/******************************************************************************* - - NAME - CsrWifiSmeDeviceConfig - - DESCRIPTION - General configuration options in the SME - - MEMBERS - trustLevel - Level of trust of the information coming from the - network - countryCode - Country code as specified by IEEE 802.11 standard - firmwareDriverInterface - Specifies the type of communication between Host - and Firmware - enableStrictDraftN - If TRUE TKIP is disallowed when connecting to - 802.11n enabled access points - -*******************************************************************************/ -typedef struct -{ - CsrWifiSme80211dTrustLevel trustLevel; - u8 countryCode[2]; - CsrWifiSmeFirmwareDriverInterface firmwareDriverInterface; - u8 enableStrictDraftN; -} CsrWifiSmeDeviceConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeDeviceInfo - - DESCRIPTION - P2P Information for a P2P Device - - MEMBERS - deviceAddress - Device Address of the P2P device - configMethods - Supported WPS configuration methods. - p2PDeviceCap - P2P device capabilities - primDeviceType - Primary WPS device type - secondaryDeviceTypeCount - Number of secondary device types - secDeviceType - list of secondary WPS device types - deviceName - Device name without up to 32 characters'\0'. - deviceNameLength - Number of characters of the device name - -*******************************************************************************/ -typedef struct -{ - CsrWifiMacAddress deviceAddress; - CsrWifiSmeWpsConfigTypeMask configMethods; - CsrWifiSmeP2pCapabilityMask p2PDeviceCap; - CsrWifiSmeWpsDeviceType primDeviceType; - u8 secondaryDeviceTypeCount; - CsrWifiSmeWpsDeviceType *secDeviceType; - u8 deviceName[32]; - u8 deviceNameLength; -} CsrWifiSmeDeviceInfo; - -/******************************************************************************* - - NAME - CsrWifiSmeDeviceInfoCommon - - DESCRIPTION - Structure holding device information. - - MEMBERS - p2pDeviceAddress - - primaryDeviceType - - secondaryDeviceTypesCount - - secondaryDeviceTypes - - deviceNameLength - - deviceName - - -*******************************************************************************/ -typedef struct -{ - CsrWifiMacAddress p2pDeviceAddress; - CsrWifiSmeWpsDeviceTypeCommon primaryDeviceType; - u8 secondaryDeviceTypesCount; - u8 secondaryDeviceTypes[10]; - u8 deviceNameLength; - u8 deviceName[32]; -} CsrWifiSmeDeviceInfoCommon; - -/******************************************************************************* - - NAME - CsrWifiSmeHostConfig - - DESCRIPTION - Defines the host power state (for example, on mains power, on battery - power etc) and the periodicity of the traffic data. - - MEMBERS - powerMode - The wireless manager application should use the - powerMode parameter to inform the SME of the host - power state. - applicationDataPeriodMs - The applicationDataPeriodMs parameter allows a - wireless manager application to inform the SME - that an application is running that generates - periodic network traffic and the period of the - traffic. - An example of such an application is a VoIP client. - The wireless manager application should set - applicationDataPeriodMs to the period in - milliseconds between data packets or zero if no - periodic application is running. - Voip etc 0 = No Periodic Data - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeHostPowerMode powerMode; - u16 applicationDataPeriodMs; -} CsrWifiSmeHostConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeKey - - DESCRIPTION - Information for a key to be used for encryption - - MEMBERS - keyType - Specifies whether the key is a pairwise or group key; it - should be set to CSR_WIFI_SME_GROUP_KEY or - CSR_WIFI_SME_PAIRWISE_KEY, as required. - keyIndex - Specifies which WEP key (0-3) to set; it should be set to 0 - for a WPA/WPA2 pairwise key and non-zero for a WPA/WPA2 - group key. - wepTxKey - If wepTxKey is TRUE, and the key is a WEP key, the key will - be selected for encrypting transmitted packets. - To select a previously defined key as the transmit - encryption key, set keyIndex to the required key, wepTxKey - to TRUE and the keyLength to 0. - keyRsc - Key Receive Sequence Counter - authenticator - If TRUE the WMA will act as authenticator. - CURRENTLY NOT SUPPORTED - address - BSS identifier of the AP - keyLength - Length of the key in bytes - key - Points to the first byte of the key - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeKeyType keyType; - u8 keyIndex; - u8 wepTxKey; - u16 keyRsc[8]; - u8 authenticator; - CsrWifiMacAddress address; - u8 keyLength; - u8 key[32]; -} CsrWifiSmeKey; - -/******************************************************************************* - - NAME - CsrWifiSmeP2pClientInfoType - - DESCRIPTION - P2P Information for a P2P Client - - MEMBERS - p2PClientInterfaceAddress - MAC address of the P2P Client - clientDeviceInfo - Device Information - -*******************************************************************************/ -typedef struct -{ - CsrWifiMacAddress p2PClientInterfaceAddress; - CsrWifiSmeDeviceInfo clientDeviceInfo; -} CsrWifiSmeP2pClientInfoType; - -/******************************************************************************* - - NAME - CsrWifiSmeP2pGroupInfo - - DESCRIPTION - P2P Information for a P2P Group - - MEMBERS - groupCapability - P2P group capabilities - p2pDeviceAddress - Device Address of the GO - p2pClientInfoCount - Number of P2P Clients that belong to the group. - p2PClientInfo - Pointer to the list containing client information for - each client in the group - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeP2pGroupCapabilityMask groupCapability; - CsrWifiMacAddress p2pDeviceAddress; - u8 p2pClientInfoCount; - CsrWifiSmeP2pClientInfoType *p2PClientInfo; -} CsrWifiSmeP2pGroupInfo; - -/******************************************************************************* - - NAME - CsrWifiSmePowerConfig - - DESCRIPTION - Configures the power-save behaviour of the driver and firmware. - - MEMBERS - powerSaveLevel - Power Save Level option - listenIntervalTu - Interval for waking to receive beacon frames - rxDtims - If TRUE, wake for DTIM every beacon period, to - allow the reception broadcast packets - d3AutoScanMode - Defines whether the autonomous scanning will be - turned off or will stay on during a D3 suspended - period - clientTrafficWindow - Deprecated - opportunisticPowerSave - Deprecated - noticeOfAbsence - Deprecated - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmePowerSaveLevel powerSaveLevel; - u16 listenIntervalTu; - u8 rxDtims; - CsrWifiSmeD3AutoScanMode d3AutoScanMode; - u8 clientTrafficWindow; - u8 opportunisticPowerSave; - u8 noticeOfAbsence; -} CsrWifiSmePowerConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeRoamingConfig - - DESCRIPTION - Configures the roaming behaviour of the driver and firmware - - MEMBERS - roamingBands - Defines the thresholds to determine the usability - level of the current connection. - roamingBands is indexed by the first 3 entries of - the CsrWifiSmeBasicUsability enum - disableSmoothRoaming - Disable the RSSI/SNR triggers from the Firmware - that the SME uses to detect the quality of the - connection. - This implicitly disables disableRoamScans - disableRoamScans - Disables the scanning for the roaming operation - reconnectLimit - Maximum number of times SME may reconnect in the - given interval - reconnectLimitIntervalMs - Interval for maximum number of times SME may - reconnect to the same Access Point - roamScanCfg - Scanning behaviour for the specifically aimed at - improving roaming performance. - roamScanCfg is indexed by the first 3 entries of - the CsrWifiSmeBasicUsability enum - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeRoamingBandData roamingBands[3]; - u8 disableSmoothRoaming; - u8 disableRoamScans; - u8 reconnectLimit; - u16 reconnectLimitIntervalMs; - CsrWifiSmeScanConfigData roamScanCfg[3]; -} CsrWifiSmeRoamingConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeScanConfig - - DESCRIPTION - Parameters for the autonomous scanning behaviour of the system - - MEMBERS - scanCfg - Scan configuration data. - Indexed by the CsrWifiSmeBasicUsability enum - disableAutonomousScans - Enables or disables the autonomous scan - maxResults - Maximum number of results to be cached in the SME - highRssiThreshold - High received signal strength indication threshold - in dBm for an AP above which the system will - report scan indications - lowRssiThreshold - Low received signal strength indication threshold - in dBm for an AP below which the system will - report scan indications - deltaRssiThreshold - Minimum difference for received signal strength - indication in dBm for an AP which trigger a scan - indication to be sent. - highSnrThreshold - High Signal to Noise Ratio threshold in dB for an - AP above which the system will report scan - indications - lowSnrThreshold - Low Signal to Noise Ratio threshold in dB for an - AP below which the system will report scan - indications - deltaSnrThreshold - Minimum difference for Signal to Noise Ratio in dB - for an AP which trigger a scan indication to be - sent. - passiveChannelListCount - Number of channels to be scanned passively. - passiveChannelList - Points to the first channel to be scanned - passively , if any. - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeScanConfigData scanCfg[4]; - u8 disableAutonomousScans; - u16 maxResults; - s8 highRssiThreshold; - s8 lowRssiThreshold; - s8 deltaRssiThreshold; - s8 highSnrThreshold; - s8 lowSnrThreshold; - s8 deltaSnrThreshold; - u16 passiveChannelListCount; - u8 *passiveChannelList; -} CsrWifiSmeScanConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeScanResult - - DESCRIPTION - This structure defines the scan result for each BSS found - - MEMBERS - ssid - Service set identifier - bssid - BSS identifier - rssi - Received signal strength indication in dBm - snr - Signal to noise ratio in dB - ifIndex - Indicates the radio interface - beaconPeriodTu - Interval between beacon frames - timeStamp - Timestamp in the BSS - localTime - Timestamp in the Access Point - channelFrequency - Channel frequency - capabilityInformation - Capabilities of the BSS. - channelNumber - Channel number - usability - Indicates the usability level. - bssType - Type of BSS. - informationElementsLength - Number of bytes of the information elements - received as part of the beacon or probe - response. - informationElements - Points to the first byte of the IEs received - as part of the beacon or probe response. - The format of the IEs is as specified in the - IEEE 802.11 specification. - p2pDeviceRole - Role of the P2P device. - Relevant only if bssType is - CSR_WIFI_SME_BSS_TYPE_P2P - deviceInfo - Union containing P2P device info which - depends on p2pDeviceRole parameter. - deviceInforeservedCli - - deviceInfogroupInfo - - deviceInforeservedNone - - deviceInfostandalonedevInfo - - -*******************************************************************************/ -typedef struct -{ - CsrWifiSsid ssid; - CsrWifiMacAddress bssid; - s16 rssi; - s16 snr; - CsrWifiSmeRadioIF ifIndex; - u16 beaconPeriodTu; - CsrWifiSmeTsfTime timeStamp; - CsrWifiSmeTsfTime localTime; - u16 channelFrequency; - u16 capabilityInformation; - u8 channelNumber; - CsrWifiSmeBasicUsability usability; - CsrWifiSmeBssType bssType; - u16 informationElementsLength; - u8 *informationElements; - CsrWifiSmeP2pRole p2pDeviceRole; - union { - CsrWifiSmeEmpty reservedCli; - CsrWifiSmeP2pGroupInfo groupInfo; - CsrWifiSmeEmpty reservedNone; - CsrWifiSmeDeviceInfo standalonedevInfo; - } deviceInfo; -} CsrWifiSmeScanResult; - -/******************************************************************************* - - NAME - CsrWifiSmeStaConfig - - DESCRIPTION - Station configuration options in the SME - - MEMBERS - connectionQualityRssiChangeTrigger - Sets the difference of RSSI - measurements which triggers reports - from the Firmware - connectionQualitySnrChangeTrigger - Sets the difference of SNR measurements - which triggers reports from the - Firmware - wmmModeMask - Mask containing one or more values from - CsrWifiSmeWmmMode - ifIndex - Indicates the band of frequencies used - allowUnicastUseGroupCipher - If TRUE, it allows to use groupwise - keys if no pairwise key is specified - enableOpportunisticKeyCaching - If TRUE, enables the Opportunistic Key - Caching feature - -*******************************************************************************/ -typedef struct -{ - u8 connectionQualityRssiChangeTrigger; - u8 connectionQualitySnrChangeTrigger; - CsrWifiSmeWmmModeMask wmmModeMask; - CsrWifiSmeRadioIF ifIndex; - u8 allowUnicastUseGroupCipher; - u8 enableOpportunisticKeyCaching; -} CsrWifiSmeStaConfig; - -/******************************************************************************* - - NAME - CsrWifiSmeWep128Keys - - DESCRIPTION - Structure holding WEP Authentication Type and WEP keys that can be used - when using WEP128. - - MEMBERS - wepAuthType - Mask to select the WEP authentication type (Open or Shared) - selectedWepKey - Index to one of the four keys below indicating the - currently used WEP key. Mapping From SME/User -> firmware. - Key 1 -> Index 0. Key 2 -> Index 1. key 3 -> Index 2. Key - 4-> Index 3. - key1 - Value for key number 1. - key2 - Value for key number 2. - key3 - Value for key number 3. - key4 - Value for key number 4. - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeWepAuthMode wepAuthType; - u8 selectedWepKey; - u8 key1[13]; - u8 key2[13]; - u8 key3[13]; - u8 key4[13]; -} CsrWifiSmeWep128Keys; - -/******************************************************************************* - - NAME - CsrWifiSmeWep64Keys - - DESCRIPTION - Structure holding WEP Authentication Type and WEP keys that can be used - when using WEP64. - - MEMBERS - wepAuthType - Mask to select the WEP authentication type (Open or Shared) - selectedWepKey - Index to one of the four keys below indicating the - currently used WEP key. Mapping From SME/User -> firmware. - Key 1 -> Index 0. Key 2 -> Index 1. key 3 -> Index 2. Key - 4-> Index 3. - key1 - Value for key number 1. - key2 - Value for key number 2. - key3 - Value for key number 3. - key4 - Value for key number 4. - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeWepAuthMode wepAuthType; - u8 selectedWepKey; - u8 key1[5]; - u8 key2[5]; - u8 key3[5]; - u8 key4[5]; -} CsrWifiSmeWep64Keys; - -/******************************************************************************* - - NAME - CsrWifiSmeWepAuth - - DESCRIPTION - WEP authentication parameter structure - - MEMBERS - wepKeyType - WEP key try (128 bit or 64 bit) - wepCredentials - Union containing credentials which depends on - wepKeyType parameter. - wepCredentialswep128Key - - wepCredentialswep64Key - - -*******************************************************************************/ -typedef struct -{ - CsrWifiSmeWepCredentialType wepKeyType; - union { - CsrWifiSmeWep128Keys wep128Key; - CsrWifiSmeWep64Keys wep64Key; - } wepCredentials; -} CsrWifiSmeWepAuth; - -/******************************************************************************* - - NAME - CsrWifiSmeWpsConfig - - DESCRIPTION - Structure holding AP WPS Config data. - - MEMBERS - wpsVersion - wpsVersion should be 0x10 for WPS1.0h or 0x20 for - WSC2.0 - uuid - uuid. - deviceName - Device name upto 32 characters without '\0'. - deviceNameLength - deviceNameLen. - manufacturer - manufacturer: CSR - manufacturerLength - manufacturerLen. - modelName - modelName Unifi - modelNameLength - modelNameLen. - modelNumber - modelNumber - modelNumberLength - modelNumberLen. - serialNumber - serialNumber - primDeviceType - Primary WPS device type - secondaryDeviceTypeCount - Number of secondary device types - secondaryDeviceType - list of secondary WPS device types - configMethods - Supported WPS config methods - rfBands - RfBands. - osVersion - Os version on which the device is running - -*******************************************************************************/ -typedef struct -{ - u8 wpsVersion; - u8 uuid[16]; - u8 deviceName[32]; - u8 deviceNameLength; - u8 manufacturer[64]; - u8 manufacturerLength; - u8 modelName[32]; - u8 modelNameLength; - u8 modelNumber[32]; - u8 modelNumberLength; - u8 serialNumber[32]; - CsrWifiSmeWpsDeviceType primDeviceType; - u8 secondaryDeviceTypeCount; - CsrWifiSmeWpsDeviceType *secondaryDeviceType; - CsrWifiSmeWpsConfigTypeMask configMethods; - u8 rfBands; - u8 osVersion[4]; -} CsrWifiSmeWpsConfig; - - -/* Downstream */ -#define CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST (0x0000) - -#define CSR_WIFI_SME_ACTIVATE_REQ ((CsrWifiSmePrim) (0x0000 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_ADHOC_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0001 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_ADHOC_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0002 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_BLACKLIST_REQ ((CsrWifiSmePrim) (0x0003 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_CALIBRATION_DATA_GET_REQ ((CsrWifiSmePrim) (0x0004 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ ((CsrWifiSmePrim) (0x0005 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_CCX_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0006 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_CCX_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0007 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_COEX_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0008 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_COEX_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0009 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_COEX_INFO_GET_REQ ((CsrWifiSmePrim) (0x000A + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_CONNECT_REQ ((CsrWifiSmePrim) (0x000B + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_CONNECTION_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x000C + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_CONNECTION_INFO_GET_REQ ((CsrWifiSmePrim) (0x000D + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_CONNECTION_STATS_GET_REQ ((CsrWifiSmePrim) (0x000E + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_DEACTIVATE_REQ ((CsrWifiSmePrim) (0x000F + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_DISCONNECT_REQ ((CsrWifiSmePrim) (0x0010 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_EVENT_MASK_SET_REQ ((CsrWifiSmePrim) (0x0011 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_HOST_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0012 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_HOST_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0013 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_KEY_REQ ((CsrWifiSmePrim) (0x0014 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_LINK_QUALITY_GET_REQ ((CsrWifiSmePrim) (0x0015 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_MIB_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0016 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_MIB_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0017 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_MIB_GET_NEXT_REQ ((CsrWifiSmePrim) (0x0018 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_MIB_GET_REQ ((CsrWifiSmePrim) (0x0019 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_MIB_SET_REQ ((CsrWifiSmePrim) (0x001A + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_MULTICAST_ADDRESS_REQ ((CsrWifiSmePrim) (0x001B + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_PACKET_FILTER_SET_REQ ((CsrWifiSmePrim) (0x001C + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_REQ ((CsrWifiSmePrim) (0x001D + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_PMKID_REQ ((CsrWifiSmePrim) (0x001E + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_POWER_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x001F + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_POWER_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0020 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_REQ ((CsrWifiSmePrim) (0x0021 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_ROAMING_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0022 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_ROAMING_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0023 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_SCAN_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0024 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_SCAN_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0025 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_SCAN_FULL_REQ ((CsrWifiSmePrim) (0x0026 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_SCAN_RESULTS_FLUSH_REQ ((CsrWifiSmePrim) (0x0027 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_SCAN_RESULTS_GET_REQ ((CsrWifiSmePrim) (0x0028 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_SME_STA_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0029 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_SME_STA_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x002A + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_REQ ((CsrWifiSmePrim) (0x002B + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_TSPEC_REQ ((CsrWifiSmePrim) (0x002C + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_VERSIONS_GET_REQ ((CsrWifiSmePrim) (0x002D + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ ((CsrWifiSmePrim) (0x002E + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_WIFI_OFF_REQ ((CsrWifiSmePrim) (0x002F + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_WIFI_ON_REQ ((CsrWifiSmePrim) (0x0030 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ ((CsrWifiSmePrim) (0x0031 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_CLOAKED_SSIDS_GET_REQ ((CsrWifiSmePrim) (0x0032 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_SME_COMMON_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0033 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0034 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ ((CsrWifiSmePrim) (0x0035 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_WPS_CONFIGURATION_REQ ((CsrWifiSmePrim) (0x0036 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) -#define CSR_WIFI_SME_SET_REQ ((CsrWifiSmePrim) (0x0037 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)) - - -#define CSR_WIFI_SME_PRIM_DOWNSTREAM_HIGHEST (0x0037 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST) - -/* Upstream */ -#define CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM) - -#define CSR_WIFI_SME_ACTIVATE_CFM ((CsrWifiSmePrim)(0x0000 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_ADHOC_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0001 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_ADHOC_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0002 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND ((CsrWifiSmePrim)(0x0003 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_ASSOCIATION_START_IND ((CsrWifiSmePrim)(0x0004 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_BLACKLIST_CFM ((CsrWifiSmePrim)(0x0005 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM ((CsrWifiSmePrim)(0x0006 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_CALIBRATION_DATA_SET_CFM ((CsrWifiSmePrim)(0x0007 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_CCX_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0008 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_CCX_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0009 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_COEX_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x000A + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_COEX_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x000B + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_COEX_INFO_GET_CFM ((CsrWifiSmePrim)(0x000C + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_CONNECT_CFM ((CsrWifiSmePrim)(0x000D + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x000E + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_CONNECTION_INFO_GET_CFM ((CsrWifiSmePrim)(0x000F + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_CONNECTION_QUALITY_IND ((CsrWifiSmePrim)(0x0010 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_CONNECTION_STATS_GET_CFM ((CsrWifiSmePrim)(0x0011 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_DEACTIVATE_CFM ((CsrWifiSmePrim)(0x0012 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_DISCONNECT_CFM ((CsrWifiSmePrim)(0x0013 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_EVENT_MASK_SET_CFM ((CsrWifiSmePrim)(0x0014 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_HOST_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0015 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_HOST_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0016 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_IBSS_STATION_IND ((CsrWifiSmePrim)(0x0017 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_KEY_CFM ((CsrWifiSmePrim)(0x0018 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_LINK_QUALITY_GET_CFM ((CsrWifiSmePrim)(0x0019 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_MEDIA_STATUS_IND ((CsrWifiSmePrim)(0x001A + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_MIB_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x001B + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_MIB_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x001C + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_MIB_GET_CFM ((CsrWifiSmePrim)(0x001D + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_MIB_GET_NEXT_CFM ((CsrWifiSmePrim)(0x001E + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_MIB_SET_CFM ((CsrWifiSmePrim)(0x001F + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_MIC_FAILURE_IND ((CsrWifiSmePrim)(0x0020 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_MULTICAST_ADDRESS_CFM ((CsrWifiSmePrim)(0x0021 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_PACKET_FILTER_SET_CFM ((CsrWifiSmePrim)(0x0022 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_CFM ((CsrWifiSmePrim)(0x0023 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND ((CsrWifiSmePrim)(0x0024 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_PMKID_CFM ((CsrWifiSmePrim)(0x0025 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_POWER_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0026 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_POWER_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0027 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_CFM ((CsrWifiSmePrim)(0x0028 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_ROAM_COMPLETE_IND ((CsrWifiSmePrim)(0x0029 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_ROAM_START_IND ((CsrWifiSmePrim)(0x002A + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_ROAMING_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x002B + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_ROAMING_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x002C + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_SCAN_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x002D + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_SCAN_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x002E + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_SCAN_FULL_CFM ((CsrWifiSmePrim)(0x002F + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_SCAN_RESULT_IND ((CsrWifiSmePrim)(0x0030 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_SCAN_RESULTS_FLUSH_CFM ((CsrWifiSmePrim)(0x0031 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_SCAN_RESULTS_GET_CFM ((CsrWifiSmePrim)(0x0032 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_SME_STA_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0033 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_SME_STA_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0034 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_CFM ((CsrWifiSmePrim)(0x0035 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_TSPEC_IND ((CsrWifiSmePrim)(0x0036 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_TSPEC_CFM ((CsrWifiSmePrim)(0x0037 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_VERSIONS_GET_CFM ((CsrWifiSmePrim)(0x0038 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_WIFI_FLIGHTMODE_CFM ((CsrWifiSmePrim)(0x0039 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_WIFI_OFF_IND ((CsrWifiSmePrim)(0x003A + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_WIFI_OFF_CFM ((CsrWifiSmePrim)(0x003B + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_WIFI_ON_CFM ((CsrWifiSmePrim)(0x003C + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_CLOAKED_SSIDS_SET_CFM ((CsrWifiSmePrim)(0x003D + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM ((CsrWifiSmePrim)(0x003E + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_WIFI_ON_IND ((CsrWifiSmePrim)(0x003F + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_SME_COMMON_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0040 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_SME_COMMON_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0041 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM ((CsrWifiSmePrim)(0x0042 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_ERROR_IND ((CsrWifiSmePrim)(0x0043 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_INFO_IND ((CsrWifiSmePrim)(0x0044 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_CORE_DUMP_IND ((CsrWifiSmePrim)(0x0045 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_AMP_STATUS_CHANGE_IND ((CsrWifiSmePrim)(0x0046 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) -#define CSR_WIFI_SME_WPS_CONFIGURATION_CFM ((CsrWifiSmePrim)(0x0047 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)) - -#define CSR_WIFI_SME_PRIM_UPSTREAM_HIGHEST (0x0047 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST) - -#define CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_SME_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST) -#define CSR_WIFI_SME_PRIM_UPSTREAM_COUNT (CSR_WIFI_SME_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST) - -/******************************************************************************* - - NAME - CsrWifiSmeActivateReq - - DESCRIPTION - The WMA sends this primitive to activate the SME. - The WMA must activate the SME before it can send any other primitive. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeActivateReq; - -/******************************************************************************* - - NAME - CsrWifiSmeAdhocConfigGetReq - - DESCRIPTION - This primitive gets the value of the adHocConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeAdhocConfigGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeAdhocConfigSetReq - - DESCRIPTION - This primitive sets the value of the adHocConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - adHocConfig - Sets the values to use when starting an ad hoc network. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeAdHocConfig adHocConfig; -} CsrWifiSmeAdhocConfigSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeBlacklistReq - - DESCRIPTION - The wireless manager application should call this primitive to notify the - driver of any networks that should not be connected to. The interface - allows the wireless manager application to query, add, remove, and flush - the BSSIDs that the driver may not connect or roam to. - When this primitive adds to the black list the BSSID to which the SME is - currently connected, the SME will try to roam, if applicable, to another - BSSID in the same ESS; if the roaming procedure fails, the SME will - disconnect. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - action - The value of the CsrWifiSmeListAction parameter instructs - the driver to modify or provide the list of blacklisted - networks. - setAddressCount - Number of BSSIDs sent with this primitive - setAddresses - Pointer to the list of BBSIDs sent with the primitive, set - to NULL if none is sent. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeListAction action; - u8 setAddressCount; - CsrWifiMacAddress *setAddresses; -} CsrWifiSmeBlacklistReq; - -/******************************************************************************* - - NAME - CsrWifiSmeCalibrationDataGetReq - - DESCRIPTION - This primitive retrieves the Wi-Fi radio calibration data. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeCalibrationDataGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeCalibrationDataSetReq - - DESCRIPTION - This primitive sets the Wi-Fi radio calibration data. - The usage of the primitive with proper calibration data will avoid - time-consuming configuration after power-up. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - calibrationDataLength - Number of bytes in the buffer pointed by - calibrationData - calibrationData - Pointer to a buffer of length calibrationDataLength - containing the calibration data - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 calibrationDataLength; - u8 *calibrationData; -} CsrWifiSmeCalibrationDataSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeCcxConfigGetReq - - DESCRIPTION - This primitive gets the value of the CcxConfig parameter. - CURRENTLY NOT SUPPORTED. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiSmeCcxConfigGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeCcxConfigSetReq - - DESCRIPTION - This primitive sets the value of the CcxConfig parameter. - CURRENTLY NOT SUPPORTED. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - ccxConfig - Currently not supported - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeCcxConfig ccxConfig; -} CsrWifiSmeCcxConfigSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeCoexConfigGetReq - - DESCRIPTION - This primitive gets the value of the CoexConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeCoexConfigGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeCoexConfigSetReq - - DESCRIPTION - This primitive sets the value of the CoexConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - coexConfig - Configures the coexistence behaviour - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeCoexConfig coexConfig; -} CsrWifiSmeCoexConfigSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeCoexInfoGetReq - - DESCRIPTION - This primitive gets the value of the CoexInfo parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeCoexInfoGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeConnectReq - - DESCRIPTION - The wireless manager application calls this primitive to start the - process of joining an 802.11 wireless network or to start an ad hoc - network. - The structure pointed by connectionConfig contains parameters describing - the network to join or, in case of an ad hoc network, to host or join. - The SME will select a network, perform the IEEE 802.11 Join, Authenticate - and Associate exchanges. - The SME selects the networks from the current scan list that match both - the SSID and BSSID, however either or both of these may be the wildcard - value. Using this rule, the following operations are possible: - * To connect to a network by name, specify the SSID and set the BSSID to - 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF. If there are two or more networks visible, - the SME will select the one with the strongest signal. - * To connect to a specific network, specify the BSSID. The SSID is - optional, but if given it must match the SSID of the network. An empty - SSID may be specified by setting the SSID length to zero. Please note - that if the BSSID is specified (i.e. not equal to 0xFF 0xFF 0xFF 0xFF - 0xFF 0xFF), the SME will not attempt to roam if signal conditions become - poor, even if there is an alternative AP with an SSID that matches the - current network SSID. - * To connect to any network matching the other parameters (i.e. security, - etc), set the SSID length to zero and set the BSSID to 0xFF 0xFF 0xFF - 0xFF 0xFF 0xFF. In this case, the SME will order all available networks - by their signal strengths and will iterate through this list until it - successfully connects. - NOTE: Specifying the BSSID will restrict the selection to one specific - network. If SSID and BSSID are given, they must both match the network - for it to be selected. To select a network based on the SSID only, the - wireless manager application must set the BSSID to 0xFF 0xFF 0xFF 0xFF - 0xFF 0xFF. - The SME will try to connect to each network that matches the provided - parameters, one by one, until it succeeds or has tried unsuccessfully - with all the matching networks. - If there is no network that matches the parameters and the request allows - to host an ad hoc network, the SME will advertise a new ad hoc network - instead. - If the SME cannot connect, it will notify the failure in the confirm. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - connectionConfig - Describes the candidate network to join or to host. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeConnectionConfig connectionConfig; -} CsrWifiSmeConnectReq; - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionConfigGetReq - - DESCRIPTION - This primitive gets the value of the ConnectionConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiSmeConnectionConfigGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionInfoGetReq - - DESCRIPTION - This primitive gets the value of the ConnectionInfo parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiSmeConnectionInfoGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionStatsGetReq - - DESCRIPTION - This primitive gets the value of the ConnectionStats parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiSmeConnectionStatsGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeDeactivateReq - - DESCRIPTION - The WMA sends this primitive to deactivate the SME. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeDeactivateReq; - -/******************************************************************************* - - NAME - CsrWifiSmeDisconnectReq - - DESCRIPTION - The wireless manager application may disconnect from the current network - by calling this primitive - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiSmeDisconnectReq; - -/******************************************************************************* - - NAME - CsrWifiSmeEventMaskSetReq - - DESCRIPTION - The wireless manager application may register with the SME to receive - notification of interesting events. Indications will be sent only if the - wireless manager explicitly registers to be notified of that event. - indMask is a bit mask of values defined in CsrWifiSmeIndicationsMask. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - indMask - Set mask with values from CsrWifiSmeIndications - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeIndicationsMask indMask; -} CsrWifiSmeEventMaskSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeHostConfigGetReq - - DESCRIPTION - This primitive gets the value of the hostConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiSmeHostConfigGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeHostConfigSetReq - - DESCRIPTION - This primitive sets the value of the hostConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - hostConfig - Communicates a change of host power state (for example, on - mains power, on battery power etc) and of the periodicity of - traffic data - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeHostConfig hostConfig; -} CsrWifiSmeHostConfigSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeKeyReq - - DESCRIPTION - The wireless manager application calls this primitive to add or remove - keys that the chip should use for encryption of data. - The interface allows the wireless manager application to add and remove - keys according to the specified action. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - action - The value of the CsrWifiSmeListAction parameter instructs the - driver to modify or provide the list of keys. - CSR_WIFI_SME_LIST_ACTION_GET is not supported here. - key - Key to be added or removed - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeListAction action; - CsrWifiSmeKey key; -} CsrWifiSmeKeyReq; - -/******************************************************************************* - - NAME - CsrWifiSmeLinkQualityGetReq - - DESCRIPTION - This primitive gets the value of the LinkQuality parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiSmeLinkQualityGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeMibConfigGetReq - - DESCRIPTION - This primitive gets the value of the MibConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeMibConfigGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeMibConfigSetReq - - DESCRIPTION - This primitive sets the value of the MibConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - mibConfig - Conveys the desired value of various IEEE 802.11 attributes as - currently configured - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeMibConfig mibConfig; -} CsrWifiSmeMibConfigSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeMibGetNextReq - - DESCRIPTION - To read a sequence of MIB parameters, for example a table, call this - primitive to find the name of the next MIB variable - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - mibAttributeLength - Length of mibAttribute - mibAttribute - Points to a VarBind or VarBindList containing the - name(s) of the MIB variable(s) to search from. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 mibAttributeLength; - u8 *mibAttribute; -} CsrWifiSmeMibGetNextReq; - -/******************************************************************************* - - NAME - CsrWifiSmeMibGetReq - - DESCRIPTION - The wireless manager application calls this primitive to retrieve one or - more MIB variables. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - mibAttributeLength - Length of mibAttribute - mibAttribute - Points to the VarBind or VarBindList containing the - names of the MIB variables to be retrieved - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 mibAttributeLength; - u8 *mibAttribute; -} CsrWifiSmeMibGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeMibSetReq - - DESCRIPTION - The SME provides raw access to the MIB on the chip, which may be used by - some configuration or diagnostic utilities, but is not normally needed by - the wireless manager application. - The MIB access functions use BER encoded names (OID) of the MIB - parameters and BER encoded values, as described in the chip Host - Interface Protocol Specification. - The MIB parameters are described in 'Wi-Fi 5.0.0 Management Information - Base Reference Guide'. - The wireless manager application calls this primitive to set one or more - MIB variables - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - mibAttributeLength - Length of mibAttribute - mibAttribute - Points to the VarBind or VarBindList containing the - names and values of the MIB variables to set - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 mibAttributeLength; - u8 *mibAttribute; -} CsrWifiSmeMibSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeMulticastAddressReq - - DESCRIPTION - The wireless manager application calls this primitive to specify the - multicast addresses which the chip should recognise. The interface allows - the wireless manager application to query, add, remove and flush the - multicast addresses for the network interface according to the specified - action. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - action - The value of the CsrWifiSmeListAction parameter - instructs the driver to modify or provide the list of - MAC addresses. - setAddressesCount - Number of MAC addresses sent with the primitive - setAddresses - Pointer to the list of MAC Addresses sent with the - primitive, set to NULL if none is sent. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeListAction action; - u8 setAddressesCount; - CsrWifiMacAddress *setAddresses; -} CsrWifiSmeMulticastAddressReq; - -/******************************************************************************* - - NAME - CsrWifiSmePacketFilterSetReq - - DESCRIPTION - The wireless manager application should call this primitive to enable or - disable filtering of broadcast packets: uninteresting broadcast packets - will be dropped by the Wi-Fi chip, instead of passing them up to the - host. - This has the advantage of saving power in the host application processor - as it removes the need to process unwanted packets. - All broadcast packets are filtered according to the filter and the filter - mode provided, except ARP packets, which are filtered using - arpFilterAddress. - Filters are not cumulative: only the parameters specified in the most - recent successful request are significant. - For more information, see 'UniFi Firmware API Specification'. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - filterLength - Length of the filter in bytes. - filterLength=0 disables the filter previously set - filter - Points to the first byte of the filter provided, if any. - This shall include zero or more instance of the - information elements of one of these types - * Traffic Classification (TCLAS) elements - * WMM-SA TCLAS elements - mode - Specifies whether the filter selects or excludes packets - matching the filter - arpFilterAddress - IPv4 address to be used for filtering the ARP packets. - * If the specified address is the IPv4 broadcast address - (255.255.255.255), all ARP packets are reported to the - host, - * If the specified address is NOT the IPv4 broadcast - address, only ARP packets with the specified address in - the Source or Target Protocol Address fields are reported - to the host - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u16 filterLength; - u8 *filter; - CsrWifiSmePacketFilterMode mode; - CsrWifiIp4Address arpFilterAddress; -} CsrWifiSmePacketFilterSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmePermanentMacAddressGetReq - - DESCRIPTION - This primitive retrieves the MAC address stored in EEPROM - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmePermanentMacAddressGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmePmkidReq - - DESCRIPTION - The wireless manager application calls this primitive to request an - operation on the SME PMKID list. - The action argument specifies the operation to perform. - When the connection is complete, the wireless manager application may - then send and receive EAPOL packets to complete WPA or WPA2 - authentication if appropriate. - The wireless manager application can then pass the resulting encryption - keys using this primitive. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - action - The value of the CsrWifiSmeListAction parameter instructs - the driver to modify or provide the list of PMKIDs. - setPmkidsCount - Number of PMKIDs sent with the primitive - setPmkids - Pointer to the list of PMKIDs sent with the primitive, set - to NULL if none is sent. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeListAction action; - u8 setPmkidsCount; - CsrWifiSmePmkid *setPmkids; -} CsrWifiSmePmkidReq; - -/******************************************************************************* - - NAME - CsrWifiSmePowerConfigGetReq - - DESCRIPTION - This primitive gets the value of the PowerConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmePowerConfigGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmePowerConfigSetReq - - DESCRIPTION - This primitive sets the value of the PowerConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - powerConfig - Power saving configuration - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmePowerConfig powerConfig; -} CsrWifiSmePowerConfigSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeRegulatoryDomainInfoGetReq - - DESCRIPTION - This primitive gets the value of the RegulatoryDomainInfo parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeRegulatoryDomainInfoGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeRoamingConfigGetReq - - DESCRIPTION - This primitive gets the value of the RoamingConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiSmeRoamingConfigGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeRoamingConfigSetReq - - DESCRIPTION - This primitive sets the value of the RoamingConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - roamingConfig - Desired roaming behaviour values - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeRoamingConfig roamingConfig; -} CsrWifiSmeRoamingConfigSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeScanConfigGetReq - - DESCRIPTION - This primitive gets the value of the ScanConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeScanConfigGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeScanConfigSetReq - - DESCRIPTION - This primitive sets the value of the ScanConfig parameter. - The SME normally configures the firmware to perform autonomous scanning - without involving the host. - The firmware passes beacon / probe response or indicates loss of beacon - on certain changes of state, for example: - * A new AP is seen for the first time - * An AP is no longer visible - * The signal strength of an AP changes by more than a certain amount, as - configured by the thresholds in the scanConfig parameter - In addition to the autonomous scan, the wireless manager application may - request a scan at any time using CSR_WIFI_SME_SCAN_FULL_REQ. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - scanConfig - Reports the configuration for the autonomous scanning behaviour - of the firmware - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeScanConfig scanConfig; -} CsrWifiSmeScanConfigSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeScanFullReq - - DESCRIPTION - The wireless manager application should call this primitive to request a - full scan. - Channels are scanned actively or passively according to the requirement - set by regulatory domain. - If the SME receives this primitive while a full scan is going on, the new - request is buffered and it will be served after the current full scan is - completed. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - ssidCount - Number of SSIDs provided. - If it is 0, the SME will attempt to detect any network - ssid - Points to the first SSID provided, if any. - bssid - BSS identifier. - If it is equal to FF-FF-FF-FF-FF, the SME will listen for - messages from any BSS. - If it is different from FF-FF-FF-FF-FF and any SSID is - provided, one SSID must match the network of the BSS. - forceScan - Forces the scan even if the SME is in a state which would - normally prevent it (e.g. autonomous scan is running). - bssType - Type of BSS to scan for - scanType - Type of scan to perform - channelListCount - Number of channels provided. - If it is 0, the SME will initiate a scan of all the - supported channels that are permitted by the current - regulatory domain. - channelList - Points to the first channel , or NULL if channelListCount - is zero. - probeIeLength - Length of the information element in bytes to be sent - with the probe message. - probeIe - Points to the first byte of the information element to be - sent with the probe message. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u8 ssidCount; - CsrWifiSsid *ssid; - CsrWifiMacAddress bssid; - u8 forceScan; - CsrWifiSmeBssType bssType; - CsrWifiSmeScanType scanType; - u16 channelListCount; - u8 *channelList; - u16 probeIeLength; - u8 *probeIe; -} CsrWifiSmeScanFullReq; - -/******************************************************************************* - - NAME - CsrWifiSmeScanResultsFlushReq - - DESCRIPTION - The Wireless Manager calls this primitive to ask the SME to delete all - scan results from its cache, except for the scan result of any currently - connected network. - As scan results are received by the SME from the firmware, they are - cached in the SME memory. - Any time the Wireless Manager requests scan results, they are returned - from the SME internal cache. - For some applications it may be desirable to clear this cache prior to - requesting that a scan be performed; this will ensure that the cache then - only contains the networks detected in the most recent scan. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeScanResultsFlushReq; - -/******************************************************************************* - - NAME - CsrWifiSmeScanResultsGetReq - - DESCRIPTION - The wireless manager application calls this primitive to retrieve the - current set of scan results, either after receiving a successful - CSR_WIFI_SME_SCAN_FULL_CFM, or to get autonomous scan results. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeScanResultsGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeSmeStaConfigGetReq - - DESCRIPTION - This primitive gets the value of the SmeStaConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; -} CsrWifiSmeSmeStaConfigGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeSmeStaConfigSetReq - - DESCRIPTION - This primitive sets the value of the SmeConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - smeConfig - SME Station Parameters to be set - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeStaConfig smeConfig; -} CsrWifiSmeSmeStaConfigSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeStationMacAddressGetReq - - DESCRIPTION - This primitives is used to retrieve the current MAC address used by the - station. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeStationMacAddressGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeTspecReq - - DESCRIPTION - The wireless manager application should call this primitive to use the - TSPEC feature. - The chip supports the use of TSPECs and TCLAS for the use of IEEE - 802.11/WMM Quality of Service features. - The API allows the wireless manager application to supply a correctly - formatted TSPEC and TCLAS pair to the driver. - After performing basic validation, the driver negotiates the installation - of the TSPEC with the AP as defined by the 802.11 specification. - The driver retains all TSPEC and TCLAS pairs until they are specifically - removed. - It is not compulsory for a TSPEC to have a TCLAS (NULL is used to - indicate that no TCLAS is supplied), while a TCLASS always require a - TSPEC. - The format of the TSPEC element is specified in 'WMM (including WMM Power - Save) Specification - Version 1.1' and 'ANSI/IEEE Std 802.11-REVmb/D3.0'. - For more information, see 'UniFi Configuring WMM and WMM-PS'. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - action - Specifies the action to be carried out on the list of TSPECs. - CSR_WIFI_SME_LIST_ACTION_FLUSH is not applicable here. - transactionId - Unique Transaction ID for the TSPEC, as assigned by the - driver - strict - If it set to false, allows the SME to perform automatic - TSPEC negotiation - ctrlMask - Additional TSPEC configuration for CCX. - Set mask with values from CsrWifiSmeTspecCtrl. - CURRENTLY NOT SUPPORTED - tspecLength - Length of the TSPEC. - tspec - Points to the first byte of the TSPEC - tclasLength - Length of the TCLAS. - If it is equal to 0, no TCLASS is provided for the TSPEC - tclas - Points to the first byte of the TCLAS, if any. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeListAction action; - u32 transactionId; - u8 strict; - CsrWifiSmeTspecCtrlMask ctrlMask; - u16 tspecLength; - u8 *tspec; - u16 tclasLength; - u8 *tclas; -} CsrWifiSmeTspecReq; - -/******************************************************************************* - - NAME - CsrWifiSmeVersionsGetReq - - DESCRIPTION - This primitive gets the value of the Versions parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeVersionsGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeWifiFlightmodeReq - - DESCRIPTION - The wireless manager application may call this primitive on boot-up of - the platform to ensure that the chip is placed in a mode that prevents - any emission of RF energy. - This primitive is an alternative to CSR_WIFI_SME_WIFI_ON_REQ. - As in CSR_WIFI_SME_WIFI_ON_REQ, it causes the download of the patch file - (if any) and the programming of the initial MIB settings (if supplied by - the WMA), but it also ensures that the chip is left in its lowest - possible power-mode with the radio subsystems disabled. - This feature is useful on platforms where power cannot be removed from - the chip (leaving the chip not initialised will cause it to consume more - power so calling this function ensures that the chip is initialised into - a low power mode but without entering a state where it could emit any RF - energy). - NOTE: this primitive does not cause the Wi-Fi to change state: Wi-Fi - stays conceptually off. Configuration primitives can be sent after - CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ and the configuration will be maintained. - Requests that require the state of the Wi-Fi to be ON will return - CSR_WIFI_SME_STATUS_WIFI_OFF in their confirms. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - address - Optionally specifies a station MAC address. - In normal use, the manager should set the address to 0xFF - 0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use - the MAC address in the MIB. - mibFilesCount - Number of provided data blocks with initial MIB values - mibFiles - Points to the first data block with initial MIB values. - These data blocks are typically the contents of the provided - files ufmib.dat and localmib.dat, available from the host - file system, if they exist. - These files typically contain radio tuning and calibration - values. - More values can be created using the Host Tools. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiMacAddress address; - u16 mibFilesCount; - CsrWifiSmeDataBlock *mibFiles; -} CsrWifiSmeWifiFlightmodeReq; - -/******************************************************************************* - - NAME - CsrWifiSmeWifiOffReq - - DESCRIPTION - The wireless manager application calls this primitive to turn off the - chip, thus saving power when Wi-Fi is not in use. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeWifiOffReq; - -/******************************************************************************* - - NAME - CsrWifiSmeWifiOnReq - - DESCRIPTION - The wireless manager application calls this primitive to turn on the - Wi-Fi chip. - If the Wi-Fi chip is currently off, the SME turns the Wi-Fi chip on, - downloads the patch file (if any), and programs the initial MIB settings - (if supplied by the WMA). - The patch file is not provided with the SME API; its downloading is - automatic and handled internally by the system. - The MIB settings, when provided, override the default values that the - firmware loads from EEPROM. - If the Wi-Fi chip is already on, the SME takes no action and returns a - successful status in the confirm. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - address - Optionally specifies a station MAC address. - In normal use, the manager should set the address to 0xFF - 0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use - the MAC address in the MIB - mibFilesCount - Number of provided data blocks with initial MIB values - mibFiles - Points to the first data block with initial MIB values. - These data blocks are typically the contents of the provided - files ufmib.dat and localmib.dat, available from the host - file system, if they exist. - These files typically contain radio tuning and calibration - values. - More values can be created using the Host Tools. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiMacAddress address; - u16 mibFilesCount; - CsrWifiSmeDataBlock *mibFiles; -} CsrWifiSmeWifiOnReq; - -/******************************************************************************* - - NAME - CsrWifiSmeCloakedSsidsSetReq - - DESCRIPTION - This primitive sets the list of cloaked SSIDs for which the WMA possesses - profiles. - When the driver detects a cloaked AP, the SME will explicitly scan for it - using the list of cloaked SSIDs provided it, and, if the scan succeeds, - it will report the AP to the WMA either via CSR_WIFI_SME_SCAN_RESULT_IND - (if registered) or via CSR_WIFI_SCAN_RESULT_GET_CFM. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - cloakedSsids - Sets the list of cloaked SSIDs - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeCloakedSsidConfig cloakedSsids; -} CsrWifiSmeCloakedSsidsSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeCloakedSsidsGetReq - - DESCRIPTION - This primitive gets the value of the CloakedSsids parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeCloakedSsidsGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeSmeCommonConfigGetReq - - DESCRIPTION - This primitive gets the value of the Sme common parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeSmeCommonConfigGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeSmeCommonConfigSetReq - - DESCRIPTION - This primitive sets the value of the Sme common. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - deviceConfig - Configuration options in the SME - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeDeviceConfig deviceConfig; -} CsrWifiSmeSmeCommonConfigSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeInterfaceCapabilityGetReq - - DESCRIPTION - The Wireless Manager calls this primitive to ask the SME for the - capabilities of the supported interfaces - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; -} CsrWifiSmeInterfaceCapabilityGetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeWpsConfigurationReq - - DESCRIPTION - This primitive passes the WPS information for the device to SME. This may - be accepted only if no interface is active. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - wpsConfig - WPS config. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeWpsConfig wpsConfig; -} CsrWifiSmeWpsConfigurationReq; - -/******************************************************************************* - - NAME - CsrWifiSmeSetReq - - DESCRIPTION - Used to pass custom data to the SME. Format is the same as 802.11 Info - Elements => | Id | Length | Data - 1) Cmanr Test Mode "Id:0 Length:1 Data:0x00 = OFF 0x01 = ON" "0x00 0x01 - (0x00|0x01)" - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - dataLength - Number of bytes in the buffer pointed to by 'data' - data - Pointer to the buffer containing 'dataLength' bytes - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u32 dataLength; - u8 *data; -} CsrWifiSmeSetReq; - -/******************************************************************************* - - NAME - CsrWifiSmeActivateCfm - - DESCRIPTION - The SME sends this primitive when the activation is complete. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeActivateCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeAdhocConfigGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - adHocConfig - Contains the values used when starting an Ad-hoc (IBSS) - connection. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiSmeAdHocConfig adHocConfig; -} CsrWifiSmeAdhocConfigGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeAdhocConfigSetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeAdhocConfigSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeAssociationCompleteInd - - DESCRIPTION - The SME will send this primitive to all the tasks that have registered to - receive it whenever it completes an attempt to associate with an AP. If - the association was successful, status will be set to - CSR_WIFI_SME_STATUS_SUCCESS, otherwise status and deauthReason shall be - set to appropriate error codes. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the association procedure - connectionInfo - This parameter is relevant only if result is - CSR_WIFI_SME_STATUS_SUCCESS: - it points to the connection information for the new network - deauthReason - This parameter is relevant only if result is not - CSR_WIFI_SME_STATUS_SUCCESS: - if the AP deauthorised the station, it gives the reason of - the deauthorization - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeConnectionInfo connectionInfo; - CsrWifiSmeIEEE80211Reason deauthReason; -} CsrWifiSmeAssociationCompleteInd; - -/******************************************************************************* - - NAME - CsrWifiSmeAssociationStartInd - - DESCRIPTION - The SME will send this primitive to all the tasks that have registered to - receive it whenever it begins an attempt to associate with an AP. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - address - BSSID of the associating network - ssid - Service Set identifier of the associating network - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiMacAddress address; - CsrWifiSsid ssid; -} CsrWifiSmeAssociationStartInd; - -/******************************************************************************* - - NAME - CsrWifiSmeBlacklistCfm - - DESCRIPTION - The SME will call this primitive when the action on the blacklist has - completed. For a GET action, this primitive also reports the list of - BBSIDs in the blacklist. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - action - Action in the request - getAddressCount - This parameter is only relevant if action is - CSR_WIFI_SME_LIST_ACTION_GET: - number of BSSIDs sent with this primitive - getAddresses - Pointer to the list of BBSIDs sent with the primitive, set - to NULL if none is sent. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeListAction action; - u8 getAddressCount; - CsrWifiMacAddress *getAddresses; -} CsrWifiSmeBlacklistCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeCalibrationDataGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - calibrationDataLength - Number of bytes in the buffer pointed by - calibrationData - calibrationData - Pointer to a buffer of length calibrationDataLength - containing the calibration data - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - u16 calibrationDataLength; - u8 *calibrationData; -} CsrWifiSmeCalibrationDataGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeCalibrationDataSetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeCalibrationDataSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeCcxConfigGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - ccxConfig - Currently not supported - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeCcxConfig ccxConfig; -} CsrWifiSmeCcxConfigGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeCcxConfigSetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiSmeCcxConfigSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeCoexConfigGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - coexConfig - Reports the parameters used to configure the coexistence - behaviour - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiSmeCoexConfig coexConfig; -} CsrWifiSmeCoexConfigGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeCoexConfigSetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeCoexConfigSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeCoexInfoGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - coexInfo - Reports information and state related to coexistence. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiSmeCoexInfo coexInfo; -} CsrWifiSmeCoexInfoGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeConnectCfm - - DESCRIPTION - The SME calls this primitive when the connection exchange is complete or - all connection attempts fail. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request. - CSR_WIFI_SME_STATUS_NOT_FOUND: all attempts by the SME to - locate the requested AP failed - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiSmeConnectCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionConfigGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - connectionConfig - Parameters used by the SME for selecting a network - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeConnectionConfig connectionConfig; -} CsrWifiSmeConnectionConfigGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionInfoGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - connectionInfo - Information about the current connection - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeConnectionInfo connectionInfo; -} CsrWifiSmeConnectionInfoGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionQualityInd - - DESCRIPTION - The SME sends this primitive to all the tasks that have registered to - receive it whenever the value of the current connection quality - parameters change by more than a certain configurable amount. - The wireless manager application may configure the trigger thresholds for - this indication using the field in smeConfig parameter of - CSR_WIFI_SME_SME_CONFIG_SET_REQ. - Connection quality messages can be suppressed by setting both thresholds - to zero. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - linkQuality - Indicates the quality of the link - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeLinkQuality linkQuality; -} CsrWifiSmeConnectionQualityInd; - -/******************************************************************************* - - NAME - CsrWifiSmeConnectionStatsGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - connectionStats - Statistics for current connection. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeConnectionStats connectionStats; -} CsrWifiSmeConnectionStatsGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeDeactivateCfm - - DESCRIPTION - The SME sends this primitive when the deactivation is complete. - The WMA cannot send any more primitives until it actives the SME again - sending another CSR_WIFI_SME_ACTIVATE_REQ. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeDeactivateCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeDisconnectCfm - - DESCRIPTION - On reception of CSR_WIFI_SME_DISCONNECT_REQ the SME will perform a - disconnect operation, sending a CsrWifiSmeMediaStatusInd with - CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED and then call this primitive when - disconnection is complete. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiSmeDisconnectCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeEventMaskSetCfm - - DESCRIPTION - The SME calls the primitive to report the result of the request - primitive. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeEventMaskSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeHostConfigGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - hostConfig - Current host power state. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeHostConfig hostConfig; -} CsrWifiSmeHostConfigGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeHostConfigSetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiSmeHostConfigSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeIbssStationInd - - DESCRIPTION - The SME will send this primitive to indicate that a station has joined or - left the ad-hoc network. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - address - MAC address of the station that has joined or left - isconnected - TRUE if the station joined, FALSE if the station left - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiMacAddress address; - u8 isconnected; -} CsrWifiSmeIbssStationInd; - -/******************************************************************************* - - NAME - CsrWifiSmeKeyCfm - - DESCRIPTION - The SME calls the primitive to report the result of the request - primitive. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - action - Action in the request - keyType - Type of the key added/deleted - peerMacAddress - Peer MAC Address of the key added/deleted - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeListAction action; - CsrWifiSmeKeyType keyType; - CsrWifiMacAddress peerMacAddress; -} CsrWifiSmeKeyCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeLinkQualityGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - linkQuality - Indicates the quality of the link - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeLinkQuality linkQuality; -} CsrWifiSmeLinkQualityGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeMediaStatusInd - - DESCRIPTION - The SME sends this primitive to all the tasks that have registered to - receive it when a network connection is established, lost or has moved to - another AP. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - mediaStatus - Indicates the media status - connectionInfo - This parameter is relevant only if the mediaStatus is - CSR_WIFI_SME_MEDIA_STATUS_CONNECTED: - it points to the connection information for the new network - disassocReason - This parameter is relevant only if the mediaStatus is - CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED: - if a disassociation has occurred it gives the reason of the - disassociation - deauthReason - This parameter is relevant only if the mediaStatus is - CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED: - if a deauthentication has occurred it gives the reason of - the deauthentication - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeMediaStatus mediaStatus; - CsrWifiSmeConnectionInfo connectionInfo; - CsrWifiSmeIEEE80211Reason disassocReason; - CsrWifiSmeIEEE80211Reason deauthReason; -} CsrWifiSmeMediaStatusInd; - -/******************************************************************************* - - NAME - CsrWifiSmeMibConfigGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - mibConfig - Reports various IEEE 802.11 attributes as currently configured - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiSmeMibConfig mibConfig; -} CsrWifiSmeMibConfigGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeMibConfigSetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeMibConfigSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeMibGetCfm - - DESCRIPTION - The SME calls this primitive to return the requested MIB variable values. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - mibAttributeLength - Length of mibAttribute - mibAttribute - Points to the VarBind or VarBindList containing the - names and values of the MIB variables requested - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - u16 mibAttributeLength; - u8 *mibAttribute; -} CsrWifiSmeMibGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeMibGetNextCfm - - DESCRIPTION - The SME calls this primitive to return the requested MIB name(s). - The wireless manager application can then read the value of the MIB - variable using CSR_WIFI_SME_MIB_GET_REQ, using the names provided. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - mibAttributeLength - Length of mibAttribute - mibAttribute - Points to a VarBind or VarBindList containing the - name(s) of the MIB variable(s) lexicographically - following the name(s) given in the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - u16 mibAttributeLength; - u8 *mibAttribute; -} CsrWifiSmeMibGetNextCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeMibSetCfm - - DESCRIPTION - The SME calls the primitive to report the result of the set primitive. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeMibSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeMicFailureInd - - DESCRIPTION - The SME sends this primitive to all the tasks that have registered to - receive it whenever the chip firmware reports a MIC failure. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - secondFailure - TRUE if this indication is for a second failure in 60 - seconds - count - The number of MIC failure events since the connection was - established - address - MAC address of the transmitter that caused the MIC failure - keyType - Type of key for which the failure occurred - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 secondFailure; - u16 count; - CsrWifiMacAddress address; - CsrWifiSmeKeyType keyType; -} CsrWifiSmeMicFailureInd; - -/******************************************************************************* - - NAME - CsrWifiSmeMulticastAddressCfm - - DESCRIPTION - The SME will call this primitive when the operation is complete. For a - GET action, this primitive reports the current list of MAC addresses. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - action - Action in the request - getAddressesCount - This parameter is only relevant if action is - CSR_WIFI_SME_LIST_ACTION_GET: - number of MAC addresses sent with the primitive - getAddresses - Pointer to the list of MAC Addresses sent with the - primitive, set to NULL if none is sent. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeListAction action; - u8 getAddressesCount; - CsrWifiMacAddress *getAddresses; -} CsrWifiSmeMulticastAddressCfm; - -/******************************************************************************* - - NAME - CsrWifiSmePacketFilterSetCfm - - DESCRIPTION - The SME calls the primitive to report the result of the set primitive. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiSmePacketFilterSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmePermanentMacAddressGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - permanentMacAddress - MAC address stored in the EEPROM - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiMacAddress permanentMacAddress; -} CsrWifiSmePermanentMacAddressGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmePmkidCandidateListInd - - DESCRIPTION - The SME will send this primitive to all the tasks that have registered to - receive it when a new network supporting preauthentication and/or PMK - caching is seen. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an - interface - pmkidCandidatesCount - Number of PMKID candidates provided - pmkidCandidates - Points to the first PMKID candidate - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u8 pmkidCandidatesCount; - CsrWifiSmePmkidCandidate *pmkidCandidates; -} CsrWifiSmePmkidCandidateListInd; - -/******************************************************************************* - - NAME - CsrWifiSmePmkidCfm - - DESCRIPTION - The SME will call this primitive when the operation is complete. For a - GET action, this primitive reports the current list of PMKIDs - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - action - Action in the request - getPmkidsCount - This parameter is only relevant if action is - CSR_WIFI_SME_LIST_ACTION_GET: - number of PMKIDs sent with the primitive - getPmkids - Pointer to the list of PMKIDs sent with the primitive, set - to NULL if none is sent. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeListAction action; - u8 getPmkidsCount; - CsrWifiSmePmkid *getPmkids; -} CsrWifiSmePmkidCfm; - -/******************************************************************************* - - NAME - CsrWifiSmePowerConfigGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - powerConfig - Returns the current parameters for the power configuration of - the firmware - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiSmePowerConfig powerConfig; -} CsrWifiSmePowerConfigGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmePowerConfigSetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmePowerConfigSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeRegulatoryDomainInfoGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - regDomInfo - Reports information and state related to regulatory domain - operation. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiSmeRegulatoryDomainInfo regDomInfo; -} CsrWifiSmeRegulatoryDomainInfoGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeRoamCompleteInd - - DESCRIPTION - The SME will send this primitive to all the tasks that have registered to - receive it whenever it completes an attempt to roam to an AP. If the roam - attempt was successful, status will be set to CSR_WIFI_SME_SUCCESS, - otherwise it shall be set to the appropriate error code. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the roaming procedure - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiSmeRoamCompleteInd; - -/******************************************************************************* - - NAME - CsrWifiSmeRoamStartInd - - DESCRIPTION - The SME will send this primitive to all the tasks that have registered to - receive it whenever it begins an attempt to roam to an AP. - If the wireless manager application connect request specified the SSID - and the BSSID was set to the broadcast address (0xFF 0xFF 0xFF 0xFF 0xFF - 0xFF), the SME monitors the signal quality and maintains a list of - candidates to roam to. When the signal quality of the current connection - falls below a threshold, and there is a candidate with better quality, - the SME will attempt to the candidate AP. - If the roaming procedure succeeds, the SME will also issue a Media - Connect indication to inform the wireless manager application of the - change. - NOTE: to prevent the SME from initiating roaming the WMA must specify the - BSSID in the connection request; this forces the SME to connect only to - that AP. - The wireless manager application can obtain statistics for roaming - purposes using CSR_WIFI_SME_CONNECTION_QUALITY_IND and - CSR_WIFI_SME_CONNECTION_STATS_GET_REQ. - When the wireless manager application wishes to roam to another AP, it - must issue a connection request specifying the BSSID of the desired AP. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - roamReason - Indicates the reason for starting the roaming procedure - reason80211 - Indicates the reason for deauthentication or disassociation - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeRoamReason roamReason; - CsrWifiSmeIEEE80211Reason reason80211; -} CsrWifiSmeRoamStartInd; - -/******************************************************************************* - - NAME - CsrWifiSmeRoamingConfigGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - roamingConfig - Reports the roaming behaviour of the driver and firmware - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeRoamingConfig roamingConfig; -} CsrWifiSmeRoamingConfigGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeRoamingConfigSetCfm - - DESCRIPTION - This primitive sets the value of the RoamingConfig parameter. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiSmeRoamingConfigSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeScanConfigGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - scanConfig - Returns the current parameters for the autonomous scanning - behaviour of the firmware - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiSmeScanConfig scanConfig; -} CsrWifiSmeScanConfigGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeScanConfigSetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeScanConfigSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeScanFullCfm - - DESCRIPTION - The SME calls this primitive when the results from the scan are - available. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeScanFullCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeScanResultInd - - DESCRIPTION - The SME sends this primitive to all the tasks that have registered to - receive it whenever a scan indication is received from the firmware. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - result - Points to a buffer containing a scan result. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeScanResult result; -} CsrWifiSmeScanResultInd; - -/******************************************************************************* - - NAME - CsrWifiSmeScanResultsFlushCfm - - DESCRIPTION - The SME will call this primitive when the cache has been cleared. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeScanResultsFlushCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeScanResultsGetCfm - - DESCRIPTION - The SME sends this primitive to provide the current set of scan results. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - scanResultsCount - Number of scan results - scanResults - Points to a buffer containing an array of - CsrWifiSmeScanResult structures. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - u16 scanResultsCount; - CsrWifiSmeScanResult *scanResults; -} CsrWifiSmeScanResultsGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeSmeStaConfigGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - smeConfig - Current SME Station Parameters - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - CsrWifiSmeStaConfig smeConfig; -} CsrWifiSmeSmeStaConfigGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeSmeStaConfigSetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; -} CsrWifiSmeSmeStaConfigSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeStationMacAddressGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - stationMacAddress - Current MAC address of the station. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiMacAddress stationMacAddress[2]; -} CsrWifiSmeStationMacAddressGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeTspecInd - - DESCRIPTION - The SME will send this primitive to all the task that have registered to - receive it when a status change in the TSPEC occurs. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - transactionId - Unique Transaction ID for the TSPEC, as assigned by the - driver - tspecResultCode - Specifies the TSPEC operation requested by the peer - station - tspecLength - Length of the TSPEC. - tspec - Points to the first byte of the TSPEC - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - u32 transactionId; - CsrWifiSmeTspecResultCode tspecResultCode; - u16 tspecLength; - u8 *tspec; -} CsrWifiSmeTspecInd; - -/******************************************************************************* - - NAME - CsrWifiSmeTspecCfm - - DESCRIPTION - The SME calls the primitive to report the result of the TSpec primitive - request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface Identifier; unique identifier of an interface - status - Reports the result of the request - transactionId - Unique Transaction ID for the TSPEC, as assigned by the - driver - tspecResultCode - Specifies the result of the negotiated TSPEC operation - tspecLength - Length of the TSPEC. - tspec - Points to the first byte of the TSPEC - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrResult status; - u32 transactionId; - CsrWifiSmeTspecResultCode tspecResultCode; - u16 tspecLength; - u8 *tspec; -} CsrWifiSmeTspecCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeVersionsGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - versions - Version IDs of the product - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiSmeVersions versions; -} CsrWifiSmeVersionsGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeWifiFlightmodeCfm - - DESCRIPTION - The SME calls this primitive when the chip is initialised for low power - mode and with the radio subsystem disabled. To leave flight mode, and - enable Wi-Fi, the wireless manager application should call - CSR_WIFI_SME_WIFI_ON_REQ. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeWifiFlightmodeCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeWifiOffInd - - DESCRIPTION - The SME sends this primitive to all the tasks that have registered to - receive it to report that the chip has been turned off. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - reason - Indicates the reason why the Wi-Fi has been switched off. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiSmeControlIndication reason; -} CsrWifiSmeWifiOffInd; - -/******************************************************************************* - - NAME - CsrWifiSmeWifiOffCfm - - DESCRIPTION - After receiving CSR_WIFI_SME_WIFI_OFF_REQ, if the chip is connected to a - network, the SME will perform a disconnect operation, will send a - CSR_WIFI_SME_MEDIA_STATUS_IND with - CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED, and then will call - CSR_WIFI_SME_WIFI_OFF_CFM when the chip is off. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeWifiOffCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeWifiOnCfm - - DESCRIPTION - The SME sends this primitive to the task that has sent the request once - the chip has been initialised and is available for use. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeWifiOnCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeCloakedSsidsSetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeCloakedSsidsSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeCloakedSsidsGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - cloakedSsids - Reports list of cloaked SSIDs that are explicitly scanned for - by the driver - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiSmeCloakedSsidConfig cloakedSsids; -} CsrWifiSmeCloakedSsidsGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeWifiOnInd - - DESCRIPTION - The SME sends this primitive to all tasks that have registered to receive - it once the chip becomes available and ready to use. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - address - Current MAC address - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrWifiMacAddress address; -} CsrWifiSmeWifiOnInd; - -/******************************************************************************* - - NAME - CsrWifiSmeSmeCommonConfigGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - deviceConfig - Configuration options in the SME - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - CsrWifiSmeDeviceConfig deviceConfig; -} CsrWifiSmeSmeCommonConfigGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeSmeCommonConfigSetCfm - - DESCRIPTION - Reports the result of the request - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Reports the result of the request - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeSmeCommonConfigSetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeInterfaceCapabilityGetCfm - - DESCRIPTION - This primitive reports the result of the request. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Result of the request - numInterfaces - Number of the interfaces supported - capBitmap - Points to the list of capabilities bitmaps provided for each - interface. - The bits represent the following capabilities: - -bits 7 to 4-Reserved - -bit 3-AMP - -bit 2-P2P - -bit 1-AP - -bit 0-STA - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; - u16 numInterfaces; - u8 capBitmap[2]; -} CsrWifiSmeInterfaceCapabilityGetCfm; - -/******************************************************************************* - - NAME - CsrWifiSmeErrorInd - - DESCRIPTION - Important error message indicating a error of some importance - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - errorMessage - Contains the error message. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - char *errorMessage; -} CsrWifiSmeErrorInd; - -/******************************************************************************* - - NAME - CsrWifiSmeInfoInd - - DESCRIPTION - Message indicating a some info about current activity. Mostly of interest - in testing but may be useful in the field. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - infoMessage - Contains the message. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - char *infoMessage; -} CsrWifiSmeInfoInd; - -/******************************************************************************* - - NAME - CsrWifiSmeCoreDumpInd - - DESCRIPTION - The SME will send this primitive to all the tasks that have registered to - receive Wi-Fi Chip core dump data. - The core dump data may be fragmented and sent using more than one - indication. - To indicate that all the data has been sent, the last indication contains - a 'length' of 0 and 'data' of NULL. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - dataLength - Number of bytes in the buffer pointed to by 'data' - data - Pointer to the buffer containing 'dataLength' bytes of core - dump data - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u32 dataLength; - u8 *data; -} CsrWifiSmeCoreDumpInd; - -/******************************************************************************* - - NAME - CsrWifiSmeAmpStatusChangeInd - - DESCRIPTION - Indication of change to AMP activity. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - interfaceTag - Interface on which the AMP activity changed. - ampStatus - The new status of AMP activity.Range: {AMP_ACTIVE, - AMP_INACTIVE}. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - u16 interfaceTag; - CsrWifiSmeAmpStatus ampStatus; -} CsrWifiSmeAmpStatusChangeInd; - -/******************************************************************************* - - NAME - CsrWifiSmeWpsConfigurationCfm - - DESCRIPTION - Confirm. - - MEMBERS - common - Common header for use with the CsrWifiFsm Module - status - Status of the request. - -*******************************************************************************/ -typedef struct -{ - CsrWifiFsmEvent common; - CsrResult status; -} CsrWifiSmeWpsConfigurationCfm; - -#endif /* CSR_WIFI_SME_PRIM_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_sme_sef.c b/drivers/staging/csr/csr_wifi_sme_sef.c deleted file mode 100644 index cf32254335c4..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_sef.c +++ /dev/null @@ -1,85 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - Confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - - *****************************************************************************/ -#include "csr_wifi_sme_sef.h" - -const CsrWifiSmeStateHandlerType CsrWifiSmeUpstreamStateHandlers[CSR_WIFI_SME_PRIM_UPSTREAM_COUNT] = -{ - /* 0x8000 */ CsrWifiSmeActivateCfmHandler, - /* 0x8001 */ CsrWifiSmeAdhocConfigGetCfmHandler, - /* 0x8002 */ CsrWifiSmeAdhocConfigSetCfmHandler, - /* 0x8003 */ CsrWifiSmeAssociationCompleteIndHandler, - /* 0x8004 */ CsrWifiSmeAssociationStartIndHandler, - /* 0x8005 */ CsrWifiSmeBlacklistCfmHandler, - /* 0x8006 */ CsrWifiSmeCalibrationDataGetCfmHandler, - /* 0x8007 */ CsrWifiSmeCalibrationDataSetCfmHandler, - /* 0x8008 */ CsrWifiSmeCcxConfigGetCfmHandler, - /* 0x8009 */ CsrWifiSmeCcxConfigSetCfmHandler, - /* 0x800A */ CsrWifiSmeCoexConfigGetCfmHandler, - /* 0x800B */ CsrWifiSmeCoexConfigSetCfmHandler, - /* 0x800C */ CsrWifiSmeCoexInfoGetCfmHandler, - /* 0x800D */ CsrWifiSmeConnectCfmHandler, - /* 0x800E */ CsrWifiSmeConnectionConfigGetCfmHandler, - /* 0x800F */ CsrWifiSmeConnectionInfoGetCfmHandler, - /* 0x8010 */ CsrWifiSmeConnectionQualityIndHandler, - /* 0x8011 */ CsrWifiSmeConnectionStatsGetCfmHandler, - /* 0x8012 */ CsrWifiSmeDeactivateCfmHandler, - /* 0x8013 */ CsrWifiSmeDisconnectCfmHandler, - /* 0x8014 */ CsrWifiSmeEventMaskSetCfmHandler, - /* 0x8015 */ CsrWifiSmeHostConfigGetCfmHandler, - /* 0x8016 */ CsrWifiSmeHostConfigSetCfmHandler, - /* 0x8017 */ CsrWifiSmeIbssStationIndHandler, - /* 0x8018 */ CsrWifiSmeKeyCfmHandler, - /* 0x8019 */ CsrWifiSmeLinkQualityGetCfmHandler, - /* 0x801A */ CsrWifiSmeMediaStatusIndHandler, - /* 0x801B */ CsrWifiSmeMibConfigGetCfmHandler, - /* 0x801C */ CsrWifiSmeMibConfigSetCfmHandler, - /* 0x801D */ CsrWifiSmeMibGetCfmHandler, - /* 0x801E */ CsrWifiSmeMibGetNextCfmHandler, - /* 0x801F */ CsrWifiSmeMibSetCfmHandler, - /* 0x8020 */ CsrWifiSmeMicFailureIndHandler, - /* 0x8021 */ CsrWifiSmeMulticastAddressCfmHandler, - /* 0x8022 */ CsrWifiSmePacketFilterSetCfmHandler, - /* 0x8023 */ CsrWifiSmePermanentMacAddressGetCfmHandler, - /* 0x8024 */ CsrWifiSmePmkidCandidateListIndHandler, - /* 0x8025 */ CsrWifiSmePmkidCfmHandler, - /* 0x8026 */ CsrWifiSmePowerConfigGetCfmHandler, - /* 0x8027 */ CsrWifiSmePowerConfigSetCfmHandler, - /* 0x8028 */ CsrWifiSmeRegulatoryDomainInfoGetCfmHandler, - /* 0x8029 */ CsrWifiSmeRoamCompleteIndHandler, - /* 0x802A */ CsrWifiSmeRoamStartIndHandler, - /* 0x802B */ CsrWifiSmeRoamingConfigGetCfmHandler, - /* 0x802C */ CsrWifiSmeRoamingConfigSetCfmHandler, - /* 0x802D */ CsrWifiSmeScanConfigGetCfmHandler, - /* 0x802E */ CsrWifiSmeScanConfigSetCfmHandler, - /* 0x802F */ CsrWifiSmeScanFullCfmHandler, - /* 0x8030 */ CsrWifiSmeScanResultIndHandler, - /* 0x8031 */ CsrWifiSmeScanResultsFlushCfmHandler, - /* 0x8032 */ CsrWifiSmeScanResultsGetCfmHandler, - /* 0x8033 */ CsrWifiSmeSmeStaConfigGetCfmHandler, - /* 0x8034 */ CsrWifiSmeSmeStaConfigSetCfmHandler, - /* 0x8035 */ CsrWifiSmeStationMacAddressGetCfmHandler, - /* 0x8036 */ CsrWifiSmeTspecIndHandler, - /* 0x8037 */ CsrWifiSmeTspecCfmHandler, - /* 0x8038 */ CsrWifiSmeVersionsGetCfmHandler, - /* 0x8039 */ CsrWifiSmeWifiFlightmodeCfmHandler, - /* 0x803A */ CsrWifiSmeWifiOffIndHandler, - /* 0x803B */ CsrWifiSmeWifiOffCfmHandler, - /* 0x803C */ CsrWifiSmeWifiOnCfmHandler, - /* 0x803D */ CsrWifiSmeCloakedSsidsSetCfmHandler, - /* 0x803E */ CsrWifiSmeCloakedSsidsGetCfmHandler, - /* 0x803F */ CsrWifiSmeWifiOnIndHandler, - /* 0x8040 */ CsrWifiSmeSmeCommonConfigGetCfmHandler, - /* 0x8041 */ CsrWifiSmeSmeCommonConfigSetCfmHandler, - /* 0x8042 */ CsrWifiSmeGetInterfaceCapabilityCfmHandler, - /* 0x8043 */ CsrWifiSmeErrorIndHandler, - /* 0x8044 */ CsrWifiSmeInfoIndHandler, - /* 0x8045 */ CsrWifiSmeCoreDumpIndHandler, - /* 0x8046 */ CsrWifiSmeAmpStatusChangeIndHandler, -}; diff --git a/drivers/staging/csr/csr_wifi_sme_sef.h b/drivers/staging/csr/csr_wifi_sme_sef.h deleted file mode 100644 index 78b88c067236..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_sef.h +++ /dev/null @@ -1,142 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - Confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ -#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_SME_H__ -#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_SME_H__ - -#include "csr_wifi_sme_prim.h" - -typedef void (*CsrWifiSmeStateHandlerType)(void *drvpriv, CsrWifiFsmEvent *msg); - -extern const CsrWifiSmeStateHandlerType - CsrWifiSmeUpstreamStateHandlers[CSR_WIFI_SME_PRIM_UPSTREAM_COUNT]; - - -extern void CsrWifiSmeActivateCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeAdhocConfigGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeAdhocConfigSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeAssociationCompleteIndHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeAssociationStartIndHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeBlacklistCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeCalibrationDataGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeCalibrationDataSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeCcxConfigGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeCcxConfigSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeCoexConfigGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeCoexConfigSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeCoexInfoGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeConnectCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeConnectionConfigGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeConnectionInfoGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeConnectionQualityIndHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeConnectionStatsGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeDeactivateCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeDisconnectCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeEventMaskSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeHostConfigGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeHostConfigSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeIbssStationIndHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeKeyCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeLinkQualityGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeMediaStatusIndHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeMibConfigGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeMibConfigSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeMibGetCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeMibGetNextCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeMibSetCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeMicFailureIndHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeMulticastAddressCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmePacketFilterSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmePermanentMacAddressGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmePmkidCandidateListIndHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmePmkidCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmePowerConfigGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmePowerConfigSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeRegulatoryDomainInfoGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeRoamCompleteIndHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeRoamStartIndHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeRoamingConfigGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeRoamingConfigSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeScanConfigGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeScanConfigSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeScanFullCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeScanResultIndHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeScanResultsFlushCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeScanResultsGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeSmeStaConfigGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeSmeStaConfigSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeStationMacAddressGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeTspecIndHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeTspecCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeVersionsGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeWifiFlightmodeCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeWifiOffIndHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeWifiOffCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeWifiOnCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeCloakedSsidsSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeCloakedSsidsGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeWifiOnIndHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeSmeCommonConfigGetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeSmeCommonConfigSetCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeGetInterfaceCapabilityCfmHandler(void *drvpriv, - CsrWifiFsmEvent *msg); -extern void CsrWifiSmeErrorIndHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeInfoIndHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeCoreDumpIndHandler(void *drvpriv, CsrWifiFsmEvent *msg); -extern void CsrWifiSmeAmpStatusChangeIndHandler(void *drvpriv, - CsrWifiFsmEvent *msg); - -#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_SME_H__ */ diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c deleted file mode 100644 index 7d7e1d8b5ed3..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_serialize.c +++ /dev/null @@ -1,5809 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ -#include <linux/string.h> -#include <linux/slab.h> -#include "csr_msgconv.h" -#include "csr_wifi_sme_prim.h" -#include "csr_wifi_sme_serialize.h" - -void CsrWifiSmePfree(void *ptr) -{ - kfree(ptr); -} - - -size_t CsrWifiSmeAdhocConfigSetReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* u16 primitive->adHocConfig.atimWindowTu */ - bufferSize += 2; /* u16 primitive->adHocConfig.beaconPeriodTu */ - bufferSize += 2; /* u16 primitive->adHocConfig.joinOnlyAttempts */ - bufferSize += 2; /* u16 primitive->adHocConfig.joinAttemptIntervalMs */ - return bufferSize; -} - - -u8* CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeAdhocConfigSetReq *primitive = (CsrWifiSmeAdhocConfigSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.atimWindowTu); - CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.beaconPeriodTu); - CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.joinOnlyAttempts); - CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.joinAttemptIntervalMs); - return(ptr); -} - - -void* CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeAdhocConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeAdhocConfigSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->adHocConfig.atimWindowTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->adHocConfig.beaconPeriodTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->adHocConfig.joinOnlyAttempts, buffer, &offset); - CsrUint16Des((u16 *) &primitive->adHocConfig.joinAttemptIntervalMs, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeBlacklistReqSizeof(void *msg) -{ - CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* u8 primitive->setAddressCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->setAddressCount; i1++) - { - bufferSize += 6; /* u8 primitive->setAddresses[i1].a[6] */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmeBlacklistReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->action); - CsrUint8Ser(ptr, len, (u8) primitive->setAddressCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->setAddressCount; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((u16) (6))); - } - } - return(ptr); -} - - -void* CsrWifiSmeBlacklistReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeBlacklistReq *primitive = kmalloc(sizeof(CsrWifiSmeBlacklistReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->action, buffer, &offset); - CsrUint8Des((u8 *) &primitive->setAddressCount, buffer, &offset); - primitive->setAddresses = NULL; - if (primitive->setAddressCount) - { - primitive->setAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->setAddressCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->setAddressCount; i1++) - { - CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((u16) (6))); - } - } - - return primitive; -} - - -void CsrWifiSmeBlacklistReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *) voidPrimitivePointer; - kfree(primitive->setAddresses); - kfree(primitive); -} - - -size_t CsrWifiSmeCalibrationDataSetReqSizeof(void *msg) -{ - CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ - bufferSize += 2; /* u16 primitive->calibrationDataLength */ - bufferSize += primitive->calibrationDataLength; /* u8 primitive->calibrationData */ - return bufferSize; -} - - -u8* CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->calibrationDataLength); - if (primitive->calibrationDataLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->calibrationData, ((u16) (primitive->calibrationDataLength))); - } - return(ptr); -} - - -void* CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeCalibrationDataSetReq *primitive = kmalloc(sizeof(CsrWifiSmeCalibrationDataSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->calibrationDataLength, buffer, &offset); - if (primitive->calibrationDataLength) - { - primitive->calibrationData = kmalloc(primitive->calibrationDataLength, GFP_KERNEL); - CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((u16) (primitive->calibrationDataLength))); - } - else - { - primitive->calibrationData = NULL; - } - - return primitive; -} - - -void CsrWifiSmeCalibrationDataSetReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *) voidPrimitivePointer; - kfree(primitive->calibrationData); - kfree(primitive); -} - - -size_t CsrWifiSmeCcxConfigSetReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* u8 primitive->ccxConfig.keepAliveTimeMs */ - bufferSize += 1; /* u8 primitive->ccxConfig.apRoamingEnabled */ - bufferSize += 1; /* u8 primitive->ccxConfig.measurementsMask */ - bufferSize += 1; /* u8 primitive->ccxConfig.ccxRadioMgtEnabled */ - return bufferSize; -} - - -u8* CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeCcxConfigSetReq *primitive = (CsrWifiSmeCcxConfigSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.keepAliveTimeMs); - CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.apRoamingEnabled); - CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.measurementsMask); - CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.ccxRadioMgtEnabled); - return(ptr); -} - - -void* CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeCcxConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeCcxConfigSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->ccxConfig.keepAliveTimeMs, buffer, &offset); - CsrUint8Des((u8 *) &primitive->ccxConfig.apRoamingEnabled, buffer, &offset); - CsrUint8Des((u8 *) &primitive->ccxConfig.measurementsMask, buffer, &offset); - CsrUint8Des((u8 *) &primitive->ccxConfig.ccxRadioMgtEnabled, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeCoexConfigSetReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 29) */ - bufferSize += 1; /* u8 primitive->coexConfig.coexEnableSchemeManagement */ - bufferSize += 1; /* u8 primitive->coexConfig.coexPeriodicWakeHost */ - bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficBurstyLatencyMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficContinuousLatencyMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutDurationMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutPeriodMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpBrBlackoutDurationMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpBrBlackoutPeriodMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpEdrBlackoutDurationMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexPagingBlackoutDurationMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexPagingBlackoutPeriodMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexInquiryBlackoutDurationMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexInquiryBlackoutPeriodMs */ - return bufferSize; -} - - -u8* CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeCoexConfigSetReq *primitive = (CsrWifiSmeCoexConfigSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexEnableSchemeManagement); - CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexPeriodicWakeHost); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexTrafficBurstyLatencyMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexTrafficContinuousLatencyMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexObexBlackoutDurationMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexObexBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpBrBlackoutDurationMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpBrBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpEdrBlackoutDurationMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexPagingBlackoutDurationMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexPagingBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexInquiryBlackoutDurationMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexInquiryBlackoutPeriodMs); - return(ptr); -} - - -void* CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeCoexConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeCoexConfigSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((u8 *) &primitive->coexConfig.coexEnableSchemeManagement, buffer, &offset); - CsrUint8Des((u8 *) &primitive->coexConfig.coexPeriodicWakeHost, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexTrafficBurstyLatencyMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexTrafficContinuousLatencyMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexObexBlackoutDurationMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexObexBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpBrBlackoutDurationMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpBrBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpEdrBlackoutDurationMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexPagingBlackoutDurationMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexPagingBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexInquiryBlackoutDurationMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexInquiryBlackoutPeriodMs, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeConnectReqSizeof(void *msg) -{ - CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 57) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 32; /* u8 primitive->connectionConfig.ssid.ssid[32] */ - bufferSize += 1; /* u8 primitive->connectionConfig.ssid.length */ - bufferSize += 6; /* u8 primitive->connectionConfig.bssid.a[6] */ - bufferSize += 1; /* CsrWifiSmeBssType primitive->connectionConfig.bssType */ - bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionConfig.ifIndex */ - bufferSize += 1; /* CsrWifiSme80211PrivacyMode primitive->connectionConfig.privacyMode */ - bufferSize += 2; /* CsrWifiSmeAuthModeMask primitive->connectionConfig.authModeMask */ - bufferSize += 2; /* CsrWifiSmeEncryptionMask primitive->connectionConfig.encryptionModeMask */ - bufferSize += 2; /* u16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */ - bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* u8 primitive->connectionConfig.mlmeAssociateReqInformationElements */ - bufferSize += 1; /* CsrWifiSmeWmmQosInfoMask primitive->connectionConfig.wmmQosInfo */ - bufferSize += 1; /* u8 primitive->connectionConfig.adhocJoinOnly */ - bufferSize += 1; /* u8 primitive->connectionConfig.adhocChannel */ - return bufferSize; -} - - -u8* CsrWifiSmeConnectReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.ssid.ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.bssid.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.bssType); - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ifIndex); - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.privacyMode); - CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.authModeMask); - CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.encryptionModeMask); - CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); - if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.mlmeAssociateReqInformationElements, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); - } - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.wmmQosInfo); - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocJoinOnly); - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocChannel); - return(ptr); -} - - -void* CsrWifiSmeConnectReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeConnectReq *primitive = kmalloc(sizeof(CsrWifiSmeConnectReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->connectionConfig.ssid.ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->connectionConfig.ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->connectionConfig.bssid.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->connectionConfig.bssType, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionConfig.ifIndex, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionConfig.privacyMode, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionConfig.authModeMask, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionConfig.encryptionModeMask, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset); - if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) - { - primitive->connectionConfig.mlmeAssociateReqInformationElements = kmalloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); - } - else - { - primitive->connectionConfig.mlmeAssociateReqInformationElements = NULL; - } - CsrUint8Des((u8 *) &primitive->connectionConfig.wmmQosInfo, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionConfig.adhocJoinOnly, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionConfig.adhocChannel, buffer, &offset); - - return primitive; -} - - -void CsrWifiSmeConnectReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *) voidPrimitivePointer; - kfree(primitive->connectionConfig.mlmeAssociateReqInformationElements); - kfree(primitive); -} - - -size_t CsrWifiSmeHostConfigSetReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiSmeHostPowerMode primitive->hostConfig.powerMode */ - bufferSize += 2; /* u16 primitive->hostConfig.applicationDataPeriodMs */ - return bufferSize; -} - - -u8* CsrWifiSmeHostConfigSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeHostConfigSetReq *primitive = (CsrWifiSmeHostConfigSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->hostConfig.powerMode); - CsrUint16Ser(ptr, len, (u16) primitive->hostConfig.applicationDataPeriodMs); - return(ptr); -} - - -void* CsrWifiSmeHostConfigSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeHostConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeHostConfigSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->hostConfig.powerMode, buffer, &offset); - CsrUint16Des((u16 *) &primitive->hostConfig.applicationDataPeriodMs, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeKeyReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 65) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* CsrWifiSmeKeyType primitive->key.keyType */ - bufferSize += 1; /* u8 primitive->key.keyIndex */ - bufferSize += 1; /* u8 primitive->key.wepTxKey */ - { - u16 i2; - for (i2 = 0; i2 < 8; i2++) - { - bufferSize += 2; /* u16 primitive->key.keyRsc[8] */ - } - } - bufferSize += 1; /* u8 primitive->key.authenticator */ - bufferSize += 6; /* u8 primitive->key.address.a[6] */ - bufferSize += 1; /* u8 primitive->key.keyLength */ - bufferSize += 32; /* u8 primitive->key.key[32] */ - return bufferSize; -} - - -u8* CsrWifiSmeKeyReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeKeyReq *primitive = (CsrWifiSmeKeyReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->action); - CsrUint8Ser(ptr, len, (u8) primitive->key.keyType); - CsrUint8Ser(ptr, len, (u8) primitive->key.keyIndex); - CsrUint8Ser(ptr, len, (u8) primitive->key.wepTxKey); - { - u16 i2; - for (i2 = 0; i2 < 8; i2++) - { - CsrUint16Ser(ptr, len, (u16) primitive->key.keyRsc[i2]); - } - } - CsrUint8Ser(ptr, len, (u8) primitive->key.authenticator); - CsrMemCpySer(ptr, len, (const void *) primitive->key.address.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->key.keyLength); - CsrMemCpySer(ptr, len, (const void *) primitive->key.key, ((u16) (32))); - return(ptr); -} - - -void* CsrWifiSmeKeyReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeKeyReq *primitive = kmalloc(sizeof(CsrWifiSmeKeyReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->action, buffer, &offset); - CsrUint8Des((u8 *) &primitive->key.keyType, buffer, &offset); - CsrUint8Des((u8 *) &primitive->key.keyIndex, buffer, &offset); - CsrUint8Des((u8 *) &primitive->key.wepTxKey, buffer, &offset); - { - u16 i2; - for (i2 = 0; i2 < 8; i2++) - { - CsrUint16Des((u16 *) &primitive->key.keyRsc[i2], buffer, &offset); - } - } - CsrUint8Des((u8 *) &primitive->key.authenticator, buffer, &offset); - CsrMemCpyDes(primitive->key.address.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->key.keyLength, buffer, &offset); - CsrMemCpyDes(primitive->key.key, buffer, &offset, ((u16) (32))); - - return primitive; -} - - -size_t CsrWifiSmeMibConfigSetReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 1; /* u8 primitive->mibConfig.unifiFixMaxTxDataRate */ - bufferSize += 1; /* u8 primitive->mibConfig.unifiFixTxDataRate */ - bufferSize += 2; /* u16 primitive->mibConfig.dot11RtsThreshold */ - bufferSize += 2; /* u16 primitive->mibConfig.dot11FragmentationThreshold */ - bufferSize += 2; /* u16 primitive->mibConfig.dot11CurrentTxPowerLevel */ - return bufferSize; -} - - -u8* CsrWifiSmeMibConfigSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeMibConfigSetReq *primitive = (CsrWifiSmeMibConfigSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixMaxTxDataRate); - CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixTxDataRate); - CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11RtsThreshold); - CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11FragmentationThreshold); - CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11CurrentTxPowerLevel); - return(ptr); -} - - -void* CsrWifiSmeMibConfigSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeMibConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeMibConfigSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixMaxTxDataRate, buffer, &offset); - CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixTxDataRate, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mibConfig.dot11RtsThreshold, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mibConfig.dot11FragmentationThreshold, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mibConfig.dot11CurrentTxPowerLevel, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeMibGetNextReqSizeof(void *msg) -{ - CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ - bufferSize += 2; /* u16 primitive->mibAttributeLength */ - bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ - return bufferSize; -} - - -u8* CsrWifiSmeMibGetNextReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength); - if (primitive->mibAttributeLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength))); - } - return(ptr); -} - - -void* CsrWifiSmeMibGetNextReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeMibGetNextReq *primitive = kmalloc(sizeof(CsrWifiSmeMibGetNextReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); - if (primitive->mibAttributeLength) - { - primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL); - CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); - } - else - { - primitive->mibAttribute = NULL; - } - - return primitive; -} - - -void CsrWifiSmeMibGetNextReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *) voidPrimitivePointer; - kfree(primitive->mibAttribute); - kfree(primitive); -} - - -size_t CsrWifiSmeMibGetReqSizeof(void *msg) -{ - CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ - bufferSize += 2; /* u16 primitive->mibAttributeLength */ - bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ - return bufferSize; -} - - -u8* CsrWifiSmeMibGetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength); - if (primitive->mibAttributeLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength))); - } - return(ptr); -} - - -void* CsrWifiSmeMibGetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeMibGetReq *primitive = kmalloc(sizeof(CsrWifiSmeMibGetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); - if (primitive->mibAttributeLength) - { - primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL); - CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); - } - else - { - primitive->mibAttribute = NULL; - } - - return primitive; -} - - -void CsrWifiSmeMibGetReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *) voidPrimitivePointer; - kfree(primitive->mibAttribute); - kfree(primitive); -} - - -size_t CsrWifiSmeMibSetReqSizeof(void *msg) -{ - CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */ - bufferSize += 2; /* u16 primitive->mibAttributeLength */ - bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ - return bufferSize; -} - - -u8* CsrWifiSmeMibSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength); - if (primitive->mibAttributeLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength))); - } - return(ptr); -} - - -void* CsrWifiSmeMibSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeMibSetReq *primitive = kmalloc(sizeof(CsrWifiSmeMibSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); - if (primitive->mibAttributeLength) - { - primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL); - CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); - } - else - { - primitive->mibAttribute = NULL; - } - - return primitive; -} - - -void CsrWifiSmeMibSetReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *) voidPrimitivePointer; - kfree(primitive->mibAttribute); - kfree(primitive); -} - - -size_t CsrWifiSmeMulticastAddressReqSizeof(void *msg) -{ - CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* u8 primitive->setAddressesCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->setAddressesCount; i1++) - { - bufferSize += 6; /* u8 primitive->setAddresses[i1].a[6] */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmeMulticastAddressReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->action); - CsrUint8Ser(ptr, len, (u8) primitive->setAddressesCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->setAddressesCount; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((u16) (6))); - } - } - return(ptr); -} - - -void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeMulticastAddressReq *primitive = kmalloc(sizeof(CsrWifiSmeMulticastAddressReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->action, buffer, &offset); - CsrUint8Des((u8 *) &primitive->setAddressesCount, buffer, &offset); - primitive->setAddresses = NULL; - if (primitive->setAddressesCount) - { - primitive->setAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->setAddressesCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->setAddressesCount; i1++) - { - CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((u16) (6))); - } - } - - return primitive; -} - - -void CsrWifiSmeMulticastAddressReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *) voidPrimitivePointer; - kfree(primitive->setAddresses); - kfree(primitive); -} - - -size_t CsrWifiSmePacketFilterSetReqSizeof(void *msg) -{ - CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* u16 primitive->filterLength */ - bufferSize += primitive->filterLength; /* u8 primitive->filter */ - bufferSize += 1; /* CsrWifiSmePacketFilterMode primitive->mode */ - bufferSize += 4; /* u8 primitive->arpFilterAddress.a[4] */ - return bufferSize; -} - - -u8* CsrWifiSmePacketFilterSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->filterLength); - if (primitive->filterLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->filter, ((u16) (primitive->filterLength))); - } - CsrUint8Ser(ptr, len, (u8) primitive->mode); - CsrMemCpySer(ptr, len, (const void *) primitive->arpFilterAddress.a, ((u16) (4))); - return(ptr); -} - - -void* CsrWifiSmePacketFilterSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmePacketFilterSetReq *primitive = kmalloc(sizeof(CsrWifiSmePacketFilterSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->filterLength, buffer, &offset); - if (primitive->filterLength) - { - primitive->filter = kmalloc(primitive->filterLength, GFP_KERNEL); - CsrMemCpyDes(primitive->filter, buffer, &offset, ((u16) (primitive->filterLength))); - } - else - { - primitive->filter = NULL; - } - CsrUint8Des((u8 *) &primitive->mode, buffer, &offset); - CsrMemCpyDes(primitive->arpFilterAddress.a, buffer, &offset, ((u16) (4))); - - return primitive; -} - - -void CsrWifiSmePacketFilterSetReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *) voidPrimitivePointer; - kfree(primitive->filter); - kfree(primitive); -} - - -size_t CsrWifiSmePmkidReqSizeof(void *msg) -{ - CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 29) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* u8 primitive->setPmkidsCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->setPmkidsCount; i1++) - { - bufferSize += 6; /* u8 primitive->setPmkids[i1].bssid.a[6] */ - bufferSize += 16; /* u8 primitive->setPmkids[i1].pmkid[16] */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmePmkidReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->action); - CsrUint8Ser(ptr, len, (u8) primitive->setPmkidsCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->setPmkidsCount; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->setPmkids[i1].bssid.a, ((u16) (6))); - CsrMemCpySer(ptr, len, (const void *) primitive->setPmkids[i1].pmkid, ((u16) (16))); - } - } - return(ptr); -} - - -void* CsrWifiSmePmkidReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmePmkidReq *primitive = kmalloc(sizeof(CsrWifiSmePmkidReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->action, buffer, &offset); - CsrUint8Des((u8 *) &primitive->setPmkidsCount, buffer, &offset); - primitive->setPmkids = NULL; - if (primitive->setPmkidsCount) - { - primitive->setPmkids = kmalloc(sizeof(CsrWifiSmePmkid) * primitive->setPmkidsCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->setPmkidsCount; i1++) - { - CsrMemCpyDes(primitive->setPmkids[i1].bssid.a, buffer, &offset, ((u16) (6))); - CsrMemCpyDes(primitive->setPmkids[i1].pmkid, buffer, &offset, ((u16) (16))); - } - } - - return primitive; -} - - -void CsrWifiSmePmkidReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *) voidPrimitivePointer; - kfree(primitive->setPmkids); - kfree(primitive); -} - - -size_t CsrWifiSmePowerConfigSetReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->powerConfig.powerSaveLevel */ - bufferSize += 2; /* u16 primitive->powerConfig.listenIntervalTu */ - bufferSize += 1; /* u8 primitive->powerConfig.rxDtims */ - bufferSize += 1; /* CsrWifiSmeD3AutoScanMode primitive->powerConfig.d3AutoScanMode */ - bufferSize += 1; /* u8 primitive->powerConfig.clientTrafficWindow */ - bufferSize += 1; /* u8 primitive->powerConfig.opportunisticPowerSave */ - bufferSize += 1; /* u8 primitive->powerConfig.noticeOfAbsence */ - return bufferSize; -} - - -u8* CsrWifiSmePowerConfigSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmePowerConfigSetReq *primitive = (CsrWifiSmePowerConfigSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.powerSaveLevel); - CsrUint16Ser(ptr, len, (u16) primitive->powerConfig.listenIntervalTu); - CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.rxDtims); - CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.d3AutoScanMode); - CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.clientTrafficWindow); - CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.opportunisticPowerSave); - CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.noticeOfAbsence); - return(ptr); -} - - -void* CsrWifiSmePowerConfigSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmePowerConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmePowerConfigSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((u8 *) &primitive->powerConfig.powerSaveLevel, buffer, &offset); - CsrUint16Des((u16 *) &primitive->powerConfig.listenIntervalTu, buffer, &offset); - CsrUint8Des((u8 *) &primitive->powerConfig.rxDtims, buffer, &offset); - CsrUint8Des((u8 *) &primitive->powerConfig.d3AutoScanMode, buffer, &offset); - CsrUint8Des((u8 *) &primitive->powerConfig.clientTrafficWindow, buffer, &offset); - CsrUint8Des((u8 *) &primitive->powerConfig.opportunisticPowerSave, buffer, &offset); - CsrUint8Des((u8 *) &primitive->powerConfig.noticeOfAbsence, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeRoamingConfigSetReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 70) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - { - u16 i2; - for (i2 = 0; i2 < 3; i2++) - { - bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].rssiHighThreshold */ - bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].rssiLowThreshold */ - bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrHighThreshold */ - bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrLowThreshold */ - } - } - bufferSize += 1; /* u8 primitive->roamingConfig.disableSmoothRoaming */ - bufferSize += 1; /* u8 primitive->roamingConfig.disableRoamScans */ - bufferSize += 1; /* u8 primitive->roamingConfig.reconnectLimit */ - bufferSize += 2; /* u16 primitive->roamingConfig.reconnectLimitIntervalMs */ - { - u16 i2; - for (i2 = 0; i2 < 3; i2++) - { - bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].intervalSeconds */ - bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].validitySeconds */ - bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu */ - bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu */ - bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu */ - bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeRoamingConfigSetReq *primitive = (CsrWifiSmeRoamingConfigSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - { - u16 i2; - for (i2 = 0; i2 < 3; i2++) - { - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].rssiHighThreshold); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].rssiLowThreshold); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].snrHighThreshold); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].snrLowThreshold); - } - } - CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableSmoothRoaming); - CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableRoamScans); - CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.reconnectLimit); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.reconnectLimitIntervalMs); - { - u16 i2; - for (i2 = 0; i2 < 3; i2++) - { - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].intervalSeconds); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].validitySeconds); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu); - } - } - return(ptr); -} - - -void* CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeRoamingConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - { - u16 i2; - for (i2 = 0; i2 < 3; i2++) - { - CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].rssiHighThreshold, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].rssiLowThreshold, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].snrHighThreshold, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].snrLowThreshold, buffer, &offset); - } - } - CsrUint8Des((u8 *) &primitive->roamingConfig.disableSmoothRoaming, buffer, &offset); - CsrUint8Des((u8 *) &primitive->roamingConfig.disableRoamScans, buffer, &offset); - CsrUint8Des((u8 *) &primitive->roamingConfig.reconnectLimit, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.reconnectLimitIntervalMs, buffer, &offset); - { - u16 i2; - for (i2 = 0; i2 < 3; i2++) - { - CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].intervalSeconds, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].validitySeconds, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); - } - } - - return primitive; -} - - -size_t CsrWifiSmeScanConfigSetReqSizeof(void *msg) -{ - CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 63) */ - { - u16 i2; - for (i2 = 0; i2 < 4; i2++) - { - bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].intervalSeconds */ - bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].validitySeconds */ - bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu */ - bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu */ - bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu */ - bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu */ - } - } - bufferSize += 1; /* u8 primitive->scanConfig.disableAutonomousScans */ - bufferSize += 2; /* u16 primitive->scanConfig.maxResults */ - bufferSize += 1; /* s8 primitive->scanConfig.highRssiThreshold */ - bufferSize += 1; /* s8 primitive->scanConfig.lowRssiThreshold */ - bufferSize += 1; /* s8 primitive->scanConfig.deltaRssiThreshold */ - bufferSize += 1; /* s8 primitive->scanConfig.highSnrThreshold */ - bufferSize += 1; /* s8 primitive->scanConfig.lowSnrThreshold */ - bufferSize += 1; /* s8 primitive->scanConfig.deltaSnrThreshold */ - bufferSize += 2; /* u16 primitive->scanConfig.passiveChannelListCount */ - bufferSize += primitive->scanConfig.passiveChannelListCount; /* u8 primitive->scanConfig.passiveChannelList */ - return bufferSize; -} - - -u8* CsrWifiSmeScanConfigSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - { - u16 i2; - for (i2 = 0; i2 < 4; i2++) - { - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].intervalSeconds); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].validitySeconds); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu); - } - } - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.disableAutonomousScans); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.maxResults); - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highRssiThreshold); - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowRssiThreshold); - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaRssiThreshold); - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highSnrThreshold); - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowSnrThreshold); - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaSnrThreshold); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.passiveChannelListCount); - if (primitive->scanConfig.passiveChannelListCount) - { - CsrMemCpySer(ptr, len, (const void *) primitive->scanConfig.passiveChannelList, ((u16) (primitive->scanConfig.passiveChannelListCount))); - } - return(ptr); -} - - -void* CsrWifiSmeScanConfigSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeScanConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeScanConfigSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - { - u16 i2; - for (i2 = 0; i2 < 4; i2++) - { - CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].intervalSeconds, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].validitySeconds, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); - } - } - CsrUint8Des((u8 *) &primitive->scanConfig.disableAutonomousScans, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.maxResults, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanConfig.highRssiThreshold, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanConfig.lowRssiThreshold, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanConfig.deltaRssiThreshold, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanConfig.highSnrThreshold, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanConfig.lowSnrThreshold, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanConfig.deltaSnrThreshold, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset); - if (primitive->scanConfig.passiveChannelListCount) - { - primitive->scanConfig.passiveChannelList = kmalloc(primitive->scanConfig.passiveChannelListCount, GFP_KERNEL); - CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((u16) (primitive->scanConfig.passiveChannelListCount))); - } - else - { - primitive->scanConfig.passiveChannelList = NULL; - } - - return primitive; -} - - -void CsrWifiSmeScanConfigSetReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *) voidPrimitivePointer; - kfree(primitive->scanConfig.passiveChannelList); - kfree(primitive); -} - - -size_t CsrWifiSmeScanFullReqSizeof(void *msg) -{ - CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 52) */ - bufferSize += 1; /* u8 primitive->ssidCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->ssidCount; i1++) - { - bufferSize += 32; /* u8 primitive->ssid[i1].ssid[32] */ - bufferSize += 1; /* u8 primitive->ssid[i1].length */ - } - } - bufferSize += 6; /* u8 primitive->bssid.a[6] */ - bufferSize += 1; /* u8 primitive->forceScan */ - bufferSize += 1; /* CsrWifiSmeBssType primitive->bssType */ - bufferSize += 1; /* CsrWifiSmeScanType primitive->scanType */ - bufferSize += 2; /* u16 primitive->channelListCount */ - bufferSize += primitive->channelListCount; /* u8 primitive->channelList */ - bufferSize += 2; /* u16 primitive->probeIeLength */ - bufferSize += primitive->probeIeLength; /* u8 primitive->probeIe */ - return bufferSize; -} - - -u8* CsrWifiSmeScanFullReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (u8) primitive->ssidCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->ssidCount; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->ssid[i1].ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->ssid[i1].length); - } - } - CsrMemCpySer(ptr, len, (const void *) primitive->bssid.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->forceScan); - CsrUint8Ser(ptr, len, (u8) primitive->bssType); - CsrUint8Ser(ptr, len, (u8) primitive->scanType); - CsrUint16Ser(ptr, len, (u16) primitive->channelListCount); - if (primitive->channelListCount) - { - CsrMemCpySer(ptr, len, (const void *) primitive->channelList, ((u16) (primitive->channelListCount))); - } - CsrUint16Ser(ptr, len, (u16) primitive->probeIeLength); - if (primitive->probeIeLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->probeIe, ((u16) (primitive->probeIeLength))); - } - return(ptr); -} - - -void* CsrWifiSmeScanFullReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeScanFullReq *primitive = kmalloc(sizeof(CsrWifiSmeScanFullReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((u8 *) &primitive->ssidCount, buffer, &offset); - primitive->ssid = NULL; - if (primitive->ssidCount) - { - primitive->ssid = kmalloc(sizeof(CsrWifiSsid) * primitive->ssidCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->ssidCount; i1++) - { - CsrMemCpyDes(primitive->ssid[i1].ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->ssid[i1].length, buffer, &offset); - } - } - CsrMemCpyDes(primitive->bssid.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->forceScan, buffer, &offset); - CsrUint8Des((u8 *) &primitive->bssType, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanType, buffer, &offset); - CsrUint16Des((u16 *) &primitive->channelListCount, buffer, &offset); - if (primitive->channelListCount) - { - primitive->channelList = kmalloc(primitive->channelListCount, GFP_KERNEL); - CsrMemCpyDes(primitive->channelList, buffer, &offset, ((u16) (primitive->channelListCount))); - } - else - { - primitive->channelList = NULL; - } - CsrUint16Des((u16 *) &primitive->probeIeLength, buffer, &offset); - if (primitive->probeIeLength) - { - primitive->probeIe = kmalloc(primitive->probeIeLength, GFP_KERNEL); - CsrMemCpyDes(primitive->probeIe, buffer, &offset, ((u16) (primitive->probeIeLength))); - } - else - { - primitive->probeIe = NULL; - } - - return primitive; -} - - -void CsrWifiSmeScanFullReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *) voidPrimitivePointer; - kfree(primitive->ssid); - kfree(primitive->channelList); - kfree(primitive->probeIe); - kfree(primitive); -} - - -size_t CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* u8 primitive->smeConfig.connectionQualityRssiChangeTrigger */ - bufferSize += 1; /* u8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ - bufferSize += 1; /* CsrWifiSmeWmmModeMask primitive->smeConfig.wmmModeMask */ - bufferSize += 1; /* CsrWifiSmeRadioIF primitive->smeConfig.ifIndex */ - bufferSize += 1; /* u8 primitive->smeConfig.allowUnicastUseGroupCipher */ - bufferSize += 1; /* u8 primitive->smeConfig.enableOpportunisticKeyCaching */ - return bufferSize; -} - - -u8* CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeSmeStaConfigSetReq *primitive = (CsrWifiSmeSmeStaConfigSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualityRssiChangeTrigger); - CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualitySnrChangeTrigger); - CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.wmmModeMask); - CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.ifIndex); - CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.allowUnicastUseGroupCipher); - CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.enableOpportunisticKeyCaching); - return(ptr); -} - - -void* CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeSmeStaConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualityRssiChangeTrigger, buffer, &offset); - CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualitySnrChangeTrigger, buffer, &offset); - CsrUint8Des((u8 *) &primitive->smeConfig.wmmModeMask, buffer, &offset); - CsrUint8Des((u8 *) &primitive->smeConfig.ifIndex, buffer, &offset); - CsrUint8Des((u8 *) &primitive->smeConfig.allowUnicastUseGroupCipher, buffer, &offset); - CsrUint8Des((u8 *) &primitive->smeConfig.enableOpportunisticKeyCaching, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeTspecReqSizeof(void *msg) -{ - CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 4; /* u32 primitive->transactionId */ - bufferSize += 1; /* u8 primitive->strict */ - bufferSize += 1; /* CsrWifiSmeTspecCtrlMask primitive->ctrlMask */ - bufferSize += 2; /* u16 primitive->tspecLength */ - bufferSize += primitive->tspecLength; /* u8 primitive->tspec */ - bufferSize += 2; /* u16 primitive->tclasLength */ - bufferSize += primitive->tclasLength; /* u8 primitive->tclas */ - return bufferSize; -} - - -u8* CsrWifiSmeTspecReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->action); - CsrUint32Ser(ptr, len, (u32) primitive->transactionId); - CsrUint8Ser(ptr, len, (u8) primitive->strict); - CsrUint8Ser(ptr, len, (u8) primitive->ctrlMask); - CsrUint16Ser(ptr, len, (u16) primitive->tspecLength); - if (primitive->tspecLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((u16) (primitive->tspecLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->tclasLength); - if (primitive->tclasLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((u16) (primitive->tclasLength))); - } - return(ptr); -} - - -void* CsrWifiSmeTspecReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeTspecReq *primitive = kmalloc(sizeof(CsrWifiSmeTspecReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->action, buffer, &offset); - CsrUint32Des((u32 *) &primitive->transactionId, buffer, &offset); - CsrUint8Des((u8 *) &primitive->strict, buffer, &offset); - CsrUint8Des((u8 *) &primitive->ctrlMask, buffer, &offset); - CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset); - if (primitive->tspecLength) - { - primitive->tspec = kmalloc(primitive->tspecLength, GFP_KERNEL); - CsrMemCpyDes(primitive->tspec, buffer, &offset, ((u16) (primitive->tspecLength))); - } - else - { - primitive->tspec = NULL; - } - CsrUint16Des((u16 *) &primitive->tclasLength, buffer, &offset); - if (primitive->tclasLength) - { - primitive->tclas = kmalloc(primitive->tclasLength, GFP_KERNEL); - CsrMemCpyDes(primitive->tclas, buffer, &offset, ((u16) (primitive->tclasLength))); - } - else - { - primitive->tclas = NULL; - } - - return primitive; -} - - -void CsrWifiSmeTspecReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *) voidPrimitivePointer; - kfree(primitive->tspec); - kfree(primitive->tclas); - kfree(primitive); -} - - -size_t CsrWifiSmeWifiFlightmodeReqSizeof(void *msg) -{ - CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ - bufferSize += 6; /* u8 primitive->address.a[6] */ - bufferSize += 2; /* u16 primitive->mibFilesCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->mibFilesCount; i1++) - { - bufferSize += 2; /* u16 primitive->mibFiles[i1].length */ - bufferSize += primitive->mibFiles[i1].length; /* u8 primitive->mibFiles[i1].data */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->mibFilesCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->mibFilesCount; i1++) - { - CsrUint16Ser(ptr, len, (u16) primitive->mibFiles[i1].length); - if (primitive->mibFiles[i1].length) - { - CsrMemCpySer(ptr, len, (const void *) primitive->mibFiles[i1].data, ((u16) (primitive->mibFiles[i1].length))); - } - } - } - return(ptr); -} - - -void* CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeWifiFlightmodeReq *primitive = kmalloc(sizeof(CsrWifiSmeWifiFlightmodeReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->mibFilesCount, buffer, &offset); - primitive->mibFiles = NULL; - if (primitive->mibFilesCount) - { - primitive->mibFiles = kmalloc(sizeof(CsrWifiSmeDataBlock) * primitive->mibFilesCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->mibFilesCount; i1++) - { - CsrUint16Des((u16 *) &primitive->mibFiles[i1].length, buffer, &offset); - if (primitive->mibFiles[i1].length) - { - primitive->mibFiles[i1].data = kmalloc(primitive->mibFiles[i1].length, GFP_KERNEL); - CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((u16) (primitive->mibFiles[i1].length))); - } - else - { - primitive->mibFiles[i1].data = NULL; - } - } - } - - return primitive; -} - - -void CsrWifiSmeWifiFlightmodeReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *) voidPrimitivePointer; - { - u16 i1; - for (i1 = 0; i1 < primitive->mibFilesCount; i1++) - { - kfree(primitive->mibFiles[i1].data); - } - } - kfree(primitive->mibFiles); - kfree(primitive); -} - - -size_t CsrWifiSmeWifiOnReqSizeof(void *msg) -{ - CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */ - bufferSize += 6; /* u8 primitive->address.a[6] */ - bufferSize += 2; /* u16 primitive->mibFilesCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->mibFilesCount; i1++) - { - bufferSize += 2; /* u16 primitive->mibFiles[i1].length */ - bufferSize += primitive->mibFiles[i1].length; /* u8 primitive->mibFiles[i1].data */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmeWifiOnReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->mibFilesCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->mibFilesCount; i1++) - { - CsrUint16Ser(ptr, len, (u16) primitive->mibFiles[i1].length); - if (primitive->mibFiles[i1].length) - { - CsrMemCpySer(ptr, len, (const void *) primitive->mibFiles[i1].data, ((u16) (primitive->mibFiles[i1].length))); - } - } - } - return(ptr); -} - - -void* CsrWifiSmeWifiOnReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeWifiOnReq *primitive = kmalloc(sizeof(CsrWifiSmeWifiOnReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->mibFilesCount, buffer, &offset); - primitive->mibFiles = NULL; - if (primitive->mibFilesCount) - { - primitive->mibFiles = kmalloc(sizeof(CsrWifiSmeDataBlock) * primitive->mibFilesCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->mibFilesCount; i1++) - { - CsrUint16Des((u16 *) &primitive->mibFiles[i1].length, buffer, &offset); - if (primitive->mibFiles[i1].length) - { - primitive->mibFiles[i1].data = kmalloc(primitive->mibFiles[i1].length, GFP_KERNEL); - CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((u16) (primitive->mibFiles[i1].length))); - } - else - { - primitive->mibFiles[i1].data = NULL; - } - } - } - - return primitive; -} - - -void CsrWifiSmeWifiOnReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *) voidPrimitivePointer; - { - u16 i1; - for (i1 = 0; i1 < primitive->mibFilesCount; i1++) - { - kfree(primitive->mibFiles[i1].data); - } - } - kfree(primitive->mibFiles); - kfree(primitive); -} - - -size_t CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg) -{ - CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 37) */ - bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsidsCount */ - { - u16 i2; - for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) - { - bufferSize += 32; /* u8 primitive->cloakedSsids.cloakedSsids[i2].ssid[32] */ - bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsids[i2].length */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsidsCount); - { - u16 i2; - for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->cloakedSsids.cloakedSsids[i2].ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsids[i2].length); - } - } - return(ptr); -} - - -void* CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeCloakedSsidsSetReq *primitive = kmalloc(sizeof(CsrWifiSmeCloakedSsidsSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsidsCount, buffer, &offset); - primitive->cloakedSsids.cloakedSsids = NULL; - if (primitive->cloakedSsids.cloakedSsidsCount) - { - primitive->cloakedSsids.cloakedSsids = kmalloc(sizeof(CsrWifiSsid) * primitive->cloakedSsids.cloakedSsidsCount, GFP_KERNEL); - } - { - u16 i2; - for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) - { - CsrMemCpyDes(primitive->cloakedSsids.cloakedSsids[i2].ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsids[i2].length, buffer, &offset); - } - } - - return primitive; -} - - -void CsrWifiSmeCloakedSsidsSetReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *) voidPrimitivePointer; - kfree(primitive->cloakedSsids.cloakedSsids); - kfree(primitive); -} - - -size_t CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 1; /* CsrWifiSme80211dTrustLevel primitive->deviceConfig.trustLevel */ - bufferSize += 2; /* u8 primitive->deviceConfig.countryCode[2] */ - bufferSize += 1; /* CsrWifiSmeFirmwareDriverInterface primitive->deviceConfig.firmwareDriverInterface */ - bufferSize += 1; /* u8 primitive->deviceConfig.enableStrictDraftN */ - return bufferSize; -} - - -u8* CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeSmeCommonConfigSetReq *primitive = (CsrWifiSmeSmeCommonConfigSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.trustLevel); - CsrMemCpySer(ptr, len, (const void *) primitive->deviceConfig.countryCode, ((u16) (2))); - CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.firmwareDriverInterface); - CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.enableStrictDraftN); - return(ptr); -} - - -void* CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeSmeCommonConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((u8 *) &primitive->deviceConfig.trustLevel, buffer, &offset); - CsrMemCpyDes(primitive->deviceConfig.countryCode, buffer, &offset, ((u16) (2))); - CsrUint8Des((u8 *) &primitive->deviceConfig.firmwareDriverInterface, buffer, &offset); - CsrUint8Des((u8 *) &primitive->deviceConfig.enableStrictDraftN, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeWpsConfigurationReqSizeof(void *msg) -{ - CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 240) */ - bufferSize += 1; /* u8 primitive->wpsConfig.wpsVersion */ - bufferSize += 16; /* u8 primitive->wpsConfig.uuid[16] */ - bufferSize += 32; /* u8 primitive->wpsConfig.deviceName[32] */ - bufferSize += 1; /* u8 primitive->wpsConfig.deviceNameLength */ - bufferSize += 64; /* u8 primitive->wpsConfig.manufacturer[64] */ - bufferSize += 1; /* u8 primitive->wpsConfig.manufacturerLength */ - bufferSize += 32; /* u8 primitive->wpsConfig.modelName[32] */ - bufferSize += 1; /* u8 primitive->wpsConfig.modelNameLength */ - bufferSize += 32; /* u8 primitive->wpsConfig.modelNumber[32] */ - bufferSize += 1; /* u8 primitive->wpsConfig.modelNumberLength */ - bufferSize += 32; /* u8 primitive->wpsConfig.serialNumber[32] */ - bufferSize += 8; /* u8 primitive->wpsConfig.primDeviceType.deviceDetails[8] */ - bufferSize += 1; /* u8 primitive->wpsConfig.secondaryDeviceTypeCount */ - { - u16 i2; - for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++) - { - bufferSize += 8; /* u8 primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails[8] */ - } - } - bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->wpsConfig.configMethods */ - bufferSize += 1; /* u8 primitive->wpsConfig.rfBands */ - bufferSize += 4; /* u8 primitive->wpsConfig.osVersion[4] */ - return bufferSize; -} - - -u8* CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.wpsVersion); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.uuid, ((u16) (16))); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.deviceName, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.deviceNameLength); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.manufacturer, ((u16) (64))); - CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.manufacturerLength); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.modelName, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.modelNameLength); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.modelNumber, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.modelNumberLength); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.serialNumber, ((u16) (32))); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.primDeviceType.deviceDetails, ((u16) (8))); - CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.secondaryDeviceTypeCount); - { - u16 i2; - for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails, ((u16) (8))); - } - } - CsrUint16Ser(ptr, len, (u16) primitive->wpsConfig.configMethods); - CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.rfBands); - CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.osVersion, ((u16) (4))); - return(ptr); -} - - -void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeWpsConfigurationReq *primitive = kmalloc(sizeof(CsrWifiSmeWpsConfigurationReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint8Des((u8 *) &primitive->wpsConfig.wpsVersion, buffer, &offset); - CsrMemCpyDes(primitive->wpsConfig.uuid, buffer, &offset, ((u16) (16))); - CsrMemCpyDes(primitive->wpsConfig.deviceName, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->wpsConfig.deviceNameLength, buffer, &offset); - CsrMemCpyDes(primitive->wpsConfig.manufacturer, buffer, &offset, ((u16) (64))); - CsrUint8Des((u8 *) &primitive->wpsConfig.manufacturerLength, buffer, &offset); - CsrMemCpyDes(primitive->wpsConfig.modelName, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->wpsConfig.modelNameLength, buffer, &offset); - CsrMemCpyDes(primitive->wpsConfig.modelNumber, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->wpsConfig.modelNumberLength, buffer, &offset); - CsrMemCpyDes(primitive->wpsConfig.serialNumber, buffer, &offset, ((u16) (32))); - CsrMemCpyDes(primitive->wpsConfig.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8))); - CsrUint8Des((u8 *) &primitive->wpsConfig.secondaryDeviceTypeCount, buffer, &offset); - primitive->wpsConfig.secondaryDeviceType = NULL; - if (primitive->wpsConfig.secondaryDeviceTypeCount) - { - primitive->wpsConfig.secondaryDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->wpsConfig.secondaryDeviceTypeCount, GFP_KERNEL); - } - { - u16 i2; - for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++) - { - CsrMemCpyDes(primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails, buffer, &offset, ((u16) (8))); - } - } - CsrUint16Des((u16 *) &primitive->wpsConfig.configMethods, buffer, &offset); - CsrUint8Des((u8 *) &primitive->wpsConfig.rfBands, buffer, &offset); - CsrMemCpyDes(primitive->wpsConfig.osVersion, buffer, &offset, ((u16) (4))); - - return primitive; -} - - -void CsrWifiSmeWpsConfigurationReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *) voidPrimitivePointer; - kfree(primitive->wpsConfig.secondaryDeviceType); - kfree(primitive); -} - - -size_t CsrWifiSmeSetReqSizeof(void *msg) -{ - CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 4; /* u32 primitive->dataLength */ - bufferSize += primitive->dataLength; /* u8 primitive->data */ - return bufferSize; -} - - -u8* CsrWifiSmeSetReqSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint32Ser(ptr, len, (u32) primitive->dataLength); - if (primitive->dataLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); - } - return(ptr); -} - - -void* CsrWifiSmeSetReqDes(u8 *buffer, size_t length) -{ - CsrWifiSmeSetReq *primitive = kmalloc(sizeof(CsrWifiSmeSetReq), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint32Des((u32 *) &primitive->dataLength, buffer, &offset); - if (primitive->dataLength) - { - primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); - CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); - } - else - { - primitive->data = NULL; - } - - return primitive; -} - - -void CsrWifiSmeSetReqSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *) voidPrimitivePointer; - kfree(primitive->data); - kfree(primitive); -} - - -size_t CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* u16 primitive->adHocConfig.atimWindowTu */ - bufferSize += 2; /* u16 primitive->adHocConfig.beaconPeriodTu */ - bufferSize += 2; /* u16 primitive->adHocConfig.joinOnlyAttempts */ - bufferSize += 2; /* u16 primitive->adHocConfig.joinAttemptIntervalMs */ - return bufferSize; -} - - -u8* CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeAdhocConfigGetCfm *primitive = (CsrWifiSmeAdhocConfigGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.atimWindowTu); - CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.beaconPeriodTu); - CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.joinOnlyAttempts); - CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.joinAttemptIntervalMs); - return(ptr); -} - - -void* CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeAdhocConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeAdhocConfigGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint16Des((u16 *) &primitive->adHocConfig.atimWindowTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->adHocConfig.beaconPeriodTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->adHocConfig.joinOnlyAttempts, buffer, &offset); - CsrUint16Des((u16 *) &primitive->adHocConfig.joinAttemptIntervalMs, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeAssociationCompleteIndSizeof(void *msg) -{ - CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 98) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 32; /* u8 primitive->connectionInfo.ssid.ssid[32] */ - bufferSize += 1; /* u8 primitive->connectionInfo.ssid.length */ - bufferSize += 6; /* u8 primitive->connectionInfo.bssid.a[6] */ - bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */ - bufferSize += 1; /* u8 primitive->connectionInfo.channelNumber */ - bufferSize += 2; /* u16 primitive->connectionInfo.channelFrequency */ - bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */ - bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */ - bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.groupCipher */ - bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */ - bufferSize += 2; /* u16 primitive->connectionInfo.atimWindowTu */ - bufferSize += 2; /* u16 primitive->connectionInfo.beaconPeriodTu */ - bufferSize += 1; /* u8 primitive->connectionInfo.reassociation */ - bufferSize += 2; /* u16 primitive->connectionInfo.beaconFrameLength */ - bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */ - bufferSize += 2; /* u16 primitive->connectionInfo.associationReqFrameLength */ - bufferSize += primitive->connectionInfo.associationReqFrameLength; /* u8 primitive->connectionInfo.associationReqFrame */ - bufferSize += 2; /* u16 primitive->connectionInfo.associationRspFrameLength */ - bufferSize += primitive->connectionInfo.associationRspFrameLength; /* u8 primitive->connectionInfo.associationRspFrame */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocScanInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* u8 primitive->connectionInfo.assocScanInfoElements */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocReqCapabilities */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocReqListenIntervalTu */ - bufferSize += 6; /* u8 primitive->connectionInfo.assocReqApAddress.a[6] */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocReqInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* u8 primitive->connectionInfo.assocReqInfoElements */ - bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocRspCapabilityInfo */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocRspAssociationId */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocRspInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* u8 primitive->connectionInfo.assocRspInfoElements */ - bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->deauthReason */ - return bufferSize; -} - - -u8* CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.networkType80211); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.channelNumber); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.channelFrequency); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.authMode); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.pairwiseCipher); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.groupCipher); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ifIndex); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.atimWindowTu); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconPeriodTu); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.reassociation); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconFrameLength); - if (primitive->connectionInfo.beaconFrameLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((u16) (primitive->connectionInfo.beaconFrameLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationReqFrameLength); - if (primitive->connectionInfo.associationReqFrameLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((u16) (primitive->connectionInfo.associationReqFrameLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationRspFrameLength); - if (primitive->connectionInfo.associationRspFrameLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((u16) (primitive->connectionInfo.associationRspFrameLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocScanInfoElementsLength); - if (primitive->connectionInfo.assocScanInfoElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqCapabilities); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqListenIntervalTu); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqInfoElementsLength); - if (primitive->connectionInfo.assocReqInfoElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspResult); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspCapabilityInfo); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspAssociationId); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspInfoElementsLength); - if (primitive->connectionInfo.assocRspInfoElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->deauthReason); - return(ptr); -} - - -void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeAssociationCompleteInd *primitive = kmalloc(sizeof(CsrWifiSmeAssociationCompleteInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.authMode, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionInfo.reassociation, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); - if (primitive->connectionInfo.beaconFrameLength) - { - primitive->connectionInfo.beaconFrame = kmalloc(primitive->connectionInfo.beaconFrameLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((u16) (primitive->connectionInfo.beaconFrameLength))); - } - else - { - primitive->connectionInfo.beaconFrame = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); - if (primitive->connectionInfo.associationReqFrameLength) - { - primitive->connectionInfo.associationReqFrame = kmalloc(primitive->connectionInfo.associationReqFrameLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationReqFrameLength))); - } - else - { - primitive->connectionInfo.associationReqFrame = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); - if (primitive->connectionInfo.associationRspFrameLength) - { - primitive->connectionInfo.associationRspFrame = kmalloc(primitive->connectionInfo.associationRspFrameLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationRspFrameLength))); - } - else - { - primitive->connectionInfo.associationRspFrame = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); - if (primitive->connectionInfo.assocScanInfoElementsLength) - { - primitive->connectionInfo.assocScanInfoElements = kmalloc(primitive->connectionInfo.assocScanInfoElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); - } - else - { - primitive->connectionInfo.assocScanInfoElements = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); - if (primitive->connectionInfo.assocReqInfoElementsLength) - { - primitive->connectionInfo.assocReqInfoElements = kmalloc(primitive->connectionInfo.assocReqInfoElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); - } - else - { - primitive->connectionInfo.assocReqInfoElements = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); - if (primitive->connectionInfo.assocRspInfoElementsLength) - { - primitive->connectionInfo.assocRspInfoElements = kmalloc(primitive->connectionInfo.assocRspInfoElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); - } - else - { - primitive->connectionInfo.assocRspInfoElements = NULL; - } - CsrUint16Des((u16 *) &primitive->deauthReason, buffer, &offset); - - return primitive; -} - - -void CsrWifiSmeAssociationCompleteIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *) voidPrimitivePointer; - kfree(primitive->connectionInfo.beaconFrame); - kfree(primitive->connectionInfo.associationReqFrame); - kfree(primitive->connectionInfo.associationRspFrame); - kfree(primitive->connectionInfo.assocScanInfoElements); - kfree(primitive->connectionInfo.assocReqInfoElements); - kfree(primitive->connectionInfo.assocRspInfoElements); - kfree(primitive); -} - - -size_t CsrWifiSmeAssociationStartIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 44) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 6; /* u8 primitive->address.a[6] */ - bufferSize += 32; /* u8 primitive->ssid.ssid[32] */ - bufferSize += 1; /* u8 primitive->ssid.length */ - return bufferSize; -} - - -u8* CsrWifiSmeAssociationStartIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeAssociationStartInd *primitive = (CsrWifiSmeAssociationStartInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6))); - CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->ssid.length); - return(ptr); -} - - -void* CsrWifiSmeAssociationStartIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeAssociationStartInd *primitive = kmalloc(sizeof(CsrWifiSmeAssociationStartInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6))); - CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeBlacklistCfmSizeof(void *msg) -{ - CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* u8 primitive->getAddressCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->getAddressCount; i1++) - { - bufferSize += 6; /* u8 primitive->getAddresses[i1].a[6] */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmeBlacklistCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->action); - CsrUint8Ser(ptr, len, (u8) primitive->getAddressCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->getAddressCount; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((u16) (6))); - } - } - return(ptr); -} - - -void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeBlacklistCfm *primitive = kmalloc(sizeof(CsrWifiSmeBlacklistCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->action, buffer, &offset); - CsrUint8Des((u8 *) &primitive->getAddressCount, buffer, &offset); - primitive->getAddresses = NULL; - if (primitive->getAddressCount) - { - primitive->getAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->getAddressCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->getAddressCount; i1++) - { - CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((u16) (6))); - } - } - - return primitive; -} - - -void CsrWifiSmeBlacklistCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *) voidPrimitivePointer; - kfree(primitive->getAddresses); - kfree(primitive); -} - - -size_t CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg) -{ - CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* u16 primitive->calibrationDataLength */ - bufferSize += primitive->calibrationDataLength; /* u8 primitive->calibrationData */ - return bufferSize; -} - - -u8* CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint16Ser(ptr, len, (u16) primitive->calibrationDataLength); - if (primitive->calibrationDataLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->calibrationData, ((u16) (primitive->calibrationDataLength))); - } - return(ptr); -} - - -void* CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeCalibrationDataGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCalibrationDataGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint16Des((u16 *) &primitive->calibrationDataLength, buffer, &offset); - if (primitive->calibrationDataLength) - { - primitive->calibrationData = kmalloc(primitive->calibrationDataLength, GFP_KERNEL); - CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((u16) (primitive->calibrationDataLength))); - } - else - { - primitive->calibrationData = NULL; - } - - return primitive; -} - - -void CsrWifiSmeCalibrationDataGetCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *) voidPrimitivePointer; - kfree(primitive->calibrationData); - kfree(primitive); -} - - -size_t CsrWifiSmeCcxConfigGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* u8 primitive->ccxConfig.keepAliveTimeMs */ - bufferSize += 1; /* u8 primitive->ccxConfig.apRoamingEnabled */ - bufferSize += 1; /* u8 primitive->ccxConfig.measurementsMask */ - bufferSize += 1; /* u8 primitive->ccxConfig.ccxRadioMgtEnabled */ - return bufferSize; -} - - -u8* CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeCcxConfigGetCfm *primitive = (CsrWifiSmeCcxConfigGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.keepAliveTimeMs); - CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.apRoamingEnabled); - CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.measurementsMask); - CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.ccxRadioMgtEnabled); - return(ptr); -} - - -void* CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeCcxConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCcxConfigGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->ccxConfig.keepAliveTimeMs, buffer, &offset); - CsrUint8Des((u8 *) &primitive->ccxConfig.apRoamingEnabled, buffer, &offset); - CsrUint8Des((u8 *) &primitive->ccxConfig.measurementsMask, buffer, &offset); - CsrUint8Des((u8 *) &primitive->ccxConfig.ccxRadioMgtEnabled, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeCcxConfigSetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeCcxConfigSetCfm *primitive = (CsrWifiSmeCcxConfigSetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeCcxConfigSetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCcxConfigSetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeCoexConfigGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 31) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* u8 primitive->coexConfig.coexEnableSchemeManagement */ - bufferSize += 1; /* u8 primitive->coexConfig.coexPeriodicWakeHost */ - bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficBurstyLatencyMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficContinuousLatencyMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutDurationMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutPeriodMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpBrBlackoutDurationMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpBrBlackoutPeriodMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpEdrBlackoutDurationMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexPagingBlackoutDurationMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexPagingBlackoutPeriodMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexInquiryBlackoutDurationMs */ - bufferSize += 2; /* u16 primitive->coexConfig.coexInquiryBlackoutPeriodMs */ - return bufferSize; -} - - -u8* CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeCoexConfigGetCfm *primitive = (CsrWifiSmeCoexConfigGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexEnableSchemeManagement); - CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexPeriodicWakeHost); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexTrafficBurstyLatencyMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexTrafficContinuousLatencyMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexObexBlackoutDurationMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexObexBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpBrBlackoutDurationMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpBrBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpEdrBlackoutDurationMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexPagingBlackoutDurationMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexPagingBlackoutPeriodMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexInquiryBlackoutDurationMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexInquiryBlackoutPeriodMs); - return(ptr); -} - - -void* CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeCoexConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCoexConfigGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->coexConfig.coexEnableSchemeManagement, buffer, &offset); - CsrUint8Des((u8 *) &primitive->coexConfig.coexPeriodicWakeHost, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexTrafficBurstyLatencyMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexTrafficContinuousLatencyMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexObexBlackoutDurationMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexObexBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpBrBlackoutDurationMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpBrBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpEdrBlackoutDurationMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexPagingBlackoutDurationMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexPagingBlackoutPeriodMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexInquiryBlackoutDurationMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexConfig.coexInquiryBlackoutPeriodMs, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeCoexInfoGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 24) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* u8 primitive->coexInfo.hasTrafficData */ - bufferSize += 1; /* CsrWifiSmeTrafficType primitive->coexInfo.currentTrafficType */ - bufferSize += 2; /* u16 primitive->coexInfo.currentPeriodMs */ - bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->coexInfo.currentPowerSave */ - bufferSize += 2; /* u16 primitive->coexInfo.currentCoexPeriodMs */ - bufferSize += 2; /* u16 primitive->coexInfo.currentCoexLatencyMs */ - bufferSize += 1; /* u8 primitive->coexInfo.hasBtDevice */ - bufferSize += 4; /* u32 primitive->coexInfo.currentBlackoutDurationUs */ - bufferSize += 4; /* u32 primitive->coexInfo.currentBlackoutPeriodUs */ - bufferSize += 1; /* CsrWifiSmeCoexScheme primitive->coexInfo.currentCoexScheme */ - return bufferSize; -} - - -u8* CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeCoexInfoGetCfm *primitive = (CsrWifiSmeCoexInfoGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.hasTrafficData); - CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.currentTrafficType); - CsrUint16Ser(ptr, len, (u16) primitive->coexInfo.currentPeriodMs); - CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.currentPowerSave); - CsrUint16Ser(ptr, len, (u16) primitive->coexInfo.currentCoexPeriodMs); - CsrUint16Ser(ptr, len, (u16) primitive->coexInfo.currentCoexLatencyMs); - CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.hasBtDevice); - CsrUint32Ser(ptr, len, (u32) primitive->coexInfo.currentBlackoutDurationUs); - CsrUint32Ser(ptr, len, (u32) primitive->coexInfo.currentBlackoutPeriodUs); - CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.currentCoexScheme); - return(ptr); -} - - -void* CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeCoexInfoGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCoexInfoGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->coexInfo.hasTrafficData, buffer, &offset); - CsrUint8Des((u8 *) &primitive->coexInfo.currentTrafficType, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexInfo.currentPeriodMs, buffer, &offset); - CsrUint8Des((u8 *) &primitive->coexInfo.currentPowerSave, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexInfo.currentCoexPeriodMs, buffer, &offset); - CsrUint16Des((u16 *) &primitive->coexInfo.currentCoexLatencyMs, buffer, &offset); - CsrUint8Des((u8 *) &primitive->coexInfo.hasBtDevice, buffer, &offset); - CsrUint32Des((u32 *) &primitive->coexInfo.currentBlackoutDurationUs, buffer, &offset); - CsrUint32Des((u32 *) &primitive->coexInfo.currentBlackoutPeriodUs, buffer, &offset); - CsrUint8Des((u8 *) &primitive->coexInfo.currentCoexScheme, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeConnectCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiSmeConnectCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeConnectCfm *primitive = (CsrWifiSmeConnectCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiSmeConnectCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeConnectCfm *primitive = kmalloc(sizeof(CsrWifiSmeConnectCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg) -{ - CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 59) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 32; /* u8 primitive->connectionConfig.ssid.ssid[32] */ - bufferSize += 1; /* u8 primitive->connectionConfig.ssid.length */ - bufferSize += 6; /* u8 primitive->connectionConfig.bssid.a[6] */ - bufferSize += 1; /* CsrWifiSmeBssType primitive->connectionConfig.bssType */ - bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionConfig.ifIndex */ - bufferSize += 1; /* CsrWifiSme80211PrivacyMode primitive->connectionConfig.privacyMode */ - bufferSize += 2; /* CsrWifiSmeAuthModeMask primitive->connectionConfig.authModeMask */ - bufferSize += 2; /* CsrWifiSmeEncryptionMask primitive->connectionConfig.encryptionModeMask */ - bufferSize += 2; /* u16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */ - bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* u8 primitive->connectionConfig.mlmeAssociateReqInformationElements */ - bufferSize += 1; /* CsrWifiSmeWmmQosInfoMask primitive->connectionConfig.wmmQosInfo */ - bufferSize += 1; /* u8 primitive->connectionConfig.adhocJoinOnly */ - bufferSize += 1; /* u8 primitive->connectionConfig.adhocChannel */ - return bufferSize; -} - - -u8* CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.ssid.ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.bssid.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.bssType); - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ifIndex); - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.privacyMode); - CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.authModeMask); - CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.encryptionModeMask); - CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.mlmeAssociateReqInformationElementsLength); - if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.mlmeAssociateReqInformationElements, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); - } - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.wmmQosInfo); - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocJoinOnly); - CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocChannel); - return(ptr); -} - - -void* CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeConnectionConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeConnectionConfigGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrMemCpyDes(primitive->connectionConfig.ssid.ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->connectionConfig.ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->connectionConfig.bssid.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->connectionConfig.bssType, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionConfig.ifIndex, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionConfig.privacyMode, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionConfig.authModeMask, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionConfig.encryptionModeMask, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset); - if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength) - { - primitive->connectionConfig.mlmeAssociateReqInformationElements = kmalloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength))); - } - else - { - primitive->connectionConfig.mlmeAssociateReqInformationElements = NULL; - } - CsrUint8Des((u8 *) &primitive->connectionConfig.wmmQosInfo, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionConfig.adhocJoinOnly, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionConfig.adhocChannel, buffer, &offset); - - return primitive; -} - - -void CsrWifiSmeConnectionConfigGetCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *) voidPrimitivePointer; - kfree(primitive->connectionConfig.mlmeAssociateReqInformationElements); - kfree(primitive); -} - - -size_t CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg) -{ - CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 96) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 32; /* u8 primitive->connectionInfo.ssid.ssid[32] */ - bufferSize += 1; /* u8 primitive->connectionInfo.ssid.length */ - bufferSize += 6; /* u8 primitive->connectionInfo.bssid.a[6] */ - bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */ - bufferSize += 1; /* u8 primitive->connectionInfo.channelNumber */ - bufferSize += 2; /* u16 primitive->connectionInfo.channelFrequency */ - bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */ - bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */ - bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.groupCipher */ - bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */ - bufferSize += 2; /* u16 primitive->connectionInfo.atimWindowTu */ - bufferSize += 2; /* u16 primitive->connectionInfo.beaconPeriodTu */ - bufferSize += 1; /* u8 primitive->connectionInfo.reassociation */ - bufferSize += 2; /* u16 primitive->connectionInfo.beaconFrameLength */ - bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */ - bufferSize += 2; /* u16 primitive->connectionInfo.associationReqFrameLength */ - bufferSize += primitive->connectionInfo.associationReqFrameLength; /* u8 primitive->connectionInfo.associationReqFrame */ - bufferSize += 2; /* u16 primitive->connectionInfo.associationRspFrameLength */ - bufferSize += primitive->connectionInfo.associationRspFrameLength; /* u8 primitive->connectionInfo.associationRspFrame */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocScanInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* u8 primitive->connectionInfo.assocScanInfoElements */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocReqCapabilities */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocReqListenIntervalTu */ - bufferSize += 6; /* u8 primitive->connectionInfo.assocReqApAddress.a[6] */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocReqInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* u8 primitive->connectionInfo.assocReqInfoElements */ - bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocRspCapabilityInfo */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocRspAssociationId */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocRspInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* u8 primitive->connectionInfo.assocRspInfoElements */ - return bufferSize; -} - - -u8* CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.networkType80211); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.channelNumber); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.channelFrequency); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.authMode); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.pairwiseCipher); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.groupCipher); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ifIndex); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.atimWindowTu); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconPeriodTu); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.reassociation); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconFrameLength); - if (primitive->connectionInfo.beaconFrameLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((u16) (primitive->connectionInfo.beaconFrameLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationReqFrameLength); - if (primitive->connectionInfo.associationReqFrameLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((u16) (primitive->connectionInfo.associationReqFrameLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationRspFrameLength); - if (primitive->connectionInfo.associationRspFrameLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((u16) (primitive->connectionInfo.associationRspFrameLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocScanInfoElementsLength); - if (primitive->connectionInfo.assocScanInfoElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqCapabilities); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqListenIntervalTu); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqInfoElementsLength); - if (primitive->connectionInfo.assocReqInfoElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspResult); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspCapabilityInfo); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspAssociationId); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspInfoElementsLength); - if (primitive->connectionInfo.assocRspInfoElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); - } - return(ptr); -} - - -void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeConnectionInfoGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeConnectionInfoGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.authMode, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionInfo.reassociation, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); - if (primitive->connectionInfo.beaconFrameLength) - { - primitive->connectionInfo.beaconFrame = kmalloc(primitive->connectionInfo.beaconFrameLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((u16) (primitive->connectionInfo.beaconFrameLength))); - } - else - { - primitive->connectionInfo.beaconFrame = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); - if (primitive->connectionInfo.associationReqFrameLength) - { - primitive->connectionInfo.associationReqFrame = kmalloc(primitive->connectionInfo.associationReqFrameLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationReqFrameLength))); - } - else - { - primitive->connectionInfo.associationReqFrame = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); - if (primitive->connectionInfo.associationRspFrameLength) - { - primitive->connectionInfo.associationRspFrame = kmalloc(primitive->connectionInfo.associationRspFrameLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationRspFrameLength))); - } - else - { - primitive->connectionInfo.associationRspFrame = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); - if (primitive->connectionInfo.assocScanInfoElementsLength) - { - primitive->connectionInfo.assocScanInfoElements = kmalloc(primitive->connectionInfo.assocScanInfoElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); - } - else - { - primitive->connectionInfo.assocScanInfoElements = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); - if (primitive->connectionInfo.assocReqInfoElementsLength) - { - primitive->connectionInfo.assocReqInfoElements = kmalloc(primitive->connectionInfo.assocReqInfoElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); - } - else - { - primitive->connectionInfo.assocReqInfoElements = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); - if (primitive->connectionInfo.assocRspInfoElementsLength) - { - primitive->connectionInfo.assocRspInfoElements = kmalloc(primitive->connectionInfo.assocRspInfoElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); - } - else - { - primitive->connectionInfo.assocRspInfoElements = NULL; - } - - return primitive; -} - - -void CsrWifiSmeConnectionInfoGetCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *) voidPrimitivePointer; - kfree(primitive->connectionInfo.beaconFrame); - kfree(primitive->connectionInfo.associationReqFrame); - kfree(primitive->connectionInfo.associationRspFrame); - kfree(primitive->connectionInfo.assocScanInfoElements); - kfree(primitive->connectionInfo.assocReqInfoElements); - kfree(primitive->connectionInfo.assocRspInfoElements); - kfree(primitive); -} - - -size_t CsrWifiSmeConnectionQualityIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* s16 primitive->linkQuality.unifiRssi */ - bufferSize += 2; /* s16 primitive->linkQuality.unifiSnr */ - return bufferSize; -} - - -u8* CsrWifiSmeConnectionQualityIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeConnectionQualityInd *primitive = (CsrWifiSmeConnectionQualityInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->linkQuality.unifiRssi); - CsrUint16Ser(ptr, len, (u16) primitive->linkQuality.unifiSnr); - return(ptr); -} - - -void* CsrWifiSmeConnectionQualityIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeConnectionQualityInd *primitive = kmalloc(sizeof(CsrWifiSmeConnectionQualityInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->linkQuality.unifiRssi, buffer, &offset); - CsrUint16Des((u16 *) &primitive->linkQuality.unifiSnr, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 101) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* u8 primitive->connectionStats.unifiTxDataRate */ - bufferSize += 1; /* u8 primitive->connectionStats.unifiRxDataRate */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11RetryCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11MultipleRetryCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11AckFailureCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11FrameDuplicateCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11FcsErrorCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11RtsSuccessCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11RtsFailureCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11FailedCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11TransmittedFragmentCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11TransmittedFrameCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11WepExcludedCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11WepIcvErrorCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11WepUndecryptableCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11MulticastReceivedFrameCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11MulticastTransmittedFrameCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11ReceivedFragmentCount */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11Rsna4WayHandshakeFailures */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsTkipReplays */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsTkipIcvErrors */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsCcmpReplays */ - bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors */ - return bufferSize; -} - - -u8* CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeConnectionStatsGetCfm *primitive = (CsrWifiSmeConnectionStatsGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->connectionStats.unifiTxDataRate); - CsrUint8Ser(ptr, len, (u8) primitive->connectionStats.unifiRxDataRate); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RetryCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11MultipleRetryCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11AckFailureCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11FrameDuplicateCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11FcsErrorCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RtsSuccessCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RtsFailureCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11FailedCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11TransmittedFragmentCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11TransmittedFrameCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11WepExcludedCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11WepIcvErrorCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11WepUndecryptableCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11MulticastReceivedFrameCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11MulticastTransmittedFrameCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11ReceivedFragmentCount); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11Rsna4WayHandshakeFailures); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsTkipReplays); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsTkipIcvErrors); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsCcmpReplays); - CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors); - return(ptr); -} - - -void* CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeConnectionStatsGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeConnectionStatsGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionStats.unifiTxDataRate, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionStats.unifiRxDataRate, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11RetryCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11MultipleRetryCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11AckFailureCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11FrameDuplicateCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11FcsErrorCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11RtsSuccessCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11RtsFailureCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11FailedCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11TransmittedFragmentCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11TransmittedFrameCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11WepExcludedCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11WepIcvErrorCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11WepUndecryptableCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11MulticastReceivedFrameCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11MulticastTransmittedFrameCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11ReceivedFragmentCount, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11Rsna4WayHandshakeFailures, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsTkipReplays, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsTkipIcvErrors, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsCcmpReplays, buffer, &offset); - CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeDisconnectCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiSmeDisconnectCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeDisconnectCfm *primitive = (CsrWifiSmeDisconnectCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiSmeDisconnectCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeDisconnectCfm *primitive = kmalloc(sizeof(CsrWifiSmeDisconnectCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeHostConfigGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrWifiSmeHostPowerMode primitive->hostConfig.powerMode */ - bufferSize += 2; /* u16 primitive->hostConfig.applicationDataPeriodMs */ - return bufferSize; -} - - -u8* CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeHostConfigGetCfm *primitive = (CsrWifiSmeHostConfigGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->hostConfig.powerMode); - CsrUint16Ser(ptr, len, (u16) primitive->hostConfig.applicationDataPeriodMs); - return(ptr); -} - - -void* CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeHostConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeHostConfigGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->hostConfig.powerMode, buffer, &offset); - CsrUint16Des((u16 *) &primitive->hostConfig.applicationDataPeriodMs, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeHostConfigSetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeHostConfigSetCfm *primitive = (CsrWifiSmeHostConfigSetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeHostConfigSetCfm *primitive = kmalloc(sizeof(CsrWifiSmeHostConfigSetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeIbssStationIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 6; /* u8 primitive->address.a[6] */ - bufferSize += 1; /* u8 primitive->isconnected */ - return bufferSize; -} - - -u8* CsrWifiSmeIbssStationIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeIbssStationInd *primitive = (CsrWifiSmeIbssStationInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->isconnected); - return(ptr); -} - - -void* CsrWifiSmeIbssStationIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeIbssStationInd *primitive = kmalloc(sizeof(CsrWifiSmeIbssStationInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->isconnected, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeKeyCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* CsrWifiSmeKeyType primitive->keyType */ - bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */ - return bufferSize; -} - - -u8* CsrWifiSmeKeyCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeKeyCfm *primitive = (CsrWifiSmeKeyCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->action); - CsrUint8Ser(ptr, len, (u8) primitive->keyType); - CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6))); - return(ptr); -} - - -void* CsrWifiSmeKeyCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeKeyCfm *primitive = kmalloc(sizeof(CsrWifiSmeKeyCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->action, buffer, &offset); - CsrUint8Des((u8 *) &primitive->keyType, buffer, &offset); - CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6))); - - return primitive; -} - - -size_t CsrWifiSmeLinkQualityGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* s16 primitive->linkQuality.unifiRssi */ - bufferSize += 2; /* s16 primitive->linkQuality.unifiSnr */ - return bufferSize; -} - - -u8* CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeLinkQualityGetCfm *primitive = (CsrWifiSmeLinkQualityGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint16Ser(ptr, len, (u16) primitive->linkQuality.unifiRssi); - CsrUint16Ser(ptr, len, (u16) primitive->linkQuality.unifiSnr); - return(ptr); -} - - -void* CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeLinkQualityGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeLinkQualityGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint16Des((u16 *) &primitive->linkQuality.unifiRssi, buffer, &offset); - CsrUint16Des((u16 *) &primitive->linkQuality.unifiSnr, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeMediaStatusIndSizeof(void *msg) -{ - CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 99) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiSmeMediaStatus primitive->mediaStatus */ - bufferSize += 32; /* u8 primitive->connectionInfo.ssid.ssid[32] */ - bufferSize += 1; /* u8 primitive->connectionInfo.ssid.length */ - bufferSize += 6; /* u8 primitive->connectionInfo.bssid.a[6] */ - bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */ - bufferSize += 1; /* u8 primitive->connectionInfo.channelNumber */ - bufferSize += 2; /* u16 primitive->connectionInfo.channelFrequency */ - bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */ - bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */ - bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.groupCipher */ - bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */ - bufferSize += 2; /* u16 primitive->connectionInfo.atimWindowTu */ - bufferSize += 2; /* u16 primitive->connectionInfo.beaconPeriodTu */ - bufferSize += 1; /* u8 primitive->connectionInfo.reassociation */ - bufferSize += 2; /* u16 primitive->connectionInfo.beaconFrameLength */ - bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */ - bufferSize += 2; /* u16 primitive->connectionInfo.associationReqFrameLength */ - bufferSize += primitive->connectionInfo.associationReqFrameLength; /* u8 primitive->connectionInfo.associationReqFrame */ - bufferSize += 2; /* u16 primitive->connectionInfo.associationRspFrameLength */ - bufferSize += primitive->connectionInfo.associationRspFrameLength; /* u8 primitive->connectionInfo.associationRspFrame */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocScanInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* u8 primitive->connectionInfo.assocScanInfoElements */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocReqCapabilities */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocReqListenIntervalTu */ - bufferSize += 6; /* u8 primitive->connectionInfo.assocReqApAddress.a[6] */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocReqInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* u8 primitive->connectionInfo.assocReqInfoElements */ - bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocRspCapabilityInfo */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocRspAssociationId */ - bufferSize += 2; /* u16 primitive->connectionInfo.assocRspInfoElementsLength */ - bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* u8 primitive->connectionInfo.assocRspInfoElements */ - bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->disassocReason */ - bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->deauthReason */ - return bufferSize; -} - - -u8* CsrWifiSmeMediaStatusIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.networkType80211); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.channelNumber); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.channelFrequency); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.authMode); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.pairwiseCipher); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.groupCipher); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ifIndex); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.atimWindowTu); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconPeriodTu); - CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.reassociation); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconFrameLength); - if (primitive->connectionInfo.beaconFrameLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((u16) (primitive->connectionInfo.beaconFrameLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationReqFrameLength); - if (primitive->connectionInfo.associationReqFrameLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((u16) (primitive->connectionInfo.associationReqFrameLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationRspFrameLength); - if (primitive->connectionInfo.associationRspFrameLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((u16) (primitive->connectionInfo.associationRspFrameLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocScanInfoElementsLength); - if (primitive->connectionInfo.assocScanInfoElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqCapabilities); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqListenIntervalTu); - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqInfoElementsLength); - if (primitive->connectionInfo.assocReqInfoElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspResult); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspCapabilityInfo); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspAssociationId); - CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspInfoElementsLength); - if (primitive->connectionInfo.assocRspInfoElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); - } - CsrUint16Ser(ptr, len, (u16) primitive->disassocReason); - CsrUint16Ser(ptr, len, (u16) primitive->deauthReason); - return(ptr); -} - - -void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeMediaStatusInd *primitive = kmalloc(sizeof(CsrWifiSmeMediaStatusInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->connectionInfo.ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->connectionInfo.networkType80211, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionInfo.channelNumber, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.authMode, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.groupCipher, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionInfo.ifIndex, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset); - CsrUint8Des((u8 *) &primitive->connectionInfo.reassociation, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset); - if (primitive->connectionInfo.beaconFrameLength) - { - primitive->connectionInfo.beaconFrame = kmalloc(primitive->connectionInfo.beaconFrameLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((u16) (primitive->connectionInfo.beaconFrameLength))); - } - else - { - primitive->connectionInfo.beaconFrame = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset); - if (primitive->connectionInfo.associationReqFrameLength) - { - primitive->connectionInfo.associationReqFrame = kmalloc(primitive->connectionInfo.associationReqFrameLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationReqFrameLength))); - } - else - { - primitive->connectionInfo.associationReqFrame = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset); - if (primitive->connectionInfo.associationRspFrameLength) - { - primitive->connectionInfo.associationRspFrame = kmalloc(primitive->connectionInfo.associationRspFrameLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationRspFrameLength))); - } - else - { - primitive->connectionInfo.associationRspFrame = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset); - if (primitive->connectionInfo.assocScanInfoElementsLength) - { - primitive->connectionInfo.assocScanInfoElements = kmalloc(primitive->connectionInfo.assocScanInfoElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength))); - } - else - { - primitive->connectionInfo.assocScanInfoElements = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset); - CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset); - if (primitive->connectionInfo.assocReqInfoElementsLength) - { - primitive->connectionInfo.assocReqInfoElements = kmalloc(primitive->connectionInfo.assocReqInfoElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength))); - } - else - { - primitive->connectionInfo.assocReqInfoElements = NULL; - } - CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset); - CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset); - if (primitive->connectionInfo.assocRspInfoElementsLength) - { - primitive->connectionInfo.assocRspInfoElements = kmalloc(primitive->connectionInfo.assocRspInfoElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength))); - } - else - { - primitive->connectionInfo.assocRspInfoElements = NULL; - } - CsrUint16Des((u16 *) &primitive->disassocReason, buffer, &offset); - CsrUint16Des((u16 *) &primitive->deauthReason, buffer, &offset); - - return primitive; -} - - -void CsrWifiSmeMediaStatusIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *) voidPrimitivePointer; - kfree(primitive->connectionInfo.beaconFrame); - kfree(primitive->connectionInfo.associationReqFrame); - kfree(primitive->connectionInfo.associationRspFrame); - kfree(primitive->connectionInfo.assocScanInfoElements); - kfree(primitive->connectionInfo.assocReqInfoElements); - kfree(primitive->connectionInfo.assocRspInfoElements); - kfree(primitive); -} - - -size_t CsrWifiSmeMibConfigGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* u8 primitive->mibConfig.unifiFixMaxTxDataRate */ - bufferSize += 1; /* u8 primitive->mibConfig.unifiFixTxDataRate */ - bufferSize += 2; /* u16 primitive->mibConfig.dot11RtsThreshold */ - bufferSize += 2; /* u16 primitive->mibConfig.dot11FragmentationThreshold */ - bufferSize += 2; /* u16 primitive->mibConfig.dot11CurrentTxPowerLevel */ - return bufferSize; -} - - -u8* CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeMibConfigGetCfm *primitive = (CsrWifiSmeMibConfigGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixMaxTxDataRate); - CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixTxDataRate); - CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11RtsThreshold); - CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11FragmentationThreshold); - CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11CurrentTxPowerLevel); - return(ptr); -} - - -void* CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeMibConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeMibConfigGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixMaxTxDataRate, buffer, &offset); - CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixTxDataRate, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mibConfig.dot11RtsThreshold, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mibConfig.dot11FragmentationThreshold, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mibConfig.dot11CurrentTxPowerLevel, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeMibGetCfmSizeof(void *msg) -{ - CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* u16 primitive->mibAttributeLength */ - bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ - return bufferSize; -} - - -u8* CsrWifiSmeMibGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength); - if (primitive->mibAttributeLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength))); - } - return(ptr); -} - - -void* CsrWifiSmeMibGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeMibGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeMibGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); - if (primitive->mibAttributeLength) - { - primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL); - CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); - } - else - { - primitive->mibAttribute = NULL; - } - - return primitive; -} - - -void CsrWifiSmeMibGetCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *) voidPrimitivePointer; - kfree(primitive->mibAttribute); - kfree(primitive); -} - - -size_t CsrWifiSmeMibGetNextCfmSizeof(void *msg) -{ - CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* u16 primitive->mibAttributeLength */ - bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */ - return bufferSize; -} - - -u8* CsrWifiSmeMibGetNextCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength); - if (primitive->mibAttributeLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength))); - } - return(ptr); -} - - -void* CsrWifiSmeMibGetNextCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeMibGetNextCfm *primitive = kmalloc(sizeof(CsrWifiSmeMibGetNextCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset); - if (primitive->mibAttributeLength) - { - primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL); - CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength))); - } - else - { - primitive->mibAttribute = NULL; - } - - return primitive; -} - - -void CsrWifiSmeMibGetNextCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *) voidPrimitivePointer; - kfree(primitive->mibAttribute); - kfree(primitive); -} - - -size_t CsrWifiSmeMicFailureIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* u8 primitive->secondFailure */ - bufferSize += 2; /* u16 primitive->count */ - bufferSize += 6; /* u8 primitive->address.a[6] */ - bufferSize += 1; /* CsrWifiSmeKeyType primitive->keyType */ - return bufferSize; -} - - -u8* CsrWifiSmeMicFailureIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeMicFailureInd *primitive = (CsrWifiSmeMicFailureInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->secondFailure); - CsrUint16Ser(ptr, len, (u16) primitive->count); - CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->keyType); - return(ptr); -} - - -void* CsrWifiSmeMicFailureIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeMicFailureInd *primitive = kmalloc(sizeof(CsrWifiSmeMicFailureInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->secondFailure, buffer, &offset); - CsrUint16Des((u16 *) &primitive->count, buffer, &offset); - CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->keyType, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeMulticastAddressCfmSizeof(void *msg) -{ - CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* u8 primitive->getAddressesCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->getAddressesCount; i1++) - { - bufferSize += 6; /* u8 primitive->getAddresses[i1].a[6] */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->action); - CsrUint8Ser(ptr, len, (u8) primitive->getAddressesCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->getAddressesCount; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((u16) (6))); - } - } - return(ptr); -} - - -void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeMulticastAddressCfm *primitive = kmalloc(sizeof(CsrWifiSmeMulticastAddressCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->action, buffer, &offset); - CsrUint8Des((u8 *) &primitive->getAddressesCount, buffer, &offset); - primitive->getAddresses = NULL; - if (primitive->getAddressesCount) - { - primitive->getAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->getAddressesCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->getAddressesCount; i1++) - { - CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((u16) (6))); - } - } - - return primitive; -} - - -void CsrWifiSmeMulticastAddressCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *) voidPrimitivePointer; - kfree(primitive->getAddresses); - kfree(primitive); -} - - -size_t CsrWifiSmePacketFilterSetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmePacketFilterSetCfm *primitive = (CsrWifiSmePacketFilterSetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmePacketFilterSetCfm *primitive = kmalloc(sizeof(CsrWifiSmePacketFilterSetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 6; /* u8 primitive->permanentMacAddress.a[6] */ - return bufferSize; -} - - -u8* CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmePermanentMacAddressGetCfm *primitive = (CsrWifiSmePermanentMacAddressGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrMemCpySer(ptr, len, (const void *) primitive->permanentMacAddress.a, ((u16) (6))); - return(ptr); -} - - -void* CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmePermanentMacAddressGetCfm *primitive = kmalloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrMemCpyDes(primitive->permanentMacAddress.a, buffer, &offset, ((u16) (6))); - - return primitive; -} - - -size_t CsrWifiSmePmkidCandidateListIndSizeof(void *msg) -{ - CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* u8 primitive->pmkidCandidatesCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) - { - bufferSize += 6; /* u8 primitive->pmkidCandidates[i1].bssid.a[6] */ - bufferSize += 1; /* u8 primitive->pmkidCandidates[i1].preAuthAllowed */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->pmkidCandidatesCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->pmkidCandidates[i1].bssid.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->pmkidCandidates[i1].preAuthAllowed); - } - } - return(ptr); -} - - -void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmePmkidCandidateListInd *primitive = kmalloc(sizeof(CsrWifiSmePmkidCandidateListInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->pmkidCandidatesCount, buffer, &offset); - primitive->pmkidCandidates = NULL; - if (primitive->pmkidCandidatesCount) - { - primitive->pmkidCandidates = kmalloc(sizeof(CsrWifiSmePmkidCandidate) * primitive->pmkidCandidatesCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++) - { - CsrMemCpyDes(primitive->pmkidCandidates[i1].bssid.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->pmkidCandidates[i1].preAuthAllowed, buffer, &offset); - } - } - - return primitive; -} - - -void CsrWifiSmePmkidCandidateListIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *) voidPrimitivePointer; - kfree(primitive->pmkidCandidates); - kfree(primitive); -} - - -size_t CsrWifiSmePmkidCfmSizeof(void *msg) -{ - CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 31) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrWifiSmeListAction primitive->action */ - bufferSize += 1; /* u8 primitive->getPmkidsCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->getPmkidsCount; i1++) - { - bufferSize += 6; /* u8 primitive->getPmkids[i1].bssid.a[6] */ - bufferSize += 16; /* u8 primitive->getPmkids[i1].pmkid[16] */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmePmkidCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->action); - CsrUint8Ser(ptr, len, (u8) primitive->getPmkidsCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->getPmkidsCount; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->getPmkids[i1].bssid.a, ((u16) (6))); - CsrMemCpySer(ptr, len, (const void *) primitive->getPmkids[i1].pmkid, ((u16) (16))); - } - } - return(ptr); -} - - -void* CsrWifiSmePmkidCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmePmkidCfm *primitive = kmalloc(sizeof(CsrWifiSmePmkidCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->action, buffer, &offset); - CsrUint8Des((u8 *) &primitive->getPmkidsCount, buffer, &offset); - primitive->getPmkids = NULL; - if (primitive->getPmkidsCount) - { - primitive->getPmkids = kmalloc(sizeof(CsrWifiSmePmkid) * primitive->getPmkidsCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->getPmkidsCount; i1++) - { - CsrMemCpyDes(primitive->getPmkids[i1].bssid.a, buffer, &offset, ((u16) (6))); - CsrMemCpyDes(primitive->getPmkids[i1].pmkid, buffer, &offset, ((u16) (16))); - } - } - - return primitive; -} - - -void CsrWifiSmePmkidCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *) voidPrimitivePointer; - kfree(primitive->getPmkids); - kfree(primitive); -} - - -size_t CsrWifiSmePowerConfigGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->powerConfig.powerSaveLevel */ - bufferSize += 2; /* u16 primitive->powerConfig.listenIntervalTu */ - bufferSize += 1; /* u8 primitive->powerConfig.rxDtims */ - bufferSize += 1; /* CsrWifiSmeD3AutoScanMode primitive->powerConfig.d3AutoScanMode */ - bufferSize += 1; /* u8 primitive->powerConfig.clientTrafficWindow */ - bufferSize += 1; /* u8 primitive->powerConfig.opportunisticPowerSave */ - bufferSize += 1; /* u8 primitive->powerConfig.noticeOfAbsence */ - return bufferSize; -} - - -u8* CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmePowerConfigGetCfm *primitive = (CsrWifiSmePowerConfigGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.powerSaveLevel); - CsrUint16Ser(ptr, len, (u16) primitive->powerConfig.listenIntervalTu); - CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.rxDtims); - CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.d3AutoScanMode); - CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.clientTrafficWindow); - CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.opportunisticPowerSave); - CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.noticeOfAbsence); - return(ptr); -} - - -void* CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmePowerConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmePowerConfigGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->powerConfig.powerSaveLevel, buffer, &offset); - CsrUint16Des((u16 *) &primitive->powerConfig.listenIntervalTu, buffer, &offset); - CsrUint8Des((u8 *) &primitive->powerConfig.rxDtims, buffer, &offset); - CsrUint8Des((u8 *) &primitive->powerConfig.d3AutoScanMode, buffer, &offset); - CsrUint8Des((u8 *) &primitive->powerConfig.clientTrafficWindow, buffer, &offset); - CsrUint8Des((u8 *) &primitive->powerConfig.opportunisticPowerSave, buffer, &offset); - CsrUint8Des((u8 *) &primitive->powerConfig.noticeOfAbsence, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* u8 primitive->regDomInfo.dot11MultiDomainCapabilityImplemented */ - bufferSize += 1; /* u8 primitive->regDomInfo.dot11MultiDomainCapabilityEnabled */ - bufferSize += 1; /* CsrWifiSmeRegulatoryDomain primitive->regDomInfo.currentRegulatoryDomain */ - bufferSize += 2; /* u8 primitive->regDomInfo.currentCountryCode[2] */ - return bufferSize; -} - - -u8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = (CsrWifiSmeRegulatoryDomainInfoGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->regDomInfo.dot11MultiDomainCapabilityImplemented); - CsrUint8Ser(ptr, len, (u8) primitive->regDomInfo.dot11MultiDomainCapabilityEnabled); - CsrUint8Ser(ptr, len, (u8) primitive->regDomInfo.currentRegulatoryDomain); - CsrMemCpySer(ptr, len, (const void *) primitive->regDomInfo.currentCountryCode, ((u16) (2))); - return(ptr); -} - - -void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->regDomInfo.dot11MultiDomainCapabilityImplemented, buffer, &offset); - CsrUint8Des((u8 *) &primitive->regDomInfo.dot11MultiDomainCapabilityEnabled, buffer, &offset); - CsrUint8Des((u8 *) &primitive->regDomInfo.currentRegulatoryDomain, buffer, &offset); - CsrMemCpyDes(primitive->regDomInfo.currentCountryCode, buffer, &offset, ((u16) (2))); - - return primitive; -} - - -size_t CsrWifiSmeRoamCompleteIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiSmeRoamCompleteIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeRoamCompleteInd *primitive = (CsrWifiSmeRoamCompleteInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiSmeRoamCompleteIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeRoamCompleteInd *primitive = kmalloc(sizeof(CsrWifiSmeRoamCompleteInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeRoamStartIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 1; /* CsrWifiSmeRoamReason primitive->roamReason */ - bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->reason80211 */ - return bufferSize; -} - - -u8* CsrWifiSmeRoamStartIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeRoamStartInd *primitive = (CsrWifiSmeRoamStartInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint8Ser(ptr, len, (u8) primitive->roamReason); - CsrUint16Ser(ptr, len, (u16) primitive->reason80211); - return(ptr); -} - - -void* CsrWifiSmeRoamStartIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeRoamStartInd *primitive = kmalloc(sizeof(CsrWifiSmeRoamStartInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint8Des((u8 *) &primitive->roamReason, buffer, &offset); - CsrUint16Des((u16 *) &primitive->reason80211, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 72) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - { - u16 i2; - for (i2 = 0; i2 < 3; i2++) - { - bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].rssiHighThreshold */ - bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].rssiLowThreshold */ - bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrHighThreshold */ - bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrLowThreshold */ - } - } - bufferSize += 1; /* u8 primitive->roamingConfig.disableSmoothRoaming */ - bufferSize += 1; /* u8 primitive->roamingConfig.disableRoamScans */ - bufferSize += 1; /* u8 primitive->roamingConfig.reconnectLimit */ - bufferSize += 2; /* u16 primitive->roamingConfig.reconnectLimitIntervalMs */ - { - u16 i2; - for (i2 = 0; i2 < 3; i2++) - { - bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].intervalSeconds */ - bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].validitySeconds */ - bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu */ - bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu */ - bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu */ - bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeRoamingConfigGetCfm *primitive = (CsrWifiSmeRoamingConfigGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - { - u16 i2; - for (i2 = 0; i2 < 3; i2++) - { - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].rssiHighThreshold); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].rssiLowThreshold); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].snrHighThreshold); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].snrLowThreshold); - } - } - CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableSmoothRoaming); - CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableRoamScans); - CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.reconnectLimit); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.reconnectLimitIntervalMs); - { - u16 i2; - for (i2 = 0; i2 < 3; i2++) - { - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].intervalSeconds); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].validitySeconds); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu); - CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu); - } - } - return(ptr); -} - - -void* CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeRoamingConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeRoamingConfigGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - { - u16 i2; - for (i2 = 0; i2 < 3; i2++) - { - CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].rssiHighThreshold, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].rssiLowThreshold, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].snrHighThreshold, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].snrLowThreshold, buffer, &offset); - } - } - CsrUint8Des((u8 *) &primitive->roamingConfig.disableSmoothRoaming, buffer, &offset); - CsrUint8Des((u8 *) &primitive->roamingConfig.disableRoamScans, buffer, &offset); - CsrUint8Des((u8 *) &primitive->roamingConfig.reconnectLimit, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.reconnectLimitIntervalMs, buffer, &offset); - { - u16 i2; - for (i2 = 0; i2 < 3; i2++) - { - CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].intervalSeconds, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].validitySeconds, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); - } - } - - return primitive; -} - - -size_t CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeRoamingConfigSetCfm *primitive = (CsrWifiSmeRoamingConfigSetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeRoamingConfigSetCfm *primitive = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeScanConfigGetCfmSizeof(void *msg) -{ - CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 65) */ - bufferSize += 2; /* CsrResult primitive->status */ - { - u16 i2; - for (i2 = 0; i2 < 4; i2++) - { - bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].intervalSeconds */ - bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].validitySeconds */ - bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu */ - bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu */ - bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu */ - bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu */ - } - } - bufferSize += 1; /* u8 primitive->scanConfig.disableAutonomousScans */ - bufferSize += 2; /* u16 primitive->scanConfig.maxResults */ - bufferSize += 1; /* s8 primitive->scanConfig.highRssiThreshold */ - bufferSize += 1; /* s8 primitive->scanConfig.lowRssiThreshold */ - bufferSize += 1; /* s8 primitive->scanConfig.deltaRssiThreshold */ - bufferSize += 1; /* s8 primitive->scanConfig.highSnrThreshold */ - bufferSize += 1; /* s8 primitive->scanConfig.lowSnrThreshold */ - bufferSize += 1; /* s8 primitive->scanConfig.deltaSnrThreshold */ - bufferSize += 2; /* u16 primitive->scanConfig.passiveChannelListCount */ - bufferSize += primitive->scanConfig.passiveChannelListCount; /* u8 primitive->scanConfig.passiveChannelList */ - return bufferSize; -} - - -u8* CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - { - u16 i2; - for (i2 = 0; i2 < 4; i2++) - { - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].intervalSeconds); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].validitySeconds); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu); - } - } - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.disableAutonomousScans); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.maxResults); - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highRssiThreshold); - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowRssiThreshold); - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaRssiThreshold); - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highSnrThreshold); - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowSnrThreshold); - CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaSnrThreshold); - CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.passiveChannelListCount); - if (primitive->scanConfig.passiveChannelListCount) - { - CsrMemCpySer(ptr, len, (const void *) primitive->scanConfig.passiveChannelList, ((u16) (primitive->scanConfig.passiveChannelListCount))); - } - return(ptr); -} - - -void* CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeScanConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeScanConfigGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - { - u16 i2; - for (i2 = 0; i2 < 4; i2++) - { - CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].intervalSeconds, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].validitySeconds, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset); - } - } - CsrUint8Des((u8 *) &primitive->scanConfig.disableAutonomousScans, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.maxResults, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanConfig.highRssiThreshold, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanConfig.lowRssiThreshold, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanConfig.deltaRssiThreshold, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanConfig.highSnrThreshold, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanConfig.lowSnrThreshold, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanConfig.deltaSnrThreshold, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset); - if (primitive->scanConfig.passiveChannelListCount) - { - primitive->scanConfig.passiveChannelList = kmalloc(primitive->scanConfig.passiveChannelListCount, GFP_KERNEL); - CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((u16) (primitive->scanConfig.passiveChannelListCount))); - } - else - { - primitive->scanConfig.passiveChannelList = NULL; - } - - return primitive; -} - - -void CsrWifiSmeScanConfigGetCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *) voidPrimitivePointer; - kfree(primitive->scanConfig.passiveChannelList); - kfree(primitive); -} - - -size_t CsrWifiSmeScanResultIndSizeof(void *msg) -{ - CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 149) */ - bufferSize += 32; /* u8 primitive->result.ssid.ssid[32] */ - bufferSize += 1; /* u8 primitive->result.ssid.length */ - bufferSize += 6; /* u8 primitive->result.bssid.a[6] */ - bufferSize += 2; /* s16 primitive->result.rssi */ - bufferSize += 2; /* s16 primitive->result.snr */ - bufferSize += 1; /* CsrWifiSmeRadioIF primitive->result.ifIndex */ - bufferSize += 2; /* u16 primitive->result.beaconPeriodTu */ - bufferSize += 8; /* u8 primitive->result.timeStamp.data[8] */ - bufferSize += 8; /* u8 primitive->result.localTime.data[8] */ - bufferSize += 2; /* u16 primitive->result.channelFrequency */ - bufferSize += 2; /* u16 primitive->result.capabilityInformation */ - bufferSize += 1; /* u8 primitive->result.channelNumber */ - bufferSize += 1; /* CsrWifiSmeBasicUsability primitive->result.usability */ - bufferSize += 1; /* CsrWifiSmeBssType primitive->result.bssType */ - bufferSize += 2; /* u16 primitive->result.informationElementsLength */ - bufferSize += primitive->result.informationElementsLength; /* u8 primitive->result.informationElements */ - bufferSize += 1; /* CsrWifiSmeP2pRole primitive->result.p2pDeviceRole */ - switch (primitive->result.p2pDeviceRole) - { - case CSR_WIFI_SME_P2P_ROLE_CLI: - bufferSize += 1; /* u8 primitive->result.deviceInfo.reservedCli.empty */ - break; - case CSR_WIFI_SME_P2P_ROLE_GO: - bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->result.deviceInfo.groupInfo.groupCapability */ - bufferSize += 6; /* u8 primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a[6] */ - bufferSize += 1; /* u8 primitive->result.deviceInfo.groupInfo.p2pClientInfoCount */ - { - u16 i4; - for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) - { - bufferSize += 6; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a[6] */ - bufferSize += 6; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a[6] */ - bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods */ - bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap */ - bufferSize += 8; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails[8] */ - bufferSize += 1; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount */ - { - u16 i6; - for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) - { - bufferSize += 8; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails[8] */ - } - } - bufferSize += 32; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName[32] */ - bufferSize += 1; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength */ - } - } - break; - case CSR_WIFI_SME_P2P_ROLE_NONE: - bufferSize += 1; /* u8 primitive->result.deviceInfo.reservedNone.empty */ - break; - case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - bufferSize += 6; /* u8 primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a[6] */ - bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->result.deviceInfo.standalonedevInfo.configMethods */ - bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap */ - bufferSize += 8; /* u8 primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails[8] */ - bufferSize += 1; /* u8 primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount */ - { - u16 i4; - for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) - { - bufferSize += 8; /* u8 primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails[8] */ - } - } - bufferSize += 32; /* u8 primitive->result.deviceInfo.standalonedevInfo.deviceName[32] */ - bufferSize += 1; /* u8 primitive->result.deviceInfo.standalonedevInfo.deviceNameLength */ - break; - default: - break; - } - return bufferSize; -} - - -u8* CsrWifiSmeScanResultIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrMemCpySer(ptr, len, (const void *) primitive->result.ssid.ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->result.ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->result.bssid.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->result.rssi); - CsrUint16Ser(ptr, len, (u16) primitive->result.snr); - CsrUint8Ser(ptr, len, (u8) primitive->result.ifIndex); - CsrUint16Ser(ptr, len, (u16) primitive->result.beaconPeriodTu); - CsrMemCpySer(ptr, len, (const void *) primitive->result.timeStamp.data, ((u16) (8))); - CsrMemCpySer(ptr, len, (const void *) primitive->result.localTime.data, ((u16) (8))); - CsrUint16Ser(ptr, len, (u16) primitive->result.channelFrequency); - CsrUint16Ser(ptr, len, (u16) primitive->result.capabilityInformation); - CsrUint8Ser(ptr, len, (u8) primitive->result.channelNumber); - CsrUint8Ser(ptr, len, (u8) primitive->result.usability); - CsrUint8Ser(ptr, len, (u8) primitive->result.bssType); - CsrUint16Ser(ptr, len, (u16) primitive->result.informationElementsLength); - if (primitive->result.informationElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->result.informationElements, ((u16) (primitive->result.informationElementsLength))); - } - CsrUint8Ser(ptr, len, (u8) primitive->result.p2pDeviceRole); - switch (primitive->result.p2pDeviceRole) - { - case CSR_WIFI_SME_P2P_ROLE_CLI: - CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.reservedCli.empty); - break; - case CSR_WIFI_SME_P2P_ROLE_GO: - CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.groupCapability); - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2pClientInfoCount); - { - u16 i4; - for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, ((u16) (6))); - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods); - CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap); - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, ((u16) (8))); - CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); - { - u16 i6; - for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, ((u16) (8))); - } - } - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength); - } - } - break; - case CSR_WIFI_SME_P2P_ROLE_NONE: - CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.reservedNone.empty); - break; - case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->result.deviceInfo.standalonedevInfo.configMethods); - CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap); - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, ((u16) (8))); - CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); - { - u16 i4; - for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, ((u16) (8))); - } - } - CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.deviceName, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.standalonedevInfo.deviceNameLength); - break; - default: - break; - } - return(ptr); -} - - -void* CsrWifiSmeScanResultIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeScanResultInd *primitive = kmalloc(sizeof(CsrWifiSmeScanResultInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrMemCpyDes(primitive->result.ssid.ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->result.ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->result.bssid.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->result.rssi, buffer, &offset); - CsrUint16Des((u16 *) &primitive->result.snr, buffer, &offset); - CsrUint8Des((u8 *) &primitive->result.ifIndex, buffer, &offset); - CsrUint16Des((u16 *) &primitive->result.beaconPeriodTu, buffer, &offset); - CsrMemCpyDes(primitive->result.timeStamp.data, buffer, &offset, ((u16) (8))); - CsrMemCpyDes(primitive->result.localTime.data, buffer, &offset, ((u16) (8))); - CsrUint16Des((u16 *) &primitive->result.channelFrequency, buffer, &offset); - CsrUint16Des((u16 *) &primitive->result.capabilityInformation, buffer, &offset); - CsrUint8Des((u8 *) &primitive->result.channelNumber, buffer, &offset); - CsrUint8Des((u8 *) &primitive->result.usability, buffer, &offset); - CsrUint8Des((u8 *) &primitive->result.bssType, buffer, &offset); - CsrUint16Des((u16 *) &primitive->result.informationElementsLength, buffer, &offset); - if (primitive->result.informationElementsLength) - { - primitive->result.informationElements = kmalloc(primitive->result.informationElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->result.informationElements, buffer, &offset, ((u16) (primitive->result.informationElementsLength))); - } - else - { - primitive->result.informationElements = NULL; - } - CsrUint8Des((u8 *) &primitive->result.p2pDeviceRole, buffer, &offset); - switch (primitive->result.p2pDeviceRole) - { - case CSR_WIFI_SME_P2P_ROLE_CLI: - CsrUint8Des((u8 *) &primitive->result.deviceInfo.reservedCli.empty, buffer, &offset); - break; - case CSR_WIFI_SME_P2P_ROLE_GO: - CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.groupCapability, buffer, &offset); - CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2pClientInfoCount, buffer, &offset); - primitive->result.deviceInfo.groupInfo.p2PClientInfo = NULL; - if (primitive->result.deviceInfo.groupInfo.p2pClientInfoCount) - { - primitive->result.deviceInfo.groupInfo.p2PClientInfo = kmalloc(sizeof(CsrWifiSmeP2pClientInfoType) * primitive->result.deviceInfo.groupInfo.p2pClientInfoCount, GFP_KERNEL); - } - { - u16 i4; - for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) - { - CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, buffer, &offset, ((u16) (6))); - CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods, buffer, &offset); - CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap, buffer, &offset); - CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8))); - CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, buffer, &offset); - primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; - if (primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount) - { - primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, GFP_KERNEL); - } - { - u16 i6; - for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) - { - CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, buffer, &offset, ((u16) (8))); - } - } - CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength, buffer, &offset); - } - } - break; - case CSR_WIFI_SME_P2P_ROLE_NONE: - CsrUint8Des((u8 *) &primitive->result.deviceInfo.reservedNone.empty, buffer, &offset); - break; - case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->result.deviceInfo.standalonedevInfo.configMethods, buffer, &offset); - CsrUint8Des((u8 *) &primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap, buffer, &offset); - CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8))); - CsrUint8Des((u8 *) &primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, buffer, &offset); - primitive->result.deviceInfo.standalonedevInfo.secDeviceType = NULL; - if (primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount) - { - primitive->result.deviceInfo.standalonedevInfo.secDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, GFP_KERNEL); - } - { - u16 i4; - for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) - { - CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, buffer, &offset, ((u16) (8))); - } - } - CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.deviceName, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->result.deviceInfo.standalonedevInfo.deviceNameLength, buffer, &offset); - break; - default: - break; - } - - return primitive; -} - - -void CsrWifiSmeScanResultIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *) voidPrimitivePointer; - kfree(primitive->result.informationElements); - switch (primitive->result.p2pDeviceRole) - { - case CSR_WIFI_SME_P2P_ROLE_GO: - { - u16 i4; - for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++) - { - kfree(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); - } - } - kfree(primitive->result.deviceInfo.groupInfo.p2PClientInfo); - break; - case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - kfree(primitive->result.deviceInfo.standalonedevInfo.secDeviceType); - break; - default: - break; - } - kfree(primitive); -} - - -size_t CsrWifiSmeScanResultsGetCfmSizeof(void *msg) -{ - CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 153) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* u16 primitive->scanResultsCount */ - { - u16 i1; - for (i1 = 0; i1 < primitive->scanResultsCount; i1++) - { - bufferSize += 32; /* u8 primitive->scanResults[i1].ssid.ssid[32] */ - bufferSize += 1; /* u8 primitive->scanResults[i1].ssid.length */ - bufferSize += 6; /* u8 primitive->scanResults[i1].bssid.a[6] */ - bufferSize += 2; /* s16 primitive->scanResults[i1].rssi */ - bufferSize += 2; /* s16 primitive->scanResults[i1].snr */ - bufferSize += 1; /* CsrWifiSmeRadioIF primitive->scanResults[i1].ifIndex */ - bufferSize += 2; /* u16 primitive->scanResults[i1].beaconPeriodTu */ - bufferSize += 8; /* u8 primitive->scanResults[i1].timeStamp.data[8] */ - bufferSize += 8; /* u8 primitive->scanResults[i1].localTime.data[8] */ - bufferSize += 2; /* u16 primitive->scanResults[i1].channelFrequency */ - bufferSize += 2; /* u16 primitive->scanResults[i1].capabilityInformation */ - bufferSize += 1; /* u8 primitive->scanResults[i1].channelNumber */ - bufferSize += 1; /* CsrWifiSmeBasicUsability primitive->scanResults[i1].usability */ - bufferSize += 1; /* CsrWifiSmeBssType primitive->scanResults[i1].bssType */ - bufferSize += 2; /* u16 primitive->scanResults[i1].informationElementsLength */ - bufferSize += primitive->scanResults[i1].informationElementsLength; /* u8 primitive->scanResults[i1].informationElements */ - bufferSize += 1; /* CsrWifiSmeP2pRole primitive->scanResults[i1].p2pDeviceRole */ - switch (primitive->scanResults[i1].p2pDeviceRole) - { - case CSR_WIFI_SME_P2P_ROLE_CLI: - bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.reservedCli.empty */ - break; - case CSR_WIFI_SME_P2P_ROLE_GO: - bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability */ - bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a[6] */ - bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount */ - { - u16 i4; - for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) - { - bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a[6] */ - bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a[6] */ - bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods */ - bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap */ - bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails[8] */ - bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount */ - { - u16 i6; - for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) - { - bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails[8] */ - } - } - bufferSize += 32; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName[32] */ - bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength */ - } - } - break; - case CSR_WIFI_SME_P2P_ROLE_NONE: - bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.reservedNone.empty */ - break; - case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a[6] */ - bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods */ - bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap */ - bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails[8] */ - bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount */ - { - u16 i4; - for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) - { - bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails[8] */ - } - } - bufferSize += 32; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName[32] */ - bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength */ - break; - default: - break; - } - } - } - return bufferSize; -} - - -u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint16Ser(ptr, len, (u16) primitive->scanResultsCount); - { - u16 i1; - for (i1 = 0; i1 < primitive->scanResultsCount; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].ssid.ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].ssid.length); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].bssid.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].rssi); - CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].snr); - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].ifIndex); - CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].beaconPeriodTu); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].timeStamp.data, ((u16) (8))); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].localTime.data, ((u16) (8))); - CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].channelFrequency); - CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].capabilityInformation); - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].channelNumber); - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].usability); - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].bssType); - CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].informationElementsLength); - if (primitive->scanResults[i1].informationElementsLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].informationElements, ((u16) (primitive->scanResults[i1].informationElementsLength))); - } - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].p2pDeviceRole); - switch (primitive->scanResults[i1].p2pDeviceRole) - { - case CSR_WIFI_SME_P2P_ROLE_CLI: - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.reservedCli.empty); - break; - case CSR_WIFI_SME_P2P_ROLE_GO: - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a, ((u16) (6))); - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount); - { - u16 i4; - for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, ((u16) (6))); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods); - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, ((u16) (8))); - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount); - { - u16 i6; - for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, ((u16) (8))); - } - } - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength); - } - } - break; - case CSR_WIFI_SME_P2P_ROLE_NONE: - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.reservedNone.empty); - break; - case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a, ((u16) (6))); - CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods); - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap); - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, ((u16) (8))); - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount); - { - u16 i4; - for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, ((u16) (8))); - } - } - CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength); - break; - default: - break; - } - } - } - return(ptr); -} - - -void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeScanResultsGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeScanResultsGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanResultsCount, buffer, &offset); - primitive->scanResults = NULL; - if (primitive->scanResultsCount) - { - primitive->scanResults = kmalloc(sizeof(CsrWifiSmeScanResult) * primitive->scanResultsCount, GFP_KERNEL); - } - { - u16 i1; - for (i1 = 0; i1 < primitive->scanResultsCount; i1++) - { - CsrMemCpyDes(primitive->scanResults[i1].ssid.ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->scanResults[i1].ssid.length, buffer, &offset); - CsrMemCpyDes(primitive->scanResults[i1].bssid.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->scanResults[i1].rssi, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanResults[i1].snr, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanResults[i1].ifIndex, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanResults[i1].beaconPeriodTu, buffer, &offset); - CsrMemCpyDes(primitive->scanResults[i1].timeStamp.data, buffer, &offset, ((u16) (8))); - CsrMemCpyDes(primitive->scanResults[i1].localTime.data, buffer, &offset, ((u16) (8))); - CsrUint16Des((u16 *) &primitive->scanResults[i1].channelFrequency, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanResults[i1].capabilityInformation, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanResults[i1].channelNumber, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanResults[i1].usability, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanResults[i1].bssType, buffer, &offset); - CsrUint16Des((u16 *) &primitive->scanResults[i1].informationElementsLength, buffer, &offset); - if (primitive->scanResults[i1].informationElementsLength) - { - primitive->scanResults[i1].informationElements = kmalloc(primitive->scanResults[i1].informationElementsLength, GFP_KERNEL); - CsrMemCpyDes(primitive->scanResults[i1].informationElements, buffer, &offset, ((u16) (primitive->scanResults[i1].informationElementsLength))); - } - else - { - primitive->scanResults[i1].informationElements = NULL; - } - CsrUint8Des((u8 *) &primitive->scanResults[i1].p2pDeviceRole, buffer, &offset); - switch (primitive->scanResults[i1].p2pDeviceRole) - { - case CSR_WIFI_SME_P2P_ROLE_CLI: - CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.reservedCli.empty, buffer, &offset); - break; - case CSR_WIFI_SME_P2P_ROLE_GO: - CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability, buffer, &offset); - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a, buffer, &offset, ((u16) (6))); - CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount, buffer, &offset); - primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = NULL; - if (primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount) - { - primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = kmalloc(sizeof(CsrWifiSmeP2pClientInfoType) * primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount, GFP_KERNEL); - } - { - u16 i4; - for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) - { - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, buffer, &offset, ((u16) (6))); - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap, buffer, &offset); - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8))); - CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, buffer, &offset); - primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL; - if (primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount) - { - primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, GFP_KERNEL); - } - { - u16 i6; - for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++) - { - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, buffer, &offset, ((u16) (8))); - } - } - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength, buffer, &offset); - } - } - break; - case CSR_WIFI_SME_P2P_ROLE_NONE: - CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.reservedNone.empty, buffer, &offset); - break; - case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a, buffer, &offset, ((u16) (6))); - CsrUint16Des((u16 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods, buffer, &offset); - CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap, buffer, &offset); - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8))); - CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, buffer, &offset); - primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = NULL; - if (primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount) - { - primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, GFP_KERNEL); - } - { - u16 i4; - for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++) - { - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, buffer, &offset, ((u16) (8))); - } - } - CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength, buffer, &offset); - break; - default: - break; - } - } - } - - return primitive; -} - - -void CsrWifiSmeScanResultsGetCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *) voidPrimitivePointer; - { - u16 i1; - for (i1 = 0; i1 < primitive->scanResultsCount; i1++) - { - kfree(primitive->scanResults[i1].informationElements); - switch (primitive->scanResults[i1].p2pDeviceRole) - { - case CSR_WIFI_SME_P2P_ROLE_GO: - { - u16 i4; - for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++) - { - kfree(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType); - } - } - kfree(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo); - break; - case CSR_WIFI_SME_P2P_ROLE_STANDALONE: - kfree(primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType); - break; - default: - break; - } - } - } - kfree(primitive->scanResults); - kfree(primitive); -} - - -size_t CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* u8 primitive->smeConfig.connectionQualityRssiChangeTrigger */ - bufferSize += 1; /* u8 primitive->smeConfig.connectionQualitySnrChangeTrigger */ - bufferSize += 1; /* CsrWifiSmeWmmModeMask primitive->smeConfig.wmmModeMask */ - bufferSize += 1; /* CsrWifiSmeRadioIF primitive->smeConfig.ifIndex */ - bufferSize += 1; /* u8 primitive->smeConfig.allowUnicastUseGroupCipher */ - bufferSize += 1; /* u8 primitive->smeConfig.enableOpportunisticKeyCaching */ - return bufferSize; -} - - -u8* CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeSmeStaConfigGetCfm *primitive = (CsrWifiSmeSmeStaConfigGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualityRssiChangeTrigger); - CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualitySnrChangeTrigger); - CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.wmmModeMask); - CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.ifIndex); - CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.allowUnicastUseGroupCipher); - CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.enableOpportunisticKeyCaching); - return(ptr); -} - - -void* CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeSmeStaConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualityRssiChangeTrigger, buffer, &offset); - CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualitySnrChangeTrigger, buffer, &offset); - CsrUint8Des((u8 *) &primitive->smeConfig.wmmModeMask, buffer, &offset); - CsrUint8Des((u8 *) &primitive->smeConfig.ifIndex, buffer, &offset); - CsrUint8Des((u8 *) &primitive->smeConfig.allowUnicastUseGroupCipher, buffer, &offset); - CsrUint8Des((u8 *) &primitive->smeConfig.enableOpportunisticKeyCaching, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - return bufferSize; -} - - -u8* CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeSmeStaConfigSetCfm *primitive = (CsrWifiSmeSmeStaConfigSetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - return(ptr); -} - - -void* CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeSmeStaConfigSetCfm *primitive = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */ - bufferSize += 2; /* CsrResult primitive->status */ - { - u16 i1; - for (i1 = 0; i1 < 2; i1++) - { - bufferSize += 6; /* u8 primitive->stationMacAddress[i1].a[6] */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeStationMacAddressGetCfm *primitive = (CsrWifiSmeStationMacAddressGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - { - u16 i1; - for (i1 = 0; i1 < 2; i1++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->stationMacAddress[i1].a, ((u16) (6))); - } - } - return(ptr); -} - - -void* CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeStationMacAddressGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeStationMacAddressGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - { - u16 i1; - for (i1 = 0; i1 < 2; i1++) - { - CsrMemCpyDes(primitive->stationMacAddress[i1].a, buffer, &offset, ((u16) (6))); - } - } - - return primitive; -} - - -size_t CsrWifiSmeTspecIndSizeof(void *msg) -{ - CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 4; /* u32 primitive->transactionId */ - bufferSize += 1; /* CsrWifiSmeTspecResultCode primitive->tspecResultCode */ - bufferSize += 2; /* u16 primitive->tspecLength */ - bufferSize += primitive->tspecLength; /* u8 primitive->tspec */ - return bufferSize; -} - - -u8* CsrWifiSmeTspecIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint32Ser(ptr, len, (u32) primitive->transactionId); - CsrUint8Ser(ptr, len, (u8) primitive->tspecResultCode); - CsrUint16Ser(ptr, len, (u16) primitive->tspecLength); - if (primitive->tspecLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((u16) (primitive->tspecLength))); - } - return(ptr); -} - - -void* CsrWifiSmeTspecIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeTspecInd *primitive = kmalloc(sizeof(CsrWifiSmeTspecInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint32Des((u32 *) &primitive->transactionId, buffer, &offset); - CsrUint8Des((u8 *) &primitive->tspecResultCode, buffer, &offset); - CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset); - if (primitive->tspecLength) - { - primitive->tspec = kmalloc(primitive->tspecLength, GFP_KERNEL); - CsrMemCpyDes(primitive->tspec, buffer, &offset, ((u16) (primitive->tspecLength))); - } - else - { - primitive->tspec = NULL; - } - - return primitive; -} - - -void CsrWifiSmeTspecIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *) voidPrimitivePointer; - kfree(primitive->tspec); - kfree(primitive); -} - - -size_t CsrWifiSmeTspecCfmSizeof(void *msg) -{ - CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */ - bufferSize += 2; /* u16 primitive->interfaceTag */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 4; /* u32 primitive->transactionId */ - bufferSize += 1; /* CsrWifiSmeTspecResultCode primitive->tspecResultCode */ - bufferSize += 2; /* u16 primitive->tspecLength */ - bufferSize += primitive->tspecLength; /* u8 primitive->tspec */ - return bufferSize; -} - - -u8* CsrWifiSmeTspecCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint32Ser(ptr, len, (u32) primitive->transactionId); - CsrUint8Ser(ptr, len, (u8) primitive->tspecResultCode); - CsrUint16Ser(ptr, len, (u16) primitive->tspecLength); - if (primitive->tspecLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((u16) (primitive->tspecLength))); - } - return(ptr); -} - - -void* CsrWifiSmeTspecCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeTspecCfm *primitive = kmalloc(sizeof(CsrWifiSmeTspecCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint32Des((u32 *) &primitive->transactionId, buffer, &offset); - CsrUint8Des((u8 *) &primitive->tspecResultCode, buffer, &offset); - CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset); - if (primitive->tspecLength) - { - primitive->tspec = kmalloc(primitive->tspecLength, GFP_KERNEL); - CsrMemCpyDes(primitive->tspec, buffer, &offset, ((u16) (primitive->tspecLength))); - } - else - { - primitive->tspec = NULL; - } - - return primitive; -} - - -void CsrWifiSmeTspecCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *) voidPrimitivePointer; - kfree(primitive->tspec); - kfree(primitive); -} - - -size_t CsrWifiSmeVersionsGetCfmSizeof(void *msg) -{ - CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 33) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 4; /* u32 primitive->versions.chipId */ - bufferSize += 4; /* u32 primitive->versions.chipVersion */ - bufferSize += 4; /* u32 primitive->versions.firmwareBuild */ - bufferSize += 4; /* u32 primitive->versions.firmwarePatch */ - bufferSize += 4; /* u32 primitive->versions.firmwareHip */ - bufferSize += (primitive->versions.routerBuild ? strlen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */ - bufferSize += 4; /* u32 primitive->versions.routerHip */ - bufferSize += (primitive->versions.smeBuild ? strlen(primitive->versions.smeBuild) : 0) + 1; /* char* primitive->versions.smeBuild (0 byte len + 1 for NULL Term) */ - bufferSize += 4; /* u32 primitive->versions.smeHip */ - return bufferSize; -} - - -u8* CsrWifiSmeVersionsGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint32Ser(ptr, len, (u32) primitive->versions.chipId); - CsrUint32Ser(ptr, len, (u32) primitive->versions.chipVersion); - CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwareBuild); - CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwarePatch); - CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwareHip); - CsrCharStringSer(ptr, len, primitive->versions.routerBuild); - CsrUint32Ser(ptr, len, (u32) primitive->versions.routerHip); - CsrCharStringSer(ptr, len, primitive->versions.smeBuild); - CsrUint32Ser(ptr, len, (u32) primitive->versions.smeHip); - return(ptr); -} - - -void* CsrWifiSmeVersionsGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeVersionsGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeVersionsGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint32Des((u32 *) &primitive->versions.chipId, buffer, &offset); - CsrUint32Des((u32 *) &primitive->versions.chipVersion, buffer, &offset); - CsrUint32Des((u32 *) &primitive->versions.firmwareBuild, buffer, &offset); - CsrUint32Des((u32 *) &primitive->versions.firmwarePatch, buffer, &offset); - CsrUint32Des((u32 *) &primitive->versions.firmwareHip, buffer, &offset); - CsrCharStringDes(&primitive->versions.routerBuild, buffer, &offset); - CsrUint32Des((u32 *) &primitive->versions.routerHip, buffer, &offset); - CsrCharStringDes(&primitive->versions.smeBuild, buffer, &offset); - CsrUint32Des((u32 *) &primitive->versions.smeHip, buffer, &offset); - - return primitive; -} - - -void CsrWifiSmeVersionsGetCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *) voidPrimitivePointer; - kfree(primitive->versions.routerBuild); - kfree(primitive->versions.smeBuild); - kfree(primitive); -} - - -size_t CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg) -{ - CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 39) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsidsCount */ - { - u16 i2; - for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) - { - bufferSize += 32; /* u8 primitive->cloakedSsids.cloakedSsids[i2].ssid[32] */ - bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsids[i2].length */ - } - } - return bufferSize; -} - - -u8* CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsidsCount); - { - u16 i2; - for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) - { - CsrMemCpySer(ptr, len, (const void *) primitive->cloakedSsids.cloakedSsids[i2].ssid, ((u16) (32))); - CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsids[i2].length); - } - } - return(ptr); -} - - -void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeCloakedSsidsGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsidsCount, buffer, &offset); - primitive->cloakedSsids.cloakedSsids = NULL; - if (primitive->cloakedSsids.cloakedSsidsCount) - { - primitive->cloakedSsids.cloakedSsids = kmalloc(sizeof(CsrWifiSsid) * primitive->cloakedSsids.cloakedSsidsCount, GFP_KERNEL); - } - { - u16 i2; - for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++) - { - CsrMemCpyDes(primitive->cloakedSsids.cloakedSsids[i2].ssid, buffer, &offset, ((u16) (32))); - CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsids[i2].length, buffer, &offset); - } - } - - return primitive; -} - - -void CsrWifiSmeCloakedSsidsGetCfmSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *) voidPrimitivePointer; - kfree(primitive->cloakedSsids.cloakedSsids); - kfree(primitive); -} - - -size_t CsrWifiSmeWifiOnIndSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 6; /* u8 primitive->address.a[6] */ - return bufferSize; -} - - -u8* CsrWifiSmeWifiOnIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeWifiOnInd *primitive = (CsrWifiSmeWifiOnInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6))); - return(ptr); -} - - -void* CsrWifiSmeWifiOnIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeWifiOnInd *primitive = kmalloc(sizeof(CsrWifiSmeWifiOnInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6))); - - return primitive; -} - - -size_t CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 1; /* CsrWifiSme80211dTrustLevel primitive->deviceConfig.trustLevel */ - bufferSize += 2; /* u8 primitive->deviceConfig.countryCode[2] */ - bufferSize += 1; /* CsrWifiSmeFirmwareDriverInterface primitive->deviceConfig.firmwareDriverInterface */ - bufferSize += 1; /* u8 primitive->deviceConfig.enableStrictDraftN */ - return bufferSize; -} - - -u8* CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeSmeCommonConfigGetCfm *primitive = (CsrWifiSmeSmeCommonConfigGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.trustLevel); - CsrMemCpySer(ptr, len, (const void *) primitive->deviceConfig.countryCode, ((u16) (2))); - CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.firmwareDriverInterface); - CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.enableStrictDraftN); - return(ptr); -} - - -void* CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeSmeCommonConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint8Des((u8 *) &primitive->deviceConfig.trustLevel, buffer, &offset); - CsrMemCpyDes(primitive->deviceConfig.countryCode, buffer, &offset, ((u16) (2))); - CsrUint8Des((u8 *) &primitive->deviceConfig.firmwareDriverInterface, buffer, &offset); - CsrUint8Des((u8 *) &primitive->deviceConfig.enableStrictDraftN, buffer, &offset); - - return primitive; -} - - -size_t CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg) -{ - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */ - bufferSize += 2; /* CsrResult primitive->status */ - bufferSize += 2; /* u16 primitive->numInterfaces */ - bufferSize += 2; /* u8 primitive->capBitmap[2] */ - return bufferSize; -} - - -u8* CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeInterfaceCapabilityGetCfm *primitive = (CsrWifiSmeInterfaceCapabilityGetCfm *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint16Ser(ptr, len, (u16) primitive->status); - CsrUint16Ser(ptr, len, (u16) primitive->numInterfaces); - CsrMemCpySer(ptr, len, (const void *) primitive->capBitmap, ((u16) (2))); - return(ptr); -} - - -void* CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, size_t length) -{ - CsrWifiSmeInterfaceCapabilityGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint16Des((u16 *) &primitive->status, buffer, &offset); - CsrUint16Des((u16 *) &primitive->numInterfaces, buffer, &offset); - CsrMemCpyDes(primitive->capBitmap, buffer, &offset, ((u16) (2))); - - return primitive; -} - - -size_t CsrWifiSmeErrorIndSizeof(void *msg) -{ - CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ - bufferSize += (primitive->errorMessage ? strlen(primitive->errorMessage) : 0) + 1; /* char* primitive->errorMessage (0 byte len + 1 for NULL Term) */ - return bufferSize; -} - - -u8* CsrWifiSmeErrorIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrCharStringSer(ptr, len, primitive->errorMessage); - return(ptr); -} - - -void* CsrWifiSmeErrorIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeErrorInd *primitive = kmalloc(sizeof(CsrWifiSmeErrorInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrCharStringDes(&primitive->errorMessage, buffer, &offset); - - return primitive; -} - - -void CsrWifiSmeErrorIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *) voidPrimitivePointer; - kfree(primitive->errorMessage); - kfree(primitive); -} - - -size_t CsrWifiSmeInfoIndSizeof(void *msg) -{ - CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */ - bufferSize += (primitive->infoMessage ? strlen(primitive->infoMessage) : 0) + 1; /* char* primitive->infoMessage (0 byte len + 1 for NULL Term) */ - return bufferSize; -} - - -u8* CsrWifiSmeInfoIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrCharStringSer(ptr, len, primitive->infoMessage); - return(ptr); -} - - -void* CsrWifiSmeInfoIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeInfoInd *primitive = kmalloc(sizeof(CsrWifiSmeInfoInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrCharStringDes(&primitive->infoMessage, buffer, &offset); - - return primitive; -} - - -void CsrWifiSmeInfoIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *) voidPrimitivePointer; - kfree(primitive->infoMessage); - kfree(primitive); -} - - -size_t CsrWifiSmeCoreDumpIndSizeof(void *msg) -{ - CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *) msg; - size_t bufferSize = 2; - - /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */ - bufferSize += 4; /* u32 primitive->dataLength */ - bufferSize += primitive->dataLength; /* u8 primitive->data */ - return bufferSize; -} - - -u8* CsrWifiSmeCoreDumpIndSer(u8 *ptr, size_t *len, void *msg) -{ - CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *)msg; - *len = 0; - CsrUint16Ser(ptr, len, primitive->common.type); - CsrUint32Ser(ptr, len, (u32) primitive->dataLength); - if (primitive->dataLength) - { - CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength))); - } - return(ptr); -} - - -void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, size_t length) -{ - CsrWifiSmeCoreDumpInd *primitive = kmalloc(sizeof(CsrWifiSmeCoreDumpInd), GFP_KERNEL); - size_t offset; - offset = 0; - - CsrUint16Des(&primitive->common.type, buffer, &offset); - CsrUint32Des((u32 *) &primitive->dataLength, buffer, &offset); - if (primitive->dataLength) - { - primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL); - CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength))); - } - else - { - primitive->data = NULL; - } - - return primitive; -} - - -void CsrWifiSmeCoreDumpIndSerFree(void *voidPrimitivePointer) -{ - CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *) voidPrimitivePointer; - kfree(primitive->data); - kfree(primitive); -} - - diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.h b/drivers/staging/csr/csr_wifi_sme_serialize.h deleted file mode 100644 index f8526269b203..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_serialize.h +++ /dev/null @@ -1,666 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2012 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_SME_SERIALIZE_H__ -#define CSR_WIFI_SME_SERIALIZE_H__ - -#include "csr_wifi_msgconv.h" -#include "csr_wifi_sme_prim.h" - -extern void CsrWifiSmePfree(void *ptr); - -#define CsrWifiSmeActivateReqSer CsrWifiEventSer -#define CsrWifiSmeActivateReqDes CsrWifiEventDes -#define CsrWifiSmeActivateReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeActivateReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeAdhocConfigGetReqSer CsrWifiEventSer -#define CsrWifiSmeAdhocConfigGetReqDes CsrWifiEventDes -#define CsrWifiSmeAdhocConfigGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeAdhocConfigGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeAdhocConfigSetReqSizeof(void *msg); -#define CsrWifiSmeAdhocConfigSetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeBlacklistReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeBlacklistReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeBlacklistReqSizeof(void *msg); -extern void CsrWifiSmeBlacklistReqSerFree(void *msg); - -#define CsrWifiSmeCalibrationDataGetReqSer CsrWifiEventSer -#define CsrWifiSmeCalibrationDataGetReqDes CsrWifiEventDes -#define CsrWifiSmeCalibrationDataGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeCalibrationDataGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeCalibrationDataSetReqSizeof(void *msg); -extern void CsrWifiSmeCalibrationDataSetReqSerFree(void *msg); - -#define CsrWifiSmeCcxConfigGetReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeCcxConfigGetReqDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeCcxConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeCcxConfigGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeCcxConfigSetReqSizeof(void *msg); -#define CsrWifiSmeCcxConfigSetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeCoexConfigGetReqSer CsrWifiEventSer -#define CsrWifiSmeCoexConfigGetReqDes CsrWifiEventDes -#define CsrWifiSmeCoexConfigGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeCoexConfigGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeCoexConfigSetReqSizeof(void *msg); -#define CsrWifiSmeCoexConfigSetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeCoexInfoGetReqSer CsrWifiEventSer -#define CsrWifiSmeCoexInfoGetReqDes CsrWifiEventDes -#define CsrWifiSmeCoexInfoGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeCoexInfoGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeConnectReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeConnectReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeConnectReqSizeof(void *msg); -extern void CsrWifiSmeConnectReqSerFree(void *msg); - -#define CsrWifiSmeConnectionConfigGetReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeConnectionConfigGetReqDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeConnectionConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeConnectionConfigGetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeConnectionInfoGetReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeConnectionInfoGetReqDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeConnectionInfoGetReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeConnectionInfoGetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeConnectionStatsGetReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeConnectionStatsGetReqDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeConnectionStatsGetReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeConnectionStatsGetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeDeactivateReqSer CsrWifiEventSer -#define CsrWifiSmeDeactivateReqDes CsrWifiEventDes -#define CsrWifiSmeDeactivateReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeDeactivateReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeDisconnectReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeDisconnectReqDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeDisconnectReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeDisconnectReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeEventMaskSetReqSer CsrWifiEventCsrUint32Ser -#define CsrWifiSmeEventMaskSetReqDes CsrWifiEventCsrUint32Des -#define CsrWifiSmeEventMaskSetReqSizeof CsrWifiEventCsrUint32Sizeof -#define CsrWifiSmeEventMaskSetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeHostConfigGetReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeHostConfigGetReqDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeHostConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeHostConfigGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeHostConfigSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeHostConfigSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeHostConfigSetReqSizeof(void *msg); -#define CsrWifiSmeHostConfigSetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeKeyReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeKeyReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeKeyReqSizeof(void *msg); -#define CsrWifiSmeKeyReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeLinkQualityGetReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeLinkQualityGetReqDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeLinkQualityGetReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeLinkQualityGetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeMibConfigGetReqSer CsrWifiEventSer -#define CsrWifiSmeMibConfigGetReqDes CsrWifiEventDes -#define CsrWifiSmeMibConfigGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeMibConfigGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeMibConfigSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeMibConfigSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeMibConfigSetReqSizeof(void *msg); -#define CsrWifiSmeMibConfigSetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeMibGetNextReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeMibGetNextReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeMibGetNextReqSizeof(void *msg); -extern void CsrWifiSmeMibGetNextReqSerFree(void *msg); - -extern u8 *CsrWifiSmeMibGetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeMibGetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeMibGetReqSizeof(void *msg); -extern void CsrWifiSmeMibGetReqSerFree(void *msg); - -extern u8 *CsrWifiSmeMibSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeMibSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeMibSetReqSizeof(void *msg); -extern void CsrWifiSmeMibSetReqSerFree(void *msg); - -extern u8 *CsrWifiSmeMulticastAddressReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeMulticastAddressReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeMulticastAddressReqSizeof(void *msg); -extern void CsrWifiSmeMulticastAddressReqSerFree(void *msg); - -extern u8 *CsrWifiSmePacketFilterSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmePacketFilterSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmePacketFilterSetReqSizeof(void *msg); -extern void CsrWifiSmePacketFilterSetReqSerFree(void *msg); - -#define CsrWifiSmePermanentMacAddressGetReqSer CsrWifiEventSer -#define CsrWifiSmePermanentMacAddressGetReqDes CsrWifiEventDes -#define CsrWifiSmePermanentMacAddressGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmePermanentMacAddressGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmePmkidReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmePmkidReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmePmkidReqSizeof(void *msg); -extern void CsrWifiSmePmkidReqSerFree(void *msg); - -#define CsrWifiSmePowerConfigGetReqSer CsrWifiEventSer -#define CsrWifiSmePowerConfigGetReqDes CsrWifiEventDes -#define CsrWifiSmePowerConfigGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmePowerConfigGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmePowerConfigSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmePowerConfigSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmePowerConfigSetReqSizeof(void *msg); -#define CsrWifiSmePowerConfigSetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeRegulatoryDomainInfoGetReqSer CsrWifiEventSer -#define CsrWifiSmeRegulatoryDomainInfoGetReqDes CsrWifiEventDes -#define CsrWifiSmeRegulatoryDomainInfoGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeRegulatoryDomainInfoGetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeRoamingConfigGetReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeRoamingConfigGetReqDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeRoamingConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeRoamingConfigGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeRoamingConfigSetReqSizeof(void *msg); -#define CsrWifiSmeRoamingConfigSetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeScanConfigGetReqSer CsrWifiEventSer -#define CsrWifiSmeScanConfigGetReqDes CsrWifiEventDes -#define CsrWifiSmeScanConfigGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeScanConfigGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeScanConfigSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeScanConfigSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeScanConfigSetReqSizeof(void *msg); -extern void CsrWifiSmeScanConfigSetReqSerFree(void *msg); - -extern u8 *CsrWifiSmeScanFullReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeScanFullReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeScanFullReqSizeof(void *msg); -extern void CsrWifiSmeScanFullReqSerFree(void *msg); - -#define CsrWifiSmeScanResultsFlushReqSer CsrWifiEventSer -#define CsrWifiSmeScanResultsFlushReqDes CsrWifiEventDes -#define CsrWifiSmeScanResultsFlushReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeScanResultsFlushReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeScanResultsGetReqSer CsrWifiEventSer -#define CsrWifiSmeScanResultsGetReqDes CsrWifiEventDes -#define CsrWifiSmeScanResultsGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeScanResultsGetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeSmeStaConfigGetReqSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeSmeStaConfigGetReqDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeSmeStaConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeSmeStaConfigGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg); -#define CsrWifiSmeSmeStaConfigSetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeStationMacAddressGetReqSer CsrWifiEventSer -#define CsrWifiSmeStationMacAddressGetReqDes CsrWifiEventDes -#define CsrWifiSmeStationMacAddressGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeStationMacAddressGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeTspecReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeTspecReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeTspecReqSizeof(void *msg); -extern void CsrWifiSmeTspecReqSerFree(void *msg); - -#define CsrWifiSmeVersionsGetReqSer CsrWifiEventSer -#define CsrWifiSmeVersionsGetReqDes CsrWifiEventDes -#define CsrWifiSmeVersionsGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeVersionsGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeWifiFlightmodeReqSizeof(void *msg); -extern void CsrWifiSmeWifiFlightmodeReqSerFree(void *msg); - -#define CsrWifiSmeWifiOffReqSer CsrWifiEventSer -#define CsrWifiSmeWifiOffReqDes CsrWifiEventDes -#define CsrWifiSmeWifiOffReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeWifiOffReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeWifiOnReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeWifiOnReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeWifiOnReqSizeof(void *msg); -extern void CsrWifiSmeWifiOnReqSerFree(void *msg); - -extern u8 *CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg); -extern void CsrWifiSmeCloakedSsidsSetReqSerFree(void *msg); - -#define CsrWifiSmeCloakedSsidsGetReqSer CsrWifiEventSer -#define CsrWifiSmeCloakedSsidsGetReqDes CsrWifiEventDes -#define CsrWifiSmeCloakedSsidsGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeCloakedSsidsGetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeSmeCommonConfigGetReqSer CsrWifiEventSer -#define CsrWifiSmeSmeCommonConfigGetReqDes CsrWifiEventDes -#define CsrWifiSmeSmeCommonConfigGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeSmeCommonConfigGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg); -#define CsrWifiSmeSmeCommonConfigSetReqSerFree CsrWifiSmePfree - -#define CsrWifiSmeInterfaceCapabilityGetReqSer CsrWifiEventSer -#define CsrWifiSmeInterfaceCapabilityGetReqDes CsrWifiEventDes -#define CsrWifiSmeInterfaceCapabilityGetReqSizeof CsrWifiEventSizeof -#define CsrWifiSmeInterfaceCapabilityGetReqSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeWpsConfigurationReqSizeof(void *msg); -extern void CsrWifiSmeWpsConfigurationReqSerFree(void *msg); - -extern u8 *CsrWifiSmeSetReqSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeSetReqDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeSetReqSizeof(void *msg); -extern void CsrWifiSmeSetReqSerFree(void *msg); - -#define CsrWifiSmeActivateCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeActivateCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeActivateCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeActivateCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg); -#define CsrWifiSmeAdhocConfigGetCfmSerFree CsrWifiSmePfree - -#define CsrWifiSmeAdhocConfigSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeAdhocConfigSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeAdhocConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeAdhocConfigSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeAssociationCompleteIndSizeof(void *msg); -extern void CsrWifiSmeAssociationCompleteIndSerFree(void *msg); - -extern u8 *CsrWifiSmeAssociationStartIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeAssociationStartIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeAssociationStartIndSizeof(void *msg); -#define CsrWifiSmeAssociationStartIndSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeBlacklistCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeBlacklistCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeBlacklistCfmSizeof(void *msg); -extern void CsrWifiSmeBlacklistCfmSerFree(void *msg); - -extern u8 *CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg); -extern void CsrWifiSmeCalibrationDataGetCfmSerFree(void *msg); - -#define CsrWifiSmeCalibrationDataSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeCalibrationDataSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeCalibrationDataSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeCalibrationDataSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeCcxConfigGetCfmSizeof(void *msg); -#define CsrWifiSmeCcxConfigGetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeCcxConfigSetCfmSizeof(void *msg); -#define CsrWifiSmeCcxConfigSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeCoexConfigGetCfmSizeof(void *msg); -#define CsrWifiSmeCoexConfigGetCfmSerFree CsrWifiSmePfree - -#define CsrWifiSmeCoexConfigSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeCoexConfigSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeCoexConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeCoexConfigSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeCoexInfoGetCfmSizeof(void *msg); -#define CsrWifiSmeCoexInfoGetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeConnectCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeConnectCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeConnectCfmSizeof(void *msg); -#define CsrWifiSmeConnectCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg); -extern void CsrWifiSmeConnectionConfigGetCfmSerFree(void *msg); - -extern u8 *CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg); -extern void CsrWifiSmeConnectionInfoGetCfmSerFree(void *msg); - -extern u8 *CsrWifiSmeConnectionQualityIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeConnectionQualityIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeConnectionQualityIndSizeof(void *msg); -#define CsrWifiSmeConnectionQualityIndSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg); -#define CsrWifiSmeConnectionStatsGetCfmSerFree CsrWifiSmePfree - -#define CsrWifiSmeDeactivateCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeDeactivateCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeDeactivateCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeDeactivateCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeDisconnectCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeDisconnectCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeDisconnectCfmSizeof(void *msg); -#define CsrWifiSmeDisconnectCfmSerFree CsrWifiSmePfree - -#define CsrWifiSmeEventMaskSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeEventMaskSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeEventMaskSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeEventMaskSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeHostConfigGetCfmSizeof(void *msg); -#define CsrWifiSmeHostConfigGetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeHostConfigSetCfmSizeof(void *msg); -#define CsrWifiSmeHostConfigSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeIbssStationIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeIbssStationIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeIbssStationIndSizeof(void *msg); -#define CsrWifiSmeIbssStationIndSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeKeyCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeKeyCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeKeyCfmSizeof(void *msg); -#define CsrWifiSmeKeyCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeLinkQualityGetCfmSizeof(void *msg); -#define CsrWifiSmeLinkQualityGetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeMediaStatusIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeMediaStatusIndSizeof(void *msg); -extern void CsrWifiSmeMediaStatusIndSerFree(void *msg); - -extern u8 *CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeMibConfigGetCfmSizeof(void *msg); -#define CsrWifiSmeMibConfigGetCfmSerFree CsrWifiSmePfree - -#define CsrWifiSmeMibConfigSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeMibConfigSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeMibConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeMibConfigSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeMibGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeMibGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeMibGetCfmSizeof(void *msg); -extern void CsrWifiSmeMibGetCfmSerFree(void *msg); - -extern u8 *CsrWifiSmeMibGetNextCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeMibGetNextCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeMibGetNextCfmSizeof(void *msg); -extern void CsrWifiSmeMibGetNextCfmSerFree(void *msg); - -#define CsrWifiSmeMibSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeMibSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeMibSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeMibSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeMicFailureIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeMicFailureIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeMicFailureIndSizeof(void *msg); -#define CsrWifiSmeMicFailureIndSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeMulticastAddressCfmSizeof(void *msg); -extern void CsrWifiSmeMulticastAddressCfmSerFree(void *msg); - -extern u8 *CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmePacketFilterSetCfmSizeof(void *msg); -#define CsrWifiSmePacketFilterSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, size_t *len, - void *msg); -extern void *CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg); -#define CsrWifiSmePermanentMacAddressGetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmePmkidCandidateListIndSizeof(void *msg); -extern void CsrWifiSmePmkidCandidateListIndSerFree(void *msg); - -extern u8 *CsrWifiSmePmkidCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmePmkidCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmePmkidCfmSizeof(void *msg); -extern void CsrWifiSmePmkidCfmSerFree(void *msg); - -extern u8 *CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmePowerConfigGetCfmSizeof(void *msg); -#define CsrWifiSmePowerConfigGetCfmSerFree CsrWifiSmePfree - -#define CsrWifiSmePowerConfigSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmePowerConfigSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmePowerConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmePowerConfigSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, size_t *len, - void *msg); -extern void *CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg); -#define CsrWifiSmeRegulatoryDomainInfoGetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeRoamCompleteIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeRoamCompleteIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeRoamCompleteIndSizeof(void *msg); -#define CsrWifiSmeRoamCompleteIndSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeRoamStartIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeRoamStartIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeRoamStartIndSizeof(void *msg); -#define CsrWifiSmeRoamStartIndSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg); -#define CsrWifiSmeRoamingConfigGetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg); -#define CsrWifiSmeRoamingConfigSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeScanConfigGetCfmSizeof(void *msg); -extern void CsrWifiSmeScanConfigGetCfmSerFree(void *msg); - -#define CsrWifiSmeScanConfigSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeScanConfigSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeScanConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeScanConfigSetCfmSerFree CsrWifiSmePfree - -#define CsrWifiSmeScanFullCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeScanFullCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeScanFullCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeScanFullCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeScanResultIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeScanResultIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeScanResultIndSizeof(void *msg); -extern void CsrWifiSmeScanResultIndSerFree(void *msg); - -#define CsrWifiSmeScanResultsFlushCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeScanResultsFlushCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeScanResultsFlushCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeScanResultsFlushCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeScanResultsGetCfmSizeof(void *msg); -extern void CsrWifiSmeScanResultsGetCfmSerFree(void *msg); - -extern u8 *CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg); -#define CsrWifiSmeSmeStaConfigGetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg); -#define CsrWifiSmeSmeStaConfigSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, size_t *len, - void *msg); -extern void *CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg); -#define CsrWifiSmeStationMacAddressGetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeTspecIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeTspecIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeTspecIndSizeof(void *msg); -extern void CsrWifiSmeTspecIndSerFree(void *msg); - -extern u8 *CsrWifiSmeTspecCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeTspecCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeTspecCfmSizeof(void *msg); -extern void CsrWifiSmeTspecCfmSerFree(void *msg); - -extern u8 *CsrWifiSmeVersionsGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeVersionsGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeVersionsGetCfmSizeof(void *msg); -extern void CsrWifiSmeVersionsGetCfmSerFree(void *msg); - -#define CsrWifiSmeWifiFlightmodeCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeWifiFlightmodeCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeWifiFlightmodeCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeWifiFlightmodeCfmSerFree CsrWifiSmePfree - -#define CsrWifiSmeWifiOffIndSer CsrWifiEventCsrUint8Ser -#define CsrWifiSmeWifiOffIndDes CsrWifiEventCsrUint8Des -#define CsrWifiSmeWifiOffIndSizeof CsrWifiEventCsrUint8Sizeof -#define CsrWifiSmeWifiOffIndSerFree CsrWifiSmePfree - -#define CsrWifiSmeWifiOffCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeWifiOffCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeWifiOffCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeWifiOffCfmSerFree CsrWifiSmePfree - -#define CsrWifiSmeWifiOnCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeWifiOnCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeWifiOnCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeWifiOnCfmSerFree CsrWifiSmePfree - -#define CsrWifiSmeCloakedSsidsSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeCloakedSsidsSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeCloakedSsidsSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeCloakedSsidsSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg); -extern void CsrWifiSmeCloakedSsidsGetCfmSerFree(void *msg); - -extern u8 *CsrWifiSmeWifiOnIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeWifiOnIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeWifiOnIndSizeof(void *msg); -#define CsrWifiSmeWifiOnIndSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg); -#define CsrWifiSmeSmeCommonConfigGetCfmSerFree CsrWifiSmePfree - -#define CsrWifiSmeSmeCommonConfigSetCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeSmeCommonConfigSetCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeSmeCommonConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeSmeCommonConfigSetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, size_t *len, - void *msg); -extern void *CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg); -#define CsrWifiSmeInterfaceCapabilityGetCfmSerFree CsrWifiSmePfree - -extern u8 *CsrWifiSmeErrorIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeErrorIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeErrorIndSizeof(void *msg); -extern void CsrWifiSmeErrorIndSerFree(void *msg); - -extern u8 *CsrWifiSmeInfoIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeInfoIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeInfoIndSizeof(void *msg); -extern void CsrWifiSmeInfoIndSerFree(void *msg); - -extern u8 *CsrWifiSmeCoreDumpIndSer(u8 *ptr, size_t *len, void *msg); -extern void *CsrWifiSmeCoreDumpIndDes(u8 *buffer, size_t len); -extern size_t CsrWifiSmeCoreDumpIndSizeof(void *msg); -extern void CsrWifiSmeCoreDumpIndSerFree(void *msg); - -#define CsrWifiSmeAmpStatusChangeIndSer CsrWifiEventCsrUint16CsrUint8Ser -#define CsrWifiSmeAmpStatusChangeIndDes CsrWifiEventCsrUint16CsrUint8Des -#define CsrWifiSmeAmpStatusChangeIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof -#define CsrWifiSmeAmpStatusChangeIndSerFree CsrWifiSmePfree - -#define CsrWifiSmeWpsConfigurationCfmSer CsrWifiEventCsrUint16Ser -#define CsrWifiSmeWpsConfigurationCfmDes CsrWifiEventCsrUint16Des -#define CsrWifiSmeWpsConfigurationCfmSizeof CsrWifiEventCsrUint16Sizeof -#define CsrWifiSmeWpsConfigurationCfmSerFree CsrWifiSmePfree - -#endif /* CSR_WIFI_SME_SERIALIZE_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_sme_task.h b/drivers/staging/csr/csr_wifi_sme_task.h deleted file mode 100644 index 1e938c1fa964..000000000000 --- a/drivers/staging/csr/csr_wifi_sme_task.h +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -/* Note: this is an auto-generated file. */ - -#ifndef CSR_WIFI_SME_TASK_H__ -#define CSR_WIFI_SME_TASK_H__ - -#include "csr_sched.h" - -#define CSR_WIFI_SME_LOG_ID 0x1202FFFF -extern CsrSchedQid CSR_WIFI_SME_IFACEQUEUE; -void CsrWifiSmeInit(void **gash); -void CsrWifiSmeDeinit(void **gash); -void CsrWifiSmeHandler(void **gash); - -#endif /* CSR_WIFI_SME_TASK_H__ */ - diff --git a/drivers/staging/csr/csr_wifi_vif_utils.h b/drivers/staging/csr/csr_wifi_vif_utils.h deleted file mode 100644 index 8ff97888996d..000000000000 --- a/drivers/staging/csr/csr_wifi_vif_utils.h +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2011 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifndef CSR_WIFI_VIF_UTILS_H -#define CSR_WIFI_VIF_UTILS_H - -/* STANDARD INCLUDES ********************************************************/ - -/* PROJECT INCLUDES *********************************************************/ -/* including this file for CsrWifiInterfaceMode*/ -#include "csr_wifi_private_common.h" - -/* MACROS *******************************************************************/ - -/* Common macros for NME and SME to be used temporarily until SoftMAC changes are made */ -#define CSR_WIFI_NUM_INTERFACES (u8)0x1 -#define CSR_WIFI_INTERFACE_IN_USE (u16)0x0 - -#endif /* CSR_WIFI_VIF_UTILS_H */ - diff --git a/drivers/staging/csr/data_tx.c b/drivers/staging/csr/data_tx.c deleted file mode 100644 index 9e3d8b8ab02c..000000000000 --- a/drivers/staging/csr/data_tx.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: data_tx.c - * - * PURPOSE: - * This file provides functions to send data requests to the UniFi. - * - * Copyright (C) 2007-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#include "csr_wifi_hip_unifi.h" -#include "unifi_priv.h" - -int -uf_verify_m4(unifi_priv_t *priv, const unsigned char *packet, unsigned int length) -{ - const unsigned char *p = packet; - u16 keyinfo; - - - if (length < (4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 1 + 8)) - return 1; - - p += 8; - keyinfo = p[5] << 8 | p[6]; /* big-endian */ - if ( - (p[0] == 1 || p[0] == 2) /* protocol version 802.1X-2001 (WPA) or -2004 (WPA2) */ && - p[1] == 3 /* EAPOL-Key */ && - /* don't bother checking p[2] p[3] (hh ll, packet body length) */ - (p[4] == 254 || p[4] == 2) /* descriptor type P802.1i-D3.0 (WPA) or 802.11i-2004 (WPA2) */ && - ((keyinfo & 0x0007) == 1 || (keyinfo & 0x0007) == 2) /* key descriptor version */ && - (keyinfo & ~0x0207U) == 0x0108 && /* key info for 4/4 or 4/2 -- ignore key desc version and sec bit (since varies in WPA 4/4) */ - (p[4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 0] == 0 && /* key data length (2 octets) 0 for 4/4 only */ - p[4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 1] == 0) - ) { - unifi_trace(priv, UDBG1, "uf_verify_m4: M4 detected\n"); - return 0; - } else { - return 1; - } -} - -/* - * --------------------------------------------------------------------------- - * - * Data transport signals. - * - * --------------------------------------------------------------------------- - */ - diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c deleted file mode 100644 index 92898de921f5..000000000000 --- a/drivers/staging/csr/drv.c +++ /dev/null @@ -1,2193 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: drv.c - * - * PURPOSE: - * Conventional device interface for debugging/monitoring of the - * driver and h/w using unicli. This interface is also being used - * by the SME linux implementation and the helper apps. - * - * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ - -/* - * Porting Notes: - * Part of this file contains an example for how to glue the OS layer - * with the HIP core lib, the SDIO glue layer, and the SME. - * - * When the unifi_sdio.ko modules loads, the linux kernel calls unifi_load(). - * unifi_load() calls uf_sdio_load() which is exported by the SDIO glue - * layer. uf_sdio_load() registers this driver with the underlying SDIO driver. - * When a card is detected, the SDIO glue layer calls register_unifi_sdio() - * to pass the SDIO function context and ask the OS layer to initialise - * the card. register_unifi_sdio() allocates all the private data of the OS - * layer and calls uf_run_unifihelper() to start the SME. The SME calls - * unifi_sys_wifi_on_req() which uses the HIP core lib to initialise the card. - */ - -#include <linux/init.h> -#include <linux/slab.h> -#include <linux/poll.h> -#include <asm/uaccess.h> -#include <linux/jiffies.h> -#include <linux/version.h> - -#include "csr_wifi_hip_unifiversion.h" -#include "unifi_priv.h" -#include "csr_wifi_hip_conversions.h" -#include "unifi_native.h" - -/* Module parameter variables */ -int buswidth = 0; /* 0 means use default, values 1,4 */ -int sdio_clock = 50000; /* kHz */ -int unifi_debug = 0; -/* fw_init prevents f/w initialisation on error. */ -int fw_init[MAX_UNIFI_DEVS] = {-1, -1}; -int use_5g = 0; -int led_mask = 0; /* 0x0c00 for dev-pc-1503c, dev-pc-1528a */ -int disable_hw_reset = 0; -int disable_power_control = 0; -int enable_wol = UNIFI_WOL_OFF; /* 0 for none, 1 for SDIO IRQ, 2 for PIO */ -#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) -int tl_80211d = (int)CSR_WIFI_SME_80211D_TRUST_LEVEL_MIB; -#endif -int sdio_block_size = -1; /* Override SDIO block size */ -int sdio_byte_mode = 0; /* 0 for block mode + padding, 1 for byte mode */ -int coredump_max = CSR_WIFI_HIP_NUM_COREDUMP_BUFFERS; -int run_bh_once = -1; /* Set for scheduled interrupt mode, -1 = default */ -int bh_priority = -1; -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -#define UNIFI_LOG_HIP_SIGNALS_FILTER_BULKDATA (1 << 1) -#define UNIFI_LOG_HIP_SIGNALS_FILTER_TIMESTAMP (1 << 2) -int log_hip_signals = 0; -#endif - -MODULE_DESCRIPTION("CSR UniFi (SDIO)"); - -module_param(buswidth, int, S_IRUGO|S_IWUSR); -module_param(sdio_clock, int, S_IRUGO|S_IWUSR); -module_param(unifi_debug, int, S_IRUGO|S_IWUSR); -module_param_array(fw_init, int, NULL, S_IRUGO|S_IWUSR); -module_param(use_5g, int, S_IRUGO|S_IWUSR); -module_param(led_mask, int, S_IRUGO|S_IWUSR); -module_param(disable_hw_reset, int, S_IRUGO|S_IWUSR); -module_param(disable_power_control, int, S_IRUGO|S_IWUSR); -module_param(enable_wol, int, S_IRUGO|S_IWUSR); -#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) -module_param(tl_80211d, int, S_IRUGO|S_IWUSR); -#endif -module_param(sdio_block_size, int, S_IRUGO|S_IWUSR); -module_param(sdio_byte_mode, int, S_IRUGO|S_IWUSR); -module_param(coredump_max, int, S_IRUGO|S_IWUSR); -module_param(run_bh_once, int, S_IRUGO|S_IWUSR); -module_param(bh_priority, int, S_IRUGO|S_IWUSR); -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -module_param(log_hip_signals, int, S_IRUGO|S_IWUSR); -#endif - -MODULE_PARM_DESC(buswidth, "SDIO bus width (0=default), set 1 for 1-bit or 4 for 4-bit mode"); -MODULE_PARM_DESC(sdio_clock, "SDIO bus frequency in kHz, (default = 50 MHz)"); -MODULE_PARM_DESC(unifi_debug, "Diagnostic reporting level"); -MODULE_PARM_DESC(fw_init, "Set to 0 to prevent f/w initialization on error"); -MODULE_PARM_DESC(use_5g, "Use the 5G (802.11a) radio band"); -MODULE_PARM_DESC(led_mask, "LED mask flags"); -MODULE_PARM_DESC(disable_hw_reset, "Set to 1 to disable hardware reset"); -MODULE_PARM_DESC(disable_power_control, "Set to 1 to disable SDIO power control"); -MODULE_PARM_DESC(enable_wol, "Enable wake-on-wlan function 0=off, 1=SDIO, 2=PIO"); -#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) -MODULE_PARM_DESC(tl_80211d, "802.11d Trust Level (1-6, default = 5)"); -#endif -MODULE_PARM_DESC(sdio_block_size, "Set to override SDIO block size"); -MODULE_PARM_DESC(sdio_byte_mode, "Set to 1 for byte mode SDIO"); -MODULE_PARM_DESC(coredump_max, "Number of chip mini-coredump buffers to allocate"); -MODULE_PARM_DESC(run_bh_once, "Run BH only when firmware interrupts"); -MODULE_PARM_DESC(bh_priority, "Modify the BH thread priority"); -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -MODULE_PARM_DESC(log_hip_signals, "Set to 1 to enable HIP signal offline logging"); -#endif - - -/* Callback for event logging to UDI clients */ -static void udi_log_event(ul_client_t *client, - const u8 *signal, int signal_len, - const bulk_data_param_t *bulkdata, - int dir); - -static void udi_set_log_filter(ul_client_t *pcli, - unifiio_filter_t *udi_filter); - - -/* Mutex to protect access to priv->sme_cli */ -DEFINE_SEMAPHORE(udi_mutex); - -s32 CsrHipResultToStatus(CsrResult csrResult) -{ - s32 r = -EIO; - - switch (csrResult) - { - case CSR_RESULT_SUCCESS: - r = 0; - break; - case CSR_WIFI_HIP_RESULT_RANGE: - r = -ERANGE; - break; - case CSR_WIFI_HIP_RESULT_NO_DEVICE: - r = -ENODEV; - break; - case CSR_WIFI_HIP_RESULT_INVALID_VALUE: - r = -EINVAL; - break; - case CSR_WIFI_HIP_RESULT_NOT_FOUND: - r = -ENOENT; - break; - case CSR_WIFI_HIP_RESULT_NO_SPACE: - r = -ENOSPC; - break; - case CSR_WIFI_HIP_RESULT_NO_MEMORY: - r = -ENOMEM; - break; - case CSR_RESULT_FAILURE: - r = -EIO; - break; - default: - /*unifi_warning(card->ospriv, "CsrHipResultToStatus: Unrecognised csrResult error code: %d\n", csrResult);*/ - r = -EIO; - } - return r; -} - - -static const char* -trace_putest_cmdid(unifi_putest_command_t putest_cmd) -{ - switch (putest_cmd) { - case UNIFI_PUTEST_START: - return "START"; - case UNIFI_PUTEST_STOP: - return "STOP"; - case UNIFI_PUTEST_SET_SDIO_CLOCK: - return "SET CLOCK"; - case UNIFI_PUTEST_CMD52_READ: - return "CMD52R"; - case UNIFI_PUTEST_CMD52_BLOCK_READ: - return "CMD52BR"; - case UNIFI_PUTEST_CMD52_WRITE: - return "CMD52W"; - case UNIFI_PUTEST_DL_FW: - return "D/L FW"; - case UNIFI_PUTEST_DL_FW_BUFF: - return "D/L FW BUFFER"; - case UNIFI_PUTEST_COREDUMP_PREPARE: - return "PREPARE COREDUMP"; - case UNIFI_PUTEST_GP_READ16: - return "GP16R"; - case UNIFI_PUTEST_GP_WRITE16: - return "GP16W"; - default: - return "ERROR: unrecognised command"; - } - } - -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -int uf_register_hip_offline_debug(unifi_priv_t *priv) -{ - ul_client_t *udi_cli; - int i; - - udi_cli = ul_register_client(priv, CLI_USING_WIRE_FORMAT, udi_log_event); - if (udi_cli == NULL) { - /* Too many clients already using this device */ - unifi_error(priv, "Too many UDI clients already open\n"); - return -ENOSPC; - } - unifi_trace(priv, UDBG1, "Offline HIP client is registered\n"); - - down(&priv->udi_logging_mutex); - udi_cli->event_hook = udi_log_event; - unifi_set_udi_hook(priv->card, logging_handler); - /* Log all signals by default */ - for (i = 0; i < SIG_FILTER_SIZE; i++) { - udi_cli->signal_filter[i] = 0xFFFF; - } - priv->logging_client = udi_cli; - up(&priv->udi_logging_mutex); - - return 0; -} - -int uf_unregister_hip_offline_debug(unifi_priv_t *priv) -{ - ul_client_t *udi_cli = priv->logging_client; - if (udi_cli == NULL) - { - unifi_error(priv, "Unknown HIP client unregister request\n"); - return -ERANGE; - } - - unifi_trace(priv, UDBG1, "Offline HIP client is unregistered\n"); - - down(&priv->udi_logging_mutex); - priv->logging_client = NULL; - udi_cli->event_hook = NULL; - up(&priv->udi_logging_mutex); - - ul_deregister_client(udi_cli); - - return 0; -} -#endif - - -/* - * --------------------------------------------------------------------------- - * unifi_open - * unifi_release - * - * Open and release entry points for the UniFi debug driver. - * - * Arguments: - * Normal linux driver args. - * - * Returns: - * Linux error code. - * --------------------------------------------------------------------------- - */ -static int -unifi_open(struct inode *inode, struct file *file) -{ - int devno; - unifi_priv_t *priv; - ul_client_t *udi_cli; - - devno = MINOR(inode->i_rdev) >> 1; - - /* - * Increase the ref_count for the char device clients. - * Make sure you call uf_put_instance() to decreace it if - * unifi_open returns an error. - */ - priv = uf_get_instance(devno); - if (priv == NULL) { - unifi_error(NULL, "unifi_open: No device present\n"); - return -ENODEV; - } - - /* Register this instance in the client's list. */ - /* The minor number determines the nature of the client (Unicli or SME). */ - if (MINOR(inode->i_rdev) & 0x1) { - udi_cli = ul_register_client(priv, CLI_USING_WIRE_FORMAT, udi_log_event); - if (udi_cli == NULL) { - /* Too many clients already using this device */ - unifi_error(priv, "Too many clients already open\n"); - uf_put_instance(devno); - return -ENOSPC; - } - unifi_trace(priv, UDBG1, "Client is registered to /dev/unifiudi%d\n", devno); - } else { - /* - * Even-numbered device nodes are the control application. - * This is the userspace helper containing SME or - * unifi_manager. - */ - - down(&udi_mutex); - -#ifdef CSR_SME_USERSPACE - /* Check if a config client is already attached */ - if (priv->sme_cli) { - up(&udi_mutex); - uf_put_instance(devno); - - unifi_info(priv, "There is already a configuration client using the character device\n"); - return -EBUSY; - } -#endif /* CSR_SME_USERSPACE */ - -#ifdef CSR_SUPPORT_SME - udi_cli = ul_register_client(priv, - CLI_USING_WIRE_FORMAT | CLI_SME_USERSPACE, - sme_log_event); -#else - /* Config client for native driver */ - udi_cli = ul_register_client(priv, - 0, - sme_native_log_event); -#endif - if (udi_cli == NULL) { - /* Too many clients already using this device */ - up(&udi_mutex); - uf_put_instance(devno); - - unifi_error(priv, "Too many clients already open\n"); - return -ENOSPC; - } - - /* - * Fill-in the pointer to the configuration client. - * This is the SME userspace helper or unifi_manager. - * Not used in the SME embedded version. - */ - unifi_trace(priv, UDBG1, "SME client (id:%d s:0x%X) is registered\n", - udi_cli->client_id, udi_cli->sender_id); - /* Store the SME UniFi Linux Client */ - if (priv->sme_cli == NULL) { - priv->sme_cli = udi_cli; - } - - up(&udi_mutex); - } - - - /* - * Store the pointer to the client. - * All char driver's entry points will pass this pointer. - */ - file->private_data = udi_cli; - - return 0; -} /* unifi_open() */ - - -static int -unifi_release(struct inode *inode, struct file *filp) -{ - ul_client_t *udi_cli = (void*)filp->private_data; - int devno; - unifi_priv_t *priv; - - priv = uf_find_instance(udi_cli->instance); - if (!priv) { - unifi_error(priv, "unifi_close: instance for device not found\n"); - return -ENODEV; - } - - devno = MINOR(inode->i_rdev) >> 1; - - /* Even device nodes are the config client (i.e. SME or unifi_manager) */ - if ((MINOR(inode->i_rdev) & 0x1) == 0) { - - if (priv->sme_cli != udi_cli) { - unifi_notice(priv, "Surprise closing config device: not the sme client\n"); - } - unifi_notice(priv, "SME client close (unifi%d)\n", devno); - - /* - * Clear sme_cli before calling unifi_sys_... so it doesn't try to - * queue a reply to the (now gone) SME. - */ - down(&udi_mutex); - priv->sme_cli = NULL; - up(&udi_mutex); - -#ifdef CSR_SME_USERSPACE - /* Power-down when config client closes */ - { - CsrWifiRouterCtrlWifiOffReq req = {{CSR_WIFI_ROUTER_CTRL_HIP_REQ, 0, 0, 0, NULL}}; - CsrWifiRouterCtrlWifiOffReqHandler(priv, &req.common); - } - - uf_sme_deinit(priv); - - /* It is possible that a blocking SME request was made from another process - * which did not get read by the SME before the WifiOffReq. - * So check for a pending request which will go unanswered and cancel - * the wait for event. As only one blocking request can be in progress at - * a time, up to one event should be completed. - */ - uf_sme_cancel_request(priv, 0); - -#endif /* CSR_SME_USERSPACE */ - } else { - - unifi_trace(priv, UDBG2, "UDI client close (unifiudi%d)\n", devno); - - /* If the pointer matches the logging client, stop logging. */ - down(&priv->udi_logging_mutex); - if (udi_cli == priv->logging_client) { - priv->logging_client = NULL; - } - up(&priv->udi_logging_mutex); - - if (udi_cli == priv->amp_client) { - priv->amp_client = NULL; - } - } - - /* Deregister this instance from the client's list. */ - ul_deregister_client(udi_cli); - - uf_put_instance(devno); - - return 0; -} /* unifi_release() */ - - - -/* - * --------------------------------------------------------------------------- - * unifi_read - * - * The read() driver entry point. - * - * Arguments: - * filp The file descriptor returned by unifi_open() - * p The user space buffer to copy the read data - * len The size of the p buffer - * poff - * - * Returns: - * number of bytes read or an error code on failure - * --------------------------------------------------------------------------- - */ -static ssize_t -unifi_read(struct file *filp, char *p, size_t len, loff_t *poff) -{ - ul_client_t *pcli = (void*)filp->private_data; - unifi_priv_t *priv; - udi_log_t *logptr = NULL; - udi_msg_t *msgptr; - struct list_head *l; - int msglen; - - priv = uf_find_instance(pcli->instance); - if (!priv) { - unifi_error(priv, "invalid priv\n"); - return -ENODEV; - } - - if (!pcli->udi_enabled) { - unifi_error(priv, "unifi_read: unknown client."); - return -EINVAL; - } - - if (list_empty(&pcli->udi_log)) { - if (filp->f_flags & O_NONBLOCK) { - /* Non-blocking - just return if the udi_log is empty */ - return 0; - } else { - /* Blocking - wait on the UDI wait queue */ - if (wait_event_interruptible(pcli->udi_wq, - !list_empty(&pcli->udi_log))) - { - unifi_error(priv, "unifi_read: wait_event_interruptible failed."); - return -ERESTARTSYS; - } - } - } - - /* Read entry from list head and remove it from the list */ - if (down_interruptible(&pcli->udi_sem)) { - return -ERESTARTSYS; - } - l = pcli->udi_log.next; - list_del(l); - up(&pcli->udi_sem); - - /* Get a pointer to whole struct */ - logptr = list_entry(l, udi_log_t, q); - if (logptr == NULL) { - unifi_error(priv, "unifi_read: failed to get event.\n"); - return -EINVAL; - } - - /* Get the real message */ - msgptr = &logptr->msg; - msglen = msgptr->length; - if (msglen > len) { - printk(KERN_WARNING "truncated read to %d actual msg len is %lu\n", msglen, (long unsigned int)len); - msglen = len; - } - - /* and pass it to the client (SME or Unicli). */ - if (copy_to_user(p, msgptr, msglen)) - { - printk(KERN_ERR "Failed to copy UDI log to user\n"); - kfree(logptr); - return -EFAULT; - } - - /* It is our resposibility to free the message buffer. */ - kfree(logptr); - - return msglen; - -} /* unifi_read() */ - - - -/* - * --------------------------------------------------------------------------- - * udi_send_signal_unpacked - * - * Sends an unpacked signal to UniFi. - * - * Arguments: - * priv Pointer to private context struct - * data Pointer to request structure and data to send - * data_len Length of data in data pointer. - * - * Returns: - * Number of bytes written, error otherwise. - * - * Notes: - * All clients that use this function to send a signal to the unifi - * must use the host formatted structures. - * --------------------------------------------------------------------------- - */ -static int -udi_send_signal_unpacked(unifi_priv_t *priv, unsigned char* data, uint data_len) -{ - CSR_SIGNAL *sigptr = (CSR_SIGNAL*)data; - CSR_DATAREF *datarefptr; - bulk_data_param_t bulk_data; - uint signal_size, i; - uint bulk_data_offset = 0; - int bytecount, r; - CsrResult csrResult; - - /* Number of bytes in the signal */ - signal_size = SigGetSize(sigptr); - if (!signal_size || (signal_size > data_len)) { - unifi_error(priv, "unifi_sme_mlme_req - Invalid signal 0x%x size should be %d bytes\n", - sigptr->SignalPrimitiveHeader.SignalId, - signal_size); - return -EINVAL; - } - bytecount = signal_size; - - /* Get a pointer to the information of the first data reference */ - datarefptr = (CSR_DATAREF*)&sigptr->u; - - /* Initialize the offset in the data buffer, bulk data is right after the signal. */ - bulk_data_offset = signal_size; - - /* store the references and the size of the bulk data to the bulkdata structure */ - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - /* the length of the bulk data is in the signal */ - if ((datarefptr+i)->DataLength) { - void *dest; - - csrResult = unifi_net_data_malloc(priv, &bulk_data.d[i], (datarefptr+i)->DataLength); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "udi_send_signal_unpacked: failed to allocate request_data.\n"); - return -EIO; - } - - dest = (void*)bulk_data.d[i].os_data_ptr; - memcpy(dest, data + bulk_data_offset, bulk_data.d[i].data_length); - } else { - bulk_data.d[i].data_length = 0; - } - - bytecount += bulk_data.d[i].data_length; - /* advance the offset, to point the next bulk data */ - bulk_data_offset += bulk_data.d[i].data_length; - } - - - unifi_trace(priv, UDBG3, "SME Send: signal 0x%.4X\n", sigptr->SignalPrimitiveHeader.SignalId); - - /* Send the signal. */ - r = ul_send_signal_unpacked(priv, sigptr, &bulk_data); - if (r < 0) { - unifi_error(priv, "udi_send_signal_unpacked: send failed (%d)\n", r); - for(i=0;i<UNIFI_MAX_DATA_REFERENCES;i++) { - if(bulk_data.d[i].data_length != 0) { - unifi_net_data_free(priv, &bulk_data.d[i]); - } - } - return -EIO; - } - - return bytecount; -} /* udi_send_signal_unpacked() */ - - - -/* - * --------------------------------------------------------------------------- - * udi_send_signal_raw - * - * Sends a packed signal to UniFi. - * - * Arguments: - * priv Pointer to private context struct - * buf Pointer to request structure and data to send - * buflen Length of data in data pointer. - * - * Returns: - * Number of bytes written, error otherwise. - * - * Notes: - * All clients that use this function to send a signal to the unifi - * must use the wire formatted structures. - * --------------------------------------------------------------------------- - */ -static int -udi_send_signal_raw(unifi_priv_t *priv, unsigned char *buf, int buflen) -{ - int signal_size; - int sig_id; - bulk_data_param_t data_ptrs; - int i, r; - unsigned int num_data_refs; - int bytecount; - CsrResult csrResult; - - /* - * The signal is the first thing in buf, the signal id is the - * first 16 bits of the signal. - */ - /* Number of bytes in the signal */ - sig_id = GET_SIGNAL_ID(buf); - signal_size = buflen; - signal_size -= GET_PACKED_DATAREF_LEN(buf, 0); - signal_size -= GET_PACKED_DATAREF_LEN(buf, 1); - if ((signal_size <= 0) || (signal_size > buflen)) { - unifi_error(priv, "udi_send_signal_raw - Couldn't find length of signal 0x%x\n", - sig_id); - return -EINVAL; - } - unifi_trace(priv, UDBG2, "udi_send_signal_raw: signal 0x%.4X len:%d\n", - sig_id, signal_size); - /* Zero the data ref arrays */ - memset(&data_ptrs, 0, sizeof(data_ptrs)); - - /* - * Find the number of associated bulk data packets. Scan through - * the data refs to check that we have enough data and pick out - * pointers to appended bulk data. - */ - num_data_refs = 0; - bytecount = signal_size; - - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i) - { - unsigned int len = GET_PACKED_DATAREF_LEN(buf, i); - unifi_trace(priv, UDBG3, "udi_send_signal_raw: data_ref length = %d\n", len); - - if (len != 0) { - void *dest; - - csrResult = unifi_net_data_malloc(priv, &data_ptrs.d[i], len); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "udi_send_signal_raw: failed to allocate request_data.\n"); - return -EIO; - } - - dest = (void*)data_ptrs.d[i].os_data_ptr; - memcpy(dest, buf + bytecount, len); - - bytecount += len; - num_data_refs++; - } - data_ptrs.d[i].data_length = len; - } - - unifi_trace(priv, UDBG3, "Queueing signal 0x%.4X from UDI with %u data refs\n", - sig_id, - num_data_refs); - - if (bytecount > buflen) { - unifi_error(priv, "udi_send_signal_raw: Not enough data (%d instead of %d)\n", buflen, bytecount); - return -EINVAL; - } - - /* Send the signal calling the function that uses the wire-formatted signals. */ - r = ul_send_signal_raw(priv, buf, signal_size, &data_ptrs); - if (r < 0) { - unifi_error(priv, "udi_send_signal_raw: send failed (%d)\n", r); - return -EIO; - } - -#ifdef CSR_NATIVE_LINUX - if (sig_id == CSR_MLME_POWERMGT_REQUEST_ID) { - int power_mode = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((buf + - SIZEOF_SIGNAL_HEADER + (UNIFI_MAX_DATA_REFERENCES*SIZEOF_DATAREF))); -#ifdef CSR_SUPPORT_WEXT - /* Overide the wext power mode to the new value */ - priv->wext_conf.power_mode = power_mode; -#endif - /* Configure deep sleep signaling */ - if (power_mode || (priv->interfacePriv[0]->connected == UnifiNotConnected)) { - csrResult = unifi_configure_low_power_mode(priv->card, - UNIFI_LOW_POWER_ENABLED, - UNIFI_PERIODIC_WAKE_HOST_DISABLED); - } else { - csrResult = unifi_configure_low_power_mode(priv->card, - UNIFI_LOW_POWER_DISABLED, - UNIFI_PERIODIC_WAKE_HOST_DISABLED); - } - } -#endif - - return bytecount; -} /* udi_send_signal_raw */ - -/* - * --------------------------------------------------------------------------- - * unifi_write - * - * The write() driver entry point. - * A UniFi Debug Interface client such as unicli can write a signal - * plus bulk data to the driver for sending to the UniFi chip. - * - * Only one signal may be sent per write operation. - * - * Arguments: - * filp The file descriptor returned by unifi_open() - * p The user space buffer to get the data from - * len The size of the p buffer - * poff - * - * Returns: - * number of bytes written or an error code on failure - * --------------------------------------------------------------------------- - */ -static ssize_t -unifi_write(struct file *filp, const char *p, size_t len, loff_t *poff) -{ - ul_client_t *pcli = (ul_client_t*)filp->private_data; - unifi_priv_t *priv; - unsigned char *buf; - unsigned char *bufptr; - int remaining; - int bytes_written; - int r; - bulk_data_param_t bulkdata; - CsrResult csrResult; - - priv = uf_find_instance(pcli->instance); - if (!priv) { - unifi_error(priv, "invalid priv\n"); - return -ENODEV; - } - - unifi_trace(priv, UDBG5, "unifi_write: len = %d\n", len); - - if (!pcli->udi_enabled) { - unifi_error(priv, "udi disabled\n"); - return -EINVAL; - } - - /* - * AMP client sends only one signal at a time, so we can use - * unifi_net_data_malloc to save the extra copy. - */ - if (pcli == priv->amp_client) { - int signal_size; - int sig_id; - unsigned char *signal_buf; - char *user_data_buf; - - csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], len); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "unifi_write: failed to allocate request_data.\n"); - return -ENOMEM; - } - - user_data_buf = (char*)bulkdata.d[0].os_data_ptr; - - /* Get the data from the AMP client. */ - if (copy_from_user((void*)user_data_buf, p, len)) { - unifi_error(priv, "unifi_write: copy from user failed\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - return -EFAULT; - } - - bulkdata.d[1].os_data_ptr = NULL; - bulkdata.d[1].data_length = 0; - - /* Number of bytes in the signal */ - sig_id = GET_SIGNAL_ID(bulkdata.d[0].os_data_ptr); - signal_size = len; - signal_size -= GET_PACKED_DATAREF_LEN(bulkdata.d[0].os_data_ptr, 0); - signal_size -= GET_PACKED_DATAREF_LEN(bulkdata.d[0].os_data_ptr, 1); - if ((signal_size <= 0) || (signal_size > len)) { - unifi_error(priv, "unifi_write - Couldn't find length of signal 0x%x\n", - sig_id); - unifi_net_data_free(priv, &bulkdata.d[0]); - return -EINVAL; - } - - unifi_trace(priv, UDBG2, "unifi_write: signal 0x%.4X len:%d\n", - sig_id, signal_size); - - /* Allocate a buffer for the signal */ - signal_buf = kmemdup(bulkdata.d[0].os_data_ptr, signal_size, - GFP_KERNEL); - if (!signal_buf) { - unifi_net_data_free(priv, &bulkdata.d[0]); - return -ENOMEM; - } - - /* Get the signal from the os_data_ptr */ - signal_buf[5] = (pcli->sender_id >> 8) & 0xff; - - if (signal_size < len) { - /* Remove the signal from the os_data_ptr */ - bulkdata.d[0].data_length -= signal_size; - bulkdata.d[0].os_data_ptr += signal_size; - } else { - bulkdata.d[0].data_length = 0; - bulkdata.d[0].os_data_ptr = NULL; - } - - /* Send the signal calling the function that uses the wire-formatted signals. */ - r = ul_send_signal_raw(priv, signal_buf, signal_size, &bulkdata); - if (r < 0) { - unifi_error(priv, "unifi_write: send failed (%d)\n", r); - if (bulkdata.d[0].os_data_ptr != NULL) { - unifi_net_data_free(priv, &bulkdata.d[0]); - } - } - - /* Free the signal buffer and return */ - kfree(signal_buf); - return len; - } - - buf = kmalloc(len, GFP_KERNEL); - if (!buf) { - return -ENOMEM; - } - - /* Get the data from the client (SME or Unicli). */ - if (copy_from_user((void*)buf, p, len)) { - unifi_error(priv, "copy from user failed\n"); - kfree(buf); - return -EFAULT; - } - - /* - * In SME userspace build read() contains a SYS or MGT message. - * Note that even though the SME sends one signal at a time, we can not - * use unifi_net_data_malloc because in the early stages, before having - * initialised the core, it will fail since the I/O block size is unknown. - */ -#ifdef CSR_SME_USERSPACE - if (pcli->configuration & CLI_SME_USERSPACE) { - CsrWifiRouterTransportRecv(priv, buf, len); - kfree(buf); - return len; - } -#endif - - /* ul_send_signal_raw will do a sanity check of len against signal content */ - - /* - * udi_send_signal_raw() and udi_send_signal_unpacked() return the number of bytes consumed. - * A write call can pass multiple signal concatenated together. - */ - bytes_written = 0; - remaining = len; - bufptr = buf; - while (remaining > 0) - { - int r; - - /* - * Set the SenderProcessId. - * The SignalPrimitiveHeader is the first 3 16-bit words of the signal, - * the SenderProcessId is bytes 4,5. - * The MSB of the sender ID needs to be set to the client ID. - * The LSB is controlled by the SME. - */ - bufptr[5] = (pcli->sender_id >> 8) & 0xff; - - /* use the appropriate interface, depending on the clients' configuration */ - if (pcli->configuration & CLI_USING_WIRE_FORMAT) { - unifi_trace(priv, UDBG1, "unifi_write: call udi_send_signal().\n"); - r = udi_send_signal_raw(priv, bufptr, remaining); - } else { - r = udi_send_signal_unpacked(priv, bufptr, remaining); - } - if (r < 0) { - /* Set the return value to the error code */ - unifi_error(priv, "unifi_write: (udi or sme)_send_signal() returns %d\n", r); - bytes_written = r; - break; - } - bufptr += r; - remaining -= r; - bytes_written += r; - } - - kfree(buf); - - return bytes_written; -} /* unifi_write() */ - - -static const char* build_type_to_string(unsigned char build_type) -{ - switch (build_type) - { - case UNIFI_BUILD_NME: return "NME"; - case UNIFI_BUILD_WEXT: return "WEXT"; - case UNIFI_BUILD_AP: return "AP"; - } - return "unknown"; -} - - -/* - * ---------------------------------------------------------------- - * unifi_ioctl - * - * Ioctl handler for unifi driver. - * - * Arguments: - * inodep Pointer to inode structure. - * filp Pointer to file structure. - * cmd Ioctl cmd passed by user. - * arg Ioctl arg passed by user. - * - * Returns: - * 0 on success, -ve error code on error. - * ---------------------------------------------------------------- - */ -static long -unifi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) -{ - ul_client_t *pcli = (ul_client_t*)filp->private_data; - unifi_priv_t *priv; - struct net_device *dev; - int r = 0; - int int_param, i; - u8* buf; - CsrResult csrResult; -#if (defined CSR_SUPPORT_SME) - unifi_cfg_command_t cfg_cmd; -#if (defined CSR_SUPPORT_WEXT) - CsrWifiSmeCoexConfig coex_config; - unsigned char uchar_param; - unsigned char varbind[MAX_VARBIND_LENGTH]; - int vblen; -#endif -#endif - unifi_putest_command_t putest_cmd; - - priv = uf_find_instance(pcli->instance); - if (!priv) { - unifi_error(priv, "ioctl error: unknown instance=%d\n", pcli->instance); - r = -ENODEV; - goto out; - } - unifi_trace(priv, UDBG5, "unifi_ioctl: cmd=0x%X, arg=0x%lX\n", cmd, arg); - - switch (cmd) { - - case UNIFI_GET_UDI_ENABLE: - unifi_trace(priv, UDBG4, "UniFi Get UDI Enable\n"); - - down(&priv->udi_logging_mutex); - int_param = (priv->logging_client == NULL) ? 0 : 1; - up(&priv->udi_logging_mutex); - - if (put_user(int_param, (int*)arg)) - { - unifi_error(priv, "UNIFI_GET_UDI_ENABLE: Failed to copy to user\n"); - r = -EFAULT; - goto out; - } - break; - - case UNIFI_SET_UDI_ENABLE: - unifi_trace(priv, UDBG4, "UniFi Set UDI Enable\n"); - if (get_user(int_param, (int*)arg)) - { - unifi_error(priv, "UNIFI_SET_UDI_ENABLE: Failed to copy from user\n"); - r = -EFAULT; - goto out; - } - -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE - if (log_hip_signals) { - unifi_error(priv, "omnicli cannot be used when log_hip_signals is used\n"); - r = -EFAULT; - goto out; - } -#endif - - down(&priv->udi_logging_mutex); - if (int_param) { - pcli->event_hook = udi_log_event; - unifi_set_udi_hook(priv->card, logging_handler); - /* Log all signals by default */ - for (i = 0; i < SIG_FILTER_SIZE; i++) { - pcli->signal_filter[i] = 0xFFFF; - } - priv->logging_client = pcli; - - } else { - priv->logging_client = NULL; - pcli->event_hook = NULL; - } - up(&priv->udi_logging_mutex); - - break; - - case UNIFI_SET_MIB: - unifi_trace(priv, UDBG4, "UniFi Set MIB\n"); -#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) - /* Read first 2 bytes and check length */ - if (copy_from_user((void*)varbind, (void*)arg, 2)) { - unifi_error(priv, - "UNIFI_SET_MIB: Failed to copy in varbind header\n"); - r = -EFAULT; - goto out; - } - vblen = varbind[1]; - if ((vblen + 2) > MAX_VARBIND_LENGTH) { - unifi_error(priv, - "UNIFI_SET_MIB: Varbind too long (%d, limit %d)\n", - (vblen+2), MAX_VARBIND_LENGTH); - r = -EINVAL; - goto out; - } - /* Read rest of varbind */ - if (copy_from_user((void*)(varbind+2), (void*)(arg+2), vblen)) { - unifi_error(priv, "UNIFI_SET_MIB: Failed to copy in varbind\n"); - r = -EFAULT; - goto out; - } - - /* send to SME */ - vblen += 2; - r = sme_mgt_mib_set(priv, varbind, vblen); - if (r) { - goto out; - } -#else - unifi_notice(priv, "UNIFI_SET_MIB: Unsupported.\n"); -#endif /* CSR_SUPPORT_WEXT */ - break; - - case UNIFI_GET_MIB: - unifi_trace(priv, UDBG4, "UniFi Get MIB\n"); -#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) - /* Read first 2 bytes and check length */ - if (copy_from_user((void*)varbind, (void*)arg, 2)) { - unifi_error(priv, "UNIFI_GET_MIB: Failed to copy in varbind header\n"); - r = -EFAULT; - goto out; - } - vblen = varbind[1]; - if ((vblen+2) > MAX_VARBIND_LENGTH) { - unifi_error(priv, "UNIFI_GET_MIB: Varbind too long (%d, limit %d)\n", - (vblen+2), MAX_VARBIND_LENGTH); - r = -EINVAL; - goto out; - } - /* Read rest of varbind */ - if (copy_from_user((void*)(varbind+2), (void*)(arg+2), vblen)) { - unifi_error(priv, "UNIFI_GET_MIB: Failed to copy in varbind\n"); - r = -EFAULT; - goto out; - } - - vblen += 2; - r = sme_mgt_mib_get(priv, varbind, &vblen); - if (r) { - goto out; - } - /* copy out varbind */ - if (vblen > MAX_VARBIND_LENGTH) { - unifi_error(priv, - "UNIFI_GET_MIB: Varbind result too long (%d, limit %d)\n", - vblen, MAX_VARBIND_LENGTH); - r = -EINVAL; - goto out; - } - if (copy_to_user((void*)arg, varbind, vblen)) { - r = -EFAULT; - goto out; - } -#else - unifi_notice(priv, "UNIFI_GET_MIB: Unsupported.\n"); -#endif /* CSR_SUPPORT_WEXT */ - break; - - case UNIFI_CFG: -#if (defined CSR_SUPPORT_SME) - if (get_user(cfg_cmd, (unifi_cfg_command_t*)arg)) - { - unifi_error(priv, "UNIFI_CFG: Failed to get the command\n"); - r = -EFAULT; - goto out; - } - - unifi_trace(priv, UDBG1, "UNIFI_CFG: Command is %d (t=%u) sz=%d\n", - cfg_cmd, jiffies_to_msecs(jiffies), sizeof(unifi_cfg_command_t)); - switch (cfg_cmd) { - case UNIFI_CFG_POWER: - r = unifi_cfg_power(priv, (unsigned char*)arg); - break; - case UNIFI_CFG_POWERSAVE: - r = unifi_cfg_power_save(priv, (unsigned char*)arg); - break; - case UNIFI_CFG_POWERSUPPLY: - r = unifi_cfg_power_supply(priv, (unsigned char*)arg); - break; - case UNIFI_CFG_FILTER: - r = unifi_cfg_packet_filters(priv, (unsigned char*)arg); - break; - case UNIFI_CFG_GET: - r = unifi_cfg_get_info(priv, (unsigned char*)arg); - break; - case UNIFI_CFG_WMM_QOSINFO: - r = unifi_cfg_wmm_qos_info(priv, (unsigned char*)arg); - break; - case UNIFI_CFG_WMM_ADDTS: - r = unifi_cfg_wmm_addts(priv, (unsigned char*)arg); - break; - case UNIFI_CFG_WMM_DELTS: - r = unifi_cfg_wmm_delts(priv, (unsigned char*)arg); - break; - case UNIFI_CFG_STRICT_DRAFT_N: - r = unifi_cfg_strict_draft_n(priv, (unsigned char*)arg); - break; - case UNIFI_CFG_ENABLE_OKC: - r = unifi_cfg_enable_okc(priv, (unsigned char*)arg); - break; -#ifdef CSR_SUPPORT_SME - case UNIFI_CFG_CORE_DUMP: - CsrWifiRouterCtrlWifiOffIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, CSR_WIFI_SME_CONTROL_INDICATION_ERROR); - unifi_trace(priv, UDBG2, "UNIFI_CFG_CORE_DUMP: sent wifi off indication\n"); - break; -#endif -#ifdef CSR_SUPPORT_WEXT_AP - case UNIFI_CFG_SET_AP_CONFIG: - r= unifi_cfg_set_ap_config(priv, (unsigned char*)arg); - break; -#endif - default: - unifi_error(priv, "UNIFI_CFG: Unknown Command (%d)\n", cfg_cmd); - r = -EINVAL; - goto out; - } -#endif - - break; - - case UNIFI_PUTEST: - if (get_user(putest_cmd, (unifi_putest_command_t*)arg)) - { - unifi_error(priv, "UNIFI_PUTEST: Failed to get the command\n"); - r = -EFAULT; - goto out; - } - - unifi_trace(priv, UDBG1, "UNIFI_PUTEST: Command is %s\n", - trace_putest_cmdid(putest_cmd)); - switch (putest_cmd) { - case UNIFI_PUTEST_START: - r = unifi_putest_start(priv, (unsigned char*)arg); - break; - case UNIFI_PUTEST_STOP: - r = unifi_putest_stop(priv, (unsigned char*)arg); - break; - case UNIFI_PUTEST_SET_SDIO_CLOCK: - r = unifi_putest_set_sdio_clock(priv, (unsigned char*)arg); - break; - case UNIFI_PUTEST_CMD52_READ: - r = unifi_putest_cmd52_read(priv, (unsigned char*)arg); - break; - case UNIFI_PUTEST_CMD52_BLOCK_READ: - r = unifi_putest_cmd52_block_read(priv, (unsigned char*)arg); - break; - case UNIFI_PUTEST_CMD52_WRITE: - r = unifi_putest_cmd52_write(priv, (unsigned char*)arg); - break; - case UNIFI_PUTEST_DL_FW: - r = unifi_putest_dl_fw(priv, (unsigned char*)arg); - break; - case UNIFI_PUTEST_DL_FW_BUFF: - r = unifi_putest_dl_fw_buff(priv, (unsigned char*)arg); - break; - case UNIFI_PUTEST_COREDUMP_PREPARE: - r = unifi_putest_coredump_prepare(priv, (unsigned char*)arg); - break; - case UNIFI_PUTEST_GP_READ16: - r = unifi_putest_gp_read16(priv, (unsigned char*)arg); - break; - case UNIFI_PUTEST_GP_WRITE16: - r = unifi_putest_gp_write16(priv, (unsigned char*)arg); - break; - default: - unifi_error(priv, "UNIFI_PUTEST: Unknown Command (%d)\n", putest_cmd); - r = -EINVAL; - goto out; - } - - break; - case UNIFI_BUILD_TYPE: - unifi_trace(priv, UDBG2, "UNIFI_BUILD_TYPE userspace=%s\n", build_type_to_string(*(unsigned char*)arg)); -#ifndef CSR_SUPPORT_WEXT_AP - if (UNIFI_BUILD_AP == *(unsigned char*)arg) - { - unifi_error(priv, "Userspace has AP support, which is incompatible\n"); - } -#endif - -#ifndef CSR_SUPPORT_WEXT - if (UNIFI_BUILD_WEXT == *(unsigned char*)arg) - { - unifi_error(priv, "Userspace has WEXT support, which is incompatible\n"); - } -#endif - break; - case UNIFI_INIT_HW: - unifi_trace(priv, UDBG2, "UNIFI_INIT_HW.\n"); - priv->init_progress = UNIFI_INIT_NONE; - -#if defined(CSR_SUPPORT_WEXT) || defined (CSR_NATIVE_LINUX) - /* At this point we are ready to start the SME. */ - r = sme_mgt_wifi_on(priv); - if (r) { - goto out; - } -#endif - - break; - - case UNIFI_INIT_NETDEV: - { - /* get the proper interfaceTagId */ - u16 interfaceTag=0; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - - dev = priv->netdev[interfaceTag]; - unifi_trace(priv, UDBG2, "UNIFI_INIT_NETDEV.\n"); - - if (copy_from_user((void*)dev->dev_addr, (void*)arg, 6)) { - r = -EFAULT; - goto out; - } - - /* Attach the network device to the stack */ - if (!interfacePriv->netdev_registered) - { - r = uf_register_netdev(priv, interfaceTag); - if (r) { - unifi_error(priv, "Failed to register the network device.\n"); - goto out; - } - } - - /* Apply scheduled interrupt mode, if requested by module param */ - if (run_bh_once != -1) { - unifi_set_interrupt_mode(priv->card, (u32)run_bh_once); - } - - priv->init_progress = UNIFI_INIT_COMPLETED; - - /* Firmware initialisation is complete, so let the SDIO bus - * clock be raised when convienent to the core. - */ - unifi_request_max_sdio_clock(priv->card); - -#ifdef CSR_SUPPORT_WEXT - /* Notify the Android wpa_supplicant that we are ready */ - wext_send_started_event(priv); -#endif - - unifi_info(priv, "UniFi ready\n"); - -#ifdef ANDROID_BUILD - /* Release the wakelock */ - unifi_trace(priv, UDBG1, "netdev_init: release wake lock\n"); - wake_unlock(&unifi_sdio_wake_lock); -#endif -#ifdef CSR_NATIVE_SOFTMAC /* For softmac dev, force-enable the network interface rather than wait for a connected-ind */ - { - struct net_device *dev = priv->netdev[interfaceTag]; -#ifdef CSR_SUPPORT_WEXT - interfacePriv->wait_netdev_change = TRUE; -#endif - netif_carrier_on(dev); - } -#endif - } - break; - case UNIFI_GET_INIT_STATUS: - unifi_trace(priv, UDBG2, "UNIFI_GET_INIT_STATUS.\n"); - if (put_user(priv->init_progress, (int*)arg)) - { - printk(KERN_ERR "UNIFI_GET_INIT_STATUS: Failed to copy to user\n"); - r = -EFAULT; - goto out; - } - break; - - case UNIFI_KICK: - unifi_trace(priv, UDBG4, "Kick UniFi\n"); - unifi_sdio_interrupt_handler(priv->card); - break; - - case UNIFI_SET_DEBUG: - unifi_debug = arg; - unifi_trace(priv, UDBG4, "unifi_debug set to %d\n", unifi_debug); - break; - - case UNIFI_SET_TRACE: - /* no longer supported */ - r = -EINVAL; - break; - - - case UNIFI_SET_UDI_LOG_MASK: - { - unifiio_filter_t udi_filter; - uint16_t *sig_ids_addr; -#define UF_MAX_SIG_IDS 128 /* Impose a sensible limit */ - - if (copy_from_user((void*)(&udi_filter), (void*)arg, sizeof(udi_filter))) { - r = -EFAULT; - goto out; - } - if ((udi_filter.action < UfSigFil_AllOn) || - (udi_filter.action > UfSigFil_SelectOff)) - { - printk(KERN_WARNING - "UNIFI_SET_UDI_LOG_MASK: Bad action value: %d\n", - udi_filter.action); - r = -EINVAL; - goto out; - } - /* No signal list for "All" actions */ - if ((udi_filter.action == UfSigFil_AllOn) || - (udi_filter.action == UfSigFil_AllOff)) - { - udi_filter.num_sig_ids = 0; - } - - if (udi_filter.num_sig_ids > UF_MAX_SIG_IDS) { - printk(KERN_WARNING - "UNIFI_SET_UDI_LOG_MASK: too many signal ids (%d, max %d)\n", - udi_filter.num_sig_ids, UF_MAX_SIG_IDS); - r = -EINVAL; - goto out; - } - - /* Copy in signal id list if given */ - if (udi_filter.num_sig_ids > 0) { - /* Preserve userspace address of sig_ids array */ - sig_ids_addr = udi_filter.sig_ids; - /* Allocate kernel memory for sig_ids and copy to it */ - udi_filter.sig_ids = - kmalloc(udi_filter.num_sig_ids * sizeof(uint16_t), GFP_KERNEL); - if (!udi_filter.sig_ids) { - r = -ENOMEM; - goto out; - } - if (copy_from_user((void*)udi_filter.sig_ids, - (void*)sig_ids_addr, - udi_filter.num_sig_ids * sizeof(uint16_t))) - { - kfree(udi_filter.sig_ids); - r = -EFAULT; - goto out; - } - } - - udi_set_log_filter(pcli, &udi_filter); - - if (udi_filter.num_sig_ids > 0) { - kfree(udi_filter.sig_ids); - } - } - break; - - case UNIFI_SET_AMP_ENABLE: - unifi_trace(priv, UDBG4, "UniFi Set AMP Enable\n"); - if (get_user(int_param, (int*)arg)) - { - unifi_error(priv, "UNIFI_SET_AMP_ENABLE: Failed to copy from user\n"); - r = -EFAULT; - goto out; - } - - if (int_param) { - priv->amp_client = pcli; - } else { - priv->amp_client = NULL; - } - - int_param = 0; - buf = (u8*)&int_param; - buf[0] = UNIFI_SOFT_COMMAND_Q_LENGTH - 1; - buf[1] = UNIFI_SOFT_TRAFFIC_Q_LENGTH - 1; - if (copy_to_user((void*)arg, &int_param, sizeof(int))) { - r = -EFAULT; - goto out; - } - break; - - case UNIFI_SET_UDI_SNAP_MASK: - { - unifiio_snap_filter_t snap_filter; - - if (copy_from_user((void*)(&snap_filter), (void*)arg, sizeof(snap_filter))) { - r = -EFAULT; - goto out; - } - - if (pcli->snap_filter.count) { - pcli->snap_filter.count = 0; - kfree(pcli->snap_filter.protocols); - } - - if (snap_filter.count == 0) { - break; - } - - pcli->snap_filter.protocols = kmalloc(snap_filter.count * sizeof(u16), GFP_KERNEL); - if (!pcli->snap_filter.protocols) { - r = -ENOMEM; - goto out; - } - if (copy_from_user((void*)pcli->snap_filter.protocols, - (void*)snap_filter.protocols, - snap_filter.count * sizeof(u16))) - { - kfree(pcli->snap_filter.protocols); - r = -EFAULT; - goto out; - } - - pcli->snap_filter.count = snap_filter.count; - - } - break; - - case UNIFI_SME_PRESENT: - { - u8 ind; - unifi_trace(priv, UDBG4, "UniFi SME Present IOCTL.\n"); - if (copy_from_user((void*)(&int_param), (void*)arg, sizeof(int))) - { - printk(KERN_ERR "UNIFI_SME_PRESENT: Failed to copy from user\n"); - r = -EFAULT; - goto out; - } - - priv->sme_is_present = int_param; - if (priv->sme_is_present == 1) { - ind = CONFIG_SME_PRESENT; - } else { - ind = CONFIG_SME_NOT_PRESENT; - } - /* Send an indication to the helper app. */ - ul_log_config_ind(priv, &ind, sizeof(u8)); - } - break; - - case UNIFI_CFG_PERIOD_TRAFFIC: - { -#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) - CsrWifiSmeCoexConfig coexConfig; -#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT */ - unifi_trace(priv, UDBG4, "UniFi Configure Periodic Traffic.\n"); -#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) - if (copy_from_user((void*)(&uchar_param), (void*)arg, sizeof(unsigned char))) { - unifi_error(priv, "UNIFI_CFG_PERIOD_TRAFFIC: Failed to copy from user\n"); - r = -EFAULT; - goto out; - } - - if (uchar_param == 0) { - r = sme_mgt_coex_config_get(priv, &coexConfig); - if (r) { - unifi_error(priv, "UNIFI_CFG_PERIOD_TRAFFIC: Get unifi_CoexInfoValue failed.\n"); - goto out; - } - if (copy_to_user((void*)(arg + 1), - (void*)&coexConfig, - sizeof(CsrWifiSmeCoexConfig))) { - r = -EFAULT; - goto out; - } - goto out; - } - - if (copy_from_user((void*)(&coex_config), (void*)(arg + 1), sizeof(CsrWifiSmeCoexConfig))) - { - unifi_error(priv, "UNIFI_CFG_PERIOD_TRAFFIC: Failed to copy from user\n"); - r = -EFAULT; - goto out; - } - - coexConfig = coex_config; - r = sme_mgt_coex_config_set(priv, &coexConfig); - if (r) { - unifi_error(priv, "UNIFI_CFG_PERIOD_TRAFFIC: Set unifi_CoexInfoValue failed.\n"); - goto out; - } - -#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT */ - break; - } - case UNIFI_CFG_UAPSD_TRAFFIC: - unifi_trace(priv, UDBG4, "UniFi Configure U-APSD Mask.\n"); -#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) - if (copy_from_user((void*)(&uchar_param), (void*)arg, sizeof(unsigned char))) { - unifi_error(priv, "UNIFI_CFG_UAPSD_TRAFFIC: Failed to copy from user\n"); - r = -EFAULT; - goto out; - } - unifi_trace(priv, UDBG4, "New U-APSD Mask: 0x%x\n", uchar_param); -#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT */ - break; - -#ifndef UNIFI_DISABLE_COREDUMP - case UNIFI_COREDUMP_GET_REG: - unifi_trace(priv, UDBG4, "Mini-coredump data request\n"); - { - unifiio_coredump_req_t dump_req; /* Public OS layer structure */ - unifi_coredump_req_t priv_req; /* Private HIP structure */ - - if (copy_from_user((void*)(&dump_req), (void*)arg, sizeof(dump_req))) { - r = -EFAULT; - goto out; - } - memset(&priv_req, 0, sizeof(priv_req)); - priv_req.index = dump_req.index; - priv_req.offset = dump_req.offset; - - /* Convert OS-layer's XAP memory space ID to HIP's ID in case they differ */ - switch (dump_req.space) { - case UNIFIIO_COREDUMP_MAC_REG: priv_req.space = UNIFI_COREDUMP_MAC_REG; break; - case UNIFIIO_COREDUMP_PHY_REG: priv_req.space = UNIFI_COREDUMP_PHY_REG; break; - case UNIFIIO_COREDUMP_SH_DMEM: priv_req.space = UNIFI_COREDUMP_SH_DMEM; break; - case UNIFIIO_COREDUMP_MAC_DMEM: priv_req.space = UNIFI_COREDUMP_MAC_DMEM; break; - case UNIFIIO_COREDUMP_PHY_DMEM: priv_req.space = UNIFI_COREDUMP_PHY_DMEM; break; - case UNIFIIO_COREDUMP_TRIGGER_MAGIC: priv_req.space = UNIFI_COREDUMP_TRIGGER_MAGIC; break; - default: - r = -EINVAL; - goto out; - } - - if (priv_req.space == UNIFI_COREDUMP_TRIGGER_MAGIC) { - /* Force a coredump grab now */ - unifi_trace(priv, UDBG2, "UNIFI_COREDUMP_GET_REG: Force capture\n"); - csrResult = unifi_coredump_capture(priv->card, &priv_req); - r = CsrHipResultToStatus(csrResult); - unifi_trace(priv, UDBG5, "UNIFI_COREDUMP_GET_REG: status %d\n", r); - } else { - /* Retrieve the appropriate register entry */ - csrResult = unifi_coredump_get_value(priv->card, &priv_req); - r = CsrHipResultToStatus(csrResult); - if (r) { - unifi_trace(priv, UDBG5, "UNIFI_COREDUMP_GET_REG: Status %d\n", r); - goto out; - } - /* Update the OS-layer structure with values returned in the private */ - dump_req.value = priv_req.value; - dump_req.timestamp = priv_req.timestamp; - dump_req.requestor = priv_req.requestor; - dump_req.serial = priv_req.serial; - dump_req.chip_ver = priv_req.chip_ver; - dump_req.fw_ver = priv_req.fw_ver; - dump_req.drv_build = 0; - - unifi_trace(priv, UDBG6, - "Dump: %d (seq %d): V:0x%04x (%d) @0x%02x:%04x = 0x%04x\n", - dump_req.index, dump_req.serial, - dump_req.chip_ver, dump_req.drv_build, - dump_req.space, dump_req.offset, dump_req.value); - } - if (copy_to_user((void*)arg, (void*)&dump_req, sizeof(dump_req))) { - r = -EFAULT; - goto out; - } - } - break; -#endif - default: - r = -EINVAL; - } - -out: - return (long)r; -} /* unifi_ioctl() */ - - - -static unsigned int -unifi_poll(struct file *filp, poll_table *wait) -{ - ul_client_t *pcli = (ul_client_t*)filp->private_data; - unsigned int mask = 0; - int ready; - - ready = !list_empty(&pcli->udi_log); - - poll_wait(filp, &pcli->udi_wq, wait); - - if (ready) { - mask |= POLLIN | POLLRDNORM; /* readable */ - } - - return mask; -} /* unifi_poll() */ - - - -/* - * --------------------------------------------------------------------------- - * udi_set_log_filter - * - * Configure the bit mask that determines which signal primitives are - * passed to the logging process. - * - * Arguments: - * pcli Pointer to the client to configure. - * udi_filter Pointer to a unifiio_filter_t containing instructions. - * - * Returns: - * None. - * - * Notes: - * SigGetFilterPos() returns a 32-bit value that contains an index and a - * mask for accessing a signal_filter array. The top 16 bits specify an - * index into a signal_filter, the bottom 16 bits specify a mask to - * apply. - * --------------------------------------------------------------------------- - */ -static void -udi_set_log_filter(ul_client_t *pcli, unifiio_filter_t *udi_filter) -{ - u32 filter_pos; - int i; - - if (udi_filter->action == UfSigFil_AllOn) - { - for (i = 0; i < SIG_FILTER_SIZE; i++) { - pcli->signal_filter[i] = 0xFFFF; - } - } - else if (udi_filter->action == UfSigFil_AllOff) - { - for (i = 0; i < SIG_FILTER_SIZE; i++) { - pcli->signal_filter[i] = 0; - } - } - else if (udi_filter->action == UfSigFil_SelectOn) - { - for (i = 0; i < udi_filter->num_sig_ids; i++) { - filter_pos = SigGetFilterPos(udi_filter->sig_ids[i]); - if (filter_pos == 0xFFFFFFFF) - { - printk(KERN_WARNING - "Unrecognised signal id (0x%X) specifed in logging filter\n", - udi_filter->sig_ids[i]); - } else { - pcli->signal_filter[filter_pos >> 16] |= (filter_pos & 0xFFFF); - } - } - } - else if (udi_filter->action == UfSigFil_SelectOff) - { - for (i = 0; i < udi_filter->num_sig_ids; i++) { - filter_pos = SigGetFilterPos(udi_filter->sig_ids[i]); - if (filter_pos == 0xFFFFFFFF) - { - printk(KERN_WARNING - "Unrecognised signal id (0x%X) specifed in logging filter\n", - udi_filter->sig_ids[i]); - } else { - pcli->signal_filter[filter_pos >> 16] &= ~(filter_pos & 0xFFFF); - } - } - } - -} /* udi_set_log_filter() */ - - -/* - * --------------------------------------------------------------------------- - * udi_log_event - * - * Callback function to be registered as the UDI hook callback. - * Copies the signal content into a new udi_log_t struct and adds - * it to the read queue for this UDI client. - * - * Arguments: - * pcli A pointer to the client instance. - * signal Pointer to the received signal. - * signal_len Size of the signal structure in bytes. - * bulkdata Pointers to any associated bulk data. - * dir Direction of the signal. Zero means from host, - * non-zero means to host. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -udi_log_event(ul_client_t *pcli, - const u8 *signal, int signal_len, - const bulk_data_param_t *bulkdata, - int dir) -{ - udi_log_t *logptr; - u8 *p; - int i; - int total_len; - udi_msg_t *msgptr; - u32 filter_pos; -#ifdef OMNICLI_LINUX_EXTRA_LOG - static volatile unsigned int printk_cpu = UINT_MAX; - unsigned long long t; - unsigned long nanosec_rem; - unsigned long n_1000; -#endif - - /* Just a sanity check */ - if ((signal == NULL) || (signal_len <= 0)) { - return; - } - -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE - /* When HIP offline signal logging is enabled, omnicli cannot run */ - if (log_hip_signals) - { - /* Add timestamp */ - if (log_hip_signals & UNIFI_LOG_HIP_SIGNALS_FILTER_TIMESTAMP) - { - int timestamp = jiffies_to_msecs(jiffies); - unifi_debug_log_to_buf("T:"); - unifi_debug_log_to_buf("%04X%04X ", *(((u16*)×tamp) + 1), - *(u16*)×tamp); - } - - /* Add signal */ - unifi_debug_log_to_buf("S%s:%04X R:%04X D:%04X ", - dir ? "T" : "F", - *(u16*)signal, - *(u16*)(signal + 2), - *(u16*)(signal + 4)); - unifi_debug_hex_to_buf(signal + 6, signal_len - 6); - - /* Add bulk data (assume 1 bulk data per signal) */ - if ((log_hip_signals & UNIFI_LOG_HIP_SIGNALS_FILTER_BULKDATA) && - (bulkdata->d[0].data_length > 0)) - { - unifi_debug_log_to_buf("\nD:"); - unifi_debug_hex_to_buf(bulkdata->d[0].os_data_ptr, bulkdata->d[0].data_length); - } - unifi_debug_log_to_buf("\n"); - - return; - } -#endif - -#ifdef CSR_NATIVE_LINUX - uf_native_process_udi_signal(pcli, signal, signal_len, bulkdata, dir); -#endif - - /* - * Apply the logging filter - only report signals that have their - * bit set in the filter mask. - */ - filter_pos = SigGetFilterPos(GET_SIGNAL_ID(signal)); - - if ((filter_pos != 0xFFFFFFFF) && - ((pcli->signal_filter[filter_pos >> 16] & (filter_pos & 0xFFFF)) == 0)) - { - /* Signal is not wanted by client */ - return; - } - - - /* Calculate the buffer we need to store signal plus bulk data */ - total_len = signal_len; - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - total_len += bulkdata->d[i].data_length; - } - - /* Allocate log structure plus actual signal. */ - logptr = kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL); - - if (logptr == NULL) { - printk(KERN_ERR - "Failed to allocate %lu bytes for a UDI log record\n", - (long unsigned int)(sizeof(udi_log_t) + total_len)); - return; - } - - /* Fill in udi_log struct */ - INIT_LIST_HEAD(&logptr->q); - msgptr = &logptr->msg; - msgptr->length = sizeof(udi_msg_t) + total_len; -#ifdef OMNICLI_LINUX_EXTRA_LOG - t = cpu_clock(printk_cpu); - nanosec_rem = do_div(t, 1000000000); - n_1000 = nanosec_rem/1000; - msgptr->timestamp = (t <<10 ) | ((unsigned long)(n_1000 >> 10) & 0x3ff); -#else - msgptr->timestamp = jiffies_to_msecs(jiffies); -#endif - msgptr->direction = dir; - msgptr->signal_length = signal_len; - - /* Copy signal and bulk data to the log */ - p = (u8 *)(msgptr + 1); - memcpy(p, signal, signal_len); - p += signal_len; - - /* Append any bulk data */ - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - int len = bulkdata->d[i].data_length; - - /* - * Len here might not be the same as the length in the bulk data slot. - * The slot length will always be even, but len could be odd. - */ - if (len > 0) { - if (bulkdata->d[i].os_data_ptr) { - memcpy(p, bulkdata->d[i].os_data_ptr, len); - } else { - memset(p, 0, len); - } - p += len; - } - } - - /* Add to tail of log queue */ - if (down_interruptible(&pcli->udi_sem)) { - printk(KERN_WARNING "udi_log_event_q: Failed to get udi sem\n"); - kfree(logptr); - return; - } - list_add_tail(&logptr->q, &pcli->udi_log); - up(&pcli->udi_sem); - - /* Wake any waiting user process */ - wake_up_interruptible(&pcli->udi_wq); - -} /* udi_log_event() */ - -#ifdef CSR_SME_USERSPACE -int -uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length) -{ - udi_log_t *logptr; - udi_msg_t *msgptr; - u8 *p; - - /* Just a sanity check */ - if ((buffer == NULL) || (length <= 0)) { - return -EINVAL; - } - - /* Allocate log structure plus actual signal. */ - logptr = kmalloc(sizeof(udi_log_t) + length, GFP_ATOMIC); - if (logptr == NULL) { - unifi_error(priv, "Failed to allocate %d bytes for an SME message\n", - sizeof(udi_log_t) + length); - kfree(buffer); - return -ENOMEM; - } - - /* Fill in udi_log struct */ - INIT_LIST_HEAD(&logptr->q); - msgptr = &logptr->msg; - msgptr->length = sizeof(udi_msg_t) + length; - msgptr->signal_length = length; - - /* Copy signal and bulk data to the log */ - p = (u8 *)(msgptr + 1); - memcpy(p, buffer, length); - - /* Add to tail of log queue */ - down(&udi_mutex); - if (priv->sme_cli == NULL) { - kfree(logptr); - kfree(buffer); - up(&udi_mutex); - unifi_info(priv, "Message for the SME dropped, SME has gone away\n"); - return 0; - } - - down(&priv->sme_cli->udi_sem); - list_add_tail(&logptr->q, &priv->sme_cli->udi_log); - up(&priv->sme_cli->udi_sem); - - /* Wake any waiting user process */ - wake_up_interruptible(&priv->sme_cli->udi_wq); - up(&udi_mutex); - - /* It is our responsibility to free the buffer allocated in build_packed_*() */ - kfree(buffer); - - return 0; - -} /* uf_sme_queue_message() */ -#endif - -/* - **************************************************************************** - * - * Driver instantiation - * - **************************************************************************** - */ -static const struct file_operations unifi_fops = { - .owner = THIS_MODULE, - .open = unifi_open, - .release = unifi_release, - .read = unifi_read, - .write = unifi_write, - .unlocked_ioctl = unifi_ioctl, - .poll = unifi_poll, -}; - -static dev_t unifi_first_devno; -static struct class *unifi_class; - - -int uf_create_device_nodes(unifi_priv_t *priv, int bus_id) -{ - dev_t devno; - int r; - - cdev_init(&priv->unifi_cdev, &unifi_fops); - - /* cdev_init() should set the cdev owner, but it does not */ - priv->unifi_cdev.owner = THIS_MODULE; - - devno = MKDEV(MAJOR(unifi_first_devno), - MINOR(unifi_first_devno) + (bus_id * 2)); - r = cdev_add(&priv->unifi_cdev, devno, 1); - if (r) { - return r; - } - -#ifdef SDIO_EXPORTS_STRUCT_DEVICE - if (!device_create(unifi_class, priv->unifi_device, - devno, priv, "unifi%d", bus_id)) { -#else - priv->unifi_device = device_create(unifi_class, NULL, - devno, priv, "unifi%d", bus_id); - if (priv->unifi_device == NULL) { -#endif /* SDIO_EXPORTS_STRUCT_DEVICE */ - - cdev_del(&priv->unifi_cdev); - return -EINVAL; - } - - cdev_init(&priv->unifiudi_cdev, &unifi_fops); - - /* cdev_init() should set the cdev owner, but it does not */ - priv->unifiudi_cdev.owner = THIS_MODULE; - - devno = MKDEV(MAJOR(unifi_first_devno), - MINOR(unifi_first_devno) + (bus_id * 2) + 1); - r = cdev_add(&priv->unifiudi_cdev, devno, 1); - if (r) { - device_destroy(unifi_class, priv->unifi_cdev.dev); - cdev_del(&priv->unifi_cdev); - return r; - } - - if (!device_create(unifi_class, -#ifdef SDIO_EXPORTS_STRUCT_DEVICE - priv->unifi_device, -#else - NULL, -#endif /* SDIO_EXPORTS_STRUCT_DEVICE */ - devno, priv, "unifiudi%d", bus_id)) { - device_destroy(unifi_class, priv->unifi_cdev.dev); - cdev_del(&priv->unifiudi_cdev); - cdev_del(&priv->unifi_cdev); - return -EINVAL; - } - - return 0; -} - - -void uf_destroy_device_nodes(unifi_priv_t *priv) -{ - device_destroy(unifi_class, priv->unifiudi_cdev.dev); - device_destroy(unifi_class, priv->unifi_cdev.dev); - cdev_del(&priv->unifiudi_cdev); - cdev_del(&priv->unifi_cdev); -} - - - -/* - * ---------------------------------------------------------------- - * uf_create_debug_device - * - * Allocates device numbers for unifi character device nodes - * and creates a unifi class in sysfs - * - * Arguments: - * fops Pointer to the char device operations structure. - * - * Returns: - * 0 on success, -ve error code on error. - * ---------------------------------------------------------------- - */ -static int -uf_create_debug_device(const struct file_operations *fops) -{ - int ret; - - /* Allocate two device numbers for each device. */ - ret = alloc_chrdev_region(&unifi_first_devno, 0, MAX_UNIFI_DEVS*2, UNIFI_NAME); - if (ret) { - unifi_error(NULL, "Failed to add alloc dev numbers: %d\n", ret); - return ret; - } - - /* Create a UniFi class */ - unifi_class = class_create(THIS_MODULE, UNIFI_NAME); - if (IS_ERR(unifi_class)) { - unifi_error(NULL, "Failed to create UniFi class\n"); - - /* Release device numbers */ - unregister_chrdev_region(unifi_first_devno, MAX_UNIFI_DEVS*2); - unifi_first_devno = 0; - return -EINVAL; - } - - return 0; -} /* uf_create_debug_device() */ - - -/* - * ---------------------------------------------------------------- - * uf_remove_debug_device - * - * Destroys the unifi class and releases the allocated - * device numbers for unifi character device nodes. - * - * Arguments: - * - * Returns: - * ---------------------------------------------------------------- - */ -static void -uf_remove_debug_device(void) -{ - /* Destroy the UniFi class */ - class_destroy(unifi_class); - - /* Release device numbers */ - unregister_chrdev_region(unifi_first_devno, MAX_UNIFI_DEVS*2); - unifi_first_devno = 0; - -} /* uf_remove_debug_device() */ - - -/* - * --------------------------------------------------------------------------- - * - * Module loading. - * - * --------------------------------------------------------------------------- - */ -int __init -unifi_load(void) -{ - int r; - - printk("UniFi SDIO Driver: %s %s %s\n", - CSR_WIFI_VERSION, - __DATE__, __TIME__); - -#ifdef CSR_SME_USERSPACE -#ifdef CSR_SUPPORT_WEXT - printk("CSR SME with WEXT support\n"); -#else - printk("CSR SME no WEXT support\n"); -#endif /* CSR_SUPPORT_WEXT */ -#endif /* CSR_SME_USERSPACE */ - -#ifdef CSR_NATIVE_LINUX -#ifdef CSR_SUPPORT_WEXT -#error WEXT unsupported in the native driver -#endif - printk("CSR native no WEXT support\n"); -#endif -#ifdef CSR_WIFI_SPLIT_PATCH - printk("Split patch support\n"); -#endif - printk("Kernel %d.%d.%d\n", - ((LINUX_VERSION_CODE) >> 16) & 0xff, - ((LINUX_VERSION_CODE) >> 8) & 0xff, - (LINUX_VERSION_CODE) & 0xff); - /* - * Instantiate the /dev/unifi* device nodes. - * We must do this before registering with the SDIO driver because it - * will immediately call the "insert" callback if the card is - * already present. - */ - r = uf_create_debug_device(&unifi_fops); - if (r) { - return r; - } - - /* Now register with the SDIO driver */ - r = uf_sdio_load(); - if (r) { - uf_remove_debug_device(); - return r; - } - - if (sdio_block_size > -1) { - unifi_info(NULL, "sdio_block_size %d\n", sdio_block_size); - } - - if (sdio_byte_mode) { - unifi_info(NULL, "sdio_byte_mode\n"); - } - - if (disable_power_control) { - unifi_info(NULL, "disable_power_control\n"); - } - - if (disable_hw_reset) { - unifi_info(NULL, "disable_hw_reset\n"); - } - - if (enable_wol) { - unifi_info(NULL, "enable_wol %d\n", enable_wol); - } - - if (run_bh_once != -1) { - unifi_info(NULL, "run_bh_once %d\n", run_bh_once); - } - - return 0; -} /* unifi_load() */ - - -void __exit -unifi_unload(void) -{ - /* The SDIO remove hook will call unifi_disconnect(). */ - uf_sdio_unload(); - - uf_remove_debug_device(); - -} /* unifi_unload() */ - -module_init(unifi_load); -module_exit(unifi_unload); - -MODULE_DESCRIPTION("UniFi Device driver"); -MODULE_AUTHOR("Cambridge Silicon Radio Ltd."); -MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/staging/csr/firmware.c b/drivers/staging/csr/firmware.c deleted file mode 100644 index b42a4d6a0c36..000000000000 --- a/drivers/staging/csr/firmware.c +++ /dev/null @@ -1,396 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: firmware.c - * - * PURPOSE: - * Implements the f/w related HIP core lib API. - * It is part of the porting exercise in Linux. - * - * Also, it contains example code for reading the loader and f/w files - * from the userspace and starting the SME in Linux. - * - * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#include <linux/kmod.h> -#include <linux/vmalloc.h> -#include <linux/firmware.h> -#include <asm/uaccess.h> -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_unifi_udi.h" -#include "unifiio.h" -#include "unifi_priv.h" - -/* - * --------------------------------------------------------------------------- - * - * F/W download. Part of the HIP core API - * - * --------------------------------------------------------------------------- - */ - - -/* - * --------------------------------------------------------------------------- - * unifi_fw_read_start - * - * Returns a structure to be passed in unifi_fw_read(). - * This structure is an OS specific description of the f/w file. - * In the linux implementation it is a buffer with the f/w and its' length. - * The HIP driver calls this functions to request for the loader or - * the firmware file. - * The structure pointer can be freed when unifi_fw_read_stop() is called. - * - * Arguments: - * ospriv Pointer to driver context. - * is_fw Type of firmware to retrieve - * info Versions information. Can be used to determine - * the appropriate f/w file to load. - * - * Returns: - * O on success, non-zero otherwise. - * - * --------------------------------------------------------------------------- - */ -void* -unifi_fw_read_start(void *ospriv, s8 is_fw, const card_info_t *info) -{ - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - CSR_UNUSED(info); - - if (is_fw == UNIFI_FW_STA) { - /* F/w may have been released after a previous successful download. */ - if (priv->fw_sta.dl_data == NULL) { - unifi_trace(priv, UDBG2, "Attempt reload of sta f/w\n"); - uf_request_firmware_files(priv, UNIFI_FW_STA); - } - /* Set up callback struct for readfunc() */ - if (priv->fw_sta.dl_data != NULL) { - return &priv->fw_sta; - } - - } else { - unifi_error(priv, "downloading firmware... unknown request: %d\n", is_fw); - } - - return NULL; -} /* unifi_fw_read_start() */ - - - -/* - * --------------------------------------------------------------------------- - * unifi_fw_read_stop - * - * Called when the HIP driver has finished using the loader or - * the firmware file. - * The firmware buffer may be released now. - * - * Arguments: - * ospriv Pointer to driver context. - * dlpriv The pointer returned by unifi_fw_read_start() - * - * --------------------------------------------------------------------------- - */ -void -unifi_fw_read_stop(void *ospriv, void *dlpriv) -{ - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - struct dlpriv *dl_struct = (struct dlpriv *)dlpriv; - - if (dl_struct != NULL) { - if (dl_struct->dl_data != NULL) { - unifi_trace(priv, UDBG2, "Release f/w buffer %p, %d bytes\n", - dl_struct->dl_data, dl_struct->dl_len); - } - uf_release_firmware(priv, dl_struct); - } - -} /* unifi_fw_read_stop() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_fw_open_buffer - * - * Returns a handle for a buffer dynamically allocated by the driver, - * e.g. into which a firmware file may have been converted from another format - * which is the case with some production test images. - * - * The handle may then be used by unifi_fw_read() to access the contents of - * the buffer. - * - * Arguments: - * ospriv Pointer to driver context. - * fwbuf Buffer containing firmware image - * len Length of buffer in bytes - * - * Returns - * Handle for buffer, or NULL on error - * --------------------------------------------------------------------------- - */ -void * -unifi_fw_open_buffer(void *ospriv, void *fwbuf, u32 len) -{ - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - - if (fwbuf == NULL) { - return NULL; - } - priv->fw_conv.dl_data = fwbuf; - priv->fw_conv.dl_len = len; - priv->fw_conv.fw_desc = NULL; /* No OS f/w resource is associated */ - - return &priv->fw_conv; -} - -/* - * --------------------------------------------------------------------------- - * unifi_fw_close_buffer - * - * Releases any handle for a buffer dynamically allocated by the driver, - * e.g. into which a firmware file may have been converted from another format - * which is the case with some production test images. - * - * - * Arguments: - * ospriv Pointer to driver context. - * fwbuf Buffer containing firmware image - * - * Returns - * Handle for buffer, or NULL on error - * --------------------------------------------------------------------------- - */ -void unifi_fw_close_buffer(void *ospriv, void *fwbuf) -{ -} - -/* - * --------------------------------------------------------------------------- - * unifi_fw_read - * - * The HIP driver calls this function to ask for a part of the loader or - * the firmware file. - * - * Arguments: - * ospriv Pointer to driver context. - * arg The pointer returned by unifi_fw_read_start(). - * offset The offset in the file to return from. - * buf A buffer to store the requested data. - * len The size of the buf and the size of the requested data. - * - * Returns - * The number of bytes read from the firmware image, or -ve on error - * --------------------------------------------------------------------------- - */ -s32 -unifi_fw_read(void *ospriv, void *arg, u32 offset, void *buf, u32 len) -{ - const struct dlpriv *dlpriv = arg; - - if (offset >= dlpriv->dl_len) { - /* at end of file */ - return 0; - } - - if ((offset + len) > dlpriv->dl_len) { - /* attempt to read past end of file */ - return -1; - } - - memcpy(buf, dlpriv->dl_data+offset, len); - - return len; - -} /* unifi_fw_read() */ - - - - -#define UNIFIHELPER_INIT_MODE_SMEUSER 2 -#define UNIFIHELPER_INIT_MODE_NATIVE 1 - -/* - * --------------------------------------------------------------------------- - * uf_run_unifihelper - * - * Ask userspace to send us firmware for download by running - * '/usr/sbin/unififw'. - * The same script starts the SME userspace application. - * Derived from net_run_sbin_hotplug(). - * - * Arguments: - * priv Pointer to OS private struct. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -int -uf_run_unifihelper(unifi_priv_t *priv) -{ -#ifdef ANDROID_BUILD - char *prog = "/system/bin/unififw"; -#else - char *prog = "/usr/sbin/unififw"; -#endif /* ANDROID_BUILD */ - - char *argv[6], *envp[4]; - char inst_str[8]; - char init_mode[8]; - int i, r; - -#if (defined CSR_SME_USERSPACE) && (!defined CSR_SUPPORT_WEXT) - unifi_trace(priv, UDBG1, "SME userspace build: run unifi_helper manually\n"); - return 0; -#endif - - unifi_trace(priv, UDBG1, "starting %s\n", prog); - - snprintf(inst_str, 8, "%d", priv->instance); -#if (defined CSR_SME_USERSPACE) - snprintf(init_mode, 8, "%d", UNIFIHELPER_INIT_MODE_SMEUSER); -#else - snprintf(init_mode, 8, "%d", UNIFIHELPER_INIT_MODE_NATIVE); -#endif /* CSR_SME_USERSPACE */ - - i = 0; - argv[i++] = prog; - argv[i++] = inst_str; - argv[i++] = init_mode; - argv[i++] = 0; - argv[i] = 0; - /* Don't add more args without making argv bigger */ - - /* minimal command environment */ - i = 0; - envp[i++] = "HOME=/"; - envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; - envp[i] = 0; - /* Don't add more without making envp bigger */ - - unifi_trace(priv, UDBG2, "running %s %s %s\n", argv[0], argv[1], argv[2]); - - r = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); - - return r; -} /* uf_run_unifihelper() */ - -#ifdef CSR_WIFI_SPLIT_PATCH -static u8 is_ap_mode(unifi_priv_t *priv) -{ - if (priv == NULL || priv->interfacePriv[0] == NULL) - { - return FALSE; - } - - /* Test for mode requiring AP patch */ - return(CSR_WIFI_HIP_IS_AP_FW(priv->interfacePriv[0]->interfaceMode)); -} -#endif - -/* - * --------------------------------------------------------------------------- - * uf_request_firmware_files - * - * Get the firmware files from userspace. - * - * Arguments: - * priv Pointer to OS private struct. - * is_fw type of firmware to load (UNIFI_FW_STA/LOADER) - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -int uf_request_firmware_files(unifi_priv_t *priv, int is_fw) -{ - /* uses the default method to get the firmware */ - const struct firmware *fw_entry; - int postfix; -#define UNIFI_MAX_FW_PATH_LEN 32 - char fw_name[UNIFI_MAX_FW_PATH_LEN]; - int r; - -#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) - if (priv->mib_data.length) { - vfree(priv->mib_data.data); - priv->mib_data.data = NULL; - priv->mib_data.length = 0; - } -#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT*/ - - postfix = priv->instance; - - if (is_fw == UNIFI_FW_STA) { - /* Free kernel buffer and reload */ - uf_release_firmware(priv, &priv->fw_sta); -#ifdef CSR_WIFI_SPLIT_PATCH - scnprintf(fw_name, UNIFI_MAX_FW_PATH_LEN, "unifi-sdio-%d/%s", - postfix, (is_ap_mode(priv) ? "ap.xbv" : "staonly.xbv") ); -#else - scnprintf(fw_name, UNIFI_MAX_FW_PATH_LEN, "unifi-sdio-%d/%s", - postfix, "sta.xbv" ); -#endif - r = request_firmware(&fw_entry, fw_name, priv->unifi_device); - if (r == 0) { - priv->fw_sta.dl_data = fw_entry->data; - priv->fw_sta.dl_len = fw_entry->size; - priv->fw_sta.fw_desc = (void *)fw_entry; - } else { - unifi_trace(priv, UDBG2, "Firmware file not available\n"); - } - } - - return 0; - -} /* uf_request_firmware_files() */ - -/* - * --------------------------------------------------------------------------- - * uf_release_firmware_files - * - * Release all buffers used to store firmware files - * - * Arguments: - * priv Pointer to OS private struct. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -int uf_release_firmware_files(unifi_priv_t *priv) -{ - uf_release_firmware(priv, &priv->fw_sta); - - return 0; -} - -/* - * --------------------------------------------------------------------------- - * uf_release_firmware - * - * Release specific buffer used to store firmware - * - * Arguments: - * priv Pointer to OS private struct. - * to_free Pointer to specific buffer to release - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -int uf_release_firmware(unifi_priv_t *priv, struct dlpriv *to_free) -{ - if (to_free != NULL) { - release_firmware((const struct firmware *)to_free->fw_desc); - to_free->fw_desc = NULL; - to_free->dl_data = NULL; - to_free->dl_len = 0; - } - return 0; -} diff --git a/drivers/staging/csr/inet.c b/drivers/staging/csr/inet.c deleted file mode 100644 index b3ef818fef35..000000000000 --- a/drivers/staging/csr/inet.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: inet.c - * - * PURPOSE: - * Routines related to IP address changes. - * Optional part of the porting exercise. It uses system network - * handlers to obtain the UniFi IP address and pass it to the SME - * using the unifi_sys_ip_configured_ind(). - * - * Copyright (C) 2008-2009 Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#include <linux/inetdevice.h> -#include <linux/notifier.h> - -#include "unifi_priv.h" -#include "csr_wifi_hip_conversions.h" - -/* - * The inet notifier is global and not per-netdev. To avoid having a - * notifier registered when there are no unifi devices present, it's - * registered after the first unifi network device is registered, and - * unregistered when the last unifi network device is unregistered. - */ - -static atomic_t inet_notif_refs = ATOMIC_INIT(0); - -static int uf_inetaddr_event(struct notifier_block *notif, unsigned long event, void *ifa) -{ - struct net_device *ndev; - unifi_priv_t *priv; - struct in_ifaddr *if_addr; - netInterface_priv_t *InterfacePriv = (netInterface_priv_t *)NULL; - - if (!ifa || !((struct in_ifaddr *)ifa)->ifa_dev) { - unifi_trace(NULL, UDBG1, "uf_inetaddr_event (%lu) ifa=%p\n", event, ifa); - return NOTIFY_DONE; - } - - ndev = ((struct in_ifaddr *)ifa)->ifa_dev->dev; - InterfacePriv = (netInterface_priv_t*) netdev_priv(ndev); - - /* As the notifier is global, the call may be for a non-UniFi netdev. - * Therefore check the netdev_priv to make sure it's a known UniFi one. - */ - if (uf_find_netdev_priv(InterfacePriv) == -1) { - unifi_trace(NULL, UDBG1, "uf_inetaddr_event (%lu) ndev=%p, other netdev_priv=%p\n", - event, ndev, InterfacePriv); - return NOTIFY_DONE; - } - - if (!InterfacePriv->privPtr) { - unifi_error(NULL, "uf_inetaddr_event null priv (%lu) ndev=%p, InterfacePriv=%p\n", - event, ndev, InterfacePriv); - return NOTIFY_DONE; - } - - priv = InterfacePriv->privPtr; - if_addr = (struct in_ifaddr *)ifa; - - /* If this event is for a UniFi device, notify the SME that an IP - * address has been added or removed. */ - if (uf_find_priv(priv) != -1) { - switch (event) { - case NETDEV_UP: - unifi_info(priv, "IP address assigned for %s\n", priv->netdev[InterfacePriv->InterfaceTag]->name); - priv->sta_ip_address = if_addr->ifa_address; -#ifdef CSR_SUPPORT_WEXT - sme_mgt_packet_filter_set(priv); -#endif - break; - case NETDEV_DOWN: - unifi_info(priv, "IP address removed for %s\n", priv->netdev[InterfacePriv->InterfaceTag]->name); - priv->sta_ip_address = 0xFFFFFFFF; -#ifdef CSR_SUPPORT_WEXT - sme_mgt_packet_filter_set(priv); -#endif - break; - } - } - - return NOTIFY_DONE; -} - -static struct notifier_block uf_inetaddr_notifier = { - .notifier_call = uf_inetaddr_event, -}; - -void uf_register_inet_notifier(void) -{ - if (atomic_inc_return(&inet_notif_refs) == 1) - register_inetaddr_notifier(&uf_inetaddr_notifier); -} - -void uf_unregister_inet_notifier(void) -{ - if (atomic_dec_return(&inet_notif_refs) == 0) - unregister_inetaddr_notifier(&uf_inetaddr_notifier); -} diff --git a/drivers/staging/csr/init_hw.c b/drivers/staging/csr/init_hw.c deleted file mode 100644 index 3b8a4babf9a6..000000000000 --- a/drivers/staging/csr/init_hw.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: init_hw.c - * - * PURPOSE: - * Use the HIP core lib to initialise the UniFi chip. - * It is part of the porting exercise in Linux. - * - * Copyright (C) 2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#include "csr_wifi_hip_unifi.h" -#include "unifi_priv.h" - - -#define MAX_INIT_ATTEMPTS 4 - -extern int led_mask; - - -/* - * --------------------------------------------------------------------------- - * uf_init_hw - * - * Resets hardware, downloads and initialises f/w. - * This function demonstrates how to use the HIP core lib API - * to implement the SME unifi_sys_wifi_on_req() part of the SYS API. - * - * In a simple implementation, all this function needs to do is call - * unifi_init_card() and then unifi_card_info(). - * In the Linux implementation, it will retry to initialise UniFi or - * try to debug the reasons if unifi_init_card() returns an error. - * - * Arguments: - * ospriv Pointer to OS driver structure for the device. - * - * Returns: - * O on success, non-zero otherwise. - * - * --------------------------------------------------------------------------- - */ -int -uf_init_hw(unifi_priv_t *priv) -{ - int attempts = 0; - int priv_instance; - CsrResult csrResult = CSR_RESULT_FAILURE; - - priv_instance = uf_find_priv(priv); - if (priv_instance == -1) { - unifi_warning(priv, "uf_init_hw: Unknown priv instance, will use fw_init[0]\n"); - priv_instance = 0; - } - - while (1) { - if (attempts > MAX_INIT_ATTEMPTS) { - unifi_error(priv, "Failed to initialise UniFi after %d attempts, " - "giving up.\n", - attempts); - break; - } - attempts++; - - unifi_info(priv, "Initialising UniFi, attempt %d\n", attempts); - - if (fw_init[priv_instance] > 0) { - unifi_notice(priv, "f/w init prevented by module parameter\n"); - break; - } else if (fw_init[priv_instance] == 0) { - fw_init[priv_instance] ++; - } - - /* - * Initialise driver core. This will perform a reset of UniFi - * internals, but not the SDIO CCCR. - */ - CsrSdioClaim(priv->sdio); - csrResult = unifi_init_card(priv->card, led_mask); - CsrSdioRelease(priv->sdio); - - if (csrResult == CSR_WIFI_HIP_RESULT_NO_DEVICE) { - return CsrHipResultToStatus(csrResult); - } - if (csrResult == CSR_WIFI_HIP_RESULT_NOT_FOUND) { - unifi_error(priv, "Firmware file required, but not found.\n"); - return CsrHipResultToStatus(csrResult); - } - if (csrResult != CSR_RESULT_SUCCESS) { - /* failed. Reset h/w and try again */ - unifi_error(priv, "Failed to initialise UniFi chip.\n"); - continue; - } - - /* Get the version information from the lib_hip */ - unifi_card_info(priv->card, &priv->card_info); - - return CsrHipResultToStatus(csrResult); - } - - return CsrHipResultToStatus(csrResult); - -} /* uf_init_hw */ - - diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c deleted file mode 100644 index f903022b4079..000000000000 --- a/drivers/staging/csr/io.c +++ /dev/null @@ -1,1098 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: io.c - * - * PURPOSE: - * This file contains routines that the SDIO driver can call when a - * UniFi card is first inserted (or detected) and removed. - * - * When used with sdioemb, the udev scripts (at least on Ubuntu) don't - * recognise a UniFi being added to the system. This is because sdioemb - * does not register itself as a device_driver, it uses it's own code - * to handle insert and remove. - * To have Ubuntu recognise UniFi, edit /etc/udev/rules.d/85-ifupdown.rules - * to change this line: - * SUBSYSTEM=="net", DRIVERS=="?*", GOTO="net_start" - * to these: - * #SUBSYSTEM=="net", DRIVERS=="?*", GOTO="net_start" - * SUBSYSTEM=="net", GOTO="net_start" - * - * Then you can add a stanza to /etc/network/interfaces like this: - * auto eth1 - * iface eth1 inet dhcp - * wpa-conf /etc/wpa_supplicant.conf - * This will then automatically associate when a car dis inserted. - * - * Copyright (C) 2006-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#include <linux/proc_fs.h> -#include <linux/seq_file.h> - -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_unifiversion.h" -#include "csr_wifi_hip_unifi_udi.h" /* for unifi_print_status() */ -#include "unifiio.h" -#include "unifi_priv.h" - -/* - * Array of pointers to context structs for unifi devices that are present. - * The index in the array corresponds to the wlan interface number - * (if "wlan*" is used). If "eth*" is used, the eth* numbers are allocated - * after any Ethernet cards. - * - * The Arasan PCI-SDIO controller card supported by this driver has 2 slots, - * hence a max of 2 devices. - */ -static unifi_priv_t *Unifi_instances[MAX_UNIFI_DEVS]; - -/* Array of pointers to netdev objects used by the UniFi driver, as there - * are now many per instance. This is used to determine which netdev events - * are for UniFi as opposed to other net interfaces. - */ -static netInterface_priv_t *Unifi_netdev_instances[MAX_UNIFI_DEVS * CSR_WIFI_NUM_INTERFACES]; - -/* - * Array to hold the status of each unifi device in each slot. - * We only process an insert event when In_use[] for the slot is - * UNIFI_DEV_NOT_IN_USE. Otherwise, it means that the slot is in use or - * we are in the middle of a cleanup (the action on unplug). - */ -#define UNIFI_DEV_NOT_IN_USE 0 -#define UNIFI_DEV_IN_USE 1 -#define UNIFI_DEV_CLEANUP 2 -static int In_use[MAX_UNIFI_DEVS]; -/* - * Mutex to prevent UDI clients to open the character device before the priv - * is created and initialised. - */ -DEFINE_SEMAPHORE(Unifi_instance_mutex); -/* - * When the device is removed, unregister waits on Unifi_cleanup_wq - * until all the UDI clients release the character device. - */ -DECLARE_WAIT_QUEUE_HEAD(Unifi_cleanup_wq); - -#ifdef CONFIG_PROC_FS -/* - * seq_file wrappers for procfile show routines. - */ -static int uf_proc_show(struct seq_file *m, void *v); - -#define UNIFI_DEBUG_TXT_BUFFER (8 * 1024) - -static int uf_proc_open(struct inode *inode, struct file *file) -{ - return single_open_size(file, uf_proc_show, PDE_DATA(inode), - UNIFI_DEBUG_TXT_BUFFER); -} - -static const struct file_operations uf_proc_fops = { - .open = uf_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -#endif /* CONFIG_PROC_FS */ - -#ifdef CSR_WIFI_RX_PATH_SPLIT - -static CsrResult signal_buffer_init(unifi_priv_t * priv, int size) -{ - int i; - - priv->rxSignalBuffer.writePointer = - priv->rxSignalBuffer.readPointer = 0; - priv->rxSignalBuffer.size = size; - /* Allocating Memory for Signal primitive pointer */ - for(i=0; i<size; i++) - { - priv->rxSignalBuffer.rx_buff[i].sig_len=0; - priv->rxSignalBuffer.rx_buff[i].bufptr = kmalloc(UNIFI_PACKED_SIGBUF_SIZE, GFP_KERNEL); - if (priv->rxSignalBuffer.rx_buff[i].bufptr == NULL) - { - int j; - unifi_error(priv, "signal_buffer_init:Failed to Allocate shared memory for T-H signals \n"); - for(j=0;j<i;j++) - { - priv->rxSignalBuffer.rx_buff[j].sig_len=0; - kfree(priv->rxSignalBuffer.rx_buff[j].bufptr); - priv->rxSignalBuffer.rx_buff[j].bufptr = NULL; - } - return -1; - } - } - return 0; -} - - -static void signal_buffer_free(unifi_priv_t * priv, int size) -{ - int i; - - for(i=0; i<size; i++) - { - priv->rxSignalBuffer.rx_buff[i].sig_len=0; - kfree(priv->rxSignalBuffer.rx_buff[i].bufptr); - priv->rxSignalBuffer.rx_buff[i].bufptr = NULL; - } -} -#endif -/* - * --------------------------------------------------------------------------- - * uf_register_netdev - * - * Registers the network interface, installes the qdisc, - * and registers the inet handler. - * In the porting exercise, register the driver to the network - * stack if necessary. - * - * Arguments: - * priv Pointer to driver context. - * - * Returns: - * O on success, non-zero otherwise. - * - * Notes: - * We will only unregister when the card is ejected, so we must - * only do it once. - * --------------------------------------------------------------------------- - */ -int -uf_register_netdev(unifi_priv_t *priv, int interfaceTag) -{ - int r; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "uf_register_netdev bad interfaceTag\n"); - return -EINVAL; - } - - /* - * Allocates a device number and registers device with the network - * stack. - */ - unifi_trace(priv, UDBG5, "uf_register_netdev: netdev %d - 0x%p\n", - interfaceTag, priv->netdev[interfaceTag]); - r = register_netdev(priv->netdev[interfaceTag]); - if (r) { - unifi_error(priv, "Failed to register net device\n"); - return -EINVAL; - } - - /* The device is registed */ - interfacePriv->netdev_registered = 1; - -#ifdef CSR_SUPPORT_SME - /* - * Register the inet handler; it notifies us for changes in the IP address. - */ - uf_register_inet_notifier(); -#endif /* CSR_SUPPORT_SME */ - - unifi_notice(priv, "unifi%d is %s\n", - priv->instance, priv->netdev[interfaceTag]->name); - - return 0; -} /* uf_register_netdev */ - - -/* - * --------------------------------------------------------------------------- - * uf_unregister_netdev - * - * Unregisters the network interface and the inet handler. - * - * Arguments: - * priv Pointer to driver context. - * - * Returns: - * None. - * - * --------------------------------------------------------------------------- - */ -void -uf_unregister_netdev(unifi_priv_t *priv) -{ - int i=0; - -#ifdef CSR_SUPPORT_SME - /* Unregister the inet handler... */ - uf_unregister_inet_notifier(); -#endif /* CSR_SUPPORT_SME */ - - for (i=0; i<CSR_WIFI_NUM_INTERFACES; i++) { - netInterface_priv_t *interfacePriv = priv->interfacePriv[i]; - if (interfacePriv->netdev_registered) { - unifi_trace(priv, UDBG5, - "uf_unregister_netdev: netdev %d - 0x%p\n", - i, priv->netdev[i]); - - /* ... and the netdev */ - unregister_netdev(priv->netdev[i]); - interfacePriv->netdev_registered = 0; - } - - interfacePriv->interfaceMode = 0; - - /* Enable all queues by default */ - interfacePriv->queueEnabled[0] = 1; - interfacePriv->queueEnabled[1] = 1; - interfacePriv->queueEnabled[2] = 1; - interfacePriv->queueEnabled[3] = 1; - } - - priv->totalInterfaceCount = 0; -} /* uf_unregister_netdev() */ - - -/* - * --------------------------------------------------------------------------- - * register_unifi_sdio - * - * This function is called from the Probe (or equivalent) method of - * the SDIO driver when a UniFi card is detected. - * We allocate the Linux net_device struct, initialise the HIP core - * lib, create the char device nodes and start the userspace helper - * to initialise the device. - * - * Arguments: - * sdio_dev Pointer to SDIO context handle to use for all - * SDIO ops. - * bus_id A small number indicating the SDIO card position on the - * bus. Typically this is the slot number, e.g. 0, 1 etc. - * Valid values are 0 to MAX_UNIFI_DEVS-1. - * dev Pointer to kernel device manager struct. - * - * Returns: - * Pointer to the unifi instance, or NULL on error. - * --------------------------------------------------------------------------- - */ -static unifi_priv_t * -register_unifi_sdio(CsrSdioFunction *sdio_dev, int bus_id, struct device *dev) -{ - unifi_priv_t *priv = NULL; - int r = -1; - CsrResult csrResult; - - if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) { - unifi_error(priv, "register_unifi_sdio: invalid device %d\n", - bus_id); - return NULL; - } - - down(&Unifi_instance_mutex); - - if (In_use[bus_id] != UNIFI_DEV_NOT_IN_USE) { - unifi_error(priv, "register_unifi_sdio: device %d is already in use\n", - bus_id); - goto failed0; - } - - - /* Allocate device private and net_device structs */ - priv = uf_alloc_netdevice(sdio_dev, bus_id); - if (priv == NULL) { - unifi_error(priv, "Failed to allocate driver private\n"); - goto failed0; - } - - priv->unifi_device = dev; - - SET_NETDEV_DEV(priv->netdev[0], dev); - - /* We are not ready to send data yet. */ - netif_carrier_off(priv->netdev[0]); - - /* Allocate driver context. */ - priv->card = unifi_alloc_card(priv->sdio, priv); - if (priv->card == NULL) { - unifi_error(priv, "Failed to allocate UniFi driver card struct.\n"); - goto failed1; - } - - if (Unifi_instances[bus_id]) { - unifi_error(priv, "Internal error: instance for slot %d is already taken\n", - bus_id); - } - Unifi_instances[bus_id] = priv; - In_use[bus_id] = UNIFI_DEV_IN_USE; - - /* Save the netdev_priv for use by the netdev event callback mechanism */ - Unifi_netdev_instances[bus_id * CSR_WIFI_NUM_INTERFACES] = netdev_priv(priv->netdev[0]); - - /* Initialise the mini-coredump capture buffers */ - csrResult = unifi_coredump_init(priv->card, (u16)coredump_max); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "Couldn't allocate mini-coredump buffers\n"); - } - - /* Create the character device nodes */ - r = uf_create_device_nodes(priv, bus_id); - if (r) { - goto failed1; - } - - /* - * We use the slot number as unifi device index. - */ - scnprintf(priv->proc_entry_name, 64, "driver/unifi%d", priv->instance); - /* - * The following complex casting is in place in order to eliminate 64-bit compilation warning - * "cast to/from pointer from/to integer of different size" - */ - if (!proc_create_data(priv->proc_entry_name, 0, NULL, - &uf_proc_fops, (void *)(long)priv->instance)) - { - unifi_error(priv, "unifi: can't create /proc/driver/unifi\n"); - } - - /* Allocate the net_device for interfaces other than 0. */ - { - int i; - priv->totalInterfaceCount =0; - - for(i=1;i<CSR_WIFI_NUM_INTERFACES;i++) - { - if( !uf_alloc_netdevice_for_other_interfaces(priv, i) ) - { - /* error occured while allocating the net_device for interface[i]. The net_device are - * allocated for the interfaces with id<i. Dont worry, all the allocated net_device will - * be releasing chen the control goes to the label failed0. - */ - unifi_error(priv, "Failed to allocate driver private for interface[%d]\n", i); - goto failed0; - } - else - { - SET_NETDEV_DEV(priv->netdev[i], dev); - - /* We are not ready to send data yet. */ - netif_carrier_off(priv->netdev[i]); - - /* Save the netdev_priv for use by the netdev event callback mechanism */ - Unifi_netdev_instances[bus_id * CSR_WIFI_NUM_INTERFACES + i] = netdev_priv(priv->netdev[i]); - } - } - - for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++) - { - netInterface_priv_t *interfacePriv = priv->interfacePriv[i]; - interfacePriv->netdev_registered=0; - } - } - -#ifdef CSR_WIFI_RX_PATH_SPLIT - if (signal_buffer_init(priv, CSR_WIFI_RX_SIGNAL_BUFFER_SIZE)) - { - unifi_error(priv, "Failed to allocate shared memory for T-H signals\n"); - goto failed2; - } - priv->rx_workqueue = create_singlethread_workqueue("rx_workq"); - if (priv->rx_workqueue == NULL) { - unifi_error(priv, "create_singlethread_workqueue failed \n"); - goto failed3; - } - INIT_WORK(&priv->rx_work_struct, rx_wq_handler); -#endif - -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE - if (log_hip_signals) - { - uf_register_hip_offline_debug(priv); - } -#endif - - /* Initialise the SME related threads and parameters */ - r = uf_sme_init(priv); - if (r) { - unifi_error(priv, "SME initialisation failed.\n"); - goto failed4; - } - - /* - * Run the userspace helper program (unififw) to perform - * the device initialisation. - */ - unifi_trace(priv, UDBG1, "run UniFi helper app...\n"); - r = uf_run_unifihelper(priv); - if (r) { - unifi_notice(priv, "unable to run UniFi helper app\n"); - /* Not a fatal error. */ - } - - up(&Unifi_instance_mutex); - - return priv; - -failed4: -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -if (log_hip_signals) -{ - uf_unregister_hip_offline_debug(priv); -} -#endif -#ifdef CSR_WIFI_RX_PATH_SPLIT - flush_workqueue(priv->rx_workqueue); - destroy_workqueue(priv->rx_workqueue); -failed3: - signal_buffer_free(priv, CSR_WIFI_RX_SIGNAL_BUFFER_SIZE); -failed2: -#endif - /* Remove the device nodes */ - uf_destroy_device_nodes(priv); -failed1: - /* Deregister priv->netdev_client */ - ul_deregister_client(priv->netdev_client); - -failed0: - if (priv && priv->card) { - unifi_coredump_free(priv->card); - unifi_free_card(priv->card); - } - if (priv) { - uf_free_netdevice(priv); - } - - up(&Unifi_instance_mutex); - - return NULL; -} /* register_unifi_sdio() */ - - -/* - * --------------------------------------------------------------------------- - * ask_unifi_sdio_cleanup - * - * We can not free our private context, until all the char device - * clients have closed the file handles. unregister_unifi_sdio() which - * is called when a card is removed, waits on Unifi_cleanup_wq until - * the reference count becomes zero. It is time to wake it up now. - * - * Arguments: - * priv Pointer to driver context. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void -ask_unifi_sdio_cleanup(unifi_priv_t *priv) -{ - - /* - * Now clear the flag that says the old instance is in use. - * This is used to prevent a new instance being started before old - * one has finshed closing down, for example if bounce makes the card - * appear to be ejected and re-inserted quickly. - */ - In_use[priv->instance] = UNIFI_DEV_CLEANUP; - - unifi_trace(NULL, UDBG5, "ask_unifi_sdio_cleanup: wake up cleanup workqueue.\n"); - wake_up(&Unifi_cleanup_wq); - -} /* ask_unifi_sdio_cleanup() */ - - -/* - * --------------------------------------------------------------------------- - * cleanup_unifi_sdio - * - * Release any resources owned by a unifi instance. - * - * Arguments: - * priv Pointer to the instance to free. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void -cleanup_unifi_sdio(unifi_priv_t *priv) -{ - int priv_instance; - int i; - static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; - - /* Remove the device nodes */ - uf_destroy_device_nodes(priv); - - /* Mark this device as gone away by NULLing the entry in Unifi_instances */ - Unifi_instances[priv->instance] = NULL; - - unifi_trace(priv, UDBG5, "cleanup_unifi_sdio: remove_proc_entry\n"); - /* - * Free the children of priv before unifi_free_netdevice() frees - * the priv struct - */ - remove_proc_entry(priv->proc_entry_name, 0); - - - /* Unregister netdev as a client. */ - if (priv->netdev_client) { - unifi_trace(priv, UDBG2, "Netdev client (id:%d s:0x%X) is unregistered\n", - priv->netdev_client->client_id, priv->netdev_client->sender_id); - ul_deregister_client(priv->netdev_client); - } - - /* Destroy the SME related threads and parameters */ - uf_sme_deinit(priv); - -#ifdef CSR_SME_USERSPACE - priv->smepriv = NULL; -#endif - -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE - if (log_hip_signals) - { - uf_unregister_hip_offline_debug(priv); - } -#endif - - /* Free any packets left in the Rx queues */ - for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++) - { - uf_free_pending_rx_packets(priv, UF_UNCONTROLLED_PORT_Q, broadcast_address, i); - uf_free_pending_rx_packets(priv, UF_CONTROLLED_PORT_Q, broadcast_address, i); - } - /* - * We need to free the resources held by the core, which include tx skbs, - * otherwise we can not call unregister_netdev(). - */ - if (priv->card) { - unifi_trace(priv, UDBG5, "cleanup_unifi_sdio: free card\n"); - unifi_coredump_free(priv->card); - unifi_free_card(priv->card); - priv->card = NULL; - } - - /* - * Unregister the network device. - * We can not unregister the netdev before we release - * all pending packets in the core. - */ - uf_unregister_netdev(priv); - priv->totalInterfaceCount = 0; - - /* Clear the table of registered netdev_priv's */ - for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { - Unifi_netdev_instances[priv->instance * CSR_WIFI_NUM_INTERFACES + i] = NULL; - } - - unifi_trace(priv, UDBG5, "cleanup_unifi_sdio: uf_free_netdevice\n"); - /* - * When uf_free_netdevice() returns, the priv is invalid - * so we need to remember the instance to clear the global flag later. - */ - priv_instance = priv->instance; - -#ifdef CSR_WIFI_RX_PATH_SPLIT - flush_workqueue(priv->rx_workqueue); - destroy_workqueue(priv->rx_workqueue); - signal_buffer_free(priv, CSR_WIFI_RX_SIGNAL_BUFFER_SIZE); -#endif - - /* Priv is freed as part of the net_device */ - uf_free_netdevice(priv); - - /* - * Now clear the flag that says the old instance is in use. - * This is used to prevent a new instance being started before old - * one has finshed closing down, for example if bounce makes the card - * appear to be ejected and re-inserted quickly. - */ - In_use[priv_instance] = UNIFI_DEV_NOT_IN_USE; - - unifi_trace(NULL, UDBG5, "cleanup_unifi_sdio: DONE.\n"); - -} /* cleanup_unifi_sdio() */ - - -/* - * --------------------------------------------------------------------------- - * unregister_unifi_sdio - * - * Call from SDIO driver when it detects that UniFi has been removed. - * - * Arguments: - * bus_id Number of the card that was ejected. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void -unregister_unifi_sdio(int bus_id) -{ - unifi_priv_t *priv; - int interfaceTag=0; - u8 reason = CONFIG_IND_EXIT; - - if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) { - unifi_error(NULL, "unregister_unifi_sdio: invalid device %d\n", - bus_id); - return; - } - - priv = Unifi_instances[bus_id]; - if (priv == NULL) { - unifi_error(priv, "unregister_unifi_sdio: device %d is not registered\n", - bus_id); - return; - } - - /* Stop the network traffic before freeing the core. */ - for(interfaceTag=0;interfaceTag<priv->totalInterfaceCount;interfaceTag++) - { - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - if(interfacePriv->netdev_registered) - { - netif_carrier_off(priv->netdev[interfaceTag]); - netif_tx_stop_all_queues(priv->netdev[interfaceTag]); - } - } - -#ifdef CSR_NATIVE_LINUX - /* - * If the unifi thread was started, signal it to stop. This - * should cause any userspace processes with open unifi device to - * close them. - */ - uf_stop_thread(priv, &priv->bh_thread); - - /* Unregister the interrupt handler */ - if (csr_sdio_linux_remove_irq(priv->sdio)) { - unifi_notice(priv, - "csr_sdio_linux_remove_irq failed to talk to card.\n"); - } - - /* Ensure no MLME functions are waiting on a the mlme_event semaphore. */ - uf_abort_mlme(priv); -#endif /* CSR_NATIVE_LINUX */ - - ul_log_config_ind(priv, &reason, sizeof(u8)); - - /* Deregister the UDI hook from the core. */ - unifi_remove_udi_hook(priv->card, logging_handler); - - uf_put_instance(bus_id); - - /* - * Wait until the device is cleaned up. i.e., when all userspace - * processes have closed any open unifi devices. - */ - wait_event(Unifi_cleanup_wq, In_use[bus_id] == UNIFI_DEV_CLEANUP); - unifi_trace(NULL, UDBG5, "Received clean up event\n"); - - /* Now we can free the private context and the char device nodes */ - cleanup_unifi_sdio(priv); - -} /* unregister_unifi_sdio() */ - - -/* - * --------------------------------------------------------------------------- - * uf_find_instance - * - * Find the context structure for a given UniFi device instance. - * - * Arguments: - * inst The instance number to look for. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -unifi_priv_t * -uf_find_instance(int inst) -{ - if ((inst < 0) || (inst >= MAX_UNIFI_DEVS)) { - return NULL; - } - return Unifi_instances[inst]; -} /* uf_find_instance() */ - - -/* - * --------------------------------------------------------------------------- - * uf_find_priv - * - * Find the device instance for a given context structure. - * - * Arguments: - * priv The context structure pointer to look for. - * - * Returns: - * index of instance, -1 otherwise. - * --------------------------------------------------------------------------- - */ -int -uf_find_priv(unifi_priv_t *priv) -{ - int inst; - - if (!priv) { - return -1; - } - - for (inst = 0; inst < MAX_UNIFI_DEVS; inst++) { - if (Unifi_instances[inst] == priv) { - return inst; - } - } - - return -1; -} /* uf_find_priv() */ - -/* - * --------------------------------------------------------------------------- - * uf_find_netdev_priv - * - * Find the device instance for a given netdev context structure. - * - * Arguments: - * priv The context structure pointer to look for. - * - * Returns: - * index of instance, -1 otherwise. - * --------------------------------------------------------------------------- - */ -int -uf_find_netdev_priv(netInterface_priv_t *priv) -{ - int inst; - - if (!priv) { - return -1; - } - - for (inst = 0; inst < MAX_UNIFI_DEVS * CSR_WIFI_NUM_INTERFACES; inst++) { - if (Unifi_netdev_instances[inst] == priv) { - return inst; - } - } - - return -1; -} /* uf_find_netdev_priv() */ - -/* - * --------------------------------------------------------------------------- - * uf_get_instance - * - * Find the context structure for a given UniFi device instance - * and increment the reference count. - * - * Arguments: - * inst The instance number to look for. - * - * Returns: - * Pointer to the instance or NULL if no instance exists. - * --------------------------------------------------------------------------- - */ -unifi_priv_t * -uf_get_instance(int inst) -{ - unifi_priv_t *priv; - - down(&Unifi_instance_mutex); - - priv = uf_find_instance(inst); - if (priv) { - priv->ref_count++; - } - - up(&Unifi_instance_mutex); - - return priv; -} - -/* - * --------------------------------------------------------------------------- - * uf_put_instance - * - * Decrement the context reference count, freeing resources and - * shutting down the driver when the count reaches zero. - * - * Arguments: - * inst The instance number to look for. - * - * Returns: - * Pointer to the instance or NULL if no instance exists. - * --------------------------------------------------------------------------- - */ -void -uf_put_instance(int inst) -{ - unifi_priv_t *priv; - - down(&Unifi_instance_mutex); - - priv = uf_find_instance(inst); - if (priv) { - priv->ref_count--; - if (priv->ref_count == 0) { - ask_unifi_sdio_cleanup(priv); - } - } - - up(&Unifi_instance_mutex); -} - - -/* - * --------------------------------------------------------------------------- - * uf_proc_show - * - * Read method for driver node in /proc/driver/unifi0 - * - * Arguments: - * page - * start - * offset - * count - * eof - * data - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -#ifdef CONFIG_PROC_FS -static int uf_proc_show(struct seq_file *m, void *v) -{ - unifi_priv_t *priv; - int i; - - /* - * The following complex casting is in place in order to eliminate - * 64-bit compilation warning "cast to/from pointer from/to integer of - * different size" - */ - priv = uf_find_instance((long)m->private); - if (!priv) - return 0; - - seq_printf(m, "UniFi SDIO Driver: %s %s %s\n", - CSR_WIFI_VERSION, __DATE__, __TIME__); -#ifdef CSR_SME_USERSPACE - seq_puts(m, "SME: CSR userspace "); -#ifdef CSR_SUPPORT_WEXT - seq_puts(m, "with WEXT support\n"); -#else - seq_putc(m, '\n'); -#endif /* CSR_SUPPORT_WEXT */ -#endif /* CSR_SME_USERSPACE */ -#ifdef CSR_NATIVE_LINUX - seq_puts(m, "SME: native\n"); -#endif - -#ifdef CSR_SUPPORT_SME - seq_printf(m, "Firmware (ROM) build:%u, Patch:%u\n", - priv->card_info.fw_build, - priv->sme_versions.firmwarePatch); -#endif - - unifi_print_status(priv->card, m); - - seq_printf(m, "Last dbg str: %s\n", priv->last_debug_string); - - seq_puts(m, "Last dbg16:"); - for (i = 0; i < 8; i++) - seq_printf(m, " %04X", priv->last_debug_word16[i]); - seq_putc(m, '\n'); - seq_puts(m, " "); - for (; i < 16; i++) - seq_printf(m, " %04X", priv->last_debug_word16[i]); - seq_putc(m, '\n'); - return 0; -} -#endif - - - - -static void -uf_lx_suspend(CsrSdioFunction *sdio_ctx) -{ - unifi_priv_t *priv = sdio_ctx->driverData; - unifi_suspend(priv); - - CsrSdioSuspendAcknowledge(sdio_ctx, CSR_RESULT_SUCCESS); -} - -static void -uf_lx_resume(CsrSdioFunction *sdio_ctx) -{ - unifi_priv_t *priv = sdio_ctx->driverData; - unifi_resume(priv); - - CsrSdioResumeAcknowledge(sdio_ctx, CSR_RESULT_SUCCESS); -} - -static int active_slot = MAX_UNIFI_DEVS; -static struct device *os_devices[MAX_UNIFI_DEVS]; - -void -uf_add_os_device(int bus_id, struct device *os_device) -{ - if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) { - unifi_error(NULL, "uf_add_os_device: invalid device %d\n", - bus_id); - return; - } - - active_slot = bus_id; - os_devices[bus_id] = os_device; -} /* uf_add_os_device() */ - -void -uf_remove_os_device(int bus_id) -{ - if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) { - unifi_error(NULL, "uf_remove_os_device: invalid device %d\n", - bus_id); - return; - } - - active_slot = bus_id; - os_devices[bus_id] = NULL; -} /* uf_remove_os_device() */ - -static void -uf_sdio_inserted(CsrSdioFunction *sdio_ctx) -{ - unifi_priv_t *priv; - - unifi_trace(NULL, UDBG5, "uf_sdio_inserted(0x%p), slot_id=%d, dev=%p\n", - sdio_ctx, active_slot, os_devices[active_slot]); - - priv = register_unifi_sdio(sdio_ctx, active_slot, os_devices[active_slot]); - if (priv == NULL) { - CsrSdioInsertedAcknowledge(sdio_ctx, CSR_RESULT_FAILURE); - return; - } - - sdio_ctx->driverData = priv; - - CsrSdioInsertedAcknowledge(sdio_ctx, CSR_RESULT_SUCCESS); -} /* uf_sdio_inserted() */ - - -static void -uf_sdio_removed(CsrSdioFunction *sdio_ctx) -{ - unregister_unifi_sdio(active_slot); - CsrSdioRemovedAcknowledge(sdio_ctx); -} /* uf_sdio_removed() */ - - -static void -uf_sdio_dsr_handler(CsrSdioFunction *sdio_ctx) -{ - unifi_priv_t *priv = sdio_ctx->driverData; - - unifi_sdio_interrupt_handler(priv->card); -} /* uf_sdio_dsr_handler() */ - -/* - * --------------------------------------------------------------------------- - * uf_sdio_int_handler - * - * Interrupt callback function for SDIO interrupts. - * This is called in kernel context (i.e. not interrupt context). - * We retrieve the unifi context pointer and call the main UniFi - * interrupt handler. - * - * Arguments: - * fdev SDIO context pointer - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static CsrSdioInterruptDsrCallback -uf_sdio_int_handler(CsrSdioFunction *sdio_ctx) -{ - return uf_sdio_dsr_handler; -} /* uf_sdio_int_handler() */ - - - - -static CsrSdioFunctionId unifi_ids[] = -{ - { - .manfId = SDIO_MANF_ID_CSR, - .cardId = SDIO_CARD_ID_UNIFI_3, - .sdioFunction = SDIO_WLAN_FUNC_ID_UNIFI_3, - .sdioInterface = CSR_SDIO_ANY_SDIO_INTERFACE, - }, - { - .manfId = SDIO_MANF_ID_CSR, - .cardId = SDIO_CARD_ID_UNIFI_4, - .sdioFunction = SDIO_WLAN_FUNC_ID_UNIFI_4, - .sdioInterface = CSR_SDIO_ANY_SDIO_INTERFACE, - } -}; - - -/* - * Structure to register with the glue layer. - */ -static CsrSdioFunctionDriver unifi_sdioFunction_drv = -{ - .inserted = uf_sdio_inserted, - .removed = uf_sdio_removed, - .intr = uf_sdio_int_handler, - .suspend = uf_lx_suspend, - .resume = uf_lx_resume, - - .ids = unifi_ids, - .idsCount = sizeof(unifi_ids) / sizeof(unifi_ids[0]) -}; - - -/* - * --------------------------------------------------------------------------- - * uf_sdio_load - * uf_sdio_unload - * - * These functions are called from the main module load and unload - * functions. They perform the appropriate operations for the monolithic - * driver. - * - * Arguments: - * None. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -int __init -uf_sdio_load(void) -{ - CsrResult csrResult; - - csrResult = CsrSdioFunctionDriverRegister(&unifi_sdioFunction_drv); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(NULL, "Failed to register UniFi SDIO driver: csrResult=%d\n", csrResult); - return -EIO; - } - - return 0; -} /* uf_sdio_load() */ - - - -void __exit -uf_sdio_unload(void) -{ - CsrSdioFunctionDriverUnregister(&unifi_sdioFunction_drv); -} /* uf_sdio_unload() */ - diff --git a/drivers/staging/csr/mlme.c b/drivers/staging/csr/mlme.c deleted file mode 100644 index 861d6b7687c7..000000000000 --- a/drivers/staging/csr/mlme.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: mlme.c - * - * PURPOSE: - * This file provides functions to send MLME requests to the UniFi. - * - * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#include "csr_wifi_hip_unifi.h" -#include "unifi_priv.h" - -/* - * --------------------------------------------------------------------------- - * unifi_mlme_wait_for_reply - * - * Wait for a reply after sending a signal. - * - * Arguments: - * priv Pointer to device private context struct - * ul_client Pointer to linux client - * sig_reply_id ID of the expected reply (defined in sigs.h). - * timeout timeout in ms - * - * Returns: - * 0 on success, -ve POSIX code on error. - * - * Notes: - * This function waits for a specific (sig_reply_id) signal from UniFi. - * It also match the sequence number of the received (cfm) signal, with - * the latest sequence number of the signal (req) we have sent. - * These two number match be equal. - * Should only be used for waiting xxx.cfm signals and only after - * we have sent the matching xxx.req signal to UniFi. - * If no response is received within the expected time (timeout), we assume - * that the UniFi is busy and return an error. - * If the wait is aborted by a kernel signal arriving, we stop waiting. - * If a response from UniFi is not what we expected, we discard it and - * wait again. This could be a response from an aborted request. If we - * see several bad responses we assume we have lost synchronisation with - * UniFi. - * --------------------------------------------------------------------------- - */ -static int -unifi_mlme_wait_for_reply(unifi_priv_t *priv, ul_client_t *pcli, int sig_reply_id, int timeout) -{ - int retries = 0; - long r; - long t = timeout; - unsigned int sent_seq_no; - - /* Convert t in ms to jiffies */ - t = msecs_to_jiffies(t); - - do { - /* Wait for the confirm or timeout. */ - r = wait_event_interruptible_timeout(pcli->udi_wq, - (pcli->wake_up_wq_id) || (priv->io_aborted == 1), - t); - /* Check for general i/o error */ - if (priv->io_aborted) { - unifi_error(priv, "MLME operation aborted\n"); - return -EIO; - } - - /* - * If r=0 the request has timed-out. - * If r>0 the request has completed successfully. - * If r=-ERESTARTSYS an event (kill signal) has interrupted the wait_event. - */ - if ((r == 0) && (pcli->wake_up_wq_id == 0)) { - unifi_error(priv, "mlme_wait: timed-out waiting for 0x%.4X, after %lu msec.\n", - sig_reply_id, jiffies_to_msecs(t)); - pcli->wake_up_wq_id = 0; - return -ETIMEDOUT; - } else if (r == -ERESTARTSYS) { - unifi_error(priv, "mlme_wait: waiting for 0x%.4X was aborted.\n", sig_reply_id); - pcli->wake_up_wq_id = 0; - return -EINTR; - } else { - /* Get the sequence number of the signal that we previously set. */ - if (pcli->seq_no != 0) { - sent_seq_no = pcli->seq_no - 1; - } else { - sent_seq_no = 0x0F; - } - - unifi_trace(priv, UDBG5, "Received 0x%.4X, seq: (r:%d, s:%d)\n", - pcli->wake_up_wq_id, - pcli->wake_seq_no, sent_seq_no); - - /* The two sequence ids must match. */ - if (pcli->wake_seq_no == sent_seq_no) { - /* and the signal ids must match. */ - if (sig_reply_id == pcli->wake_up_wq_id) { - /* Found the expected signal */ - break; - } else { - /* This should never happen ... */ - unifi_error(priv, "mlme_wait: mismatching signal id (0x%.4X - exp 0x%.4X) (seq %d)\n", - pcli->wake_up_wq_id, - sig_reply_id, - pcli->wake_seq_no); - pcli->wake_up_wq_id = 0; - return -EIO; - } - } - /* Wait for the next signal. */ - pcli->wake_up_wq_id = 0; - - retries ++; - if (retries >= 3) { - unifi_error(priv, "mlme_wait: confirm wait retries exhausted (0x%.4X - exp 0x%.4X)\n", - pcli->wake_up_wq_id, - sig_reply_id); - pcli->wake_up_wq_id = 0; - return -EIO; - } - } - } while (1); - - pcli->wake_up_wq_id = 0; - - return 0; -} /* unifi_mlme_wait_for_reply() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_mlme_blocking_request - * - * Send a MLME request signal to UniFi. - * - * Arguments: - * priv Pointer to device private context struct - * pcli Pointer to context of calling process - * sig Pointer to the signal to send - * data_ptrs Pointer to the bulk data of the signal - * timeout The request's timeout. - * - * Returns: - * 0 on success, 802.11 result code on error. - * --------------------------------------------------------------------------- - */ -int -unifi_mlme_blocking_request(unifi_priv_t *priv, ul_client_t *pcli, - CSR_SIGNAL *sig, bulk_data_param_t *data_ptrs, - int timeout) -{ - int r; - - if (sig->SignalPrimitiveHeader.SignalId == 0) { - unifi_error(priv, "unifi_mlme_blocking_request: Invalid Signal Id (0x%x)\n", - sig->SignalPrimitiveHeader.SignalId); - return -EINVAL; - } - - down(&priv->mlme_blocking_mutex); - - sig->SignalPrimitiveHeader.ReceiverProcessId = 0; - sig->SignalPrimitiveHeader.SenderProcessId = pcli->sender_id | pcli->seq_no; - - unifi_trace(priv, UDBG2, "Send client=%d, S:0x%04X, sig 0x%.4X\n", - pcli->client_id, - sig->SignalPrimitiveHeader.SenderProcessId, - sig->SignalPrimitiveHeader.SignalId); - /* Send the signal to UniFi */ - r = ul_send_signal_unpacked(priv, sig, data_ptrs); - if (r) { - up(&priv->mlme_blocking_mutex); - unifi_error(priv, "Error queueing MLME REQUEST signal\n"); - return r; - } - - unifi_trace(priv, UDBG5, "Send 0x%.4X, seq = %d\n", - sig->SignalPrimitiveHeader.SignalId, pcli->seq_no); - - /* - * Advance the sequence number of the last sent signal, only - * if the signal has been successfully set. - */ - pcli->seq_no++; - if (pcli->seq_no > 0x0F) { - pcli->seq_no = 0; - } - - r = unifi_mlme_wait_for_reply(priv, pcli, (sig->SignalPrimitiveHeader.SignalId + 1), timeout); - up(&priv->mlme_blocking_mutex); - - if (r) { - unifi_error(priv, "Error waiting for MLME CONFIRM signal\n"); - return r; - } - - return 0; -} /* unifi_mlme_blocking_request() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_mlme_copy_reply_and_wakeup_client - * - * Copy the reply signal from UniFi to the client's structure - * and wake up the waiting client. - * - * Arguments: - * None. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -unifi_mlme_copy_reply_and_wakeup_client(ul_client_t *pcli, - CSR_SIGNAL *signal, int signal_len, - const bulk_data_param_t *bulkdata) -{ - int i; - - /* Copy the signal to the reply */ - memcpy(pcli->reply_signal, signal, signal_len); - - /* Get the sequence number of the signal that woke us up. */ - pcli->wake_seq_no = pcli->reply_signal->SignalPrimitiveHeader.ReceiverProcessId & 0x0F; - - /* Append any bulk data */ - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - if (bulkdata->d[i].data_length > 0) { - if (bulkdata->d[i].os_data_ptr) { - memcpy(pcli->reply_bulkdata[i]->ptr, bulkdata->d[i].os_data_ptr, bulkdata->d[i].data_length); - pcli->reply_bulkdata[i]->length = bulkdata->d[i].data_length; - } else { - pcli->reply_bulkdata[i]->length = 0; - } - } - } - - /* Wake the requesting MLME function. */ - pcli->wake_up_wq_id = pcli->reply_signal->SignalPrimitiveHeader.SignalId; - wake_up_interruptible(&pcli->udi_wq); - -} /* unifi_mlme_copy_reply_and_wakeup_client() */ - - -/* - * --------------------------------------------------------------------------- - * uf_abort_mlme - * - * Abort any MLME operation in progress. - * This is used in the error recovery mechanism. - * - * Arguments: - * priv Pointer to driver context. - * - * Returns: - * 0 on success. - * --------------------------------------------------------------------------- - */ -int -uf_abort_mlme(unifi_priv_t *priv) -{ - ul_client_t *ul_cli; - - /* Ensure no MLME functions are waiting on a the mlme_event semaphore. */ - priv->io_aborted = 1; - - ul_cli = priv->netdev_client; - if (ul_cli) { - wake_up_interruptible(&ul_cli->udi_wq); - } - - ul_cli = priv->wext_client; - if (ul_cli) { - wake_up_interruptible(&ul_cli->udi_wq); - } - - return 0; -} /* uf_abort_mlme() */ - - - -/* - * --------------------------------------------------------------------------- - * - * Human-readable decoding of Reason and Result codes. - * - * --------------------------------------------------------------------------- - */ - -struct mlme_code { - const char *name; - int id; -}; - -static const struct mlme_code Result_codes[] = { - { "Success", 0x0000 }, - { "Unspecified Failure", 0x0001 }, - /* (Reserved) 0x0002 - 0x0009 */ - { "Refused Capabilities Mismatch", 0x000A }, - /* (Reserved) 0x000B */ - { "Refused External Reason", 0x000C }, - /* (Reserved) 0x000D - 0x0010 */ - { "Refused AP Out Of Memory", 0x0011 }, - { "Refused Basic Rates Mismatch", 0x0012 }, - /* (Reserved) 0x0013 - 0x001F */ - { "Failure", 0x0020 }, - /* (Reserved) 0x0021 - 0x0024 */ - { "Refused Reason Unspecified", 0x0025 }, - { "Invalid Parameters", 0x0026 }, - { "Rejected With Suggested Changes", 0x0027 }, - /* (Reserved) 0x0028 - 0x002E */ - { "Rejected For Delay Period", 0x002F }, - { "Not Allowed", 0x0030 }, - { "Not Present", 0x0031 }, - { "Not QSTA", 0x0032 }, - /* (Reserved) 0x0033 - 0x7FFF */ - { "Timeout", 0x8000 }, - { "Too Many Simultaneous Requests", 0x8001 }, - { "BSS Already Started Or Joined", 0x8002 }, - { "Not Supported", 0x8003 }, - { "Transmission Failure", 0x8004 }, - { "Refused Not Authenticated", 0x8005 }, - { "Reset Required Before Start", 0x8006 }, - { "LM Info Unavailable", 0x8007 }, - { NULL, -1 } -}; - -static const struct mlme_code Reason_codes[] = { - /* (Reserved) 0x0000 */ - { "Unspecified Reason", 0x0001 }, - { "Authentication Not Valid", 0x0002 }, - { "Deauthenticated Leave BSS", 0x0003 }, - { "Disassociated Inactivity", 0x0004 }, - { "AP Overload", 0x0005 }, - { "Class2 Frame Error", 0x0006 }, - { "Class3 Frame Error", 0x0007 }, - { "Disassociated Leave BSS", 0x0008 }, - { "Association Not Authenticated", 0x0009 }, - { "Disassociated Power Capability", 0x000A }, - { "Disassociated Supported Channels", 0x000B }, - /* (Reserved) 0x000C */ - { "Invalid Information Element", 0x000D }, - { "Michael MIC Failure", 0x000E }, - { "Fourway Handshake Timeout", 0x000F }, - { "Group Key Update Timeout", 0x0010 }, - { "Handshake Element Different", 0x0011 }, - { "Invalid Group Cipher", 0x0012 }, - { "Invalid Pairwise Cipher", 0x0013 }, - { "Invalid AKMP", 0x0014 }, - { "Unsupported RSN IE Version", 0x0015 }, - { "Invalid RSN IE Capabilities", 0x0016 }, - { "Dot1X Auth Failed", 0x0017 }, - { "Cipher Rejected By Policy", 0x0018 }, - /* (Reserved) 0x0019 - 0x001F */ - { "QoS Unspecified Reason", 0x0020 }, - { "QoS Insufficient Bandwidth", 0x0021 }, - { "QoS Excessive Not Ack", 0x0022 }, - { "QoS TXOP Limit Exceeded", 0x0023 }, - { "QSTA Leaving", 0x0024 }, - { "End TS, End DLS, End BA", 0x0025 }, - { "Unknown TS, Unknown DLS, Unknown BA", 0x0026 }, - { "Timeout", 0x0027 }, - /* (Reserved) 0x0028 - 0x002C */ - { "STAKey Mismatch", 0x002D }, - { NULL, -1 } -}; - - -static const char * -lookup_something(const struct mlme_code *n, int id) -{ - for (; n->name; n++) { - if (n->id == id) { - return n->name; - } - } - - /* not found */ - return NULL; -} /* lookup_something() */ - - -const char * -lookup_result_code(int result) -{ - static char fallback[16]; - const char *str; - - str = lookup_something(Result_codes, result); - - if (str == NULL) { - snprintf(fallback, 16, "%d", result); - str = fallback; - } - - return str; -} /* lookup_result_code() */ - - -/* - * --------------------------------------------------------------------------- - * lookup_reason - * - * Return a description string for a WiFi MLME ReasonCode. - * - * Arguments: - * reason The ReasonCode to interpret. - * - * Returns: - * Pointer to description string. - * --------------------------------------------------------------------------- - */ -const char * -lookup_reason_code(int reason) -{ - static char fallback[16]; - const char *str; - - str = lookup_something(Reason_codes, reason); - - if (str == NULL) { - snprintf(fallback, 16, "%d", reason); - str = fallback; - } - - return str; -} /* lookup_reason_code() */ - diff --git a/drivers/staging/csr/monitor.c b/drivers/staging/csr/monitor.c deleted file mode 100644 index e11f6cba8266..000000000000 --- a/drivers/staging/csr/monitor.c +++ /dev/null @@ -1,384 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: monitor.c - * - * Copyright (C) 2006-2008 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ - -#include "unifi_priv.h" - -#ifdef UNIFI_SNIFF_ARPHRD - - -#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_RADIOTAP) -#include <net/ieee80211_radiotap.h> -#endif - -#ifndef ETH_P_80211_RAW -#define ETH_P_80211_RAW ETH_P_ALL -#endif - -/* - * --------------------------------------------------------------------------- - * uf_start_sniff - * - * Start UniFi capture in SNIFF mode, i.e capture everything it hears. - * - * Arguments: - * priv Pointer to device private context struct - * - * Returns: - * 0 on success or kernel error code - * --------------------------------------------------------------------------- - */ -int -uf_start_sniff(unifi_priv_t *priv) -{ - ul_client_t *pcli = priv->wext_client; - CSR_SIGNAL signal; - CSR_MLME_SNIFFJOIN_REQUEST *req = &signal.u.MlmeSniffjoinRequest; - int timeout = 1000; - int r; - - req->Ifindex = priv->if_index; - req->Channel = priv->wext_conf.channel; - req->ChannelStartingFactor = 0; - - signal.SignalPrimitiveHeader.SignalId = CSR_MLME_SNIFFJOIN_REQUEST_ID; - - r = unifi_mlme_blocking_request(priv, pcli, &signal, NULL, timeout); - if (r < 0) { - unifi_error(priv, "failed to send SNIFFJOIN request, error %d\n", r); - return r; - } - - r = pcli->reply_signal->u.MlmeSniffjoinConfirm.Resultcode; - if (r) { - unifi_notice(priv, "SNIFFJOIN request was rejected with result 0x%X (%s)\n", - r, lookup_result_code(r)); - return -EIO; - } - - return 0; -} /* uf_start_sniff() */ - - - -/* - * --------------------------------------------------------------------------- - * netrx_radiotap - * - * Reformat a UniFi SNIFFDATA signal into a radiotap packet. - * - * Arguments: - * priv OS private context pointer. - * ind Pointer to a MA_UNITDATA_INDICATION or - * DS_UNITDATA_INDICATION indication structure. - * - * Notes: - * Radiotap header values are all little-endian, UniFi signals will have - * been converted to host-endian. - * --------------------------------------------------------------------------- - */ -#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_RADIOTAP) -static void -netrx_radiotap(unifi_priv_t *priv, - const CSR_MA_SNIFFDATA_INDICATION *ind, - struct sk_buff *skb_orig) -{ - struct net_device *dev = priv->netdev; - struct sk_buff *skb = NULL; - unsigned char *ptr; - unsigned char *base; - int ind_data_len = skb_orig->len - 2 - ETH_HLEN; - struct unifi_rx_radiotap_header { - struct ieee80211_radiotap_header rt_hdr; - /* IEEE80211_RADIOTAP_TSFT */ - u64 rt_tsft; - /* IEEE80211_RADIOTAP_FLAGS */ - u8 rt_flags; - /* IEEE80211_RADIOTAP_RATE */ - u8 rt_rate; - /* IEEE80211_RADIOTAP_CHANNEL */ - u16 rt_chan; - u16 rt_chan_flags; - /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */ - u8 rt_dbm_antsignal; - /* IEEE80211_RADIOTAP_DBM_ANTNOISE */ - u8 rt_dbm_antnoise; - /* IEEE80211_RADIOTAP_ANTENNA */ - u8 rt_antenna; - - /* pad to 4-byte boundary */ - u8 pad[3]; - } __attribute__((__packed__)); - - struct unifi_rx_radiotap_header *unifi_rt; - int signal, noise, snr; - - if (ind_data_len <= 0) { - unifi_error(priv, "Invalid length in CSR_MA_SNIFFDATA_INDICATION.\n"); - return; - } - - /* - * Allocate a SKB for the received data packet, including radiotap - * header. - */ - skb = dev_alloc_skb(ind_data_len + sizeof(struct unifi_rx_radiotap_header) + 4); - if (! skb) { - unifi_error(priv, "alloc_skb failed.\n"); - priv->stats.rx_errors++; - return; - } - - base = skb->data; - - /* Reserve the radiotap header at the front of skb */ - unifi_rt = (struct unifi_rx_radiotap_header *) - skb_put(skb, sizeof(struct unifi_rx_radiotap_header)); - - /* Copy in the 802.11 frame */ - ptr = skb_put(skb, ind_data_len); - memcpy(ptr, skb_orig->data, ind_data_len); - - unifi_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; - unifi_rt->rt_hdr.it_pad = 0; /* always good to zero */ - unifi_rt->rt_hdr.it_len = sizeof(struct unifi_rx_radiotap_header); - - /* Big bitfield of all the fields we provide in radiotap */ - unifi_rt->rt_hdr.it_present = 0 - | (1 << IEEE80211_RADIOTAP_TSFT) - | (1 << IEEE80211_RADIOTAP_FLAGS) - | (1 << IEEE80211_RADIOTAP_RATE) - | (1 << IEEE80211_RADIOTAP_CHANNEL) - | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) - | (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) - | (1 << IEEE80211_RADIOTAP_ANTENNA) - ; - - - /* No flags to set */ - unifi_rt->rt_tsft = (((u64)ind->Timestamp.x[7]) | (((u64)ind->Timestamp.x[6]) << 8) | - (((u64)ind->Timestamp.x[5]) << 16) | (((u64)ind->Timestamp.x[4]) << 24) | - (((u64)ind->Timestamp.x[3]) << 32) | (((u64)ind->Timestamp.x[2]) << 40) | - (((u64)ind->Timestamp.x[1]) << 48) | (((u64)ind->Timestamp.x[0]) << 56)); - - unifi_rt->rt_flags = 0; - - unifi_rt->rt_rate = ind->Rate; - - unifi_rt->rt_chan = cpu_to_le16(ieee80211chan2mhz(priv->wext_conf.channel)); - unifi_rt->rt_chan_flags = 0; - - /* Convert signal to dBm */ - signal = (s16)unifi2host_16(ind->Rssi); /* in dBm */ - snr = (s16)unifi2host_16(ind->Snr); /* in dB */ - noise = signal - snr; - - unifi_rt->rt_dbm_antsignal = signal; - unifi_rt->rt_dbm_antnoise = noise; - - unifi_rt->rt_antenna = ind->AntennaId; - - - skb->dev = dev; - skb_reset_mac_header(skb); - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = __constant_htons(ETH_P_80211_RAW); - memset(skb->cb, 0, sizeof(skb->cb)); - - /* Pass up to Linux network stack */ - netif_rx_ni(skb); - - dev->last_rx = jiffies; - - /* Bump the rx stats */ - priv->stats.rx_packets++; - priv->stats.rx_bytes += ind_data_len; - -} /* netrx_radiotap() */ -#endif /* RADIOTAP */ - - -/* - * --------------------------------------------------------------------------- - * netrx_prism - * - * Reformat a UniFi SNIFFDATA signal into a Prism format sniff packet. - * - * Arguments: - * priv OS private context pointer. - * ind Pointer to a MA_UNITDATA_INDICATION or - * DS_UNITDATA_INDICATION indication structure. - * - * Notes: - * Radiotap header values are all little-endian, UniFi signals will have - * been converted to host-endian. - * --------------------------------------------------------------------------- - */ -#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_PRISM) -static void -netrx_prism(unifi_priv_t *priv, - const CSR_MA_SNIFFDATA_INDICATION *ind, - struct sk_buff *skb_orig) -{ - struct net_device *dev = priv->netdev; - struct sk_buff *skb = NULL; - unsigned char *ptr; - unsigned char *base; - int ind_data_len = skb_orig->len - 2 - ETH_HLEN; -#define WLANCAP_MAGIC_COOKIE_V1 0x80211001 - struct avs_header_v1 { - uint32 version; - uint32 length; - uint64 mactime; - uint64 hosttime; - uint32 phytype; - uint32 channel; - uint32 datarate; - uint32 antenna; - uint32 priority; - uint32 ssi_type; - int32 ssi_signal; - int32 ssi_noise; - uint32 preamble; - uint32 encoding; - } *avs; - int signal, noise, snr; - - if (ind_data_len <= 0) { - unifi_error(priv, "Invalid length in CSR_MA_SNIFFDATA_INDICATION.\n"); - return; - } - - /* - * Allocate a SKB for the received data packet, including radiotap - * header. - */ - skb = dev_alloc_skb(ind_data_len + sizeof(struct avs_header_v1) + 4); - if (! skb) { - unifi_error(priv, "alloc_skb failed.\n"); - priv->stats.rx_errors++; - return; - } - - base = skb->data; - - /* Reserve the radiotap header at the front of skb */ - avs = (struct avs_header_v1 *)skb_put(skb, sizeof(struct avs_header_v1)); - - /* Copy in the 802.11 frame */ - ptr = skb_put(skb, ind_data_len); - memcpy(ptr, skb_orig->data, ind_data_len); - - /* Convert signal to dBm */ - signal = 0x10000 - ((s16)unifi2host_16(ind->Rssi)); /* in dBm */ - snr = (s16)unifi2host_16(ind->Snr); /* in dB */ - noise = signal - snr; - - avs->version = htonl(WLANCAP_MAGIC_COOKIE_V1); - avs->length = htonl(sizeof(struct avs_header_v1)); - avs->mactime = __cpu_to_be64(ind->Timestamp); - avs->hosttime = __cpu_to_be64(jiffies); - avs->phytype = htonl(9); /* dss_ofdm_dot11_g */ - avs->channel = htonl(priv->wext_conf.channel); - avs->datarate = htonl(ind->Rate * 5); - avs->antenna = htonl(ind->Antenna); - avs->priority = htonl(0); /* unknown */ - avs->ssi_type = htonl(2); /* dBm */ - avs->ssi_signal = htonl(signal); - avs->ssi_noise = htonl(noise); - avs->preamble = htonl(0); /* unknown */ - avs->encoding = htonl(0); /* unknown */ - - - skb->dev = dev; - skb->mac.raw = skb->data; - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = __constant_htons(ETH_P_80211_RAW); - memset(skb->cb, 0, sizeof(skb->cb)); - - /* Pass up to Linux network stack */ - netif_rx_ni(skb); - - dev->last_rx = jiffies; - - /* Bump the rx stats */ - priv->stats.rx_packets++; - priv->stats.rx_bytes += ind_data_len; - -} /* netrx_prism() */ -#endif /* PRISM */ - - -/* - * --------------------------------------------------------------------------- - * ma_sniffdata_ind - * - * Reformat a UniFi SNIFFDATA signal into a network - * - * Arguments: - * ospriv OS private context pointer. - * ind Pointer to a MA_UNITDATA_INDICATION or - * DS_UNITDATA_INDICATION indication structure. - * bulkdata Pointer to a bulk data structure, describing - * the data received. - * - * Notes: - * Radiotap header values are all little-endian, UniFi signals will have - * been converted to host-endian. - * --------------------------------------------------------------------------- - */ -void -ma_sniffdata_ind(void *ospriv, - const CSR_MA_SNIFFDATA_INDICATION *ind, - const bulk_data_param_t *bulkdata) -{ - unifi_priv_t *priv = ospriv; - struct net_device *dev = priv->netdev; - struct sk_buff *skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; - - if (bulkdata->d[0].data_length == 0) { - unifi_warning(priv, "rx: MA-SNIFFDATA indication with zero bulk data\n"); - return; - } - - skb->len = bulkdata->d[0].data_length; - - /* We only process data packets if the interface is open */ - if (unlikely(!netif_running(dev))) { - priv->stats.rx_dropped++; - priv->wext_conf.wireless_stats.discard.misc++; - dev_kfree_skb(skb); - return; - } - - if (ind->ReceptionStatus) { - priv->stats.rx_dropped++; - priv->wext_conf.wireless_stats.discard.misc++; - printk(KERN_INFO "unifi: Dropping corrupt sniff packet\n"); - dev_kfree_skb(skb); - return; - } - -#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_PRISM) - netrx_prism(priv, ind, skb); -#endif /* PRISM */ - -#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_RADIOTAP) - netrx_radiotap(priv, ind, skb); -#endif /* RADIOTAP */ - - dev_kfree_skb(skb); - -} /* ma_sniffdata_ind() */ - - -#endif /* UNIFI_SNIFF_ARPHRD */ - diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c deleted file mode 100644 index 9c716c162c24..000000000000 --- a/drivers/staging/csr/netdev.c +++ /dev/null @@ -1,3307 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: netdev.c - * - * PURPOSE: - * This file provides the upper edge interface to the linux netdevice - * and wireless extensions. - * It is part of the porting exercise. - * - * Copyright (C) 2005-2010 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ - -/* - * Porting Notes: - * This file implements the data plane of the UniFi linux driver. - * - * All the Tx packets are passed to the HIP core lib, using the - * unifi_send_signal() API. For EAPOL packets use the MLME-EAPOL.req - * signal, for all other use the MLME-UNITDATA.req. The unifi_send_signal() - * expects the wire-formatted (packed) signal. For convenience, in the OS - * layer we only use the native (unpacked) signal structures. The HIP core lib - * provides the write_pack() helper function to convert to the packed signal. - * The packet is stored in the bulk data of the signal. We do not need to - * allocate new memory to store the packet, because unifi_net_data_malloc() - * is implemented to return a skb, which is the format of packet in Linux. - * The HIP core lib frees the bulk data buffers, so we do not need to do - * this in the OS layer. - * - * All the Rx packets are MLME-UNITDATA.ind signals, passed by the HIP core lib - * in unifi_receive_event(). We do not need to allocate an skb and copy the - * received packet because the HIP core lib has stored in memory allocated by - * unifi_net_data_malloc(). Also, we can perform the 802.11 to Ethernet - * translation in-place because we allocate the extra memory allocated in - * unifi_net_data_malloc(). - * - * If possible, the porting exercise should appropriately implement - * unifi_net_data_malloc() and unifi_net_data_free() to save copies between - * network and driver buffers. - */ - -#include <linux/types.h> -#include <linux/etherdevice.h> -#include <linux/mutex.h> -#include <linux/semaphore.h> -#include <linux/vmalloc.h> -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_conversions.h" -#include "unifi_priv.h" -#include <net/pkt_sched.h> - - -/* Wext handler is supported only if CSR_SUPPORT_WEXT is defined */ -#ifdef CSR_SUPPORT_WEXT -extern struct iw_handler_def unifi_iw_handler_def; -#endif /* CSR_SUPPORT_WEXT */ -static void check_ba_frame_age_timeout( unifi_priv_t *priv, - netInterface_priv_t *interfacePriv, - ba_session_rx_struct *ba_session); -static void process_ba_frame(unifi_priv_t *priv, - netInterface_priv_t *interfacePriv, - ba_session_rx_struct *ba_session, - frame_desc_struct *frame_desc); -static void process_ba_complete(unifi_priv_t *priv, netInterface_priv_t *interfacePriv); -static void process_ma_packet_error_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata); -static void process_amsdu(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata); -static int uf_net_open(struct net_device *dev); -static int uf_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -static int uf_net_stop(struct net_device *dev); -static struct net_device_stats *uf_net_get_stats(struct net_device *dev); -static u16 uf_net_select_queue(struct net_device *dev, struct sk_buff *skb); -static netdev_tx_t uf_net_xmit(struct sk_buff *skb, struct net_device *dev); -static void uf_set_multicast_list(struct net_device *dev); - - -typedef int (*tx_signal_handler)(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, CSR_PRIORITY priority); - -#ifdef CONFIG_NET_SCHED -/* - * Queueing Discipline Interface - * Only used if kernel is configured with CONFIG_NET_SCHED - */ - -/* - * The driver uses the qdisc interface to buffer and control all - * outgoing traffic. We create a root qdisc, register our qdisc operations - * and later we create two subsidiary pfifo queues for the uncontrolled - * and controlled ports. - * - * The network stack delivers all outgoing packets in our enqueue handler. - * There, we classify the packet and decide whether to store it or drop it - * (if the controlled port state is set to "discard"). - * If the packet is enqueued, the network stack call our dequeue handler. - * There, we decide whether we can send the packet, delay it or drop it - * (the controlled port configuration might have changed meanwhile). - * If a packet is dequeued, then the network stack calls our hard_start_xmit - * handler where finally we send the packet. - * - * If the hard_start_xmit handler fails to send the packet, we return - * NETDEV_TX_BUSY and the network stack call our requeue handler where - * we put the packet back in the same queue in came from. - * - */ - -struct uf_sched_data -{ - /* Traffic Classifier TBD */ - struct tcf_proto *filter_list; - /* Our two queues */ - struct Qdisc *queues[UNIFI_TRAFFIC_Q_MAX]; -}; - -struct uf_tx_packet_data { - /* Queue the packet is stored in */ - unifi_TrafficQueue queue; - /* QoS Priority determined when enqueing packet */ - CSR_PRIORITY priority; - /* Debug */ - unsigned long host_tag; -}; - -#endif /* CONFIG_NET_SCHED */ - -static const struct net_device_ops uf_netdev_ops = -{ - .ndo_open = uf_net_open, - .ndo_stop = uf_net_stop, - .ndo_start_xmit = uf_net_xmit, - .ndo_do_ioctl = uf_net_ioctl, - .ndo_get_stats = uf_net_get_stats, /* called by /proc/net/dev */ - .ndo_set_rx_mode = uf_set_multicast_list, - .ndo_select_queue = uf_net_select_queue, -}; - -static u8 oui_rfc1042[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; -static u8 oui_8021h[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; - - -/* Callback for event logging to blocking clients */ -static void netdev_mlme_event_handler(ul_client_t *client, - const u8 *sig_packed, int sig_len, - const bulk_data_param_t *bulkdata, - int dir); - -#ifdef CSR_SUPPORT_WEXT -/* Declare netdev_notifier block which will contain the state change - * handler callback function - */ -static struct notifier_block uf_netdev_notifier; -#endif - -/* - * --------------------------------------------------------------------------- - * uf_alloc_netdevice - * - * Allocate memory for the net_device and device private structs - * for this interface. - * Fill in the fields, but don't register the interface yet. - * We need to configure the UniFi first. - * - * Arguments: - * sdio_dev Pointer to SDIO context handle to use for all - * SDIO ops. - * bus_id A small number indicating the SDIO card position on the - * bus. Typically this is the slot number, e.g. 0, 1 etc. - * Valid values are 0 to MAX_UNIFI_DEVS-1. - * - * Returns: - * Pointer to device private struct. - * - * Notes: - * The net_device and device private structs are allocated together - * and should be freed by freeing the net_device pointer. - * --------------------------------------------------------------------------- - */ -unifi_priv_t * -uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id) -{ - struct net_device *dev; - unifi_priv_t *priv; - netInterface_priv_t *interfacePriv; -#ifdef CSR_SUPPORT_WEXT - int rc; -#endif - unsigned char i; /* loop index */ - - /* - * Allocate netdevice struct, assign name template and - * setup as an ethernet device. - * The net_device and private structs are zeroed. Ether_setup() then - * sets up ethernet handlers and values. - * The RedHat 9 redhat-config-network tool doesn't recognise wlan* devices, - * so use "eth*" (like other wireless extns drivers). - */ - dev = alloc_etherdev_mq(sizeof(unifi_priv_t) + sizeof(netInterface_priv_t), UNIFI_TRAFFIC_Q_MAX); - - if (dev == NULL) { - return NULL; - } - - /* Set up back pointer from priv to netdev */ - interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - priv = (unifi_priv_t *)(interfacePriv + 1); - interfacePriv->privPtr = priv; - interfacePriv->InterfaceTag = 0; - - - /* Initialize all supported netdev interface to be NULL */ - for(i=0; i<CSR_WIFI_NUM_INTERFACES; i++) { - priv->netdev[i] = NULL; - priv->interfacePriv[i] = NULL; - } - priv->netdev[0] = dev; - priv->interfacePriv[0] = interfacePriv; - - /* Setup / override net_device fields */ - dev->netdev_ops = &uf_netdev_ops; - -#ifdef CSR_SUPPORT_WEXT - dev->wireless_handlers = &unifi_iw_handler_def; -#if IW_HANDLER_VERSION < 6 - dev->get_wireless_stats = unifi_get_wireless_stats; -#endif /* IW_HANDLER_VERSION */ -#endif /* CSR_SUPPORT_WEXT */ - - /* This gives us enough headroom to add the 802.11 header */ - dev->needed_headroom = 32; - - /* Use bus_id as instance number */ - priv->instance = bus_id; - /* Store SDIO pointer to pass in the core */ - priv->sdio = sdio_dev; - - sdio_dev->driverData = (void*)priv; - /* Consider UniFi to be uninitialised */ - priv->init_progress = UNIFI_INIT_NONE; - - priv->prev_queue = 0; - - /* - * Initialise the clients structure array. - * We do not need protection around ul_init_clients() because - * the character device can not be used until uf_alloc_netdevice() - * returns and Unifi_instances[bus_id]=priv is set, since unifi_open() - * will return -ENODEV. - */ - ul_init_clients(priv); - - /* - * Register a new ul client to send the multicast list signals. - * Note: priv->instance must be set before calling this. - */ - priv->netdev_client = ul_register_client(priv, - 0, - netdev_mlme_event_handler); - if (priv->netdev_client == NULL) { - unifi_error(priv, - "Failed to register a unifi client for background netdev processing\n"); - free_netdev(priv->netdev[0]); - return NULL; - } - unifi_trace(priv, UDBG2, "Netdev %p client (id:%d s:0x%X) is registered\n", - dev, priv->netdev_client->client_id, priv->netdev_client->sender_id); - - priv->sta_wmm_capabilities = 0; - -#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_SUPPORT_SME)) - priv->wapi_multicast_filter = 0; - priv->wapi_unicast_filter = 0; - priv->wapi_unicast_queued_pkt_filter = 0; -#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND - priv->isWapiConnection = FALSE; -#endif -#endif - - /* Enable all queues by default */ - interfacePriv->queueEnabled[0] = 1; - interfacePriv->queueEnabled[1] = 1; - interfacePriv->queueEnabled[2] = 1; - interfacePriv->queueEnabled[3] = 1; - -#ifdef CSR_SUPPORT_SME - priv->allPeerDozing = 0; -#endif - /* - * Initialise the OS private struct. - */ - /* - * Instead of deciding in advance to use 11bg or 11a, we could do a more - * clever scan on both radios. - */ - if (use_5g) { - priv->if_index = CSR_INDEX_5G; - unifi_info(priv, "Using the 802.11a radio\n"); - } else { - priv->if_index = CSR_INDEX_2G4; - } - - /* Initialise bh thread structure */ - priv->bh_thread.thread_task = NULL; - priv->bh_thread.block_thread = 1; - init_waitqueue_head(&priv->bh_thread.wakeup_q); - priv->bh_thread.wakeup_flag = 0; - sprintf(priv->bh_thread.name, "uf_bh_thread"); - - /* reset the connected state for the interface */ - interfacePriv->connected = UnifiConnectedUnknown; /* -1 unknown, 0 no, 1 yes */ - -#ifdef USE_DRIVER_LOCK - sema_init(&priv->lock, 1); -#endif /* USE_DRIVER_LOCK */ - - spin_lock_init(&priv->send_signal_lock); - - spin_lock_init(&priv->m4_lock); - sema_init(&priv->ba_mutex, 1); - -#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) - spin_lock_init(&priv->wapi_lock); -#endif - -#ifdef CSR_SUPPORT_SME - spin_lock_init(&priv->staRecord_lock); - spin_lock_init(&priv->tx_q_lock); -#endif - - /* Create the Traffic Analysis workqueue */ - priv->unifi_workqueue = create_singlethread_workqueue("unifi_workq"); - if (priv->unifi_workqueue == NULL) { - /* Deregister priv->netdev_client */ - ul_deregister_client(priv->netdev_client); - free_netdev(priv->netdev[0]); - return NULL; - } - -#ifdef CSR_SUPPORT_SME - /* Create the Multicast Addresses list work structure */ - INIT_WORK(&priv->multicast_list_task, uf_multicast_list_wq); - - /* Create m4 buffering work structure */ - INIT_WORK(&interfacePriv->send_m4_ready_task, uf_send_m4_ready_wq); - -#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) - /* Create work structure to buffer the WAPI data packets to be sent to SME for encryption */ - INIT_WORK(&interfacePriv->send_pkt_to_encrypt, uf_send_pkt_to_encrypt); -#endif -#endif - - priv->ref_count = 1; - - priv->amp_client = NULL; - priv->coredump_mode = 0; - priv->ptest_mode = 0; - priv->wol_suspend = FALSE; - INIT_LIST_HEAD(&interfacePriv->rx_uncontrolled_list); - INIT_LIST_HEAD(&interfacePriv->rx_controlled_list); - sema_init(&priv->rx_q_sem, 1); - -#ifdef CSR_SUPPORT_WEXT - interfacePriv->netdev_callback_registered = FALSE; - interfacePriv->wait_netdev_change = FALSE; - /* Register callback for netdevice state changes */ - if ((rc = register_netdevice_notifier(&uf_netdev_notifier)) == 0) { - interfacePriv->netdev_callback_registered = TRUE; - } - else { - unifi_warning(priv, "Failed to register netdevice notifier : %d %p\n", rc, dev); - } -#endif /* CSR_SUPPORT_WEXT */ - -#ifdef CSR_WIFI_SPLIT_PATCH - /* set it to some invalid value */ - priv->pending_mode_set.common.destination = 0xaaaa; -#endif - - return priv; -} /* uf_alloc_netdevice() */ - -/* - *--------------------------------------------------------------------------- - * uf_alloc_netdevice_for_other_interfaces - * - * Allocate memory for the net_device and device private structs - * for this interface. - * Fill in the fields, but don't register the interface yet. - * We need to configure the UniFi first. - * - * Arguments: - * interfaceTag Interface number. - * sdio_dev Pointer to SDIO context handle to use for all - * SDIO ops. - * bus_id A small number indicating the SDIO card position on the - * bus. Typically this is the slot number, e.g. 0, 1 etc. - * Valid values are 0 to MAX_UNIFI_DEVS-1. - * - * Returns: - * Pointer to device private struct. - * - * Notes: - * The device private structure contains the interfaceTag and pointer to the unifi_priv - * structure created allocated by net_device od interface0. - * The net_device and device private structs are allocated together - * and should be freed by freeing the net_device pointer. - * --------------------------------------------------------------------------- - */ -u8 -uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, u16 interfaceTag) -{ - struct net_device *dev; - netInterface_priv_t *interfacePriv; - - /* - * Allocate netdevice struct, assign name template and - * setup as an ethernet device. - * The net_device and private structs are zeroed. Ether_setup() then - * sets up ethernet handlers and values. - * The RedHat 9 redhat-config-network tool doesn't recognise wlan* devices, - * so use "eth*" (like other wireless extns drivers). - */ - dev = alloc_etherdev_mq(sizeof(netInterface_priv_t), 1); - if (dev == NULL) { - return FALSE; - } - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "uf_alloc_netdevice_for_other_interfaces bad interfaceTag\n"); - return FALSE; - } - - /* Set up back pointer from priv to netdev */ - interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - interfacePriv->privPtr = priv; - interfacePriv->InterfaceTag = interfaceTag; - priv->netdev[interfaceTag] = dev; - priv->interfacePriv[interfacePriv->InterfaceTag] = interfacePriv; - - /* reset the connected state for the interface */ - interfacePriv->connected = UnifiConnectedUnknown; /* -1 unknown, 0 no, 1 yes */ - INIT_LIST_HEAD(&interfacePriv->rx_uncontrolled_list); - INIT_LIST_HEAD(&interfacePriv->rx_controlled_list); - - /* Setup / override net_device fields */ - dev->netdev_ops = &uf_netdev_ops; - -#ifdef CSR_SUPPORT_WEXT - dev->wireless_handlers = &unifi_iw_handler_def; -#if IW_HANDLER_VERSION < 6 - dev->get_wireless_stats = unifi_get_wireless_stats; -#endif /* IW_HANDLER_VERSION */ -#endif /* CSR_SUPPORT_WEXT */ - return TRUE; -} /* uf_alloc_netdevice() */ - - - -/* - * --------------------------------------------------------------------------- - * uf_free_netdevice - * - * Unregister the network device and free the memory allocated for it. - * NB This includes the memory for the priv struct. - * - * Arguments: - * priv Device private pointer. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -int -uf_free_netdevice(unifi_priv_t *priv) -{ - int i; - unsigned long flags; - - unifi_trace(priv, UDBG1, "uf_free_netdevice\n"); - - if (!priv) { - return -EINVAL; - } - - /* - * Free any buffers used for holding firmware - */ - uf_release_firmware_files(priv); - -#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT) - if (priv->connection_config.mlmeAssociateReqInformationElements) { - kfree(priv->connection_config.mlmeAssociateReqInformationElements); - } - priv->connection_config.mlmeAssociateReqInformationElements = NULL; - priv->connection_config.mlmeAssociateReqInformationElementsLength = 0; - - if (priv->mib_data.length) { - vfree(priv->mib_data.data); - } - priv->mib_data.data = NULL; - priv->mib_data.length = 0; - -#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT*/ - - /* Free any bulkdata buffers allocated for M4 caching */ - spin_lock_irqsave(&priv->m4_lock, flags); - for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { - netInterface_priv_t *interfacePriv = priv->interfacePriv[i]; - if (interfacePriv->m4_bulk_data.data_length > 0) { - unifi_trace(priv, UDBG5, "uf_free_netdevice: free M4 bulkdata %d\n", i); - unifi_net_data_free(priv, &interfacePriv->m4_bulk_data); - } - } - spin_unlock_irqrestore(&priv->m4_lock, flags); - -#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) - /* Free any bulkdata buffers allocated for M4 caching */ - spin_lock_irqsave(&priv->wapi_lock, flags); - for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { - netInterface_priv_t *interfacePriv = priv->interfacePriv[i]; - if (interfacePriv->wapi_unicast_bulk_data.data_length > 0) { - unifi_trace(priv, UDBG5, "uf_free_netdevice: free WAPI PKT bulk data %d\n", i); - unifi_net_data_free(priv, &interfacePriv->wapi_unicast_bulk_data); - } - } - spin_unlock_irqrestore(&priv->wapi_lock, flags); -#endif - -#ifdef CSR_SUPPORT_WEXT - /* Unregister callback for netdevice state changes */ - unregister_netdevice_notifier(&uf_netdev_notifier); -#endif /* CSR_SUPPORT_WEXT */ - -#ifdef CSR_SUPPORT_SME - /* Cancel work items and destroy the workqueue */ - cancel_work_sync(&priv->multicast_list_task); -#endif -/* Destroy the workqueues. */ - flush_workqueue(priv->unifi_workqueue); - destroy_workqueue(priv->unifi_workqueue); - - /* Free up netdev in reverse order: priv is allocated with netdev[0]. - * So, netdev[0] should be freed after all other netdevs are freed up - */ - for (i=CSR_WIFI_NUM_INTERFACES-1; i>=0; i--) { - /*Free the netdev struct and priv, which are all one lump*/ - if (priv->netdev[i]) { - unifi_error(priv, "uf_free_netdevice: netdev %d %p\n", i, priv->netdev[i]); - free_netdev(priv->netdev[i]); - } - } - - return 0; -} /* uf_free_netdevice() */ - - -/* - * --------------------------------------------------------------------------- - * uf_net_open - * - * Called when userland does "ifconfig wlan0 up". - * - * Arguments: - * dev Device pointer. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static int -uf_net_open(struct net_device *dev) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - - /* If we haven't finished UniFi initialisation, we can't start */ - if (priv->init_progress != UNIFI_INIT_COMPLETED) { - unifi_warning(priv, "%s: unifi not ready, failing net_open\n", __FUNCTION__); - return -EINVAL; - } - -#if (defined CSR_NATIVE_LINUX) && (defined UNIFI_SNIFF_ARPHRD) && defined(CSR_SUPPORT_WEXT) - /* - * To sniff, the user must do "iwconfig mode monitor", which sets - * priv->wext_conf.mode to IW_MODE_MONITOR. - * Then he/she must do "ifconfig ethn up", which calls this fn. - * There is no point in starting the sniff with SNIFFJOIN until - * this point. - */ - if (priv->wext_conf.mode == IW_MODE_MONITOR) { - int err; - err = uf_start_sniff(priv); - if (err) { - return err; - } - netif_carrier_on(dev); - } -#endif - -#ifdef CSR_SUPPORT_WEXT - if (interfacePriv->wait_netdev_change) { - unifi_trace(priv, UDBG1, "%s: Waiting for NETDEV_CHANGE, assume connected\n", - __FUNCTION__); - interfacePriv->connected = UnifiConnected; - interfacePriv->wait_netdev_change = FALSE; - } -#endif - - netif_tx_start_all_queues(dev); - - return 0; -} /* uf_net_open() */ - - -static int -uf_net_stop(struct net_device *dev) -{ -#if defined(CSR_NATIVE_LINUX) && defined(UNIFI_SNIFF_ARPHRD) && defined(CSR_SUPPORT_WEXT) - netInterface_priv_t *interfacePriv = (netInterface_priv_t*)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - - /* Stop sniffing if in Monitor mode */ - if (priv->wext_conf.mode == IW_MODE_MONITOR) { - if (priv->card) { - int err; - err = unifi_reset_state(priv, dev->dev_addr, 1); - if (err) { - return err; - } - } - } -#endif - - netif_tx_stop_all_queues(dev); - - return 0; -} /* uf_net_stop() */ - - -/* This is called after the WE handlers */ -static int -uf_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - int rc; - - rc = -EOPNOTSUPP; - - return rc; -} /* uf_net_ioctl() */ - - - -static struct net_device_stats * -uf_net_get_stats(struct net_device *dev) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - - return &interfacePriv->stats; -} /* uf_net_get_stats() */ - -static CSR_PRIORITY uf_get_packet_priority(unifi_priv_t *priv, netInterface_priv_t *interfacePriv, struct sk_buff *skb, const int proto) -{ - CSR_PRIORITY priority = CSR_CONTENTION; - - priority = (CSR_PRIORITY) (skb->priority >> 5); - - if (priority == CSR_QOS_UP0) { /* 0 */ - - unifi_trace(priv, UDBG5, "uf_get_packet_priority: proto = 0x%.4X\n", proto); - - switch (proto) { - case 0x0800: /* IPv4 */ - case 0x814C: /* SNMP */ - case 0x880C: /* GSMP */ - priority = (CSR_PRIORITY) (skb->data[1 + ETH_HLEN] >> 5); - break; - - case 0x8100: /* VLAN */ - priority = (CSR_PRIORITY) (skb->data[0 + ETH_HLEN] >> 5); - break; - - case 0x86DD: /* IPv6 */ - priority = (CSR_PRIORITY) ((skb->data[0 + ETH_HLEN] & 0x0E) >> 1); - break; - - default: - priority = CSR_QOS_UP0; - break; - } - } - - /* Check if we are allowed to transmit on this AC. Because of ACM we may have to downgrade to a lower - * priority */ - if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI) { - unifi_TrafficQueue queue; - - /* Keep trying lower priorities until we find a queue - * Priority to queue mapping is 1,2 - BK, 0,3 - BE, 4,5 - VI, 6,7 - VO */ - queue = unifi_frame_priority_to_queue(priority); - - while (queue > UNIFI_TRAFFIC_Q_BK && !interfacePriv->queueEnabled[queue]) { - queue--; - priority = unifi_get_default_downgrade_priority(queue); - } - } - - unifi_trace(priv, UDBG5, "Packet priority = %d\n", priority); - - return priority; -} - -/* - */ -/* - * --------------------------------------------------------------------------- - * get_packet_priority - * - * Arguments: - * priv private data area of functional driver - * skb socket buffer - * ehdr ethernet header to fetch protocol - * interfacePriv For accessing station record database - * - * - * Returns: - * CSR_PRIORITY. - * --------------------------------------------------------------------------- - */ -CSR_PRIORITY -get_packet_priority(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, netInterface_priv_t *interfacePriv) -{ - CSR_PRIORITY priority = CSR_CONTENTION; - const int proto = ntohs(ehdr->h_proto); - - u8 interfaceMode = interfacePriv->interfaceMode; - - /* Priority Mapping for all the Modes */ - switch(interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_STA: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: - unifi_trace(priv, UDBG4, "mode is STA \n"); - if ((priv->sta_wmm_capabilities & QOS_CAPABILITY_WMM_ENABLED) == 1) { - priority = uf_get_packet_priority(priv, interfacePriv, skb, proto); - } else { - priority = CSR_CONTENTION; - } - break; -#ifdef CSR_SUPPORT_SME - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: - { - CsrWifiRouterCtrlStaInfo_t * dstStaInfo = - CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, ehdr->h_dest, interfacePriv->InterfaceTag); - unifi_trace(priv, UDBG4, "mode is AP \n"); - if (!(ehdr->h_dest[0] & 0x01) && dstStaInfo && dstStaInfo->wmmOrQosEnabled) { - /* If packet is not Broadcast/multicast */ - priority = uf_get_packet_priority(priv, interfacePriv, skb, proto); - } else { - /* Since packet destination is not QSTA, set priority to CSR_CONTENTION */ - unifi_trace(priv, UDBG4, "Destination is not QSTA or BroadCast/Multicast\n"); - priority = CSR_CONTENTION; - } - } - break; -#endif - default: - unifi_trace(priv, UDBG3, " mode unknown in %s func, mode=%x\n", __FUNCTION__, interfaceMode); - } - unifi_trace(priv, UDBG5, "priority = %x\n", priority); - - return priority; -} - -/* - * --------------------------------------------------------------------------- - * uf_net_select_queue - * - * Called by the kernel to select which queue to put the packet in - * - * Arguments: - * dev Device pointer - * skb Packet - * - * Returns: - * Queue index - * --------------------------------------------------------------------------- - */ -static u16 -uf_net_select_queue(struct net_device *dev, struct sk_buff *skb) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = (unifi_priv_t *)interfacePriv->privPtr; - struct ethhdr ehdr; - unifi_TrafficQueue queue; - int proto; - CSR_PRIORITY priority; - - memcpy(&ehdr, skb->data, ETH_HLEN); - proto = ntohs(ehdr.h_proto); - - /* 802.1x - apply controlled/uncontrolled port rules */ - if ((proto != ETH_P_PAE) -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - && (proto != ETH_P_WAI) -#endif - ) { - /* queues 0 - 3 */ - priority = get_packet_priority(priv, skb, &ehdr, interfacePriv); - queue = unifi_frame_priority_to_queue(priority); - } else { - /* queue 4 */ - queue = UNIFI_TRAFFIC_Q_EAPOL; - } - - - return (u16)queue; -} /* uf_net_select_queue() */ - -int -skb_add_llc_snap(struct net_device *dev, struct sk_buff *skb, int proto) -{ - llc_snap_hdr_t *snap; - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int headroom; - - /* get the headroom available in skb */ - headroom = skb_headroom(skb); - /* step 1: classify ether frame, DIX or 802.3? */ - - if (proto < 0x600) { - /* codes <= 1500 reserved for 802.3 lengths */ - /* it's 802.3, pass ether payload unchanged, */ - unifi_trace(priv, UDBG3, "802.3 len: %d\n", skb->len); - - /* leave off any PAD octets. */ - skb_trim(skb, proto); - } else if (proto == ETH_P_8021Q) { - - /* Store the VLAN SNAP (should be 87-65). */ - u16 vlan_snap = *(u16*)skb->data; - /* check for headroom availability before skb_push 14 = (4 + 10) */ - if (headroom < 14) { - unifi_trace(priv, UDBG3, "cant append vlan snap: debug\n"); - return -1; - } - /* Add AA-AA-03-00-00-00 */ - snap = (llc_snap_hdr_t *)skb_push(skb, 4); - snap->dsap = snap->ssap = 0xAA; - snap->ctrl = 0x03; - memcpy(snap->oui, oui_rfc1042, P80211_OUI_LEN); - - /* Add AA-AA-03-00-00-00 */ - snap = (llc_snap_hdr_t *)skb_push(skb, 10); - snap->dsap = snap->ssap = 0xAA; - snap->ctrl = 0x03; - memcpy(snap->oui, oui_rfc1042, P80211_OUI_LEN); - - /* Add the VLAN specific information */ - snap->protocol = htons(proto); - *(u16*)(snap + 1) = vlan_snap; - - } else - { - /* it's DIXII, time for some conversion */ - unifi_trace(priv, UDBG3, "DIXII len: %d\n", skb->len); - - /* check for headroom availability before skb_push */ - if (headroom < sizeof(llc_snap_hdr_t)) { - unifi_trace(priv, UDBG3, "cant append snap: debug\n"); - return -1; - } - /* tack on SNAP */ - snap = (llc_snap_hdr_t *)skb_push(skb, sizeof(llc_snap_hdr_t)); - snap->dsap = snap->ssap = 0xAA; - snap->ctrl = 0x03; - /* Use the appropriate OUI. */ - if ((proto == ETH_P_AARP) || (proto == ETH_P_IPX)) { - memcpy(snap->oui, oui_8021h, P80211_OUI_LEN); - } else { - memcpy(snap->oui, oui_rfc1042, P80211_OUI_LEN); - } - snap->protocol = htons(proto); - } - - return 0; -} /* skb_add_llc_snap() */ - -#ifdef CSR_SUPPORT_SME -static int -_identify_sme_ma_pkt_ind(unifi_priv_t *priv, - const s8 *oui, u16 protocol, - const CSR_SIGNAL *signal, - bulk_data_param_t *bulkdata, - const unsigned char *daddr, - const unsigned char *saddr) -{ - CSR_MA_PACKET_INDICATION *pkt_ind = (CSR_MA_PACKET_INDICATION*)&signal->u.MaPacketIndication; - int r; - u8 i; - - unifi_trace(priv, UDBG5, - "_identify_sme_ma_pkt_ind -->\n"); - for (i = 0; i < MAX_MA_UNIDATA_IND_FILTERS; i++) { - if (priv->sme_unidata_ind_filters[i].in_use) { - if (!memcmp(oui, priv->sme_unidata_ind_filters[i].oui, 3) && - (protocol == priv->sme_unidata_ind_filters[i].protocol)) { - - /* Send to client */ - if (priv->sme_cli) { - /* - * Pass the packet to the SME, using unifi_sys_ma_unitdata_ind(). - * The frame needs to be converted according to the encapsulation. - */ - unifi_trace(priv, UDBG1, - "_identify_sme_ma_pkt_ind: handle=%d, encap=%d, proto=%x\n", - i, priv->sme_unidata_ind_filters[i].encapsulation, - priv->sme_unidata_ind_filters[i].protocol); - if (priv->sme_unidata_ind_filters[i].encapsulation == CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET) { - struct sk_buff *skb; - /* The translation is performed on skb... */ - skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; - skb->len = bulkdata->d[0].data_length; - - unifi_trace(priv, UDBG1, - "_identify_sme_ma_pkt_ind: skb_80211_to_ether -->\n"); - r = skb_80211_to_ether(priv, skb, daddr, saddr, - signal, bulkdata); - unifi_trace(priv, UDBG1, - "_identify_sme_ma_pkt_ind: skb_80211_to_ether <--\n"); - if (r) { - return -EINVAL; - } - - /* ... but we indicate buffer and length */ - bulkdata->d[0].os_data_ptr = skb->data; - bulkdata->d[0].data_length = skb->len; - } else { - /* Add the MAC addresses before the SNAP */ - bulkdata->d[0].os_data_ptr -= 2*ETH_ALEN; - bulkdata->d[0].data_length += 2*ETH_ALEN; - memcpy((void*)bulkdata->d[0].os_data_ptr, daddr, ETH_ALEN); - memcpy((void*)bulkdata->d[0].os_data_ptr + ETH_ALEN, saddr, ETH_ALEN); - } - - unifi_trace(priv, UDBG1, - "_identify_sme_ma_pkt_ind: unifi_sys_ma_pkt_ind -->\n"); - CsrWifiRouterMaPacketIndSend(priv->sme_unidata_ind_filters[i].appHandle, - (pkt_ind->VirtualInterfaceIdentifier & 0xff), - i, - pkt_ind->ReceptionStatus, - bulkdata->d[0].data_length, - (u8*)bulkdata->d[0].os_data_ptr, - NULL, - pkt_ind->Rssi, - pkt_ind->Snr, - pkt_ind->ReceivedRate); - - - unifi_trace(priv, UDBG1, - "_identify_sme_ma_pkt_ind: unifi_sys_ma_pkt_ind <--\n"); - } - - return 1; - } - } - } - - return -1; -} -#endif /* CSR_SUPPORT_SME */ - -/* - * --------------------------------------------------------------------------- - * skb_80211_to_ether - * - * Make sure the received frame is in Ethernet (802.3) form. - * De-encapsulates SNAP if necessary, adds a ethernet header. - * The source buffer should not contain an 802.11 MAC header - * - * Arguments: - * payload Pointer to packet data received from UniFi. - * payload_length Number of bytes of data received from UniFi. - * daddr Destination MAC address. - * saddr Source MAC address. - * - * Returns: - * 0 on success, -1 if the packet is bad and should be dropped, - * 1 if the packet was forwarded to the SME or AMP client. - * --------------------------------------------------------------------------- - */ -int -skb_80211_to_ether(unifi_priv_t *priv, struct sk_buff *skb, - const unsigned char *daddr, const unsigned char *saddr, - const CSR_SIGNAL *signal, - bulk_data_param_t *bulkdata) -{ - unsigned char *payload; - int payload_length; - struct ethhdr *eth; - llc_snap_hdr_t *snap; - int headroom; -#define UF_VLAN_LLC_HEADER_SIZE 18 - static const u8 vlan_inner_snap[] = { 0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 }; -#if defined(CSR_NATIVE_SOFTMAC) && defined(CSR_SUPPORT_SME) - const CSR_MA_PACKET_INDICATION *pkt_ind = &signal->u.MaPacketIndication; -#endif - - if(skb== NULL || daddr == NULL || saddr == NULL){ - unifi_error(priv, "skb_80211_to_ether: PBC fail\n"); - return 1; - } - - payload = skb->data; - payload_length = skb->len; - - snap = (llc_snap_hdr_t *)payload; - eth = (struct ethhdr *)payload; - - /* get the skb headroom size */ - headroom = skb_headroom(skb); - - /* - * Test for the various encodings - */ - if ((payload_length >= sizeof(llc_snap_hdr_t)) && - (snap->dsap == 0xAA) && - (snap->ssap == 0xAA) && - (snap->ctrl == 0x03) && - (snap->oui[0] == 0) && - (snap->oui[1] == 0) && - ((snap->oui[2] == 0) || (snap->oui[2] == 0xF8))) - { - /* AppleTalk AARP (2) or IPX SNAP */ - if ((snap->oui[2] == 0) && - ((ntohs(snap->protocol) == ETH_P_AARP) || (ntohs(snap->protocol) == ETH_P_IPX))) - { - u16 len; - - unifi_trace(priv, UDBG3, "%s len: %d\n", - (ntohs(snap->protocol) == ETH_P_AARP) ? "ETH_P_AARP" : "ETH_P_IPX", - payload_length); - - /* check for headroom availability before skb_push */ - if (headroom < (2 * ETH_ALEN + 2)) { - unifi_warning(priv, "headroom not available to skb_push ether header\n"); - return -1; - } - - /* Add 802.3 header and leave full payload */ - len = htons(skb->len); - memcpy(skb_push(skb, 2), &len, 2); - memcpy(skb_push(skb, ETH_ALEN), saddr, ETH_ALEN); - memcpy(skb_push(skb, ETH_ALEN), daddr, ETH_ALEN); - - return 0; - } - /* VLAN-tagged IP */ - if ((snap->oui[2] == 0) && (ntohs(snap->protocol) == ETH_P_8021Q)) - { - /* - * The translation doesn't change the packet length, so is done in-place. - * - * Example header (from Std 802.11-2007 Annex M): - * AA-AA-03-00-00-00-81-00-87-65-AA-AA-03-00-00-00-08-06 - * -------SNAP-------p1-p1-ll-ll-------SNAP--------p2-p2 - * dd-dd-dd-dd-dd-dd-aa-aa-aa-aa-aa-aa-p1-p1-ll-ll-p2-p2 - * dd-dd-dd-dd-dd-dd-aa-aa-aa-aa-aa-aa-81-00-87-65-08-06 - */ - u16 vlan_snap; - - if (payload_length < UF_VLAN_LLC_HEADER_SIZE) { - unifi_warning(priv, "VLAN SNAP header too short: %d bytes\n", payload_length); - return -1; - } - - if (memcmp(payload + 10, vlan_inner_snap, 6)) { - unifi_warning(priv, "VLAN malformatted SNAP header.\n"); - return -1; - } - - unifi_trace(priv, UDBG3, "VLAN SNAP: %02x-%02x\n", payload[8], payload[9]); - unifi_trace(priv, UDBG3, "VLAN len: %d\n", payload_length); - - /* Create the 802.3 header */ - - vlan_snap = *((u16*)(payload + 8)); - - /* Create LLC header without byte-swapping */ - eth->h_proto = snap->protocol; - - memcpy(eth->h_dest, daddr, ETH_ALEN); - memcpy(eth->h_source, saddr, ETH_ALEN); - *(u16*)(eth + 1) = vlan_snap; - return 0; - } - - /* it's a SNAP + RFC1042 frame */ - unifi_trace(priv, UDBG3, "SNAP+RFC1042 len: %d\n", payload_length); - - /* chop SNAP+llc header from skb. */ - skb_pull(skb, sizeof(llc_snap_hdr_t)); - - /* Since skb_pull called above to chop snap+llc, no need to check for headroom - * availability before skb_push - */ - /* create 802.3 header at beginning of skb. */ - eth = (struct ethhdr *)skb_push(skb, ETH_HLEN); - memcpy(eth->h_dest, daddr, ETH_ALEN); - memcpy(eth->h_source, saddr, ETH_ALEN); - /* Copy protocol field without byte-swapping */ - eth->h_proto = snap->protocol; - } else { - u16 len; - - /* check for headroom availability before skb_push */ - if (headroom < (2 * ETH_ALEN + 2)) { - unifi_warning(priv, "headroom not available to skb_push ether header\n"); - return -1; - } - /* Add 802.3 header and leave full payload */ - len = htons(skb->len); - memcpy(skb_push(skb, 2), &len, 2); - memcpy(skb_push(skb, ETH_ALEN), saddr, ETH_ALEN); - memcpy(skb_push(skb, ETH_ALEN), daddr, ETH_ALEN); - - return 1; - } - - return 0; -} /* skb_80211_to_ether() */ - - -static CsrWifiRouterCtrlPortAction verify_port(unifi_priv_t *priv, unsigned char *address, int queue, u16 interfaceTag) -{ -#ifdef CSR_NATIVE_LINUX -#ifdef CSR_SUPPORT_WEXT - if (queue == UF_CONTROLLED_PORT_Q) { - return priv->wext_conf.block_controlled_port; - } else { - return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN; - } -#else - return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN; /* default to open for softmac dev */ -#endif -#else - return uf_sme_port_state(priv, address, queue, interfaceTag); -#endif -} - -/* - * --------------------------------------------------------------------------- - * prepare_and_add_macheader - * - * - * These functions adds mac header for packet from netdev - * to UniFi for transmission. - * EAP protocol packets are also appended with Mac header & - * sent using send_ma_pkt_request(). - * - * Arguments: - * priv Pointer to device private context struct - * skb Socket buffer containing data packet to transmit - * newSkb Socket buffer containing data packet + Mac header if no sufficient headroom in skb - * serviceClass to append QOS control header in Mac header - * bulkdata if newSkb allocated then bulkdata updated to send to unifi - * interfaceTag the interfaceID on which activity going on - * daddr destination address - * saddr source address - * protection protection bit set in framce control of mac header - * - * Returns: - * Zero on success or error code. - * --------------------------------------------------------------------------- - */ - -int prepare_and_add_macheader(unifi_priv_t *priv, struct sk_buff *skb, struct sk_buff *newSkb, - CSR_PRIORITY priority, - bulk_data_param_t *bulkdata, - u16 interfaceTag, - const u8 *daddr, - const u8 *saddr, - u8 protection) -{ - u16 fc = 0; - u8 qc = 0; - u8 macHeaderLengthInBytes = MAC_HEADER_SIZE, *bufPtr = NULL; - bulk_data_param_t data_ptrs; - CsrResult csrResult; - int headroom =0; - u8 direction = 0; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - u8 *addressOne; - u8 bQosNull = false; - - if (skb == NULL) { - unifi_error(priv, "prepare_and_add_macheader: Invalid SKB reference\n"); - return -1; - } - - /* add a MAC header refer: 7.1.3.1 Frame Control field in P802.11REVmb.book */ - if (priority != CSR_CONTENTION) { - /* EAPOL packets don't go as QOS_DATA */ - if (priority == CSR_MANAGEMENT) { - fc |= cpu_to_le16(IEEE802_11_FC_TYPE_DATA); - } else { - /* Qos Control Field */ - macHeaderLengthInBytes += QOS_CONTROL_HEADER_SIZE; - - if (skb->len) { - - fc |= cpu_to_le16(IEEE802_11_FC_TYPE_QOS_DATA); - } else { - fc |= cpu_to_le16(IEEE802_11_FC_TYPE_QOS_NULL); - bQosNull = true; - } - } - } else { - if(skb->len == 0) { - fc |= cpu_to_le16(IEEE802_11_FC_TYPE_NULL); - } else { - fc |= cpu_to_le16(IEEE802_11_FC_TYPE_DATA); - } - } - - switch (interfacePriv->interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_STA: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: - direction = 2; - fc |= cpu_to_le16(IEEE802_11_FC_TO_DS_MASK); - break; - case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: - direction = 0; - break; - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - direction = 1; - fc |= cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK); - break; - case CSR_WIFI_ROUTER_CTRL_MODE_AMP: - if (priority == CSR_MANAGEMENT ) { - - direction = 2; - fc |= cpu_to_le16(IEEE802_11_FC_TO_DS_MASK); - } else { - /* Data frames have to use WDS 4 address frames */ - direction = 3; - fc |= cpu_to_le16(IEEE802_11_FC_TO_DS_MASK | IEEE802_11_FC_FROM_DS_MASK); - macHeaderLengthInBytes += 6; - } - break; - default: - unifi_warning(priv, "prepare_and_add_macheader: Unknown mode %d\n", - interfacePriv->interfaceMode); - } - - - /* If Sta is QOS & HTC is supported then need to set 'order' bit */ - /* We don't support HT Control for now */ - - if(protection) { - fc |= cpu_to_le16(IEEE802_11_FC_PROTECTED_MASK); - } - - /* check the skb headroom before pushing mac header */ - headroom = skb_headroom(skb); - - if (headroom < macHeaderLengthInBytes) { - unifi_trace(priv, UDBG5, - "prepare_and_add_macheader: Allocate headroom extra %d bytes\n", - macHeaderLengthInBytes); - - csrResult = unifi_net_data_malloc(priv, &data_ptrs.d[0], skb->len + macHeaderLengthInBytes); - - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, " failed to allocate request_data. in %s func\n", __FUNCTION__); - return -1; - } - newSkb = (struct sk_buff *)(data_ptrs.d[0].os_net_buf_ptr); - newSkb->len = skb->len + macHeaderLengthInBytes; - - memcpy((void*)data_ptrs.d[0].os_data_ptr + macHeaderLengthInBytes, - skb->data, skb->len); - - bulkdata->d[0].os_data_ptr = newSkb->data; - bulkdata->d[0].os_net_buf_ptr = (unsigned char*)newSkb; - bulkdata->d[0].data_length = newSkb->len; - - bufPtr = (u8*)data_ptrs.d[0].os_data_ptr; - - /* The old skb will not be used again */ - kfree_skb(skb); - } else { - - /* headroom has sufficient size, so will get proper pointer */ - bufPtr = (u8*)skb_push(skb, macHeaderLengthInBytes); - bulkdata->d[0].os_data_ptr = skb->data; - bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb; - bulkdata->d[0].data_length = skb->len; - } - - /* Frame the actual MAC header */ - - memset(bufPtr, 0, macHeaderLengthInBytes); - - /* copy frameControl field */ - memcpy(bufPtr, &fc, sizeof(fc)); - bufPtr += sizeof(fc); - macHeaderLengthInBytes -= sizeof(fc); - - /* Duration/ID field which is 2 bytes */ - bufPtr += 2; - macHeaderLengthInBytes -= 2; - - switch(direction) - { - case 0: - /* Its an Ad-Hoc no need to route it through AP */ - /* Address1: MAC address of the destination from eth header */ - memcpy(bufPtr, daddr, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - - /* Address2: MAC address of the source */ - memcpy(bufPtr, saddr, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - - /* Address3: the BSSID (locally generated in AdHoc (creators Bssid)) */ - memcpy(bufPtr, &interfacePriv->bssid, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - break; - case 1: - /* Address1: MAC address of the actual destination */ - memcpy(bufPtr, daddr, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - /* Address2: The MAC address of the AP */ - memcpy(bufPtr, &interfacePriv->bssid, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - - /* Address3: MAC address of the source from eth header */ - memcpy(bufPtr, saddr, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - break; - case 2: - /* Address1: To AP is the MAC address of the AP to which its associated */ - memcpy(bufPtr, &interfacePriv->bssid, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - - /* Address2: MAC address of the source from eth header */ - memcpy(bufPtr, saddr, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - - /* Address3: MAC address of the actual destination on the distribution system */ - memcpy(bufPtr, daddr, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - break; - case 3: - memcpy(bufPtr, &interfacePriv->bssid, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - - /* Address2: MAC address of the source from eth header */ - memcpy(bufPtr, saddr, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - - /* Address3: MAC address of the actual destination on the distribution system */ - memcpy(bufPtr, daddr, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - break; - default: - unifi_error(priv, "Unknown direction =%d : Not handled now\n", direction); - return -1; - } - /* 2 bytes of frame control field, appended by firmware */ - bufPtr += 2; - macHeaderLengthInBytes -= 2; - - if (3 == direction) { - /* Address4: MAC address of the source */ - memcpy(bufPtr, saddr, ETH_ALEN); - bufPtr += ETH_ALEN; - macHeaderLengthInBytes -= ETH_ALEN; - } - - /* IF Qos Data or Qos Null Data then set QosControl field */ - if ((priority != CSR_CONTENTION) && (macHeaderLengthInBytes >= QOS_CONTROL_HEADER_SIZE)) { - - if (priority > 7) { - unifi_trace(priv, UDBG1, "data packets priority is more than 7, priority = %x\n", priority); - qc |= 7; - } else { - qc |= priority; - } - /*assigning address1 - * Address1 offset taken fromm bufPtr(currently bufPtr pointing to Qos contorl) variable in reverse direction - * Address4 don't exit - */ - - addressOne = bufPtr- ADDRESS_ONE_OFFSET; - - if (addressOne[0] & 0x1) { - /* multicast/broadcast frames, no acknowledgement needed */ - qc |= 1 << 5; - } - /* non-AP mode only for now */ - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI) { - /* In case of STA and IBSS case eosp and txop limit is 0. */ - } else { - if(bQosNull) { - qc |= 1 << 4; - } - } - - /* append Qos control field to mac header */ - bufPtr[0] = qc; - /* txop limit is 0 */ - bufPtr[1] = 0; - macHeaderLengthInBytes -= QOS_CONTROL_HEADER_SIZE; - } - if (macHeaderLengthInBytes) { - unifi_warning(priv, " Mac header not appended properly\n"); - return -1; - } - return 0; -} - -/* - * --------------------------------------------------------------------------- - * send_ma_pkt_request - * - * These functions send a data packet to UniFi for transmission. - * EAP protocol packets are also sent as send_ma_pkt_request(). - * - * Arguments: - * priv Pointer to device private context struct - * skb Socket buffer containing data packet to transmit - * ehdr Pointer to Ethernet header within skb. - * - * Returns: - * Zero on success or error code. - * --------------------------------------------------------------------------- - */ - -static int -send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, CSR_PRIORITY priority) -{ - int r; - u16 i; - u8 eapolStore = FALSE; - struct sk_buff *newSkb = NULL; - bulk_data_param_t bulkdata; - const int proto = ntohs(ehdr->h_proto); - u16 interfaceTag; - CsrWifiMacAddress peerAddress; - CSR_TRANSMISSION_CONTROL transmissionControl = CSR_NO_CONFIRM_REQUIRED; - s8 protection; - netInterface_priv_t *interfacePriv = NULL; - CSR_RATE TransmitRate = (CSR_RATE)0; - - unifi_trace(priv, UDBG5, "entering send_ma_pkt_request\n"); - - /* Get the interface Tag by means of source Mac address */ - for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { - if (!memcmp(priv->netdev[i]->dev_addr, ehdr->h_source, ETH_ALEN)) { - interfaceTag = i; - interfacePriv = priv->interfacePriv[interfaceTag]; - break; - } - } - - if (interfacePriv == NULL) { - /* No match found - error */ - interfaceTag = 0; - interfacePriv = priv->interfacePriv[interfaceTag]; - unifi_warning(priv, "Mac address not matching ... debugging needed\n"); - interfacePriv->stats.tx_dropped++; - kfree_skb(skb); - return -1; - } - - /* Add a SNAP header if necessary */ - if (skb_add_llc_snap(priv->netdev[interfaceTag], skb, proto) != 0) { - /* convert failed */ - unifi_error(priv, "skb_add_llc_snap failed.\n"); - kfree_skb(skb); - return -1; - } - - bulkdata.d[0].os_data_ptr = skb->data; - bulkdata.d[0].os_net_buf_ptr = (unsigned char*)skb; - bulkdata.d[0].net_buf_length = bulkdata.d[0].data_length = skb->len; - bulkdata.d[1].os_data_ptr = NULL; - bulkdata.d[1].os_net_buf_ptr = NULL; - bulkdata.d[1].net_buf_length = bulkdata.d[1].data_length = 0; - -#ifdef CSR_SUPPORT_SME - /* Notify the TA module for the Tx frame for non AP/P2PGO mode*/ - if ((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_AP) && - (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)) { - unifi_ta_sample(priv->card, CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX, - &bulkdata.d[0], ehdr->h_source, - priv->netdev[interfaceTag]->dev_addr, - jiffies_to_msecs(jiffies), - 0); /* rate is unknown on tx */ - } -#endif /* CSR_SUPPORT_SME */ - - if ((proto == ETH_P_PAE) -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - || (proto == ETH_P_WAI) -#endif - ) - { - /* check for m4 detection */ - if (0 == uf_verify_m4(priv, bulkdata.d[0].os_data_ptr, bulkdata.d[0].data_length)) { - eapolStore = TRUE; - } - } - -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - if (proto == ETH_P_WAI) - { - protection = 0; /*WAI packets always sent unencrypted*/ - } - else - { -#endif -#ifdef CSR_SUPPORT_SME - if ((protection = uf_get_protection_bit_from_interfacemode(priv, interfaceTag, ehdr->h_dest)) < 0) { - unifi_warning(priv, "unicast address, but destination not in station record database\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - return -1; - } -#else - protection = 0; -#endif -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - } -#endif - - /* append Mac header for Eapol as well as data packet */ - if (prepare_and_add_macheader(priv, skb, newSkb, priority, &bulkdata, interfaceTag, ehdr->h_dest, ehdr->h_source, protection)) { - unifi_error(priv, "failed to create MAC header\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - return -1; - } - - /* RA address must contain the immediate destination MAC address that is similar to - * the Address 1 field of 802.11 Mac header here 4 is: (sizeof(framecontrol) + sizeof (durationID)) - * which is address 1 field - */ - memcpy(peerAddress.a, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); - - unifi_trace(priv, UDBG5, "RA[0]=%x, RA[1]=%x, RA[2]=%x, RA[3]=%x, RA[4]=%x, RA[5]=%x\n", - peerAddress.a[0], peerAddress.a[1], peerAddress.a[2], peerAddress.a[3], - peerAddress.a[4], peerAddress.a[5]); - - - if ((proto == ETH_P_PAE) -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - || (proto == ETH_P_WAI) -#endif - ) - { - CSR_SIGNAL signal; - CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest; - - /* initialize signal to zero */ - memset(&signal, 0, sizeof(CSR_SIGNAL)); - - /* Frame MA_PACKET request */ - signal.SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID; - signal.SignalPrimitiveHeader.ReceiverProcessId = 0; - signal.SignalPrimitiveHeader.SenderProcessId = priv->netdev_client->sender_id; - - transmissionControl = req->TransmissionControl = 0; -#ifdef CSR_SUPPORT_SME - if (eapolStore) - { - netInterface_priv_t *netpriv = (netInterface_priv_t *)netdev_priv(priv->netdev[interfaceTag]); - - /* Fill the MA-PACKET.req */ - - req->Priority = priority; - unifi_trace(priv, UDBG3, "Tx Frame with Priority: %x\n", req->Priority); - - /* rate selected by firmware */ - req->TransmitRate = 0; - req->HostTag = CSR_WIFI_EAPOL_M4_HOST_TAG; - /* RA address matching with address 1 of Mac header */ - memcpy(req->Ra.x, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); - - spin_lock(&priv->m4_lock); - /* Store the M4-PACKET.req for later */ - interfacePriv->m4_signal = signal; - interfacePriv->m4_bulk_data.net_buf_length = bulkdata.d[0].net_buf_length; - interfacePriv->m4_bulk_data.data_length = bulkdata.d[0].data_length; - interfacePriv->m4_bulk_data.os_data_ptr = bulkdata.d[0].os_data_ptr; - interfacePriv->m4_bulk_data.os_net_buf_ptr = bulkdata.d[0].os_net_buf_ptr; - spin_unlock(&priv->m4_lock); - - /* Signal the workqueue to call CsrWifiRouterCtrlM4ReadyToSendIndSend(). - * It cannot be called directly from the tx path because it - * does a non-atomic kmalloc via the framework's CsrPmemAlloc(). - */ - queue_work(priv->unifi_workqueue, &netpriv->send_m4_ready_task); - - return 0; - } -#endif - }/*EAPOL or WAI packet*/ - -#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) - if ((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) && \ - (priv->wapi_unicast_filter) && \ - (proto != ETH_P_PAE) && \ - (proto != ETH_P_WAI) && \ - (skb->len > 0)) - { - CSR_SIGNAL signal; - CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest; - netInterface_priv_t *netpriv = (netInterface_priv_t *)netdev_priv(priv->netdev[interfaceTag]); - - unifi_trace(priv, UDBG4, "send_ma_pkt_request() - WAPI unicast data packet when USKID = 1 \n"); - - /* initialize signal to zero */ - memset(&signal, 0, sizeof(CSR_SIGNAL)); - /* Frame MA_PACKET request */ - signal.SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID; - signal.SignalPrimitiveHeader.ReceiverProcessId = 0; - signal.SignalPrimitiveHeader.SenderProcessId = priv->netdev_client->sender_id; - - /* Fill the MA-PACKET.req */ - req->TransmissionControl = 0; - req->Priority = priority; - unifi_trace(priv, UDBG3, "Tx Frame with Priority: %x\n", req->Priority); - req->TransmitRate = (CSR_RATE) 0; /* rate selected by firmware */ - req->HostTag = 0xffffffff; /* Ask for a new HostTag */ - /* RA address matching with address 1 of Mac header */ - memcpy(req->Ra.x, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); - - /* Store the M4-PACKET.req for later */ - spin_lock(&priv->wapi_lock); - interfacePriv->wapi_unicast_ma_pkt_sig = signal; - interfacePriv->wapi_unicast_bulk_data.net_buf_length = bulkdata.d[0].net_buf_length; - interfacePriv->wapi_unicast_bulk_data.data_length = bulkdata.d[0].data_length; - interfacePriv->wapi_unicast_bulk_data.os_data_ptr = bulkdata.d[0].os_data_ptr; - interfacePriv->wapi_unicast_bulk_data.os_net_buf_ptr = bulkdata.d[0].os_net_buf_ptr; - spin_unlock(&priv->wapi_lock); - - /* Signal the workqueue to call CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend(). - * It cannot be called directly from the tx path because it - * does a non-atomic kmalloc via the framework's CsrPmemAlloc(). - */ - queue_work(priv->unifi_workqueue, &netpriv->send_pkt_to_encrypt); - - return 0; - } -#endif - - if(priv->cmanrTestMode) - { - TransmitRate = priv->cmanrTestModeTransmitRate; - unifi_trace(priv, UDBG2, "send_ma_pkt_request: cmanrTestModeTransmitRate = %d TransmitRate=%d\n", - priv->cmanrTestModeTransmitRate, - TransmitRate - ); - } - - /* Send UniFi msg */ - /* Here hostTag is been sent as 0xffffffff, its been appended properly while framing MA-Packet request in pdu_processing.c file */ - r = uf_process_ma_packet_req(priv, - peerAddress.a, - 0xffffffff, /* Ask for a new HostTag */ - interfaceTag, - transmissionControl, - TransmitRate, - priority, - priv->netdev_client->sender_id, - &bulkdata); - - if (r) { - unifi_trace(priv, UDBG1, "(HIP validation failure) r = %x\n", r); - unifi_net_data_free(priv, &bulkdata.d[0]); - return -1; - } - - unifi_trace(priv, UDBG3, "leaving send_ma_pkt_request, UNITDATA result code = %d\n", r); - - return r; -} /* send_ma_pkt_request() */ - -/* - * --------------------------------------------------------------------------- - * uf_net_xmit - * - * This function is called by the higher level stack to transmit an - * ethernet packet. - * - * Arguments: - * skb Ethernet packet to send. - * dev Pointer to the linux net device. - * - * Returns: - * 0 on success (packet was consumed, not necessarily transmitted) - * 1 if packet was requeued - * -1 on error - * - * - * Notes: - * The controlled port is handled in the qdisc dequeue handler. - * --------------------------------------------------------------------------- - */ -static netdev_tx_t -uf_net_xmit(struct sk_buff *skb, struct net_device *dev) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct ethhdr ehdr; - int proto, port; - int result; - static tx_signal_handler tx_handler; - CSR_PRIORITY priority; - CsrWifiRouterCtrlPortAction port_action; - - unifi_trace(priv, UDBG5, "unifi_net_xmit: skb = %x\n", skb); - - memcpy(&ehdr, skb->data, ETH_HLEN); - proto = ntohs(ehdr.h_proto); - priority = get_packet_priority(priv, skb, &ehdr, interfacePriv); - - /* All frames are sent as MA-PACKET.req (EAPOL also) */ - tx_handler = send_ma_pkt_request; - - /* 802.1x - apply controlled/uncontrolled port rules */ - if ((proto != ETH_P_PAE) -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - && (proto != ETH_P_WAI) -#endif - ) { - port = UF_CONTROLLED_PORT_Q; - } else { - /* queue 4 */ - port = UF_UNCONTROLLED_PORT_Q; - } - - /* Uncontrolled port rules apply */ - port_action = verify_port(priv - , (((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode)||(CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI== interfacePriv->interfaceMode))? interfacePriv->bssid.a: ehdr.h_dest) - , port - , interfacePriv->InterfaceTag); - - if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) { - unifi_trace(priv, UDBG5, - "uf_net_xmit: %s controlled port open\n", - port ? "" : "un"); - /* Remove the ethernet header */ - skb_pull(skb, ETH_HLEN); - result = tx_handler(priv, skb, &ehdr, priority); - } else { - - /* Discard the packet if necessary */ - unifi_trace(priv, UDBG2, - "uf_net_xmit: %s controlled port %s\n", - port ? "" : "un", port_action==CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK ? "blocked" : "closed"); - interfacePriv->stats.tx_dropped++; - kfree_skb(skb); - - return NETDEV_TX_OK; - } - - if (result == NETDEV_TX_OK) { -#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) - /* Don't update the tx stats when the pkt is to be sent for sw encryption*/ - if (!((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) && - (priv->wapi_unicast_filter == 1))) - { - dev->trans_start = jiffies; - /* Should really count tx stats in the UNITDATA.status signal but - * that doesn't have the length. - */ - interfacePriv->stats.tx_packets++; - /* count only the packet payload */ - interfacePriv->stats.tx_bytes += skb->len; - - } -#else - dev->trans_start = jiffies; - - /* - * Should really count tx stats in the UNITDATA.status signal but - * that doesn't have the length. - */ - interfacePriv->stats.tx_packets++; - /* count only the packet payload */ - interfacePriv->stats.tx_bytes += skb->len; -#endif - } else if (result < 0) { - - /* Failed to send: fh queue was full, and the skb was discarded. - * Return OK to indicate that the buffer was consumed, to stop the - * kernel re-transmitting the freed buffer. - */ - interfacePriv->stats.tx_dropped++; - unifi_trace(priv, UDBG1, "unifi_net_xmit: (Packet Drop), dropped count = %x\n", interfacePriv->stats.tx_dropped); - result = NETDEV_TX_OK; - } - - /* The skb will have been freed by send_XXX_request() */ - - return result; -} /* uf_net_xmit() */ - -/* - * --------------------------------------------------------------------------- - * unifi_pause_xmit - * unifi_restart_xmit - * - * These functions are called from the UniFi core to control the flow - * of packets from the upper layers. - * unifi_pause_xmit() is called when the internal queue is full and - * should take action to stop unifi_ma_unitdata() being called. - * When the queue has drained, unifi_restart_xmit() will be called to - * re-enable the flow of packets for transmission. - * - * Arguments: - * ospriv OS private context pointer. - * - * Returns: - * unifi_pause_xmit() is called from interrupt context. - * --------------------------------------------------------------------------- - */ -void -unifi_pause_xmit(void *ospriv, unifi_TrafficQueue queue) -{ - unifi_priv_t *priv = ospriv; - int i; /* used as a loop counter */ - - unifi_trace(priv, UDBG2, "Stopping queue %d\n", queue); - - for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++) - { - if (netif_running(priv->netdev[i])) - { - netif_stop_subqueue(priv->netdev[i], (u16)queue); - } - } - -#ifdef CSR_SUPPORT_SME - if(queue<=3) { - routerStartBuffering(priv, queue); - unifi_trace(priv, UDBG2, "Start buffering %d\n", queue); - } else { - routerStartBuffering(priv, 0); - unifi_error(priv, "Start buffering %d defaulting to 0\n", queue); - } -#endif - -} /* unifi_pause_xmit() */ - -void -unifi_restart_xmit(void *ospriv, unifi_TrafficQueue queue) -{ - unifi_priv_t *priv = ospriv; - int i=0; /* used as a loop counter */ - - unifi_trace(priv, UDBG2, "Waking queue %d\n", queue); - - for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++) - { - if (netif_running(priv->netdev[i])) - { - netif_wake_subqueue(priv->netdev[i], (u16)queue); - } - } - -#ifdef CSR_SUPPORT_SME - if(queue <=3) { - routerStopBuffering(priv, queue); - uf_send_buffered_frames(priv, queue); - } else { - routerStopBuffering(priv, 0); - uf_send_buffered_frames(priv, 0); - } -#endif -} /* unifi_restart_xmit() */ - - -static void -indicate_rx_skb(unifi_priv_t *priv, u16 ifTag, u8* dst_a, u8* src_a, struct sk_buff *skb, CSR_SIGNAL *signal, - bulk_data_param_t *bulkdata) -{ - int r, sr = 0; - struct net_device *dev; - -#ifdef CSR_SUPPORT_SME - llc_snap_hdr_t *snap; - - snap = (llc_snap_hdr_t *)skb->data; - - sr = _identify_sme_ma_pkt_ind(priv, - snap->oui, ntohs(snap->protocol), - signal, - bulkdata, - dst_a, src_a ); -#endif - - /* - * Decapsulate any SNAP header and - * prepend an ethernet header so that the skb manipulation and ARP - * stuff works. - */ - r = skb_80211_to_ether(priv, skb, dst_a, src_a, - signal, bulkdata); - if (r == -1) { - /* Drop the packet and return */ - priv->interfacePriv[ifTag]->stats.rx_errors++; - priv->interfacePriv[ifTag]->stats.rx_frame_errors++; - unifi_net_data_free(priv, &bulkdata->d[0]); - unifi_notice(priv, "indicate_rx_skb: Discard unknown frame.\n"); - return; - } - - /* Handle the case where packet is sent up through the subscription - * API but should not be given to the network stack (AMP PAL case) - * LLC header is different from WiFi and the packet has been subscribed for - */ - if (r == 1 && sr == 1) { - unifi_net_data_free(priv, &bulkdata->d[0]); - unifi_trace(priv, UDBG5, "indicate_rx_skb: Data given to subscription" - "API, not being given to kernel\n"); - return; - } - - dev = priv->netdev[ifTag]; - /* Now we look like a regular ethernet frame */ - /* Fill in SKB meta data */ - skb->dev = dev; - skb->protocol = eth_type_trans(skb, dev); - skb->ip_summed = CHECKSUM_UNNECESSARY; - - /* Test for an overlength frame */ - if (skb->len > (dev->mtu + ETH_HLEN)) { - /* A bogus length ethfrm has been encap'd. */ - /* Is someone trying an oflow attack? */ - unifi_error(priv, "%s: oversize frame (%d > %d)\n", - dev->name, - skb->len, dev->mtu + ETH_HLEN); - - /* Drop the packet and return */ - priv->interfacePriv[ifTag]->stats.rx_errors++; - priv->interfacePriv[ifTag]->stats.rx_length_errors++; - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - - - if(priv->cmanrTestMode) - { - const CSR_MA_PACKET_INDICATION *pkt_ind = &signal->u.MaPacketIndication; - priv->cmanrTestModeTransmitRate = pkt_ind->ReceivedRate; - unifi_trace(priv, UDBG2, "indicate_rx_skb: cmanrTestModeTransmitRate=%d\n", priv->cmanrTestModeTransmitRate); - } - - /* Pass SKB up the stack */ -#ifdef CSR_WIFI_USE_NETIF_RX - netif_rx(skb); -#else - netif_rx_ni(skb); -#endif - - if (dev != NULL) { - dev->last_rx = jiffies; - } - - /* Bump rx stats */ - priv->interfacePriv[ifTag]->stats.rx_packets++; - priv->interfacePriv[ifTag]->stats.rx_bytes += bulkdata->d[0].data_length; - - return; -} - -void -uf_process_rx_pending_queue(unifi_priv_t *priv, int queue, - CsrWifiMacAddress source_address, - int indicate, u16 interfaceTag) -{ - rx_buffered_packets_t *rx_q_item; - struct list_head *rx_list; - struct list_head *n; - struct list_head *l_h; - static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "uf_process_rx_pending_queue bad interfaceTag\n"); - return; - } - - if (queue == UF_CONTROLLED_PORT_Q) { - rx_list = &interfacePriv->rx_controlled_list; - } else { - rx_list = &interfacePriv->rx_uncontrolled_list; - } - - down(&priv->rx_q_sem); - list_for_each_safe(l_h, n, rx_list) { - rx_q_item = list_entry(l_h, rx_buffered_packets_t, q); - - /* Validate against the source address */ - if (memcmp(broadcast_address.a, source_address.a, ETH_ALEN) && - memcmp(rx_q_item->sa.a, source_address.a, ETH_ALEN)) { - - unifi_trace(priv, UDBG2, - "uf_process_rx_pending_queue: Skipping sa=%02X%02X%02X%02X%02X%02X skb=%p, bulkdata=%p\n", - rx_q_item->sa.a[0], rx_q_item->sa.a[1], - rx_q_item->sa.a[2], rx_q_item->sa.a[3], - rx_q_item->sa.a[4], rx_q_item->sa.a[5], - rx_q_item->skb, &rx_q_item->bulkdata.d[0]); - continue; - } - - list_del(l_h); - - - unifi_trace(priv, UDBG2, - "uf_process_rx_pending_queue: Was Blocked skb=%p, bulkdata=%p\n", - rx_q_item->skb, &rx_q_item->bulkdata); - - if (indicate) { - indicate_rx_skb(priv, interfaceTag, rx_q_item->da.a, rx_q_item->sa.a, rx_q_item->skb, &rx_q_item->signal, &rx_q_item->bulkdata); - } else { - interfacePriv->stats.rx_dropped++; - unifi_net_data_free(priv, &rx_q_item->bulkdata.d[0]); - } - - /* It is our resposibility to free the Rx structure object. */ - kfree(rx_q_item); - } - up(&priv->rx_q_sem); -} - -/* - * --------------------------------------------------------------------------- - * uf_resume_data_plane - * - * Is called when the (un)controlled port is set to open, - * to notify the network stack to schedule for transmission - * any packets queued in the qdisk while port was closed and - * indicated to the stack any packets buffered in the Rx queues. - * - * Arguments: - * priv Pointer to device private struct - * - * Returns: - * --------------------------------------------------------------------------- - */ -void -uf_resume_data_plane(unifi_priv_t *priv, int queue, - CsrWifiMacAddress peer_address, - u16 interfaceTag) -{ -#ifdef CSR_SUPPORT_WEXT - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; -#endif - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "uf_resume_data_plane bad interfaceTag\n"); - return; - } - - unifi_trace(priv, UDBG2, "Resuming netif\n"); - - /* - * If we are waiting for the net device to enter the up state, don't - * process the rx queue yet as it will be done by the callback when - * the device is ready. - */ -#ifdef CSR_SUPPORT_WEXT - if (!interfacePriv->wait_netdev_change) -#endif - { -#ifdef CONFIG_NET_SCHED - if (netif_running(priv->netdev[interfaceTag])) { - netif_tx_schedule_all(priv->netdev[interfaceTag]); - } -#endif - uf_process_rx_pending_queue(priv, queue, peer_address, 1, interfaceTag); - } -} /* uf_resume_data_plane() */ - - -void uf_free_pending_rx_packets(unifi_priv_t *priv, int queue, CsrWifiMacAddress peer_address, u16 interfaceTag) -{ - uf_process_rx_pending_queue(priv, queue, peer_address, 0, interfaceTag); - -} /* uf_free_pending_rx_packets() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_rx - * - * Reformat a UniFi data received packet into a p80211 packet and - * pass it up the protocol stack. - * - * Arguments: - * None. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void -unifi_rx(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) -{ - u16 interfaceTag; - bulk_data_desc_t *pData; - const CSR_MA_PACKET_INDICATION *pkt_ind = &signal->u.MaPacketIndication; - struct sk_buff *skb; - CsrWifiRouterCtrlPortAction port_action; - u8 dataFrameType; - int proto; - int queue; - - u8 da[ETH_ALEN], sa[ETH_ALEN]; - u8 toDs, fromDs, frameType, macHeaderLengthInBytes = MAC_HEADER_SIZE; - u16 frameControl; - netInterface_priv_t *interfacePriv; - struct ethhdr ehdr; - - interfaceTag = (pkt_ind->VirtualInterfaceIdentifier & 0xff); - interfacePriv = priv->interfacePriv[interfaceTag]; - - /* Sanity check that the VIF refers to a sensible interface */ - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) - { - unifi_error(priv, "%s: MA-PACKET indication with bad interfaceTag %d\n", __FUNCTION__, interfaceTag); - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - - /* Sanity check that the VIF refers to an allocated netdev */ - if (!interfacePriv->netdev_registered) - { - unifi_error(priv, "%s: MA-PACKET indication with unallocated interfaceTag %d\n", __FUNCTION__, interfaceTag); - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - - if (bulkdata->d[0].data_length == 0) { - unifi_warning(priv, "%s: MA-PACKET indication with zero bulk data\n", __FUNCTION__); - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - - - skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; - skb->len = bulkdata->d[0].data_length; - - /* Point to the addresses */ - toDs = (skb->data[1] & 0x01) ? 1 : 0; - fromDs = (skb->data[1] & 0x02) ? 1 : 0; - - memcpy(da, (skb->data+4+toDs*12), ETH_ALEN);/* Address1 or 3 */ - memcpy(sa, (skb->data+10+fromDs*(6+toDs*8)), ETH_ALEN); /* Address2, 3 or 4 */ - - - pData = &bulkdata->d[0]; - frameControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr); - frameType = ((frameControl & 0x000C) >> 2); - - dataFrameType =((frameControl & 0x00f0) >> 4); - unifi_trace(priv, UDBG6, - "%s: Receive Data Frame Type %d \n", __FUNCTION__, dataFrameType); - - switch(dataFrameType) - { - case QOS_DATA: - case QOS_DATA_NULL: - /* If both are set then the Address4 exists (only for AP) */ - if (fromDs && toDs) - { - /* 6 is the size of Address4 field */ - macHeaderLengthInBytes += (QOS_CONTROL_HEADER_SIZE + 6); - } - else - { - macHeaderLengthInBytes += QOS_CONTROL_HEADER_SIZE; - } - - /* If order bit set then HT control field is the part of MAC header */ - if (frameControl & FRAME_CONTROL_ORDER_BIT) - macHeaderLengthInBytes += HT_CONTROL_HEADER_SIZE; - break; - default: - if (fromDs && toDs) - macHeaderLengthInBytes += 6; - } - - /* Prepare the ethernet header from snap header of skb data */ - switch(dataFrameType) - { - case DATA_NULL: - case QOS_DATA_NULL: - /* This is for only queue info fetching, EAPOL wont come as - * null data so the proto is initialized as zero - */ - proto = 0x0; - break; - default: - { - llc_snap_hdr_t *snap; - /* Fetch a snap header to find protocol (for IPV4/IPV6 packets - * the snap header fetching offset is same) - */ - snap = (llc_snap_hdr_t *) (skb->data + macHeaderLengthInBytes); - - /* prepare the ethernet header from the snap header & addresses */ - ehdr.h_proto = snap->protocol; - memcpy(ehdr.h_dest, da, ETH_ALEN); - memcpy(ehdr.h_source, sa, ETH_ALEN); - } - proto = ntohs(ehdr.h_proto); - } - unifi_trace(priv, UDBG3, "in unifi_rx protocol from snap header = 0x%x\n", proto); - - if ((proto != ETH_P_PAE) -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - && (proto != ETH_P_WAI) -#endif - ) { - queue = UF_CONTROLLED_PORT_Q; - } else { - queue = UF_UNCONTROLLED_PORT_Q; - } - - port_action = verify_port(priv, (unsigned char*)sa, queue, interfaceTag); - unifi_trace(priv, UDBG3, "in unifi_rx port action is = 0x%x & queue = %x\n", port_action, queue); - -#ifdef CSR_SUPPORT_SME - /* Notify the TA module for the Rx frame for non P2PGO and AP cases*/ - if((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_AP) && - (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)) - { - /* Remove MAC header of length(macHeaderLengthInBytes) before sampling */ - skb_pull(skb, macHeaderLengthInBytes); - pData->os_data_ptr = skb->data; - pData->data_length -= macHeaderLengthInBytes; - - if (pData->data_length) { - unifi_ta_sample(priv->card, CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX, - &bulkdata->d[0], - sa, priv->netdev[interfaceTag]->dev_addr, - jiffies_to_msecs(jiffies), - pkt_ind->ReceivedRate); - } - } else { - - /* AP/P2PGO specific handling here */ - CsrWifiRouterCtrlStaInfo_t * srcStaInfo = - CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, sa, interfaceTag); - - /* Defensive check only; Source address is already checked in - process_ma_packet_ind and we should have a valid source address here */ - - if(srcStaInfo == NULL) { - CsrWifiMacAddress peerMacAddress; - /* Unknown data PDU */ - memcpy(peerMacAddress.a, sa, ETH_ALEN); - unifi_trace(priv, UDBG1, "%s: Unexpected frame from peer = %x:%x:%x:%x:%x:%x\n", __FUNCTION__, - sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]); - CsrWifiRouterCtrlUnexpectedFrameIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress); - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - - /* For AP GO mode, don't store the PDUs */ - if (port_action != CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) { - /* Drop the packet and return */ - CsrWifiMacAddress peerMacAddress; - memcpy(peerMacAddress.a, sa, ETH_ALEN); - unifi_trace(priv, UDBG3, "%s: Port is not open: unexpected frame from peer = %x:%x:%x:%x:%x:%x\n", - __FUNCTION__, sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]); - - CsrWifiRouterCtrlUnexpectedFrameIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress); - interfacePriv->stats.rx_dropped++; - unifi_net_data_free(priv, &bulkdata->d[0]); - unifi_notice(priv, "%s: Dropping packet, proto=0x%04x, %s port\n", __FUNCTION__, - proto, queue ? "Controlled" : "Un-controlled"); - return; - } - - /* Qos NULL/Data NULL are freed here and not processed further */ - if((dataFrameType == QOS_DATA_NULL) || (dataFrameType == DATA_NULL)){ - unifi_trace(priv, UDBG5, "%s: Null Frame Received and Freed\n", __FUNCTION__); - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - - /* Now we have done with MAC header so proceed with the real data part*/ - /* This function takes care of appropriate routing for AP/P2PGO case*/ - /* the function hadnles following things - 2. Routing the PDU to appropriate location - 3. Error case handling - */ - if(!(uf_ap_process_data_pdu(priv, skb, &ehdr, srcStaInfo, - signal, - bulkdata, - macHeaderLengthInBytes))) - { - return; - } - unifi_trace(priv, UDBG5, "unifi_rx: no specific AP handling process as normal frame, MAC Header len %d\n", macHeaderLengthInBytes); - /* Remove the MAC header for subsequent conversion */ - skb_pull(skb, macHeaderLengthInBytes); - pData->os_data_ptr = skb->data; - pData->data_length -= macHeaderLengthInBytes; - pData->os_net_buf_ptr = (unsigned char*)skb; - pData->net_buf_length = skb->len; - } -#endif /* CSR_SUPPORT_SME */ - - - /* Now that the MAC header is removed, null-data frames have zero length - * and can be dropped - */ - if (pData->data_length == 0) { - if (((frameControl & 0x00f0) >> 4) != QOS_DATA_NULL && - ((frameControl & 0x00f0) >> 4) != DATA_NULL) { - unifi_trace(priv, UDBG1, "Zero length frame, but not null-data %04x\n", frameControl); - } - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - - if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) { - /* Drop the packet and return */ - interfacePriv->stats.rx_dropped++; - unifi_net_data_free(priv, &bulkdata->d[0]); - unifi_notice(priv, "%s: Dropping packet, proto=0x%04x, %s port\n", - __FUNCTION__, proto, queue ? "controlled" : "uncontrolled"); - return; - } else if ( (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK) || - (interfacePriv->connected != UnifiConnected) ) { - - /* Buffer the packet into the Rx queues */ - rx_buffered_packets_t *rx_q_item; - struct list_head *rx_list; - - rx_q_item = kmalloc(sizeof(rx_buffered_packets_t), - GFP_KERNEL); - if (rx_q_item == NULL) { - unifi_error(priv, "%s: Failed to allocate %d bytes for rx packet record\n", - __FUNCTION__, sizeof(rx_buffered_packets_t)); - interfacePriv->stats.rx_dropped++; - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - - INIT_LIST_HEAD(&rx_q_item->q); - rx_q_item->bulkdata = *bulkdata; - rx_q_item->skb = skb; - rx_q_item->signal = *signal; - memcpy(rx_q_item->sa.a, sa, ETH_ALEN); - memcpy(rx_q_item->da.a, da, ETH_ALEN); - unifi_trace(priv, UDBG2, "%s: Blocked skb=%p, bulkdata=%p\n", - __FUNCTION__, rx_q_item->skb, &rx_q_item->bulkdata); - - if (queue == UF_CONTROLLED_PORT_Q) { - rx_list = &interfacePriv->rx_controlled_list; - } else { - rx_list = &interfacePriv->rx_uncontrolled_list; - } - - /* Add to tail of packets queue */ - down(&priv->rx_q_sem); - list_add_tail(&rx_q_item->q, rx_list); - up(&priv->rx_q_sem); - - return; - - } - - indicate_rx_skb(priv, interfaceTag, da, sa, skb, signal, bulkdata); - -} /* unifi_rx() */ - -static void process_ma_packet_cfm(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) -{ - u16 interfaceTag; - const CSR_MA_PACKET_CONFIRM *pkt_cfm = &signal->u.MaPacketConfirm; - netInterface_priv_t *interfacePriv; - - interfaceTag = (pkt_cfm->VirtualInterfaceIdentifier & 0xff); - interfacePriv = priv->interfacePriv[interfaceTag]; - - /* Sanity check that the VIF refers to a sensible interface */ - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) - { - unifi_error(priv, "%s: MA-PACKET confirm with bad interfaceTag %d\n", __FUNCTION__, interfaceTag); - return; - } -#ifdef CSR_SUPPORT_SME - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - - uf_process_ma_pkt_cfm_for_ap(priv, interfaceTag, pkt_cfm); - } else if (interfacePriv->m4_sent && (pkt_cfm->HostTag == interfacePriv->m4_hostTag)) { - /* Check if this is a confirm for EAPOL M4 frame and we need to send transmistted ind*/ - CsrResult result = pkt_cfm->TransmissionStatus == CSR_TX_SUCCESSFUL?CSR_RESULT_SUCCESS:CSR_RESULT_FAILURE; - CsrWifiMacAddress peerMacAddress; - memcpy(peerMacAddress.a, interfacePriv->m4_signal.u.MaPacketRequest.Ra.x, ETH_ALEN); - - unifi_trace(priv, UDBG1, "%s: Sending M4 Transmit CFM\n", __FUNCTION__); - CsrWifiRouterCtrlM4TransmittedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, - interfaceTag, - peerMacAddress, - result); - interfacePriv->m4_sent = FALSE; - interfacePriv->m4_hostTag = 0xffffffff; - } -#endif - return; -} - - -/* - * --------------------------------------------------------------------------- - * unifi_rx - * - * Reformat a UniFi data received packet into a p80211 packet and - * pass it up the protocol stack. - * - * Arguments: - * None. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) -{ - u16 interfaceTag; - bulk_data_desc_t *pData; - CSR_MA_PACKET_INDICATION *pkt_ind = (CSR_MA_PACKET_INDICATION*)&signal->u.MaPacketIndication; - struct sk_buff *skb; - u16 frameControl; - netInterface_priv_t *interfacePriv; - u8 da[ETH_ALEN], sa[ETH_ALEN]; - u8 *bssid = NULL, *ba_addr = NULL; - u8 toDs, fromDs, frameType; - u8 i =0; - -#ifdef CSR_SUPPORT_SME - u8 dataFrameType = 0; - u8 powerSaveChanged = FALSE; - u8 pmBit = 0; - CsrWifiRouterCtrlStaInfo_t *srcStaInfo = NULL; - u16 qosControl; - -#endif - - interfaceTag = (pkt_ind->VirtualInterfaceIdentifier & 0xff); - interfacePriv = priv->interfacePriv[interfaceTag]; - - - /* Sanity check that the VIF refers to a sensible interface */ - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) - { - unifi_error(priv, "%s: MA-PACKET indication with bad interfaceTag %d\n", __FUNCTION__, interfaceTag); - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - - /* Sanity check that the VIF refers to an allocated netdev */ - if (!interfacePriv->netdev_registered) - { - unifi_error(priv, "%s: MA-PACKET indication with unallocated interfaceTag %d\n", __FUNCTION__, interfaceTag); - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - - if (bulkdata->d[0].data_length == 0) { - unifi_warning(priv, "%s: MA-PACKET indication with zero bulk data\n", __FUNCTION__); - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - /* For monitor mode we need to pass this indication to the registered application - handle this separately*/ - /* MIC failure is already taken care of so no need to send the PDUs which are not successfully received in non-monitor mode*/ - if(pkt_ind->ReceptionStatus != CSR_RX_SUCCESS) - { - unifi_warning(priv, "%s: MA-PACKET indication with status = %d\n", __FUNCTION__, pkt_ind->ReceptionStatus); - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - - - skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; - skb->len = bulkdata->d[0].data_length; - - /* Point to the addresses */ - toDs = (skb->data[1] & 0x01) ? 1 : 0; - fromDs = (skb->data[1] & 0x02) ? 1 : 0; - - memcpy(da, (skb->data+4+toDs*12), ETH_ALEN);/* Address1 or 3 */ - memcpy(sa, (skb->data+10+fromDs*(6+toDs*8)), ETH_ALEN); /* Address2, 3 or 4 */ - - /* Find the BSSID, which will be used to match the BA session */ - if (toDs && fromDs) - { - unifi_trace(priv, UDBG6, "4 address frame - don't try to find BSSID\n"); - bssid = NULL; - } - else - { - bssid = (u8 *) (skb->data + 4 + 12 - (fromDs * 6) - (toDs * 12)); - } - - pData = &bulkdata->d[0]; - frameControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr); - frameType = ((frameControl & 0x000C) >> 2); - - unifi_trace(priv, UDBG3, "Rx Frame Type: %d sn: %d\n", frameType, - (le16_to_cpu(*((u16*)(bulkdata->d[0].os_data_ptr + IEEE802_11_SEQUENCE_CONTROL_OFFSET))) >> 4) & 0xfff); - if(frameType == IEEE802_11_FRAMETYPE_CONTROL){ -#ifdef CSR_SUPPORT_SME - unifi_trace(priv, UDBG6, "%s: Received Control Frame\n", __FUNCTION__); - - if((frameControl & 0x00f0) == 0x00A0){ - /* This is a PS-POLL request */ - u8 pmBit = (frameControl & 0x1000)?0x01:0x00; - unifi_trace(priv, UDBG6, "%s: Received PS-POLL Frame\n", __FUNCTION__); - - uf_process_ps_poll(priv, sa, da, pmBit, interfaceTag); - } - else { - unifi_warning(priv, "%s: Non PS-POLL control frame is received\n", __FUNCTION__); - } -#endif - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - if(frameType != IEEE802_11_FRAMETYPE_DATA) { - unifi_warning(priv, "%s: Non control Non Data frame is received\n", __FUNCTION__); - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - -#ifdef CSR_SUPPORT_SME - if((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP) || - (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)){ - - srcStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, sa, interfaceTag); - - if(srcStaInfo == NULL) { - CsrWifiMacAddress peerMacAddress; - /* Unknown data PDU */ - memcpy(peerMacAddress.a, sa, ETH_ALEN); - unifi_trace(priv, UDBG1, "%s: Unexpected frame from peer = %x:%x:%x:%x:%x:%x\n", __FUNCTION__, - sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]); - CsrWifiRouterCtrlUnexpectedFrameIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress); - unifi_net_data_free(priv, &bulkdata->d[0]); - return; - } - - /* - verify power management bit here so as to ensure host and unifi are always - in sync with power management status of peer. - - If we do it later, it may so happen we have stored the frame in BA re-ordering - buffer and hence host and unifi are out of sync for power management status - */ - - pmBit = (frameControl & 0x1000)?0x01:0x00; - powerSaveChanged = uf_process_pm_bit_for_peer(priv, srcStaInfo, pmBit, interfaceTag); - - /* Update station last activity time */ - srcStaInfo->activity_flag = TRUE; - - /* For Qos Frame if PM bit is toggled to indicate the change in power save state then it shall not be - considered as Trigger Frame. Enter only if WMM STA and peer is in Power save */ - - dataFrameType = ((frameControl & 0x00f0) >> 4); - - if((powerSaveChanged == FALSE)&&(srcStaInfo->wmmOrQosEnabled == TRUE)&& - (srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE)){ - - if((dataFrameType == QOS_DATA) || (dataFrameType == QOS_DATA_NULL)){ - - /* - * QoS control field is offset from frame control by 2 (frame control) - * + 2 (duration/ID) + 2 (sequence control) + 3*ETH_ALEN or 4*ETH_ALEN - */ - if((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK)){ - qosControl= CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr + 30); - } - else{ - qosControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr + 24); - } - unifi_trace(priv, UDBG5, "%s: Check if U-APSD operations are triggered for qosControl: 0x%x\n", __FUNCTION__, qosControl); - uf_process_wmm_deliver_ac_uapsd(priv, srcStaInfo, qosControl, interfaceTag); - } - } - } - -#endif - - if( ((frameControl & 0x00f0) >> 4) == QOS_DATA) { - u8 *qos_control_ptr = (u8*)bulkdata->d[0].os_data_ptr + (((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK))?30: 24); - int tID = *qos_control_ptr & IEEE802_11_QC_TID_MASK; /* using ls octet of qos control */ - ba_session_rx_struct *ba_session; - u8 ba_session_idx = 0; - /* Get the BA originator address */ - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO){ - ba_addr = sa; - }else{ - ba_addr = bssid; - } - - down(&priv->ba_mutex); - for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ - ba_session = interfacePriv->ba_session_rx[ba_session_idx]; - if (ba_session){ - unifi_trace(priv, UDBG6, "found ba_session=0x%x ba_session_idx=%d", ba_session, ba_session_idx); - if ((!memcmp(ba_session->macAddress.a, ba_addr, ETH_ALEN)) && (ba_session->tID == tID)){ - frame_desc_struct frame_desc; - frame_desc.bulkdata = *bulkdata; - frame_desc.signal = *signal; - frame_desc.sn = (le16_to_cpu(*((u16*)(bulkdata->d[0].os_data_ptr + IEEE802_11_SEQUENCE_CONTROL_OFFSET))) >> 4) & 0xfff; - frame_desc.active = TRUE; - unifi_trace(priv, UDBG6, "%s: calling process_ba_frame (session=%d)\n", __FUNCTION__, ba_session_idx); - process_ba_frame(priv, interfacePriv, ba_session, &frame_desc); - up(&priv->ba_mutex); - process_ba_complete(priv, interfacePriv); - break; - } - } - } - if (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_RX){ - up(&priv->ba_mutex); - unifi_trace(priv, UDBG6, "%s: calling process_amsdu()", __FUNCTION__); - process_amsdu(priv, signal, bulkdata); - } - } else { - unifi_trace(priv, UDBG6, "calling unifi_rx()"); - unifi_rx(priv, signal, bulkdata); - } - - /* check if the frames in reorder buffer has aged, the check - * is done after receive processing so that if the missing frame - * has arrived in this receive process, then it is handled cleanly. - * - * And also this code here takes care that timeout check is made for all - * the receive indications - */ - down(&priv->ba_mutex); - for (i=0; i < MAX_SUPPORTED_BA_SESSIONS_RX; i++){ - ba_session_rx_struct *ba_session; - ba_session = interfacePriv->ba_session_rx[i]; - if (ba_session){ - check_ba_frame_age_timeout(priv, interfacePriv, ba_session); - } - } - up(&priv->ba_mutex); - process_ba_complete(priv, interfacePriv); - -} -/* - * --------------------------------------------------------------------------- - * uf_set_multicast_list - * - * This function is called by the higher level stack to set - * a list of multicast rx addresses. - * - * Arguments: - * dev Network Device pointer. - * - * Returns: - * None. - * - * Notes: - * --------------------------------------------------------------------------- - */ - -static void -uf_set_multicast_list(struct net_device *dev) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - -#ifdef CSR_NATIVE_LINUX - unifi_trace(priv, UDBG3, "uf_set_multicast_list unsupported\n"); - return; -#else - - u8 *mc_list = interfacePriv->mc_list; - struct netdev_hw_addr *mc_addr; - int mc_addr_count; - - if (priv->init_progress != UNIFI_INIT_COMPLETED) { - return; - } - - mc_addr_count = netdev_mc_count(dev); - - unifi_trace(priv, UDBG3, - "uf_set_multicast_list (count=%d)\n", mc_addr_count); - - - /* Not enough space? */ - if (mc_addr_count > UNIFI_MAX_MULTICAST_ADDRESSES) { - return; - } - - /* Store the list to be processed by the work item. */ - interfacePriv->mc_list_count = mc_addr_count; - netdev_hw_addr_list_for_each(mc_addr, &dev->mc) { - memcpy(mc_list, mc_addr->addr, ETH_ALEN); - mc_list += ETH_ALEN; - } - - /* Send a message to the workqueue */ - queue_work(priv->unifi_workqueue, &priv->multicast_list_task); -#endif - -} /* uf_set_multicast_list() */ - -/* - * --------------------------------------------------------------------------- - * netdev_mlme_event_handler - * - * Callback function to be used as the udi_event_callback when registering - * as a netdev client. - * To use it, a client specifies this function as the udi_event_callback - * to ul_register_client(). The signal dispatcher in - * unifi_receive_event() will call this function to deliver a signal. - * - * Arguments: - * pcli Pointer to the client instance. - * signal Pointer to the received signal. - * signal_len Size of the signal structure in bytes. - * bulkdata Pointer to structure containing any associated bulk data. - * dir Direction of the signal. Zero means from host, - * non-zero means to host. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void -netdev_mlme_event_handler(ul_client_t *pcli, const u8 *sig_packed, int sig_len, - const bulk_data_param_t *bulkdata_o, int dir) -{ - CSR_SIGNAL signal; - unifi_priv_t *priv = uf_find_instance(pcli->instance); - int id, r; - bulk_data_param_t bulkdata; - - /* Just a sanity check */ - if (sig_packed == NULL) { - return; - } - - /* - * This copy is to silence a compiler warning about discarding the - * const qualifier. - */ - bulkdata = *bulkdata_o; - - /* Get the unpacked signal */ - r = read_unpack_signal(sig_packed, &signal); - if (r) { - /* - * The CSR_MLME_CONNECTED_INDICATION_ID has a receiverID=0 so will - * fall through this case. It is safe to ignore this signal. - */ - unifi_trace(priv, UDBG1, - "Netdev - Received unknown signal 0x%.4X.\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sig_packed)); - return; - } - - id = signal.SignalPrimitiveHeader.SignalId; - unifi_trace(priv, UDBG3, "Netdev - Process signal 0x%.4X\n", id); - - /* - * Take the appropriate action for the signal. - */ - switch (id) { - case CSR_MA_PACKET_ERROR_INDICATION_ID: - process_ma_packet_error_ind(priv, &signal, &bulkdata); - break; - case CSR_MA_PACKET_INDICATION_ID: - process_ma_packet_ind(priv, &signal, &bulkdata); - break; - case CSR_MA_PACKET_CONFIRM_ID: - process_ma_packet_cfm(priv, &signal, &bulkdata); - break; -#ifdef CSR_SUPPORT_SME - case CSR_MLME_SET_TIM_CONFIRM_ID: - /* Handle TIM confirms from FW & set the station record's TIM state appropriately, - * In case of failures, tries with max_retransmit limit - */ - uf_handle_tim_cfm(priv, &signal.u.MlmeSetTimConfirm, signal.SignalPrimitiveHeader.ReceiverProcessId); - break; -#endif - case CSR_DEBUG_STRING_INDICATION_ID: - debug_string_indication(priv, bulkdata.d[0].os_data_ptr, bulkdata.d[0].data_length); - break; - - case CSR_DEBUG_WORD16_INDICATION_ID: - debug_word16_indication(priv, &signal); - break; - - case CSR_DEBUG_GENERIC_CONFIRM_ID: - case CSR_DEBUG_GENERIC_INDICATION_ID: - debug_generic_indication(priv, &signal); - break; - default: - break; - } - -} /* netdev_mlme_event_handler() */ - - -/* - * --------------------------------------------------------------------------- - * uf_net_get_name - * - * Retrieve the name (e.g. eth1) associated with this network device - * - * Arguments: - * dev Pointer to the network device. - * name Buffer to write name - * len Size of buffer in bytes - * - * Returns: - * None - * - * Notes: - * --------------------------------------------------------------------------- - */ -void uf_net_get_name(struct net_device *dev, char *name, int len) -{ - *name = '\0'; - if (dev) { - strlcpy(name, dev->name, (len > IFNAMSIZ) ? IFNAMSIZ : len); - } - -} /* uf_net_get_name */ - -#ifdef CSR_SUPPORT_WEXT - -/* - * --------------------------------------------------------------------------- - * uf_netdev_event - * - * Callback function to handle netdev state changes - * - * Arguments: - * notif Pointer to a notifier_block. - * event Event prompting notification - * ptr net_device pointer - * - * Returns: - * None - * - * Notes: - * The event handler is global, and may occur on non-UniFi netdevs. - * --------------------------------------------------------------------------- - */ -static int -uf_netdev_event(struct notifier_block *notif, unsigned long event, void* ptr) { - struct net_device *netdev = netdev_notifier_info_to_dev(ptr); - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(netdev); - unifi_priv_t *priv = NULL; - static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; - - /* Check that the event is for a UniFi netdev. If it's not, the netdev_priv - * structure is not safe to use. - */ - if (uf_find_netdev_priv(interfacePriv) == -1) { - unifi_trace(NULL, UDBG1, "uf_netdev_event: ignore e=%d, ptr=%p, priv=%p %s\n", - event, ptr, interfacePriv, netdev->name); - return 0; - } - - switch(event) { - case NETDEV_CHANGE: - priv = interfacePriv->privPtr; - unifi_trace(priv, UDBG1, "NETDEV_CHANGE: %p %s %s waiting for it\n", - ptr, - netdev->name, - interfacePriv->wait_netdev_change ? "" : "not"); - - if (interfacePriv->wait_netdev_change) { - netif_tx_wake_all_queues(priv->netdev[interfacePriv->InterfaceTag]); - interfacePriv->connected = UnifiConnected; - interfacePriv->wait_netdev_change = FALSE; - /* Note: passing the broadcast address here will allow anyone to attempt to join our adhoc network */ - uf_process_rx_pending_queue(priv, UF_UNCONTROLLED_PORT_Q, broadcast_address, 1, interfacePriv->InterfaceTag); - uf_process_rx_pending_queue(priv, UF_CONTROLLED_PORT_Q, broadcast_address, 1, interfacePriv->InterfaceTag); - } - break; - - default: - break; - } - return 0; -} - -static struct notifier_block uf_netdev_notifier = { - .notifier_call = uf_netdev_event, -}; -#endif /* CSR_SUPPORT_WEXT */ - - -static void - process_amsdu(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) -{ - u32 offset; - u32 length = bulkdata->d[0].data_length; - u32 subframe_length, subframe_body_length, dot11_hdr_size; - u8 *ptr; - bulk_data_param_t subframe_bulkdata; - u8 *dot11_hdr_ptr = (u8*)bulkdata->d[0].os_data_ptr; - CsrResult csrResult; - u16 frameControl; - u8 *qos_control_ptr; - - frameControl = le16_to_cpu(*((u16*)dot11_hdr_ptr)); - qos_control_ptr = dot11_hdr_ptr + (((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK))?30: 24); - if(!(*qos_control_ptr & IEEE802_11_QC_A_MSDU_PRESENT)) { - unifi_trace(priv, UDBG6, "%s: calling unifi_rx()", __FUNCTION__); - unifi_rx(priv, signal, bulkdata); - return; - } - *qos_control_ptr &= ~(IEEE802_11_QC_A_MSDU_PRESENT); - - ptr = qos_control_ptr + 2; - offset = dot11_hdr_size = ptr - dot11_hdr_ptr; - - while(length > (offset + sizeof(struct ethhdr) + sizeof(llc_snap_hdr_t))) { - subframe_body_length = ntohs(((struct ethhdr*)ptr)->h_proto); - if(subframe_body_length > IEEE802_11_MAX_DATA_LEN) { - unifi_error(priv, "%s: bad subframe_body_length = %d\n", __FUNCTION__, subframe_body_length); - break; - } - subframe_length = sizeof(struct ethhdr) + subframe_body_length; - memset(&subframe_bulkdata, 0, sizeof(bulk_data_param_t)); - - csrResult = unifi_net_data_malloc(priv, &subframe_bulkdata.d[0], dot11_hdr_size + subframe_body_length); - - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "%s: unifi_net_data_malloc failed\n", __FUNCTION__); - break; - } - - memcpy((u8*)subframe_bulkdata.d[0].os_data_ptr, dot11_hdr_ptr, dot11_hdr_size); - - - /* When to DS=0 and from DS=0, address 3 will already have BSSID so no need to re-program */ - if ((frameControl & IEEE802_11_FC_TO_DS_MASK) && !(frameControl & IEEE802_11_FC_FROM_DS_MASK)){ - memcpy((u8*)subframe_bulkdata.d[0].os_data_ptr + IEEE802_11_ADDR3_OFFSET, ((struct ethhdr*)ptr)->h_dest, ETH_ALEN); - } - else if (!(frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK)){ - memcpy((u8*)subframe_bulkdata.d[0].os_data_ptr + IEEE802_11_ADDR3_OFFSET, - ((struct ethhdr*)ptr)->h_source, - ETH_ALEN); - } - - memcpy((u8*)subframe_bulkdata.d[0].os_data_ptr + dot11_hdr_size, - ptr + sizeof(struct ethhdr), - subframe_body_length); - unifi_trace(priv, UDBG6, "%s: calling unifi_rx. length = %d subframe_length = %d\n", __FUNCTION__, length, subframe_length); - unifi_rx(priv, signal, &subframe_bulkdata); - - subframe_length = (subframe_length + 3)&(~0x3); - ptr += subframe_length; - offset += subframe_length; - } - unifi_net_data_free(priv, &bulkdata->d[0]); -} - - -#define SN_TO_INDEX(__ba_session, __sn) (((__sn - __ba_session->start_sn) & 0xFFF) % __ba_session->wind_size) - - -#define ADVANCE_EXPECTED_SN(__ba_session) \ -{ \ - __ba_session->expected_sn++; \ - __ba_session->expected_sn &= 0xFFF; \ -} - -#define FREE_BUFFER_SLOT(__ba_session, __index) \ -{ \ - __ba_session->occupied_slots--; \ - __ba_session->buffer[__index].active = FALSE; \ - ADVANCE_EXPECTED_SN(__ba_session); \ -} - -static void add_frame_to_ba_complete(unifi_priv_t *priv, - netInterface_priv_t *interfacePriv, - frame_desc_struct *frame_desc) -{ - interfacePriv->ba_complete[interfacePriv->ba_complete_index] = *frame_desc; - interfacePriv->ba_complete_index++; -} - - -static void update_expected_sn(unifi_priv_t *priv, - netInterface_priv_t *interfacePriv, - ba_session_rx_struct *ba_session, - u16 sn) -{ - int i, j; - u16 gap; - - gap = (sn - ba_session->expected_sn) & 0xFFF; - unifi_trace(priv, UDBG6, "%s: process the frames up to new_expected_sn = %d gap = %d\n", __FUNCTION__, sn, gap); - for(j = 0; j < gap && j < ba_session->wind_size; j++) { - i = SN_TO_INDEX(ba_session, ba_session->expected_sn); - unifi_trace(priv, UDBG6, "%s: process the slot index = %d\n", __FUNCTION__, i); - if(ba_session->buffer[i].active) { - add_frame_to_ba_complete(priv, interfacePriv, &ba_session->buffer[i]); - unifi_trace(priv, UDBG6, "%s: process the frame at index = %d expected_sn = %d\n", __FUNCTION__, i, ba_session->expected_sn); - FREE_BUFFER_SLOT(ba_session, i); - } else { - unifi_trace(priv, UDBG6, "%s: empty slot at index = %d\n", __FUNCTION__, i); - ADVANCE_EXPECTED_SN(ba_session); - } - } - ba_session->expected_sn = sn; -} - - -static void complete_ready_sequence(unifi_priv_t *priv, - netInterface_priv_t *interfacePriv, - ba_session_rx_struct *ba_session) -{ - int i; - - i = SN_TO_INDEX(ba_session, ba_session->expected_sn); - while (ba_session->buffer[i].active) { - add_frame_to_ba_complete(priv, interfacePriv, &ba_session->buffer[i]); - unifi_trace(priv, UDBG6, "%s: completed stored frame(expected_sn=%d) at i = %d\n", __FUNCTION__, ba_session->expected_sn, i); - FREE_BUFFER_SLOT(ba_session, i); - i = SN_TO_INDEX(ba_session, ba_session->expected_sn); - } -} - - -void scroll_ba_window(unifi_priv_t *priv, - netInterface_priv_t *interfacePriv, - ba_session_rx_struct *ba_session, - u16 sn) -{ - if(((sn - ba_session->expected_sn) & 0xFFF) <= 2048) { - update_expected_sn(priv, interfacePriv, ba_session, sn); - complete_ready_sequence(priv, interfacePriv, ba_session); - } -} - - -static int consume_frame_or_get_buffer_index(unifi_priv_t *priv, - netInterface_priv_t *interfacePriv, - ba_session_rx_struct *ba_session, - u16 sn, - frame_desc_struct *frame_desc) { - int i; - u16 sn_temp; - - if(((sn - ba_session->expected_sn) & 0xFFF) <= 2048) { - - /* once we are in BA window, set the flag for BA trigger */ - if(!ba_session->trigger_ba_after_ssn){ - ba_session->trigger_ba_after_ssn = TRUE; - } - - sn_temp = ba_session->expected_sn + ba_session->wind_size; - unifi_trace(priv, UDBG6, "%s: new frame: sn=%d\n", __FUNCTION__, sn); - if(!(((sn - sn_temp) & 0xFFF) > 2048)) { - u16 new_expected_sn; - unifi_trace(priv, UDBG6, "%s: frame is out of window\n", __FUNCTION__); - sn_temp = (sn - ba_session->wind_size) & 0xFFF; - new_expected_sn = (sn_temp + 1) & 0xFFF; - update_expected_sn(priv, interfacePriv, ba_session, new_expected_sn); - } - i = -1; - if (sn == ba_session->expected_sn) { - unifi_trace(priv, UDBG6, "%s: sn = ba_session->expected_sn = %d\n", __FUNCTION__, sn); - ADVANCE_EXPECTED_SN(ba_session); - add_frame_to_ba_complete(priv, interfacePriv, frame_desc); - } else { - i = SN_TO_INDEX(ba_session, sn); - unifi_trace(priv, UDBG6, "%s: sn(%d) != ba_session->expected_sn(%d), i = %d\n", __FUNCTION__, sn, ba_session->expected_sn, i); - if (ba_session->buffer[i].active) { - unifi_trace(priv, UDBG6, "%s: free frame at i = %d\n", __FUNCTION__, i); - i = -1; - unifi_net_data_free(priv, &frame_desc->bulkdata.d[0]); - } - } - } else { - i = -1; - if(!ba_session->trigger_ba_after_ssn){ - unifi_trace(priv, UDBG6, "%s: frame before ssn, pass it up: sn=%d\n", __FUNCTION__, sn); - add_frame_to_ba_complete(priv, interfacePriv, frame_desc); - }else{ - unifi_trace(priv, UDBG6, "%s: old frame, drop: sn=%d, expected_sn=%d\n", __FUNCTION__, sn, ba_session->expected_sn); - unifi_net_data_free(priv, &frame_desc->bulkdata.d[0]); - } - } - return i; -} - - - -static void process_ba_frame(unifi_priv_t *priv, - netInterface_priv_t *interfacePriv, - ba_session_rx_struct *ba_session, - frame_desc_struct *frame_desc) -{ - int i; - u16 sn = frame_desc->sn; - - if (ba_session->timeout) { - mod_timer(&ba_session->timer, (jiffies + usecs_to_jiffies((ba_session->timeout) * 1024))); - } - unifi_trace(priv, UDBG6, "%s: got frame(sn=%d)\n", __FUNCTION__, sn); - - i = consume_frame_or_get_buffer_index(priv, interfacePriv, ba_session, sn, frame_desc); - if(i >= 0) { - unifi_trace(priv, UDBG6, "%s: store frame(sn=%d) at i = %d\n", __FUNCTION__, sn, i); - ba_session->buffer[i] = *frame_desc; - ba_session->buffer[i].recv_time = CsrTimeGet(NULL); - ba_session->occupied_slots++; - } else { - unifi_trace(priv, UDBG6, "%s: frame consumed - sn = %d\n", __FUNCTION__, sn); - } - complete_ready_sequence(priv, interfacePriv, ba_session); -} - - -static void process_ba_complete(unifi_priv_t *priv, netInterface_priv_t *interfacePriv) -{ - frame_desc_struct *frame_desc; - u8 i; - - for(i = 0; i < interfacePriv->ba_complete_index; i++) { - frame_desc = &interfacePriv->ba_complete[i]; - unifi_trace(priv, UDBG6, "%s: calling process_amsdu()\n", __FUNCTION__); - process_amsdu(priv, &frame_desc->signal, &frame_desc->bulkdata); - } - interfacePriv->ba_complete_index = 0; - -} - - -/* Check if the frames in BA reoder buffer has aged and - * if so release the frames to upper processes and move - * the window - */ -static void check_ba_frame_age_timeout( unifi_priv_t *priv, - netInterface_priv_t *interfacePriv, - ba_session_rx_struct *ba_session) -{ - u32 now; - u32 age; - u8 i, j; - u16 sn_temp; - - /* gap is started at 1 because we have buffered frames and - * hence a minimum gap of 1 exists - */ - u8 gap=1; - - now = CsrTimeGet(NULL); - - if (ba_session->occupied_slots) - { - /* expected sequence has not arrived so start searching from next - * sequence number until a frame is available and determine the gap. - * Check if the frame available has timedout, if so advance the - * expected sequence number and release the frames - */ - sn_temp = (ba_session->expected_sn + 1) & 0xFFF; - - for(j = 0; j < ba_session->wind_size; j++) - { - i = SN_TO_INDEX(ba_session, sn_temp); - - if(ba_session->buffer[i].active) - { - unifi_trace(priv, UDBG6, "check age at slot index = %d sn = %d recv_time = %u now = %u\n", - i, - ba_session->buffer[i].sn, - ba_session->buffer[i].recv_time, - now); - - if (ba_session->buffer[i].recv_time > now) - { - /* timer wrap */ - age = CsrTimeAdd((u32)CsrTimeSub(CSR_SCHED_TIME_MAX, ba_session->buffer[i].recv_time), now); - } - else - { - age = (u32)CsrTimeSub(now, ba_session->buffer[i].recv_time); - } - - if (age >= CSR_WIFI_BA_MPDU_FRAME_AGE_TIMEOUT) - { - unifi_trace(priv, UDBG2, "release the frame at index = %d gap = %d expected_sn = %d sn = %d\n", - i, - gap, - ba_session->expected_sn, - ba_session->buffer[i].sn); - - /* if it has timedout don't wait for missing frames, move the window */ - while (gap--) - { - ADVANCE_EXPECTED_SN(ba_session); - } - add_frame_to_ba_complete(priv, interfacePriv, &ba_session->buffer[i]); - FREE_BUFFER_SLOT(ba_session, i); - complete_ready_sequence(priv, interfacePriv, ba_session); - } - break; - - } - else - { - /* advance temp sequence number and frame gap */ - sn_temp = (sn_temp + 1) & 0xFFF; - gap++; - } - } - } -} - - -static void process_ma_packet_error_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata) -{ - u16 interfaceTag; - const CSR_MA_PACKET_ERROR_INDICATION *pkt_err_ind = &signal->u.MaPacketErrorIndication; - netInterface_priv_t *interfacePriv; - ba_session_rx_struct *ba_session; - u8 ba_session_idx = 0; - CSR_PRIORITY UserPriority; - CSR_SEQUENCE_NUMBER sn; - - interfaceTag = (pkt_err_ind->VirtualInterfaceIdentifier & 0xff); - - - /* Sanity check that the VIF refers to a sensible interface */ - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) - { - unifi_error(priv, "%s: MaPacketErrorIndication indication with bad interfaceTag %d\n", __FUNCTION__, interfaceTag); - return; - } - - interfacePriv = priv->interfacePriv[interfaceTag]; - UserPriority = pkt_err_ind->UserPriority; - if(UserPriority > 15) { - unifi_error(priv, "%s: MaPacketErrorIndication indication with bad UserPriority=%d\n", __FUNCTION__, UserPriority); - } - sn = pkt_err_ind->SequenceNumber; - - down(&priv->ba_mutex); - /* To find the right ba_session loop through the BA sessions, compare MAC address and tID */ - for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ - ba_session = interfacePriv->ba_session_rx[ba_session_idx]; - if (ba_session){ - if ((!memcmp(ba_session->macAddress.a, pkt_err_ind->PeerQstaAddress.x, ETH_ALEN)) && (ba_session->tID == UserPriority)){ - if (ba_session->timeout) { - mod_timer(&ba_session->timer, (jiffies + usecs_to_jiffies((ba_session->timeout) * 1024))); - } - scroll_ba_window(priv, interfacePriv, ba_session, sn); - break; - } - } - } - - up(&priv->ba_mutex); - process_ba_complete(priv, interfacePriv); -} - - diff --git a/drivers/staging/csr/os.c b/drivers/staging/csr/os.c deleted file mode 100644 index 37ec59df3581..000000000000 --- a/drivers/staging/csr/os.c +++ /dev/null @@ -1,477 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: os.c - * - * PURPOSE: - * Routines to fulfil the OS-abstraction for the HIP lib. - * It is part of the porting exercise. - * - * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ - -/** - * The HIP lib OS abstraction consists of the implementation - * of the functions in this file. It is part of the porting exercise. - */ - -#include "unifi_priv.h" - - -/* - * --------------------------------------------------------------------------- - * unifi_net_data_malloc - * - * Allocate an OS specific net data buffer of "size" bytes. - * The bulk_data_slot.os_data_ptr must be initialised to point - * to the buffer allocated. The bulk_data_slot.length must be - * initialised to the requested size, zero otherwise. - * The bulk_data_slot.os_net_buf_ptr can be initialised to - * an OS specific pointer to be used in the unifi_net_data_free(). - * - * - * Arguments: - * ospriv Pointer to device private context struct. - * bulk_data_slot Pointer to the bulk data structure to initialise. - * size Size of the buffer to be allocated. - * - * Returns: - * CSR_RESULT_SUCCESS on success, CSR_RESULT_FAILURE otherwise. - * --------------------------------------------------------------------------- - */ -CsrResult -unifi_net_data_malloc(void *ospriv, bulk_data_desc_t *bulk_data_slot, unsigned int size) -{ - struct sk_buff *skb; - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - int rounded_length; - - if (priv->card_info.sdio_block_size == 0) { - unifi_error(priv, "unifi_net_data_malloc: Invalid SDIO block size\n"); - return CSR_RESULT_FAILURE; - } - - rounded_length = (size + priv->card_info.sdio_block_size - 1) & ~(priv->card_info.sdio_block_size - 1); - - /* - * (ETH_HLEN + 2) bytes tailroom for header manipulation - * CSR_WIFI_ALIGN_BYTES bytes headroom for alignment manipulation - */ - skb = dev_alloc_skb(rounded_length + 2 + ETH_HLEN + CSR_WIFI_ALIGN_BYTES); - if (! skb) { - unifi_error(ospriv, "alloc_skb failed.\n"); - bulk_data_slot->os_net_buf_ptr = NULL; - bulk_data_slot->net_buf_length = 0; - bulk_data_slot->os_data_ptr = NULL; - bulk_data_slot->data_length = 0; - return CSR_RESULT_FAILURE; - } - - bulk_data_slot->os_net_buf_ptr = (const unsigned char*)skb; - bulk_data_slot->net_buf_length = rounded_length + 2 + ETH_HLEN + CSR_WIFI_ALIGN_BYTES; - bulk_data_slot->os_data_ptr = (const void*)skb->data; - bulk_data_slot->data_length = size; - - return CSR_RESULT_SUCCESS; -} /* unifi_net_data_malloc() */ - -/* - * --------------------------------------------------------------------------- - * unifi_net_data_free - * - * Free an OS specific net data buffer. - * The bulk_data_slot.length must be initialised to 0. - * - * - * Arguments: - * ospriv Pointer to device private context struct. - * bulk_data_slot Pointer to the bulk data structure that - * holds the data to be freed. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -unifi_net_data_free(void *ospriv, bulk_data_desc_t *bulk_data_slot) -{ - struct sk_buff *skb; - CSR_UNUSED(ospriv); - - skb = (struct sk_buff *)bulk_data_slot->os_net_buf_ptr; - dev_kfree_skb(skb); - - bulk_data_slot->net_buf_length = 0; - bulk_data_slot->data_length = 0; - bulk_data_slot->os_data_ptr = bulk_data_slot->os_net_buf_ptr = NULL; - -} /* unifi_net_data_free() */ - - -/* -* --------------------------------------------------------------------------- -* unifi_net_dma_align -* -* DMA align an OS specific net data buffer. -* The buffer must be empty. -* -* -* Arguments: -* ospriv Pointer to device private context struct. -* bulk_data_slot Pointer to the bulk data structure that -* holds the data to be aligned. -* -* Returns: -* None. -* --------------------------------------------------------------------------- -*/ -CsrResult -unifi_net_dma_align(void *ospriv, bulk_data_desc_t *bulk_data_slot) -{ - struct sk_buff *skb; - unsigned long buf_address; - int offset; - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - - if ((bulk_data_slot == NULL) || (CSR_WIFI_ALIGN_BYTES == 0)) { - return CSR_RESULT_SUCCESS; - } - - if ((bulk_data_slot->os_data_ptr == NULL) || (bulk_data_slot->data_length == 0)) { - return CSR_RESULT_SUCCESS; - } - - buf_address = (unsigned long)(bulk_data_slot->os_data_ptr) & (CSR_WIFI_ALIGN_BYTES - 1); - - unifi_trace(priv, UDBG5, - "unifi_net_dma_align: Allign buffer (0x%p) by %d bytes\n", - bulk_data_slot->os_data_ptr, buf_address); - - offset = CSR_WIFI_ALIGN_BYTES - buf_address; - if (offset < 0) { - unifi_error(priv, "unifi_net_dma_align: Failed (offset=%d)\n", offset); - return CSR_RESULT_FAILURE; - } - - skb = (struct sk_buff*)(bulk_data_slot->os_net_buf_ptr); - skb_reserve(skb, offset); - bulk_data_slot->os_net_buf_ptr = (const unsigned char*)skb; - bulk_data_slot->os_data_ptr = (const void*)(skb->data); - - return CSR_RESULT_SUCCESS; - -} /* unifi_net_dma_align() */ - -#ifdef ANDROID_TIMESTAMP -static volatile unsigned int printk_cpu = UINT_MAX; -char tbuf[30]; - -char* print_time(void ) -{ - unsigned long long t; - unsigned long nanosec_rem; - - t = cpu_clock(printk_cpu); - nanosec_rem = do_div(t, 1000000000); - sprintf(tbuf, "[%5lu.%06lu] ", - (unsigned long) t, - nanosec_rem / 1000); - - return tbuf; -} -#endif - - -/* Module parameters */ -extern int unifi_debug; - -#ifdef UNIFI_DEBUG -#define DEBUG_BUFFER_SIZE 120 - -#define FORMAT_TRACE(_s, _len, _args, _fmt) \ - do { \ - va_start(_args, _fmt); \ - _len += vsnprintf(&(_s)[_len], \ - (DEBUG_BUFFER_SIZE - _len), \ - _fmt, _args); \ - va_end(_args); \ - if (_len >= DEBUG_BUFFER_SIZE) { \ - (_s)[DEBUG_BUFFER_SIZE - 2] = '\n'; \ - (_s)[DEBUG_BUFFER_SIZE - 1] = 0; \ - } \ - } while (0) - -void -unifi_error(void* ospriv, const char *fmt, ...) -{ - unifi_priv_t *priv = (unifi_priv_t*) ospriv; - char s[DEBUG_BUFFER_SIZE]; - va_list args; - unsigned int len; -#ifdef ANDROID_TIMESTAMP - if (priv != NULL) { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "%s unifi%d: ", print_time(), priv->instance); - } else { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "%s unifi: ", print_time()); - } -#else - if (priv != NULL) { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "unifi%d: ", priv->instance); - } else { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "unifi: "); - } -#endif /* ANDROID_TIMESTAMP */ - FORMAT_TRACE(s, len, args, fmt); - - printk("%s", s); -} - -void -unifi_warning(void* ospriv, const char *fmt, ...) -{ - unifi_priv_t *priv = (unifi_priv_t*) ospriv; - char s[DEBUG_BUFFER_SIZE]; - va_list args; - unsigned int len; - -#ifdef ANDROID_TIMESTAMP - if (priv != NULL) { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_WARNING "%s unifi%d: ", print_time(), priv->instance); - } else { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_WARNING "%s unifi: ", print_time()); - } -#else - if (priv != NULL) { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_WARNING "unifi%d: ", priv->instance); - } else { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_WARNING "unifi: "); - } -#endif /* ANDROID_TIMESTAMP */ - - FORMAT_TRACE(s, len, args, fmt); - - printk("%s", s); -} - - -void -unifi_notice(void* ospriv, const char *fmt, ...) -{ - unifi_priv_t *priv = (unifi_priv_t*) ospriv; - char s[DEBUG_BUFFER_SIZE]; - va_list args; - unsigned int len; - -#ifdef ANDROID_TIMESTAMP - if (priv != NULL) { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_NOTICE "%s unifi%d: ", print_time(), priv->instance); - } else { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_NOTICE "%s unifi: ", print_time()); - } -#else - if (priv != NULL) { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_NOTICE "unifi%d: ", priv->instance); - } else { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_NOTICE "unifi: "); - } -#endif /* ANDROID_TIMESTAMP */ - - FORMAT_TRACE(s, len, args, fmt); - - printk("%s", s); -} - - -void -unifi_info(void* ospriv, const char *fmt, ...) -{ - unifi_priv_t *priv = (unifi_priv_t*) ospriv; - char s[DEBUG_BUFFER_SIZE]; - va_list args; - unsigned int len; - -#ifdef ANDROID_TIMESTAMP - if (priv != NULL) { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_INFO "%s unifi%d: ", print_time(), priv->instance); - } else { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_INFO "%s unifi: ", print_time()); - } -#else - if (priv != NULL) { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_INFO "unifi%d: ", priv->instance); - } else { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_INFO "unifi: "); - } -#endif /* ANDROID_TIMESTAMP */ - - FORMAT_TRACE(s, len, args, fmt); - - printk("%s", s); -} - -/* debugging */ -void -unifi_trace(void* ospriv, int level, const char *fmt, ...) -{ - unifi_priv_t *priv = (unifi_priv_t*) ospriv; - char s[DEBUG_BUFFER_SIZE]; - va_list args; - unsigned int len; - - if (unifi_debug >= level) { -#ifdef ANDROID_TIMESTAMP - if (priv != NULL) { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "%s unifi%d: ", print_time(), priv->instance); - } else { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "%s unifi: ", print_time()); - } -#else - if (priv != NULL) { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "unifi%d: ", priv->instance); - } else { - len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "unifi: "); - } -#endif /* ANDROID_TIMESTAMP */ - - FORMAT_TRACE(s, len, args, fmt); - - printk("%s", s); - } -} - -#else - -void -unifi_error_nop(void* ospriv, const char *fmt, ...) -{ -} - -void -unifi_trace_nop(void* ospriv, int level, const char *fmt, ...) -{ -} - -#endif /* UNIFI_DEBUG */ - - -/* - * --------------------------------------------------------------------------- - * - * Debugging support. - * - * --------------------------------------------------------------------------- - */ - -#ifdef UNIFI_DEBUG - -/* Memory dump with level filter controlled by unifi_debug */ -void -unifi_dump(void *ospriv, int level, const char *msg, void *mem, u16 len) -{ - unifi_priv_t *priv = (unifi_priv_t*) ospriv; - - if (unifi_debug >= level) { -#ifdef ANDROID_TIMESTAMP - if (priv != NULL) { - printk(KERN_ERR "%s unifi%d: --- dump: %s ---\n", print_time(), priv->instance, msg ? msg : ""); - } else { - printk(KERN_ERR "%s unifi: --- dump: %s ---\n", print_time(), msg ? msg : ""); - } -#else - if (priv != NULL) { - printk(KERN_ERR "unifi%d: --- dump: %s ---\n", priv->instance, msg ? msg : ""); - } else { - printk(KERN_ERR "unifi: --- dump: %s ---\n", msg ? msg : ""); - } -#endif /* ANDROID_TIMESTAMP */ - dump(mem, len); - - if (priv != NULL) { - printk(KERN_ERR "unifi%d: --- end of dump ---\n", priv->instance); - } else { - printk(KERN_ERR "unifi: --- end of dump ---\n"); - } - } -} - -/* Memory dump that appears all the time, use sparingly */ -void -dump(void *mem, u16 len) -{ - int i, col = 0; - unsigned char *pdata = (unsigned char *)mem; -#ifdef ANDROID_TIMESTAMP - printk("timestamp %s \n", print_time()); -#endif /* ANDROID_TIMESTAMP */ - if (mem == NULL) { - printk("(null dump)\n"); - return; - } - for (i = 0; i < len; i++) { - if (col == 0) - printk("0x%02X: ", i); - - printk(" %02X", pdata[i]); - - if (++col == 16) { - printk("\n"); - col = 0; - } - } - if (col) - printk("\n"); -} /* dump() */ - - -void -dump16(void *mem, u16 len) -{ - int i, col=0; - unsigned short *p = (unsigned short *)mem; -#ifdef ANDROID_TIMESTAMP - printk("timestamp %s \n", print_time()); -#endif /* ANDROID_TIMESTAMP */ - for (i = 0; i < len; i+=2) { - if (col == 0) - printk("0x%02X: ", i); - - printk(" %04X", *p++); - - if (++col == 8) { - printk("\n"); - col = 0; - } - } - if (col) - printk("\n"); -} - - -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -void -dump_str(void *mem, u16 len) -{ - int i; - unsigned char *pdata = (unsigned char *)mem; -#ifdef ANDROID_TIMESTAMP - printk("timestamp %s \n", print_time()); -#endif /* ANDROID_TIMESTAMP */ - for (i = 0; i < len; i++) { - printk("%c", pdata[i]); - } - printk("\n"); - -} /* dump_str() */ -#endif /* CSR_ONLY_NOTES */ - - -#endif /* UNIFI_DEBUG */ - - -/* --------------------------------------------------------------------------- - * - End - - * ------------------------------------------------------------------------- */ diff --git a/drivers/staging/csr/putest.c b/drivers/staging/csr/putest.c deleted file mode 100644 index 5613cf0e16b0..000000000000 --- a/drivers/staging/csr/putest.c +++ /dev/null @@ -1,685 +0,0 @@ -/* - * *************************************************************************** - * FILE: putest.c - * - * PURPOSE: putest related functions. - * - * Copyright (C) 2008-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * *************************************************************************** - */ - -#include <linux/vmalloc.h> -#include <linux/firmware.h> - -#include "unifi_priv.h" -#include "csr_wifi_hip_chiphelper.h" - -#define UNIFI_PROC_BOTH 3 - - -int unifi_putest_cmd52_read(unifi_priv_t *priv, unsigned char *arg) -{ - struct unifi_putest_cmd52 cmd52_params; - u8 *arg_pos; - unsigned int cmd_param_size; - int r; - CsrResult csrResult; - unsigned char ret_buffer[32]; - u8 *ret_buffer_pos; - u8 retries; - - arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1); - if (get_user(cmd_param_size, (int*)arg_pos)) { - unifi_error(priv, - "unifi_putest_cmd52_read: Failed to get the argument\n"); - return -EFAULT; - } - - if (cmd_param_size != sizeof(struct unifi_putest_cmd52)) { - unifi_error(priv, - "unifi_putest_cmd52_read: cmd52 struct mismatch\n"); - return -EINVAL; - } - - arg_pos += sizeof(unsigned int); - if (copy_from_user(&cmd52_params, - (void*)arg_pos, - sizeof(struct unifi_putest_cmd52))) { - unifi_error(priv, - "unifi_putest_cmd52_read: Failed to get the cmd52 params\n"); - return -EFAULT; - } - - unifi_trace(priv, UDBG2, "cmd52r: func=%d addr=0x%x ", - cmd52_params.funcnum, cmd52_params.addr); - - retries = 3; - CsrSdioClaim(priv->sdio); - do { - if (cmd52_params.funcnum == 0) { - csrResult = CsrSdioF0Read8(priv->sdio, cmd52_params.addr, &cmd52_params.data); - } else { - csrResult = CsrSdioRead8(priv->sdio, cmd52_params.addr, &cmd52_params.data); - } - } while (--retries && ((csrResult == CSR_SDIO_RESULT_CRC_ERROR) || (csrResult == CSR_SDIO_RESULT_TIMEOUT))); - CsrSdioRelease(priv->sdio); - - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, - "\nunifi_putest_cmd52_read: Read8() failed (csrResult=0x%x)\n", csrResult); - return -EFAULT; - } - unifi_trace(priv, UDBG2, "data=%d\n", cmd52_params.data); - - /* Copy the info to the out buffer */ - *(unifi_putest_command_t*)ret_buffer = UNIFI_PUTEST_CMD52_READ; - ret_buffer_pos = (u8*)(((unifi_putest_command_t*)ret_buffer) + 1); - *(unsigned int*)ret_buffer_pos = sizeof(struct unifi_putest_cmd52); - ret_buffer_pos += sizeof(unsigned int); - memcpy(ret_buffer_pos, &cmd52_params, sizeof(struct unifi_putest_cmd52)); - ret_buffer_pos += sizeof(struct unifi_putest_cmd52); - - r = copy_to_user((void*)arg, - ret_buffer, - ret_buffer_pos - ret_buffer); - if (r) { - unifi_error(priv, - "unifi_putest_cmd52_read: Failed to return the data\n"); - return -EFAULT; - } - - return 0; -} - - -int unifi_putest_cmd52_write(unifi_priv_t *priv, unsigned char *arg) -{ - struct unifi_putest_cmd52 cmd52_params; - u8 *arg_pos; - unsigned int cmd_param_size; - CsrResult csrResult; - u8 retries; - - arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1); - if (get_user(cmd_param_size, (int*)arg_pos)) { - unifi_error(priv, - "unifi_putest_cmd52_write: Failed to get the argument\n"); - return -EFAULT; - } - - if (cmd_param_size != sizeof(struct unifi_putest_cmd52)) { - unifi_error(priv, - "unifi_putest_cmd52_write: cmd52 struct mismatch\n"); - return -EINVAL; - } - - arg_pos += sizeof(unsigned int); - if (copy_from_user(&cmd52_params, - (void*)(arg_pos), - sizeof(struct unifi_putest_cmd52))) { - unifi_error(priv, - "unifi_putest_cmd52_write: Failed to get the cmd52 params\n"); - return -EFAULT; - } - - unifi_trace(priv, UDBG2, "cmd52w: func=%d addr=0x%x data=%d\n", - cmd52_params.funcnum, cmd52_params.addr, cmd52_params.data); - - retries = 3; - CsrSdioClaim(priv->sdio); - do { - if (cmd52_params.funcnum == 0) { - csrResult = CsrSdioF0Write8(priv->sdio, cmd52_params.addr, cmd52_params.data); - } else { - csrResult = CsrSdioWrite8(priv->sdio, cmd52_params.addr, cmd52_params.data); - } - } while (--retries && ((csrResult == CSR_SDIO_RESULT_CRC_ERROR) || (csrResult == CSR_SDIO_RESULT_TIMEOUT))); - CsrSdioRelease(priv->sdio); - - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, - "unifi_putest_cmd52_write: Write8() failed (csrResult=0x%x)\n", csrResult); - return -EFAULT; - } - - return 0; -} - -int unifi_putest_gp_read16(unifi_priv_t *priv, unsigned char *arg) -{ - struct unifi_putest_gp_rw16 gp_r16_params; - u8 *arg_pos; - unsigned int cmd_param_size; - int r; - CsrResult csrResult; - unsigned char ret_buffer[32]; - u8 *ret_buffer_pos; - - arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1); - if (get_user(cmd_param_size, (int*)arg_pos)) { - unifi_error(priv, - "unifi_putest_gp_read16: Failed to get the argument\n"); - return -EFAULT; - } - - if (cmd_param_size != sizeof(struct unifi_putest_gp_rw16)) { - unifi_error(priv, - "unifi_putest_gp_read16: struct mismatch\n"); - return -EINVAL; - } - - arg_pos += sizeof(unsigned int); - if (copy_from_user(&gp_r16_params, - (void*)arg_pos, - sizeof(struct unifi_putest_gp_rw16))) { - unifi_error(priv, - "unifi_putest_gp_read16: Failed to get the params\n"); - return -EFAULT; - } - CsrSdioClaim(priv->sdio); - csrResult = unifi_card_read16(priv->card, gp_r16_params.addr, &gp_r16_params.data); - CsrSdioRelease(priv->sdio); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, - "unifi_putest_gp_read16: unifi_card_read16() GP=0x%x failed (csrResult=0x%x)\n", gp_r16_params.addr, csrResult); - return -EFAULT; - } - - unifi_trace(priv, UDBG2, "gp_r16: GP=0x%08x, data=0x%04x\n", gp_r16_params.addr, gp_r16_params.data); - - /* Copy the info to the out buffer */ - *(unifi_putest_command_t*)ret_buffer = UNIFI_PUTEST_GP_READ16; - ret_buffer_pos = (u8*)(((unifi_putest_command_t*)ret_buffer) + 1); - *(unsigned int*)ret_buffer_pos = sizeof(struct unifi_putest_gp_rw16); - ret_buffer_pos += sizeof(unsigned int); - memcpy(ret_buffer_pos, &gp_r16_params, sizeof(struct unifi_putest_gp_rw16)); - ret_buffer_pos += sizeof(struct unifi_putest_gp_rw16); - - r = copy_to_user((void*)arg, - ret_buffer, - ret_buffer_pos - ret_buffer); - if (r) { - unifi_error(priv, - "unifi_putest_gp_read16: Failed to return the data\n"); - return -EFAULT; - } - - return 0; -} - -int unifi_putest_gp_write16(unifi_priv_t *priv, unsigned char *arg) -{ - struct unifi_putest_gp_rw16 gp_w16_params; - u8 *arg_pos; - unsigned int cmd_param_size; - CsrResult csrResult; - - arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1); - if (get_user(cmd_param_size, (int*)arg_pos)) { - unifi_error(priv, - "unifi_putest_gp_write16: Failed to get the argument\n"); - return -EFAULT; - } - - if (cmd_param_size != sizeof(struct unifi_putest_gp_rw16)) { - unifi_error(priv, - "unifi_putest_gp_write16: struct mismatch\n"); - return -EINVAL; - } - - arg_pos += sizeof(unsigned int); - if (copy_from_user(&gp_w16_params, - (void*)(arg_pos), - sizeof(struct unifi_putest_gp_rw16))) { - unifi_error(priv, - "unifi_putest_gp_write16: Failed to get the params\n"); - return -EFAULT; - } - - unifi_trace(priv, UDBG2, "gp_w16: GP=0x%08x, data=0x%04x\n", gp_w16_params.addr, gp_w16_params.data); - CsrSdioClaim(priv->sdio); - csrResult = unifi_card_write16(priv->card, gp_w16_params.addr, gp_w16_params.data); - CsrSdioRelease(priv->sdio); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, - "unifi_putest_gp_write16: unifi_card_write16() GP=%x failed (csrResult=0x%x)\n", gp_w16_params.addr, csrResult); - return -EFAULT; - } - - return 0; -} - -int unifi_putest_set_sdio_clock(unifi_priv_t *priv, unsigned char *arg) -{ - int sdio_clock_speed; - CsrResult csrResult; - - if (get_user(sdio_clock_speed, (int*)(((unifi_putest_command_t*)arg) + 1))) { - unifi_error(priv, - "unifi_putest_set_sdio_clock: Failed to get the argument\n"); - return -EFAULT; - } - - unifi_trace(priv, UDBG2, "set sdio clock: %d KHz\n", sdio_clock_speed); - - CsrSdioClaim(priv->sdio); - csrResult = CsrSdioMaxBusClockFrequencySet(priv->sdio, sdio_clock_speed * 1000); - CsrSdioRelease(priv->sdio); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, - "unifi_putest_set_sdio_clock: Set clock failed (csrResult=0x%x)\n", csrResult); - return -EFAULT; - } - - return 0; -} - - -int unifi_putest_start(unifi_priv_t *priv, unsigned char *arg) -{ - int r; - CsrResult csrResult; - int already_in_test = priv->ptest_mode; - - /* Ensure that sme_sys_suspend() doesn't power down the chip because: - * 1) Power is needed anyway for ptest. - * 2) The app code uses the START ioctl as a reset, so it gets called - * multiple times. If the app stops the XAPs, but the power_down/up - * sequence doesn't actually power down the chip, there can be problems - * resetting, because part of the power_up sequence disables function 1 - */ - priv->ptest_mode = 1; - - /* Suspend the SME and UniFi */ - if (priv->sme_cli) { - r = sme_sys_suspend(priv); - if (r) { - unifi_error(priv, - "unifi_putest_start: failed to suspend UniFi\n"); - return r; - } - } - - /* Application may have stopped the XAPs, but they are needed for reset */ - if (already_in_test) { - CsrSdioClaim(priv->sdio); - csrResult = unifi_start_processors(priv->card); - CsrSdioRelease(priv->sdio); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "Failed to start XAPs. Hard reset required.\n"); - } - } else { - /* Ensure chip is powered for the case where there's no unifi_helper */ - CsrSdioClaim(priv->sdio); - csrResult = CsrSdioPowerOn(priv->sdio); - CsrSdioRelease(priv->sdio); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "CsrSdioPowerOn csrResult = %d\n", csrResult); - } - } - CsrSdioClaim(priv->sdio); - csrResult = unifi_init(priv->card); - CsrSdioRelease(priv->sdio); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, - "unifi_putest_start: failed to init UniFi\n"); - return CsrHipResultToStatus(csrResult); - } - - return 0; -} - - -int unifi_putest_stop(unifi_priv_t *priv, unsigned char *arg) -{ - int r = 0; - CsrResult csrResult; - - /* Application may have stopped the XAPs, but they are needed for reset */ - CsrSdioClaim(priv->sdio); - csrResult = unifi_start_processors(priv->card); - CsrSdioRelease(priv->sdio); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "Failed to start XAPs. Hard reset required.\n"); - } - - /* PUTEST_STOP is also used to resume the XAPs after SME coredump. - * Don't power off the chip, leave that to the normal wifi-off which is - * about to carry on. No need to resume the SME either, as it wasn't suspended. - */ - if (priv->coredump_mode) { - priv->coredump_mode = 0; - return 0; - } - - /* At this point function 1 is enabled and the XAPs are running, so it is - * safe to let the card power down. Power is restored later, asynchronously, - * during the wifi_on requested by the SME. - */ - CsrSdioClaim(priv->sdio); - CsrSdioPowerOff(priv->sdio); - CsrSdioRelease(priv->sdio); - - /* Resume the SME and UniFi */ - if (priv->sme_cli) { - r = sme_sys_resume(priv); - if (r) { - unifi_error(priv, - "unifi_putest_stop: failed to resume SME\n"); - } - } - priv->ptest_mode = 0; - - return r; -} - - -int unifi_putest_dl_fw(unifi_priv_t *priv, unsigned char *arg) -{ -#define UF_PUTEST_MAX_FW_FILE_NAME 16 -#define UNIFI_MAX_FW_PATH_LEN 32 - unsigned int fw_name_length; - unsigned char fw_name[UF_PUTEST_MAX_FW_FILE_NAME+1]; - unsigned char *name_buffer; - int postfix; - char fw_path[UNIFI_MAX_FW_PATH_LEN]; - const struct firmware *fw_entry; - struct dlpriv temp_fw_sta; - int r; - CsrResult csrResult; - - /* Get the f/w file name length */ - if (get_user(fw_name_length, (unsigned int*)(((unifi_putest_command_t*)arg) + 1))) { - unifi_error(priv, - "unifi_putest_dl_fw: Failed to get the length argument\n"); - return -EFAULT; - } - - unifi_trace(priv, UDBG2, "unifi_putest_dl_fw: file name size = %d\n", fw_name_length); - - /* Sanity check for the f/w file name length */ - if (fw_name_length > UF_PUTEST_MAX_FW_FILE_NAME) { - unifi_error(priv, - "unifi_putest_dl_fw: F/W file name is too long\n"); - return -EINVAL; - } - - /* Get the f/w file name */ - name_buffer = ((unsigned char*)arg) + sizeof(unifi_putest_command_t) + sizeof(unsigned int); - if (copy_from_user(fw_name, (void*)name_buffer, fw_name_length)) { - unifi_error(priv, "unifi_putest_dl_fw: Failed to get the file name\n"); - return -EFAULT; - } - fw_name[fw_name_length] = '\0'; - unifi_trace(priv, UDBG2, "unifi_putest_dl_fw: file = %s\n", fw_name); - - /* Keep the existing f/w to a temp, we need to restore it later */ - temp_fw_sta = priv->fw_sta; - - /* Get the putest f/w */ - postfix = priv->instance; - scnprintf(fw_path, UNIFI_MAX_FW_PATH_LEN, "unifi-sdio-%d/%s", - postfix, fw_name); - r = request_firmware(&fw_entry, fw_path, priv->unifi_device); - if (r == 0) { - priv->fw_sta.fw_desc = (void *)fw_entry; - priv->fw_sta.dl_data = fw_entry->data; - priv->fw_sta.dl_len = fw_entry->size; - } else { - unifi_error(priv, "Firmware file not available\n"); - return -EINVAL; - } - - /* Application may have stopped the XAPs, but they are needed for reset */ - CsrSdioClaim(priv->sdio); - csrResult = unifi_start_processors(priv->card); - CsrSdioRelease(priv->sdio); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "Failed to start XAPs. Hard reset required.\n"); - } - - /* Download the f/w. On UF6xxx this will cause the f/w file to convert - * into patch format and download via the ROM boot loader - */ - CsrSdioClaim(priv->sdio); - csrResult = unifi_download(priv->card, 0x0c00); - CsrSdioRelease(priv->sdio); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, - "unifi_putest_dl_fw: failed to download the f/w\n"); - goto free_fw; - } - - /* Free the putest f/w... */ -free_fw: - uf_release_firmware(priv, &priv->fw_sta); - /* ... and restore the original f/w */ - priv->fw_sta = temp_fw_sta; - - return CsrHipResultToStatus(csrResult); -} - - -int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg) -{ - unsigned int fw_length; - unsigned char *fw_buf = NULL; - unsigned char *fw_user_ptr; - struct dlpriv temp_fw_sta; - CsrResult csrResult; - - /* Get the f/w buffer length */ - if (get_user(fw_length, (unsigned int*)(((unifi_putest_command_t*)arg) + 1))) { - unifi_error(priv, - "unifi_putest_dl_fw_buff: Failed to get the length arg\n"); - return -EFAULT; - } - - unifi_trace(priv, UDBG2, "unifi_putest_dl_fw_buff: size = %d\n", fw_length); - - /* Sanity check for the buffer length */ - if (fw_length == 0 || fw_length > 0xfffffff) { - unifi_error(priv, - "unifi_putest_dl_fw_buff: buffer length bad %u\n", fw_length); - return -EINVAL; - } - - /* Buffer for kernel copy of the f/w image */ - fw_buf = kmalloc(fw_length, GFP_KERNEL); - if (!fw_buf) { - unifi_error(priv, "unifi_putest_dl_fw_buff: malloc fail\n"); - return -ENOMEM; - } - - /* Get the f/w image */ - fw_user_ptr = ((unsigned char*)arg) + sizeof(unifi_putest_command_t) + sizeof(unsigned int); - if (copy_from_user(fw_buf, (void*)fw_user_ptr, fw_length)) { - unifi_error(priv, "unifi_putest_dl_fw_buff: Failed to get the buffer\n"); - kfree(fw_buf); - return -EFAULT; - } - - /* Save the existing f/w to a temp, we need to restore it later */ - temp_fw_sta = priv->fw_sta; - - /* Setting fw_desc NULL indicates to the core that no f/w file was loaded - * via the kernel request_firmware() mechanism. This indicates to the core - * that it shouldn't call release_firmware() after the download is done. - */ - priv->fw_sta.fw_desc = NULL; /* No OS f/w resource */ - priv->fw_sta.dl_data = fw_buf; - priv->fw_sta.dl_len = fw_length; - - /* Application may have stopped the XAPs, but they are needed for reset */ - CsrSdioClaim(priv->sdio); - csrResult = unifi_start_processors(priv->card); - CsrSdioRelease(priv->sdio); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "Failed to start XAPs. Hard reset required.\n"); - } - - /* Download the f/w. On UF6xxx this will cause the f/w file to convert - * into patch format and download via the ROM boot loader - */ - CsrSdioClaim(priv->sdio); - csrResult = unifi_download(priv->card, 0x0c00); - CsrSdioRelease(priv->sdio); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, - "unifi_putest_dl_fw_buff: failed to download the f/w\n"); - goto free_fw; - } - -free_fw: - /* Finished with the putest f/w, so restore the station f/w */ - priv->fw_sta = temp_fw_sta; - kfree(fw_buf); - - return CsrHipResultToStatus(csrResult); -} - - -int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg) -{ - u16 data_u16; - s32 i; - CsrResult r; - - unifi_info(priv, "Preparing for SDIO coredump\n"); -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) - unifi_debug_buf_dump(); -#endif - - /* Sanity check that userspace hasn't called a PUTEST_START, because that - * would have reset UniFi, potentially power cycling it and losing context - */ - if (priv->ptest_mode) { - unifi_error(priv, "PUTEST_START shouldn't be used before a coredump\n"); - } - - /* Flag that the userspace has requested coredump. Even if this preparation - * fails, the SME will call PUTEST_STOP to tidy up. - */ - priv->coredump_mode = 1; - - for (i = 0; i < 3; i++) { - CsrSdioClaim(priv->sdio); - r = CsrSdioRead16(priv->sdio, CHIP_HELPER_UNIFI_GBL_CHIP_VERSION*2, &data_u16); - CsrSdioRelease(priv->sdio); - if (r != CSR_RESULT_SUCCESS) { - unifi_info(priv, "Failed to read chip version! Try %d\n", i); - - /* First try, re-enable function which may have been disabled by f/w panic */ - if (i == 0) { - unifi_info(priv, "Try function enable\n"); - CsrSdioClaim(priv->sdio); - r = CsrSdioFunctionEnable(priv->sdio); - CsrSdioRelease(priv->sdio); - if (r != CSR_RESULT_SUCCESS) { - unifi_error(priv, "CsrSdioFunctionEnable failed %d\n", r); - } - continue; - } - - /* Subsequent tries, reset */ - - /* Set clock speed low */ - CsrSdioClaim(priv->sdio); - r = CsrSdioMaxBusClockFrequencySet(priv->sdio, UNIFI_SDIO_CLOCK_SAFE_HZ); - CsrSdioRelease(priv->sdio); - if (r != CSR_RESULT_SUCCESS) { - unifi_error(priv, "CsrSdioMaxBusClockFrequencySet() failed %d\n", r); - } - - /* Card software reset */ - CsrSdioClaim(priv->sdio); - r = unifi_card_hard_reset(priv->card); - CsrSdioRelease(priv->sdio); - if (r != CSR_RESULT_SUCCESS) { - unifi_error(priv, "unifi_card_hard_reset() failed %d\n", r); - } - } else { - unifi_info(priv, "Read chip version of 0x%04x\n", data_u16); - break; - } - } - - if (r != CSR_RESULT_SUCCESS) { - unifi_error(priv, "Failed to prepare chip\n"); - return -EIO; - } - - /* Stop the XAPs for coredump. The PUTEST_STOP must be called, e.g. at - * Raw SDIO deinit, to resume them. - */ - CsrSdioClaim(priv->sdio); - r = unifi_card_stop_processor(priv->card, UNIFI_PROC_BOTH); - CsrSdioRelease(priv->sdio); - if (r != CSR_RESULT_SUCCESS) { - unifi_error(priv, "Failed to stop processors\n"); - } - - return 0; -} - -int unifi_putest_cmd52_block_read(unifi_priv_t *priv, unsigned char *arg) -{ - struct unifi_putest_block_cmd52_r block_cmd52; - u8 *arg_pos; - unsigned int cmd_param_size; - CsrResult r; - u8 *block_local_buffer; - - arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1); - if (get_user(cmd_param_size, (int*)arg_pos)) { - unifi_error(priv, - "cmd52r_block: Failed to get the argument\n"); - return -EFAULT; - } - - if (cmd_param_size != sizeof(struct unifi_putest_block_cmd52_r)) { - unifi_error(priv, - "cmd52r_block: cmd52 struct mismatch\n"); - return -EINVAL; - } - - arg_pos += sizeof(unsigned int); - if (copy_from_user(&block_cmd52, - (void*)arg_pos, - sizeof(struct unifi_putest_block_cmd52_r))) { - unifi_error(priv, - "cmd52r_block: Failed to get the cmd52 params\n"); - return -EFAULT; - } - - unifi_trace(priv, UDBG2, "cmd52r_block: func=%d addr=0x%x len=0x%x ", - block_cmd52.funcnum, block_cmd52.addr, block_cmd52.length); - - block_local_buffer = vmalloc(block_cmd52.length); - if (block_local_buffer == NULL) { - unifi_error(priv, "cmd52r_block: Failed to allocate buffer\n"); - return -ENOMEM; - } - - CsrSdioClaim(priv->sdio); - r = unifi_card_readn(priv->card, block_cmd52.addr, block_local_buffer, block_cmd52.length); - CsrSdioRelease(priv->sdio); - if (r != CSR_RESULT_SUCCESS) { - unifi_error(priv, "cmd52r_block: unifi_readn failed\n"); - return -EIO; - } - - if (copy_to_user((void*)block_cmd52.data, - block_local_buffer, - block_cmd52.length)) { - unifi_error(priv, - "cmd52r_block: Failed to return the data\n"); - return -EFAULT; - } - - return 0; -} diff --git a/drivers/staging/csr/sdio_events.c b/drivers/staging/csr/sdio_events.c deleted file mode 100644 index 2a80b9eb0200..000000000000 --- a/drivers/staging/csr/sdio_events.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: sdio_events.c - * - * PURPOSE: - * Process the events received by the SDIO glue layer. - * Optional part of the porting exercise. - * - * Copyright (C) 2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#include "unifi_priv.h" - - -/* - * Porting Notes: - * There are two ways to support the suspend/resume system events in a driver. - * In some operating systems these events are delivered to the OS driver - * directly from the system. In this case, the OS driver needs to pass these - * events to the API described in the CSR SDIO Abstration API document. - * In Linux, and other embedded operating systems, the suspend/resume events - * come from the SDIO driver. In this case, simply get these events in the - * SDIO glue layer and notify the OS layer. - * - * In either case, typically, the events are processed by the SME. - * Use the unifi_sys_suspend_ind() and unifi_sys_resume_ind() to pass - * the events to the SME. - */ - -/* - * --------------------------------------------------------------------------- - * unifi_suspend - * - * Handles a suspend request from the SDIO driver. - * - * Arguments: - * ospriv Pointer to OS driver context. - * - * --------------------------------------------------------------------------- - */ -void unifi_suspend(void *ospriv) -{ - unifi_priv_t *priv = ospriv; - int interfaceTag=0; - - /* For powered suspend, tell the resume's wifi_on() not to reinit UniFi */ - priv->wol_suspend = (enable_wol == UNIFI_WOL_OFF) ? FALSE : TRUE; - - unifi_trace(priv, UDBG1, "unifi_suspend: wol_suspend %d, enable_wol %d", - priv->wol_suspend, enable_wol ); - - /* Stop network traffic. */ - /* need to stop all the netdevices*/ - for( interfaceTag=0;interfaceTag<CSR_WIFI_NUM_INTERFACES;interfaceTag++) - { - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - if (interfacePriv->netdev_registered == 1) - { - if( priv->wol_suspend ) { - unifi_trace(priv, UDBG1, "unifi_suspend: Don't netif_carrier_off"); - } else { - unifi_trace(priv, UDBG1, "unifi_suspend: netif_carrier_off"); - netif_carrier_off(priv->netdev[interfaceTag]); - } - netif_tx_stop_all_queues(priv->netdev[interfaceTag]); - } - } - - unifi_trace(priv, UDBG1, "unifi_suspend: suspend SME"); - - sme_sys_suspend(priv); - -} /* unifi_suspend() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_resume - * - * Handles a resume request from the SDIO driver. - * - * Arguments: - * ospriv Pointer to OS driver context. - * - * --------------------------------------------------------------------------- - */ -void unifi_resume(void *ospriv) -{ - unifi_priv_t *priv = ospriv; - int interfaceTag=0; - int r; - int wol = priv->wol_suspend; - - unifi_trace(priv, UDBG1, "unifi_resume: resume SME, enable_wol=%d", enable_wol); - - /* The resume causes wifi-on which will re-enable the BH and reinstall the ISR */ - r = sme_sys_resume(priv); - if (r) { - unifi_error(priv, "Failed to resume UniFi\n"); - } - - /* Resume the network interfaces. For the cold resume case, this will - * happen upon reconnection. - */ - if (wol) { - unifi_trace(priv, UDBG1, "unifi_resume: try to enable carrier"); - - /* need to start all the netdevices*/ - for( interfaceTag=0;interfaceTag<CSR_WIFI_NUM_INTERFACES;interfaceTag++) { - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - - unifi_trace(priv, UDBG1, "unifi_resume: interfaceTag %d netdev_registered %d mode %d\n", - interfaceTag, interfacePriv->netdev_registered, interfacePriv->interfaceMode); - - if (interfacePriv->netdev_registered == 1) - { - netif_carrier_on(priv->netdev[interfaceTag]); - netif_tx_start_all_queues(priv->netdev[interfaceTag]); - } - } - - /* Kick the BH thread (with reason=host) to poll for data that may have - * arrived during a powered suspend. This caters for the case where the SME - * doesn't interact with the chip (e.g install autonomous scans) during resume. - */ - unifi_send_signal(priv->card, NULL, 0, NULL); - } - -} /* unifi_resume() */ - diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c deleted file mode 100644 index 2b503c23efae..000000000000 --- a/drivers/staging/csr/sdio_mmc.c +++ /dev/null @@ -1,1288 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * - * FILE: sdio_mmc.c - * - * PURPOSE: SDIO driver interface for generic MMC stack. - * - * Copyright (C) 2008-2009 by Cambridge Silicon Radio Ltd. - * - * --------------------------------------------------------------------------- - */ -#include <linux/module.h> -#include <linux/init.h> -#include <linux/kernel.h> -#include <linux/mutex.h> -#include <linux/gfp.h> -#include <linux/mmc/core.h> -#include <linux/mmc/card.h> -#include <linux/mmc/host.h> -#include <linux/mmc/sdio_func.h> -#include <linux/mmc/sdio_ids.h> -#include <linux/mmc/sdio.h> -#include <linux/suspend.h> - -#include "unifi_priv.h" - -#ifdef ANDROID_BUILD -struct wake_lock unifi_sdio_wake_lock; /* wakelock to prevent suspend while resuming */ -#endif - -static CsrSdioFunctionDriver *sdio_func_drv; - -#ifdef CONFIG_PM -static int uf_sdio_mmc_power_event(struct notifier_block *this, unsigned long event, void *ptr); -#endif - -/* - * We need to keep track of the power on/off because we can not call - * mmc_power_restore_host() when the card is already powered. - * Even then, we need to patch the MMC driver to add a power_restore handler - * in the mmc_sdio_ops structure. If the MMC driver before 2.6.37 is not patched, - * mmc_power_save_host() and mmc_power_restore_host() are no-ops in the kernel, - * returning immediately (at least on x86). - */ -static int card_is_powered = 1; - -/* MMC uses ENOMEDIUM to indicate card gone away */ - -static CsrResult -ConvertSdioToCsrSdioResult(int r) -{ - CsrResult csrResult = CSR_RESULT_FAILURE; - - switch (r) { - case 0: - csrResult = CSR_RESULT_SUCCESS; - break; - case -EIO: - case -EILSEQ: - csrResult = CSR_SDIO_RESULT_CRC_ERROR; - break; - /* Timeout errors */ - case -ETIMEDOUT: - case -EBUSY: - csrResult = CSR_SDIO_RESULT_TIMEOUT; - break; - case -ENODEV: - case -ENOMEDIUM: - csrResult = CSR_SDIO_RESULT_NO_DEVICE; - break; - case -EINVAL: - csrResult = CSR_SDIO_RESULT_INVALID_VALUE; - break; - case -ENOMEM: - case -ENOSYS: - case -ERANGE: - case -ENXIO: - csrResult = CSR_RESULT_FAILURE; - break; - default: - unifi_warning(NULL, "Unrecognised SDIO error code: %d\n", r); - break; - } - - return csrResult; -} - - -static int -csr_io_rw_direct(struct mmc_card *card, int write, uint8_t fn, - uint32_t addr, uint8_t in, uint8_t* out) -{ - struct mmc_command cmd; - int err; - - BUG_ON(!card); - BUG_ON(fn > 7); - - memset(&cmd, 0, sizeof(struct mmc_command)); - - cmd.opcode = SD_IO_RW_DIRECT; - cmd.arg = write ? 0x80000000 : 0x00000000; - cmd.arg |= fn << 28; - cmd.arg |= (write && out) ? 0x08000000 : 0x00000000; - cmd.arg |= addr << 9; - cmd.arg |= in; - cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC; - - err = mmc_wait_for_cmd(card->host, &cmd, 0); - if (err) - return err; - - /* this function is not exported, so we will need to sort it out here - * for now, lets hard code it to sdio */ - if (0) { - /* old arg (mmc_host_is_spi(card->host)) { */ - /* host driver already reported errors */ - } else { - if (cmd.resp[0] & R5_ERROR) { - printk(KERN_ERR "%s: r5 error 0x%02x\n", - __FUNCTION__, cmd.resp[0]); - return -EIO; - } - if (cmd.resp[0] & R5_FUNCTION_NUMBER) - return -EINVAL; - if (cmd.resp[0] & R5_OUT_OF_RANGE) - return -ERANGE; - } - - if (out) { - if (0) { /* old argument (mmc_host_is_spi(card->host)) */ - *out = (cmd.resp[0] >> 8) & 0xFF; - } - else { - *out = cmd.resp[0] & 0xFF; - } - } - - return CSR_RESULT_SUCCESS; -} - - -CsrResult -CsrSdioRead8(CsrSdioFunction *function, u32 address, u8 *data) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int err = 0; - - _sdio_claim_host(func); - *data = sdio_readb(func, address, &err); - _sdio_release_host(func); - - if (err) { - return ConvertSdioToCsrSdioResult(err); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioRead8() */ - -CsrResult -CsrSdioWrite8(CsrSdioFunction *function, u32 address, u8 data) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int err = 0; - - _sdio_claim_host(func); - sdio_writeb(func, data, address, &err); - _sdio_release_host(func); - - if (err) { - return ConvertSdioToCsrSdioResult(err); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioWrite8() */ - -CsrResult -CsrSdioRead16(CsrSdioFunction *function, u32 address, u16 *data) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int err; - uint8_t b0, b1; - - _sdio_claim_host(func); - b0 = sdio_readb(func, address, &err); - if (err) { - _sdio_release_host(func); - return ConvertSdioToCsrSdioResult(err); - } - - b1 = sdio_readb(func, address+1, &err); - if (err) { - _sdio_release_host(func); - return ConvertSdioToCsrSdioResult(err); - } - _sdio_release_host(func); - - *data = ((uint16_t)b1 << 8) | b0; - - return CSR_RESULT_SUCCESS; -} /* CsrSdioRead16() */ - - -CsrResult -CsrSdioWrite16(CsrSdioFunction *function, u32 address, u16 data) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int err; - uint8_t b0, b1; - - _sdio_claim_host(func); - b1 = (data >> 8) & 0xFF; - sdio_writeb(func, b1, address+1, &err); - if (err) { - _sdio_release_host(func); - return ConvertSdioToCsrSdioResult(err); - } - - b0 = data & 0xFF; - sdio_writeb(func, b0, address, &err); - if (err) { - _sdio_release_host(func); - return ConvertSdioToCsrSdioResult(err); - } - - _sdio_release_host(func); - return CSR_RESULT_SUCCESS; -} /* CsrSdioWrite16() */ - - -CsrResult -CsrSdioF0Read8(CsrSdioFunction *function, u32 address, u8 *data) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int err = 0; - - _sdio_claim_host(func); -#ifdef MMC_QUIRK_LENIENT_FN0 - *data = sdio_f0_readb(func, address, &err); -#else - err = csr_io_rw_direct(func->card, 0, 0, address, 0, data); -#endif - _sdio_release_host(func); - - if (err) { - return ConvertSdioToCsrSdioResult(err); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioF0Read8() */ - -CsrResult -CsrSdioF0Write8(CsrSdioFunction *function, u32 address, u8 data) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int err = 0; - - _sdio_claim_host(func); -#ifdef MMC_QUIRK_LENIENT_FN0 - sdio_f0_writeb(func, data, address, &err); -#else - err = csr_io_rw_direct(func->card, 1, 0, address, data, NULL); -#endif - _sdio_release_host(func); - - if (err) { - return ConvertSdioToCsrSdioResult(err); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioF0Write8() */ - - -CsrResult -CsrSdioRead(CsrSdioFunction *function, u32 address, void *data, u32 length) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int err; - - _sdio_claim_host(func); - err = sdio_readsb(func, data, address, length); - _sdio_release_host(func); - - if (err) { - return ConvertSdioToCsrSdioResult(err); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioRead() */ - -CsrResult -CsrSdioWrite(CsrSdioFunction *function, u32 address, const void *data, u32 length) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int err; - - _sdio_claim_host(func); - err = sdio_writesb(func, address, (void*)data, length); - _sdio_release_host(func); - - if (err) { - return ConvertSdioToCsrSdioResult(err); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioWrite() */ - - -static int -csr_sdio_enable_hs(struct mmc_card *card) -{ - int ret; - u8 speed; - - if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) { - /* We've asked for HS clock rates, but controller doesn't - * claim to support it. We should limit the clock - * to 25MHz via module parameter. - */ - printk(KERN_INFO "unifi: request HS but not MMC_CAP_SD_HIGHSPEED"); - return 0; - } - - if (!card->cccr.high_speed) - return 0; - -#if 1 - ret = csr_io_rw_direct(card, 0, 0, SDIO_CCCR_SPEED, 0, &speed); - if (ret) - return ret; - - speed |= SDIO_SPEED_EHS; -#else - /* Optimisation: Eliminate read by always assuming SHS and that reserved bits can be zero */ - speed = SDIO_SPEED_EHS | SDIO_SPEED_SHS; -#endif - - ret = csr_io_rw_direct(card, 1, 0, SDIO_CCCR_SPEED, speed, NULL); - if (ret) - return ret; - - mmc_card_set_highspeed(card); - card->host->ios.timing = MMC_TIMING_SD_HS; - card->host->ops->set_ios(card->host, &card->host->ios); - - return 0; -} - -static int -csr_sdio_disable_hs(struct mmc_card *card) -{ - int ret; - u8 speed; - - if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) - return 0; - - if (!card->cccr.high_speed) - return 0; -#if 1 - ret = csr_io_rw_direct(card, 0, 0, SDIO_CCCR_SPEED, 0, &speed); - if (ret) - return ret; - - speed &= ~SDIO_SPEED_EHS; -#else - /* Optimisation: Eliminate read by always assuming SHS and that reserved bits can be zero */ - speed = SDIO_SPEED_SHS; /* clear SDIO_SPEED_EHS */ -#endif - - ret = csr_io_rw_direct(card, 1, 0, SDIO_CCCR_SPEED, speed, NULL); - if (ret) - return ret; - - card->state &= ~MMC_STATE_HIGHSPEED; - card->host->ios.timing = MMC_TIMING_LEGACY; - card->host->ops->set_ios(card->host, &card->host->ios); - - return 0; -} - - -/* - * --------------------------------------------------------------------------- - * CsrSdioMaxBusClockFrequencySet - * - * Set the maximum SDIO bus clock speed to use. - * - * Arguments: - * sdio SDIO context pointer - * maxFrequency maximum clock speed in Hz - * - * Returns: - * an error code. - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, u32 maxFrequency) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - struct mmc_host *host = func->card->host; - struct mmc_ios *ios = &host->ios; - unsigned int max_hz; - int err; - u32 max_khz = maxFrequency/1000; - - if (!max_khz || max_khz > sdio_clock) { - max_khz = sdio_clock; - } - - _sdio_claim_host(func); - max_hz = 1000 * max_khz; - if (max_hz > host->f_max) { - max_hz = host->f_max; - } - - if (max_hz > 25000000) { - err = csr_sdio_enable_hs(func->card); - } else { - err = csr_sdio_disable_hs(func->card); - } - if (err) { - printk(KERN_ERR "SDIO warning: Failed to configure SDIO clock mode\n"); - _sdio_release_host(func); - return CSR_RESULT_SUCCESS; - } - - ios->clock = max_hz; - host->ops->set_ios(host, ios); - - _sdio_release_host(func); - - return CSR_RESULT_SUCCESS; -} /* CsrSdioMaxBusClockFrequencySet() */ - - -/* - * --------------------------------------------------------------------------- - * CsrSdioInterruptEnable - * CsrSdioInterruptDisable - * - * Enable or disable the SDIO interrupt. - * The driver disables the SDIO interrupt until the i/o thread can - * process it. - * The SDIO interrupt can be disabled by modifying the SDIO_INT_ENABLE - * register in the Card Common Control Register block, but this requires - * two CMD52 operations. A better solution is to mask the interrupt at - * the host controller. - * - * Arguments: - * sdio SDIO context pointer - * - * Returns: - * Zero on success or a UniFi driver error code. - * - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioInterruptEnable(CsrSdioFunction *function) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int err = 0; - -#ifdef CSR_CONFIG_MMC_INT_BYPASS_KSOFTIRQD - sdio_unblock_card_irq(func); -#else - _sdio_claim_host(func); - /* Write the Int Enable in CCCR block */ -#ifdef MMC_QUIRK_LENIENT_FN0 - sdio_f0_writeb(func, 0x3, SDIO_CCCR_IENx, &err); -#else - err = csr_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, 0x03, NULL); -#endif - _sdio_release_host(func); - - if (err) { - printk(KERN_ERR "unifi: %s: error %d writing IENx\n", __FUNCTION__, err); - return ConvertSdioToCsrSdioResult(err); - } -#endif - return CSR_RESULT_SUCCESS; -} /* CsrSdioInterruptEnable() */ - -CsrResult -CsrSdioInterruptDisable(CsrSdioFunction *function) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int err = 0; - -#ifdef CSR_CONFIG_MMC_INT_BYPASS_KSOFTIRQD - sdio_block_card_irq(func); -#else - _sdio_claim_host(func); - /* Write the Int Enable in CCCR block */ -#ifdef MMC_QUIRK_LENIENT_FN0 - sdio_f0_writeb(func, 0, SDIO_CCCR_IENx, &err); -#else - err = csr_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, 0x00, NULL); -#endif - _sdio_release_host(func); - - if (err) { - printk(KERN_ERR "unifi: %s: error %d writing IENx\n", __FUNCTION__, err); - return ConvertSdioToCsrSdioResult(err); - } -#endif - return CSR_RESULT_SUCCESS; -} /* CsrSdioInterruptDisable() */ - - -void CsrSdioInterruptAcknowledge(CsrSdioFunction *function) -{ -} - - -/* - * --------------------------------------------------------------------------- - * CsrSdioFunctionEnable - * - * Enable i/o on function 1. - * - * Arguments: - * sdio SDIO context pointer - * - * Returns: - * UniFi driver error code. - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioFunctionEnable(CsrSdioFunction *function) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int err; - - /* Enable UniFi function 1 (the 802.11 part). */ - _sdio_claim_host(func); - err = sdio_enable_func(func); - _sdio_release_host(func); - if (err) { - unifi_error(NULL, "Failed to enable SDIO function %d\n", func->num); - } - - return ConvertSdioToCsrSdioResult(err); -} /* CsrSdioFunctionEnable() */ - - -/* - * --------------------------------------------------------------------------- - * CsrSdioFunctionDisable - * - * Enable i/o on function 1. - * - * Arguments: - * sdio SDIO context pointer - * - * Returns: - * UniFi driver error code. - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioFunctionDisable(CsrSdioFunction *function) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int err; - - /* Disable UniFi function 1 (the 802.11 part). */ - _sdio_claim_host(func); - err = sdio_disable_func(func); - _sdio_release_host(func); - if (err) { - unifi_error(NULL, "Failed to disable SDIO function %d\n", func->num); - } - - return ConvertSdioToCsrSdioResult(err); -} /* CsrSdioFunctionDisable() */ - - -/* - * --------------------------------------------------------------------------- - * CsrSdioFunctionActive - * - * No-op as the bus goes to an active state at the start of every - * command. - * - * Arguments: - * sdio SDIO context pointer - * --------------------------------------------------------------------------- - */ -void -CsrSdioFunctionActive(CsrSdioFunction *function) -{ -} /* CsrSdioFunctionActive() */ - -/* - * --------------------------------------------------------------------------- - * CsrSdioFunctionIdle - * - * Set the function as idle. - * - * Arguments: - * sdio SDIO context pointer - * --------------------------------------------------------------------------- - */ -void -CsrSdioFunctionIdle(CsrSdioFunction *function) -{ -} /* CsrSdioFunctionIdle() */ - - -/* - * --------------------------------------------------------------------------- - * CsrSdioPowerOn - * - * Power on UniFi. - * - * Arguments: - * sdio SDIO context pointer - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioPowerOn(CsrSdioFunction *function) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - struct mmc_host *host = func->card->host; - - _sdio_claim_host(func); - if (!card_is_powered) { - mmc_power_restore_host(host); - card_is_powered = 1; - } else { - printk(KERN_INFO "SDIO: Skip power on; card is already powered.\n"); - } - _sdio_release_host(func); - - return CSR_RESULT_SUCCESS; -} /* CsrSdioPowerOn() */ - -/* - * --------------------------------------------------------------------------- - * CsrSdioPowerOff - * - * Power off UniFi. - * - * Arguments: - * sdio SDIO context pointer - * --------------------------------------------------------------------------- - */ -void -CsrSdioPowerOff(CsrSdioFunction *function) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - struct mmc_host *host = func->card->host; - - _sdio_claim_host(func); - if (card_is_powered) { - mmc_power_save_host(host); - card_is_powered = 0; - } else { - printk(KERN_INFO "SDIO: Skip power off; card is already powered off.\n"); - } - _sdio_release_host(func); -} /* CsrSdioPowerOff() */ - - -static int -sdio_set_block_size_ignore_first_error(struct sdio_func *func, unsigned blksz) -{ - int ret; - - if (blksz > func->card->host->max_blk_size) - return -EINVAL; - - if (blksz == 0) { - blksz = min(func->max_blksize, func->card->host->max_blk_size); - blksz = min(blksz, 512u); - } - - /* - * Ignore -ERANGE (OUT_OF_RANGE in R5) on the first byte as - * the block size may be invalid until both bytes are written. - */ - ret = csr_io_rw_direct(func->card, 1, 0, - SDIO_FBR_BASE(func->num) + SDIO_FBR_BLKSIZE, - blksz & 0xff, NULL); - if (ret && ret != -ERANGE) - return ret; - ret = csr_io_rw_direct(func->card, 1, 0, - SDIO_FBR_BASE(func->num) + SDIO_FBR_BLKSIZE + 1, - (blksz >> 8) & 0xff, NULL); - if (ret) - return ret; - func->cur_blksize = blksz; - - return 0; -} - -CsrResult -CsrSdioBlockSizeSet(CsrSdioFunction *function, u16 blockSize) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int r = 0; - - /* Module parameter overrides */ - if (sdio_block_size > -1) { - blockSize = sdio_block_size; - } - - unifi_trace(NULL, UDBG1, "Set SDIO function block size to %d\n", - blockSize); - - _sdio_claim_host(func); - r = sdio_set_block_size(func, blockSize); - _sdio_release_host(func); - - /* - * The MMC driver for kernels prior to 2.6.32 may fail this request - * with -ERANGE. In this case use our workaround. - */ - if (r == -ERANGE) { - _sdio_claim_host(func); - r = sdio_set_block_size_ignore_first_error(func, blockSize); - _sdio_release_host(func); - } - if (r) { - unifi_error(NULL, "Error %d setting block size\n", r); - } - - /* Determine the achieved block size to pass to the core */ - function->blockSize = func->cur_blksize; - - return ConvertSdioToCsrSdioResult(r); -} /* CsrSdioBlockSizeSet() */ - - -/* - * --------------------------------------------------------------------------- - * CsrSdioHardReset - * - * Hard Resets UniFi is possible. - * - * Arguments: - * sdio SDIO context pointer - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioHardReset(CsrSdioFunction *function) -{ - return CSR_RESULT_FAILURE; -} /* CsrSdioHardReset() */ - - - -/* - * --------------------------------------------------------------------------- - * uf_glue_sdio_int_handler - * - * Interrupt callback function for SDIO interrupts. - * This is called in kernel context (i.e. not interrupt context). - * - * Arguments: - * func SDIO context pointer - * - * Returns: - * None. - * - * Note: Called with host already claimed. - * --------------------------------------------------------------------------- - */ -static void -uf_glue_sdio_int_handler(struct sdio_func *func) -{ - CsrSdioFunction *sdio_ctx; - CsrSdioInterruptDsrCallback func_dsr_callback; - int r; - - sdio_ctx = sdio_get_drvdata(func); - if (!sdio_ctx) { - return; - } - -#ifndef CSR_CONFIG_MMC_INT_BYPASS_KSOFTIRQD - /* - * Normally, we are not allowed to do any SDIO commands here. - * However, this is called in a thread context and with the SDIO lock - * so we disable the interrupts here instead of trying to do complicated - * things with the SDIO lock. - */ -#ifdef MMC_QUIRK_LENIENT_FN0 - sdio_f0_writeb(func, 0, SDIO_CCCR_IENx, &r); -#else - r = csr_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, 0x00, NULL); -#endif - if (r) { - printk(KERN_ERR "UniFi MMC Int handler: Failed to disable interrupts %d\n", r); - } -#endif - - /* If the function driver has registered a handler, call it */ - if (sdio_func_drv && sdio_func_drv->intr) { - - func_dsr_callback = sdio_func_drv->intr(sdio_ctx); - - /* If interrupt handle returns a DSR handle, call it */ - if (func_dsr_callback) { - func_dsr_callback(sdio_ctx); - } - } - -} /* uf_glue_sdio_int_handler() */ - - - -/* - * --------------------------------------------------------------------------- - * csr_sdio_linux_remove_irq - * - * Unregister the interrupt handler. - * This means that the linux layer can not process interrupts any more. - * - * Arguments: - * sdio SDIO context pointer - * - * Returns: - * Status of the removal. - * --------------------------------------------------------------------------- - */ -int csr_sdio_linux_remove_irq(CsrSdioFunction *function) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int r; - - unifi_trace(NULL, UDBG1, "csr_sdio_linux_remove_irq\n"); - - sdio_claim_host(func); - r = sdio_release_irq(func); - sdio_release_host(func); - - return r; - -} /* csr_sdio_linux_remove_irq() */ - - -/* - * --------------------------------------------------------------------------- - * csr_sdio_linux_install_irq - * - * Register the interrupt handler. - * This means that the linux layer can process interrupts. - * - * Arguments: - * sdio SDIO context pointer - * - * Returns: - * Status of the removal. - * --------------------------------------------------------------------------- - */ -int csr_sdio_linux_install_irq(CsrSdioFunction *function) -{ - struct sdio_func *func = (struct sdio_func *)function->priv; - int r; - - unifi_trace(NULL, UDBG1, "csr_sdio_linux_install_irq\n"); - - /* Register our interrupt handle */ - sdio_claim_host(func); - r = sdio_claim_irq(func, uf_glue_sdio_int_handler); - sdio_release_host(func); - - /* If the interrupt was installed earlier, is fine */ - if (r == -EBUSY) - r = 0; - - return r; -} /* csr_sdio_linux_install_irq() */ - -#ifdef CONFIG_PM - -/* - * Power Management notifier - */ -struct uf_sdio_mmc_pm_notifier -{ - struct list_head list; - - CsrSdioFunction *sdio_ctx; - struct notifier_block pm_notifier; -}; - -/* PM notifier list head */ -static struct uf_sdio_mmc_pm_notifier uf_sdio_mmc_pm_notifiers = { - .sdio_ctx = NULL, -}; - -/* - * --------------------------------------------------------------------------- - * uf_sdio_mmc_register_pm_notifier - * uf_sdio_mmc_unregister_pm_notifier - * - * Register/unregister for power management events. A list is used to - * allow multiple card instances to be supported. - * - * Arguments: - * sdio_ctx - CSR SDIO context to associate PM notifier to - * - * Returns: - * Register function returns NULL on error - * --------------------------------------------------------------------------- - */ -static struct uf_sdio_mmc_pm_notifier * -uf_sdio_mmc_register_pm_notifier(CsrSdioFunction *sdio_ctx) -{ - /* Allocate notifier context for this card instance */ - struct uf_sdio_mmc_pm_notifier *notifier_ctx = kmalloc(sizeof(struct uf_sdio_mmc_pm_notifier), GFP_KERNEL); - - if (notifier_ctx) - { - notifier_ctx->sdio_ctx = sdio_ctx; - notifier_ctx->pm_notifier.notifier_call = uf_sdio_mmc_power_event; - - list_add(¬ifier_ctx->list, &uf_sdio_mmc_pm_notifiers.list); - - if (register_pm_notifier(¬ifier_ctx->pm_notifier)) { - printk(KERN_ERR "unifi: register_pm_notifier failed\n"); - } - } - - return notifier_ctx; -} - -static void -uf_sdio_mmc_unregister_pm_notifier(CsrSdioFunction *sdio_ctx) -{ - struct uf_sdio_mmc_pm_notifier *notifier_ctx; - struct list_head *node, *q; - - list_for_each_safe(node, q, &uf_sdio_mmc_pm_notifiers.list) { - notifier_ctx = list_entry(node, struct uf_sdio_mmc_pm_notifier, list); - - /* If it matches, unregister and free the notifier context */ - if (notifier_ctx && notifier_ctx->sdio_ctx == sdio_ctx) - { - if (unregister_pm_notifier(¬ifier_ctx->pm_notifier)) { - printk(KERN_ERR "unifi: unregister_pm_notifier failed\n"); - } - - /* Remove from list */ - notifier_ctx->sdio_ctx = NULL; - list_del(node); - kfree(notifier_ctx); - } - } -} - -/* - * --------------------------------------------------------------------------- - * uf_sdio_mmc_power_event - * - * Handler for power management events. - * - * We need to handle suspend/resume events while the userspace is unsuspended - * to allow the SME to run its suspend/resume state machines. - * - * Arguments: - * event event ID - * - * Returns: - * Status of the event handling - * --------------------------------------------------------------------------- - */ -static int -uf_sdio_mmc_power_event(struct notifier_block *this, unsigned long event, void *ptr) -{ - struct uf_sdio_mmc_pm_notifier *notifier_ctx = container_of(this, - struct uf_sdio_mmc_pm_notifier, - pm_notifier); - - /* Call the CSR SDIO function driver's suspend/resume method - * while the userspace is unsuspended. - */ - switch (event) { - case PM_POST_HIBERNATION: - case PM_POST_SUSPEND: - printk(KERN_INFO "%s:%d resume\n", __FUNCTION__, __LINE__ ); - if (sdio_func_drv && sdio_func_drv->resume) { - sdio_func_drv->resume(notifier_ctx->sdio_ctx); - } - break; - - case PM_HIBERNATION_PREPARE: - case PM_SUSPEND_PREPARE: - printk(KERN_INFO "%s:%d suspend\n", __FUNCTION__, __LINE__ ); - if (sdio_func_drv && sdio_func_drv->suspend) { - sdio_func_drv->suspend(notifier_ctx->sdio_ctx); - } - break; - } - return NOTIFY_DONE; -} - -#endif /* CONFIG_PM */ - -/* - * --------------------------------------------------------------------------- - * uf_glue_sdio_probe - * - * Card insert callback. - * - * Arguments: - * func Our (glue layer) context pointer. - * - * Returns: - * UniFi driver error code. - * --------------------------------------------------------------------------- - */ -static int -uf_glue_sdio_probe(struct sdio_func *func, - const struct sdio_device_id *id) -{ - int instance; - CsrSdioFunction *sdio_ctx; - - /* First of all claim the SDIO driver */ - sdio_claim_host(func); - - /* Assume that the card is already powered */ - card_is_powered = 1; - - /* Assumes one card per host, which is true for SDIO */ - instance = func->card->host->index; - printk("sdio bus_id: %16s - UniFi card 0x%X inserted\n", - sdio_func_id(func), instance); - - /* Allocate context */ - sdio_ctx = kmalloc(sizeof(CsrSdioFunction), GFP_KERNEL); - if (sdio_ctx == NULL) { - sdio_release_host(func); - return -ENOMEM; - } - - /* Initialise the context */ - sdio_ctx->sdioId.manfId = func->vendor; - sdio_ctx->sdioId.cardId = func->device; - sdio_ctx->sdioId.sdioFunction = func->num; - sdio_ctx->sdioId.sdioInterface = func->class; - sdio_ctx->blockSize = func->cur_blksize; - sdio_ctx->priv = (void *)func; - sdio_ctx->features = 0; - - /* Module parameter enables byte mode */ - if (sdio_byte_mode) { - sdio_ctx->features |= CSR_SDIO_FEATURE_BYTE_MODE; - } - - if (func->card->host->caps & MMC_CAP_SD_HIGHSPEED) { - unifi_trace(NULL, UDBG1, "MMC_CAP_SD_HIGHSPEED is available\n"); - } - -#ifdef MMC_QUIRK_LENIENT_FN0 - func->card->quirks |= MMC_QUIRK_LENIENT_FN0; -#endif - - /* Pass context to the SDIO driver */ - sdio_set_drvdata(func, sdio_ctx); - -#ifdef CONFIG_PM - /* Register to get PM events */ - if (uf_sdio_mmc_register_pm_notifier(sdio_ctx) == NULL) { - unifi_error(NULL, "%s: Failed to register for PM events\n", __FUNCTION__); - } -#endif - - /* Register this device with the SDIO function driver */ - /* Call the main UniFi driver inserted handler */ - if (sdio_func_drv && sdio_func_drv->inserted) { - uf_add_os_device(instance, &func->dev); - sdio_func_drv->inserted(sdio_ctx); - } - - /* We have finished, so release the SDIO driver */ - sdio_release_host(func); - -#ifdef ANDROID_BUILD - /* Take the wakelock */ - unifi_trace(NULL, UDBG1, "probe: take wake lock\n"); - wake_lock(&unifi_sdio_wake_lock); -#endif - - return 0; -} /* uf_glue_sdio_probe() */ - - -/* - * --------------------------------------------------------------------------- - * uf_glue_sdio_remove - * - * Card removal callback. - * - * Arguments: - * func Our (glue layer) context pointer. - * - * Returns: - * UniFi driver error code. - * --------------------------------------------------------------------------- - */ -static void -uf_glue_sdio_remove(struct sdio_func *func) -{ - CsrSdioFunction *sdio_ctx; - - sdio_ctx = sdio_get_drvdata(func); - if (!sdio_ctx) { - return; - } - - unifi_info(NULL, "UniFi card removed\n"); - - /* Clean up the SDIO function driver */ - if (sdio_func_drv && sdio_func_drv->removed) { - uf_remove_os_device(func->card->host->index); - sdio_func_drv->removed(sdio_ctx); - } - -#ifdef CONFIG_PM - /* Unregister for PM events */ - uf_sdio_mmc_unregister_pm_notifier(sdio_ctx); -#endif - - kfree(sdio_ctx); - -} /* uf_glue_sdio_remove */ - - -/* - * SDIO ids *must* be statically declared, so we can't take - * them from the list passed in csr_sdio_register_driver(). - */ -static const struct sdio_device_id unifi_ids[] = { - { SDIO_DEVICE(SDIO_MANF_ID_CSR, SDIO_CARD_ID_UNIFI_3) }, - { SDIO_DEVICE(SDIO_MANF_ID_CSR, SDIO_CARD_ID_UNIFI_4) }, - { /* end: all zeroes */ }, -}; - -MODULE_DEVICE_TABLE(sdio, unifi_ids); - -#ifdef CONFIG_PM - -/* - * --------------------------------------------------------------------------- - * uf_glue_sdio_suspend - * - * Card suspend callback. The userspace will already be suspended. - * - * Arguments: - * dev The struct device owned by the MMC driver - * - * Returns: - * None - * --------------------------------------------------------------------------- - */ -static int -uf_glue_sdio_suspend(struct device *dev) -{ - unifi_trace(NULL, UDBG1, "uf_glue_sdio_suspend"); - - return 0; -} /* uf_glue_sdio_suspend */ - - -/* - * --------------------------------------------------------------------------- - * uf_glue_sdio_resume - * - * Card resume callback. The userspace will still be suspended. - * - * Arguments: - * dev The struct device owned by the MMC driver - * - * Returns: - * None - * --------------------------------------------------------------------------- - */ -static int -uf_glue_sdio_resume(struct device *dev) -{ - unifi_trace(NULL, UDBG1, "uf_glue_sdio_resume"); - -#ifdef ANDROID_BUILD - unifi_trace(NULL, UDBG1, "resume: take wakelock\n"); - wake_lock(&unifi_sdio_wake_lock); -#endif - - return 0; - -} /* uf_glue_sdio_resume */ - -static struct dev_pm_ops unifi_pm_ops = { - .suspend = uf_glue_sdio_suspend, - .resume = uf_glue_sdio_resume, -}; - -#define UNIFI_PM_OPS (&unifi_pm_ops) - -#else - -#define UNIFI_PM_OPS NULL - -#endif /* CONFIG_PM */ - -static struct sdio_driver unifi_driver = { - .probe = uf_glue_sdio_probe, - .remove = uf_glue_sdio_remove, - .name = "unifi", - .id_table = unifi_ids, - .drv.pm = UNIFI_PM_OPS, -}; - - -/* - * --------------------------------------------------------------------------- - * CsrSdioFunctionDriverRegister - * CsrSdioFunctionDriverUnregister - * - * These functions are called from the main module load and unload - * functions. They perform the appropriate operations for the - * linux MMC/SDIO driver. - * - * Arguments: - * sdio_drv Pointer to the function driver's SDIO structure. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -CsrResult -CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *sdio_drv) -{ - int r; - - printk("UniFi: Using native Linux MMC driver for SDIO.\n"); - - if (sdio_func_drv) { - unifi_error(NULL, "sdio_mmc: UniFi driver already registered\n"); - return CSR_SDIO_RESULT_INVALID_VALUE; - } - -#ifdef ANDROID_BUILD - wake_lock_init(&unifi_sdio_wake_lock, WAKE_LOCK_SUSPEND, "unifi_sdio_work"); -#endif - - /* Save the registered driver description */ - /* - * FIXME: - * Need a table here to handle a call to register for just one function. - * mmc only allows us to register for the whole device - */ - sdio_func_drv = sdio_drv; - -#ifdef CONFIG_PM - /* Initialise PM notifier list */ - INIT_LIST_HEAD(&uf_sdio_mmc_pm_notifiers.list); -#endif - - /* Register ourself with mmc_core */ - r = sdio_register_driver(&unifi_driver); - if (r) { - printk(KERN_ERR "unifi_sdio: Failed to register UniFi SDIO driver: %d\n", r); - return ConvertSdioToCsrSdioResult(r); - } - - return CSR_RESULT_SUCCESS; -} /* CsrSdioFunctionDriverRegister() */ - - - -void -CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *sdio_drv) -{ - printk(KERN_INFO "UniFi: unregister from MMC sdio\n"); - -#ifdef ANDROID_BUILD - wake_lock_destroy(&unifi_sdio_wake_lock); -#endif - sdio_unregister_driver(&unifi_driver); - - sdio_func_drv = NULL; - -} /* CsrSdioFunctionDriverUnregister() */ - diff --git a/drivers/staging/csr/sdio_stubs.c b/drivers/staging/csr/sdio_stubs.c deleted file mode 100644 index 839fae01d96c..000000000000 --- a/drivers/staging/csr/sdio_stubs.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Stubs for some of the bottom edge functions. - * - * These stubs are optional functions in the bottom edge (SDIO driver - * interface) API that not all platforms or SDIO drivers may support. - * - * They're declared as weak symbols so they can be overridden by - * simply providing a non-weak declaration. - * - * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - */ -#include "csr_wifi_hip_unifi.h" - -void __attribute__((weak)) CsrSdioFunctionIdle(CsrSdioFunction *function) -{ -} - -void __attribute__((weak)) CsrSdioFunctionActive(CsrSdioFunction *function) -{ -} - -CsrResult __attribute__((weak)) CsrSdioPowerOn(CsrSdioFunction *function) -{ - return CSR_RESULT_SUCCESS; -} - -void __attribute__((weak)) CsrSdioPowerOff(CsrSdioFunction *function) -{ -} - -CsrResult __attribute__((weak)) CsrSdioHardReset(CsrSdioFunction *function) -{ - return CSR_SDIO_RESULT_NOT_RESET; -} - -CsrResult __attribute__((weak)) CsrSdioBlockSizeSet(CsrSdioFunction *function, - u16 blockSize) -{ - return CSR_RESULT_SUCCESS; -} - -CsrResult __attribute__((weak)) CsrSdioSuspend(CsrSdioFunction *function) -{ - return CSR_RESULT_SUCCESS; -} - -CsrResult __attribute__((weak)) CsrSdioResume(CsrSdioFunction *function) -{ - return CSR_RESULT_SUCCESS; -} - -int __attribute__((weak)) csr_sdio_linux_install_irq(CsrSdioFunction *function) -{ - return 0; -} - -int __attribute__((weak)) csr_sdio_linux_remove_irq(CsrSdioFunction *function) -{ - return 0; -} - -void __attribute__((weak)) CsrSdioInsertedAcknowledge(CsrSdioFunction *function, CsrResult result) -{ -} - -void __attribute__((weak)) CsrSdioRemovedAcknowledge(CsrSdioFunction *function) -{ -} - -void __attribute__((weak)) CsrSdioSuspendAcknowledge(CsrSdioFunction *function, CsrResult result) -{ -} - -void __attribute__((weak)) CsrSdioResumeAcknowledge(CsrSdioFunction *function, CsrResult result) -{ -} - - diff --git a/drivers/staging/csr/sme_blocking.c b/drivers/staging/csr/sme_blocking.c deleted file mode 100644 index 0c6e21636e7f..000000000000 --- a/drivers/staging/csr/sme_blocking.c +++ /dev/null @@ -1,1466 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: sme_mgt_blocking.c - * - * PURPOSE: - * This file contains the driver specific implementation of - * the WEXT <==> SME MGT interface for all SME builds that support WEXT. - * - * Copyright (C) 2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ - -#include "unifi_priv.h" - - -/* - * This file also contains the implementation of the asynchronous - * requests to the SME. - * - * Before calling an asynchronous SME function, we call sme_init_request() - * which gets hold of the SME semaphore and updates the request status. - * The semaphore makes sure that there is only one pending request to - * the SME at a time. - * - * Now we are ready to call the SME function, but only if - * sme_init_request() has returned 0. - * - * When the SME function returns, we need to wait - * for the reply. This is done in sme_wait_for_reply(). - * If the request times-out, the request status is set to SME_REQUEST_TIMEDOUT - * and the sme_wait_for_reply() returns. - * - * If the SME replies in time, we call sme_complete_request(). - * There we change the request status to SME_REQUEST_RECEIVED. This will - * wake up the process waiting on sme_wait_for_reply(). - * It is important that we copy the reply data in priv->sme_reply - * before calling sme_complete_request(). - * - * Handling the wext requests, we need to block - * until the SME sends the response to our request. - * We use the sme_init_request() and sme_wait_for_reply() - * to implement this behavior in the following functions: - * sme_mgt_wifi_on() - * sme_mgt_wifi_off() - * sme_mgt_scan_full() - * sme_mgt_scan_results_get_async() - * sme_mgt_connect() - * unifi_mgt_media_status_ind() - * sme_mgt_disconnect() - * sme_mgt_pmkid() - * sme_mgt_key() - * sme_mgt_mib_get() - * sme_mgt_mib_set() - * sme_mgt_versions_get() - * sme_mgt_set_value() - * sme_mgt_get_value() - * sme_mgt_set_value_async() - * sme_mgt_get_value_async() - * sme_mgt_packet_filter_set() - * sme_mgt_tspec() - */ - - -/* - * Handling the suspend and resume system events, we need to block - * until the SME sends the response to our indication. - * We use the sme_init_request() and sme_wait_for_reply() - * to implement this behavior in the following functions: - * sme_sys_suspend() - * sme_sys_resume() - */ - -#define UNIFI_SME_MGT_SHORT_TIMEOUT 10000 -#define UNIFI_SME_MGT_LONG_TIMEOUT 19000 -#define UNIFI_SME_SYS_LONG_TIMEOUT 10000 - -#ifdef UNIFI_DEBUG -# define sme_wait_for_reply(priv, t) _sme_wait_for_reply(priv, t, __func__) -#else -# define sme_wait_for_reply(priv, t) _sme_wait_for_reply(priv, t, NULL) -#endif - -static int -sme_init_request(unifi_priv_t *priv) -{ - if (priv == NULL) { - unifi_error(priv, "sme_init_request: Invalid priv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG5, "sme_init_request: wait sem\n"); - - /* Grab the SME semaphore until the reply comes, or timeout */ - if (down_interruptible(&priv->sme_sem)) { - unifi_error(priv, "sme_init_request: Failed to get SME semaphore\n"); - return -EIO; - } - unifi_trace(priv, UDBG5, "sme_init_request: got sem: pending\n"); - - priv->sme_reply.request_status = SME_REQUEST_PENDING; - - return 0; - -} /* sme_init_request() */ - - -void -uf_sme_complete_request(unifi_priv_t *priv, CsrResult reply_status, const char *func) -{ - if (priv == NULL) { - unifi_error(priv, "sme_complete_request: Invalid priv\n"); - return; - } - - if (priv->sme_reply.request_status != SME_REQUEST_PENDING) { - unifi_notice(priv, - "sme_complete_request: request not pending %s (s:%d)\n", - (func ? func : ""), priv->sme_reply.request_status); - return; - } - unifi_trace(priv, UDBG5, - "sme_complete_request: completed %s (s:%d)\n", - (func ? func : ""), priv->sme_reply.request_status); - - priv->sme_reply.request_status = SME_REQUEST_RECEIVED; - priv->sme_reply.reply_status = reply_status; - - wake_up_interruptible(&priv->sme_request_wq); - - return; -} - - -void -uf_sme_cancel_request(unifi_priv_t *priv, CsrResult reply_status) -{ - /* Check for a blocking SME request in progress, and cancel the wait. - * This should be used when the character device is closed. - */ - - if (priv == NULL) { - unifi_error(priv, "sme_cancel_request: Invalid priv\n"); - return; - } - - /* If no request is pending, nothing to wake up */ - if (priv->sme_reply.request_status != SME_REQUEST_PENDING) { - unifi_trace(priv, UDBG5, - "sme_cancel_request: no request was pending (s:%d)\n", - priv->sme_reply.request_status); - /* Nothing to do */ - return; - } - unifi_trace(priv, UDBG5, - "sme_cancel_request: request cancelled (s:%d)\n", - priv->sme_reply.request_status); - - /* Wake up the wait with an error status */ - priv->sme_reply.request_status = SME_REQUEST_CANCELLED; - priv->sme_reply.reply_status = reply_status; /* unimportant since the CANCELLED state will fail the ioctl */ - - wake_up_interruptible(&priv->sme_request_wq); - - return; -} - - -static int -_sme_wait_for_reply(unifi_priv_t *priv, - unsigned long timeout, const char *func) -{ - long r; - - unifi_trace(priv, UDBG5, "sme_wait_for_reply: %s sleep\n", func ? func : ""); - r = wait_event_interruptible_timeout(priv->sme_request_wq, - (priv->sme_reply.request_status != SME_REQUEST_PENDING), - msecs_to_jiffies(timeout)); - unifi_trace(priv, UDBG5, "sme_wait_for_reply: %s awake (%d)\n", func ? func : "", r); - - if (r == -ERESTARTSYS) { - /* The thread was killed */ - unifi_info(priv, "ERESTARTSYS in _sme_wait_for_reply\n"); - up(&priv->sme_sem); - return r; - } - if (priv->sme_reply.request_status == SME_REQUEST_CANCELLED) { - unifi_trace(priv, UDBG5, "Cancelled waiting for SME to reply (%s s:%d, t:%d, r:%d)\n", - (func ? func : ""), priv->sme_reply.request_status, timeout, r); - - /* Release the SME semaphore that was downed in sme_init_request() */ - up(&priv->sme_sem); - return -EIO; /* fail the ioctl */ - } - if ((r == 0) && (priv->sme_reply.request_status != SME_REQUEST_RECEIVED)) { - unifi_notice(priv, "Timeout waiting for SME to reply (%s s:%d, t:%d)\n", - (func ? func : ""), priv->sme_reply.request_status, timeout); - - priv->sme_reply.request_status = SME_REQUEST_TIMEDOUT; - - /* Release the SME semaphore that was downed in sme_init_request() */ - up(&priv->sme_sem); - - return -ETIMEDOUT; - } - - unifi_trace(priv, UDBG5, "sme_wait_for_reply: %s received (%d)\n", - func ? func : "", r); - - /* Release the SME semaphore that was downed in sme_init_request() */ - up(&priv->sme_sem); - - return 0; -} /* sme_wait_for_reply() */ - - - - -#ifdef CSR_SUPPORT_WEXT -int sme_mgt_wifi_on(unifi_priv_t *priv) -{ - u16 numElements; - CsrWifiSmeDataBlock* dataList; -#ifdef CSR_SUPPORT_WEXT_AP - int r; -#endif - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_wifi_on: invalid smepriv\n"); - return -EIO; - } - - if (priv->mib_data.length) { - numElements = 1; - dataList = &priv->mib_data; - } else { - numElements = 0; - dataList = NULL; - } - /* Start the SME */ -#ifdef CSR_SUPPORT_WEXT_AP - r = sme_init_request(priv); - if (r) { - return -EIO; - } -#endif - CsrWifiSmeWifiOnReqSend(0, priv->sta_mac_address, numElements, dataList); -#ifdef CSR_SUPPORT_WEXT_AP - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT); - unifi_trace(priv, UDBG4, - "sme_mgt_wifi_on: unifi_mgt_wifi_oo_req <-- (r=%d, status=%d)\n", - r, priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -#else - return 0; -#endif -} /* sme_mgt_wifi_on() */ - - -int sme_mgt_wifi_off(unifi_priv_t *priv) -{ - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_wifi_off: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - /* Stop the SME */ - CsrWifiSmeWifiOffReqSend(0); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, - "sme_mgt_wifi_off: unifi_mgt_wifi_off_req <-- (r=%d, status=%d)\n", - r, priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); - -} /* sme_mgt_wifi_off */ - -int sme_mgt_key(unifi_priv_t *priv, CsrWifiSmeKey *sme_key, - CsrWifiSmeListAction action) -{ - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_key: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeKeyReqSend(0, CSR_WIFI_INTERFACE_IN_USE, action, *sme_key); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - return convert_sme_error(priv->sme_reply.reply_status); -} - - -int sme_mgt_scan_full(unifi_priv_t *priv, - CsrWifiSsid *specific_ssid, - int num_channels, - unsigned char *channel_list) -{ - CsrWifiMacAddress bcastAddress = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }}; - u8 is_active = (num_channels > 0) ? TRUE : FALSE; - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_scan_full: invalid smepriv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG4, "sme_mgt_scan_full: -->\n"); - - r = sme_init_request(priv); - if (r) - return -EIO; - - /* If a channel list is provided, do an active scan */ - if (is_active) { - unifi_trace(priv, UDBG1, - "channel list - num_channels: %d, active scan\n", - num_channels); - } - - CsrWifiSmeScanFullReqSend(0, - specific_ssid->length?1:0, /* 0 or 1 SSIDS */ - specific_ssid, - bcastAddress, - is_active, - CSR_WIFI_SME_BSS_TYPE_ANY_BSS, - CSR_WIFI_SME_SCAN_TYPE_ALL, - (u16)num_channels, channel_list, - 0, NULL); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, "sme_mgt_scan_full: <-- (status=%d)\n", priv->sme_reply.reply_status); - if (priv->sme_reply.reply_status == CSR_WIFI_RESULT_UNAVAILABLE) - return 0; /* initial scan already underway */ - else - return convert_sme_error(priv->sme_reply.reply_status); -} - - -int sme_mgt_scan_results_get_async(unifi_priv_t *priv, - struct iw_request_info *info, - char *scan_results, - long scan_results_len) -{ - u16 scan_result_list_count; - CsrWifiSmeScanResult *scan_result_list; - CsrWifiSmeScanResult *scan_result; - int r; - int i; - char *current_ev = scan_results; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_scan_results_get_async: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeScanResultsGetReqSend(0); - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT); - if (r) - return r; - - scan_result_list_count = priv->sme_reply.reply_scan_results_count; - scan_result_list = priv->sme_reply.reply_scan_results; - unifi_trace(priv, UDBG2, - "scan_results: Scan returned %d, numElements=%d\n", - r, scan_result_list_count); - - /* OK, now we have the scan results */ - for (i = 0; i < scan_result_list_count; ++i) { - scan_result = &scan_result_list[i]; - - unifi_trace(priv, UDBG2, "Scan Result: %.*s\n", - scan_result->ssid.length, - scan_result->ssid.ssid); - - r = unifi_translate_scan(priv->netdev[0], info, - current_ev, - scan_results + scan_results_len, - scan_result, i+1); - - if (r < 0) { - kfree(scan_result_list); - priv->sme_reply.reply_scan_results_count = 0; - priv->sme_reply.reply_scan_results = NULL; - return r; - } - - current_ev += r; - } - - /* - * Free the scan results allocated in unifi_mgt_scan_results_get_cfm() - * and invalidate the reply_scan_results to avoid re-using - * the freed pointers. - */ - kfree(scan_result_list); - priv->sme_reply.reply_scan_results_count = 0; - priv->sme_reply.reply_scan_results = NULL; - - unifi_trace(priv, UDBG2, - "scan_results: Scan translated to %d bytes\n", - current_ev - scan_results); - return (current_ev - scan_results); -} - - -int sme_mgt_connect(unifi_priv_t *priv) -{ - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_connect: invalid smepriv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG2, "sme_mgt_connect: %.*s\n", - priv->connection_config.ssid.length, - priv->connection_config.ssid.ssid); - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeConnectReqSend(0, CSR_WIFI_INTERFACE_IN_USE, priv->connection_config); - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - if (priv->sme_reply.reply_status) - unifi_trace(priv, UDBG1, "sme_mgt_connect: failed with SME status %d\n", - priv->sme_reply.reply_status); - - return convert_sme_error(priv->sme_reply.reply_status); -} - - -int sme_mgt_disconnect(unifi_priv_t *priv) -{ - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_disconnect: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeDisconnectReqSend(0, CSR_WIFI_INTERFACE_IN_USE); - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, "sme_mgt_disconnect: <-- (status=%d)\n", priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -} - - -int sme_mgt_pmkid(unifi_priv_t *priv, - CsrWifiSmeListAction action, - CsrWifiSmePmkidList *pmkid_list) -{ - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_pmkid: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmePmkidReqSend(0, CSR_WIFI_INTERFACE_IN_USE, action, - pmkid_list->pmkidsCount, pmkid_list->pmkids); - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, "sme_mgt_pmkid: <-- (status=%d)\n", priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -} - - -int sme_mgt_mib_get(unifi_priv_t *priv, - unsigned char *varbind, int *length) -{ - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_mib_get: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - priv->mib_cfm_buffer = varbind; - priv->mib_cfm_buffer_length = MAX_VARBIND_LENGTH; - - CsrWifiSmeMibGetReqSend(0, *length, varbind); - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) { - priv->mib_cfm_buffer_length = 0; - priv->mib_cfm_buffer = NULL; - return r; - } - - *length = priv->mib_cfm_buffer_length; - - priv->mib_cfm_buffer_length = 0; - priv->mib_cfm_buffer = NULL; - unifi_trace(priv, UDBG4, "sme_mgt_mib_get: <-- (status=%d)\n", priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -} - -int sme_mgt_mib_set(unifi_priv_t *priv, - unsigned char *varbind, int length) -{ - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_mib_get: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeMibSetReqSend(0, length, varbind); - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, "sme_mgt_mib_set: <-- (status=%d)\n", priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -} - -#endif /* CSR_SUPPORT_WEXT */ - -int sme_mgt_power_config_set(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_set_value_async: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmePowerConfigSetReqSend(0, *powerConfig); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, - "sme_mgt_set_value_async: unifi_mgt_set_value_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_set_value: invalid smepriv\n"); - return -EIO; - } - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtPowerConfigSetReq(priv->smepriv, *powerConfig); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -int sme_mgt_sme_config_set(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_sme_config_set: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeSmeStaConfigSetReqSend(0, CSR_WIFI_INTERFACE_IN_USE, *staConfig); - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, - "sme_mgt_sme_config_set: CsrWifiSmeSmeStaConfigSetReq <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeSmeCommonConfigSetReqSend(0, *deviceConfig); - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, - "sme_mgt_sme_config_set: CsrWifiSmeSmeCommonConfigSetReq <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_sme_config_set: invalid smepriv\n"); - return -EIO; - } - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtSmeConfigSetReq(priv->smepriv, *staConfig); - status = CsrWifiSmeMgtDeviceConfigSetReq(priv->smepriv, *deviceConfig); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -#ifdef CSR_SUPPORT_WEXT - -int sme_mgt_mib_config_set(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_mib_config_set: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeMibConfigSetReqSend(0, *mibConfig); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, - "sme_mgt_mib_config_set: unifi_mgt_set_mib_config_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_mib_config_set: invalid smepriv\n"); - return -EIO; - } - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtMibConfigSetReq(priv->smepriv, *mibConfig); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -int sme_mgt_coex_config_set(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_coex_config_set: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeCoexConfigSetReqSend(0, *coexConfig); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, - "sme_mgt_coex_config_set: unifi_mgt_set_mib_config_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_coex_config_set: invalid smepriv\n"); - return -EIO; - } - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtCoexConfigSetReq(priv->smepriv, *coexConfig); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -#endif /* CSR_SUPPORT_WEXT */ - -int sme_mgt_host_config_set(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_host_config_set: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeHostConfigSetReqSend(0, CSR_WIFI_INTERFACE_IN_USE, *hostConfig); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, - "sme_mgt_host_config_set: unifi_mgt_set_host_config_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_host_config_set: invalid smepriv\n"); - return -EIO; - } - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtHostConfigSetReq(priv->smepriv, *hostConfig); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -#ifdef CSR_SUPPORT_WEXT - -int sme_mgt_versions_get(unifi_priv_t *priv, CsrWifiSmeVersions *versions) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_versions_get: invalid smepriv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG4, "sme_mgt_versions_get: unifi_mgt_versions_get_req -->\n"); - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeVersionsGetReqSend(0); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - /* store the reply */ - if (versions != NULL) { - memcpy((unsigned char*)versions, - (unsigned char*)&priv->sme_reply.versions, - sizeof(CsrWifiSmeVersions)); - } - - unifi_trace(priv, UDBG4, - "sme_mgt_versions_get: unifi_mgt_versions_get_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtVersionsGetReq(priv->smepriv, versions); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -#endif /* CSR_SUPPORT_WEXT */ - -int sme_mgt_power_config_get(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_power_config_get: invalid smepriv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG4, "sme_mgt_power_config_get: unifi_mgt_power_config_req -->\n"); - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmePowerConfigGetReqSend(0); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - /* store the reply */ - if (powerConfig != NULL) { - memcpy((unsigned char*)powerConfig, - (unsigned char*)&priv->sme_reply.powerConfig, - sizeof(CsrWifiSmePowerConfig)); - } - - unifi_trace(priv, UDBG4, - "sme_mgt_get_versions: unifi_mgt_power_config_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtPowerConfigGetReq(priv->smepriv, powerConfig); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -int sme_mgt_host_config_get(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_host_config_get: invalid smepriv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG4, "sme_mgt_host_config_get: unifi_mgt_host_config_get_req -->\n"); - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeHostConfigGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - /* store the reply */ - if (hostConfig != NULL) - memcpy((unsigned char*)hostConfig, - (unsigned char*)&priv->sme_reply.hostConfig, - sizeof(CsrWifiSmeHostConfig)); - - unifi_trace(priv, UDBG4, - "sme_mgt_host_config_get: unifi_mgt_host_config_get_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtHostConfigGetReq(priv->smepriv, hostConfig); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -int sme_mgt_sme_config_get(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_sme_config_get: invalid smepriv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG4, "sme_mgt_sme_config_get: unifi_mgt_sme_config_get_req -->\n"); - - /* Common device config */ - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeSmeCommonConfigGetReqSend(0); - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - /* store the reply */ - if (deviceConfig != NULL) - memcpy((unsigned char*)deviceConfig, - (unsigned char*)&priv->sme_reply.deviceConfig, - sizeof(CsrWifiSmeDeviceConfig)); - - /* STA config */ - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeSmeStaConfigGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE); - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - /* store the reply */ - if (staConfig != NULL) - memcpy((unsigned char*)staConfig, - (unsigned char*)&priv->sme_reply.staConfig, - sizeof(CsrWifiSmeStaConfig)); - - unifi_trace(priv, UDBG4, - "sme_mgt_sme_config_get: unifi_mgt_sme_config_get_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtSmeConfigGetReq(priv->smepriv, staConfig); - status = CsrWifiSmeMgtDeviceConfigGetReq(priv->smepriv, deviceConfig); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -int sme_mgt_coex_info_get(unifi_priv_t *priv, CsrWifiSmeCoexInfo *coexInfo) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_coex_info_get: invalid smepriv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG4, "sme_mgt_coex_info_get: unifi_mgt_coex_info_get_req -->\n"); - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeCoexInfoGetReqSend(0); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - /* store the reply */ - if (coexInfo != NULL) - memcpy((unsigned char*)coexInfo, - (unsigned char*)&priv->sme_reply.coexInfo, - sizeof(CsrWifiSmeCoexInfo)); - - unifi_trace(priv, UDBG4, - "sme_mgt_coex_info_get: unifi_mgt_coex_info_get_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtCoexInfoGetReq(priv->smepriv, coexInfo); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -#ifdef CSR_SUPPORT_WEXT - -int sme_mgt_coex_config_get(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_coex_config_get: invalid smepriv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG4, "sme_mgt_coex_config_get: unifi_mgt_coex_config_get_req -->\n"); - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeCoexConfigGetReqSend(0); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - /* store the reply */ - if (coexConfig != NULL) - memcpy((unsigned char*)coexConfig, - (unsigned char*)&priv->sme_reply.coexConfig, - sizeof(CsrWifiSmeCoexConfig)); - - unifi_trace(priv, UDBG4, - "sme_mgt_coex_config_get: unifi_mgt_coex_config_get_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtCoexConfigGetReq(priv->smepriv, coexConfig); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -int sme_mgt_mib_config_get(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_mib_config_get: invalid smepriv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG4, "sme_mgt_mib_config_get: unifi_mgt_mib_config_get_req -->\n"); - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeMibConfigGetReqSend(0); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - /* store the reply */ - if (mibConfig != NULL) - memcpy((unsigned char*)mibConfig, - (unsigned char*)&priv->sme_reply.mibConfig, - sizeof(CsrWifiSmeMibConfig)); - - unifi_trace(priv, UDBG4, - "sme_mgt_mib_config_get: unifi_mgt_mib_config_get_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtMibConfigGetReq(priv->smepriv, mibConfig); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -int sme_mgt_connection_info_get(unifi_priv_t *priv, CsrWifiSmeConnectionInfo *connectionInfo) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_connection_info_get: invalid smepriv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG4, "sme_mgt_connection_info_get: unifi_mgt_connection_info_get_req -->\n"); - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeConnectionInfoGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - /* store the reply */ - if (connectionInfo != NULL) - memcpy((unsigned char*)connectionInfo, - (unsigned char*)&priv->sme_reply.connectionInfo, - sizeof(CsrWifiSmeConnectionInfo)); - - unifi_trace(priv, UDBG4, - "sme_mgt_connection_info_get: unifi_mgt_connection_info_get_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtConnectionInfoGetReq(priv->smepriv, connectionInfo); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -int sme_mgt_connection_config_get(unifi_priv_t *priv, CsrWifiSmeConnectionConfig *connectionConfig) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_connection_config_get: invalid smepriv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG4, "sme_mgt_connection_config_get: unifi_mgt_connection_config_get_req -->\n"); - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeConnectionConfigGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - /* store the reply */ - if (connectionConfig != NULL) - memcpy((unsigned char*)connectionConfig, - (unsigned char*)&priv->sme_reply.connectionConfig, - sizeof(CsrWifiSmeConnectionConfig)); - - unifi_trace(priv, UDBG4, - "sme_mgt_connection_config_get: unifi_mgt_connection_config_get_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtConnectionConfigGetReq(priv->smepriv, connectionConfig); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -int sme_mgt_connection_stats_get(unifi_priv_t *priv, CsrWifiSmeConnectionStats *connectionStats) -{ -#ifdef CSR_SME_USERSPACE - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_connection_stats_get: invalid smepriv\n"); - return -EIO; - } - - unifi_trace(priv, UDBG4, "sme_mgt_connection_stats_get: unifi_mgt_connection_stats_get_req -->\n"); - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeConnectionStatsGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - /* store the reply */ - if (connectionStats != NULL) - memcpy((unsigned char*)connectionStats, - (unsigned char*)&priv->sme_reply.connectionStats, - sizeof(CsrWifiSmeConnectionStats)); - - unifi_trace(priv, UDBG4, - "sme_mgt_connection_stats_get: unifi_mgt_connection_stats_get_req <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - - return convert_sme_error(priv->sme_reply.reply_status); -#else - CsrResult status; - CsrWifiSmeMgtClaimSyncAccess(priv->smepriv); - status = CsrWifiSmeMgtConnectionStatsGetReq(priv->smepriv, connectionStats); - CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv); - return convert_sme_error(status); -#endif -} - -#endif /* CSR_SUPPORT_WEXT */ - -int sme_mgt_packet_filter_set(unifi_priv_t *priv) -{ - CsrWifiIp4Address ipAddress = {{0xFF, 0xFF, 0xFF, 0xFF }}; - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_packet_filter_set: invalid smepriv\n"); - return -EIO; - } - if (priv->packet_filters.arp_filter) { - ipAddress.a[0] = (priv->sta_ip_address ) & 0xFF; - ipAddress.a[1] = (priv->sta_ip_address >> 8) & 0xFF; - ipAddress.a[2] = (priv->sta_ip_address >> 16) & 0xFF; - ipAddress.a[3] = (priv->sta_ip_address >> 24) & 0xFF; - } - - unifi_trace(priv, UDBG5, - "sme_mgt_packet_filter_set: IP address %d.%d.%d.%d\n", - ipAddress.a[0], ipAddress.a[1], - ipAddress.a[2], ipAddress.a[3]); - - /* Doesn't block for a confirm */ - CsrWifiSmePacketFilterSetReqSend(0, CSR_WIFI_INTERFACE_IN_USE, - priv->packet_filters.tclas_ies_length, - priv->filter_tclas_ies, - priv->packet_filters.filter_mode, - ipAddress); - return 0; -} - -int sme_mgt_tspec(unifi_priv_t *priv, CsrWifiSmeListAction action, - u32 tid, CsrWifiSmeDataBlock *tspec, CsrWifiSmeDataBlock *tclas) -{ - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_mgt_tspec: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiSmeTspecReqSend(0, CSR_WIFI_INTERFACE_IN_USE, - action, tid, TRUE, 0, - tspec->length, tspec->data, - tclas->length, tclas->data); - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, "sme_mgt_tspec: <-- (status=%d)\n", priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -} - - - -int sme_sys_suspend(unifi_priv_t *priv) -{ - int r; - CsrResult csrResult; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_sys_suspend: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - /* Suspend the SME, which MAY cause it to power down UniFi */ - CsrWifiRouterCtrlSuspendIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, 0, priv->wol_suspend); - r = sme_wait_for_reply(priv, UNIFI_SME_SYS_LONG_TIMEOUT); - if (r) { - /* No reply - forcibly power down in case the request wasn't processed */ - unifi_notice(priv, - "suspend: SME did not reply %s, ", - (priv->ptest_mode | priv->wol_suspend) ? "leave powered" : "power off UniFi anyway\n"); - - /* Leave power on for production test, though */ - if (!priv->ptest_mode) { - /* Put UniFi to deep sleep, in case we can not power it off */ - CsrSdioClaim(priv->sdio); - unifi_trace(priv, UDBG1, "Force deep sleep"); - csrResult = unifi_force_low_power_mode(priv->card); - - /* For WOL, the UniFi must stay powered */ - if (!priv->wol_suspend) { - unifi_trace(priv, UDBG1, "Power off\n"); - CsrSdioPowerOff(priv->sdio); - } - CsrSdioRelease(priv->sdio); - } - } - - if (priv->wol_suspend) { - unifi_trace(priv, UDBG1, "UniFi left powered for WOL\n"); - - /* Remove the IRQ, which also disables the card SDIO interrupt. - * Disabling the card SDIO interrupt enables the PIO WOL source. - * Removal of the of the handler ensures that in both SDIO and PIO cases - * the card interrupt only wakes the host. The card will be polled - * after resume to handle any pending data. - */ - if (csr_sdio_linux_remove_irq(priv->sdio)) { - unifi_notice(priv, "WOL csr_sdio_linux_remove_irq failed\n"); - } - - if (enable_wol == UNIFI_WOL_SDIO) { - /* Because csr_sdio_linux_remove_irq() disabled the card SDIO interrupt, - * it must be left enabled to wake-on-SDIO. - */ - unifi_trace(priv, UDBG1, "Enable card SDIO interrupt for SDIO WOL\n"); - - CsrSdioClaim(priv->sdio); - csrResult = CsrSdioInterruptEnable(priv->sdio); - CsrSdioRelease(priv->sdio); - - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "WOL CsrSdioInterruptEnable failed %d\n", csrResult); - } - } else { - unifi_trace(priv, UDBG1, "Disabled card SDIO interrupt for PIO WOL\n"); - } - - /* Prevent the BH thread from running during the suspend. - * Upon resume, sme_sys_resume() will trigger a wifi-on, this will cause - * the BH thread to be re-enabled and reinstall the ISR. - */ - priv->bh_thread.block_thread = 1; - - unifi_trace(priv, UDBG1, "unifi_suspend: suspended BH"); - } - - /* Consider UniFi to be uninitialised */ - priv->init_progress = UNIFI_INIT_NONE; - - unifi_trace(priv, UDBG1, "sme_sys_suspend: <-- (r=%d status=%d)\n", r, priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -} - - -int sme_sys_resume(unifi_priv_t *priv) -{ - int r; - - unifi_trace(priv, UDBG1, "sme_sys_resume %s\n", priv->wol_suspend ? "warm" : ""); - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_sys_resume: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiRouterCtrlResumeIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, priv->wol_suspend); - - r = sme_wait_for_reply(priv, UNIFI_SME_SYS_LONG_TIMEOUT); - if (r) - unifi_notice(priv, - "resume: SME did not reply, return success anyway\n"); - - return 0; -} - -#ifdef CSR_SUPPORT_WEXT_AP -int sme_ap_stop(unifi_priv_t *priv, u16 interface_tag) -{ - int r; - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_ap_stop: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiNmeApStopReqSend(0, interface_tag); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, - "sme_ap_stop <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); - -} - -int sme_ap_start(unifi_priv_t *priv, u16 interface_tag, - CsrWifiSmeApConfig_t * ap_config) -{ - int r; - CsrWifiSmeApP2pGoConfig p2p_go_param; - memset(&p2p_go_param, 0, sizeof(CsrWifiSmeApP2pGoConfig)); - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_ap_start: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiNmeApStartReqSend(0, interface_tag, CSR_WIFI_AP_TYPE_LEGACY, FALSE, - ap_config->ssid, 1, ap_config->channel, - ap_config->credentials, ap_config->max_connections, - p2p_go_param, FALSE); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, - "sme_ap_start <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -} - -int sme_ap_config(unifi_priv_t *priv, - CsrWifiSmeApMacConfig *ap_mac_config, - CsrWifiNmeApConfig *group_security_config) -{ - int r; - CsrWifiSmeApP2pGoConfig p2p_go_param; - memset(&p2p_go_param, 0, sizeof(CsrWifiSmeApP2pGoConfig)); - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_ap_config: invalid smepriv\n"); - return -EIO; - } - - r = sme_init_request(priv); - if (r) - return -EIO; - - CsrWifiNmeApConfigSetReqSend(0, *group_security_config, - *ap_mac_config); - - r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT); - if (r) - return r; - - unifi_trace(priv, UDBG4, - "sme_ap_config <-- (r=%d status=%d)\n", - r, priv->sme_reply.reply_status); - return convert_sme_error(priv->sme_reply.reply_status); -} -#endif diff --git a/drivers/staging/csr/sme_mgt.c b/drivers/staging/csr/sme_mgt.c deleted file mode 100644 index 58d1b3b72932..000000000000 --- a/drivers/staging/csr/sme_mgt.c +++ /dev/null @@ -1,1012 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: sme_mgt.c - * - * PURPOSE: - * This file contains the driver specific implementation of - * the SME MGT SAP. - * It is part of the porting exercise. - * - * Copyright (C) 2008-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ - -#include "csr_wifi_hip_unifiversion.h" -#include "unifi_priv.h" -#include "csr_wifi_hip_conversions.h" -/* - * This file implements the SME MGT API. It contains the following functions: - * CsrWifiSmeWifiFlightmodeCfmSend() - * CsrWifiSmeWifiOnCfmSend() - * CsrWifiSmeWifiOffCfmSend() - * CsrWifiSmeWifiOffIndSend() - * CsrWifiSmeScanFullCfmSend() - * CsrWifiSmeScanResultsGetCfmSend() - * CsrWifiSmeScanResultIndSend() - * CsrWifiSmeScanResultsFlushCfmSend() - * CsrWifiSmeConnectCfmSend() - * CsrWifiSmeMediaStatusIndSend() - * CsrWifiSmeDisconnectCfmSend() - * CsrWifiSmeKeyCfmSend() - * CsrWifiSmeMulticastAddressCfmSend() - * CsrWifiSmeSetValueCfmSend() - * CsrWifiSmeGetValueCfmSend() - * CsrWifiSmeMicFailureIndSend() - * CsrWifiSmePmkidCfmSend() - * CsrWifiSmePmkidCandidateListIndSend() - * CsrWifiSmeMibSetCfmSend() - * CsrWifiSmeMibGetCfmSend() - * CsrWifiSmeMibGetNextCfmSend() - * CsrWifiSmeConnectionQualityIndSend() - * CsrWifiSmePacketFilterSetCfmSend() - * CsrWifiSmeTspecCfmSend() - * CsrWifiSmeTspecIndSend() - * CsrWifiSmeBlacklistCfmSend() - * CsrWifiSmeEventMaskSetCfmSend() - * CsrWifiSmeRoamStartIndSend() - * CsrWifiSmeRoamCompleteIndSend() - * CsrWifiSmeAssociationStartIndSend() - * CsrWifiSmeAssociationCompleteIndSend() - * CsrWifiSmeIbssStationIndSend() - */ - - -void CsrWifiSmeMicFailureIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeMicFailureInd* ind = (CsrWifiSmeMicFailureInd*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeMicFailureIndSend: invalid priv\n"); - return; - } - - unifi_trace(priv, UDBG1, - "CsrWifiSmeMicFailureIndSend: count=%d, KeyType=%d\n", - ind->count, ind->keyType); - - wext_send_michaelmicfailure_event(priv, ind->count, ind->address, ind->keyType, ind->interfaceTag); -#endif -} - - -void CsrWifiSmePmkidCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmePmkidCfm* cfm = (CsrWifiSmePmkidCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmePmkidCfmSend: Invalid ospriv.\n"); - return; - } - - /* - * WEXT never does a GET operation the PMKIDs, so we don't need - * handle data returned in pmkids. - */ - - sme_complete_request(priv, cfm->status); -#endif -} - - -void CsrWifiSmePmkidCandidateListIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmePmkidCandidateListInd* ind = (CsrWifiSmePmkidCandidateListInd*)msg; - int i; - - if (priv->smepriv == NULL) { - unifi_error(priv, "CsrWifiSmePmkidCandidateListIndSend: invalid smepriv\n"); - return; - } - - for (i = 0; i < ind->pmkidCandidatesCount; i++) - { - wext_send_pmkid_candidate_event(priv, ind->pmkidCandidates[i].bssid, ind->pmkidCandidates[i].preAuthAllowed, ind->interfaceTag); - } -#endif -} - -void CsrWifiSmeScanResultsFlushCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeScanResultsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeScanResultsGetCfm* cfm = (CsrWifiSmeScanResultsGetCfm*)msg; - int bytesRequired = cfm->scanResultsCount * sizeof(CsrWifiSmeScanResult); - int i; - u8* current_buff; - CsrWifiSmeScanResult* scanCopy; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeScanResultsGetCfmSend: Invalid ospriv.\n"); - return; - } - - /* Calc the size of the buffer reuired */ - for (i = 0; i < cfm->scanResultsCount; ++i) { - const CsrWifiSmeScanResult *scan_result = &cfm->scanResults[i]; - bytesRequired += scan_result->informationElementsLength; - } - - /* Take a Copy of the scan Results :-) */ - scanCopy = kmalloc(bytesRequired, GFP_KERNEL); - memcpy(scanCopy, cfm->scanResults, sizeof(CsrWifiSmeScanResult) * cfm->scanResultsCount); - - /* Take a Copy of the Info Elements AND update the scan result pointers */ - current_buff = (u8*)&scanCopy[cfm->scanResultsCount]; - for (i = 0; i < cfm->scanResultsCount; ++i) - { - CsrWifiSmeScanResult *scan_result = &scanCopy[i]; - memcpy(current_buff, scan_result->informationElements, scan_result->informationElementsLength); - scan_result->informationElements = current_buff; - current_buff += scan_result->informationElementsLength; - } - - priv->sme_reply.reply_scan_results_count = cfm->scanResultsCount; - priv->sme_reply.reply_scan_results = scanCopy; - - sme_complete_request(priv, cfm->status); -#endif -} - - -void CsrWifiSmeScanFullCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeScanFullCfm* cfm = (CsrWifiSmeScanFullCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeScanFullCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - - -void CsrWifiSmeScanResultIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - -} - - -void CsrWifiSmeConnectCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeConnectCfm* cfm = (CsrWifiSmeConnectCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeConnectCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - - -void CsrWifiSmeDisconnectCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeDisconnectCfm* cfm = (CsrWifiSmeDisconnectCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeDisconnectCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - - -void CsrWifiSmeKeyCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeKeyCfm* cfm = (CsrWifiSmeKeyCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeKeyCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - - -void CsrWifiSmeMulticastAddressCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeMulticastAddressCfm* cfm = (CsrWifiSmeMulticastAddressCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeMulticastAddressCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeWifiFlightmodeCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeWifiFlightmodeCfm* cfm = (CsrWifiSmeWifiFlightmodeCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeWifiFlightmodeCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeWifiOnCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeWifiOnCfm* cfm = (CsrWifiSmeWifiOnCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeWifiOnCfmSend: Invalid ospriv.\n"); - return; - } - - unifi_trace(priv, UDBG4, - "CsrWifiSmeWifiOnCfmSend: wake up status %d\n", cfm->status); -#ifdef CSR_SUPPORT_WEXT_AP - sme_complete_request(priv, cfm->status); -#endif - -#endif -} - -void CsrWifiSmeWifiOffCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeWifiOffCfm* cfm = (CsrWifiSmeWifiOffCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeWifiOffCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - - -void CsrWifiSmeWifiOffIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeWifiOffInd* ind = (CsrWifiSmeWifiOffInd*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiRouterCtrlStoppedReqSend: Invalid ospriv.\n"); - return; - } - - if (priv->smepriv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlStoppedReqSend: invalid smepriv\n"); - return; - } - - /* - * If the status indicates an error, the SME is in a stopped state. - * We need to start it again in order to reinitialise UniFi. - */ - switch (ind->reason) { - case CSR_WIFI_SME_CONTROL_INDICATION_ERROR: - unifi_trace(priv, UDBG1, - "CsrWifiRouterCtrlStoppedReqSend: Restarting SME (ind:%d)\n", - ind->reason); - - /* On error, restart the SME */ - sme_mgt_wifi_on(priv); - break; - case CSR_WIFI_SME_CONTROL_INDICATION_EXIT: -#ifdef CSR_SUPPORT_WEXT_AP - sme_complete_request(priv, 0); -#endif - break; - default: - break; - } - -#endif -} - -void CsrWifiSmeVersionsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeVersionsGetCfm* cfm = (CsrWifiSmeVersionsGetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeVersionsGetCfmSend: Invalid ospriv.\n"); - return; - } - - priv->sme_reply.versions = cfm->versions; - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmePowerConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmePowerConfigGetCfm* cfm = (CsrWifiSmePowerConfigGetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmePowerConfigGetCfmSend: Invalid ospriv.\n"); - return; - } - - priv->sme_reply.powerConfig = cfm->powerConfig; - sme_complete_request(priv, cfm->status); -} - -void CsrWifiSmeHostConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeHostConfigGetCfm* cfm = (CsrWifiSmeHostConfigGetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeHostConfigGetCfmSend: Invalid ospriv.\n"); - return; - } - - priv->sme_reply.hostConfig = cfm->hostConfig; - sme_complete_request(priv, cfm->status); -} - -void CsrWifiSmeCoexInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeCoexInfoGetCfm* cfm = (CsrWifiSmeCoexInfoGetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeCoexInfoGetCfmSend: Invalid ospriv.\n"); - return; - } - - priv->sme_reply.coexInfo = cfm->coexInfo; - sme_complete_request(priv, cfm->status); -} - -void CsrWifiSmeCoexConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeCoexConfigGetCfm* cfm = (CsrWifiSmeCoexConfigGetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeCoexConfigGetCfmSend: Invalid ospriv.\n"); - return; - } - - priv->sme_reply.coexConfig = cfm->coexConfig; - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeMibConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeMibConfigGetCfm* cfm = (CsrWifiSmeMibConfigGetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeMibConfigGetCfmSend: Invalid ospriv.\n"); - return; - } - - priv->sme_reply.mibConfig = cfm->mibConfig; - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeConnectionInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeConnectionInfoGetCfm* cfm = (CsrWifiSmeConnectionInfoGetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeConnectionInfoGetCfmSend: Invalid ospriv.\n"); - return; - } - - priv->sme_reply.connectionInfo = cfm->connectionInfo; - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeConnectionConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeConnectionConfigGetCfm* cfm = (CsrWifiSmeConnectionConfigGetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeConnectionConfigGetCfmSend: Invalid ospriv.\n"); - return; - } - - priv->sme_reply.connectionConfig = cfm->connectionConfig; - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeConnectionStatsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeConnectionStatsGetCfm* cfm = (CsrWifiSmeConnectionStatsGetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeConnectionStatsGetCfmSend: Invalid ospriv.\n"); - return; - } - - priv->sme_reply.connectionStats = cfm->connectionStats; - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeMibSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeMibSetCfm* cfm = (CsrWifiSmeMibSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeMibSetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeMibGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeMibGetCfm* cfm = (CsrWifiSmeMibGetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeMibGetCfmSend: Invalid ospriv.\n"); - return; - } - - if (cfm->mibAttribute == NULL) { - unifi_error(priv, "CsrWifiSmeMibGetCfmSend: Empty reply.\n"); - sme_complete_request(priv, cfm->status); - return; - } - - if ((priv->mib_cfm_buffer != NULL) && - (priv->mib_cfm_buffer_length >= cfm->mibAttributeLength)) { - memcpy(priv->mib_cfm_buffer, cfm->mibAttribute, cfm->mibAttributeLength); - priv->mib_cfm_buffer_length = cfm->mibAttributeLength; - } else { - unifi_error(priv, - "CsrWifiSmeMibGetCfmSend: No room to store MIB data (have=%d need=%d).\n", - priv->mib_cfm_buffer_length, cfm->mibAttributeLength); - } - - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeMibGetNextCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeMibGetNextCfm* cfm = (CsrWifiSmeMibGetNextCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeMibGetNextCfmSend: Invalid ospriv.\n"); - return; - } - - /* Need to copy MIB data */ - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeConnectionQualityIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeConnectionQualityInd* ind = (CsrWifiSmeConnectionQualityInd*)msg; - int signal, noise, snr; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeConnectionQualityIndSend: Invalid ospriv.\n"); - return; - } - - /* - * level and noise below are mapped into an unsigned 8 bit number, - * ranging from [-192; 63]. The way this is achieved is simply to - * add 0x100 onto the number if it is negative, - * once clipped to the correct range. - */ - signal = ind->linkQuality.unifiRssi; - /* Clip range of snr */ - snr = (ind->linkQuality.unifiSnr > 0) ? ind->linkQuality.unifiSnr : 0; /* In dB relative, from 0 - 255 */ - snr = (snr < 255) ? snr : 255; - noise = signal - snr; - - /* Clip range of signal */ - signal = (signal < 63) ? signal : 63; - signal = (signal > -192) ? signal : -192; - - /* Clip range of noise */ - noise = (noise < 63) ? noise : 63; - noise = (noise > -192) ? noise : -192; - - /* Make u8 */ - signal = ( signal < 0 ) ? signal + 0x100 : signal; - noise = ( noise < 0 ) ? noise + 0x100 : noise; - - priv->wext_wireless_stats.qual.level = (u8)signal; /* -192 : 63 */ - priv->wext_wireless_stats.qual.noise = (u8)noise; /* -192 : 63 */ - priv->wext_wireless_stats.qual.qual = snr; /* 0 : 255 */ - priv->wext_wireless_stats.qual.updated = 0; - -#if WIRELESS_EXT > 16 - priv->wext_wireless_stats.qual.updated |= IW_QUAL_LEVEL_UPDATED | - IW_QUAL_NOISE_UPDATED | - IW_QUAL_QUAL_UPDATED; -#if WIRELESS_EXT > 18 - priv->wext_wireless_stats.qual.updated |= IW_QUAL_DBM; -#endif -#endif -#endif -} - -void CsrWifiSmePacketFilterSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmePacketFilterSetCfmSend: Invalid ospriv.\n"); - return; - } - - /* The packet filter set request does not block for a reply */ -} - -void CsrWifiSmeTspecCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeTspecCfm* cfm = (CsrWifiSmeTspecCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeTspecCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -} - -void CsrWifiSmeTspecIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeBlacklistCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeEventMaskSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - - -void CsrWifiSmeRoamStartIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeRoamCompleteIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - /* This is called when the association completes, before any 802.1x authentication */ -} - -void CsrWifiSmeAssociationStartIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeAssociationCompleteIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeIbssStationIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeWifiOnIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeRestrictedAccessEnableCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeRestrictedAccessDisableCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - - -void CsrWifiSmeAdhocConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeAdhocConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeAdhocConfigSetCfm* cfm = (CsrWifiSmeAdhocConfigSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeCalibrationDataGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeCalibrationDataSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeCalibrationDataSetCfm* cfm = (CsrWifiSmeCalibrationDataSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeCcxConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeCcxConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeCcxConfigSetCfm* cfm = (CsrWifiSmeCcxConfigSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeCloakedSsidsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeCloakedSsidsSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeCloakedSsidsSetCfm* cfm = (CsrWifiSmeCloakedSsidsSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - - -void CsrWifiSmeCoexConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeCoexConfigSetCfm* cfm = (CsrWifiSmeCoexConfigSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeHostConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeHostConfigSetCfm* cfm = (CsrWifiSmeHostConfigSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -} - -void CsrWifiSmeLinkQualityGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - - -void CsrWifiSmeMibConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeMibConfigSetCfm* cfm = (CsrWifiSmeMibConfigSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmePermanentMacAddressGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmePowerConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmePowerConfigSetCfm* cfm = (CsrWifiSmePowerConfigSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -} - -void CsrWifiSmeRegulatoryDomainInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeRoamingConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeMediaStatusIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeMediaStatusInd* ind = (CsrWifiSmeMediaStatusInd*)msg; - - if (priv->smepriv == NULL) { - unifi_error(priv, "CsrWifiSmeMediaStatusIndSend: invalid smepriv\n"); - return; - } - - if (ind->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_CONNECTED) { - /* - * Send wireless-extension event up to userland to announce - * connection. - */ - wext_send_assoc_event(priv, - (unsigned char *)ind->connectionInfo.bssid.a, - (unsigned char *)ind->connectionInfo.assocReqInfoElements, - ind->connectionInfo.assocReqInfoElementsLength, - (unsigned char *)ind->connectionInfo.assocRspInfoElements, - ind->connectionInfo.assocRspInfoElementsLength, - (unsigned char *)ind->connectionInfo.assocScanInfoElements, - ind->connectionInfo.assocScanInfoElementsLength); - - unifi_trace(priv, UDBG2, "CsrWifiSmeMediaStatusIndSend: IBSS=%pM\n", - ind->connectionInfo.bssid.a); - - sme_mgt_packet_filter_set(priv); - - } else { - /* - * Send wireless-extension event up to userland to announce - * connection lost to a BSS. - */ - wext_send_disassoc_event(priv); - } -#endif -} - -void CsrWifiSmeRoamingConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeRoamingConfigSetCfm* cfm = (CsrWifiSmeRoamingConfigSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeRoamingConfigSetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -} - -void CsrWifiSmeScanConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeScanConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_SUPPORT_WEXT - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeScanConfigSetCfm* cfm = (CsrWifiSmeScanConfigSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -#endif -} - -void CsrWifiSmeStationMacAddressGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeSmeCommonConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeSmeCommonConfigGetCfm* cfm = (CsrWifiSmeSmeCommonConfigGetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeCommonConfigGetCfmSend: Invalid ospriv.\n"); - return; - } - - priv->sme_reply.deviceConfig = cfm->deviceConfig; - sme_complete_request(priv, cfm->status); -} - -void CsrWifiSmeSmeStaConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeSmeStaConfigGetCfm* cfm = (CsrWifiSmeSmeStaConfigGetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeStaConfigGetCfmSend: Invalid ospriv.\n"); - return; - } - - priv->sme_reply.staConfig = cfm->smeConfig; - sme_complete_request(priv, cfm->status); -} - -void CsrWifiSmeSmeCommonConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeSmeCommonConfigSetCfm* cfm = (CsrWifiSmeSmeCommonConfigSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeCommonConfigGetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -} - -void CsrWifiSmeSmeStaConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiSmeSmeStaConfigSetCfm* cfm = (CsrWifiSmeSmeStaConfigSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiSmeSmeStaConfigGetCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -} - -void CsrWifiSmeGetInterfaceCapabilityCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeErrorIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeInfoIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeCoreDumpIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} -void CsrWifiSmeAmpStatusChangeIndHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiSmeActivateCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} -void CsrWifiSmeDeactivateCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -#ifdef CSR_SUPPORT_WEXT -#ifdef CSR_SUPPORT_WEXT_AP -void CsrWifiNmeApStartCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiNmeApStartCfm* cfm = (CsrWifiNmeApStartCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiNmeApStartCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -} - -void CsrWifiNmeApStopCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiNmeApStopCfm* cfm = (CsrWifiNmeApStopCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiNmeApStopCfmSend: Invalid ospriv.\n"); - return; - } - - sme_complete_request(priv, cfm->status); -} - -void CsrWifiNmeApConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiNmeApConfigSetCfm* cfm = (CsrWifiNmeApConfigSetCfm*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiNmeApConfigSetCfmSend: Invalid ospriv.\n"); - return; - } - sme_complete_request(priv, cfm->status); -} -#endif -#endif diff --git a/drivers/staging/csr/sme_native.c b/drivers/staging/csr/sme_native.c deleted file mode 100644 index d0b9be31e12c..000000000000 --- a/drivers/staging/csr/sme_native.c +++ /dev/null @@ -1,566 +0,0 @@ -/* - * *************************************************************************** - * - * FILE: sme_native.c - * - * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * *************************************************************************** - */ - -#include <linux/netdevice.h> -#include "unifi_priv.h" -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_conversions.h" - -static const unsigned char wildcard_address[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -int -uf_sme_init(unifi_priv_t *priv) -{ - sema_init(&priv->mlme_blocking_mutex, 1); - -#ifdef CSR_SUPPORT_WEXT - { - int r = uf_init_wext_interface(priv); - if (r != 0) { - return r; - } - } -#endif - - return 0; -} /* uf_sme_init() */ - - -void -uf_sme_deinit(unifi_priv_t *priv) -{ - - /* Free memory allocated for the scan table */ -/* unifi_clear_scan_table(priv); */ - - /* Cancel any pending workqueue tasks */ - flush_workqueue(priv->unifi_workqueue); - -#ifdef CSR_SUPPORT_WEXT - uf_deinit_wext_interface(priv); -#endif - -} /* uf_sme_deinit() */ - - -int sme_mgt_wifi_on(unifi_priv_t *priv) -{ - int r, i; - s32 csrResult; - - if (priv == NULL) { - return -EINVAL; - } - /* Initialize the interface mode to None */ - for (i=0; i<CSR_WIFI_NUM_INTERFACES; i++) { - priv->interfacePriv[i]->interfaceMode = 0; - } - - /* Set up interface mode so that get_packet_priority() can - * select the right QOS priority when WMM is enabled. - */ - priv->interfacePriv[0]->interfaceMode = CSR_WIFI_ROUTER_CTRL_MODE_STA; - - r = uf_request_firmware_files(priv, UNIFI_FW_STA); - if (r) { - unifi_error(priv, "sme_mgt_wifi_on: Failed to get f/w\n"); - return r; - } - - /* - * The request to initialise UniFi might come while UniFi is running. - * We need to block all I/O activity until the reset completes, otherwise - * an SDIO error might occur resulting an indication to the SME which - * makes it think that the initialisation has failed. - */ - priv->bh_thread.block_thread = 1; - - /* Power on UniFi */ - CsrSdioClaim(priv->sdio); - csrResult = CsrSdioPowerOn(priv->sdio); - CsrSdioRelease(priv->sdio); - if(csrResult != CSR_RESULT_SUCCESS && csrResult != CSR_SDIO_RESULT_NOT_RESET) { - return -EIO; - } - - if (csrResult == CSR_RESULT_SUCCESS) { - /* Initialise UniFi hardware */ - r = uf_init_hw(priv); - if (r) { - return r; - } - } - - /* Re-enable the I/O thread */ - priv->bh_thread.block_thread = 0; - - /* Disable deep sleep signalling during the firmware initialisation, to - * prevent the wakeup mechanism raising the SDIO clock beyond INIT before - * the first MLME-RESET.ind. It gets re-enabled at the CONNECTED.ind, - * immediately after the MLME-RESET.ind - */ - csrResult = unifi_configure_low_power_mode(priv->card, - UNIFI_LOW_POWER_DISABLED, - UNIFI_PERIODIC_WAKE_HOST_DISABLED); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_warning(priv, - "sme_mgt_wifi_on: unifi_configure_low_power_mode() returned an error\n"); - } - - - /* Start the I/O thread */ - CsrSdioClaim(priv->sdio); - r = uf_init_bh(priv); - if (r) { - CsrSdioPowerOff(priv->sdio); - CsrSdioRelease(priv->sdio); - return r; - } - CsrSdioRelease(priv->sdio); - - priv->init_progress = UNIFI_INIT_FW_DOWNLOADED; - - return 0; -} - -int -sme_sys_suspend(unifi_priv_t *priv) -{ - const int interfaceNum = 0; /* FIXME */ - CsrResult csrResult; - - /* Abort any pending requests. */ - uf_abort_mlme(priv); - - /* Allow our mlme request to go through. */ - priv->io_aborted = 0; - - /* Send MLME-RESET.req to UniFi. */ - unifi_reset_state(priv, priv->netdev[interfaceNum]->dev_addr, 0); - - /* Stop the network traffic */ - netif_carrier_off(priv->netdev[interfaceNum]); - - /* Put UniFi to deep sleep */ - CsrSdioClaim(priv->sdio); - csrResult = unifi_force_low_power_mode(priv->card); - CsrSdioRelease(priv->sdio); - - return 0; -} /* sme_sys_suspend() */ - - -int -sme_sys_resume(unifi_priv_t *priv) -{ -#ifdef CSR_SUPPORT_WEXT - /* Send disconnect event so clients will re-initialise connection. */ - memset(priv->wext_conf.current_ssid, 0, UNIFI_MAX_SSID_LEN); - memset((void*)priv->wext_conf.current_bssid, 0, ETH_ALEN); - priv->wext_conf.capability = 0; - wext_send_disassoc_event(priv); -#endif - return 0; -} /* sme_sys_resume() */ - - -/* - * --------------------------------------------------------------------------- - * sme_native_log_event - * - * Callback function to be registered as the SME event callback. - * Copies the signal content into a new udi_log_t struct and adds - * it to the read queue for the SME client. - * - * Arguments: - * arg This is the value given to unifi_add_udi_hook, in - * this case a pointer to the client instance. - * signal Pointer to the received signal. - * signal_len Size of the signal structure in bytes. - * bulkdata Pointers to any associated bulk data. - * dir Direction of the signal. Zero means from host, - * non-zero means to host. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -sme_native_log_event(ul_client_t *pcli, - const u8 *sig_packed, int sig_len, - const bulk_data_param_t *bulkdata, - int dir) -{ - unifi_priv_t *priv; - udi_log_t *logptr; - u8 *p; - int i, r; - int signal_len; - int total_len; - udi_msg_t *msgptr; - CSR_SIGNAL signal; - ul_client_t *client = pcli; - - if (client == NULL) { - unifi_error(NULL, "sme_native_log_event: client has exited\n"); - return; - } - - priv = uf_find_instance(client->instance); - if (!priv) { - unifi_error(priv, "invalid priv\n"); - return; - } - - /* Just a sanity check */ - if ((sig_packed == NULL) || (sig_len <= 0)) { - return; - } - - /* Get the unpacked signal */ - r = read_unpack_signal(sig_packed, &signal); - if (r == 0) { - signal_len = SigGetSize(&signal); - } else { - u16 receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sig_packed) + sizeof(u16)) & 0xFF00; - - /* The control indications are 1 byte, pass them to client. */ - if (sig_len == 1) { - unifi_trace(priv, UDBG5, - "Control indication (0x%x) for native SME.\n", - *sig_packed); - - *(u8*)&signal = *sig_packed; - signal_len = sig_len; - } else if (receiver_id == 0) { - /* - * Also "unknown" signals with a ReceiverId of 0 are passed to the client - * without unpacking. (This is a code size optimisation to allow signals - * that the driver not interested in to be dropped from the unpack code). - */ - unifi_trace(priv, UDBG5, - "Signal 0x%.4X with ReceiverId 0 for native SME.\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sig_packed)); - - *(u8*)&signal = *sig_packed; - signal_len = sig_len; - } else { - unifi_error(priv, - "sme_native_log_event - Received unknown signal 0x%.4X.\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sig_packed)); - return; - } - } - - unifi_trace(priv, UDBG3, "sme_native_log_event: signal 0x%.4X for %d\n", - signal.SignalPrimitiveHeader.SignalId, - client->client_id); - - total_len = signal_len; - /* Calculate the buffer we need to store signal plus bulk data */ - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - total_len += bulkdata->d[i].data_length; - } - - /* Allocate log structure plus actual signal. */ - logptr = kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL); - - if (logptr == NULL) { - unifi_error(priv, - "Failed to allocate %d bytes for a UDI log record\n", - sizeof(udi_log_t) + total_len); - return; - } - - /* Fill in udi_log struct */ - INIT_LIST_HEAD(&logptr->q); - msgptr = &logptr->msg; - msgptr->length = sizeof(udi_msg_t) + total_len; - msgptr->timestamp = jiffies_to_msecs(jiffies); - msgptr->direction = dir; - msgptr->signal_length = signal_len; - - /* Copy signal and bulk data to the log */ - p = (u8 *)(msgptr + 1); - memcpy(p, &signal, signal_len); - p += signal_len; - - /* Append any bulk data */ - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - int len = bulkdata->d[i].data_length; - - /* - * Len here might not be the same as the length in the bulk data slot. - * The slot length will always be even, but len could be odd. - */ - if (len > 0) { - if (bulkdata->d[i].os_data_ptr) { - memcpy(p, bulkdata->d[i].os_data_ptr, len); - } else { - memset(p, 0, len); - } - p += len; - } - } - - /* Add to tail of log queue */ - down(&client->udi_sem); - list_add_tail(&logptr->q, &client->udi_log); - up(&client->udi_sem); - - /* Wake any waiting user process */ - wake_up_interruptible(&client->udi_wq); - -} /* sme_native_log_event() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_ta_indicate_protocol - * - * Report that a packet of a particular type has been seen - * - * Arguments: - * drv_priv The device context pointer passed to ta_init. - * protocol The protocol type enum value. - * direction Whether the packet was a tx or rx. - * src_addr The source MAC address from the data packet. - * - * Returns: - * None. - * - * Notes: - * We defer the actual sending to a background workqueue, - * see uf_ta_ind_wq(). - * --------------------------------------------------------------------------- - */ -void -unifi_ta_indicate_protocol(void *ospriv, - CsrWifiRouterCtrlTrafficPacketType packet_type, - CsrWifiRouterCtrlProtocolDirection direction, - const CsrWifiMacAddress *src_addr) -{ - -} /* unifi_ta_indicate_protocol */ - -/* - * --------------------------------------------------------------------------- - * unifi_ta_indicate_sampling - * - * Send the TA sampling information to the SME. - * - * Arguments: - * drv_priv The device context pointer passed to ta_init. - * stats The TA sampling data to send. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats) -{ - -} /* unifi_ta_indicate_sampling() */ - - -void -unifi_ta_indicate_l4stats(void *ospriv, - u32 rxTcpThroughput, - u32 txTcpThroughput, - u32 rxUdpThroughput, - u32 txUdpThroughput) -{ - -} /* unifi_ta_indicate_l4stats() */ - -/* - * --------------------------------------------------------------------------- - * uf_native_process_udi_signal - * - * Process interesting signals from the UDI interface. - * - * Arguments: - * pcli A pointer to the client instance. - * signal Pointer to the received signal. - * signal_len Size of the signal structure in bytes. - * bulkdata Pointers to any associated bulk data. - * dir Direction of the signal. Zero means from host, - * non-zero means to host. - * - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -uf_native_process_udi_signal(ul_client_t *pcli, - const u8 *packed_signal, int packed_signal_len, - const bulk_data_param_t *bulkdata, int dir) -{ - -} /* uf_native_process_udi_signal() */ - - -/* - * --------------------------------------------------------------------------- - * sme_native_mlme_event_handler - * - * Callback function to be used as the udi_event_callback when registering - * as a client. - * This function implements a blocking request-reply interface for WEXT. - * To use it, a client specifies this function as the udi_event_callback - * to ul_register_client(). The signal dispatcher in - * unifi_receive_event() will call this function to deliver a signal. - * - * Arguments: - * pcli Pointer to the client instance. - * signal Pointer to the received signal. - * signal_len Size of the signal structure in bytes. - * bulkdata Pointer to structure containing any associated bulk data. - * dir Direction of the signal. Zero means from host, - * non-zero means to host. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -sme_native_mlme_event_handler(ul_client_t *pcli, - const u8 *sig_packed, int sig_len, - const bulk_data_param_t *bulkdata, - int dir) -{ - CSR_SIGNAL signal; - int signal_len; - unifi_priv_t *priv = uf_find_instance(pcli->instance); - int id, r; - - /* Just a sanity check */ - if ((sig_packed == NULL) || (sig_len <= 0)) { - return; - } - - /* Get the unpacked signal */ - r = read_unpack_signal(sig_packed, &signal); - if (r == 0) { - signal_len = SigGetSize(&signal); - } else { - unifi_error(priv, - "sme_native_mlme_event_handler - Received unknown signal 0x%.4X.\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sig_packed)); - return; - } - - id = signal.SignalPrimitiveHeader.SignalId; - unifi_trace(priv, UDBG4, "wext - Process signal 0x%.4X\n", id); - - /* - * Take the appropriate action for the signal. - */ - switch (id) { - /* - * Confirm replies from UniFi. - * These all have zero or one CSR_DATAREF member. (FIXME: check this is still true for softmac) - */ - case CSR_MA_PACKET_CONFIRM_ID: - case CSR_MLME_RESET_CONFIRM_ID: - case CSR_MLME_GET_CONFIRM_ID: - case CSR_MLME_SET_CONFIRM_ID: - case CSR_MLME_GET_NEXT_CONFIRM_ID: - case CSR_MLME_POWERMGT_CONFIRM_ID: - case CSR_MLME_SCAN_CONFIRM_ID: - case CSR_MLME_HL_SYNC_CONFIRM_ID: - case CSR_MLME_MEASURE_CONFIRM_ID: - case CSR_MLME_SETKEYS_CONFIRM_ID: - case CSR_MLME_DELETEKEYS_CONFIRM_ID: - case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID: - case CSR_MLME_ADD_PERIODIC_CONFIRM_ID: - case CSR_MLME_DEL_PERIODIC_CONFIRM_ID: - case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID: - case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID: - case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID: - case CSR_MLME_STOP_MEASURE_CONFIRM_ID: - case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID: - case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID: - case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID: - case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID: - case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID: - case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID: - case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID: - case CSR_MLME_CONNECT_STATUS_CONFIRM_ID: - case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID: - case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID: - case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID: - case CSR_MLME_ADD_TSPEC_CONFIRM_ID: - case CSR_MLME_DEL_TSPEC_CONFIRM_ID: - case CSR_MLME_START_AGGREGATION_CONFIRM_ID: - case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID: - case CSR_MLME_SM_START_CONFIRM_ID: - case CSR_MLME_LEAVE_CONFIRM_ID: - case CSR_MLME_SET_TIM_CONFIRM_ID: - case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID: - case CSR_MLME_SET_CHANNEL_CONFIRM_ID: - case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID: - case CSR_DEBUG_GENERIC_CONFIRM_ID: - unifi_mlme_copy_reply_and_wakeup_client(pcli, &signal, signal_len, bulkdata); - break; - - case CSR_MLME_CONNECTED_INDICATION_ID: - /* We currently ignore the connected-ind for softmac f/w development */ - unifi_info(priv, "CSR_MLME_CONNECTED_INDICATION_ID ignored\n"); - break; - - default: - break; - } - -} /* sme_native_mlme_event_handler() */ - - - -/* - * ------------------------------------------------------------------------- - * unifi_reset_state - * - * Ensure that a MAC address has been set. - * Send the MLME-RESET signal. - * This must be called at least once before starting to do any - * network activities (e.g. scan, join etc). - * - * Arguments: - * priv Pointer to device private context struct - * macaddr Pointer to chip MAC address. - * If this is FF:FF:FF:FF:FF:FF it will be replaced - * with the MAC address from the chip. - * set_default_mib 1 if the f/w must reset the MIB to the default values - * 0 otherwise - * - * Returns: - * 0 on success, an error code otherwise. - * ------------------------------------------------------------------------- - */ -int -unifi_reset_state(unifi_priv_t *priv, unsigned char *macaddr, - unsigned char set_default_mib) -{ - int r = 0; - -#ifdef CSR_SUPPORT_WEXT - /* The reset clears any 802.11 association. */ - priv->wext_conf.flag_associated = 0; -#endif - - return r; -} /* unifi_reset_state() */ - diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c deleted file mode 100644 index b5258d71d250..000000000000 --- a/drivers/staging/csr/sme_sys.c +++ /dev/null @@ -1,3260 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: sme_sys.c - * - * PURPOSE: - * Driver specific implementation of the SME SYS SAP. - * It is part of the porting exercise. - * - * Copyright (C) 2008-2011 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ - -#include "csr_wifi_hip_unifiversion.h" -#include "unifi_priv.h" -#include "csr_wifi_hip_conversions.h" -#ifdef CSR_SUPPORT_WEXT_AP -#include "csr_wifi_sme_sef.h" -#endif - -/* - * This file implements the SME SYS API and contains the following functions: - * CsrWifiRouterCtrlMediaStatusReqHandler() - * CsrWifiRouterCtrlHipReqHandler() - * CsrWifiRouterCtrlPortConfigureReqHandler() - * CsrWifiRouterCtrlWifiOnReqHandler() - * CsrWifiRouterCtrlWifiOffReqHandler() - * CsrWifiRouterCtrlSuspendResHandler() - * CsrWifiRouterCtrlResumeResHandler() - * CsrWifiRouterCtrlQosControlReqHandler() - * CsrWifiRouterCtrlConfigurePowerModeReqHandler() - * CsrWifiRouterCtrlWifiOnResHandler() - * CsrWifiRouterCtrlWifiOffRspHandler() - * CsrWifiRouterCtrlMulticastAddressResHandler() - * CsrWifiRouterCtrlTrafficConfigReqHandler() - * CsrWifiRouterCtrlTrafficClassificationReqHandler() - * CsrWifiRouterCtrlTclasAddReqHandler() - * CsrWifiRouterCtrlTclasDelReqHandler() - * CsrWifiRouterCtrlSetModeReqHandler() - * CsrWifiRouterCtrlWapiMulticastFilterReqHandler() - * CsrWifiRouterCtrlWapiUnicastFilterReqHandler() - * CsrWifiRouterCtrlWapiUnicastTxPktReqHandler() - * CsrWifiRouterCtrlWapiRxPktReqHandler() - * CsrWifiRouterCtrlWapiFilterReqHandler() - */ - -#ifdef CSR_SUPPORT_SME -static void check_inactivity_timer_expire_func(unsigned long data); -void uf_send_disconnected_ind_wq(struct work_struct *work); -#endif - -void send_auto_ma_packet_confirm(unifi_priv_t *priv, - netInterface_priv_t *interfacePriv, - struct list_head *buffered_frames_list) -{ - tx_buffered_packets_t *buffered_frame_item = NULL; - struct list_head *listHead; - struct list_head *placeHolder; - int client_id; - - CSR_SIGNAL unpacked_signal; - u8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; - u16 packed_siglen; - - - list_for_each_safe(listHead, placeHolder, buffered_frames_list) - { - buffered_frame_item = list_entry(listHead, tx_buffered_packets_t, q); - - if(!buffered_frame_item) { - unifi_error(priv, "Entry should exist, otherwise it is a (BUG)\n"); - continue; - } - - if ((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_NONE) && - (priv->wifi_on_state == wifi_on_done)) - { - - unifi_warning(priv, "Send MA_PACKET_CONFIRM to SenderProcessId = %x for (HostTag = %x TransmissionControl = %x)\n", - (buffered_frame_item->leSenderProcessId), - buffered_frame_item->hostTag, - buffered_frame_item->transmissionControl); - - client_id = buffered_frame_item->leSenderProcessId & 0xFF00; - - if (client_id == priv->sme_cli->sender_id) - { - /* construct a MA-PACKET.confirm message for SME */ - memset(&unpacked_signal, 0, sizeof(unpacked_signal)); - unpacked_signal.SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_CONFIRM_ID; - unpacked_signal.SignalPrimitiveHeader.ReceiverProcessId = buffered_frame_item->leSenderProcessId; - unpacked_signal.SignalPrimitiveHeader.SenderProcessId = CSR_WIFI_ROUTER_IFACEQUEUE; - - unpacked_signal.u.MaPacketConfirm.VirtualInterfaceIdentifier = uf_get_vif_identifier(interfacePriv->interfaceMode, - interfacePriv->InterfaceTag); - unpacked_signal.u.MaPacketConfirm.TransmissionStatus = CSR_RESULT_FAILURE; - unpacked_signal.u.MaPacketConfirm.RetryCount = 0; - unpacked_signal.u.MaPacketConfirm.Rate = buffered_frame_item->rate; - unpacked_signal.u.MaPacketConfirm.HostTag = buffered_frame_item->hostTag; - - write_pack(&unpacked_signal, sigbuf, &packed_siglen); - unifi_warning(priv, "MA_PACKET_CONFIRM for SME (0x%x, 0x%x, 0x%x, 0x%x)\n", - unpacked_signal.SignalPrimitiveHeader.ReceiverProcessId, - unpacked_signal.SignalPrimitiveHeader.SenderProcessId, - unpacked_signal.u.MaPacketConfirm.VirtualInterfaceIdentifier, - unpacked_signal.u.MaPacketConfirm.HostTag); - - CsrWifiRouterCtrlHipIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, - packed_siglen, - (u8 *)sigbuf, - 0, NULL, - 0, NULL); - } - else if((buffered_frame_item->hostTag & 0x80000000)) - { - /* construct a MA-PACKET.confirm message for NME */ - unifi_warning(priv, "MA_PACKET_CONFIRM for NME (0x%x, 0x%x, 0x%x, 0x%x)\n", - buffered_frame_item->leSenderProcessId, - buffered_frame_item->interfaceTag, - buffered_frame_item->transmissionControl, - (buffered_frame_item->hostTag & 0x3FFFFFFF)); - - CsrWifiRouterMaPacketCfmSend((buffered_frame_item->leSenderProcessId & 0xFF), - buffered_frame_item->interfaceTag, - CSR_RESULT_FAILURE, - (buffered_frame_item->hostTag & 0x3FFFFFFF), - buffered_frame_item->rate); - - } - else - { - unifi_warning(priv, "Buffered packet dropped without sending a confirm\n"); - } - - } - - list_del(listHead); - kfree(buffered_frame_item); - buffered_frame_item = NULL; - } -} - -void CsrWifiRouterCtrlMediaStatusReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlMediaStatusReq* req = (CsrWifiRouterCtrlMediaStatusReq*)msg; - netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; - unsigned long flags; - - if (priv->smepriv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlMediaStatusReqHandler: invalid smepriv\n"); - return; - } - if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "CsrWifiRouterCtrlMediaStatusReqHandler: invalid interfaceTag\n"); - return; - } - unifi_trace(priv, UDBG3, "CsrWifiRouterCtrlMediaStatusReqHandler: Mode = %d req->mediaStatus = %d\n", interfacePriv->interfaceMode, req->mediaStatus); - if (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_AMP) { - bulk_data_desc_t bulk_data; - - bulk_data.data_length = 0; - - spin_lock_irqsave(&priv->m4_lock, flags); - if (interfacePriv->m4_bulk_data.data_length > 0) { - bulk_data = interfacePriv->m4_bulk_data; - interfacePriv->m4_bulk_data.net_buf_length = 0; - interfacePriv->m4_bulk_data.data_length = 0; - interfacePriv->m4_bulk_data.os_data_ptr = interfacePriv->m4_bulk_data.os_net_buf_ptr = NULL; - } - spin_unlock_irqrestore(&priv->m4_lock, flags); - - if (bulk_data.data_length != 0) { - unifi_trace(priv, UDBG5, "CsrWifiRouterCtrlMediaStatusReqHandler: free M4\n"); - unifi_net_data_free(priv, &bulk_data); - } - - if ((req->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_CONNECTED) && - (interfacePriv->connected != UnifiConnected)) { - - switch(interfacePriv->interfaceMode){ - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - interfacePriv->connected = UnifiConnected; - netif_carrier_on(priv->netdev[req->interfaceTag]); -#ifdef CSR_SUPPORT_WEXT - wext_send_started_event(priv); -#endif - unifi_trace(priv, UDBG1, - "CsrWifiRouterCtrlMediaStatusReqHandler: AP/P2PGO setting netif_carrier_on\n"); - netif_tx_wake_all_queues(priv->netdev[req->interfaceTag]); - break; - - default: -#ifdef CSR_SUPPORT_WEXT - /* In the WEXT builds (sme and native), the userspace is not ready - * to process any EAPOL or WAPI packets, until it has been informed - * of the NETDEV_CHANGE. - */ - if (interfacePriv->netdev_callback_registered && (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI)) { - interfacePriv->wait_netdev_change = TRUE; - unifi_trace(priv, UDBG1, - "CsrWifiRouterCtrlMediaStatusReqHandler: waiting for NETDEV_CHANGE\n"); - /* - * Carrier can go to on, only after wait_netdev_change is set to TRUE. - * Otherwise there can be a race in uf_netdev_event(). - */ - netif_carrier_on(priv->netdev[req->interfaceTag]); - unifi_trace(priv, UDBG1, - "CsrWifiRouterCtrlMediaStatusReqHandler: STA/P2PCLI setting netif_carrier_on\n"); - } - else -#endif - { - /* In the NME build, the userspace does not wait for the NETDEV_CHANGE - * so it is ready to process all the EAPOL or WAPI packets. - * At this point, we enable all the Tx queues, and we indicate any packets - * that are queued (and the respective port is opened). - */ - static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; - interfacePriv->connected = UnifiConnected; - unifi_trace(priv, UDBG1, - "CsrWifiRouterMediaStatusReqHandler: UnifiConnected && netif_carrier_on\n"); - netif_carrier_on(priv->netdev[req->interfaceTag]); - netif_tx_wake_all_queues(priv->netdev[req->interfaceTag]); - uf_process_rx_pending_queue(priv, UF_UNCONTROLLED_PORT_Q, broadcast_address, 1, interfacePriv->InterfaceTag); - uf_process_rx_pending_queue(priv, UF_CONTROLLED_PORT_Q, broadcast_address, 1, interfacePriv->InterfaceTag); - } - break; - } - } - - if (req->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED) { -#ifdef CSR_SUPPORT_WEXT - unifi_trace(priv, UDBG1, - "CsrWifiRouterMediaStatusReqHandler: cancel waiting for NETDEV_CHANGE\n"); - interfacePriv->wait_netdev_change = FALSE; -#endif - unifi_trace(priv, UDBG1, - "CsrWifiRouterMediaStatusReqHandler: setting netif_carrier_off\n"); - netif_carrier_off(priv->netdev[req->interfaceTag]); -#ifdef CSR_SUPPORT_WEXT - switch(interfacePriv->interfaceMode){ - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - wext_send_started_event(priv); - break; - default: - break; - } -#endif - interfacePriv->connected = UnifiNotConnected; - } - } else { - /* For AMP, just update the L2 connected flag */ - if (req->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_CONNECTED) { - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlMediaStatusReqHandler: AMP connected\n"); - interfacePriv->connected = UnifiConnected; - } else { - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlMediaStatusReqHandler: AMP disconnected\n"); - interfacePriv->connected = UnifiNotConnected; - } - } -} - - -void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlHipReq* hipreq = (CsrWifiRouterCtrlHipReq*)msg; - bulk_data_param_t bulkdata; - u8 *signal_ptr; - int signal_length; - int r=0; - void *dest; - CsrResult csrResult; - CSR_SIGNAL *signal; - u16 interfaceTag = 0; - CSR_MA_PACKET_REQUEST *req; - netInterface_priv_t *interfacePriv; - - if (priv == NULL) { - return; - } - if (priv->smepriv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlHipReqHandler: invalid smepriv\n"); - return; - } - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "CsrWifiRouterCtrlHipReqHandler: invalid interfaceTag\n"); - return; - } - - interfacePriv = priv->interfacePriv[interfaceTag]; - - /* Initialize bulkdata to avoid os_net_buf is garbage */ - memset(&bulkdata, 0, sizeof(bulk_data_param_t)); - - signal = (CSR_SIGNAL *)hipreq->mlmeCommand; - - unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlHipReqHandler: 0x04%X ---->\n", - *((u16*)hipreq->mlmeCommand)); - - /* Construct the signal. */ - signal_ptr = (u8*)hipreq->mlmeCommand; - signal_length = hipreq->mlmeCommandLength; - - /* - * The MSB of the sender ID needs to be set to the client ID. - * The LSB is controlled by the SME. - */ - signal_ptr[5] = (priv->sme_cli->sender_id >> 8) & 0xff; - - /* Allocate buffers for the bulk data. */ - if (hipreq->dataRef1Length) { - csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], hipreq->dataRef1Length); - if (csrResult == CSR_RESULT_SUCCESS) { - dest = (void*)bulkdata.d[0].os_data_ptr; - memcpy(dest, hipreq->dataRef1, hipreq->dataRef1Length); - bulkdata.d[0].data_length = hipreq->dataRef1Length; - } else { - unifi_warning(priv, "signal not sent down, allocation failed in CsrWifiRouterCtrlHipReqHandler\n"); - return; - } - } else { - bulkdata.d[0].os_data_ptr = NULL; - bulkdata.d[0].data_length = 0; - } - if (hipreq->dataRef2Length) { - csrResult = unifi_net_data_malloc(priv, &bulkdata.d[1], hipreq->dataRef2Length); - if (csrResult == CSR_RESULT_SUCCESS) { - dest = (void*)bulkdata.d[1].os_data_ptr; - memcpy(dest, hipreq->dataRef2, hipreq->dataRef2Length); - bulkdata.d[1].data_length = hipreq->dataRef2Length; - } else { - if (bulkdata.d[0].data_length) - { - unifi_net_data_free(priv, &bulkdata.d[0]); - } - unifi_warning(priv, "signal not sent down, allocation failed in CsrWifiRouterCtrlHipReqHandler\n"); - return; - } - } else { - bulkdata.d[1].os_data_ptr = NULL; - bulkdata.d[1].data_length = 0; - } - - unifi_trace(priv, UDBG3, "SME SEND: Signal 0x%.4X \n", - *((u16*)signal_ptr)); - if (signal->SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_REQUEST_ID) - { - CSR_SIGNAL unpacked_signal; - read_unpack_signal((u8 *) signal, &unpacked_signal); - req = &unpacked_signal.u.MaPacketRequest; - interfaceTag = req->VirtualInterfaceIdentifier & 0xff; - switch(interfacePriv->interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_NONE: - unifi_error(priv, "CsrWifiRouterCtrlHipReqHandler: invalid mode: NONE \n"); - break; - default: - unifi_trace(priv, UDBG5, "mode is %x\n", interfacePriv->interfaceMode); - } - /* While sending ensure that first 2 bits b31 and b30 are 00. These are used for local routing*/ - r = uf_process_ma_packet_req(priv, req->Ra.x, (req->HostTag & 0x3FFFFFFF), interfaceTag, - req->TransmissionControl, req->TransmitRate, - req->Priority, signal->SignalPrimitiveHeader.SenderProcessId, - &bulkdata); - if (r) - { - if (bulkdata.d[0].data_length) - { - unifi_net_data_free(priv, &bulkdata.d[0]); - } - if (bulkdata.d[1].data_length) - { - unifi_net_data_free(priv, &bulkdata.d[1]); - } - } - } else { - /* ul_send_signal_raw frees the bulk data if it fails */ - r = ul_send_signal_raw(priv, signal_ptr, signal_length, &bulkdata); - } - - if (r) { - unifi_error(priv, - "CsrWifiRouterCtrlHipReqHandler: Failed to send signal (0x%.4X - %u)\n", - *((u16*)signal_ptr), r); - CsrWifiRouterCtrlWifiOffIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, CSR_WIFI_SME_CONTROL_INDICATION_ERROR); - } - - unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlHipReqHandler: <----\n"); -} - -#ifdef CSR_WIFI_SEND_GRATUITOUS_ARP -static void -uf_send_gratuitous_arp(unifi_priv_t *priv, u16 interfaceTag) -{ - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - CSR_PRIORITY priority; - CSR_SIGNAL signal; - bulk_data_param_t bulkdata; - CsrResult csrResult; - struct sk_buff *skb, *newSkb = NULL; - s8 protection; - int r; - static const u8 arp_req[36] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x06, 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, - 0x00, 0x02, 0x5f, 0x20, 0x2f, 0x02, - 0xc0, 0xa8, 0x00, 0x02, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xc0, 0xa8, 0x00, 0x02}; - - csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], sizeof(arp_req)); - if (csrResult != CSR_RESULT_SUCCESS) - { - unifi_error(priv, "Failed to allocate bulk data in CsrWifiSmeRoamCompleteIndHandler()\n"); - return; - } - skb = (struct sk_buff *)(bulkdata.d[0].os_net_buf_ptr); - skb->len = bulkdata.d[0].data_length; - - memcpy(skb->data, arp_req, sizeof(arp_req)); - /* add MAC and IP address */ - memcpy(skb->data + 16, priv->netdev[interfaceTag]->dev_addr, ETH_ALEN); - skb->data[22] = (priv->sta_ip_address ) & 0xFF; - skb->data[23] = (priv->sta_ip_address >> 8) & 0xFF; - skb->data[24] = (priv->sta_ip_address >> 16) & 0xFF; - skb->data[25] = (priv->sta_ip_address >> 24) & 0xFF; - skb->data[32] = (priv->sta_ip_address ) & 0xFF; - skb->data[33] = (priv->sta_ip_address >> 8) & 0xFF; - skb->data[34] = (priv->sta_ip_address >> 16) & 0xFF; - skb->data[35] = (priv->sta_ip_address >> 24) & 0xFF; - - bulkdata.d[1].os_data_ptr = NULL; - bulkdata.d[1].os_net_buf_ptr = NULL; - bulkdata.d[1].net_buf_length = bulkdata.d[1].data_length = 0; - - if ((protection = uf_get_protection_bit_from_interfacemode(priv, interfaceTag, &arp_req[26])) < 0) - { - unifi_error(priv, "CsrWifiSmeRoamCompleteIndHandler: Failed to determine protection mode\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - return; - } - - if ((priv->sta_wmm_capabilities & QOS_CAPABILITY_WMM_ENABLED) == 1) - { - priority = CSR_QOS_UP0; - } - else - { - priority = CSR_CONTENTION; - } - - if (prepare_and_add_macheader(priv, skb, newSkb, priority, &bulkdata, - interfaceTag, &arp_req[26], - priv->netdev[interfaceTag]->dev_addr, protection)) - { - unifi_error(priv, "CsrWifiSmeRoamCompleteIndHandler: failed to create MAC header\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - return; - } - bulkdata.d[0].os_data_ptr = skb->data; - bulkdata.d[0].os_net_buf_ptr = skb; - bulkdata.d[0].data_length = skb->len; - - unifi_frame_ma_packet_req(priv, priority, 0, 0xffffffff, interfaceTag, - CSR_NO_CONFIRM_REQUIRED, priv->netdev_client->sender_id, - interfacePriv->bssid.a, &signal); - - r = ul_send_signal_unpacked(priv, &signal, &bulkdata); - if (r) - { - unifi_error(priv, "CsrWifiSmeRoamCompleteIndHandler: failed to send QOS data null packet result: %d\n", r); - unifi_net_data_free(priv, &bulkdata.d[0]); - return; - } - -} -#endif /* CSR_WIFI_SEND_GRATUITOUS_ARP */ - -/* - * --------------------------------------------------------------------------- - * configure_data_port - * - * Store the new controlled port configuration. - * - * Arguments: - * priv Pointer to device private context struct - * port_cfg Pointer to the port configuration - * - * Returns: - * An unifi_ControlledPortAction value. - * --------------------------------------------------------------------------- - */ -static int -configure_data_port(unifi_priv_t *priv, - CsrWifiRouterCtrlPortAction port_action, - const CsrWifiMacAddress *macAddress, - const int queue, - u16 interfaceTag) -{ - const u8 broadcast_mac_address[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - unifi_port_config_t *port; - netInterface_priv_t *interfacePriv; - int i; - const char* controlled_string; /* cosmetic "controlled"/"uncontrolled" for trace */ - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "configure_data_port: bad interfaceTag\n"); - return -EFAULT; - } - - interfacePriv = priv->interfacePriv[interfaceTag]; - - if (queue == UF_CONTROLLED_PORT_Q) { - port = &interfacePriv->controlled_data_port; - controlled_string = "controlled"; - } else { - port = &interfacePriv->uncontrolled_data_port; - controlled_string = "uncontrolled"; - } - - unifi_trace(priv, UDBG2, - "port config request %pM %s with port_action %d.\n", - macAddress->a, controlled_string, port_action); - - /* If the new configuration has the broadcast MAC address or if we are in infrastructure mode then clear the list first and set port overide mode */ - if ((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI) || - !memcmp(macAddress->a, broadcast_mac_address, ETH_ALEN)) { - - port->port_cfg[0].port_action = port_action; - port->port_cfg[0].mac_address = *macAddress; - port->port_cfg[0].in_use = TRUE; - port->entries_in_use = 1; - port->overide_action = UF_DATA_PORT_OVERIDE; - - unifi_trace(priv, UDBG2, "%s port override on\n", - (queue == UF_CONTROLLED_PORT_Q) ? "Controlled" : "Uncontrolled"); - - /* Discard the remaining entries in the port config table */ - for (i = 1; i < UNIFI_MAX_CONNECTIONS; i++) { - port->port_cfg[i].in_use = FALSE; - } - - if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) { - unifi_trace(priv, UDBG1, "%s port broadcast set to open.\n", - (queue == UF_CONTROLLED_PORT_Q) ? "Controlled" : "Uncontrolled"); - - /* - * Ask stack to schedule for transmission any packets queued - * while controlled port was not open. - * Use netif_schedule() instead of netif_wake_queue() because - * transmission should be already enabled at this point. If it - * is not, probably the interface is down and should remain as is. - */ - uf_resume_data_plane(priv, queue, *macAddress, interfaceTag); - -#ifdef CSR_WIFI_SEND_GRATUITOUS_ARP - if ((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) && - (queue == UF_CONTROLLED_PORT_Q) && (priv->sta_ip_address != 0xFFFFFFFF)) - { - uf_send_gratuitous_arp(priv, interfaceTag); - } -#endif - } else { - unifi_trace(priv, UDBG1, "%s port broadcast set to %s.\n", - (queue == UF_CONTROLLED_PORT_Q) ? "Controlled" : "Uncontrolled", - (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) ? "discard": "closed"); - - /* If port is closed, discard all the pending Rx packets */ - if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) { - uf_free_pending_rx_packets(priv, queue, *macAddress, interfaceTag); - } - } - } else { - /* store the new configuration, either in the entry with matching mac address (if already present), - * otherwise in a new entry - */ - - int found_entry_flag; - int first_free_slot = -1; - - /* If leaving override mode, free the port entry used for override */ - if (port->overide_action == UF_DATA_PORT_OVERIDE) { - port->port_cfg[0].in_use = FALSE; - port->entries_in_use = 0; - port->overide_action = UF_DATA_PORT_NOT_OVERIDE; - - unifi_trace(priv, UDBG2, "%s port override off\n", - (queue == UF_CONTROLLED_PORT_Q) ? "Controlled" : "Uncontrolled"); - } - - found_entry_flag = 0; - for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { - if (port->port_cfg[i].in_use) { - if (!memcmp(&port->port_cfg[i].mac_address.a, macAddress->a, ETH_ALEN)) { - /* We've seen this address before, reconfigure it */ - port->port_cfg[i].port_action = port_action; - found_entry_flag = 1; - break; - } - } else if (first_free_slot == -1) { - /* Remember the first free slot on the way past so it can be claimed - * if this turns out to be a new MAC address (to save walking the list again). - */ - first_free_slot = i; - } - } - - /* At this point we found an existing entry and have updated it, or need to - * add a new entry. If all slots are allocated, give up and return an error. - */ - if (!found_entry_flag) { - if (first_free_slot == -1) { - unifi_error(priv, "no free slot found in port config array (%d used)\n", port->entries_in_use); - return -EFAULT; - } else { - port->entries_in_use++; - } - - unifi_trace(priv, UDBG3, "port config index assigned in config_data_port = %d\n", first_free_slot); - port->port_cfg[first_free_slot].in_use = TRUE; - port->port_cfg[first_free_slot].port_action = port_action; - port->port_cfg[first_free_slot].mac_address = *macAddress; - } - - if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) { - /* - * Ask stack to schedule for transmission any packets queued - * while controlled port was not open. - * Use netif_schedule() instead of netif_wake_queue() because - * transmission should be already enabled at this point. If it - * is not, probably the interface is down and should remain as is. - */ - uf_resume_data_plane(priv, queue, *macAddress, interfaceTag); - } - - /* - * If port is closed, discard all the pending Rx packets - * coming from the peer station. - */ - if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) { - uf_free_pending_rx_packets(priv, queue, *macAddress, interfaceTag); - } - - unifi_trace(priv, UDBG2, - "port config %pM with port_action %d.\n", - macAddress->a, port_action); - } - return 0; -} /* configure_data_port() */ - - -void CsrWifiRouterCtrlPortConfigureReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlPortConfigureReq* req = (CsrWifiRouterCtrlPortConfigureReq*)msg; - netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; - - unifi_trace(priv, UDBG3, "entering CsrWifiRouterCtrlPortConfigureReqHandler\n"); - if (priv->smepriv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlPortConfigureReqHandler: invalid smepriv\n"); - return; - } - - /* To update the protection status of the peer/station */ - switch(interfacePriv->interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_STA: - case CSR_WIFI_ROUTER_CTRL_MODE_AMP: - case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: - /* Since for Unifi as a station, the station record not maintained & interfaceID is - * only needed to update the peer protection status - */ - interfacePriv->protect = req->setProtection; - break; - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - { - u8 i; - CsrWifiRouterCtrlStaInfo_t *staRecord; - /* Ifscontrolled port is open means, The peer has been added to station record - * so that the protection corresponding to the peer is valid in this req - */ - if (req->controlledPortAction == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) { - for(i =0; i < UNIFI_MAX_CONNECTIONS; i++) { - staRecord = (CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i]); - if (staRecord) { - /* Find the matching station record & set the protection type */ - if (!memcmp(req->macAddress.a, staRecord->peerMacAddress.a, ETH_ALEN)) { - staRecord->protection = req->setProtection; - break; - } - } - } - } - } - break; - default: - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlPortConfigureReqHandler(0x%.4X) Uncaught mode %d\n", - msg->source, interfacePriv->interfaceMode); - } - - configure_data_port(priv, req->uncontrolledPortAction, (const CsrWifiMacAddress *)&req->macAddress, - UF_UNCONTROLLED_PORT_Q, req->interfaceTag); - configure_data_port(priv, req->controlledPortAction, (const CsrWifiMacAddress *)&req->macAddress, - UF_CONTROLLED_PORT_Q, req->interfaceTag); - - CsrWifiRouterCtrlPortConfigureCfmSend(msg->source, req->clientData, req->interfaceTag, - CSR_RESULT_SUCCESS, req->macAddress); - unifi_trace(priv, UDBG3, "leaving CsrWifiRouterCtrlPortConfigureReqHandler\n"); -} - - -void CsrWifiRouterCtrlWifiOnReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlVersions versions; - CsrWifiRouterCtrlWifiOnReq* req = (CsrWifiRouterCtrlWifiOnReq*)msg; - int r, i; - CsrResult csrResult; - - if (priv == NULL) { - return; - } - if( priv->wol_suspend ) { - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler: Don't reset mode\n"); - } else { -#ifdef ANDROID_BUILD - /* Take the wakelock while Wi-Fi On is in progress */ - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler: take wake lock\n"); - wake_lock(&unifi_sdio_wake_lock); -#endif - for (i=0; i<CSR_WIFI_NUM_INTERFACES; i++) { - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler: Setting interface %d to NONE\n", i ); - - priv->interfacePriv[i]->interfaceMode = 0; - } - } - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler(0x%.4X) req->dataLength=%d req->data=0x%x\n", msg->source, req->dataLength, req->data); - - if(req->dataLength==3 && req->data && req->data[0]==0 && req->data[1]==1 && req->data[2]==1) - { - priv->cmanrTestMode = TRUE; - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler: cmanrTestMode=%d\n", priv->cmanrTestMode); - } - else - { - priv->cmanrTestMode = FALSE; - } - - /* - * The request to initialise UniFi might come while UniFi is running. - * We need to block all I/O activity until the reset completes, otherwise - * an SDIO error might occur resulting an indication to the SME which - * makes it think that the initialisation has failed. - */ - priv->bh_thread.block_thread = 1; - - /* Update the wifi_on state */ - priv->wifi_on_state = wifi_on_in_progress; - - /* If UniFi was unpowered, acquire the firmware for download to chip */ - if (!priv->wol_suspend) { - r = uf_request_firmware_files(priv, UNIFI_FW_STA); - if (r) { - unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to get f/w\n"); - CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE); - return; - } - } else { - unifi_trace(priv, UDBG1, "Don't need firmware\n"); - } - - /* Power on UniFi (which may not necessarily have been off) */ - CsrSdioClaim(priv->sdio); - csrResult = CsrSdioPowerOn(priv->sdio); - CsrSdioRelease(priv->sdio); - if (csrResult != CSR_RESULT_SUCCESS && csrResult != CSR_SDIO_RESULT_NOT_RESET) { - unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to power on UniFi\n"); - CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE); - return; - } - - /* If CsrSdioPowerOn() returns CSR_RESULT_SUCCESS, it means that we need to initialise UniFi */ - if (csrResult == CSR_RESULT_SUCCESS && !priv->wol_suspend) { - /* Initialise UniFi hardware */ - r = uf_init_hw(priv); - if (r) { - unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to initialise h/w, error %d\n", r); - CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE); - return; - } - } else { - unifi_trace(priv, UDBG1, "UniFi already initialised\n"); - } - - /* Completed handling of wake up from suspend with UniFi powered */ - priv->wol_suspend = FALSE; - - /* Re-enable the I/O thread */ - priv->bh_thread.block_thread = 0; - - /* - * Start the I/O thread. The thread might be already running. - * This fine, just carry on with the request. - */ - r = uf_init_bh(priv); - if (r) { - CsrSdioClaim(priv->sdio); - CsrSdioPowerOff(priv->sdio); - CsrSdioRelease(priv->sdio); - CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE); - return; - } - - /* Get the version information from the core */ - unifi_card_info(priv->card, &priv->card_info); - - /* Set the sme queue id */ - priv->CSR_WIFI_SME_IFACEQUEUE = msg->source; - CSR_WIFI_SME_IFACEQUEUE = msg->source; - - - /* Copy to the unifiio_card_info structure. */ - versions.chipId = priv->card_info.chip_id; - versions.chipVersion = priv->card_info.chip_version; - versions.firmwareBuild = priv->card_info.fw_build; - versions.firmwareHip = priv->card_info.fw_hip_version; - versions.routerBuild = (char*)CSR_WIFI_VERSION; - versions.routerHip = (UNIFI_HIP_MAJOR_VERSION << 8) | UNIFI_HIP_MINOR_VERSION; - - CsrWifiRouterCtrlWifiOnIndSend(msg->source, 0, CSR_RESULT_SUCCESS, versions); - - /* Update the wifi_on state */ - priv->wifi_on_state = wifi_on_done; -} - - -/* - * wifi_off: - * Common code for CsrWifiRouterCtrlWifiOffReqHandler() and - * CsrWifiRouterCtrlWifiOffRspHandler(). - */ -static void -wifi_off(unifi_priv_t *priv) -{ - int power_off; - int priv_instance; - int i; - CsrResult csrResult; - - - /* Already off? */ - if (priv->wifi_on_state == wifi_on_unspecified) { - unifi_trace(priv, UDBG1, "wifi_off already\n"); - return; - } - - unifi_trace(priv, UDBG1, "wifi_off\n"); - - /* Destroy the Traffic Analysis Module */ - cancel_work_sync(&priv->ta_ind_work.task); - cancel_work_sync(&priv->ta_sample_ind_work.task); -#ifdef CSR_SUPPORT_WEXT - cancel_work_sync(&priv->sme_config_task); - wext_send_disassoc_event(priv); -#endif - - /* Cancel pending M4 stuff */ - for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { - if (priv->netdev[i]) { - netInterface_priv_t *netpriv = (netInterface_priv_t *) netdev_priv(priv->netdev[i]); - cancel_work_sync(&netpriv->send_m4_ready_task); - } - } - flush_workqueue(priv->unifi_workqueue); - - /* fw_init parameter can prevent power off UniFi, for debugging */ - priv_instance = uf_find_priv(priv); - if (priv_instance == -1) { - unifi_warning(priv, - "CsrWifiRouterCtrlStopReqHandler: Unknown priv instance, will power off card.\n"); - power_off = 1; - } else { - power_off = (fw_init[priv_instance] > 0) ? 0 : 1; - } - - /* Production test mode requires power to the chip, too */ - if (priv->ptest_mode) { - power_off = 0; - } - - /* Stop the bh_thread */ - uf_stop_thread(priv, &priv->bh_thread); - - /* Read the f/w panic codes, if any. Protect against second wifi_off() call, - * which may happen if SME requests a wifi_off and closes the char device */ - if (priv->init_progress != UNIFI_INIT_NONE) { - CsrSdioClaim(priv->sdio); - unifi_capture_panic(priv->card); - CsrSdioRelease(priv->sdio); - } - - /* Unregister the interrupt handler */ - if (csr_sdio_linux_remove_irq(priv->sdio)) { - unifi_notice(priv, - "csr_sdio_linux_remove_irq failed to talk to card.\n"); - } - - if (power_off) { - unifi_trace(priv, UDBG2, - "Force low power and try to power off\n"); - /* Put UniFi to deep sleep, in case we can not power it off */ - CsrSdioClaim(priv->sdio); - csrResult = unifi_force_low_power_mode(priv->card); - CsrSdioRelease(priv->sdio); - - CsrSdioPowerOff(priv->sdio); - } - - /* Consider UniFi to be uninitialised */ - priv->init_progress = UNIFI_INIT_NONE; - priv->wifi_on_state = wifi_on_unspecified; - - -} /* wifi_off() */ - - -void CsrWifiRouterCtrlWifiOffReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlWifiOffReq* req = (CsrWifiRouterCtrlWifiOffReq*)msg; - int i = 0; - - if (priv == NULL) { - return; - } - - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOffReqHandler(0x%.4X)\n", msg->source); - - /* Stop the network traffic on all interfaces before freeing the core. */ - for (i=0; i<CSR_WIFI_NUM_INTERFACES; i++) { - netInterface_priv_t *interfacePriv = priv->interfacePriv[i]; - if (interfacePriv->netdev_registered == 1) { - netif_carrier_off(priv->netdev[i]); - netif_tx_stop_all_queues(priv->netdev[i]); - interfacePriv->connected = UnifiConnectedUnknown; - } - interfacePriv->interfaceMode = 0; - - /* Enable all queues by default */ - interfacePriv->queueEnabled[0] = 1; - interfacePriv->queueEnabled[1] = 1; - interfacePriv->queueEnabled[2] = 1; - interfacePriv->queueEnabled[3] = 1; - } - wifi_off(priv); - - CsrWifiRouterCtrlWifiOffCfmSend(msg->source, req->clientData); - - /* If this is called in response to closing the character device, the - * caller must use uf_sme_cancel_request() to terminate any pending SME - * blocking request or there will be a delay while the operation times out. - */ -} - - -void CsrWifiRouterCtrlQosControlReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlQosControlReq* req = (CsrWifiRouterCtrlQosControlReq*)msg; - netInterface_priv_t *interfacePriv; - - if (priv->smepriv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlQosControlReqHandler: invalid smepriv\n"); - return; - } - - unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlQosControlReqHandler:scontrol = %d", req->control); - - if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "CsrWifiRouterCtrlQosControlReqHandler: interfaceID >= CSR_WIFI_NUM_INTERFACES.\n"); - return; - } - interfacePriv = priv->interfacePriv[req->interfaceTag]; - - if (req->control == CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_WMM_ON) { - priv->sta_wmm_capabilities |= QOS_CAPABILITY_WMM_ENABLED; - unifi_trace(priv, UDBG1, "WMM enabled\n"); - - unifi_trace(priv, UDBG1, "Queue Config %x\n", req->queueConfig); - - interfacePriv->queueEnabled[UNIFI_TRAFFIC_Q_BK] = (req->queueConfig & CSR_WIFI_ROUTER_CTRL_QUEUE_BK_ENABLE)?1:0; - interfacePriv->queueEnabled[UNIFI_TRAFFIC_Q_BE] = (req->queueConfig & CSR_WIFI_ROUTER_CTRL_QUEUE_BE_ENABLE)?1:0; - interfacePriv->queueEnabled[UNIFI_TRAFFIC_Q_VI] = (req->queueConfig & CSR_WIFI_ROUTER_CTRL_QUEUE_VI_ENABLE)?1:0; - interfacePriv->queueEnabled[UNIFI_TRAFFIC_Q_VO] = (req->queueConfig & CSR_WIFI_ROUTER_CTRL_QUEUE_VO_ENABLE)?1:0; - - } else { - priv->sta_wmm_capabilities = 0; - unifi_trace(priv, UDBG1, "WMM disabled\n"); - } -} - - -void CsrWifiRouterCtrlTclasAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlTclasAddReq* req = (CsrWifiRouterCtrlTclasAddReq*)msg; - - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlTclasAddReqHandler: invalid smepriv\n"); - return; - } - - CsrWifiRouterCtrlTclasAddCfmSend(msg->source, req->clientData, req->interfaceTag , CSR_RESULT_SUCCESS); -} - -void CsrWifiRouterCtrlTclasDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlTclasDelReq* req = (CsrWifiRouterCtrlTclasDelReq*)msg; - - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlTclasDelReqHandler: invalid smepriv\n"); - return; - } - - CsrWifiRouterCtrlTclasDelCfmSend(msg->source, req->clientData, req->interfaceTag, CSR_RESULT_SUCCESS); -} - - -void CsrWifiRouterCtrlConfigurePowerModeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlConfigurePowerModeReq* req = (CsrWifiRouterCtrlConfigurePowerModeReq*)msg; - enum unifi_low_power_mode pm; - CsrResult csrResult; - - if (priv->smepriv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlConfigurePowerModeReqHandler: invalid smepriv\n"); - return; - } - - if (req->mode == CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_DISABLED) { - pm = UNIFI_LOW_POWER_DISABLED; - } else { - pm = UNIFI_LOW_POWER_ENABLED; - } - - unifi_trace(priv, UDBG2, - "CsrWifiRouterCtrlConfigurePowerModeReqHandler (mode=%d, wake=%d)\n", - req->mode, req->wakeHost); - csrResult = unifi_configure_low_power_mode(priv->card, pm, - (req->wakeHost ? UNIFI_PERIODIC_WAKE_HOST_ENABLED : UNIFI_PERIODIC_WAKE_HOST_DISABLED)); -} - - -void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlWifiOnRes* res = (CsrWifiRouterCtrlWifiOnRes*)msg; - - if (priv == NULL) { - unifi_error(NULL, "CsrWifiRouterCtrlWifiOnResHandler: Invalid ospriv.\n"); - return; - } - - unifi_trace(priv, UDBG1, - "CsrWifiRouterCtrlWifiOnResHandler: status %d (patch %u)\n", res->status, res->smeVersions.firmwarePatch); - - if (res->smeVersions.firmwarePatch != 0) { - unifi_info(priv, "Firmware patch %d\n", res->smeVersions.firmwarePatch); - } - - if (res->numInterfaceAddress > CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "WifiOnResHandler bad numInterfaceAddress %d\n", res->numInterfaceAddress); - return; - } - - /* UniFi is now initialised, complete the init. */ - if (res->status == CSR_RESULT_SUCCESS) - { - int i; /* used as a loop counter */ - u32 intmode = CSR_WIFI_INTMODE_DEFAULT; -#ifdef CSR_WIFI_SPLIT_PATCH - u8 switching_ap_fw = FALSE; -#endif - /* Register the UniFi device with the OS network manager */ - unifi_trace(priv, UDBG3, "Card Init Completed Successfully\n"); - - /* Store the MAC address in the netdev */ - for(i=0;i<res->numInterfaceAddress;i++) - { - memcpy(priv->netdev[i]->dev_addr, res->stationMacAddress[i].a, ETH_ALEN); - } - - /* Copy version structure into the private versions field */ - priv->sme_versions = res->smeVersions; - - unifi_trace(priv, UDBG2, "network interfaces count = %d\n", - res->numInterfaceAddress); - - /* Register the netdevs for each interface. */ - for(i=0;i<res->numInterfaceAddress;i++) - { - netInterface_priv_t *interfacePriv = priv->interfacePriv[i]; - if(!interfacePriv->netdev_registered) - { - int r; - unifi_trace(priv, UDBG3, "registering net device %d\n", i); - r = uf_register_netdev(priv, i); - if (r) - { - /* unregister the net_device that are registered in the previous iterations */ - uf_unregister_netdev(priv); - unifi_error(priv, "Failed to register the network device.\n"); - CsrWifiRouterCtrlWifiOnCfmSend(msg->source, res->clientData, CSR_RESULT_FAILURE); - return; - } - } -#ifdef CSR_WIFI_SPLIT_PATCH - else - { - /* If a netdev is already registered, we have received this WifiOnRes - * in response to switching AP/STA firmware in a ModeSetReq. - * Rememeber this in order to send a ModeSetCfm once - */ - switching_ap_fw = TRUE; - } -#endif - } - priv->totalInterfaceCount = res->numInterfaceAddress; - - /* If the MIB has selected f/w scheduled interrupt mode, apply it now - * but let module param override. - */ - if (run_bh_once != -1) { - intmode = (u32)run_bh_once; - } else if (res->scheduledInterrupt) { - intmode = CSR_WIFI_INTMODE_RUN_BH_ONCE; - } - unifi_set_interrupt_mode(priv->card, intmode); - - priv->init_progress = UNIFI_INIT_COMPLETED; - - /* Acknowledge the CsrWifiRouterCtrlWifiOnReq now */ - CsrWifiRouterCtrlWifiOnCfmSend(msg->source, res->clientData, CSR_RESULT_SUCCESS); - -#ifdef CSR_WIFI_SPLIT_PATCH - if (switching_ap_fw && (priv->pending_mode_set.common.destination != 0xaaaa)) { - unifi_info(priv, "Completed firmware reload with %s patch\n", - CSR_WIFI_HIP_IS_AP_FW(priv->interfacePriv[0]->interfaceMode) ? "AP" : "STA"); - - /* Confirm the ModeSetReq that requested the AP/STA patch switch */ - CsrWifiRouterCtrlModeSetCfmSend(priv->pending_mode_set.common.source, - priv->pending_mode_set.clientData, - priv->pending_mode_set.interfaceTag, - priv->pending_mode_set.mode, - CSR_RESULT_SUCCESS); - priv->pending_mode_set.common.destination = 0xaaaa; - } -#endif - unifi_info(priv, "UniFi ready\n"); - -#ifdef ANDROID_BUILD - /* Release the wakelock */ - unifi_trace(priv, UDBG1, "ready: release wake lock\n"); - wake_unlock(&unifi_sdio_wake_lock); -#endif - /* Firmware initialisation is complete, so let the SDIO bus - * clock be raised when convienent to the core. - */ - unifi_request_max_sdio_clock(priv->card); - -#ifdef CSR_SUPPORT_WEXT - /* Notify the Android wpa_supplicant that we are ready */ - wext_send_started_event(priv); - - queue_work(priv->unifi_workqueue, &priv->sme_config_task); -#endif - - } else { - /* Acknowledge the CsrWifiRouterCtrlWifiOnReq now */ - CsrWifiRouterCtrlWifiOnCfmSend(msg->source, res->clientData, CSR_RESULT_FAILURE); - } -} - - -void CsrWifiRouterCtrlWifiOffResHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - - -void CsrWifiRouterCtrlMulticastAddressResHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - - -void CsrWifiRouterMaPacketSubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterMaPacketSubscribeReq* req = (CsrWifiRouterMaPacketSubscribeReq*)msg; - u8 i; - CsrResult result; - - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterMaPacketSubscribeReqHandler: invalid priv\n"); - return; - } - - /* Look for an unused filter */ - - result = CSR_WIFI_RESULT_NO_ROOM; - for (i = 0; i < MAX_MA_UNIDATA_IND_FILTERS; i++) { - - if (!priv->sme_unidata_ind_filters[i].in_use) { - - priv->sme_unidata_ind_filters[i].in_use = 1; - priv->sme_unidata_ind_filters[i].appHandle = msg->source; - priv->sme_unidata_ind_filters[i].encapsulation = req->encapsulation; - priv->sme_unidata_ind_filters[i].protocol = req->protocol; - - priv->sme_unidata_ind_filters[i].oui[2] = (u8) (req->oui & 0xFF); - priv->sme_unidata_ind_filters[i].oui[1] = (u8) ((req->oui >> 8) & 0xFF); - priv->sme_unidata_ind_filters[i].oui[0] = (u8) ((req->oui >> 16) & 0xFF); - - result = CSR_RESULT_SUCCESS; - break; - } - } - - unifi_trace(priv, UDBG1, - "subscribe_req: encap=%d, handle=%d, result=%d\n", - req->encapsulation, i, result); - CsrWifiRouterMaPacketSubscribeCfmSend(msg->source, req->interfaceTag, i, result, 0); -} - - -void CsrWifiRouterMaPacketUnsubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterMaPacketUnsubscribeReq* req = (CsrWifiRouterMaPacketUnsubscribeReq*)msg; - CsrResult result; - - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterMaPacketUnsubscribeReqHandler: invalid priv\n"); - return; - } - - result = CSR_WIFI_RESULT_NOT_FOUND; - - if (req->subscriptionHandle < MAX_MA_UNIDATA_IND_FILTERS) { - if (priv->sme_unidata_ind_filters[req->subscriptionHandle].in_use) { - priv->sme_unidata_ind_filters[req->subscriptionHandle].in_use = 0; - result = CSR_RESULT_SUCCESS; - } else { - result = CSR_WIFI_RESULT_NOT_FOUND; - } - } - - unifi_trace(priv, UDBG1, - "unsubscribe_req: handle=%d, result=%d\n", - req->subscriptionHandle, result); - CsrWifiRouterMaPacketUnsubscribeCfmSend(msg->source, req->interfaceTag, result); -} - - -void CsrWifiRouterCtrlCapabilitiesReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlCapabilitiesReq* req = (CsrWifiRouterCtrlCapabilitiesReq*)msg; - - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlCapabilitiesReqHandler: invalid priv\n"); - return; - } - - CsrWifiRouterCtrlCapabilitiesCfmSend(msg->source, req->clientData, - UNIFI_SOFT_COMMAND_Q_LENGTH - 1, - UNIFI_SOFT_TRAFFIC_Q_LENGTH - 1); -} - - -void CsrWifiRouterCtrlSuspendResHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlSuspendRes* res = (CsrWifiRouterCtrlSuspendRes*)msg; - - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlSuspendResHandler: invalid priv\n"); - return; - } - - sme_complete_request(priv, res->status); -} - - -void CsrWifiRouterCtrlResumeResHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlResumeRes* res = (CsrWifiRouterCtrlResumeRes*)msg; - - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlResumeResHandler: invalid priv\n"); - return; - } - - sme_complete_request(priv, res->status); -} - - -void CsrWifiRouterCtrlTrafficConfigReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlTrafficConfigReq* req = (CsrWifiRouterCtrlTrafficConfigReq*)msg; - CsrResult csrResult; - - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlTrafficConfigReqHandler: invalid smepriv\n"); - return; - } - if (req->trafficConfigType == CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER) - { - req->config.packetFilter |= CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM; - } - csrResult = unifi_ta_configure(priv->card, req->trafficConfigType, (const CsrWifiRouterCtrlTrafficConfig *)&req->config); -} - -void CsrWifiRouterCtrlTrafficClassificationReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlTrafficClassificationReq* req = (CsrWifiRouterCtrlTrafficClassificationReq*)msg; - - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlTrafficClassificationReqHandler: invalid smepriv\n"); - return; - } - - unifi_ta_classification(priv->card, req->trafficType, req->period); -} - -static int -_sys_packet_req(unifi_priv_t *priv, const CSR_SIGNAL *signal, - u8 subscriptionHandle, - u16 frameLength, u8 *frame, - int proto) -{ - int r; - const sme_ma_unidata_ind_filter_t *subs; - bulk_data_param_t bulkdata; - CSR_MA_PACKET_REQUEST req = signal->u.MaPacketRequest; - struct sk_buff *skb, *newSkb = NULL; - CsrWifiMacAddress peerMacAddress; - CsrResult csrResult; - u16 interfaceTag = req.VirtualInterfaceIdentifier & 0xff; - u8 eapolStore = FALSE; - s8 protection = 0; - netInterface_priv_t *interfacePriv; - unsigned long flags; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "_sys_packet_req: interfaceID >= CSR_WIFI_NUM_INTERFACES.\n"); - return -EINVAL; - } - interfacePriv = priv->interfacePriv[interfaceTag]; - if (!priv->sme_unidata_ind_filters[subscriptionHandle].in_use) { - unifi_error(priv, "_sys_packet_req: unknown subscription.\n"); - return -EINVAL; - } - - subs = &priv->sme_unidata_ind_filters[subscriptionHandle]; - unifi_trace(priv, UDBG1, - "_sys_packet_req: handle=%d, subs=%p, encap=%d\n", - subscriptionHandle, subs, subs->encapsulation); - - csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], frameLength); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "_sys_packet_req: failed to allocate bulkdata.\n"); - return (int)CsrHipResultToStatus(csrResult); - } - - /* get the peer Mac address */ - memcpy(&peerMacAddress, frame, ETH_ALEN); - - /* Determine if we need to add encapsulation header */ - if (subs->encapsulation == CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET) { - memcpy((void*)bulkdata.d[0].os_data_ptr, frame, frameLength); - - /* The translation is performed on the skb */ - skb = (struct sk_buff*)bulkdata.d[0].os_net_buf_ptr; - - unifi_trace(priv, UDBG1, - "_sys_packet_req: skb_add_llc_snap -->\n"); - r = skb_add_llc_snap(priv->netdev[interfaceTag], skb, proto); - unifi_trace(priv, UDBG1, - "_sys_packet_req: skb_add_llc_snap <--\n"); - if (r) { - unifi_error(priv, - "_sys_packet_req: failed to translate eth frame.\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - return r; - } - - bulkdata.d[0].data_length = skb->len; - } else { - /* Crop the MAC addresses from the packet */ - memcpy((void*)bulkdata.d[0].os_data_ptr, frame + 2*ETH_ALEN, frameLength - 2*ETH_ALEN); - bulkdata.d[0].data_length = frameLength - 2*ETH_ALEN; - skb = (struct sk_buff*)bulkdata.d[0].os_net_buf_ptr; - skb->len = bulkdata.d[0].data_length; - - } - - bulkdata.d[1].os_data_ptr = NULL; - bulkdata.d[1].os_net_buf_ptr = NULL; - bulkdata.d[1].data_length = 0; - - /* check for m4 detection */ - if (0 == uf_verify_m4(priv, bulkdata.d[0].os_data_ptr, bulkdata.d[0].data_length)) { - eapolStore = TRUE; - } - -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - if (proto == ETH_P_WAI) - { - protection = 0; /*WAI packets always sent unencrypted*/ - } - else - { -#endif - -#ifdef CSR_SUPPORT_SME - if ((protection = uf_get_protection_bit_from_interfacemode(priv, interfaceTag, peerMacAddress.a)) < 0) { - unifi_error(priv, "unicast address, but destination not in station record database\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - return -1; - } -#else - protection = 0; -#endif - -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - } -#endif - - /* add Mac header */ - if (prepare_and_add_macheader(priv, skb, newSkb, req.Priority, &bulkdata, interfaceTag, frame, frame + ETH_ALEN, protection)) { - unifi_error(priv, "failed to create MAC header\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - return -1; - } - - if (eapolStore) { - spin_lock_irqsave(&priv->m4_lock, flags); - /* Store the EAPOL M4 packet for later */ - interfacePriv->m4_signal = *signal; - interfacePriv->m4_bulk_data.net_buf_length = bulkdata.d[0].net_buf_length; - interfacePriv->m4_bulk_data.data_length = bulkdata.d[0].data_length; - interfacePriv->m4_bulk_data.os_data_ptr = bulkdata.d[0].os_data_ptr; - interfacePriv->m4_bulk_data.os_net_buf_ptr = bulkdata.d[0].os_net_buf_ptr; - spin_unlock_irqrestore(&priv->m4_lock, flags); - /* Send a signal to SME */ - unifi_trace(priv, UDBG1, "_sys_packet_req: Sending CsrWifiRouterCtrlM4ReadyToSendInd\n"); - CsrWifiRouterCtrlM4ReadyToSendIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress); - return 0; - } - - /* Send the signal to UniFi */ - /* Set the B31 to 1 for local routing*/ - r= uf_process_ma_packet_req(priv, peerMacAddress.a, (req.HostTag | 0x80000000), interfaceTag, 0, - (CSR_RATE)0, req.Priority, signal->SignalPrimitiveHeader.SenderProcessId, &bulkdata); - if (r) { - unifi_error(priv, - "_sys_packet_req: failed to send signal.\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - return r; - } - /* The final CsrWifiRouterMaPacketCfmSend() will called when the actual MA-PACKET.cfm is received from the chip */ - - return 0; -} - -void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - int r; - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterMaPacketReq* mareq = (CsrWifiRouterMaPacketReq*)msg; - llc_snap_hdr_t *snap; - u16 snap_protocol; - CSR_SIGNAL signal; - CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest; - CsrWifiRouterCtrlPortAction controlPortaction; - u8 *daddr, *saddr; - u16 interfaceTag = mareq->interfaceTag & 0x00ff; - int queue; - netInterface_priv_t *interfacePriv; - - if (!mareq->frame || !priv || !priv->smepriv) - { - unifi_error(priv, "CsrWifiRouterMaPacketReqHandler: invalid frame/priv/priv->smepriv\n"); - return; - } - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "CsrWifiRouterMaPacketReqHandler: interfaceID >= CSR_WIFI_NUM_INTERFACES.\n"); - return; - } - - interfacePriv = priv->interfacePriv[interfaceTag]; - /* get a pointer to dest & source Mac address */ - daddr = mareq->frame; - saddr = (mareq->frame + ETH_ALEN); - /* point to the proper position of frame, since frame has MAC header */ - snap = (llc_snap_hdr_t *) (mareq->frame + 2 * ETH_ALEN); - snap_protocol = ntohs(snap->protocol); - if((snap_protocol == ETH_P_PAE) -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - || (snap_protocol == ETH_P_WAI) -#endif - ) - { - queue = UF_UNCONTROLLED_PORT_Q; - } - else - { - queue = UF_CONTROLLED_PORT_Q; - } - - /* Controlled port restrictions apply to the packets */ - controlPortaction = uf_sme_port_state(priv, daddr, queue, interfaceTag); - if (controlPortaction != CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) - { - unifi_warning(priv, "CsrWifiRouterMaPacketReqHandler: (%s)controlled port is closed.\n", (queue == UF_CONTROLLED_PORT_Q)?"":"un"); - if(mareq->cfmRequested) - { - CsrWifiRouterMaPacketCfmSend(msg->source, - interfaceTag, - CSR_RESULT_FAILURE, - mareq->hostTag, 0); - } - return; - } - - signal.SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID; - /* Store the appHandle in the LSB of the SenderId. */ - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(((priv->sme_cli->sender_id & 0xff00) | (unsigned int)msg->source), - (u8*)&signal.SignalPrimitiveHeader.SenderProcessId); - signal.SignalPrimitiveHeader.ReceiverProcessId = 0; - - /* Fill in the MA-PACKET.req signal */ - memcpy(req->Ra.x, daddr, ETH_ALEN); - req->Priority = mareq->priority; - req->TransmitRate = 0; /* Let firmware select the rate*/ - req->VirtualInterfaceIdentifier = uf_get_vif_identifier(interfacePriv->interfaceMode, interfaceTag); - req->HostTag = mareq->hostTag; - - if(mareq->cfmRequested) - req->TransmissionControl = 0; - else - req->TransmissionControl = CSR_NO_CONFIRM_REQUIRED; - - r = _sys_packet_req(priv, &signal, mareq->subscriptionHandle, - mareq->frameLength, mareq->frame, snap_protocol); - - if (r && mareq->cfmRequested) - { - CsrWifiRouterMaPacketCfmSend(msg->source, interfaceTag, - CSR_RESULT_FAILURE, - mareq->hostTag, 0); - } - return; -} - -void CsrWifiRouterMaPacketCancelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -void CsrWifiRouterCtrlM4TransmitReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlM4TransmitReq* req = (CsrWifiRouterCtrlM4TransmitReq*)msg; - int r; - bulk_data_param_t bulkdata; - netInterface_priv_t *interfacePriv; - CSR_SIGNAL m4_signal; - unsigned long flags; - - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlM4TransmitReqHandler: invalid smepriv\n"); - return; - } - if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "M4TransmitReqHandler: interfaceTag >= CSR_WIFI_NUM_INTERFACES\n"); - return; - } - - interfacePriv = priv->interfacePriv[req->interfaceTag]; - spin_lock_irqsave(&priv->m4_lock, flags); - if (interfacePriv->m4_bulk_data.data_length == 0) { - spin_unlock_irqrestore(&priv->m4_lock, flags); - unifi_error(priv, "CsrWifiRouterCtrlM4TransmitReqHandler: invalid buffer\n"); - return; - } - - memcpy(&bulkdata.d[0], &interfacePriv->m4_bulk_data, sizeof(bulk_data_desc_t)); - - interfacePriv->m4_bulk_data.net_buf_length = 0; - interfacePriv->m4_bulk_data.data_length = 0; - interfacePriv->m4_bulk_data.os_data_ptr = interfacePriv->m4_bulk_data.os_net_buf_ptr = NULL; - m4_signal = interfacePriv->m4_signal; - spin_unlock_irqrestore(&priv->m4_lock, flags); - - bulkdata.d[1].os_data_ptr = NULL; - bulkdata.d[1].data_length = 0; - - interfacePriv->m4_sent = TRUE; - m4_signal.u.MaPacketRequest.HostTag |= 0x80000000; - /* Store the hostTag for later varification */ - interfacePriv->m4_hostTag = m4_signal.u.MaPacketRequest.HostTag; - r = ul_send_signal_unpacked(priv, &m4_signal, &bulkdata); - unifi_trace(priv, UDBG1, - "CsrWifiRouterCtrlM4TransmitReqHandler: sent\n"); - if (r) { - unifi_error(priv, - "CsrWifiRouterCtrlM4TransmitReqHandler: failed to send signal.\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - } -} - -/* reset the station records when the mode is set as CSR_WIFI_ROUTER_CTRL_MODE_NONE */ -static void CsrWifiRouterCtrlResetStationRecordList(unifi_priv_t *priv, u16 interfaceTag) -{ - u8 i, j; - CsrWifiRouterCtrlStaInfo_t *staInfo=NULL; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - unsigned long lock_flags; - - /* create a list for sending confirms of un-delivered packets */ - struct list_head send_cfm_list; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "CsrWifiRouterCtrlResetStationRecordList: bad interfaceTag\n"); - return; - } - - INIT_LIST_HEAD(&send_cfm_list); - - /* Reset the station record to NULL if mode is NONE */ - for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { - if ((staInfo=interfacePriv->staInfo[i]) != NULL) { - uf_prepare_send_cfm_list_for_queued_pkts(priv, - &send_cfm_list, - &(staInfo->mgtFrames)); - uf_flush_list(priv, &(staInfo->mgtFrames)); - for(j=0;j<MAX_ACCESS_CATOGORY;j++){ - uf_prepare_send_cfm_list_for_queued_pkts(priv, - &send_cfm_list, - &(staInfo->dataPdu[j])); - uf_flush_list(priv, &(staInfo->dataPdu[j])); - } - - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - /* Removing station record information from port config array */ - memset(staInfo->peerControlledPort, 0, sizeof(unifi_port_cfg_t)); - staInfo->peerControlledPort->port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; - staInfo->peerControlledPort->in_use = FALSE; - interfacePriv->controlled_data_port.entries_in_use--; - - memset(staInfo->peerUnControlledPort, 0, sizeof(unifi_port_cfg_t)); - staInfo->peerUnControlledPort->port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; - staInfo->peerUnControlledPort->in_use = FALSE; - interfacePriv->uncontrolled_data_port.entries_in_use--; - - kfree(interfacePriv->staInfo[i]); - interfacePriv->staInfo[i] = NULL; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - } - } - /* after the critical region process the list of frames that requested cfm - * and send cfm to requestor one by one - */ - send_auto_ma_packet_confirm(priv, interfacePriv, &send_cfm_list); - -#ifdef CSR_SUPPORT_SME - /* Interface Independent, no of packet queued, incase of mode is None or AP set to 0 */ - switch(interfacePriv->interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - case CSR_WIFI_ROUTER_CTRL_MODE_NONE: - if (priv->noOfPktQueuedInDriver) { - unifi_warning(priv, "After reset the noOfPktQueuedInDriver = %x\n", priv->noOfPktQueuedInDriver); - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - priv->noOfPktQueuedInDriver = 0; - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - } - break; - case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: - break; - default: - unifi_error(priv, "interfacemode is not correct in CsrWifiRouterCtrlResetStationRecordList: debug\n"); - } -#endif - - if (((interfacePriv->controlled_data_port.entries_in_use != 0) || (interfacePriv->uncontrolled_data_port.entries_in_use != 0)) - && (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_NONE)) { - /* Print in case if the value of entries goes to -ve/+ve (apart from 0) - * we expect the entries should be zero here if mode is set as NONE - */ - unifi_trace(priv, UDBG3, "In %s controlled port entries = %d, uncontrolled port entries = %d\n", - __FUNCTION__, interfacePriv->controlled_data_port.entries_in_use, - interfacePriv->uncontrolled_data_port.entries_in_use); - } -} - -void CsrWifiRouterCtrlInterfaceReset(unifi_priv_t *priv, u16 interfaceTag) -{ - netInterface_priv_t *interfacePriv; - - /* create a list for sending confirms of un-delivered packets */ - struct list_head send_cfm_list; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "CsrWifiRouterCtrlInterfaceReset: bad interfaceTag\n"); - return; - } - - interfacePriv = priv->interfacePriv[interfaceTag]; - - INIT_LIST_HEAD(&send_cfm_list); - - /* Enable all queues by default */ - interfacePriv->queueEnabled[0] = 1; - interfacePriv->queueEnabled[1] = 1; - interfacePriv->queueEnabled[2] = 1; - interfacePriv->queueEnabled[3] = 1; - - uf_prepare_send_cfm_list_for_queued_pkts(priv, - &send_cfm_list, - &(interfacePriv->genericMgtFrames)); - uf_flush_list(priv, &(interfacePriv->genericMgtFrames)); - - uf_prepare_send_cfm_list_for_queued_pkts(priv, - &send_cfm_list, - &(interfacePriv->genericMulticastOrBroadCastMgtFrames)); - uf_flush_list(priv, &(interfacePriv->genericMulticastOrBroadCastMgtFrames)); - - uf_prepare_send_cfm_list_for_queued_pkts(priv, - &send_cfm_list, - &(interfacePriv->genericMulticastOrBroadCastFrames)); - - uf_flush_list(priv, &(interfacePriv->genericMulticastOrBroadCastFrames)); - - /* process the list of frames that requested cfm - and send cfm to requestor one by one */ - send_auto_ma_packet_confirm(priv, interfacePriv, &send_cfm_list); - - /* Reset the station record to NULL if mode is tried to set as NONE */ - switch(interfacePriv->interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_STA: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: - case CSR_WIFI_ROUTER_CTRL_MODE_MONITOR: - case CSR_WIFI_ROUTER_CTRL_MODE_AMP: - /* station records not available in these modes */ - break; - default: - CsrWifiRouterCtrlResetStationRecordList(priv, interfaceTag); - } - - interfacePriv->num_stations_joined = 0; - interfacePriv->sta_activity_check_enabled = FALSE; -} - - -void CsrWifiRouterCtrlModeSetReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlModeSetReq* req = (CsrWifiRouterCtrlModeSetReq*)msg; - - if (priv == NULL) - { - unifi_error(priv, "CsrWifiRouterCtrlModeSetReqHandler: invalid smepriv\n"); - return; - } - - if (req->interfaceTag < CSR_WIFI_NUM_INTERFACES) - { - netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; -#ifdef CSR_WIFI_SPLIT_PATCH - u8 old_mode = interfacePriv->interfaceMode; -#endif - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlModeSetReqHandler: interfacePriv->interfaceMode = %d\n", - interfacePriv->interfaceMode); - - interfacePriv->interfaceMode = req->mode; - -#ifdef CSR_WIFI_SPLIT_PATCH - /* Detect a change in mode that requires a switch to/from the AP firmware patch. - * This should only happen when transitioning in/out of AP modes. - */ - if (CSR_WIFI_HIP_IS_AP_FW(req->mode) != CSR_WIFI_HIP_IS_AP_FW(old_mode)) - { - CsrWifiRouterCtrlVersions versions; - int r; - -#ifdef ANDROID_BUILD - /* Take the wakelock while switching patch */ - unifi_trace(priv, UDBG1, "patch switch: take wake lock\n"); - wake_lock(&unifi_sdio_wake_lock); -#endif - unifi_info(priv, "Resetting UniFi with %s patch\n", CSR_WIFI_HIP_IS_AP_FW(req->mode) ? "AP" : "STA"); - - r = uf_request_firmware_files(priv, UNIFI_FW_STA); - if (r) { - unifi_error(priv, "CsrWifiRouterCtrlModeSetReqHandler: Failed to get f/w\n"); - CsrWifiRouterCtrlModeSetCfmSend(msg->source, req->clientData, req->interfaceTag, - req->mode, CSR_RESULT_FAILURE); - return; - } - - /* Block the I/O thread */ - priv->bh_thread.block_thread = 1; - - /* Reset and download the new patch */ - r = uf_init_hw(priv); - if (r) { - unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to initialise h/w, error %d\n", r); - CsrWifiRouterCtrlModeSetCfmSend(msg->source, req->clientData, req->interfaceTag, - req->mode, CSR_RESULT_FAILURE); - return; - } - - /* Re-enable the I/O thread */ - priv->bh_thread.block_thread = 0; - - /* Get the version information from the core */ - unifi_card_info(priv->card, &priv->card_info); - - /* Copy to the unifiio_card_info structure. */ - versions.chipId = priv->card_info.chip_id; - versions.chipVersion = priv->card_info.chip_version; - versions.firmwareBuild = priv->card_info.fw_build; - versions.firmwareHip = priv->card_info.fw_hip_version; - versions.routerBuild = (char*)CSR_WIFI_VERSION; - versions.routerHip = (UNIFI_HIP_MAJOR_VERSION << 8) | UNIFI_HIP_MINOR_VERSION; - - /* Now that new firmware is running, send a WifiOnInd to the NME. This will - * cause it to retransfer the MIB. - */ - CsrWifiRouterCtrlWifiOnIndSend(msg->source, 0, CSR_RESULT_SUCCESS, versions); - - /* Store the request so we know where to send the ModeSetCfm */ - priv->pending_mode_set = *req; - } - else -#endif - { - /* No patch switch, confirm straightaway */ - CsrWifiRouterCtrlModeSetCfmSend(msg->source, req->clientData, req->interfaceTag, - req->mode, CSR_RESULT_SUCCESS); - } - - interfacePriv->bssid = req->bssid; - /* For modes other than AP/P2PGO, set below member FALSE */ - interfacePriv->intraBssEnabled = FALSE; - /* Initialise the variable bcTimSet with a value - * other then CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET value - */ - interfacePriv->bcTimSet = 0xFF; - interfacePriv->bcTimSetReqPendingFlag = FALSE; - /* Initialise the variable bcTimSetReqQueued with a value - * other then CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET value - */ - interfacePriv->bcTimSetReqQueued =0xFF; - CsrWifiRouterCtrlInterfaceReset(priv, req->interfaceTag); - - if(req->mode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - req->mode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - interfacePriv->protect = req->protection; - interfacePriv->dtimActive=FALSE; - interfacePriv->multicastPduHostTag = 0xffffffff; - /* For AP/P2PGO mode SME sending intraBssDistEnabled - * i.e. for AP: intraBssDistEnabled = TRUE, for P2PGO - * intraBssDistEnabled = TRUE/FALSE on requirement - */ - interfacePriv->intraBssEnabled = req->intraBssDistEnabled; - unifi_trace(priv, UDBG3, "CsrWifiRouterCtrlModeSetReqHandler: IntraBssDisEnabled = %d\n", - req->intraBssDistEnabled); - } else if (req->mode == CSR_WIFI_ROUTER_CTRL_MODE_NONE) { - netif_carrier_off(priv->netdev[req->interfaceTag]); - interfacePriv->connected = UnifiConnectedUnknown; - } - } - else { - unifi_error(priv, "CsrWifiRouterCtrlModeSetReqHandler: invalid interfaceTag :%d\n", req->interfaceTag); - } -} - -void CsrWifiRouterMaPacketResHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -} - -/* delete the station record from the station record data base */ -static int peer_delete_record(unifi_priv_t *priv, CsrWifiRouterCtrlPeerDelReq *req) -{ - u8 j; - CsrWifiRouterCtrlStaInfo_t *staInfo = NULL; - unifi_port_config_t *controlledPort; - unifi_port_config_t *unControlledPort; - netInterface_priv_t *interfacePriv; - - u8 ba_session_idx = 0; - ba_session_rx_struct *ba_session_rx = NULL; - ba_session_tx_struct *ba_session_tx = NULL; - - /* create a list for sending confirms of un-delivered packets */ - struct list_head send_cfm_list; - - unsigned long lock_flags; - - if ((req->peerRecordHandle >= UNIFI_MAX_CONNECTIONS) || (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES)) { - unifi_error(priv, "handle/interfaceTag is not proper, handle = %d, interfaceTag = %d\n", req->peerRecordHandle, req->interfaceTag); - return CSR_RESULT_FAILURE; - } - - INIT_LIST_HEAD(&send_cfm_list); - - interfacePriv = priv->interfacePriv[req->interfaceTag]; - /* remove the station record & make it NULL */ - if ((staInfo=interfacePriv->staInfo[req->peerRecordHandle])!=NULL) { - - uf_prepare_send_cfm_list_for_queued_pkts(priv, - &send_cfm_list, - &(staInfo->mgtFrames)); - - uf_flush_list(priv, &(staInfo->mgtFrames)); - for(j=0;j<MAX_ACCESS_CATOGORY;j++){ - uf_prepare_send_cfm_list_for_queued_pkts(priv, - &send_cfm_list, - &(staInfo->dataPdu[j])); - uf_flush_list(priv, &(staInfo->dataPdu[j])); - } - - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - /* clear the port configure array info, for the corresponding peer entry */ - controlledPort = &interfacePriv->controlled_data_port; - unControlledPort = &interfacePriv->uncontrolled_data_port; - - unifi_trace(priv, UDBG1, "peer_delete_record: Peer found handle = %d, port in use: cont(%d), unCont(%d)\n", - req->peerRecordHandle, controlledPort->entries_in_use, unControlledPort->entries_in_use); - - memset(staInfo->peerControlledPort, 0, sizeof(unifi_port_cfg_t)); - staInfo->peerControlledPort->port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; - staInfo->peerControlledPort->in_use = FALSE; - if (controlledPort->entries_in_use) { - controlledPort->entries_in_use--; - } else { - unifi_warning(priv, "number of controlled port entries is zero, trying to decrement: debug\n"); - } - - memset(staInfo->peerUnControlledPort, 0, sizeof(unifi_port_cfg_t)); - staInfo->peerUnControlledPort->port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; - staInfo->peerUnControlledPort->in_use = FALSE; - if (unControlledPort->entries_in_use) { - unControlledPort->entries_in_use--; - } else { - unifi_warning(priv, "number of uncontrolled port entries is zero, trying to decrement: debug\n"); - } - - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - /* update the TIM with zero */ - if (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_IBSS && - staInfo->timSet == CSR_WIFI_TIM_SET) { - unifi_trace(priv, UDBG3, "peer is deleted so TIM updated to 0, in firmware\n"); - update_tim(priv, staInfo->aid, 0, req->interfaceTag, req->peerRecordHandle); - } - - - /* Stop BA session if it is active, for this peer address all BA sessions - (per tID per role) are closed */ - - down(&priv->ba_mutex); - for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ - ba_session_rx = priv->interfacePriv[req->interfaceTag]->ba_session_rx[ba_session_idx]; - if(ba_session_rx) { - if(!memcmp(ba_session_rx->macAddress.a, staInfo->peerMacAddress.a, ETH_ALEN)){ - blockack_session_stop(priv, - req->interfaceTag, - CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT, - ba_session_rx->tID, - ba_session_rx->macAddress); - } - } - } - - for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){ - ba_session_tx = priv->interfacePriv[req->interfaceTag]->ba_session_tx[ba_session_idx]; - if(ba_session_tx) { - if(!memcmp(ba_session_tx->macAddress.a, staInfo->peerMacAddress.a, ETH_ALEN)){ - blockack_session_stop(priv, - req->interfaceTag, - CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR, - ba_session_tx->tID, - ba_session_tx->macAddress); - } - } - } - - up(&priv->ba_mutex); - -#ifdef CSR_SUPPORT_SME - unifi_trace(priv, UDBG1, "Canceling work queue for STA with AID: %d\n", staInfo->aid); - cancel_work_sync(&staInfo->send_disconnected_ind_task); -#endif - - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); -#ifdef CSR_SUPPORT_SME - interfacePriv->num_stations_joined--; - - staInfo->nullDataHostTag = INVALID_HOST_TAG; - - if ((interfacePriv->sta_activity_check_enabled) && - (interfacePriv->num_stations_joined < STA_INACTIVE_DETECTION_TRIGGER_THRESHOLD)) - { - unifi_trace(priv, UDBG1, "STOPPING the Inactivity Timer (num of stations = %d)\n", interfacePriv->num_stations_joined); - interfacePriv->sta_activity_check_enabled = FALSE; - del_timer_sync(&interfacePriv->sta_activity_check_timer); - } -#endif - - /* Free the station record for corresponding peer */ - kfree(interfacePriv->staInfo[req->peerRecordHandle]); - interfacePriv->staInfo[req->peerRecordHandle] = NULL; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - - /* after the critical region process the list of frames that requested cfm - and send cfm to requestor one by one */ - send_auto_ma_packet_confirm(priv, interfacePriv, &send_cfm_list); - - - } - else - { - unifi_trace(priv, UDBG3, " peer not found: Delete request Peer handle[%d]\n", req->peerRecordHandle); - } - - return CSR_RESULT_SUCCESS; -} - -void CsrWifiRouterCtrlPeerDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - CsrWifiRouterCtrlPeerDelReq* req = (CsrWifiRouterCtrlPeerDelReq*)msg; - CsrResult status = CSR_RESULT_SUCCESS; - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - netInterface_priv_t *interfacePriv; - - unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerDelReqHandler\n"); - if (priv == NULL) - { - unifi_error(priv, "CsrWifiRouterCtrlPeerDelReqHandler: invalid smepriv\n"); - return; - } - - if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) - { - unifi_error(priv, "CsrWifiRouterCtrlPeerDelReqHandler: bad interfaceTag\n"); - return; - } - - interfacePriv = priv->interfacePriv[req->interfaceTag]; - - switch(interfacePriv->interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - /* remove the station from station record data base */ - status = peer_delete_record(priv, req); - break; - case CSR_WIFI_ROUTER_CTRL_MODE_STA: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: - default: - /* No station record to maintain in these modes */ - break; - } - - CsrWifiRouterCtrlPeerDelCfmSend(msg->source, req->clientData, req->interfaceTag, status); - unifi_trace(priv, UDBG2, "leaving CsrWifiRouterCtrlPeerDelReqHandler \n"); -} - -/* Add the new station to the station record data base */ -static int peer_add_new_record(unifi_priv_t *priv, CsrWifiRouterCtrlPeerAddReq *req, u32 *handle) -{ - u8 i, powerModeTemp = 0; - u8 freeSlotFound = FALSE; - CsrWifiRouterCtrlStaInfo_t *newRecord = NULL; - netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; - u32 currentTime, currentTimeHi; - unsigned long lock_flags; - - if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "peer_add_new_record: bad interfaceTag\n"); - return CSR_RESULT_FAILURE; - } - - currentTime = CsrTimeGet(¤tTimeHi); - - for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { - if(interfacePriv->staInfo[i] == NULL) { - /* Slot is empty, so can be used for station record */ - freeSlotFound = TRUE; - *handle = i; - - /* Allocate for the new station record , to avoid race condition would happen between ADD_PEER & - * DEL_PEER the allocation made atomic memory rather than kernel memory - */ - newRecord = kmalloc(sizeof(CsrWifiRouterCtrlStaInfo_t), GFP_ATOMIC); - if (!newRecord) { - unifi_error(priv, "failed to allocate the %d bytes of mem for station record\n", - sizeof(CsrWifiRouterCtrlStaInfo_t)); - return CSR_RESULT_FAILURE; - } - - unifi_trace(priv, UDBG1, "peer_add_new_record: handle = %d AID = %d addr = %x:%x:%x:%x:%x:%x LI=%u\n", - *handle, req->associationId, req->peerMacAddress.a[0], req->peerMacAddress.a[1], req->peerMacAddress.a[2], - req->peerMacAddress.a[3], req->peerMacAddress.a[4], req->peerMacAddress.a[5], - req->staInfo.listenIntervalInTus); - - /* disable the preemption until station record updated */ - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - - interfacePriv->staInfo[i] = newRecord; - /* Initialize the record*/ - memset(newRecord, 0, sizeof(CsrWifiRouterCtrlStaInfo_t)); - /* update the station record */ - memcpy(newRecord->peerMacAddress.a, req->peerMacAddress.a, ETH_ALEN); - newRecord->wmmOrQosEnabled = req->staInfo.wmmOrQosEnabled; - - /* maxSpLength is bit map in qosInfo field, so converting accordingly */ - newRecord->maxSpLength = req->staInfo.maxSpLength * 2; - - /*Max SP 0 mean any number of packets. since we buffer only 512 - packets we are hard coding this to zero for the moment */ - - if(newRecord->maxSpLength == 0) - newRecord->maxSpLength=512; - - newRecord->assignedHandle = i; - - /* copy power save mode of all access catagory (Trigger/Delivery/both enabled/disabled) */ - powerModeTemp = (u8) ((req->staInfo.powersaveMode >> 4) & 0xff); - - if(!(req->staInfo.powersaveMode & 0x0001)) - newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BK]= CSR_WIFI_AC_LEGACY_POWER_SAVE; - else - newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BK]= powerModeTemp & 0x03; - - if(!(req->staInfo.powersaveMode & 0x0002)) - newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BE]= CSR_WIFI_AC_LEGACY_POWER_SAVE; - else - newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BE]= ((powerModeTemp & 0x0C)>> 2); - - if(!(req->staInfo.powersaveMode & 0x0004)) - newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VI]= CSR_WIFI_AC_LEGACY_POWER_SAVE; - else - newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VI]= ((powerModeTemp & 0x30)>> 4); - - if(!(req->staInfo.powersaveMode & 0x0008)) - newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]= CSR_WIFI_AC_LEGACY_POWER_SAVE; - else - newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]= ((powerModeTemp & 0xC0)>> 6); - - { - u8 k; - for(k=0; k< MAX_ACCESS_CATOGORY ;k++) - unifi_trace(priv, UDBG2, "peer_add_new_record: WMM : %d ,AC %d, powersaveMode %x \n", - req->staInfo.wmmOrQosEnabled, k, newRecord->powersaveMode[k]); - } - - unifi_trace(priv, UDBG3, "newRecord->wmmOrQosEnabled : %d , MAX SP : %d\n", - newRecord->wmmOrQosEnabled, newRecord->maxSpLength); - - /* Initialize the mgtFrames & data Pdu list */ - { - u8 j; - INIT_LIST_HEAD(&newRecord->mgtFrames); - for(j = 0; j < MAX_ACCESS_CATOGORY; j++) { - INIT_LIST_HEAD(&newRecord->dataPdu[j]); - } - } - - newRecord->lastActivity = currentTime; - newRecord->activity_flag = TRUE; - - /* enable the preemption as station record updated */ - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - - /* First time port actions are set for the peer with below information */ - configure_data_port(priv, CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN, &newRecord->peerMacAddress, - UF_UNCONTROLLED_PORT_Q, req->interfaceTag); - - if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS) { - configure_data_port(priv, CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN, &newRecord->peerMacAddress, - UF_CONTROLLED_PORT_Q, req->interfaceTag); - } else { - configure_data_port(priv, CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD, &newRecord->peerMacAddress, - UF_CONTROLLED_PORT_Q, req->interfaceTag); - } - - - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - /* Port status must be already set before calling the Add Peer request */ - newRecord->peerControlledPort = uf_sme_port_config_handle(priv, newRecord->peerMacAddress.a, - UF_CONTROLLED_PORT_Q, req->interfaceTag); - newRecord->peerUnControlledPort = uf_sme_port_config_handle(priv, newRecord->peerMacAddress.a, - UF_UNCONTROLLED_PORT_Q, req->interfaceTag); - - if (!newRecord->peerControlledPort || !newRecord->peerUnControlledPort) { - /* enable the preemption as station record failed to update */ - unifi_warning(priv, "Un/ControlledPort record not found in port configuration array index = %d\n", i); - kfree(interfacePriv->staInfo[i]); - interfacePriv->staInfo[i] = NULL; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - return CSR_RESULT_FAILURE; - } - - newRecord->currentPeerState = CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE; - - /* changes done during block ack handling */ - newRecord->txSuspend = FALSE; - - /*U-APSD related data structure*/ - newRecord->timRequestPendingFlag = FALSE; - - /* Initialise the variable updateTimReqQueued with a value - * other then CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET value - */ - newRecord->updateTimReqQueued = 0xFF; - newRecord->timSet = CSR_WIFI_TIM_RESET; - newRecord->uapsdActive = FALSE; - newRecord->noOfSpFramesSent =0; - newRecord->triggerFramePriority = CSR_QOS_UP0; - - /* The protection bit is updated once the port opens for corresponding peer in - * routerPortConfigure request */ - - /* update the association ID */ - newRecord->aid = req->associationId; - -#ifdef CSR_SUPPORT_SME - interfacePriv->num_stations_joined++; - newRecord->interfacePriv = interfacePriv; - newRecord->listenIntervalInTus = req->staInfo.listenIntervalInTus; - newRecord->nullDataHostTag = INVALID_HOST_TAG; - - INIT_WORK(&newRecord->send_disconnected_ind_task, uf_send_disconnected_ind_wq); - - if(!(interfacePriv->sta_activity_check_enabled) && - (interfacePriv->num_stations_joined >= STA_INACTIVE_DETECTION_TRIGGER_THRESHOLD)){ - unifi_trace(priv, UDBG1, - "peer_add_new_record: STARTING the Inactivity Timer (num of stations = %d)", - interfacePriv->num_stations_joined); - - interfacePriv->sta_activity_check_enabled = TRUE; - interfacePriv->sta_activity_check_timer.function = check_inactivity_timer_expire_func; - interfacePriv->sta_activity_check_timer.data = (unsigned long)interfacePriv; - - init_timer(&interfacePriv->sta_activity_check_timer); - mod_timer(&interfacePriv->sta_activity_check_timer, - (jiffies + usecs_to_jiffies(STA_INACTIVE_DETECTION_TIMER_INTERVAL * 1000 * 1000))); - - } -#endif - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - break; - } - } - - if(!freeSlotFound) { - unifi_error(priv, "Limited connectivity, Free slot not found for station record addition\n"); - return CSR_RESULT_FAILURE; - } - return CSR_RESULT_SUCCESS; -} - -#ifdef CSR_SUPPORT_SME -static void check_inactivity_timer_expire_func(unsigned long data) -{ - struct unifi_priv *priv; - CsrWifiRouterCtrlStaInfo_t *sta_record = NULL; - u8 i = 0; - u32 now; - u32 inactive_time; - netInterface_priv_t *interfacePriv = (netInterface_priv_t *) data; - - if (!interfacePriv) - { - return; - } - - priv = interfacePriv->privPtr; - - if (interfacePriv->InterfaceTag >= CSR_WIFI_NUM_INTERFACES) - { - unifi_error(priv, "check_inactivity_timer_expire_func: Invalid interfaceTag\n"); - return; - } - - /* RUN Algorithm to check inactivity for each connected station */ - now = CsrTimeGet(NULL); - - for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { - if(interfacePriv->staInfo[i] != NULL) { - sta_record = interfacePriv->staInfo[i]; - - if (sta_record->activity_flag == TRUE){ - sta_record->activity_flag = FALSE; - sta_record->lastActivity = now; - continue; - } - - if (sta_record->lastActivity > now) - { - /* simple timer wrap (for 1 wrap) */ - inactive_time = CsrTimeAdd((u32)CsrTimeSub(CSR_SCHED_TIME_MAX, sta_record->lastActivity), now); - } - else - { - inactive_time = (u32)CsrTimeSub(now, sta_record->lastActivity); - } - - if (inactive_time >= STA_INACTIVE_TIMEOUT_VAL) - { - unifi_trace(priv, UDBG1, "STA is Inactive - AID = %d inactive_time = %d\n", - sta_record->aid, - inactive_time); - - /* station is in-active, if it is in active mode send a null frame - * and the station should acknowledge the null frame, if acknowledgement - * is not received throw out the station. - * If the station is in Power Save, update TIM for the station so - * that it wakes up and register some activity through PS-Poll or - * trigger frame. - */ - if (sta_record->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) - { - unifi_trace(priv, UDBG1, "STA power save state - Active, send a NULL frame to check if it is ALIVE\n"); - uf_send_nulldata ( priv, - sta_record->interfacePriv->InterfaceTag, - sta_record->peerMacAddress.a, - CSR_CONTENTION, - sta_record); - } - else if (sta_record->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) - { - if((sta_record->timSet == CSR_WIFI_TIM_SET) || - (sta_record->timSet == CSR_WIFI_TIM_SETTING)) - { - unifi_trace(priv, UDBG1, "STA power save state - PS, TIM is already SET\n"); - - /* If TIM is set and we do not have any activity for - * more than 3 listen intervals then send a disconnected - * indication to SME, to delete the station from station - * record list. - * The inactivity is already more than STA_INACTIVE_TIMEOUT_VAL - * and this check ensures if the listen interval is a larger - * value than STA_INACTIVE_TIMEOUT_VAL. - */ - if (inactive_time > (3 * (sta_record->listenIntervalInTus * 1024))) - { - unifi_trace(priv, UDBG1, "STA is inactive for more than 3 listen intervals\n"); - queue_work( priv->unifi_workqueue, - &sta_record->send_disconnected_ind_task); - } - - } - else - { - unifi_trace(priv, UDBG1, "STA power save state - PS, update TIM to see if it is ALIVE\n"); - update_tim(priv, - sta_record->aid, - CSR_WIFI_TIM_SET, - interfacePriv->InterfaceTag, - sta_record->assignedHandle); - } - } - } - } - } - - /* re-run the timer interrupt */ - mod_timer(&interfacePriv->sta_activity_check_timer, - (jiffies + usecs_to_jiffies(STA_INACTIVE_DETECTION_TIMER_INTERVAL * 1000 * 1000))); - -} - - -void uf_send_disconnected_ind_wq(struct work_struct *work) -{ - - CsrWifiRouterCtrlStaInfo_t *staInfo = container_of(work, CsrWifiRouterCtrlStaInfo_t, send_disconnected_ind_task); - unifi_priv_t *priv; - u16 interfaceTag; - struct list_head send_cfm_list; - u8 j; - - if(!staInfo) { - return; - } - - if(!staInfo->interfacePriv) { - return; - } - - priv = staInfo->interfacePriv->privPtr; - interfaceTag = staInfo->interfacePriv->InterfaceTag; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "uf_send_disconnected_ind_wq: invalid interfaceTag\n"); - return; - } - - /* The SME/NME may be waiting for confirmation for requested frames to this station. - * So loop through buffered frames for this station and if confirmation is - * requested, send auto confirmation with failure status. Also flush the frames so - * that these are not processed again in PEER_DEL_REQ handler. - */ - INIT_LIST_HEAD(&send_cfm_list); - - uf_prepare_send_cfm_list_for_queued_pkts(priv, - &send_cfm_list, - &(staInfo->mgtFrames)); - - uf_flush_list(priv, &(staInfo->mgtFrames)); - - for(j = 0; j < MAX_ACCESS_CATOGORY; j++){ - uf_prepare_send_cfm_list_for_queued_pkts(priv, - &send_cfm_list, - &(staInfo->dataPdu[j])); - - uf_flush_list(priv, &(staInfo->dataPdu[j])); - } - - send_auto_ma_packet_confirm(priv, staInfo->interfacePriv, &send_cfm_list); - - unifi_warning(priv, "uf_send_disconnected_ind_wq: Router Disconnected IND Peer (%x-%x-%x-%x-%x-%x)\n", - staInfo->peerMacAddress.a[0], - staInfo->peerMacAddress.a[1], - staInfo->peerMacAddress.a[2], - staInfo->peerMacAddress.a[3], - staInfo->peerMacAddress.a[4], - staInfo->peerMacAddress.a[5]); - - CsrWifiRouterCtrlConnectedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, - 0, - staInfo->interfacePriv->InterfaceTag, - staInfo->peerMacAddress, - CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED); - - - return; -} - - -#endif -void CsrWifiRouterCtrlPeerAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - CsrWifiRouterCtrlPeerAddReq* req = (CsrWifiRouterCtrlPeerAddReq*)msg; - CsrResult status = CSR_RESULT_SUCCESS; - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - u32 handle = 0; - netInterface_priv_t *interfacePriv; - - unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerAddReqHandler \n"); - if (priv == NULL) - { - unifi_error(priv, "CsrWifiRouterCtrlPeerAddReqHandler: invalid smepriv\n"); - return; - } - - if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) - { - unifi_error(priv, "CsrWifiRouterCtrlPeerAddReqHandler: bad interfaceTag\n"); - return; - } - - interfacePriv = priv->interfacePriv[req->interfaceTag]; - - switch(interfacePriv->interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - /* Add station record */ - status = peer_add_new_record(priv, req, &handle); - break; - case CSR_WIFI_ROUTER_CTRL_MODE_STA: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: - default: - /* No station record to maintain in these modes */ - break; - } - - CsrWifiRouterCtrlPeerAddCfmSend(msg->source, req->clientData, req->interfaceTag, req->peerMacAddress, handle, status); - unifi_trace(priv, UDBG2, "leaving CsrWifiRouterCtrlPeerAddReqHandler \n"); -} - -void CsrWifiRouterCtrlPeerUpdateReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - CsrWifiRouterCtrlPeerUpdateReq* req = (CsrWifiRouterCtrlPeerUpdateReq*)msg; - CsrResult status = CSR_RESULT_SUCCESS; - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - - unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerUpdateReqHandler \n"); - if (priv == NULL) - { - unifi_error(priv, "CsrWifiRouterCtrlPeerUpdateReqHandler: invalid smepriv\n"); - return; - } - - CsrWifiRouterCtrlPeerUpdateCfmSend(msg->source, req->clientData, req->interfaceTag, status); - unifi_trace(priv, UDBG2, "leaving CsrWifiRouterCtrlPeerUpdateReqHandler \n"); -} - - - void CsrWifiRouterCtrlRawSdioDeinitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - /* This will never be called as it is intercepted in the Userspace */ -} - -void CsrWifiRouterCtrlRawSdioInitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - /* This will never be called as it is intercepted in the Userspace */ -} - -void -uf_send_ba_err_wq(struct work_struct *work) -{ - ba_session_rx_struct *ba_session = container_of(work, ba_session_rx_struct, send_ba_err_task); - unifi_priv_t *priv; - - if(!ba_session) { - return; - } - - if(!ba_session->interfacePriv) { - return; - } - - priv = ba_session->interfacePriv->privPtr; - - if (ba_session->interfacePriv->InterfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "%s: invalid interfaceTag\n", __FUNCTION__); - return; - } - - unifi_warning(priv, "%s: Calling CsrWifiRouterCtrlBlockAckErrorIndSend(%d, %d, %d, %d, %x:%x:%x:%x:%x:%x, %d)\n", - __FUNCTION__, - priv->CSR_WIFI_SME_IFACEQUEUE, - 0, - ba_session->interfacePriv->InterfaceTag, - ba_session->tID, - ba_session->macAddress.a[0], - ba_session->macAddress.a[1], - ba_session->macAddress.a[2], - ba_session->macAddress.a[3], - ba_session->macAddress.a[4], - ba_session->macAddress.a[5], - CSR_RESULT_SUCCESS - ); - CsrWifiRouterCtrlBlockAckErrorIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, - 0, - ba_session->interfacePriv->InterfaceTag, - ba_session->tID, - ba_session->macAddress, - CSR_RESULT_SUCCESS); -} - - -static void ba_session_terminate_timer_func(unsigned long data) -{ - ba_session_rx_struct *ba_session = (ba_session_rx_struct*)data; - struct unifi_priv *priv; - - if(!ba_session) { - return; - } - - if(!ba_session->interfacePriv) { - return; - } - - priv = ba_session->interfacePriv->privPtr; - - if (ba_session->interfacePriv->InterfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "%s: invalid interfaceTag\n", __FUNCTION__); - return; - } - - queue_work(priv->unifi_workqueue, &ba_session->send_ba_err_task); -} - - -u8 blockack_session_stop(unifi_priv_t *priv, - u16 interfaceTag, - CsrWifiRouterCtrlBlockAckRole role, - u16 tID, - CsrWifiMacAddress macAddress) -{ - netInterface_priv_t *interfacePriv; - ba_session_rx_struct *ba_session_rx = NULL; - ba_session_tx_struct *ba_session_tx = NULL; - u8 ba_session_idx = 0; - int i; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "%s: bad interfaceTag = %d\n", __FUNCTION__, interfaceTag); - return FALSE; - } - - interfacePriv = priv->interfacePriv[interfaceTag]; - - if(!interfacePriv) { - unifi_error(priv, "%s: bad interfacePriv\n", __FUNCTION__); - return FALSE; - } - - if(tID > 15) { - unifi_error(priv, "%s: bad tID = %d\n", __FUNCTION__, tID); - return FALSE; - } - - if((role != CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR) && - (role != CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT)) { - unifi_error(priv, "%s: bad role = %d\n", __FUNCTION__, role); - return FALSE; - } - - unifi_warning(priv, - "%s: stopping ba_session for peer = %pM role = %d tID = %d\n", - __func__, macAddress.a, role, tID); - - /* find out the appropriate ba session (/station /tid /role) for which stop is requested */ - if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT){ - for (ba_session_idx =0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ - - ba_session_rx = interfacePriv->ba_session_rx[ba_session_idx]; - - if(ba_session_rx){ - if ((!memcmp(ba_session_rx->macAddress.a, macAddress.a, ETH_ALEN)) && (ba_session_rx->tID == tID)){ - break; - } - } - } - - if (!ba_session_rx || (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_RX)) { - unifi_error(priv, "%s: bad ba_session for Rx [tID=%d]\n", __FUNCTION__, tID); - return FALSE; - } - - - if(ba_session_rx->timeout) { - del_timer_sync(&ba_session_rx->timer); - } - cancel_work_sync(&ba_session_rx->send_ba_err_task); - for (i = 0; i < ba_session_rx->wind_size; i++) { - if(ba_session_rx->buffer[i].active) { - frame_desc_struct *frame_desc = &ba_session_rx->buffer[i]; - unifi_net_data_free(priv, &frame_desc->bulkdata.d[0]); - } - } - kfree(ba_session_rx->buffer); - - interfacePriv->ba_session_rx[ba_session_idx] = NULL; - kfree(ba_session_rx); - }else if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR){ - for (ba_session_idx =0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){ - ba_session_tx = interfacePriv->ba_session_tx[ba_session_idx]; - if(ba_session_tx){ - if ((!memcmp(ba_session_tx->macAddress.a, macAddress.a, ETH_ALEN)) && (ba_session_tx->tID == tID)){ - break; - } - } - } - - if (!ba_session_tx || (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_TX)) { - unifi_error(priv, "%s: bad ba_session for Tx [tID=%d]\n", __FUNCTION__, tID); - return FALSE; - } - interfacePriv->ba_session_tx[ba_session_idx] = NULL; - kfree(ba_session_tx); - - } - - return TRUE; -} - - -void CsrWifiRouterCtrlBlockAckDisableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - CsrWifiRouterCtrlBlockAckDisableReq* req = (CsrWifiRouterCtrlBlockAckDisableReq*)msg; - u8 r; - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - - unifi_trace(priv, UDBG6, "%s: in ok\n", __FUNCTION__); - - down(&priv->ba_mutex); - r = blockack_session_stop(priv, - req->interfaceTag, - req->role, - req->trafficStreamID, - req->macAddress); - up(&priv->ba_mutex); - - CsrWifiRouterCtrlBlockAckDisableCfmSend(msg->source, - req->clientData, - req->interfaceTag, - r?CSR_RESULT_SUCCESS:CSR_RESULT_FAILURE); - - unifi_trace(priv, UDBG6, "%s: out ok\n", __FUNCTION__); -} - - -u8 blockack_session_start(unifi_priv_t *priv, - u16 interfaceTag, - u16 tID, - u16 timeout, - CsrWifiRouterCtrlBlockAckRole role, - u16 wind_size, - u16 start_sn, - CsrWifiMacAddress macAddress - ) -{ - netInterface_priv_t *interfacePriv; - ba_session_rx_struct *ba_session_rx = NULL; - ba_session_tx_struct *ba_session_tx = NULL; - u8 ba_session_idx = 0; - - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "%s: bad interfaceTag = %d\n", __FUNCTION__, interfaceTag); - return FALSE; - } - - interfacePriv = priv->interfacePriv[interfaceTag]; - - if(!interfacePriv) { - unifi_error(priv, "%s: bad interfacePriv\n", __FUNCTION__); - return FALSE; - } - - if(tID > 15) - { - unifi_error(priv, "%s: bad tID=%d\n", __FUNCTION__, tID); - return FALSE; - } - - if(wind_size > MAX_BA_WIND_SIZE) { - unifi_error(priv, "%s: bad wind_size = %d\n", __FUNCTION__, wind_size); - return FALSE; - } - - if(role != CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR && - role != CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT) { - unifi_error(priv, "%s: bad role = %d\n", __FUNCTION__, role); - return FALSE; - } - - unifi_warning(priv, - "%s: ba session with peer= (%pM)\n", __func__, - macAddress.a); - - unifi_warning(priv, "%s: ba session for tID=%d timeout=%d role=%d wind_size=%d start_sn=%d\n", __FUNCTION__, - tID, - timeout, - role, - wind_size, - start_sn); - - /* Check if BA session exists for per station, per TID, per role or not. - if BA session exists update parameters and if it does not exist - create a new BA session */ - if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR){ - for (ba_session_idx =0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){ - ba_session_tx = interfacePriv->ba_session_tx[ba_session_idx]; - if (ba_session_tx) { - if ((!memcmp(ba_session_tx->macAddress.a, macAddress.a, ETH_ALEN)) && (ba_session_tx->tID == tID)){ - unifi_warning(priv, "%s: ba_session for Tx already exists\n", __FUNCTION__); - return TRUE; - } - } - } - - /* we have to create new ba_session_tx struct */ - ba_session_tx = NULL; - - /* loop through until an empty BA session slot is there and save the session there */ - for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX ; ba_session_idx++){ - if (!(interfacePriv->ba_session_tx[ba_session_idx])){ - break; - } - } - if (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_TX){ - unifi_error(priv, "%s: All ba_session used for Tx, NO free session available\n", __FUNCTION__); - return FALSE; - } - - /* create and populate the new BA session structure */ - ba_session_tx = kzalloc(sizeof(ba_session_tx_struct), GFP_KERNEL); - if (!ba_session_tx) { - unifi_error(priv, "%s: kmalloc failed for ba_session_tx\n", __FUNCTION__); - return FALSE; - } - - ba_session_tx->interfacePriv = interfacePriv; - ba_session_tx->tID = tID; - ba_session_tx->macAddress = macAddress; - - interfacePriv->ba_session_tx[ba_session_idx] = ba_session_tx; - - } else if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT){ - - for (ba_session_idx =0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ - ba_session_rx = interfacePriv->ba_session_rx[ba_session_idx]; - if (ba_session_rx) { - if ((!memcmp(ba_session_rx->macAddress.a, macAddress.a, ETH_ALEN)) && (ba_session_rx->tID == tID)){ - unifi_warning(priv, "%s: ba_session for Rx[tID = %d] already exists\n", __FUNCTION__, tID); - - if(ba_session_rx->wind_size == wind_size && - ba_session_rx->timeout == timeout && - ba_session_rx->expected_sn == start_sn) { - return TRUE; - } - - if(ba_session_rx->timeout) { - del_timer_sync(&ba_session_rx->timer); - ba_session_rx->timeout = 0; - } - - if(ba_session_rx->wind_size != wind_size) { - blockack_session_stop(priv, interfaceTag, role, tID, macAddress); - } else { - if (timeout) { - ba_session_rx->timeout = timeout; - ba_session_rx->timer.function = ba_session_terminate_timer_func; - ba_session_rx->timer.data = (unsigned long)ba_session_rx; - init_timer(&ba_session_rx->timer); - mod_timer(&ba_session_rx->timer, (jiffies + usecs_to_jiffies((ba_session_rx->timeout) * 1024))); - } - /* - * The starting sequence number shall remain same if the BA - * enable request is issued to update BA parameters only. If - * it is not same, then we scroll our window to the new starting - * sequence number. This could happen if the DELBA frame from - * originator is lost and then we receive ADDBA frame with new SSN. - */ - if(ba_session_rx->start_sn != start_sn) { - scroll_ba_window(priv, interfacePriv, ba_session_rx, start_sn); - } - return TRUE; - } - } - } - } - - /* we could have a valid BA session pointer here or un-initialized - ba session pointer. but in any case we have to create a new session. - so re-initialize the ba_session pointer */ - ba_session_rx = NULL; - - /* loop through until an empty BA session slot is there and save the session there */ - for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX ; ba_session_idx++){ - if (!(interfacePriv->ba_session_rx[ba_session_idx])){ - break; - } - } - if (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_RX){ - unifi_error(priv, "%s: All ba_session used for Rx, NO free session available\n", __FUNCTION__); - return FALSE; - } - - /* It is observed that with some devices there is a race between - * EAPOL exchanges and BA session establishment. This results in - * some EAPOL authentication packets getting stuck in BA reorder - * buffer and hence the conection cannot be established. To avoid - * this we check here if the EAPOL authentication is complete and - * if so then only allow the BA session to establish. - * - * It is verified that the peers normally re-establish - * the BA session after the initial rejection. - */ - if (CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN != uf_sme_port_state(priv, macAddress.a, UF_CONTROLLED_PORT_Q, interfacePriv->InterfaceTag)) - { - unifi_warning(priv, "blockack_session_start: Controlled port not opened, Reject BA request\n"); - return FALSE; - } - - ba_session_rx = kzalloc(sizeof(ba_session_rx_struct), GFP_KERNEL); - if (!ba_session_rx) { - unifi_error(priv, "%s: kmalloc failed for ba_session_rx\n", __FUNCTION__); - return FALSE; - } - - ba_session_rx->wind_size = wind_size; - ba_session_rx->start_sn = ba_session_rx->expected_sn = start_sn; - ba_session_rx->trigger_ba_after_ssn = FALSE; - - ba_session_rx->buffer = kzalloc(ba_session_rx->wind_size*sizeof(frame_desc_struct), GFP_KERNEL); - if (!ba_session_rx->buffer) { - kfree(ba_session_rx); - unifi_error(priv, "%s: kmalloc failed for buffer\n", __FUNCTION__); - return FALSE; - } - - INIT_WORK(&ba_session_rx->send_ba_err_task, uf_send_ba_err_wq); - if (timeout) { - ba_session_rx->timeout = timeout; - ba_session_rx->timer.function = ba_session_terminate_timer_func; - ba_session_rx->timer.data = (unsigned long)ba_session_rx; - init_timer(&ba_session_rx->timer); - mod_timer(&ba_session_rx->timer, (jiffies + usecs_to_jiffies((ba_session_rx->timeout) * 1024))); - } - - ba_session_rx->interfacePriv = interfacePriv; - ba_session_rx->tID = tID; - ba_session_rx->macAddress = macAddress; - - interfacePriv->ba_session_rx[ba_session_idx] = ba_session_rx; - } - return TRUE; -} - -void CsrWifiRouterCtrlBlockAckEnableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ - CsrWifiRouterCtrlBlockAckEnableReq* req = (CsrWifiRouterCtrlBlockAckEnableReq*)msg; - u8 r; - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - - unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - down(&priv->ba_mutex); - r = blockack_session_start(priv, - req->interfaceTag, - req->trafficStreamID, - req->timeout, - req->role, - req->bufferSize, - req->ssn, - req->macAddress - ); - up(&priv->ba_mutex); - - CsrWifiRouterCtrlBlockAckEnableCfmSend(msg->source, - req->clientData, - req->interfaceTag, - r?CSR_RESULT_SUCCESS:CSR_RESULT_FAILURE); - unifi_trace(priv, UDBG6, "<<%s: r=%d\n", __FUNCTION__, r); - -} - -void CsrWifiRouterCtrlWapiMulticastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlWapiMulticastFilterReq* req = (CsrWifiRouterCtrlWapiMulticastFilterReq*)msg; - netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; - - if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) { - - unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiMulticastFilterReq: req->status = %d\n", req->status); - - /* status 1 - Filter on - * status 0 - Filter off */ - priv->wapi_multicast_filter = req->status; - - unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); - } else { - - unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__, interfacePriv->interfaceMode); - - } -#elif defined(UNIFI_DEBUG) - /*WAPI Disabled*/ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - unifi_error(priv, "CsrWifiRouterCtrlWapiMulticastFilterReqHandler: called when WAPI isn't enabled\n"); -#endif -} - -void CsrWifiRouterCtrlWapiUnicastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlWapiUnicastFilterReq* req = (CsrWifiRouterCtrlWapiUnicastFilterReq*)msg; - netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; - - if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) { - - unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiUnicastFilterReq: req->status= %d\n", req->status); - - if ((priv->wapi_unicast_filter == 1) && (req->status == 0)) { - /* When we have successfully re-associated and obtained a new unicast key with keyid = 0 */ - priv->wapi_unicast_queued_pkt_filter = 1; - } - - /* status 1 - Filter ON - * status 0 - Filter OFF */ - priv->wapi_unicast_filter = req->status; - - unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); - } else { - - unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__, interfacePriv->interfaceMode); - - } -#elif defined(UNIFI_DEBUG) - /*WAPI Disabled*/ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastFilterReqHandler: called when WAPI isn't enabled\n"); -#endif -} - -void CsrWifiRouterCtrlWapiRxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlWapiRxPktReq* req = (CsrWifiRouterCtrlWapiRxPktReq*)msg; - int client_id, receiver_id; - bulk_data_param_t bulkdata; - CsrResult res; - ul_client_t *client; - CSR_SIGNAL signal; - CSR_MA_PACKET_INDICATION *pkt_ind; - netInterface_priv_t *interfacePriv; - - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq : invalid priv\n", __func__); - return; - } - - if (priv->smepriv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq : invalid sme priv\n", __func__); - return; - } - - interfacePriv = priv->interfacePriv[req->interfaceTag]; - - if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) { - - unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - - - if (req->dataLength == 0 || req->data == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq: invalid request\n", __FUNCTION__); - return; - } - - res = unifi_net_data_malloc(priv, &bulkdata.d[0], req->dataLength); - if (res != CSR_RESULT_SUCCESS) { - unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq: Could not allocate net data\n", __FUNCTION__); - return; - } - - /* This function is expected to be called only when the MIC has been verified by SME to be correct - * So reset the reception status to rx_success */ - res = read_unpack_signal(req->signal, &signal); - if (res) { - unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReqHandler: Received unknown or corrupted signal.\n"); - return; - } - pkt_ind = (CSR_MA_PACKET_INDICATION*) (&((&signal)->u).MaPacketIndication); - if (pkt_ind->ReceptionStatus != CSR_MICHAEL_MIC_ERROR) { - unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReqHandler: Unknown signal with reception status = %d\n", pkt_ind->ReceptionStatus); - return; - } else { - unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlWapiRxPktReqHandler: MIC verified , RX_SUCCESS \n", __FUNCTION__); - pkt_ind->ReceptionStatus = CSR_RX_SUCCESS; - write_pack(&signal, req->signal, &(req->signalLength)); - } - - memcpy((void*)bulkdata.d[0].os_data_ptr, req->data, req->dataLength); - - receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((req->signal) + sizeof(s16)) & 0xFFF0; - client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT; - - client = &priv->ul_clients[client_id]; - - if (client && client->event_hook) { - unifi_trace(priv, UDBG3, - "CsrWifiRouterCtrlWapiRxPktReq: " - "Sending signal to client %d, (s:0x%X, r:0x%X) - Signal 0x%X \n", - client->client_id, client->sender_id, receiver_id, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(req->signal)); - - client->event_hook(client, req->signal, req->signalLength, &bulkdata, UDI_TO_HOST); - } else { - unifi_trace(priv, UDBG4, "No client to give the packet to\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - } - - unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); - } else { - unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__, interfacePriv->interfaceMode); - } -#elif defined(UNIFI_DEBUG) - /*WAPI Disabled*/ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReqHandler: called when WAPI isn't enabled\n"); -#endif -} - -void CsrWifiRouterCtrlWapiUnicastTxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) - - unifi_priv_t *priv = (unifi_priv_t*) drvpriv; - CsrWifiRouterCtrlWapiUnicastTxPktReq *req = (CsrWifiRouterCtrlWapiUnicastTxPktReq*) msg; - netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; - bulk_data_param_t bulkdata; - u8 macHeaderLengthInBytes = MAC_HEADER_SIZE; - /*KeyID, Reserved, PN, MIC*/ - u8 appendedCryptoFields = 1 + 1 + 16 + 16; - CsrResult result; - /* Retrieve the MA PACKET REQ fields from the Signal retained from send_ma_pkt_request() */ - CSR_MA_PACKET_REQUEST *storedSignalMAPktReq = &interfacePriv->wapi_unicast_ma_pkt_sig.u.MaPacketRequest; - - if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) { - - unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - - if (priv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler : invalid priv\n", __FUNCTION__); - return; - } - if (priv->smepriv == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler : invalid sme priv\n", __FUNCTION__); - return; - } - if (req->data == NULL) { - unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: invalid request\n", __FUNCTION__); - return; - } else { - /* If it is QoS data (type = data subtype = QoS), frame header contains QoS control field */ - if ((req->data[0] & 0x88) == 0x88) { - macHeaderLengthInBytes = macHeaderLengthInBytes + QOS_CONTROL_HEADER_SIZE; - } - } - if ( !(req->dataLength>(macHeaderLengthInBytes+appendedCryptoFields)) ) { - unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: invalid dataLength\n", __FUNCTION__); - return; - } - - /* Encrypted DATA Packet contained in (req->data) - * ------------------------------------------------------------------- - * |MAC Header| KeyId | Reserved | PN | xxDataxx | xxMICxxx | - * ------------------------------------------------------------------- - * (<-----Encrypted----->) - * ------------------------------------------------------------------- - * |24/26(QoS)| 1 | 1 | 16 | x | 16 | - * ------------------------------------------------------------------- - */ - result = unifi_net_data_malloc(priv, &bulkdata.d[0], req->dataLength); - if (result != CSR_RESULT_SUCCESS) { - unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: Could not allocate net data\n", __FUNCTION__); - return; - } - memcpy((void*)bulkdata.d[0].os_data_ptr, req->data, req->dataLength); - bulkdata.d[0].data_length = req->dataLength; - bulkdata.d[1].os_data_ptr = NULL; - bulkdata.d[1].data_length = 0; - - /* Send UniFi msg */ - /* Here hostTag is been sent as 0xffffffff, its been appended properly while framing MA-Packet request in pdu_processing.c file */ - result = uf_process_ma_packet_req(priv, - storedSignalMAPktReq->Ra.x, - storedSignalMAPktReq->HostTag,/* Ask for a new HostTag */ - req->interfaceTag, - storedSignalMAPktReq->TransmissionControl, - storedSignalMAPktReq->TransmitRate, - storedSignalMAPktReq->Priority, /* Retained value */ - interfacePriv->wapi_unicast_ma_pkt_sig.SignalPrimitiveHeader.SenderProcessId, /*FIXME AP: VALIDATE ???*/ - &bulkdata); - - if (result == NETDEV_TX_OK) { - (priv->netdev[req->interfaceTag])->trans_start = jiffies; - /* Should really count tx stats in the UNITDATA.status signal but - * that doesn't have the length. - */ - interfacePriv->stats.tx_packets++; - - /* count only the packet payload */ - interfacePriv->stats.tx_bytes += req->dataLength - macHeaderLengthInBytes - appendedCryptoFields; - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: (Packet Sent), sent count = %x\n", interfacePriv->stats.tx_packets); - } else { - /* Failed to send: fh queue was full, and the skb was discarded*/ - unifi_trace(priv, UDBG1, "(HIP validation failure) Result = %d\n", result); - unifi_net_data_free(priv, &bulkdata.d[0]); - - interfacePriv->stats.tx_dropped++; - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: (Packet Drop), dropped count = %x\n", interfacePriv->stats.tx_dropped); - } - - unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); - - } else { - - unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__, interfacePriv->interfaceMode); - - } -#elif defined(UNIFI_DEBUG) - /*WAPI Disabled*/ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: called when WAPI SW ENCRYPTION isn't enabled\n"); -#endif -} - -void CsrWifiRouterCtrlWapiFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) -{ -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - -#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - CsrWifiRouterCtrlWapiFilterReq* req = (CsrWifiRouterCtrlWapiFilterReq*)msg; - netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag]; - - if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) { - - unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__); - - unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiFilterReq: req->isWapiConnected [0/1] = %d \n", req->isWapiConnected); - - priv->isWapiConnection = req->isWapiConnected; - - unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__); - } else { - - unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__, interfacePriv->interfaceMode); - - } -#endif - -#elif defined(UNIFI_DEBUG) - /*WAPI Disabled*/ - unifi_priv_t *priv = (unifi_priv_t*)drvpriv; - unifi_error(priv, "CsrWifiRouterCtrlWapiFilterReq: called when WAPI isn't enabled\n"); -#endif -} diff --git a/drivers/staging/csr/sme_userspace.c b/drivers/staging/csr/sme_userspace.c deleted file mode 100644 index b919b001ef7c..000000000000 --- a/drivers/staging/csr/sme_userspace.c +++ /dev/null @@ -1,315 +0,0 @@ -/* - ***************************************************************************** - * - * FILE : sme_userspace.c - * - * PURPOSE : Support functions for userspace SME helper application. - * - * - * Copyright (C) 2008-2011 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - ***************************************************************************** - */ - -#include "unifi_priv.h" - -/* - * Fix Me..... These need to be the correct values... - * Dynamic from the user space. - */ -CsrSchedQid CSR_WIFI_ROUTER_IFACEQUEUE = 0xFFFF; -CsrSchedQid CSR_WIFI_SME_IFACEQUEUE = 0xFFFF; -#ifdef CSR_SUPPORT_WEXT_AP -CsrSchedQid CSR_WIFI_NME_IFACEQUEUE = 0xFFFF; -#endif -int -uf_sme_init(unifi_priv_t *priv) -{ - int i, j; - - CsrWifiRouterTransportInit(priv); - - priv->smepriv = priv; - - init_waitqueue_head(&priv->sme_request_wq); - - priv->filter_tclas_ies = NULL; - memset(&priv->packet_filters, 0, sizeof(uf_cfg_bcast_packet_filter_t)); - -#ifdef CSR_SUPPORT_WEXT - priv->ignore_bssid_join = FALSE; - priv->mib_data.length = 0; - - uf_sme_wext_set_defaults(priv); -#endif /* CSR_SUPPORT_WEXT*/ - - priv->sta_ip_address = 0xFFFFFFFF; - - priv->wifi_on_state = wifi_on_unspecified; - - sema_init(&priv->sme_sem, 1); - memset(&priv->sme_reply, 0, sizeof(sme_reply_t)); - - priv->ta_ind_work.in_use = 0; - priv->ta_sample_ind_work.in_use = 0; - - priv->CSR_WIFI_SME_IFACEQUEUE = 0xFFFF; - - for (i = 0; i < MAX_MA_UNIDATA_IND_FILTERS; i++) { - priv->sme_unidata_ind_filters[i].in_use = 0; - } - - /* Create a work queue item for Traffic Analysis indications to SME */ - INIT_WORK(&priv->ta_ind_work.task, uf_ta_ind_wq); - INIT_WORK(&priv->ta_sample_ind_work.task, uf_ta_sample_ind_wq); -#ifdef CSR_SUPPORT_WEXT - INIT_WORK(&priv->sme_config_task, uf_sme_config_wq); -#endif - - for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { - netInterface_priv_t *interfacePriv = priv->interfacePriv[i]; - interfacePriv->m4_sent = FALSE; - interfacePriv->m4_bulk_data.net_buf_length = 0; - interfacePriv->m4_bulk_data.data_length = 0; - interfacePriv->m4_bulk_data.os_data_ptr = interfacePriv->m4_bulk_data.os_net_buf_ptr = NULL; - - memset(&interfacePriv->controlled_data_port, 0, sizeof(unifi_port_config_t)); - interfacePriv->controlled_data_port.entries_in_use = 1; - interfacePriv->controlled_data_port.port_cfg[0].in_use = TRUE; - interfacePriv->controlled_data_port.port_cfg[0].port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; - interfacePriv->controlled_data_port.overide_action = UF_DATA_PORT_OVERIDE; - - memset(&interfacePriv->uncontrolled_data_port, 0, sizeof(unifi_port_config_t)); - interfacePriv->uncontrolled_data_port.entries_in_use = 1; - interfacePriv->uncontrolled_data_port.port_cfg[0].in_use = TRUE; - interfacePriv->uncontrolled_data_port.port_cfg[0].port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; - interfacePriv->uncontrolled_data_port.overide_action = UF_DATA_PORT_OVERIDE; - - /* Mark the remainder of the port config table as unallocated */ - for(j = 1; j < UNIFI_MAX_CONNECTIONS; j++) { - interfacePriv->controlled_data_port.port_cfg[j].in_use = FALSE; - interfacePriv->controlled_data_port.port_cfg[j].port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; - - interfacePriv->uncontrolled_data_port.port_cfg[j].in_use = FALSE; - interfacePriv->uncontrolled_data_port.port_cfg[j].port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; - } - - /* intializing the lists */ - INIT_LIST_HEAD(&interfacePriv->genericMgtFrames); - INIT_LIST_HEAD(&interfacePriv->genericMulticastOrBroadCastMgtFrames); - INIT_LIST_HEAD(&interfacePriv->genericMulticastOrBroadCastFrames); - - for(j = 0; j < UNIFI_MAX_CONNECTIONS; j++) { - interfacePriv->staInfo[j] = NULL; - } - - interfacePriv->num_stations_joined = 0; - interfacePriv->sta_activity_check_enabled = FALSE; - } - - - return 0; -} /* uf_sme_init() */ - - -void -uf_sme_deinit(unifi_priv_t *priv) -{ - int i, j; - u8 ba_session_idx; - ba_session_rx_struct *ba_session_rx = NULL; - ba_session_tx_struct *ba_session_tx = NULL; - CsrWifiRouterCtrlStaInfo_t *staInfo = NULL; - netInterface_priv_t *interfacePriv = NULL; - - /* Free any TCLASs previously allocated */ - if (priv->packet_filters.tclas_ies_length) { - priv->packet_filters.tclas_ies_length = 0; - kfree(priv->filter_tclas_ies); - priv->filter_tclas_ies = NULL; - } - - for (i = 0; i < MAX_MA_UNIDATA_IND_FILTERS; i++) { - priv->sme_unidata_ind_filters[i].in_use = 0; - } - - /* Remove all the Peer database, before going down */ - for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) { - down(&priv->ba_mutex); - for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){ - ba_session_rx = priv->interfacePriv[i]->ba_session_rx[ba_session_idx]; - if(ba_session_rx) { - blockack_session_stop(priv, - i, - CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT, - ba_session_rx->tID, - ba_session_rx->macAddress); - } - } - for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){ - ba_session_tx = priv->interfacePriv[i]->ba_session_tx[ba_session_idx]; - if(ba_session_tx) { - blockack_session_stop(priv, - i, - CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR, - ba_session_tx->tID, - ba_session_tx->macAddress); - } - } - - up(&priv->ba_mutex); - interfacePriv = priv->interfacePriv[i]; - if(interfacePriv){ - for(j = 0; j < UNIFI_MAX_CONNECTIONS; j++) { - if ((staInfo=interfacePriv->staInfo[j]) != NULL) { - /* Clear the STA activity parameters before freeing station Record */ - unifi_trace(priv, UDBG1, "uf_sme_deinit: Canceling work queue for STA with AID: %d\n", staInfo->aid); - cancel_work_sync(&staInfo->send_disconnected_ind_task); - staInfo->nullDataHostTag = INVALID_HOST_TAG; - } - } - if (interfacePriv->sta_activity_check_enabled){ - interfacePriv->sta_activity_check_enabled = FALSE; - del_timer_sync(&interfacePriv->sta_activity_check_timer); - } - } - CsrWifiRouterCtrlInterfaceReset(priv, i); - priv->interfacePriv[i]->interfaceMode = CSR_WIFI_ROUTER_CTRL_MODE_NONE; - } - - -} /* uf_sme_deinit() */ - - - - - -/* - * --------------------------------------------------------------------------- - * unifi_ta_indicate_protocol - * - * Report that a packet of a particular type has been seen - * - * Arguments: - * drv_priv The device context pointer passed to ta_init. - * protocol The protocol type enum value. - * direction Whether the packet was a tx or rx. - * src_addr The source MAC address from the data packet. - * - * Returns: - * None. - * - * Notes: - * We defer the actual sending to a background workqueue, - * see uf_ta_ind_wq(). - * --------------------------------------------------------------------------- - */ -void -unifi_ta_indicate_protocol(void *ospriv, - CsrWifiRouterCtrlTrafficPacketType packet_type, - CsrWifiRouterCtrlProtocolDirection direction, - const CsrWifiMacAddress *src_addr) -{ - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - - if (priv->ta_ind_work.in_use) { - unifi_warning(priv, - "unifi_ta_indicate_protocol: workqueue item still in use, not sending\n"); - return; - } - - if (CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX == direction) - { - u16 interfaceTag = 0; - CsrWifiRouterCtrlTrafficProtocolIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, - interfaceTag, - packet_type, - direction, - *src_addr); - } - else - { - priv->ta_ind_work.packet_type = packet_type; - priv->ta_ind_work.direction = direction; - priv->ta_ind_work.src_addr = *src_addr; - - queue_work(priv->unifi_workqueue, &priv->ta_ind_work.task); - } - -} /* unifi_ta_indicate_protocol() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_ta_indicate_sampling - * - * Send the TA sampling information to the SME. - * - * Arguments: - * drv_priv The device context pointer passed to ta_init. - * stats The TA sampling data to send. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats) -{ - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - - if (!priv) { - return; - } - - if (priv->ta_sample_ind_work.in_use) { - unifi_warning(priv, - "unifi_ta_indicate_sampling: workqueue item still in use, not sending\n"); - return; - } - - priv->ta_sample_ind_work.stats = *stats; - - queue_work(priv->unifi_workqueue, &priv->ta_sample_ind_work.task); - -} /* unifi_ta_indicate_sampling() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_ta_indicate_l4stats - * - * Send the TA TCP/UDP throughput information to the driver. - * - * Arguments: - * drv_priv The device context pointer passed to ta_init. - * rxTcpThroughput TCP RX throughput in KiloBytes - * txTcpThroughput TCP TX throughput in KiloBytes - * rxUdpThroughput UDP RX throughput in KiloBytes - * txUdpThroughput UDP TX throughput in KiloBytes - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -unifi_ta_indicate_l4stats(void *ospriv, - u32 rxTcpThroughput, - u32 txTcpThroughput, - u32 rxUdpThroughput, - u32 txUdpThroughput) -{ - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - - if (!priv) { - return; - } - /* Save the info. The actual action will be taken in unifi_ta_indicate_sampling() */ - priv->rxTcpThroughput = rxTcpThroughput; - priv->txTcpThroughput = txTcpThroughput; - priv->rxUdpThroughput = rxUdpThroughput; - priv->txUdpThroughput = txUdpThroughput; -} /* unifi_ta_indicate_l4stats() */ diff --git a/drivers/staging/csr/sme_userspace.h b/drivers/staging/csr/sme_userspace.h deleted file mode 100644 index ebe371c732b2..000000000000 --- a/drivers/staging/csr/sme_userspace.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * *************************************************************************** - * FILE: sme_userspace.h - * - * PURPOSE: SME related definitions. - * - * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * *************************************************************************** - */ -#ifndef __LINUX_SME_USERSPACE_H__ -#define __LINUX_SME_USERSPACE_H__ 1 - -#include <linux/kernel.h> - -int uf_sme_init(unifi_priv_t *priv); -void uf_sme_deinit(unifi_priv_t *priv); -int uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length); - - -#include "csr_wifi_router_lib.h" -#include "csr_wifi_router_sef.h" -#include "csr_wifi_router_ctrl_lib.h" -#include "csr_wifi_router_ctrl_sef.h" -#include "csr_wifi_sme_task.h" -#ifdef CSR_SUPPORT_WEXT_AP -#include "csr_wifi_nme_ap_lib.h" -#endif -#include "csr_wifi_sme_lib.h" - -void CsrWifiRouterTransportInit(unifi_priv_t *priv); -void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8 *buffer, size_t bufferLength); -void CsrWifiRouterTransportDeInit(unifi_priv_t *priv); - -#endif /* __LINUX_SME_USERSPACE_H__ */ diff --git a/drivers/staging/csr/sme_wext.c b/drivers/staging/csr/sme_wext.c deleted file mode 100644 index 84f11cb53596..000000000000 --- a/drivers/staging/csr/sme_wext.c +++ /dev/null @@ -1,3327 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: sme_wext.c - * - * PURPOSE: - * Handlers for ioctls from iwconfig. - * These provide the control plane operations. - * - * Copyright (C) 2007-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#include <linux/types.h> -#include <linux/etherdevice.h> -#include <linux/if_arp.h> -#include <asm/uaccess.h> -#include <linux/ctype.h> -#include "unifi_priv.h" -#include <linux/rtnetlink.h> - -#define CHECK_INITED(_priv) \ - do { \ - if (_priv->init_progress != UNIFI_INIT_COMPLETED) { \ - unifi_trace(_priv, UDBG2, "%s unifi not ready, failing wext call\n", __FUNCTION__); \ - return -ENODEV; \ - } \ - } while (0) - -/* Workaround for the wpa_supplicant hanging issue - disabled on Android */ -#ifndef ANDROID_BUILD -#define CSR_WIFI_WEXT_HANG_WORKAROUND -#endif - -#ifdef CSR_WIFI_WEXT_HANG_WORKAROUND -# define UF_RTNL_LOCK() rtnl_lock() -# define UF_RTNL_UNLOCK() rtnl_unlock() -#else -# define UF_RTNL_LOCK() -# define UF_RTNL_UNLOCK() -#endif - - -/* - * --------------------------------------------------------------------------- - * Helper functions - * --------------------------------------------------------------------------- - */ - -/* - * --------------------------------------------------------------------------- - * wext_freq_to_channel - * channel_to_mhz - * - * These functions convert between channel number and frequency. - * - * Arguments: - * ch Channel number, as defined in 802.11 specs - * m, e Mantissa and exponent as provided by wireless extension. - * - * Returns: - * channel or frequency (in MHz) value - * --------------------------------------------------------------------------- - */ -static int -wext_freq_to_channel(int m, int e) -{ - int mhz; - - mhz = m; - while (e < 6) { - mhz /= 10; - e++; - } - while (e > 6) { - mhz *= 10; - e--; - } - - if (mhz >= 5000) { - return ((mhz - 5000) / 5); - } - - if (mhz == 2482) { - return 14; - } - - if (mhz >= 2407) { - return ((mhz - 2407) / 5); - } - - return 0; -} /* wext_freq_to_channel() */ - -static int -channel_to_mhz(int ch, int dot11a) -{ - - if (ch == 0) return 0; - if (ch > 200) return 0; - - /* 5G */ - if (dot11a) { - return (5000 + (5 * ch)); - } - - /* 2.4G */ - if (ch == 14) { - return 2484; - } - - if ((ch < 14) && (ch > 0)) { - return (2407 + (5 * ch)); - } - - return 0; -} -#ifdef CSR_SUPPORT_WEXT_AP -void uf_sme_wext_ap_set_defaults(unifi_priv_t *priv) -{ - memcpy(priv->ap_config.ssid.ssid, "defaultssid", sizeof("defaultssid")); - - priv->ap_config.ssid.length = 8; - priv->ap_config.channel = 6; - priv->ap_config.if_index = 1; - priv->ap_config.credentials.authType = 0; - priv->ap_config.max_connections=8; - - priv->group_sec_config.apGroupkeyTimeout = 0; - priv->group_sec_config.apStrictGtkRekey = 0; - priv->group_sec_config.apGmkTimeout = 0; - priv->group_sec_config.apResponseTimeout = 100; /* Default*/ - priv->group_sec_config.apRetransLimit = 3; /* Default*/ - /* Set default params even if they may not be used*/ - /* Until Here*/ - - priv->ap_mac_config.preamble = CSR_WIFI_SME_USE_LONG_PREAMBLE; - priv->ap_mac_config.shortSlotTimeEnabled = FALSE; - priv->ap_mac_config.ctsProtectionType=CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC; - - priv->ap_mac_config.wmmEnabled = TRUE; - priv->ap_mac_config.wmmApParams[0].cwMin=4; - priv->ap_mac_config.wmmApParams[0].cwMax=10; - priv->ap_mac_config.wmmApParams[0].aifs=3; - priv->ap_mac_config.wmmApParams[0].txopLimit=0; - priv->ap_mac_config.wmmApParams[0].admissionControlMandatory=FALSE; - priv->ap_mac_config.wmmApParams[1].cwMin=4; - priv->ap_mac_config.wmmApParams[1].cwMax=10; - priv->ap_mac_config.wmmApParams[1].aifs=7; - priv->ap_mac_config.wmmApParams[1].txopLimit=0; - priv->ap_mac_config.wmmApParams[1].admissionControlMandatory=FALSE; - priv->ap_mac_config.wmmApParams[2].cwMin=3; - priv->ap_mac_config.wmmApParams[2].cwMax=4; - priv->ap_mac_config.wmmApParams[2].aifs=1; - priv->ap_mac_config.wmmApParams[2].txopLimit=94; - priv->ap_mac_config.wmmApParams[2].admissionControlMandatory=FALSE; - priv->ap_mac_config.wmmApParams[3].cwMin=2; - priv->ap_mac_config.wmmApParams[3].cwMax=3; - priv->ap_mac_config.wmmApParams[3].aifs=1; - priv->ap_mac_config.wmmApParams[3].txopLimit=47; - priv->ap_mac_config.wmmApParams[3].admissionControlMandatory=FALSE; - - priv->ap_mac_config.wmmApBcParams[0].cwMin=4; - priv->ap_mac_config.wmmApBcParams[0].cwMax=10; - priv->ap_mac_config.wmmApBcParams[0].aifs=3; - priv->ap_mac_config.wmmApBcParams[0].txopLimit=0; - priv->ap_mac_config.wmmApBcParams[0].admissionControlMandatory=FALSE; - priv->ap_mac_config.wmmApBcParams[1].cwMin=4; - priv->ap_mac_config.wmmApBcParams[1].cwMax=10; - priv->ap_mac_config.wmmApBcParams[1].aifs=7; - priv->ap_mac_config.wmmApBcParams[1].txopLimit=0; - priv->ap_mac_config.wmmApBcParams[1].admissionControlMandatory=FALSE; - priv->ap_mac_config.wmmApBcParams[2].cwMin=3; - priv->ap_mac_config.wmmApBcParams[2].cwMax=4; - priv->ap_mac_config.wmmApBcParams[2].aifs=2; - priv->ap_mac_config.wmmApBcParams[2].txopLimit=94; - priv->ap_mac_config.wmmApBcParams[2].admissionControlMandatory=FALSE; - priv->ap_mac_config.wmmApBcParams[3].cwMin=2; - priv->ap_mac_config.wmmApBcParams[3].cwMax=3; - priv->ap_mac_config.wmmApBcParams[3].aifs=2; - priv->ap_mac_config.wmmApBcParams[3].txopLimit=47; - priv->ap_mac_config.wmmApBcParams[3].admissionControlMandatory=FALSE; - - priv->ap_mac_config.accessType=CSR_WIFI_AP_ACCESS_TYPE_NONE; - priv->ap_mac_config.macAddressListCount=0; - priv->ap_mac_config.macAddressList=NULL; - - priv->ap_mac_config.apHtParams.rxStbc=1; - priv->ap_mac_config.apHtParams.rifsModeAllowed=TRUE; - priv->ap_mac_config.apHtParams.greenfieldSupported=FALSE; - priv->ap_mac_config.apHtParams.shortGi20MHz=TRUE; - priv->ap_mac_config.apHtParams.htProtection=0; - priv->ap_mac_config.apHtParams.dualCtsProtection=FALSE; - - priv->ap_mac_config.phySupportedBitmap = - (CSR_WIFI_SME_AP_PHY_SUPPORT_B|CSR_WIFI_SME_AP_PHY_SUPPORT_G|CSR_WIFI_SME_AP_PHY_SUPPORT_N); - priv->ap_mac_config.beaconInterval= 100; - priv->ap_mac_config.dtimPeriod=3; - priv->ap_mac_config.maxListenInterval=0x00ff;/* Set it to a large value - to enable different types of - devices to join us */ - priv->ap_mac_config.supportedRatesCount = - uf_configure_supported_rates(priv->ap_mac_config.supportedRates, priv->ap_mac_config.phySupportedBitmap); -} -#endif -/* - * --------------------------------------------------------------------------- - * uf_sme_wext_set_defaults - * - * Set up power-on defaults for driver config. - * - * Note: The SME Management API *cannot* be used in this function. - * - * Arguments: - * priv Pointer to device private context struct - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -uf_sme_wext_set_defaults(unifi_priv_t *priv) -{ - memset(&priv->connection_config, 0, sizeof(CsrWifiSmeConnectionConfig)); - - priv->connection_config.bssType = CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE; - priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; - priv->connection_config.encryptionModeMask = CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE; - priv->connection_config.privacyMode = CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED; - priv->connection_config.wmmQosInfo = 0xFF; - priv->connection_config.ifIndex = CSR_WIFI_SME_RADIO_IF_BOTH; - priv->connection_config.adhocJoinOnly = FALSE; - priv->connection_config.adhocChannel = 6; - - priv->wep_tx_key_index = 0; - - priv->wext_wireless_stats.qual.qual = 0; - priv->wext_wireless_stats.qual.level = 0; - priv->wext_wireless_stats.qual.noise = 0; - priv->wext_wireless_stats.qual.updated = 0x70; -#ifdef CSR_SUPPORT_WEXT_AP - /* Initialize the default configuration for AP */ - uf_sme_wext_ap_set_defaults(priv); -#endif - - -} /* uf_sme_wext_set_defaults() */ - - -/* - * --------------------------------------------------------------------------- - * WEXT methods - * --------------------------------------------------------------------------- - */ - -/* - * --------------------------------------------------------------------------- - * unifi_giwname - handler for SIOCGIWNAME - * unifi_siwfreq - handler for SIOCSIWFREQ - * unifi_giwfreq - handler for SIOCGIWFREQ - * unifi_siwmode - handler for SIOCSIWMODE - * unifi_giwmode - handler for SIOCGIWMODE - * unifi_giwrange - handler for SIOCGIWRANGE - * unifi_siwap - handler for SIOCSIWAP - * unifi_giwap - handler for SIOCGIWAP - * unifi_siwscan - handler for SIOCSIWSCAN - * unifi_giwscan - handler for SIOCGIWSCAN - * unifi_siwessid - handler for SIOCSIWESSID - * unifi_giwessid - handler for SIOCGIWESSID - * unifi_siwencode - handler for SIOCSIWENCODE - * unifi_giwencode - handler for SIOCGIWENCODE - * - * Handler functions for IW extensions. - * These are registered via the unifi_iw_handler_def struct below - * and called by the generic IW driver support code. - * See include/net/iw_handler.h. - * - * Arguments: - * None. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static int -iwprivsdefs(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - int r; - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - CsrWifiSmeMibConfig mibConfig; - CsrWifiSmePowerConfig powerConfig; - - unifi_trace(priv, UDBG1, "iwprivs80211defaults: reload defaults\n"); - - uf_sme_wext_set_defaults(priv); - - /* Get, modify and set the MIB data */ - r = sme_mgt_mib_config_get(priv, &mibConfig); - if (r) { - unifi_error(priv, "iwprivs80211defaults: Get CsrWifiSmeMibConfigValue failed.\n"); - return r; - } - mibConfig.dot11RtsThreshold = 2347; - mibConfig.dot11FragmentationThreshold = 2346; - r = sme_mgt_mib_config_set(priv, &mibConfig); - if (r) { - unifi_error(priv, "iwprivs80211defaults: Set CsrWifiSmeMibConfigValue failed.\n"); - return r; - } - - powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW; - powerConfig.listenIntervalTu = 100; - powerConfig.rxDtims = 1; - - r = sme_mgt_power_config_set(priv, &powerConfig); - if (r) { - unifi_error(priv, "iwprivs80211defaults: Set unifi_PowerConfigValue failed.\n"); - return r; - } - - return 0; -} /* iwprivsdefs() */ - -static int -iwprivs80211ps(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - int r = 0; - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - - int ps_mode = (int)(*extra); - CsrWifiSmePowerConfig powerConfig; - - unifi_trace(priv, UDBG1, "iwprivs80211ps: power save mode = %d\n", ps_mode); - - r = sme_mgt_power_config_get(priv, &powerConfig); - if (r) { - unifi_error(priv, "iwprivs80211ps: Get unifi_PowerConfigValue failed.\n"); - return r; - } - - switch (ps_mode) { - case CSR_PMM_ACTIVE_MODE: - powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW; - break; - case CSR_PMM_POWER_SAVE: - powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH; - break; - case CSR_PMM_FAST_POWER_SAVE: - powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_MED; - break; - default: - powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO; - break; - } - - r = sme_mgt_power_config_set(priv, &powerConfig); - if (r) { - unifi_error(priv, "iwprivs80211ps: Set unifi_PowerConfigValue failed.\n"); - } - - return r; -} - -static int -iwprivg80211ps(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - - CsrWifiSmePowerConfig powerConfig; - int r; - - r = sme_mgt_power_config_get(priv, &powerConfig); - if (r) { - unifi_error(priv, "iwprivg80211ps: Get 802.11 power mode failed.\n"); - return r; - } - - switch (powerConfig.powerSaveLevel) { - case CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW: - snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING, - "Power save mode: %d (Active)", - powerConfig.powerSaveLevel); - break; - case CSR_WIFI_SME_POWER_SAVE_LEVEL_MED: - snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING, - "Power save mode: %d (Fast)", - powerConfig.powerSaveLevel); - break; - case CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH: - snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING, - "Power save mode: %d (Full)", - powerConfig.powerSaveLevel); - break; - case CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO: - snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING, - "Power save mode: %d (Auto)", - powerConfig.powerSaveLevel); - break; - default: - snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING, - "Power save mode: %d (Unknown)", - powerConfig.powerSaveLevel); - break; - } - - wrqu->data.length = strlen(extra) + 1; - - return 0; -} - -static int -iwprivssmedebug(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* No longer supported on the API */ -#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) - unifi_debug_buf_dump(); -#endif - - return 0; -} - -#ifdef CSR_SUPPORT_WEXT_AP -#define PARAM_TYPE_INT 0 -#define PARAM_TYPE_STRING 1 -#define CSR_WIFI_MAX_SSID_LEN 32 -#define CSR_WIFI_MAX_SEC_LEN 16 -#define CSR_WIFI_MAX_KEY_LEN 65 - -static int hex_look_up(char x) -{ - if(x>='0' && x<='9') - return (x-48); - if(x>= 'a' && x <= 'f') - return (x-87); - return -1; -} - -static int power (int a, int b) -{ - int i; - int num =1; - for(i=0;i<b;i++) - num *=a; - return num; -} - -static int decode_parameter_from_string(unifi_priv_t* priv, char **str_ptr, - const char *token, int param_type, - void *dst, int param_max_len) -{ - u8 int_str[7] = "0"; - u32 param_str_len; - u8 *param_str_begin, *param_str_end; - u8 *orig_str = *str_ptr; - - if (!strncmp(*str_ptr, token, strlen(token))) { - strsep(str_ptr, "=,"); - param_str_begin = *str_ptr; - strsep(str_ptr, "=,"); - if (*str_ptr == NULL) { - param_str_len = strlen(param_str_begin); - } else { - param_str_end = *str_ptr-1; - param_str_len = param_str_end - param_str_begin; - } - unifi_trace(priv, UDBG2, "'token:%s', len:%d, ", token, param_str_len); - if (param_str_len > param_max_len) { - unifi_notice(priv, "extracted param len:%d is > MAX:%d\n", param_str_len, param_max_len); - param_str_len = param_max_len; - } - switch (param_type) { - case PARAM_TYPE_INT: - { - u32 *pdst_int = dst, num =0; - int i, j=0; - if (param_str_len > sizeof(int_str)) { - param_str_len = sizeof(int_str); - } - memcpy(int_str, param_str_begin, param_str_len); - for(i = param_str_len; i>0;i--) { - if(int_str[i-1] >= '0' && int_str[i-1] <='9') { - num += ((int_str[i-1]-'0')*power(10, j)); - j++; - } else { - unifi_error(priv, "decode_parameter_from_string:not a number %c\n", (int_str[i-1])); - return -1; - } - } - *pdst_int = num; - unifi_trace(priv, UDBG2, "decode_parameter_from_string:decoded int = %d\n", *pdst_int); - } - break; - default: - memcpy(dst, param_str_begin, param_str_len); - *((char *)dst + param_str_len) = 0; - unifi_trace(priv, UDBG2, "decode_parameter_from_string:decoded string = %s\n", (char *)dst); - break; - } - } else { - unifi_error(priv, "decode_parameter_from_string: Token:%s not found in %s \n", token, orig_str); - return -1; - } - return 0; -} -static int store_ap_advanced_config_from_string(unifi_priv_t *priv, char *param_str) -{ - char * str_ptr=param_str; - int ret = 0, tmp_var; - char phy_mode[6]; - CsrWifiSmeApMacConfig * ap_mac_config = &priv->ap_mac_config; - - /* Check for BI */ - ret = decode_parameter_from_string(priv, &str_ptr, "BI=", - PARAM_TYPE_INT, &tmp_var, 5); - if(ret) { - unifi_error(priv, "store_ap_advanced_config_from_string: BI not found\n"); - return -1; - } - ap_mac_config->beaconInterval = tmp_var; - ret = decode_parameter_from_string(priv, &str_ptr, "DTIM_PER=", - PARAM_TYPE_INT, &tmp_var, 5); - if(ret) { - unifi_error(priv, "store_ap_advanced_config_from_string: DTIM_PER not found\n"); - return -1; - } - ap_mac_config->dtimPeriod = tmp_var; - ret = decode_parameter_from_string(priv, &str_ptr, "WMM=", - PARAM_TYPE_INT, &tmp_var, 5); - if(ret) { - unifi_error(priv, "store_ap_advanced_config_from_string: WMM not found\n"); - return -1; - } - ap_mac_config->wmmEnabled = tmp_var; - ret = decode_parameter_from_string(priv, &str_ptr, "PHY=", - PARAM_TYPE_STRING, phy_mode, 5); - if(ret) { - unifi_error(priv, "store_ap_advanced_config_from_string: PHY not found\n"); - } else { - if(strstr(phy_mode, "b")){ - ap_mac_config->phySupportedBitmap = CSR_WIFI_SME_AP_PHY_SUPPORT_B; - } - if(strstr(phy_mode, "g")) { - ap_mac_config->phySupportedBitmap |= CSR_WIFI_SME_AP_PHY_SUPPORT_G; - } - if(strstr(phy_mode, "n")) { - ap_mac_config->phySupportedBitmap |= CSR_WIFI_SME_AP_PHY_SUPPORT_N; - } - ap_mac_config->supportedRatesCount = - uf_configure_supported_rates(ap_mac_config->supportedRates, ap_mac_config->phySupportedBitmap); - } - return ret; -} - -static int store_ap_config_from_string( unifi_priv_t * priv, char *param_str) - -{ - char *str_ptr = param_str; - char sub_cmd[16]; - char sec[CSR_WIFI_MAX_SEC_LEN]; - char key[CSR_WIFI_MAX_KEY_LEN]; - int ret = 0, tmp_var; - CsrWifiSmeApConfig_t *ap_config = &priv->ap_config; - CsrWifiSmeApMacConfig * ap_mac_config = &priv->ap_mac_config; - memset(sub_cmd, 0, sizeof(sub_cmd)); - if(!strstr(param_str, "END")) { - unifi_error(priv, "store_ap_config_from_string:Invalid config string:%s\n", param_str); - return -1; - } - if (decode_parameter_from_string(priv, &str_ptr, "ASCII_CMD=", - PARAM_TYPE_STRING, sub_cmd, 6) != 0) { - return -1; - } - if (strncmp(sub_cmd, "AP_CFG", 6)) { - - if(!strncmp(sub_cmd , "ADVCFG", 6)) { - return store_ap_advanced_config_from_string(priv, str_ptr); - } - unifi_error(priv, "store_ap_config_from_string: sub_cmd:%s != 'AP_CFG or ADVCFG'!\n", sub_cmd); - return -1; - } - memset(ap_config, 0, sizeof(CsrWifiSmeApConfig_t)); - ret = decode_parameter_from_string(priv, &str_ptr, "SSID=", - PARAM_TYPE_STRING, ap_config->ssid.ssid, - CSR_WIFI_MAX_SSID_LEN); - if(ret) { - unifi_error(priv, "store_ap_config_from_string: SSID not found\n"); - return -1; - } - ap_config->ssid.length = strlen(ap_config->ssid.ssid); - - ret = decode_parameter_from_string(priv, &str_ptr, "SEC=", - PARAM_TYPE_STRING, sec, CSR_WIFI_MAX_SEC_LEN); - if(ret) { - unifi_error(priv, "store_ap_config_from_string: SEC not found\n"); - return -1; - } - ret = decode_parameter_from_string(priv, &str_ptr, "KEY=", - PARAM_TYPE_STRING, key, CSR_WIFI_MAX_KEY_LEN); - if(!strcasecmp(sec, "open")) { - unifi_trace(priv, UDBG2, "store_ap_config_from_string: security open"); - ap_config->credentials.authType = CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM; - if(ret) { - unifi_notice(priv, "store_ap_config_from_string: KEY not found:fine with Open\n"); - } - } - else if(!strcasecmp(sec, "wpa2-psk")) { - int i, j=0; - CsrWifiNmeApAuthPers *pers = - ((CsrWifiNmeApAuthPers *)&(ap_config->credentials.nmeAuthType.authTypePersonal)); - u8 *psk = pers->authPers_credentials.psk.psk; - - unifi_trace(priv, UDBG2, "store_ap_config_from_string: security WPA2"); - if(ret) { - unifi_error(priv, "store_ap_config_from_string: KEY not found for WPA2\n"); - return -1; - } - ap_config->credentials.authType = CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL; - pers->authSupport = CSR_WIFI_SME_RSN_AUTH_WPA2PSK; - pers->rsnCapabilities =0; - pers->wapiCapabilities =0; - pers->pskOrPassphrase=CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK; - pers->authPers_credentials.psk.encryptionMode = - (CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_CCMP |CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_CCMP) ; - for(i=0;i<32;i++){ - psk[i] = (16*hex_look_up(key[j]))+hex_look_up(key[j+1]); - j+=2; - } - - } else { - unifi_notice(priv, "store_ap_config_from_string: Unknown security: Assuming Open"); - ap_config->credentials.authType = CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM; - return -1; - } - /* Get the decoded value in a temp int variable to ensure that other fields within the struct - which are of type other than int are not over written */ - ret = decode_parameter_from_string(priv, &str_ptr, "CHANNEL=", PARAM_TYPE_INT, &tmp_var, 5); - if(ret) - return -1; - ap_config->channel = tmp_var; - ret = decode_parameter_from_string(priv, &str_ptr, "PREAMBLE=", PARAM_TYPE_INT, &tmp_var, 5); - if(ret) - return -1; - ap_mac_config->preamble = tmp_var; - ret = decode_parameter_from_string(priv, &str_ptr, "MAX_SCB=", PARAM_TYPE_INT, &tmp_var, 5); - ap_config->max_connections = tmp_var; - return ret; -} - -static int -iwprivsapstart(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int r; - - unifi_trace(priv, UDBG1, "iwprivsapstart\n" ); - r = sme_ap_start(priv, interfacePriv->InterfaceTag, &priv->ap_config); - if(r) { - unifi_error(priv, "iwprivsapstart AP START failed : %d\n", -r); - } - return r; -} - -static int -iwprivsapconfig(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - char *cfg_str = NULL; - int r; - - unifi_trace(priv, UDBG1, "iwprivsapconfig\n" ); - if (wrqu->data.length != 0) { - char *str; - if (!(cfg_str = kmalloc(wrqu->data.length+1, GFP_KERNEL))) - { - return -ENOMEM; - } - if (copy_from_user(cfg_str, wrqu->data.pointer, wrqu->data.length)) { - kfree(cfg_str); - return -EFAULT; - } - cfg_str[wrqu->data.length] = 0; - unifi_trace(priv, UDBG2, "length:%d\n", wrqu->data.length); - unifi_trace(priv, UDBG2, "AP configuration string:%s\n", cfg_str); - str = cfg_str; - if ((r = store_ap_config_from_string(priv, str))) { - unifi_error(priv, "iwprivsapconfig:Failed to decode the string %d\n", r); - kfree(cfg_str); - return -EIO; - - } - } else { - unifi_error(priv, "iwprivsapconfig argument length = 0 \n"); - return -EIO; - } - r = sme_ap_config(priv, &priv->ap_mac_config, &priv->group_sec_config); - if(r) { - unifi_error(priv, "iwprivsapstop AP Config failed : %d\n", -r); - } else if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_trace(priv, UDBG1, "iwprivsapconfig: Starting the AP"); - r = sme_ap_start(priv, interfacePriv->InterfaceTag, &priv->ap_config); - if(r) { - unifi_error(priv, "iwprivsapstart AP START failed : %d\n", -r); - } - } - kfree(cfg_str); - return r; -} - -static int -iwprivsapstop(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int r; - u16 interface_tag = interfacePriv->InterfaceTag; - - unifi_trace(priv, UDBG1, "iwprivsapstop\n" ); - r = sme_ap_stop(priv, interface_tag); - if(r) { - unifi_error(priv, "iwprivsapstop AP STOP failed : %d\n", -r); - } - return r; -} - -#ifdef ANDROID_BUILD -static int -iwprivsapfwreload(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - - unifi_trace(priv, UDBG1, "iwprivsapfwreload\n" ); - return 0; -} - -static int -iwprivsstackstart(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - unifi_trace(priv, UDBG1, "iwprivsstackstart\n" ); - return 0; -} - -static int -iwprivsstackstop(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int r = 0; - u16 interface_tag = interfacePriv->InterfaceTag; - - unifi_trace(priv, UDBG1, "iwprivsstackstop\n" ); - - switch(interfacePriv->interfaceMode) { - case CSR_WIFI_ROUTER_CTRL_MODE_STA: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: - case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: - r = sme_mgt_disconnect(priv); - break; - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - r = sme_ap_stop(priv, interface_tag); - break; - default : - break; - } - - if(r) { - unifi_error(priv, "iwprivsstackstop Stack stop failed : %d\n", -r); - } - return 0; -} -#endif /* ANDROID_BUILD */ -#endif /* CSR_SUPPORT_WEXT_AP */ - -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE -static int -iwprivsconfwapi(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - u8 enable; - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - - unifi_trace(priv, UDBG1, "iwprivsconfwapi\n" ); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "iwprivsconfwapi: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - enable = *(u8*)(extra); - - if (enable) { - priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; - priv->connection_config.authModeMask |= (CSR_WIFI_SME_AUTH_MODE_WAPI_WAIPSK | CSR_WIFI_SME_AUTH_MODE_WAPI_WAI); - priv->connection_config.encryptionModeMask |= - CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_SMS4; - } else { - priv->connection_config.authModeMask &= ~(CSR_WIFI_SME_AUTH_MODE_WAPI_WAIPSK | CSR_WIFI_SME_AUTH_MODE_WAPI_WAI); - priv->connection_config.encryptionModeMask &= - ~(CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_SMS4); - } - - return 0; -} - -static int -iwprivswpikey(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - int r = 0, i; - CsrWifiSmeKey key; - unifiio_wapi_key_t inKey; - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - - unifi_trace(priv, UDBG1, "iwprivswpikey\n" ); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "iwprivswpikey: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - inKey = *(unifiio_wapi_key_t*)(extra); - - if (inKey.unicastKey) { - key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE; - } else { - key.keyType = CSR_WIFI_SME_KEY_TYPE_GROUP; - } - - key.keyIndex = inKey.keyIndex; - - /* memcpy(key.keyRsc, inKey.keyRsc, 16); */ - for (i = 0; i < 16; i+= 2) - { - key.keyRsc[i/2] = inKey.keyRsc[i+1] << 8 | inKey.keyRsc[i]; - } - - memcpy(key.address.a, inKey.address, 6); - key.keyLength = 32; - memcpy(key.key, inKey.key, 32); - key.authenticator = 0; - key.wepTxKey = 0; - - unifi_trace(priv, UDBG1, "keyType = %d, keyIndex = %d, wepTxKey = %d, keyRsc = %x:%x, auth = %d, address = %x:%x, " - "keylength = %d, key = %x:%x\n", key.keyType, key.keyIndex, key.wepTxKey, - key.keyRsc[0], key.keyRsc[7], key.authenticator, - key.address.a[0], key.address.a[5], key.keyLength, key.key[0], - key.key[15]); - - r = sme_mgt_key(priv, &key, CSR_WIFI_SME_LIST_ACTION_ADD); - if (r) { - unifi_error(priv, "SETKEYS request was rejected with result %d\n", r); - return convert_sme_error(r); - } - - return r; -} -#endif - - -static int -unifi_giwname(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - char *name = wrqu->name; - unifi_trace(priv, UDBG2, "unifi_giwname\n"); - - if (priv->if_index == CSR_INDEX_5G) { - strcpy(name, "IEEE 802.11-a"); - } else { - strcpy(name, "IEEE 802.11-bgn"); - } - return 0; -} /* unifi_giwname() */ - - -static int -unifi_siwfreq(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct iw_freq *freq = (struct iw_freq *)wrqu; - - unifi_trace(priv, UDBG2, "unifi_siwfreq\n"); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_siwfreq: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - /* - * Channel is stored in the connection configuration, - * and set later when ask for a connection. - */ - if ((freq->e == 0) && (freq->m <= 1000)) { - priv->connection_config.adhocChannel = freq->m; - } else { - priv->connection_config.adhocChannel = wext_freq_to_channel(freq->m, freq->e); - } - - return 0; -} /* unifi_siwfreq() */ - - -static int -unifi_giwfreq(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct iw_freq *freq = (struct iw_freq *)wrqu; - int err = 0; - CsrWifiSmeConnectionInfo connectionInfo; - - unifi_trace(priv, UDBG2, "unifi_giwfreq\n"); - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_giwfreq: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - UF_RTNL_UNLOCK(); - err = sme_mgt_connection_info_get(priv, &connectionInfo); - UF_RTNL_LOCK(); - - freq->m = channel_to_mhz(connectionInfo.channelNumber, - (connectionInfo.networkType80211 == CSR_WIFI_SME_RADIO_IF_GHZ_5_0)); - freq->e = 6; - - return convert_sme_error(err); -} /* unifi_giwfreq() */ - - -static int -unifi_siwmode(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - - unifi_trace(priv, UDBG2, "unifi_siwmode\n"); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_siwmode: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - switch(wrqu->mode) { - case IW_MODE_ADHOC: - priv->connection_config.bssType = CSR_WIFI_SME_BSS_TYPE_ADHOC; - break; - case IW_MODE_INFRA: - priv->connection_config.bssType = CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE; - break; - case IW_MODE_AUTO: - priv->connection_config.bssType = CSR_WIFI_SME_BSS_TYPE_ANY_BSS; - break; - default: - unifi_notice(priv, "Unknown IW MODE value.\n"); - } - - /* Clear the SSID and BSSID configuration */ - priv->connection_config.ssid.length = 0; - memset(priv->connection_config.bssid.a, 0xFF, ETH_ALEN); - - return 0; -} /* unifi_siwmode() */ - - - -static int -unifi_giwmode(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - int r = 0; - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - CsrWifiSmeConnectionConfig connectionConfig; - - unifi_trace(priv, UDBG2, "unifi_giwmode\n"); - CHECK_INITED(priv); - - unifi_trace(priv, UDBG2, "unifi_giwmode: Exisitng mode = 0x%x\n", - interfacePriv->interfaceMode); - switch(interfacePriv->interfaceMode) { - case CSR_WIFI_ROUTER_CTRL_MODE_STA: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: - wrqu->mode = IW_MODE_INFRA; - break; - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - wrqu->mode = IW_MODE_MASTER; - break; - case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: - wrqu->mode = IW_MODE_ADHOC; - break; - case CSR_WIFI_ROUTER_CTRL_MODE_P2P: - case CSR_WIFI_ROUTER_CTRL_MODE_NONE: - UF_RTNL_UNLOCK(); - r = sme_mgt_connection_config_get(priv, &connectionConfig); - UF_RTNL_LOCK(); - if (r == 0) { - switch(connectionConfig.bssType) { - case CSR_WIFI_SME_BSS_TYPE_ADHOC: - wrqu->mode = IW_MODE_ADHOC; - break; - case CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE: - wrqu->mode = IW_MODE_INFRA; - break; - default: - wrqu->mode = IW_MODE_AUTO; - unifi_notice(priv, "Unknown IW MODE value.\n"); - } - } - break; - default: - wrqu->mode = IW_MODE_AUTO; - unifi_notice(priv, "Unknown IW MODE value.\n"); - - } - unifi_trace(priv, UDBG4, "unifi_giwmode: mode = 0x%x\n", wrqu->mode); - return r; -} /* unifi_giwmode() */ - - - -static int -unifi_giwrange(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct iw_point *dwrq = &wrqu->data; - struct iw_range *range = (struct iw_range *) extra; - int i; - - unifi_trace(NULL, UDBG2, "unifi_giwrange\n"); - - dwrq->length = sizeof(struct iw_range); - memset(range, 0, sizeof(*range)); - range->min_nwid = 0x0000; - range->max_nwid = 0x0000; - - /* - * Don't report the frequency/channel table, then the channel - * number returned elsewhere will be printed as a channel number. - */ - - /* Ranges of values reported in quality structs */ - range->max_qual.qual = 40; /* Max expected qual value */ - range->max_qual.level = -120; /* Noise floor in dBm */ - range->max_qual.noise = -120; /* Noise floor in dBm */ - - - /* space for IW_MAX_BITRATES (8 up to WE15, 32 later) */ - i = 0; -#if WIRELESS_EXT > 15 - range->bitrate[i++] = 2 * 500000; - range->bitrate[i++] = 4 * 500000; - range->bitrate[i++] = 11 * 500000; - range->bitrate[i++] = 22 * 500000; - range->bitrate[i++] = 12 * 500000; - range->bitrate[i++] = 18 * 500000; - range->bitrate[i++] = 24 * 500000; - range->bitrate[i++] = 36 * 500000; - range->bitrate[i++] = 48 * 500000; - range->bitrate[i++] = 72 * 500000; - range->bitrate[i++] = 96 * 500000; - range->bitrate[i++] = 108 * 500000; -#else - range->bitrate[i++] = 2 * 500000; - range->bitrate[i++] = 4 * 500000; - range->bitrate[i++] = 11 * 500000; - range->bitrate[i++] = 22 * 500000; - range->bitrate[i++] = 24 * 500000; - range->bitrate[i++] = 48 * 500000; - range->bitrate[i++] = 96 * 500000; - range->bitrate[i++] = 108 * 500000; -#endif /* WIRELESS_EXT < 16 */ - range->num_bitrates = i; - - range->max_encoding_tokens = NUM_WEPKEYS; - range->num_encoding_sizes = 2; - range->encoding_size[0] = 5; - range->encoding_size[1] = 13; - - range->we_version_source = 20; - range->we_version_compiled = WIRELESS_EXT; - - /* Number of channels available in h/w */ - range->num_channels = 14; - /* Number of entries in freq[] array */ - range->num_frequency = 14; - for (i = 0; (i < range->num_frequency) && (i < IW_MAX_FREQUENCIES); i++) { - int chan = i + 1; - range->freq[i].i = chan; - range->freq[i].m = channel_to_mhz(chan, 0); - range->freq[i].e = 6; - } - if ((i+3) < IW_MAX_FREQUENCIES) { - range->freq[i].i = 36; - range->freq[i].m = channel_to_mhz(36, 1); - range->freq[i].e = 6; - range->freq[i+1].i = 40; - range->freq[i+1].m = channel_to_mhz(40, 1); - range->freq[i+1].e = 6; - range->freq[i+2].i = 44; - range->freq[i+2].m = channel_to_mhz(44, 1); - range->freq[i+2].e = 6; - range->freq[i+3].i = 48; - range->freq[i+3].m = channel_to_mhz(48, 1); - range->freq[i+3].e = 6; - } - -#if WIRELESS_EXT > 16 - /* Event capability (kernel + driver) */ - range->event_capa[0] = (IW_EVENT_CAPA_K_0 | - IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | - IW_EVENT_CAPA_MASK(SIOCGIWAP) | - IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); - range->event_capa[1] = IW_EVENT_CAPA_K_1; - range->event_capa[4] = (IW_EVENT_CAPA_MASK(IWEVTXDROP) | - IW_EVENT_CAPA_MASK(IWEVCUSTOM) | - IW_EVENT_CAPA_MASK(IWEVREGISTERED) | - IW_EVENT_CAPA_MASK(IWEVEXPIRED)); -#endif /* WIRELESS_EXT > 16 */ - -#if WIRELESS_EXT > 17 - range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; -#endif /* WIRELESS_EXT > 17 */ - - - return 0; -} /* unifi_giwrange() */ - - -static int -unifi_siwap(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int err = 0; - - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_siwap: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) { - return -EINVAL; - } - - unifi_trace(priv, UDBG1, "unifi_siwap: asked for %pM\n", - wrqu->ap_addr.sa_data); - - if (is_zero_ether_addr(wrqu->ap_addr.sa_data)) { - priv->ignore_bssid_join = FALSE; - err = sme_mgt_disconnect(priv); - if (err) { - unifi_trace(priv, UDBG4, "unifi_siwap: Disconnect failed, status %d\n", err); - } - return 0; - } - - if (priv->ignore_bssid_join) { - unifi_trace(priv, UDBG4, "unifi_siwap: ignoring second join\n"); - priv->ignore_bssid_join = FALSE; - } else { - memcpy(priv->connection_config.bssid.a, wrqu->ap_addr.sa_data, ETH_ALEN); - unifi_trace(priv, UDBG1, "unifi_siwap: Joining %X:%X:%X:%X:%X:%X\n", - priv->connection_config.bssid.a[0], - priv->connection_config.bssid.a[1], - priv->connection_config.bssid.a[2], - priv->connection_config.bssid.a[3], - priv->connection_config.bssid.a[4], - priv->connection_config.bssid.a[5]); - err = sme_mgt_connect(priv); - if (err) { - unifi_error(priv, "unifi_siwap: Join failed, status %d\n", err); - return convert_sme_error(err); - } - } - - return 0; -} /* unifi_siwap() */ - - -static int -unifi_giwap(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - CsrWifiSmeConnectionInfo connectionInfo; - int r = 0; - u8 *bssid; - - CHECK_INITED(priv); - unifi_trace(priv, UDBG2, "unifi_giwap\n"); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "iwprivswpikey: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - UF_RTNL_UNLOCK(); - r = sme_mgt_connection_info_get(priv, &connectionInfo); - UF_RTNL_LOCK(); - - if (r == 0) { - bssid = connectionInfo.bssid.a; - wrqu->ap_addr.sa_family = ARPHRD_ETHER; - unifi_trace(priv, UDBG4, "unifi_giwap: BSSID = %pM\n", bssid); - - memcpy(wrqu->ap_addr.sa_data, bssid, ETH_ALEN); - } else { - memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); - } - - return 0; -} /* unifi_giwap() */ - - -static int -unifi_siwscan(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int r; - CsrWifiSsid scan_ssid; - unsigned char *channel_list = NULL; - int chans_good = 0; -#if WIRELESS_EXT > 17 - struct iw_point *data = &wrqu->data; - struct iw_scan_req *req = (struct iw_scan_req *) extra; -#endif - - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_siwscan: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - -#if WIRELESS_EXT > 17 - /* Providing a valid channel list will force an active scan */ - if (req) { - if ((req->num_channels > 0) && (req->num_channels < IW_MAX_FREQUENCIES)) { - channel_list = kmalloc(req->num_channels, GFP_KERNEL); - if (channel_list) { - int i; - for (i = 0; i < req->num_channels; i++) { - /* Convert frequency to channel number */ - int ch = wext_freq_to_channel(req->channel_list[i].m, - req->channel_list[i].e); - if (ch) { - channel_list[chans_good++] = ch; - } - } - unifi_trace(priv, UDBG1, - "SIWSCAN: Scanning %d channels\n", chans_good); - } else { - /* Fall back to scanning all */ - unifi_error(priv, "SIWSCAN: Can't alloc channel_list (%d)\n", - req->num_channels); - } - } - } - - if (req && (data->flags & IW_SCAN_THIS_ESSID)) { - memcpy(scan_ssid.ssid, req->essid, req->essid_len); - scan_ssid.length = req->essid_len; - unifi_trace(priv, UDBG1, - "SIWSCAN: Scanning for %.*s\n", - scan_ssid.length, scan_ssid.ssid); - } else -#endif - { - unifi_trace(priv, UDBG1, "SIWSCAN: Scanning for all APs\n"); - scan_ssid.length = 0; - } - - r = sme_mgt_scan_full(priv, &scan_ssid, chans_good, channel_list); - if (r) { - unifi_error(priv, "SIWSCAN: Scan returned error %d\n", r); - } else { - unifi_trace(priv, UDBG1, "SIWSCAN: Scan done\n"); - wext_send_scan_results_event(priv); - } - - if (channel_list) { - kfree(channel_list); - } - - return r; - -} /* unifi_siwscan() */ - - -static const unsigned char * -unifi_find_info_element(int id, const unsigned char *info, int len) -{ - const unsigned char *ie = info; - - while (len > 1) - { - int e_id, e_len; - e_id = ie[0]; - e_len = ie[1]; - - /* Return if we find a match */ - if (e_id == id) - { - return ie; - } - - len -= (e_len + 2); - ie += (e_len + 2); - } - - return NULL; -} /* unifi_find_info_element() */ - - -/* - * Translate scan data returned from the card to a card independent - * format that the Wireless Tools will understand - Jean II - */ -int -unifi_translate_scan(struct net_device *dev, - struct iw_request_info *info, - char *current_ev, char *end_buf, - CsrWifiSmeScanResult *scan_data, - int scan_index) -{ - struct iw_event iwe; /* Temporary buffer */ - unsigned char *info_elems; - int info_elem_len; - const unsigned char *elem; - u16 capabilities; - int signal, noise, snr; - char *start_buf = current_ev; - char *current_val; /* For rates */ - int i, r; - - info_elems = scan_data->informationElements; - info_elem_len = scan_data->informationElementsLength; - - if (!scan_data->informationElementsLength || !scan_data->informationElements) { - unifi_error(NULL, "*** NULL SCAN IEs ***\n"); - return -EIO; - } - - /* get capinfo bits */ - capabilities = scan_data->capabilityInformation; - - unifi_trace(NULL, UDBG5, "Capabilities: 0x%x\n", capabilities); - - /* First entry *MUST* be the AP MAC address */ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, scan_data->bssid.a, ETH_ALEN); - iwe.len = IW_EV_ADDR_LEN; - r = uf_iwe_stream_add_event(info, start_buf, end_buf, &iwe, IW_EV_ADDR_LEN); - if (r < 0) { - return r; - } - start_buf += r; - - /* Other entries will be displayed in the order we give them */ - - /* Add the ESSID */ - /* find SSID in Info Elems */ - elem = unifi_find_info_element(IE_SSID_ID, info_elems, info_elem_len); - if (elem) { - int e_len = elem[1]; - const unsigned char *e_ptr = elem + 2; - unsigned char buf[33]; - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWESSID; - iwe.u.essid.length = e_len; - if (iwe.u.essid.length > 32) { - iwe.u.essid.length = 32; - } - iwe.u.essid.flags = scan_index; - memcpy(buf, e_ptr, iwe.u.essid.length); - buf[iwe.u.essid.length] = '\0'; - r = uf_iwe_stream_add_point(info, start_buf, end_buf, &iwe, buf); - if (r < 0) { - return r; - } - start_buf += r; - - } - - /* Add mode */ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWMODE; - if (scan_data->bssType == CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE) { - iwe.u.mode = IW_MODE_INFRA; - } else { - iwe.u.mode = IW_MODE_ADHOC; - } - iwe.len = IW_EV_UINT_LEN; - r = uf_iwe_stream_add_event(info, start_buf, end_buf, &iwe, IW_EV_UINT_LEN); - if (r < 0) { - return r; - } - start_buf += r; - - /* Add frequency. iwlist will convert to channel using table given in giwrange */ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = scan_data->channelFrequency; - iwe.u.freq.e = 6; - r = uf_iwe_stream_add_event(info, start_buf, end_buf, &iwe, IW_EV_FREQ_LEN); - if (r < 0) { - return r; - } - start_buf += r; - - - /* Add quality statistics */ - iwe.cmd = IWEVQUAL; - /* - * level and noise below are mapped into an unsigned 8 bit number, - * ranging from [-192; 63]. The way this is achieved is simply to - * add 0x100 onto the number if it is negative, - * once clipped to the correct range. - */ - signal = scan_data->rssi; /* This value is in dBm */ - /* Clip range of snr */ - snr = (scan_data->snr > 0) ? scan_data->snr : 0; /* In dB relative, from 0 - 255 */ - snr = (snr < 255) ? snr : 255; - noise = signal - snr; - - /* Clip range of signal */ - signal = (signal < 63) ? signal : 63; - signal = (signal > -192) ? signal : -192; - - /* Clip range of noise */ - noise = (noise < 63) ? noise : 63; - noise = (noise > -192) ? noise : -192; - - /* Make u8 */ - signal = ( signal < 0 ) ? signal + 0x100 : signal; - noise = ( noise < 0 ) ? noise + 0x100 : noise; - - iwe.u.qual.level = (u8)signal; /* -192 : 63 */ - iwe.u.qual.noise = (u8)noise; /* -192 : 63 */ - iwe.u.qual.qual = snr; /* 0 : 255 */ - iwe.u.qual.updated = 0; -#if WIRELESS_EXT > 16 - iwe.u.qual.updated |= IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_UPDATED | - IW_QUAL_QUAL_UPDATED; -#if WIRELESS_EXT > 18 - iwe.u.qual.updated |= IW_QUAL_DBM; -#endif -#endif - r = uf_iwe_stream_add_event(info, start_buf, end_buf, &iwe, IW_EV_QUAL_LEN); - if (r < 0) { - return r; - } - start_buf += r; - - /* Add encryption capability */ - iwe.cmd = SIOCGIWENCODE; - if (capabilities & SIG_CAP_PRIVACY) { - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - } else { - iwe.u.data.flags = IW_ENCODE_DISABLED; - } - iwe.u.data.length = 0; - iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; - r = uf_iwe_stream_add_point(info, start_buf, end_buf, &iwe, ""); - if (r < 0) { - return r; - } - start_buf += r; - - - /* - * Rate : stuffing multiple values in a single event require a bit - * more of magic - Jean II - */ - current_val = start_buf + IW_EV_LCP_LEN; - - iwe.cmd = SIOCGIWRATE; - /* Those two flags are ignored... */ - iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; - - elem = unifi_find_info_element(IE_SUPPORTED_RATES_ID, - info_elems, info_elem_len); - if (elem) { - int e_len = elem[1]; - const unsigned char *e_ptr = elem + 2; - - /* - * Count how many rates we have. - * Zero marks the end of the list, if the list is not truncated. - */ - /* Max 8 values */ - for (i = 0; i < e_len; i++) { - if (e_ptr[i] == 0) { - break; - } - /* Bit rate given in 500 kb/s units (+ 0x80) */ - iwe.u.bitrate.value = ((e_ptr[i] & 0x7f) * 500000); - /* Add new value to event */ - r = uf_iwe_stream_add_value(info, start_buf, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); - if (r < 0) { - return r; - } - current_val +=r; - - } - } - elem = unifi_find_info_element(IE_EXTENDED_SUPPORTED_RATES_ID, - info_elems, info_elem_len); - if (elem) { - int e_len = elem[1]; - const unsigned char *e_ptr = elem + 2; - - /* - * Count how many rates we have. - * Zero marks the end of the list, if the list is not truncated. - */ - /* Max 8 values */ - for (i = 0; i < e_len; i++) { - if (e_ptr[i] == 0) { - break; - } - /* Bit rate given in 500 kb/s units (+ 0x80) */ - iwe.u.bitrate.value = ((e_ptr[i] & 0x7f) * 500000); - /* Add new value to event */ - r = uf_iwe_stream_add_value(info, start_buf, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); - if (r < 0) { - return r; - } - current_val +=r; - } - } - /* Check if we added any rates event */ - if ((current_val - start_buf) > IW_EV_LCP_LEN) { - start_buf = current_val; - } - - -#if WIRELESS_EXT > 17 - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = info_elem_len; - - r = uf_iwe_stream_add_point(info, start_buf, end_buf, &iwe, info_elems); - if (r < 0) { - return r; - } - - start_buf += r; -#endif /* WE > 17 */ - - return (start_buf - current_ev); -} /* unifi_translate_scan() */ - - - -static int -unifi_giwscan(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct iw_point *dwrq = &wrqu->data; - int r; - - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_giwscan: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - unifi_trace(priv, UDBG1, - "unifi_giwscan: buffer (%d bytes) \n", - dwrq->length); - UF_RTNL_UNLOCK(); - r = sme_mgt_scan_results_get_async(priv, info, extra, dwrq->length); - UF_RTNL_LOCK(); - if (r < 0) { - unifi_trace(priv, UDBG1, - "unifi_giwscan: buffer (%d bytes) not big enough.\n", - dwrq->length); - return r; - } - - dwrq->length = r; - dwrq->flags = 0; - - return 0; -} /* unifi_giwscan() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_siwessid - * - * Request to join a network or start and AdHoc. - * - * Arguments: - * dev Pointer to network device struct. - * info Pointer to broken-out ioctl request. - * data Pointer to argument data. - * essid Pointer to string giving name of network to join - * or start - * - * Returns: - * 0 on success and everything complete - * -EINPROGRESS to have the higher level call the commit method. - * --------------------------------------------------------------------------- - */ -static int -unifi_siwessid(struct net_device *dev, struct iw_request_info *info, - struct iw_point *data, char *essid) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int len; - int err = 0; - - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_siwessid: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - len = 0; - if (data->flags & 1) { - /* Limit length */ - len = data->length; - if (len > UNIFI_MAX_SSID_LEN) { - len = UNIFI_MAX_SSID_LEN; - } - } - -#ifdef UNIFI_DEBUG - { - char essid_str[UNIFI_MAX_SSID_LEN+1]; - int i; - - for (i = 0; i < len; i++) { - essid_str[i] = (isprint(essid[i]) ? essid[i] : '?'); - } - essid_str[i] = '\0'; - - unifi_trace(priv, UDBG1, "unifi_siwessid: asked for '%*s' (%d)\n", len, essid_str, len); - unifi_trace(priv, UDBG2, " with authModeMask = %d", priv->connection_config.authModeMask); - } -#endif - - memset(priv->connection_config.bssid.a, 0xFF, ETH_ALEN); - if (len) { - if (essid[len - 1] == 0) { - len --; - } - - memcpy(priv->connection_config.ssid.ssid, essid, len); - priv->connection_config.ssid.length = len; - - } else { - priv->connection_config.ssid.length = 0; - } - - UF_RTNL_UNLOCK(); - err = sme_mgt_connect(priv); - UF_RTNL_LOCK(); - if (err) { - unifi_error(priv, "unifi_siwessid: Join failed, status %d\n", err); - return convert_sme_error(err); - } - - return 0; -} /* unifi_siwessid() */ - - -static int -unifi_giwessid(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *essid) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct iw_point *data = &wrqu->essid; - CsrWifiSmeConnectionInfo connectionInfo; - int r = 0; - - unifi_trace(priv, UDBG2, "unifi_giwessid\n"); - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_giwessid: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - UF_RTNL_UNLOCK(); - r = sme_mgt_connection_info_get(priv, &connectionInfo); - UF_RTNL_LOCK(); - - if (r == 0) { - data->length = connectionInfo.ssid.length; - strncpy(essid, - connectionInfo.ssid.ssid, - data->length); - data->flags = 1; /* active */ - - unifi_trace(priv, UDBG2, "unifi_giwessid: %.*s\n", - data->length, essid); - } - - - return 0; -} /* unifi_giwessid() */ - - -static int -unifi_siwrate(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct iw_param *args = &wrqu->bitrate; - CsrWifiSmeMibConfig mibConfig; - int r; - - CHECK_INITED(priv); - unifi_trace(priv, UDBG2, "unifi_siwrate\n"); - - /* - * If args->fixed == 0, value is max rate or -1 for best - * If args->fixed == 1, value is rate to set or -1 for best - * args->disabled and args->flags are not used in SIOCSIWRATE - */ - - /* Get, modify and set the MIB data */ - UF_RTNL_UNLOCK(); - r = sme_mgt_mib_config_get(priv, &mibConfig); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "unifi_siwrate: Get CsrWifiSmeMibConfigValue failed.\n"); - return r; - } - - /* Default to auto rate algorithm */ - /* in 500Kbit/s, 0 means auto */ - mibConfig.unifiFixTxDataRate = 0; - - if (args->value != -1) { - mibConfig.unifiFixTxDataRate = args->value / 500000; - } - - /* 1 means rate is a maximum, 2 means rate is a set value */ - if (args->fixed == 1) { - mibConfig.unifiFixMaxTxDataRate = 0; - } else { - mibConfig.unifiFixMaxTxDataRate = 1; - } - UF_RTNL_UNLOCK(); - r = sme_mgt_mib_config_set(priv, &mibConfig); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "unifi_siwrate: Set CsrWifiSmeMibConfigValue failed.\n"); - return r; - } - - - return 0; -} /* unifi_siwrate() */ - - - -static int -unifi_giwrate(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct iw_param *args = &wrqu->bitrate; - int r; - int bitrate, flag; - CsrWifiSmeMibConfig mibConfig; - CsrWifiSmeConnectionStats connectionStats; - - unifi_trace(priv, UDBG2, "unifi_giwrate\n"); - CHECK_INITED(priv); - - flag = 0; - bitrate = 0; - UF_RTNL_UNLOCK(); - r = sme_mgt_mib_config_get(priv, &mibConfig); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "unifi_giwrate: Get CsrWifiSmeMibConfigValue failed.\n"); - return r; - } - - bitrate = mibConfig.unifiFixTxDataRate; - flag = mibConfig.unifiFixMaxTxDataRate; - - /* Used the value returned by the SME if MIB returns 0 */ - if (bitrate == 0) { - UF_RTNL_UNLOCK(); - r = sme_mgt_connection_stats_get(priv, &connectionStats); - UF_RTNL_LOCK(); - /* Ignore errors, we may be disconnected */ - if (r == 0) { - bitrate = connectionStats.unifiTxDataRate; - } - } - - args->value = bitrate * 500000; - args->fixed = !flag; - - return 0; -} /* unifi_giwrate() */ - - -static int -unifi_siwrts(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int val = wrqu->rts.value; - int r = 0; - CsrWifiSmeMibConfig mibConfig; - - unifi_trace(priv, UDBG2, "unifi_siwrts\n"); - CHECK_INITED(priv); - - if (wrqu->rts.disabled) { - val = 2347; - } - - if ( (val < 0) || (val > 2347) ) - { - return -EINVAL; - } - - /* Get, modify and set the MIB data */ - UF_RTNL_UNLOCK(); - r = sme_mgt_mib_config_get(priv, &mibConfig); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "unifi_siwrts: Get CsrWifiSmeMibConfigValue failed.\n"); - return r; - } - mibConfig.dot11RtsThreshold = val; - UF_RTNL_UNLOCK(); - r = sme_mgt_mib_config_set(priv, &mibConfig); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "unifi_siwrts: Set CsrWifiSmeMibConfigValue failed.\n"); - return r; - } - - return 0; -} - - -static int -unifi_giwrts(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int r; - int rts_thresh; - CsrWifiSmeMibConfig mibConfig; - - unifi_trace(priv, UDBG2, "unifi_giwrts\n"); - CHECK_INITED(priv); - - UF_RTNL_UNLOCK(); - r = sme_mgt_mib_config_get(priv, &mibConfig); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "unifi_giwrts: Get CsrWifiSmeMibConfigValue failed.\n"); - return r; - } - - rts_thresh = mibConfig.dot11RtsThreshold; - if (rts_thresh > 2347) { - rts_thresh = 2347; - } - - wrqu->rts.value = rts_thresh; - wrqu->rts.disabled = (rts_thresh == 2347); - wrqu->rts.fixed = 1; - - return 0; -} - - -static int -unifi_siwfrag(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int val = wrqu->frag.value; - int r = 0; - CsrWifiSmeMibConfig mibConfig; - - unifi_trace(priv, UDBG2, "unifi_siwfrag\n"); - CHECK_INITED(priv); - - if (wrqu->frag.disabled) - val = 2346; - - if ( (val < 256) || (val > 2347) ) - return -EINVAL; - - /* Get, modify and set the MIB data */ - UF_RTNL_UNLOCK(); - r = sme_mgt_mib_config_get(priv, &mibConfig); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "unifi_siwfrag: Get CsrWifiSmeMibConfigValue failed.\n"); - return r; - } - /* Fragmentation Threashold must be even */ - mibConfig.dot11FragmentationThreshold = (val & ~0x1); - UF_RTNL_UNLOCK(); - r = sme_mgt_mib_config_set(priv, &mibConfig); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "unifi_siwfrag: Set CsrWifiSmeMibConfigValue failed.\n"); - return r; - } - - return 0; -} - - -static int -unifi_giwfrag(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int r; - int frag_thresh; - CsrWifiSmeMibConfig mibConfig; - - unifi_trace(priv, UDBG2, "unifi_giwfrag\n"); - CHECK_INITED(priv); - - UF_RTNL_UNLOCK(); - r = sme_mgt_mib_config_get(priv, &mibConfig); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "unifi_giwfrag: Get CsrWifiSmeMibConfigValue failed.\n"); - return r; - } - - frag_thresh = mibConfig.dot11FragmentationThreshold; - - /* Build the return structure */ - wrqu->frag.value = frag_thresh; - wrqu->frag.disabled = (frag_thresh >= 2346); - wrqu->frag.fixed = 1; - - return 0; -} - - -static int -unifi_siwencode(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct iw_point *erq = &wrqu->encoding; - int index; - int rc = 0; - int privacy = -1; - CsrWifiSmeKey sme_key; - - unifi_trace(priv, UDBG2, "unifi_siwencode\n"); - - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_siwencode: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - /* - * Key index is encoded in the flags. - * 0 - use current default, - * 1-4 - if a key value is given set that key - * if not use that key - */ - index = (erq->flags & IW_ENCODE_INDEX); /* key number, 1-4 */ - if ((index < 0) || (index > 4)) { - unifi_error(priv, "unifi_siwencode: Request to set an invalid key (index:%d)", index); - return -EINVAL; - } - - /* - * Basic checking: do we have a key to set ? - * The IW_ENCODE_NOKEY flag is set when no key is present (only change flags), - * but older versions rely on sending a key id 1-4. - */ - if (erq->length > 0) { - - /* Check the size of the key */ - if ((erq->length > LARGE_KEY_SIZE) || (erq->length < SMALL_KEY_SIZE)) { - unifi_error(priv, "unifi_siwencode: Request to set an invalid key (length:%d)", - erq->length); - return -EINVAL; - } - - /* Check the index (none (i.e. 0) means use current) */ - if ((index < 1) || (index > 4)) { - /* If we do not have a previous key, use 1 as default */ - if (!priv->wep_tx_key_index) { - priv->wep_tx_key_index = 1; - } - index = priv->wep_tx_key_index; - } - - /* If we didn't have a key and a valid index is set, we want to remember it*/ - if (!priv->wep_tx_key_index) { - priv->wep_tx_key_index = index; - } - - unifi_trace(priv, UDBG1, "Tx key Index is %d\n", priv->wep_tx_key_index); - - privacy = 1; - - /* Check if the key is not marked as invalid */ - if ((erq->flags & IW_ENCODE_NOKEY) == 0) { - - unifi_trace(priv, UDBG1, "New %s key (len=%d, index=%d)\n", - (priv->wep_tx_key_index == index) ? "tx" : "", - erq->length, index); - - sme_key.wepTxKey = (priv->wep_tx_key_index == index); - if (priv->wep_tx_key_index == index) { - sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE; - } else { - sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_GROUP; - } - /* Key index is zero based in SME but 1 based in wext */ - sme_key.keyIndex = (index - 1); - sme_key.keyLength = erq->length; - sme_key.authenticator = 0; - memset(sme_key.address.a, 0xFF, ETH_ALEN); - memcpy(sme_key.key, extra, erq->length); - - UF_RTNL_UNLOCK(); - rc = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_ADD); - UF_RTNL_LOCK(); - if (rc) { - unifi_error(priv, "unifi_siwencode: Set key failed (%d)", rc); - return convert_sme_error(rc); - } - - /* Store the key to be reported by the SIOCGIWENCODE handler */ - priv->wep_keys[index - 1].len = erq->length; - memcpy(priv->wep_keys[index - 1].key, extra, erq->length); - } - } else { - /* - * No additional key data, so it must be a request to change the - * active key. - */ - if (index != 0) { - unifi_trace(priv, UDBG1, "Tx key Index is %d\n", index - 1); - - /* Store the index to be reported by the SIOCGIWENCODE handler */ - priv->wep_tx_key_index = index; - - sme_key.wepTxKey = 1; - sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE; - - /* Key index is zero based in SME but 1 based in wext */ - sme_key.keyIndex = (index - 1); - sme_key.keyLength = 0; - sme_key.authenticator = 0; - UF_RTNL_UNLOCK(); - rc = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_ADD); - UF_RTNL_LOCK(); - if (rc) { - unifi_error(priv, "unifi_siwencode: Set key failed (%d)", rc); - return convert_sme_error(rc); - } - - /* Turn on encryption */ - privacy = 1; - } - } - - /* Read the flags */ - if (erq->flags & IW_ENCODE_DISABLED) { - /* disable encryption */ - unifi_trace(priv, UDBG1, "disable WEP encryption\n"); - privacy = 0; - - priv->wep_tx_key_index = 0; - - unifi_trace(priv, UDBG1, "IW_ENCODE_DISABLED: CSR_WIFI_SME_AUTH_MODE_80211_OPEN\n"); - priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; - } - - if (erq->flags & IW_ENCODE_RESTRICTED) { - /* Use shared key auth */ - unifi_trace(priv, UDBG1, "IW_ENCODE_RESTRICTED: CSR_WIFI_SME_AUTH_MODE_80211_SHARED\n"); - priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_SHARED; - - /* Turn on encryption */ - privacy = 1; - } - if (erq->flags & IW_ENCODE_OPEN) { - unifi_trace(priv, UDBG1, "IW_ENCODE_OPEN: CSR_WIFI_SME_AUTH_MODE_80211_OPEN\n"); - priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; - } - - /* Commit the changes to flags if needed */ - if (privacy != -1) { - priv->connection_config.privacyMode = privacy ? CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED : CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED; - priv->connection_config.encryptionModeMask = privacy ? (CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 | - CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 | - CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40 | - CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104) : - CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE; - } - - return convert_sme_error(rc); - -} /* unifi_siwencode() */ - - - -static int -unifi_giwencode(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct iw_point *erq = &wrqu->encoding; - - unifi_trace(priv, UDBG2, "unifi_giwencode\n"); - - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_giwencode: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - if (priv->connection_config.authModeMask == CSR_WIFI_SME_AUTH_MODE_80211_SHARED) { - erq->flags = IW_ENCODE_RESTRICTED; - } - else { - if (priv->connection_config.privacyMode == CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED) { - erq->flags = IW_ENCODE_DISABLED; - } else { - erq->flags = IW_ENCODE_OPEN; - } - } - - erq->length = 0; - - if (erq->flags != IW_ENCODE_DISABLED) { - int index = priv->wep_tx_key_index; - - if ((index > 0) && (index <= NUM_WEPKEYS)) { - erq->flags |= (index & IW_ENCODE_INDEX); - erq->length = priv->wep_keys[index - 1].len; - memcpy(extra, priv->wep_keys[index - 1].key, erq->length); - } else { - unifi_notice(priv, "unifi_giwencode: Surprise, do not have a valid key index (%d)\n", - index); - } - } - - return 0; -} /* unifi_giwencode() */ - - -static int -unifi_siwpower(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct iw_param *args = &wrqu->power; - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int listen_interval, wake_for_dtim; - int r = 0; - CsrWifiSmePowerConfig powerConfig; - - unifi_trace(priv, UDBG2, "unifi_siwpower\n"); - - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_siwpower: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - UF_RTNL_UNLOCK(); - r = sme_mgt_power_config_get(priv, &powerConfig); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "unifi_siwpower: Get unifi_PowerConfigValue failed.\n"); - return r; - } - - listen_interval = -1; - wake_for_dtim = -1; - if (args->disabled) { - powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW; - } - else - { - powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH; - - switch (args->flags & IW_POWER_TYPE) { - case 0: - /* not specified */ - break; - case IW_POWER_PERIOD: - listen_interval = args->value / 1000; - break; - default: - return -EINVAL; - } - - switch (args->flags & IW_POWER_MODE) { - case 0: - /* not specified */ - break; - case IW_POWER_UNICAST_R: - /* not interested in broadcast packets */ - wake_for_dtim = 0; - break; - case IW_POWER_ALL_R: - /* yes, we are interested in broadcast packets */ - wake_for_dtim = 1; - break; - default: - return -EINVAL; - } - } - - if (listen_interval > 0) { - powerConfig.listenIntervalTu = listen_interval; - unifi_trace(priv, UDBG4, "unifi_siwpower: new Listen Interval = %d.\n", - powerConfig.listenIntervalTu); - } - - if (wake_for_dtim >= 0) { - powerConfig.rxDtims = wake_for_dtim; - } - UF_RTNL_UNLOCK(); - r = sme_mgt_power_config_set(priv, &powerConfig); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "unifi_siwpower: Set unifi_PowerConfigValue failed.\n"); - return r; - } - - return 0; -} /* unifi_siwpower() */ - - -static int -unifi_giwpower(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct iw_param *args = &wrqu->power; - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - CsrWifiSmePowerConfig powerConfig; - int r; - - unifi_trace(priv, UDBG2, "unifi_giwpower\n"); - - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_giwpower: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - args->flags = 0; - UF_RTNL_UNLOCK(); - r = sme_mgt_power_config_get(priv, &powerConfig); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "unifi_giwpower: Get unifi_PowerConfigValue failed.\n"); - return r; - } - - unifi_trace(priv, UDBG4, "unifi_giwpower: mode=%d\n", - powerConfig.powerSaveLevel); - - args->disabled = (powerConfig.powerSaveLevel == CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW); - if (args->disabled) { - args->flags = 0; - return 0; - } - - args->value = powerConfig.listenIntervalTu * 1000; - args->flags |= IW_POWER_PERIOD; - - if (powerConfig.rxDtims) { - args->flags |= IW_POWER_ALL_R; - } else { - args->flags |= IW_POWER_UNICAST_R; - } - - return 0; -} /* unifi_giwpower() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_siwcommit - handler for SIOCSIWCOMMIT - * - * Apply all the parameters that have been set. - * In practice this means: - * - do a scan - * - join a network or start an AdHoc - * - authenticate and associate. - * - * Arguments: - * None. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static int -unifi_siwcommit(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - return 0; -} /* unifi_siwcommit() */ - - - -static int -unifi_siwmlme(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct iw_mlme *mlme = (struct iw_mlme *)extra; - - unifi_trace(priv, UDBG2, "unifi_siwmlme\n"); - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_siwmlme: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - switch (mlme->cmd) { - case IW_MLME_DEAUTH: - case IW_MLME_DISASSOC: - UF_RTNL_UNLOCK(); - sme_mgt_disconnect(priv); - UF_RTNL_LOCK(); - break; - default: - return -EOPNOTSUPP; - } - - return 0; -} /* unifi_siwmlme() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_siwgenie - * unifi_giwgenie - * - * WPA : Generic IEEE 802.11 information element (e.g., for WPA/RSN/WMM). - * Handlers for SIOCSIWGENIE, SIOCGIWGENIE - set/get generic IE - * - * The host program (e.g. wpa_supplicant) uses this call to set the - * additional IEs to accompany the next (Associate?) request. - * - * Arguments: - * None. - * - * Returns: - * None. - * Notes: - * From wireless.h: - * This ioctl uses struct iw_point and data buffer that includes IE id - * and len fields. More than one IE may be included in the - * request. Setting the generic IE to empty buffer (len=0) removes the - * generic IE from the driver. - * --------------------------------------------------------------------------- - */ -static int -unifi_siwgenie(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int len; - - unifi_trace(priv, UDBG2, "unifi_siwgenie\n"); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_siwgenie: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - if ( priv->connection_config.mlmeAssociateReqInformationElements) { - kfree( priv->connection_config.mlmeAssociateReqInformationElements); - } - priv->connection_config.mlmeAssociateReqInformationElementsLength = 0; - priv->connection_config.mlmeAssociateReqInformationElements = NULL; - - len = wrqu->data.length; - if (len == 0) { - return 0; - } - - priv->connection_config.mlmeAssociateReqInformationElements = kmalloc(len, GFP_KERNEL); - if (priv->connection_config.mlmeAssociateReqInformationElements == NULL) { - return -ENOMEM; - } - - priv->connection_config.mlmeAssociateReqInformationElementsLength = len; - memcpy( priv->connection_config.mlmeAssociateReqInformationElements, extra, len); - - return 0; -} /* unifi_siwgenie() */ - - -static int -unifi_giwgenie(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - int len; - - unifi_trace(priv, UDBG2, "unifi_giwgenie\n"); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_giwgenie: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - len = priv->connection_config.mlmeAssociateReqInformationElementsLength; - - if (len == 0) { - wrqu->data.length = 0; - return 0; - } - - if (wrqu->data.length < len) { - return -E2BIG; - } - - wrqu->data.length = len; - memcpy(extra, priv->connection_config.mlmeAssociateReqInformationElements, len); - - return 0; -} /* unifi_giwgenie() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_siwauth - * unifi_giwauth - * - * Handlers for SIOCSIWAUTH, SIOCGIWAUTH - * Set/get various authentication parameters. - * - * Arguments: - * - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static int -_unifi_siwauth(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - CsrWifiSmeAuthModeMask new_auth; - - unifi_trace(priv, UDBG2, "unifi_siwauth\n"); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_siwauth: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - /* - * This ioctl is safe to call even when UniFi is powered off. - * wpa_supplicant calls it to test whether we support WPA. - */ - - switch (wrqu->param.flags & IW_AUTH_INDEX) { - - case IW_AUTH_WPA_ENABLED: - unifi_trace(priv, UDBG1, "IW_AUTH_WPA_ENABLED: %d\n", wrqu->param.value); - - if (wrqu->param.value == 0) { - unifi_trace(priv, UDBG5, "IW_AUTH_WPA_ENABLED: CSR_WIFI_SME_AUTH_MODE_80211_OPEN\n"); - priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; - } - break; - - case IW_AUTH_PRIVACY_INVOKED: - unifi_trace(priv, UDBG1, "IW_AUTH_PRIVACY_INVOKED: %d\n", wrqu->param.value); - - priv->connection_config.privacyMode = wrqu->param.value ? CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED : CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED; - if (wrqu->param.value == CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED) - { - priv->connection_config.encryptionModeMask = CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE; - } - break; - - case IW_AUTH_80211_AUTH_ALG: - /* - IW_AUTH_ALG_OPEN_SYSTEM 0x00000001 - IW_AUTH_ALG_SHARED_KEY 0x00000002 - IW_AUTH_ALG_LEAP 0x00000004 - */ - new_auth = 0; - if (wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) { - unifi_trace(priv, UDBG1, "IW_AUTH_80211_AUTH_ALG: %d (IW_AUTH_ALG_OPEN_SYSTEM)\n", wrqu->param.value); - new_auth |= CSR_WIFI_SME_AUTH_MODE_80211_OPEN; - } - if (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) { - unifi_trace(priv, UDBG1, "IW_AUTH_80211_AUTH_ALG: %d (IW_AUTH_ALG_SHARED_KEY)\n", wrqu->param.value); - new_auth |= CSR_WIFI_SME_AUTH_MODE_80211_SHARED; - } - if (wrqu->param.value & IW_AUTH_ALG_LEAP) { - /* Initial exchanges using open-system to set EAP */ - unifi_trace(priv, UDBG1, "IW_AUTH_80211_AUTH_ALG: %d (IW_AUTH_ALG_LEAP)\n", wrqu->param.value); - new_auth |= CSR_WIFI_SME_AUTH_MODE_8021X_OTHER1X; - } - if (new_auth == 0) { - unifi_trace(priv, UDBG1, "IW_AUTH_80211_AUTH_ALG: invalid value %d\n", - wrqu->param.value); - return -EINVAL; - } else { - priv->connection_config.authModeMask = new_auth; - } - break; - - case IW_AUTH_WPA_VERSION: - unifi_trace(priv, UDBG1, "IW_AUTH_WPA_VERSION: %d\n", wrqu->param.value); - priv->ignore_bssid_join = TRUE; - /* - IW_AUTH_WPA_VERSION_DISABLED 0x00000001 - IW_AUTH_WPA_VERSION_WPA 0x00000002 - IW_AUTH_WPA_VERSION_WPA2 0x00000004 - */ - - if (!(wrqu->param.value & IW_AUTH_WPA_VERSION_DISABLED)) { - - priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN; - - if (wrqu->param.value & IW_AUTH_WPA_VERSION_WPA) { - unifi_trace(priv, UDBG4, "IW_AUTH_WPA_VERSION: WPA, WPA-PSK\n"); - priv->connection_config.authModeMask |= (CSR_WIFI_SME_AUTH_MODE_8021X_WPA | CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK); - } - if (wrqu->param.value & IW_AUTH_WPA_VERSION_WPA2) { - unifi_trace(priv, UDBG4, "IW_AUTH_WPA_VERSION: WPA2, WPA2-PSK\n"); - priv->connection_config.authModeMask |= (CSR_WIFI_SME_AUTH_MODE_8021X_WPA2 | CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK); - } - } - break; - - case IW_AUTH_CIPHER_PAIRWISE: - unifi_trace(priv, UDBG1, "IW_AUTH_CIPHER_PAIRWISE: %d\n", wrqu->param.value); - /* - * one of: - IW_AUTH_CIPHER_NONE 0x00000001 - IW_AUTH_CIPHER_WEP40 0x00000002 - IW_AUTH_CIPHER_TKIP 0x00000004 - IW_AUTH_CIPHER_CCMP 0x00000008 - IW_AUTH_CIPHER_WEP104 0x00000010 - */ - - priv->connection_config.encryptionModeMask = CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE; - - if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { - priv->connection_config.encryptionModeMask |= - CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40; - } - if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { - priv->connection_config.encryptionModeMask |= - CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104; - } - if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { - priv->connection_config.encryptionModeMask |= - CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_TKIP | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP; - } - if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { - priv->connection_config.encryptionModeMask |= - CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_CCMP | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP; - } - - break; - - case IW_AUTH_CIPHER_GROUP: - unifi_trace(priv, UDBG1, "IW_AUTH_CIPHER_GROUP: %d\n", wrqu->param.value); - /* - * Use the WPA version and the group cipher suite to set the permitted - * group key in the MIB. f/w uses this value to validate WPA and RSN IEs - * in the probe responses from the desired BSS(ID) - */ - - priv->connection_config.encryptionModeMask &= ~(CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40 | - CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104 | - CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP | - CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP); - if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { - priv->connection_config.encryptionModeMask |= CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40; - } - if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { - priv->connection_config.encryptionModeMask |= CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104; - } - if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { - priv->connection_config.encryptionModeMask |= CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP; - } - if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { - priv->connection_config.encryptionModeMask |= CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP; - } - - break; - - case IW_AUTH_KEY_MGMT: - unifi_trace(priv, UDBG1, "IW_AUTH_KEY_MGMT: %d\n", wrqu->param.value); - /* - IW_AUTH_KEY_MGMT_802_1X 1 - IW_AUTH_KEY_MGMT_PSK 2 - */ - if (priv->connection_config.authModeMask & (CSR_WIFI_SME_AUTH_MODE_8021X_WPA | CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK)) { - /* Check for explicitly set mode. */ - if (wrqu->param.value == IW_AUTH_KEY_MGMT_802_1X) { - priv->connection_config.authModeMask &= ~CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK; - } - if (wrqu->param.value == IW_AUTH_KEY_MGMT_PSK) { - priv->connection_config.authModeMask &= ~CSR_WIFI_SME_AUTH_MODE_8021X_WPA; - } - unifi_trace(priv, UDBG5, "IW_AUTH_KEY_MGMT: WPA: %d\n", - priv->connection_config.authModeMask); - } - if (priv->connection_config.authModeMask & (CSR_WIFI_SME_AUTH_MODE_8021X_WPA2 | CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK)) { - /* Check for explicitly set mode. */ - if (wrqu->param.value == IW_AUTH_KEY_MGMT_802_1X) { - priv->connection_config.authModeMask &= ~CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK; - } - if (wrqu->param.value == IW_AUTH_KEY_MGMT_PSK) { - priv->connection_config.authModeMask &= ~CSR_WIFI_SME_AUTH_MODE_8021X_WPA2; - } - unifi_trace(priv, UDBG5, "IW_AUTH_KEY_MGMT: WPA2: %d\n", - priv->connection_config.authModeMask); - } - - break; - case IW_AUTH_TKIP_COUNTERMEASURES: - /* - * Set to true at the start of the 60 second backup-off period - * following 2 MichaelMIC failures within 60s. - */ - unifi_trace(priv, UDBG1, "IW_AUTH_TKIP_COUNTERMEASURES: %d\n", wrqu->param.value); - break; - - case IW_AUTH_DROP_UNENCRYPTED: - /* - * Set to true on init. - * Set to false just before associate if encryption will not be - * required. - * - * Note this is not the same as the 802.1X controlled port - */ - unifi_trace(priv, UDBG1, "IW_AUTH_DROP_UNENCRYPTED: %d\n", wrqu->param.value); - break; - - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - /* - * This is set by wpa_supplicant to allow unencrypted EAPOL messages - * even if pairwise keys are set when not using WPA. IEEE 802.1X - * specifies that these frames are not encrypted, but WPA encrypts - * them when pairwise keys are in use. - * I think the UniFi f/w handles this decision for us. - */ - unifi_trace(priv, UDBG1, "IW_AUTH_RX_UNENCRYPTED_EAPOL: %d\n", wrqu->param.value); - break; - - case IW_AUTH_ROAMING_CONTROL: - unifi_trace(priv, UDBG1, "IW_AUTH_ROAMING_CONTROL: %d\n", wrqu->param.value); - break; - - default: - unifi_trace(priv, UDBG1, "Unsupported auth param %d to 0x%X\n", - wrqu->param.flags & IW_AUTH_INDEX, - wrqu->param.value); - return -EOPNOTSUPP; - } - - unifi_trace(priv, UDBG2, "authModeMask = %d", priv->connection_config.authModeMask); - - return 0; -} /* _unifi_siwauth() */ - - -static int -unifi_siwauth(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - int err = 0; - - UF_RTNL_UNLOCK(); - err = _unifi_siwauth(dev, info, wrqu, extra); - UF_RTNL_LOCK(); - - return err; -} /* unifi_siwauth() */ - - -static int -unifi_giwauth(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - unifi_trace(NULL, UDBG2, "unifi_giwauth\n"); - return -EOPNOTSUPP; -} /* unifi_giwauth() */ - -/* - * --------------------------------------------------------------------------- - * unifi_siwencodeext - * unifi_giwencodeext - * - * Handlers for SIOCSIWENCODEEXT, SIOCGIWENCODEEXT - set/get - * encoding token & mode - * - * Arguments: - * None. - * - * Returns: - * None. - * - * Notes: - * For WPA/WPA2 we don't take note of the IW_ENCODE_EXT_SET_TX_KEY flag. - * This flag means "use this key to encode transmissions"; we just - * assume only one key will be set and that is the one to use. - * --------------------------------------------------------------------------- - */ -static int -_unifi_siwencodeext(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int r = 0; - unsigned char *keydata; - unsigned char tkip_key[32]; - int keyid; - unsigned char *a = (unsigned char *)ext->addr.sa_data; - CsrWifiSmeKey sme_key; - CsrWifiSmeKeyType key_type; - - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_siwencodeext: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - unifi_trace(priv, UDBG1, "siwencodeext: flags=0x%X, alg=%d, ext_flags=0x%X, len=%d, index=%d,\n", - wrqu->encoding.flags, ext->alg, ext->ext_flags, - ext->key_len, (wrqu->encoding.flags & IW_ENCODE_INDEX)); - unifi_trace(priv, UDBG3, " addr=%pM\n", a); - - if ((ext->key_len == 0) && (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) { - /* This means use a different key (given by key_idx) for Tx. */ - /* NYI */ - unifi_trace(priv, UDBG1, KERN_ERR "unifi_siwencodeext: NYI should change tx key id here!!\n"); - return -ENOTSUPP; - } - - memset(&sme_key, 0, sizeof(sme_key)); - - keydata = (unsigned char *)(ext + 1); - keyid = (wrqu->encoding.flags & IW_ENCODE_INDEX); - - /* - * Check for request to delete keys for an address. - */ - /* Pick out request for no privacy. */ - if (ext->alg == IW_ENCODE_ALG_NONE) { - - unifi_trace(priv, UDBG1, "Deleting %s key %d\n", - (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) ? "GROUP" : "PAIRWISE", - keyid); - - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_GROUP; - } else { - sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE; - } - sme_key.keyIndex = (keyid - 1); - sme_key.keyLength = 0; - sme_key.authenticator = 0; - memcpy(sme_key.address.a, a, ETH_ALEN); - UF_RTNL_UNLOCK(); - r = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_REMOVE); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "Delete key request was rejected with result %d\n", r); - return convert_sme_error(r); - } - - return 0; - } - - /* - * Request is to set a key, not delete - */ - - /* Pick out WEP and use set_wep_key(). */ - if (ext->alg == IW_ENCODE_ALG_WEP) { - /* WEP-40, WEP-104 */ - - /* Check for valid key length */ - if (!((ext->key_len == 5) || (ext->key_len == 13))) { - unifi_trace(priv, UDBG1, KERN_ERR "Invalid length for WEP key: %d\n", ext->key_len); - return -EINVAL; - } - - unifi_trace(priv, UDBG1, "Setting WEP key %d tx:%d\n", - keyid, ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY); - - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - sme_key.wepTxKey = TRUE; - sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE; - } else { - sme_key.wepTxKey = FALSE; - sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_GROUP; - } - sme_key.keyIndex = (keyid - 1); - sme_key.keyLength = ext->key_len; - sme_key.authenticator = 0; - memset(sme_key.address.a, 0xFF, ETH_ALEN); - memcpy(sme_key.key, keydata, ext->key_len); - UF_RTNL_UNLOCK(); - r = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_ADD); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "siwencodeext: Set key failed (%d)", r); - return convert_sme_error(r); - } - - return 0; - } - - /* - * - * If we reach here, we are dealing with a WPA/WPA2 key - * - */ - if (ext->key_len > 32) { - return -EINVAL; - } - - /* - * TKIP keys from wpa_supplicant need swapping. - * What about other supplicants (when they come along)? - */ - if ((ext->alg == IW_ENCODE_ALG_TKIP) && (ext->key_len == 32)) { - memcpy(tkip_key, keydata, 16); - memcpy(tkip_key + 16, keydata + 24, 8); - memcpy(tkip_key + 24, keydata + 16, 8); - keydata = tkip_key; - } - - key_type = (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) ? - CSR_WIFI_SME_KEY_TYPE_GROUP : /* Group Key */ - CSR_WIFI_SME_KEY_TYPE_PAIRWISE; /* Pairwise Key */ - - sme_key.keyType = key_type; - sme_key.keyIndex = (keyid - 1); - sme_key.keyLength = ext->key_len; - sme_key.authenticator = 0; - memcpy(sme_key.address.a, ext->addr.sa_data, ETH_ALEN); - if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { - - unifi_trace(priv, UDBG5, "RSC first 6 bytes = %*phC\n", - 6, ext->rx_seq); - - /* memcpy((u8*)(&sme_key.keyRsc), ext->rx_seq, 8); */ - sme_key.keyRsc[0] = ext->rx_seq[1] << 8 | ext->rx_seq[0]; - sme_key.keyRsc[1] = ext->rx_seq[3] << 8 | ext->rx_seq[2]; - sme_key.keyRsc[2] = ext->rx_seq[5] << 8 | ext->rx_seq[4]; - sme_key.keyRsc[3] = ext->rx_seq[7] << 8 | ext->rx_seq[6]; - - } - - memcpy(sme_key.key, keydata, ext->key_len); - UF_RTNL_UNLOCK(); - r = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_ADD); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "SETKEYS request was rejected with result %d\n", r); - return convert_sme_error(r); - } - - return r; -} /* _unifi_siwencodeext() */ - - -static int -unifi_siwencodeext(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - int err = 0; - - err = _unifi_siwencodeext(dev, info, wrqu, extra); - - return err; -} /* unifi_siwencodeext() */ - - -static int -unifi_giwencodeext(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - return -EOPNOTSUPP; -} /* unifi_giwencodeext() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_siwpmksa - * - * SIOCSIWPMKSA - PMKSA cache operation - * The caller passes a pmksa structure: - * - cmd one of ADD, REMOVE, FLUSH - * - bssid MAC address - * - pmkid ID string (16 bytes) - * - * Arguments: - * None. - * - * Returns: - * None. - * - * Notes: - * This is not needed since we provide a siwgenie method. - * --------------------------------------------------------------------------- - */ -#define UNIFI_PMKID_KEY_SIZE 16 -static int -unifi_siwpmksa(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct iw_pmksa *pmksa = (struct iw_pmksa *)extra; - CsrResult r = 0; - CsrWifiSmePmkidList pmkid_list; - CsrWifiSmePmkid pmkid; - CsrWifiSmeListAction action; - - CHECK_INITED(priv); - - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - unifi_error(priv, "unifi_siwpmksa: not permitted in Mode %d\n", - interfacePriv->interfaceMode); - return -EPERM; - } - - - unifi_trace(priv, UDBG1, "SIWPMKSA: cmd %d, %pM\n", pmksa->cmd, - pmksa->bssid.sa_data); - - pmkid_list.pmkids = NULL; - switch (pmksa->cmd) { - case IW_PMKSA_ADD: - pmkid_list.pmkids = &pmkid; - action = CSR_WIFI_SME_LIST_ACTION_ADD; - pmkid_list.pmkidsCount = 1; - memcpy(pmkid.bssid.a, pmksa->bssid.sa_data, ETH_ALEN); - memcpy(pmkid.pmkid, pmksa->pmkid, UNIFI_PMKID_KEY_SIZE); - break; - case IW_PMKSA_REMOVE: - pmkid_list.pmkids = &pmkid; - action = CSR_WIFI_SME_LIST_ACTION_REMOVE; - pmkid_list.pmkidsCount = 1; - memcpy(pmkid.bssid.a, pmksa->bssid.sa_data, ETH_ALEN); - memcpy(pmkid.pmkid, pmksa->pmkid, UNIFI_PMKID_KEY_SIZE); - break; - case IW_PMKSA_FLUSH: - /* Replace current PMKID's with an empty list */ - pmkid_list.pmkidsCount = 0; - action = CSR_WIFI_SME_LIST_ACTION_FLUSH; - break; - default: - unifi_notice(priv, "SIWPMKSA: Unknown command (0x%x)\n", pmksa->cmd); - return -EINVAL; - } - - /* Set the Value the pmkid's will have 1 added OR 1 removed OR be cleared at this point */ - UF_RTNL_UNLOCK(); - r = sme_mgt_pmkid(priv, action, &pmkid_list); - UF_RTNL_LOCK(); - if (r) { - unifi_error(priv, "SIWPMKSA: Set PMKID's Failed.\n"); - } - - return r; - -} /* unifi_siwpmksa() */ - - -/* - * --------------------------------------------------------------------------- - * unifi_get_wireless_stats - * - * get_wireless_stats method for Linux wireless extensions. - * - * Arguments: - * dev Pointer to associated netdevice. - * - * Returns: - * Pointer to iw_statistics struct. - * --------------------------------------------------------------------------- - */ -struct iw_statistics * -unifi_get_wireless_stats(struct net_device *dev) -{ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - - if (priv->init_progress != UNIFI_INIT_COMPLETED) { - return NULL; - } - - return &priv->wext_wireless_stats; -} /* unifi_get_wireless_stats() */ - - -/* - * Structures to export the Wireless Handlers - */ - -static const struct iw_priv_args unifi_private_args[] = { - /*{ cmd, set_args, get_args, name } */ - { SIOCIWS80211POWERSAVEPRIV, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, - IW_PRIV_TYPE_NONE, "iwprivs80211ps" }, - { SIOCIWG80211POWERSAVEPRIV, IW_PRIV_TYPE_NONE, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IWPRIV_POWER_SAVE_MAX_STRING, "iwprivg80211ps" }, - { SIOCIWS80211RELOADDEFAULTSPRIV, IW_PRIV_TYPE_NONE, - IW_PRIV_TYPE_NONE, "iwprivsdefs" }, - { SIOCIWSSMEDEBUGPRIV, IW_PRIV_TYPE_CHAR | IWPRIV_SME_DEBUG_MAX_STRING, IW_PRIV_TYPE_NONE, "iwprivssmedebug" }, -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - { SIOCIWSCONFWAPIPRIV, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, - IW_PRIV_TYPE_NONE, "iwprivsconfwapi" }, - { SIOCIWSWAPIKEYPRIV, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | sizeof(unifiio_wapi_key_t), - IW_PRIV_TYPE_NONE, "iwprivswpikey" }, -#endif -#ifdef CSR_SUPPORT_WEXT_AP - { SIOCIWSAPCFGPRIV, IW_PRIV_TYPE_CHAR | 256, IW_PRIV_TYPE_NONE, "AP_SET_CFG" }, - { SIOCIWSAPSTARTPRIV, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED|IWPRIV_SME_MAX_STRING, "AP_BSS_START" }, - { SIOCIWSAPSTOPPRIV, IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|0, - IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|0, "AP_BSS_STOP" }, -#ifdef ANDROID_BUILD - { SIOCIWSFWRELOADPRIV, IW_PRIV_TYPE_CHAR |256, - IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|0, "WL_FW_RELOAD" }, - { SIOCIWSSTACKSTART, 0, - IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|IWPRIV_SME_MAX_STRING, "START" }, - { SIOCIWSSTACKSTOP, 0, - IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|IWPRIV_SME_MAX_STRING, "STOP" }, -#endif /* ANDROID_BUILD */ -#endif /* CSR_SUPPORT_WEXT_AP */ -}; - -static const iw_handler unifi_handler[] = -{ - (iw_handler) unifi_siwcommit, /* SIOCSIWCOMMIT */ - (iw_handler) unifi_giwname, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) unifi_siwfreq, /* SIOCSIWFREQ */ - (iw_handler) unifi_giwfreq, /* SIOCGIWFREQ */ - (iw_handler) unifi_siwmode, /* SIOCSIWMODE */ - (iw_handler) unifi_giwmode, /* SIOCGIWMODE */ - (iw_handler) NULL, /* SIOCSIWSENS */ - (iw_handler) NULL, /* SIOCGIWSENS */ - (iw_handler) NULL, /* SIOCSIWRANGE */ - (iw_handler) unifi_giwrange, /* SIOCGIWRANGE */ - (iw_handler) NULL, /* SIOCSIWPRIV */ - (iw_handler) NULL, /* SIOCGIWPRIV */ - (iw_handler) NULL, /* SIOCSIWSTATS */ - (iw_handler) NULL, /* SIOCGIWSTATS */ - (iw_handler) NULL, /* SIOCSIWSPY */ - (iw_handler) NULL, /* SIOCGIWSPY */ - (iw_handler) NULL, /* SIOCSIWTHRSPY */ - (iw_handler) NULL, /* SIOCGIWTHRSPY */ - (iw_handler) unifi_siwap, /* SIOCSIWAP */ - (iw_handler) unifi_giwap, /* SIOCGIWAP */ -#if WIRELESS_EXT > 17 - /* WPA : IEEE 802.11 MLME requests */ - unifi_siwmlme, /* SIOCSIWMLME, request MLME operation */ -#else - (iw_handler) NULL, /* -- hole -- */ -#endif - (iw_handler) NULL, /* SIOCGIWAPLIST */ - (iw_handler) unifi_siwscan, /* SIOCSIWSCAN */ - (iw_handler) unifi_giwscan, /* SIOCGIWSCAN */ - (iw_handler) unifi_siwessid, /* SIOCSIWESSID */ - (iw_handler) unifi_giwessid, /* SIOCGIWESSID */ - (iw_handler) NULL, /* SIOCSIWNICKN */ - (iw_handler) NULL, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - unifi_siwrate, /* SIOCSIWRATE */ - unifi_giwrate, /* SIOCGIWRATE */ - unifi_siwrts, /* SIOCSIWRTS */ - unifi_giwrts, /* SIOCGIWRTS */ - unifi_siwfrag, /* SIOCSIWFRAG */ - unifi_giwfrag, /* SIOCGIWFRAG */ - (iw_handler) NULL, /* SIOCSIWTXPOW */ - (iw_handler) NULL, /* SIOCGIWTXPOW */ - (iw_handler) NULL, /* SIOCSIWRETRY */ - (iw_handler) NULL, /* SIOCGIWRETRY */ - unifi_siwencode, /* SIOCSIWENCODE */ - unifi_giwencode, /* SIOCGIWENCODE */ - unifi_siwpower, /* SIOCSIWPOWER */ - unifi_giwpower, /* SIOCGIWPOWER */ -#if WIRELESS_EXT > 17 - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - - /* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM). */ - unifi_siwgenie, /* SIOCSIWGENIE */ /* set generic IE */ - unifi_giwgenie, /* SIOCGIWGENIE */ /* get generic IE */ - - /* WPA : Authentication mode parameters */ - unifi_siwauth, /* SIOCSIWAUTH */ /* set authentication mode params */ - unifi_giwauth, /* SIOCGIWAUTH */ /* get authentication mode params */ - - /* WPA : Extended version of encoding configuration */ - unifi_siwencodeext, /* SIOCSIWENCODEEXT */ /* set encoding token & mode */ - unifi_giwencodeext, /* SIOCGIWENCODEEXT */ /* get encoding token & mode */ - - /* WPA2 : PMKSA cache management */ - unifi_siwpmksa, /* SIOCSIWPMKSA */ /* PMKSA cache operation */ - (iw_handler) NULL, /* -- hole -- */ -#endif /* WIRELESS_EXT > 17 */ -}; - - -static const iw_handler unifi_private_handler[] = -{ - iwprivs80211ps, /* SIOCIWFIRSTPRIV */ - iwprivg80211ps, /* SIOCIWFIRSTPRIV + 1 */ - iwprivsdefs, /* SIOCIWFIRSTPRIV + 2 */ - (iw_handler) NULL, -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - iwprivsconfwapi, /* SIOCIWFIRSTPRIV + 4 */ - (iw_handler) NULL, /* SIOCIWFIRSTPRIV + 5 */ - iwprivswpikey, /* SIOCIWFIRSTPRIV + 6 */ -#else - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, -#endif - (iw_handler) NULL, - iwprivssmedebug, /* SIOCIWFIRSTPRIV + 8 */ -#ifdef CSR_SUPPORT_WEXT_AP - (iw_handler) NULL, - iwprivsapconfig, - (iw_handler) NULL, - iwprivsapstart, - (iw_handler) NULL, - iwprivsapstop, - (iw_handler) NULL, -#ifdef ANDROID_BUILD - iwprivsapfwreload, - (iw_handler) NULL, - iwprivsstackstart, - (iw_handler) NULL, - iwprivsstackstop, -#else - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, -#endif /* ANDROID_BUILD */ -#else - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, -#endif /* CSR_SUPPORT_WEXT_AP */ -}; - -struct iw_handler_def unifi_iw_handler_def = -{ - .num_standard = sizeof(unifi_handler) / sizeof(iw_handler), - .num_private = sizeof(unifi_private_handler) / sizeof(iw_handler), - .num_private_args = sizeof(unifi_private_args) / sizeof(struct iw_priv_args), - .standard = (iw_handler *) unifi_handler, - .private = (iw_handler *) unifi_private_handler, - .private_args = (struct iw_priv_args *) unifi_private_args, -#if IW_HANDLER_VERSION >= 6 - .get_wireless_stats = unifi_get_wireless_stats, -#endif -}; - - diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c deleted file mode 100644 index eb286e5f7467..000000000000 --- a/drivers/staging/csr/ul_int.c +++ /dev/null @@ -1,528 +0,0 @@ -/* - * *************************************************************************** - * FILE: ul_int.c - * - * PURPOSE: - * Manage list of client applications using UniFi. - * - * Copyright (C) 2006-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * *************************************************************************** - */ -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_conversions.h" -#include "unifi_priv.h" -#include "unifiio.h" -#include "unifi_os.h" - -static void free_bulkdata_buffers(unifi_priv_t *priv, bulk_data_param_t *bulkdata); -static void reset_driver_status(unifi_priv_t *priv); - -/* - * --------------------------------------------------------------------------- - * ul_init_clients - * - * Initialise the clients array to empty. - * - * Arguments: - * priv Pointer to device private context struct - * - * Returns: - * None. - * - * Notes: - * This function needs to be called before priv is stored in - * Unifi_instances[]. - * --------------------------------------------------------------------------- - */ -void -ul_init_clients(unifi_priv_t *priv) -{ - int id; - ul_client_t *ul_clients; - - sema_init(&priv->udi_logging_mutex, 1); - priv->logging_client = NULL; - - ul_clients = priv->ul_clients; - - for (id = 0; id < MAX_UDI_CLIENTS; id++) { - memset(&ul_clients[id], 0, sizeof(ul_client_t)); - - ul_clients[id].client_id = id; - ul_clients[id].sender_id = UDI_SENDER_ID_BASE + (id << UDI_SENDER_ID_SHIFT); - ul_clients[id].instance = -1; - ul_clients[id].event_hook = NULL; - - INIT_LIST_HEAD(&ul_clients[id].udi_log); - init_waitqueue_head(&ul_clients[id].udi_wq); - sema_init(&ul_clients[id].udi_sem, 1); - - ul_clients[id].wake_up_wq_id = 0; - ul_clients[id].seq_no = 0; - ul_clients[id].wake_seq_no = 0; - ul_clients[id].snap_filter.count = 0; - } -} /* ul_init_clients() */ - - -/* - * --------------------------------------------------------------------------- - * ul_register_client - * - * This function registers a new ul client. - * - * Arguments: - * priv Pointer to device private context struct - * configuration Special configuration for the client. - * udi_event_clbk Callback for receiving event from unifi. - * - * Returns: - * 0 if a new clients is registered, -1 otherwise. - * --------------------------------------------------------------------------- - */ -ul_client_t * -ul_register_client(unifi_priv_t *priv, unsigned int configuration, - udi_event_t udi_event_clbk) -{ - unsigned char id, ref; - ul_client_t *ul_clients; - - ul_clients = priv->ul_clients; - - /* check for an unused entry */ - for (id = 0; id < MAX_UDI_CLIENTS; id++) { - if (ul_clients[id].udi_enabled == 0) { - ul_clients[id].instance = priv->instance; - ul_clients[id].udi_enabled = 1; - ul_clients[id].configuration = configuration; - - /* Allocate memory for the reply signal.. */ - ul_clients[id].reply_signal = kmalloc(sizeof(CSR_SIGNAL), GFP_KERNEL); - if (ul_clients[id].reply_signal == NULL) { - unifi_error(priv, "Failed to allocate reply signal for client.\n"); - return NULL; - } - /* .. and the bulk data of the reply signal. */ - for (ref = 0; ref < UNIFI_MAX_DATA_REFERENCES; ref ++) { - ul_clients[id].reply_bulkdata[ref] = kmalloc(sizeof(bulk_data_t), GFP_KERNEL); - /* If allocation fails, free allocated memory. */ - if (ul_clients[id].reply_bulkdata[ref] == NULL) { - for (; ref > 0; ref --) { - kfree(ul_clients[id].reply_bulkdata[ref - 1]); - } - kfree(ul_clients[id].reply_signal); - unifi_error(priv, "Failed to allocate bulk data buffers for client.\n"); - return NULL; - } - } - - /* Set the event callback. */ - ul_clients[id].event_hook = udi_event_clbk; - - unifi_trace(priv, UDBG2, "UDI %d (0x%x) registered. configuration = 0x%x\n", - id, &ul_clients[id], configuration); - return &ul_clients[id]; - } - } - return NULL; -} /* ul_register_client() */ - - -/* - * --------------------------------------------------------------------------- - * ul_deregister_client - * - * This function deregisters a blocking UDI client. - * - * Arguments: - * client Pointer to the client we deregister. - * - * Returns: - * 0 if a new clients is deregistered. - * --------------------------------------------------------------------------- - */ -int -ul_deregister_client(ul_client_t *ul_client) -{ - struct list_head *pos, *n; - udi_log_t *logptr; - unifi_priv_t *priv = uf_find_instance(ul_client->instance); - int ref; - - ul_client->instance = -1; - ul_client->event_hook = NULL; - ul_client->udi_enabled = 0; - unifi_trace(priv, UDBG5, "UDI (0x%x) deregistered.\n", ul_client); - - /* Free memory allocated for the reply signal and its bulk data. */ - kfree(ul_client->reply_signal); - for (ref = 0; ref < UNIFI_MAX_DATA_REFERENCES; ref ++) { - kfree(ul_client->reply_bulkdata[ref]); - } - - if (ul_client->snap_filter.count) { - ul_client->snap_filter.count = 0; - kfree(ul_client->snap_filter.protocols); - } - - /* Free anything pending on the udi_log list */ - down(&ul_client->udi_sem); - list_for_each_safe(pos, n, &ul_client->udi_log) - { - logptr = list_entry(pos, udi_log_t, q); - list_del(pos); - kfree(logptr); - } - up(&ul_client->udi_sem); - - return 0; -} /* ul_deregister_client() */ - - - -/* - * --------------------------------------------------------------------------- - * logging_handler - * - * This function is registered with the driver core. - * It is called every time a UniFi HIP Signal is sent. It iterates over - * the list of processes interested in receiving log events and - * delivers the events to them. - * - * Arguments: - * ospriv Pointer to driver's private data. - * sigdata Pointer to the packed signal buffer. - * signal_len Length of the packed signal. - * bulkdata Pointer to the signal's bulk data. - * dir Direction of the signal - * 0 = from-host - * 1 = to-host - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -logging_handler(void *ospriv, - u8 *sigdata, u32 signal_len, - const bulk_data_param_t *bulkdata, - enum udi_log_direction direction) -{ - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - ul_client_t *client; - int dir; - - dir = (direction == UDI_LOG_FROM_HOST) ? UDI_FROM_HOST : UDI_TO_HOST; - - down(&priv->udi_logging_mutex); - client = priv->logging_client; - if (client != NULL) { - client->event_hook(client, sigdata, signal_len, - bulkdata, dir); - } - up(&priv->udi_logging_mutex); - -} /* logging_handler() */ - - - -/* - * --------------------------------------------------------------------------- - * ul_log_config_ind - * - * This function uses the client's register callback - * to indicate configuration information e.g core errors. - * - * Arguments: - * priv Pointer to driver's private data. - * conf_param Pointer to the configuration data. - * len Length of the configuration data. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -ul_log_config_ind(unifi_priv_t *priv, u8 *conf_param, int len) -{ -#ifdef CSR_SUPPORT_SME - if (priv->smepriv == NULL) - { - return; - } - if ((CONFIG_IND_ERROR == (*conf_param)) && (priv->wifi_on_state == wifi_on_in_progress)) { - unifi_notice(priv, "ul_log_config_ind: wifi on in progress, suppress error\n"); - } else { - /* wifi_off_ind (error or exit) */ - CsrWifiRouterCtrlWifiOffIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, (CsrWifiRouterCtrlControlIndication)(*conf_param)); - } -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE - unifi_debug_buf_dump(); -#endif -#else - bulk_data_param_t bulkdata; - - /* - * If someone killed unifi_managed before the driver was unloaded - * the g_drvpriv pointer is going to be NULL. In this case it is - * safe to assume that there is no client to get the indication. - */ - if (!priv) { - unifi_notice(NULL, "uf_sme_event_ind: NULL priv\n"); - return; - } - - /* Create a null bulkdata structure. */ - bulkdata.d[0].data_length = 0; - bulkdata.d[1].data_length = 0; - - sme_native_log_event(priv->sme_cli, conf_param, sizeof(u8), - &bulkdata, UDI_CONFIG_IND); - -#endif /* CSR_SUPPORT_SME */ - -} /* ul_log_config_ind */ - - -/* - * --------------------------------------------------------------------------- - * free_bulkdata_buffers - * - * Free the bulkdata buffers e.g. after a failed unifi_send_signal(). - * - * Arguments: - * priv Pointer to device private struct - * bulkdata Pointer to bulkdata parameter table - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void -free_bulkdata_buffers(unifi_priv_t *priv, bulk_data_param_t *bulkdata) -{ - int i; - - if (bulkdata) { - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i) { - if (bulkdata->d[i].data_length != 0) { - unifi_net_data_free(priv, (bulk_data_desc_t *)(&bulkdata->d[i])); - /* data_length is now 0 */ - } - } - } - -} /* free_bulkdata_buffers */ - -static int -_align_bulk_data_buffers(unifi_priv_t *priv, u8 *signal, - bulk_data_param_t *bulkdata) -{ - unsigned int i; - - if ((bulkdata == NULL) || (CSR_WIFI_ALIGN_BYTES == 0)) { - return 0; - } - - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) - { - struct sk_buff *skb; - /* - * The following complex casting is in place in order to eliminate 64-bit compilation warning - * "cast to/from pointer from/to integer of different size" - */ - u32 align_offset = (u32)(long)(bulkdata->d[i].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1); - if (align_offset) - { - skb = (struct sk_buff*)bulkdata->d[i].os_net_buf_ptr; - if (skb == NULL) { - unifi_warning(priv, - "_align_bulk_data_buffers: Align offset found (%d) but skb is NULL!\n", - align_offset); - return -EINVAL; - } - if (bulkdata->d[i].data_length == 0) { - unifi_warning(priv, - "_align_bulk_data_buffers: Align offset found (%d) but length is zero\n", - align_offset); - return CSR_RESULT_SUCCESS; - } - unifi_trace(priv, UDBG5, - "Align f-h buffer (0x%p) by %d bytes (skb->data: 0x%p)\n", - bulkdata->d[i].os_data_ptr, align_offset, skb->data); - - - /* Check if there is enough headroom... */ - if (unlikely(skb_headroom(skb) < align_offset)) - { - struct sk_buff *tmp = skb; - - unifi_trace(priv, UDBG5, "Headroom not enough - realloc it\n"); - skb = skb_realloc_headroom(skb, align_offset); - if (skb == NULL) { - unifi_error(priv, - "_align_bulk_data_buffers: skb_realloc_headroom failed - signal is dropped\n"); - return -EFAULT; - } - /* Free the old bulk data only if allocation succeeds */ - kfree_skb(tmp); - /* Bulkdata needs to point to the new skb */ - bulkdata->d[i].os_net_buf_ptr = (const unsigned char*)skb; - bulkdata->d[i].os_data_ptr = (const void*)skb->data; - } - /* ... before pushing the data to the right alignment offset */ - skb_push(skb, align_offset); - - } - /* The direction bit is zero for the from-host */ - signal[SIZEOF_SIGNAL_HEADER + (i * SIZEOF_DATAREF) + 1] = align_offset; - - } - return 0; -} /* _align_bulk_data_buffers() */ - - -/* - * --------------------------------------------------------------------------- - * ul_send_signal_unpacked - * - * This function sends a host formatted signal to unifi. - * - * Arguments: - * priv Pointer to driver's private data. - * sigptr Pointer to the signal. - * bulkdata Pointer to the signal's bulk data. - * - * Returns: - * O on success, error code otherwise. - * - * Notes: - * The signals have to be sent in the format described in the host interface - * specification, i.e wire formatted. Certain clients use the host formatted - * structures. The write_pack() transforms the host formatted signal - * into the wired formatted signal. The code is in the core, since the signals - * are defined therefore binded to the host interface specification. - * --------------------------------------------------------------------------- - */ -int -ul_send_signal_unpacked(unifi_priv_t *priv, CSR_SIGNAL *sigptr, - bulk_data_param_t *bulkdata) -{ - u8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE]; - u16 packed_siglen; - CsrResult csrResult; - unsigned long lock_flags; - int r; - - - csrResult = write_pack(sigptr, sigbuf, &packed_siglen); - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "Malformed HIP signal in ul_send_signal_unpacked()\n"); - return CsrHipResultToStatus(csrResult); - } - r = _align_bulk_data_buffers(priv, sigbuf, (bulk_data_param_t*)bulkdata); - if (r) { - return r; - } - - spin_lock_irqsave(&priv->send_signal_lock, lock_flags); - csrResult = unifi_send_signal(priv->card, sigbuf, packed_siglen, bulkdata); - if (csrResult != CSR_RESULT_SUCCESS) { - /* free_bulkdata_buffers(priv, (bulk_data_param_t *)bulkdata); */ - spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags); - return CsrHipResultToStatus(csrResult); - } - spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags); - - return 0; -} /* ul_send_signal_unpacked() */ - - -/* - * --------------------------------------------------------------------------- - * reset_driver_status - * - * This function is called from ul_send_signal_raw() when it detects - * that the SME has sent a MLME-RESET request. - * - * Arguments: - * priv Pointer to device private struct - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -static void -reset_driver_status(unifi_priv_t *priv) -{ - priv->sta_wmm_capabilities = 0; -#ifdef CSR_NATIVE_LINUX -#ifdef CSR_SUPPORT_WEXT - priv->wext_conf.flag_associated = 0; - priv->wext_conf.block_controlled_port = CSR_WIFI_ROUTER_PORT_ACTION_8021X_PORT_OPEN; - priv->wext_conf.bss_wmm_capabilities = 0; - priv->wext_conf.disable_join_on_ssid_set = 0; -#endif -#endif -} /* reset_driver_status() */ - - -/* - * --------------------------------------------------------------------------- - * ul_send_signal_raw - * - * This function sends a wire formatted data signal to unifi. - * - * Arguments: - * priv Pointer to driver's private data. - * sigptr Pointer to the signal. - * siglen Length of the signal. - * bulkdata Pointer to the signal's bulk data. - * - * Returns: - * O on success, error code otherwise. - * --------------------------------------------------------------------------- - */ -int -ul_send_signal_raw(unifi_priv_t *priv, unsigned char *sigptr, int siglen, - bulk_data_param_t *bulkdata) -{ - CsrResult csrResult; - unsigned long lock_flags; - int r; - - /* - * Make sure that the signal is updated with the bulk data - * alignment for DMA. - */ - r = _align_bulk_data_buffers(priv, (u8*)sigptr, bulkdata); - if (r) { - return r; - } - - spin_lock_irqsave(&priv->send_signal_lock, lock_flags); - csrResult = unifi_send_signal(priv->card, sigptr, siglen, bulkdata); - if (csrResult != CSR_RESULT_SUCCESS) { - free_bulkdata_buffers(priv, bulkdata); - spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags); - return CsrHipResultToStatus(csrResult); - } - spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags); - - /* - * Since this is use by unicli, if we get an MLME reset request - * we need to initialize a few status parameters - * that the driver uses to make decisions. - */ - if (GET_SIGNAL_ID(sigptr) == CSR_MLME_RESET_REQUEST_ID) { - reset_driver_status(priv); - } - - return 0; -} /* ul_send_signal_raw() */ - - diff --git a/drivers/staging/csr/unifi_clients.h b/drivers/staging/csr/unifi_clients.h deleted file mode 100644 index df853e160ea5..000000000000 --- a/drivers/staging/csr/unifi_clients.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - ***************************************************************************** - * - * FILE : unifi_clients.h - * - * PURPOSE : Private header file for unifi clients. - * - * UDI = UniFi Debug Interface - * - * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - ***************************************************************************** - */ -#ifndef __LINUX_UNIFI_CLIENTS_H__ -#define __LINUX_UNIFI_CLIENTS_H__ 1 - -#include <linux/kernel.h> - -#define MAX_UDI_CLIENTS 8 - -/* The start of the range of process ids allocated for ul clients */ -#define UDI_SENDER_ID_BASE 0xC000 -#define UDI_SENDER_ID_SHIFT 8 - - -/* Structure to hold a UDI logged signal */ -typedef struct { - - /* List link structure */ - struct list_head q; - - /* The message that will be passed to the user app */ - udi_msg_t msg; - - /* Signal body and data follow */ - -} udi_log_t; - - - -typedef struct ul_client ul_client_t; - -typedef void (*udi_event_t)(ul_client_t *client, - const u8 *sigdata, int signal_len, - const bulk_data_param_t *bulkdata, - int dir); - -void logging_handler(void *ospriv, - u8 *sigdata, u32 signal_len, - const bulk_data_param_t *bulkdata, - enum udi_log_direction direction); - - -/* - * Structure describing a bulk data slot. - * The length field is used to indicate empty/occupied state. - */ -typedef struct _bulk_data -{ - unsigned char ptr[2000]; - unsigned int length; -} bulk_data_t; - - -struct ul_client { - /* Index of this client in the ul_clients array. */ - int client_id; - - /* Index of UniFi device to which this client is attached. */ - int instance; - - /* Flag to say whether this client has been enabled. */ - int udi_enabled; - - /* Value to use in signal->SenderProcessId */ - int sender_id; - - /* Configuration flags, e.g blocking, logging, etc. */ - unsigned int configuration; - - udi_event_t event_hook; - - /* A list to hold signals received from UniFi for reading by read() */ - struct list_head udi_log; - - /* Semaphore to protect the udi_log list */ - struct semaphore udi_sem; - - /* - * Linux waitqueue to support blocking read and poll. - * Logging clients should wait on udi_log. while - * blocking clients should wait on wake_up_wq. - */ - wait_queue_head_t udi_wq; - CSR_SIGNAL* reply_signal; - bulk_data_t* reply_bulkdata[UNIFI_MAX_DATA_REFERENCES]; - - u16 signal_filter[SIG_FILTER_SIZE]; - - - /* ------------------------------------------------------------------- */ - /* Code below here is used by the sme_native configuration only */ - - /* Flag to wake up blocking clients waiting on udi_wq. */ - int wake_up_wq_id; - - /* - * A 0x00 - 0x0F mask to apply in signal->SenderProcessId. - * Every time we do a blocking mlme request we increase this value. - * The mlme_wait_for_reply() will wait for this sequence number. - * Only the MLME blocking functions update this field. - */ - unsigned char seq_no; - - /* - * A 0x00 - 0x0F counter, containing the sequence number of - * the signal that this client has last received. - * Only the MLME blocking functions update this field. - */ - unsigned char wake_seq_no; - - unifiio_snap_filter_t snap_filter; -}; /* struct ul_client */ - - -#endif /* __LINUX_UNIFI_CLIENTS_H__ */ diff --git a/drivers/staging/csr/unifi_config.h b/drivers/staging/csr/unifi_config.h deleted file mode 100644 index fe119707844a..000000000000 --- a/drivers/staging/csr/unifi_config.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * - * FILE: unifi_config.h - * - * PURPOSE: - * This header file provides parameters that configure the operation - * of the driver. - * - * Copyright (C) 2006-2008 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#ifndef __UNIFI_CONFIG_H__ -#define __UNIFI_CONFIG_H__ 1 - -/* - * Override for the SDIO function block size on this host. When byte mode CMD53s - * are not used/supported by the SD host controller, transfers are padded up to - * the next block boundary. The 512-byte default on UF6xxx wastes too much space - * on the chip, so the block size is reduced to support this configuration. - */ -#define CSR_WIFI_HIP_SDIO_BLOCK_SIZE 64 - -/* Define the number of mini-coredump buffers to allocate at startup. These are - * used to record chip status for the last n unexpected resets. - */ -#define CSR_WIFI_HIP_NUM_COREDUMP_BUFFERS 5 - - -#endif /* __UNIFI_CONFIG_H__ */ diff --git a/drivers/staging/csr/unifi_dbg.c b/drivers/staging/csr/unifi_dbg.c deleted file mode 100644 index 38d57085a26a..000000000000 --- a/drivers/staging/csr/unifi_dbg.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * *************************************************************************** - * FILE: unifi_dbg.c - * - * PURPOSE: - * Handle debug signals received from UniFi. - * - * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * *************************************************************************** - */ -#include "unifi_priv.h" - -/* - * --------------------------------------------------------------------------- - * debug_string_indication - * debug_word16_indication - * - * Handlers for debug indications. - * - * Arguments: - * priv Pointer to private context structure. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -debug_string_indication(unifi_priv_t *priv, const unsigned char *extra, unsigned int extralen) -{ - const unsigned int maxlen = sizeof(priv->last_debug_string) - 1; - - if (extralen > maxlen) { - extralen = maxlen; - } - - strncpy(priv->last_debug_string, extra, extralen); - - /* Make sure the string is terminated */ - priv->last_debug_string[extralen] = '\0'; - - unifi_info(priv, "unifi debug: %s\n", priv->last_debug_string); - -} /* debug_string_indication() */ - - - -void -debug_word16_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr) -{ - int i; - - if (priv == NULL) { - unifi_info(priv, "Priv is NULL\n"); - return; - } - - for (i = 0; i < 16; i++) { - priv->last_debug_word16[i] = - sigptr->u.DebugWord16Indication.DebugWords[i]; - } - - if (priv->last_debug_word16[0] == 0xFA11) { - unsigned long ts; - ts = (priv->last_debug_word16[6] << 16) | priv->last_debug_word16[5]; - unifi_info(priv, " %10lu: %s fault %04x, arg %04x (x%d)\n", - ts, - priv->last_debug_word16[3] == 0x8000 ? "MAC" : - priv->last_debug_word16[3] == 0x4000 ? "PHY" : - "???", - priv->last_debug_word16[1], - priv->last_debug_word16[2], - priv->last_debug_word16[4]); - } - else if (priv->last_debug_word16[0] != 0xDBAC) - /* suppress SDL Trace output (note: still available to unicli). */ - { - unifi_info(priv, "unifi debug: %04X %04X %04X %04X %04X %04X %04X %04X\n", - priv->last_debug_word16[0], priv->last_debug_word16[1], - priv->last_debug_word16[2], priv->last_debug_word16[3], - priv->last_debug_word16[4], priv->last_debug_word16[5], - priv->last_debug_word16[6], priv->last_debug_word16[7]); - unifi_info(priv, " %04X %04X %04X %04X %04X %04X %04X %04X\n", - priv->last_debug_word16[8], priv->last_debug_word16[9], - priv->last_debug_word16[10], priv->last_debug_word16[11], - priv->last_debug_word16[12], priv->last_debug_word16[13], - priv->last_debug_word16[14], priv->last_debug_word16[15]); - } - -} /* debug_word16_indication() */ - - -void -debug_generic_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr) -{ - unifi_info(priv, "debug: %04X %04X %04X %04X %04X %04X %04X %04X\n", - sigptr->u.DebugGenericIndication.DebugWords[0], - sigptr->u.DebugGenericIndication.DebugWords[1], - sigptr->u.DebugGenericIndication.DebugWords[2], - sigptr->u.DebugGenericIndication.DebugWords[3], - sigptr->u.DebugGenericIndication.DebugWords[4], - sigptr->u.DebugGenericIndication.DebugWords[5], - sigptr->u.DebugGenericIndication.DebugWords[6], - sigptr->u.DebugGenericIndication.DebugWords[7]); - -} /* debug_generic_indication() */ - diff --git a/drivers/staging/csr/unifi_event.c b/drivers/staging/csr/unifi_event.c deleted file mode 100644 index 71fdb2180e3d..000000000000 --- a/drivers/staging/csr/unifi_event.c +++ /dev/null @@ -1,692 +0,0 @@ -/* - * *************************************************************************** - * FILE: unifi_event.c - * - * PURPOSE: - * Process the signals received by UniFi. - * It is part of the porting exercise. - * - * Copyright (C) 2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * *************************************************************************** - */ - - -/* - * Porting notes: - * The implementation of unifi_receive_event() in Linux is fairly complicated. - * The linux driver support multiple userspace applications and several - * build configurations, so the received signals are processed by different - * processes and multiple times. - * In a simple implementation, this function needs to deliver: - * - The MLME-UNITDATA.ind signals to the Rx data plane and to the Traffic - * Analysis using unifi_ta_sample(). - * - The MLME-UNITDATA-STATUS.ind signals to the Tx data plane. - * - All the other signals to the SME using unifi_sys_hip_ind(). - */ - -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_conversions.h" -#include "unifi_priv.h" - - -/* - * --------------------------------------------------------------------------- - * send_to_client - * - * Helper for unifi_receive_event. - * - * This function forwards a signal to one client. - * - * Arguments: - * priv Pointer to driver's private data. - * client Pointer to the client structure. - * receiver_id The reciever id of the signal. - * sigdata Pointer to the packed signal buffer. - * siglen Length of the packed signal. - * bulkdata Pointer to the signal's bulk data. - * - * Returns: - * None. - * - * --------------------------------------------------------------------------- - */ -static void send_to_client(unifi_priv_t *priv, ul_client_t *client, - int receiver_id, - unsigned char *sigdata, int siglen, - const bulk_data_param_t *bulkdata) -{ - if (client && client->event_hook) { - /*unifi_trace(priv, UDBG3, - "Receive: client %d, (s:0x%X, r:0x%X) - Signal 0x%.4X \n", - client->client_id, client->sender_id, receiver_id, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata));*/ - - client->event_hook(client, sigdata, siglen, bulkdata, UDI_TO_HOST); - } -} - -/* - * --------------------------------------------------------------------------- - * process_pkt_data_ind - * - * Dispatcher for received signals. - * - * This function receives the 'to host' signals and forwards - * them to the unifi linux clients. - * - * Arguments: - * priv Context - * sigdata Pointer to the packed signal buffer(Its in form of MA-PACKET.ind). - * bulkdata Pointer to signal's bulkdata - * freeBulkData Pointer to a flag which gets set if the bulkdata needs to - * be freed after calling the logging handlers. If it is not - * set the bulkdata must be freed by the MLME handler or - * passed to the network stack. - * Returns: - * TRUE if the packet should be routed to the SME etc. - * FALSE if the packet is for the driver or network stack - * --------------------------------------------------------------------------- - */ -static u8 check_routing_pkt_data_ind(unifi_priv_t *priv, - u8 *sigdata, - const bulk_data_param_t* bulkdata, - u8 *freeBulkData, - netInterface_priv_t *interfacePriv) -{ - u16 frmCtrl, receptionStatus, frmCtrlSubType; - u8 *macHdrLocation; - u8 interfaceTag; - u8 isDataFrame; - u8 isProtocolVerInvalid = FALSE; - u8 isDataFrameSubTypeNoData = FALSE; - -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - static const u8 wapiProtocolIdSNAPHeader[] = {0x88, 0xb4}; - static const u8 wapiProtocolIdSNAPHeaderOffset = 6; - u8 *destAddr; - u8 *srcAddr; - u8 isWapiUnicastPkt = FALSE; - -#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND - u16 qosControl; -#endif - - u8 llcSnapHeaderOffset = 0; - - destAddr = (u8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET; - srcAddr = (u8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET; - - /*Individual/Group bit - Bit 0 of first byte*/ - isWapiUnicastPkt = (!(destAddr[0] & 0x01)) ? TRUE : FALSE; -#endif - -#define CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET sizeof(CSR_SIGNAL_PRIMITIVE_HEADER) + 22 - - *freeBulkData = FALSE; - - /* Fetch the MAC header location from MA_PKT_IND packet */ - macHdrLocation = (u8 *) bulkdata->d[0].os_data_ptr; - /* Fetch the Frame Control value from MAC header */ - frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation); - - /* Pull out interface tag from virtual interface identifier */ - interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + 14)) & 0xff; - - /* check for MIC failure before processing the signal */ - receptionStatus = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET); - - /* To discard any spurious MIC failures that could be reported by the firmware */ - isDataFrame = ((frmCtrl & IEEE80211_FC_TYPE_MASK) == (IEEE802_11_FC_TYPE_DATA & IEEE80211_FC_TYPE_MASK)) ? TRUE : FALSE; - /* 0x00 is the only valid protocol version*/ - isProtocolVerInvalid = (frmCtrl & IEEE80211_FC_PROTO_VERSION_MASK) ? TRUE : FALSE; - frmCtrlSubType = (frmCtrl & IEEE80211_FC_SUBTYPE_MASK) >> FRAME_CONTROL_SUBTYPE_FIELD_OFFSET; - /*Exclude the no data & reserved sub-types from MIC failure processing*/ - isDataFrameSubTypeNoData = (((frmCtrlSubType>0x03)&&(frmCtrlSubType<0x08)) || (frmCtrlSubType>0x0B)) ? TRUE : FALSE; - if ((receptionStatus == CSR_MICHAEL_MIC_ERROR) && - ((!isDataFrame) || isProtocolVerInvalid || (isDataFrame && isDataFrameSubTypeNoData))) { - /* Currently MIC errors are discarded for frames other than data frames. This might need changing when we start - * supporting 802.11w (Protected Management frames) - */ - *freeBulkData = TRUE; - unifi_trace(priv, UDBG4, "Discarding this frame and ignoring the MIC failure as this is a garbage/non-data/no data frame\n"); - return FALSE; - } - -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - - if (receptionStatus == CSR_MICHAEL_MIC_ERROR) { - - if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA) { - -#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND - if ((isDataFrame) && - ((IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK) == (frmCtrl & IEEE80211_FC_SUBTYPE_MASK)) && - (priv->isWapiConnection)) - { - qosControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation + (((frmCtrl & IEEE802_11_FC_TO_DS_MASK) && (frmCtrl & IEEE802_11_FC_FROM_DS_MASK)) ? 30 : 24) ); - - unifi_trace(priv, UDBG4, "check_routing_pkt_data_ind() :: Value of the QoS control field - 0x%04x \n", qosControl); - - if (qosControl & IEEE802_11_QC_NON_TID_BITS_MASK) - { - unifi_trace(priv, UDBG4, "Ignore the MIC failure and pass the MPDU to the stack when any of bits [4-15] is set in the QoS control field\n"); - - /*Exclude the MIC [16] and the PN [16] that are appended by the firmware*/ - ((bulk_data_param_t*)bulkdata)->d[0].data_length = bulkdata->d[0].data_length - 32; - - /*Clear the reception status of the signal (CSR_RX_SUCCESS)*/ - *(sigdata + CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET) = 0x00; - *(sigdata + CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET+1) = 0x00; - - *freeBulkData = FALSE; - - return FALSE; - } - } -#endif - /* If this MIC ERROR reported by the firmware is either for - * [1] a WAPI Multicast MPDU and the Multicast filter has NOT been set (It is set only when group key index (MSKID) = 1 in Group Rekeying) OR - * [2] a WAPI Unicast MPDU and either the CONTROL PORT is open or the WAPI Unicast filter or filter(s) is NOT set - * then report a MIC FAILURE indication to the SME. - */ -#ifndef CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION - if ((priv->wapi_multicast_filter == 0) || isWapiUnicastPkt) { -#else - /*When SW encryption is enabled and USKID=1 (wapi_unicast_filter = 1), we are expected - *to receive MIC failure INDs for unicast MPDUs*/ - if ( ((priv->wapi_multicast_filter == 0) && !isWapiUnicastPkt) || - ((priv->wapi_unicast_filter == 0) && isWapiUnicastPkt) ) { -#endif - /*Discard the frame*/ - *freeBulkData = TRUE; - unifi_trace(priv, UDBG4, "Discarding the contents of the frame with MIC failure \n"); - - if (isWapiUnicastPkt && - ((uf_sme_port_state(priv, srcAddr, UF_CONTROLLED_PORT_Q, interfaceTag) != CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN)|| -#ifndef CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION - (priv->wapi_unicast_filter) || -#endif - (priv->wapi_unicast_queued_pkt_filter))) { - - /* Workaround to handle MIC failures reported by the firmware for encrypted packets from the AP - * while we are in the process of re-association induced by unsupported WAPI Unicast key index - * - Discard the packets with MIC failures "until" we have - * a. negotiated a key, - * b. opened the CONTROL PORT and - * c. the AP has started using the new key - */ - unifi_trace(priv, UDBG4, "Ignoring the MIC failure as either a. CONTROL PORT isn't OPEN or b. Unicast filter is set or c. WAPI AP using old key for buffered pkts\n"); - - /*Ignore this MIC failure*/ - return FALSE; - - }/*WAPI re-key specific workaround*/ - - unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind - MIC FAILURE : interfaceTag %x Src Addr %x:%x:%x:%x:%x:%x\n", - interfaceTag, srcAddr[0], srcAddr[1], srcAddr[2], srcAddr[3], srcAddr[4], srcAddr[5]); - unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind - MIC FAILURE : Dest Addr %x:%x:%x:%x:%x:%x\n", - destAddr[0], destAddr[1], destAddr[2], destAddr[3], destAddr[4], destAddr[5]); - unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind - MIC FAILURE : Control Port State - 0x%.4X \n", - uf_sme_port_state(priv, srcAddr, UF_CONTROLLED_PORT_Q, interfaceTag)); - - unifi_error(priv, "MIC failure in %s\n", __FUNCTION__); - - /*Report the MIC failure to the SME*/ - return TRUE; - } - }/* STA mode */ - else { - /* Its AP Mode . Just Return */ - *freeBulkData = TRUE; - unifi_error(priv, "MIC failure in %s\n", __FUNCTION__); - return TRUE; - } /* AP mode */ - }/* MIC error */ -#else - if (receptionStatus == CSR_MICHAEL_MIC_ERROR) { - *freeBulkData = TRUE; - unifi_error(priv, "MIC failure in %s\n", __FUNCTION__); - return TRUE; - } -#endif /*CSR_WIFI_SECURITY_WAPI_ENABLE*/ - - unifi_trace(priv, UDBG4, "frmCtrl = 0x%04x %s\n", - frmCtrl, - (((frmCtrl & 0x000c)>>FRAME_CONTROL_TYPE_FIELD_OFFSET) == IEEE802_11_FRAMETYPE_MANAGEMENT) ? - "Mgt" : "Ctrl/Data"); - -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - /* To ignore MIC failures reported due to the WAPI AP using the old key for queued packets before - * starting to use the new key negotiated as part of unicast re-keying - */ - if ((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA)&& - isWapiUnicastPkt && - (receptionStatus == CSR_RX_SUCCESS) && - (priv->wapi_unicast_queued_pkt_filter==1)) { - - unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): WAPI unicast pkt received when the (wapi_unicast_queued_pkt_filter) is set\n"); - - if (isDataFrame) { - switch(frmCtrl & IEEE80211_FC_SUBTYPE_MASK) { - case IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK: - llcSnapHeaderOffset = MAC_HEADER_SIZE + 2; - break; - case IEEE802_11_FC_TYPE_QOS_NULL & IEEE80211_FC_SUBTYPE_MASK: - case IEEE802_11_FC_TYPE_NULL & IEEE80211_FC_SUBTYPE_MASK: - break; - default: - llcSnapHeaderOffset = MAC_HEADER_SIZE; - } - } - - if (llcSnapHeaderOffset > 0) { - /* QoS data or Data */ - unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): SNAP header found & its offset %d\n", llcSnapHeaderOffset); - if (memcmp((u8 *)(bulkdata->d[0].os_data_ptr+llcSnapHeaderOffset+wapiProtocolIdSNAPHeaderOffset), - wapiProtocolIdSNAPHeader, sizeof(wapiProtocolIdSNAPHeader))) { - - unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): This is a data & NOT a WAI protocol packet\n"); - /* On the first unicast data pkt that is decrypted successfully after re-keying, reset the filter */ - priv->wapi_unicast_queued_pkt_filter = 0; - unifi_trace(priv, UDBG4, "check_routing_pkt_data_ind(): WAPI AP has started using the new unicast key, no more MIC failures expected (reset filter)\n"); - } - else { - unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): WAPI - This is a WAI protocol packet\n"); - } - } - } -#endif - - - switch ((frmCtrl & 0x000c)>>FRAME_CONTROL_TYPE_FIELD_OFFSET) { - case IEEE802_11_FRAMETYPE_MANAGEMENT: - *freeBulkData = TRUE; /* Free (after SME handler copies it) */ - - /* In P2P device mode, filter the legacy AP beacons here */ - if((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2P)&&\ - ((CSR_WIFI_80211_GET_FRAME_SUBTYPE(macHdrLocation)) == CSR_WIFI_80211_FRAME_SUBTYPE_BEACON)){ - - u8 *pSsid, *pSsidLen; - static u8 P2PWildCardSsid[CSR_WIFI_P2P_WILDCARD_SSID_LENGTH] = {'D', 'I', 'R', 'E', 'C', 'T', '-'}; - - pSsidLen = macHdrLocation + MAC_HEADER_SIZE + CSR_WIFI_BEACON_FIXED_LENGTH; - pSsid = pSsidLen + 2; - - if(*(pSsidLen + 1) >= CSR_WIFI_P2P_WILDCARD_SSID_LENGTH){ - if(memcmp(pSsid, P2PWildCardSsid, CSR_WIFI_P2P_WILDCARD_SSID_LENGTH) == 0){ - unifi_trace(priv, UDBG6, "Received a P2P Beacon, pass it to SME\n"); - return TRUE; - } - } - unifi_trace(priv, UDBG6, "Received a Legacy AP beacon in P2P mode, drop it\n"); - return FALSE; - } - return TRUE; /* Route to SME */ - case IEEE802_11_FRAMETYPE_DATA: - case IEEE802_11_FRAMETYPE_CONTROL: - *freeBulkData = FALSE; /* Network stack or MLME handler frees */ - return FALSE; - default: - unifi_error(priv, "Unhandled frame type %04x\n", frmCtrl); - *freeBulkData = TRUE; /* Not interested, but must free it */ - return FALSE; - } -} - -/* - * --------------------------------------------------------------------------- - * unifi_process_receive_event - * - * Dispatcher for received signals. - * - * This function receives the 'to host' signals and forwards - * them to the unifi linux clients. - * - * Arguments: - * ospriv Pointer to driver's private data. - * sigdata Pointer to the packed signal buffer. - * siglen Length of the packed signal. - * bulkdata Pointer to the signal's bulk data. - * - * Returns: - * None. - * - * Notes: - * The signals are received in the format described in the host interface - * specification, i.e wire formatted. Certain clients use the same format - * to interpret them and other clients use the host formatted structures. - * Each client has to call read_unpack_signal() to transform the wire - * formatted signal into the host formatted signal, if necessary. - * The code is in the core, since the signals are defined therefore - * binded to the host interface specification. - * --------------------------------------------------------------------------- - */ -static void -unifi_process_receive_event(void *ospriv, - u8 *sigdata, u32 siglen, - const bulk_data_param_t *bulkdata) -{ - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - int i, receiver_id; - int client_id; - s16 signal_id; - u8 pktIndToSme = FALSE, freeBulkData = FALSE; - - unifi_trace(priv, UDBG5, "unifi_process_receive_event: " - "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*0) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*1) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*2) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*3) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*4) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*5) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*6) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*7) & 0xFFFF, - siglen); - - receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)) & 0xFF00; - client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT; - signal_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata); - - - - /* check for the type of frame received (checks for 802.11 management frames) */ - if (signal_id == CSR_MA_PACKET_INDICATION_ID) - { -#define CSR_MA_PACKET_INDICATION_INTERFACETAG_OFFSET 14 - u8 interfaceTag; - netInterface_priv_t *interfacePriv; - - /* Pull out interface tag from virtual interface identifier */ - interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_MA_PACKET_INDICATION_INTERFACETAG_OFFSET)) & 0xff; - interfacePriv = priv->interfacePriv[interfaceTag]; - - /* Update activity for this station in case of IBSS */ -#ifdef CSR_SUPPORT_SME - if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS) - { - u8 *saddr; - /* Fetch the source address from mac header */ - saddr = (u8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET; - unifi_trace(priv, UDBG5, - "Updating sta activity in IBSS interfaceTag %x Src Addr %x:%x:%x:%x:%x:%x\n", - interfaceTag, saddr[0], saddr[1], saddr[2], saddr[3], saddr[4], saddr[5]); - - uf_update_sta_activity(priv, interfaceTag, saddr); - } -#endif - - pktIndToSme = check_routing_pkt_data_ind(priv, sigdata, bulkdata, &freeBulkData, interfacePriv); - - unifi_trace(priv, UDBG6, "RX: packet entry point to driver from HIP,pkt to SME ?(%s) \n", (pktIndToSme)? "YES":"NO"); - - } - - if (pktIndToSme) - { - /* Management MA_PACKET_IND for SME */ - if(sigdata != NULL && bulkdata != NULL){ - send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata); - } - else{ - unifi_error(priv, "unifi_receive_event2: sigdata or Bulkdata is NULL \n"); - } -#ifdef CSR_NATIVE_LINUX - send_to_client(priv, priv->wext_client, - receiver_id, - sigdata, siglen, bulkdata); -#endif - } - else - { - /* Signals with ReceiverId==0 are also reported to SME / WEXT, - * unless they are data/control MA_PACKET_INDs or VIF_AVAILABILITY_INDs - */ - if (!receiver_id) { - if(signal_id == CSR_MA_VIF_AVAILABILITY_INDICATION_ID) { - uf_process_ma_vif_availibility_ind(priv, sigdata, siglen); - } - else if (signal_id != CSR_MA_PACKET_INDICATION_ID) { - send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata); -#ifdef CSR_NATIVE_LINUX - send_to_client(priv, priv->wext_client, - receiver_id, - sigdata, siglen, bulkdata); -#endif - } - else - { - -#if (defined(CSR_SUPPORT_SME) && defined(CSR_WIFI_SECURITY_WAPI_ENABLE)) - #define CSR_MA_PACKET_INDICATION_RECEPTION_STATUS_OFFSET sizeof(CSR_SIGNAL_PRIMITIVE_HEADER) + 22 - netInterface_priv_t *interfacePriv; - u8 interfaceTag; - u16 receptionStatus = CSR_RX_SUCCESS; - - /* Pull out interface tag from virtual interface identifier */ - interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_MA_PACKET_INDICATION_INTERFACETAG_OFFSET)) & 0xff; - interfacePriv = priv->interfacePriv[interfaceTag]; - - /* check for MIC failure */ - receptionStatus = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_MA_PACKET_INDICATION_RECEPTION_STATUS_OFFSET); - - /* Send a WAPI MPDU to SME for re-check MIC if the respective filter has been set*/ - if ((!freeBulkData) && - (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA) && - (receptionStatus == CSR_MICHAEL_MIC_ERROR) && - ((priv->wapi_multicast_filter == 1) -#ifdef CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION - || (priv->wapi_unicast_filter == 1) -#endif - )) - { - CSR_SIGNAL signal; - u8 *destAddr; - CsrResult res; - u16 interfaceTag = 0; - u8 isMcastPkt = TRUE; - - unifi_trace(priv, UDBG6, "Received a WAPI data packet when the Unicast/Multicast filter is set\n"); - res = read_unpack_signal(sigdata, &signal); - if (res) { - unifi_error(priv, "Received unknown or corrupted signal (0x%x).\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata)); - return; - } - - /* Check if the type of MPDU and the respective filter status*/ - destAddr = (u8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET; - isMcastPkt = (destAddr[0] & 0x01) ? TRUE : FALSE; - unifi_trace(priv, UDBG6, - "1.MPDU type: (%s), 2.Multicast filter: (%s), 3. Unicast filter: (%s)\n", - ((isMcastPkt) ? "Multiast":"Unicast"), - ((priv->wapi_multicast_filter) ? "Enabled":"Disabled"), - ((priv->wapi_unicast_filter) ? "Enabled":"Disabled")); - - if (((isMcastPkt) && (priv->wapi_multicast_filter == 1)) -#ifdef CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION - || ((!isMcastPkt) && (priv->wapi_unicast_filter == 1)) -#endif - ) - { - unifi_trace(priv, UDBG4, "Sending the WAPI MPDU for MIC check\n"); - CsrWifiRouterCtrlWapiRxMicCheckIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, siglen, sigdata, bulkdata->d[0].data_length, (u8*)bulkdata->d[0].os_data_ptr); - - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - if (bulkdata->d[i].data_length != 0) { - unifi_net_data_free(priv, (void *)&bulkdata->d[i]); - } - } - return; - } - } /* CSR_MA_PACKET_INDICATION_ID */ -#endif /*CSR_SUPPORT_SME && CSR_WIFI_SECURITY_WAPI_ENABLE*/ - } - } - - /* calls the registered clients handler callback func. - * netdev_mlme_event_handler is one of the registered handler used to route - * data packet to network stack or AMP/EAPOL related data to SME - * - * The freeBulkData check ensures that, it has received a management frame and - * the frame needs to be freed here. So not to be passed to netdev handler - */ - if(!freeBulkData){ - if ((client_id < MAX_UDI_CLIENTS) && - (&priv->ul_clients[client_id] != priv->logging_client)) { - unifi_trace(priv, UDBG6, "Call the registered clients handler callback func\n"); - send_to_client(priv, &priv->ul_clients[client_id], - receiver_id, - sigdata, siglen, bulkdata); - } - } - } - - /* - * Free bulk data buffers here unless it is a CSR_MA_PACKET_INDICATION - */ - switch (signal_id) - { -#ifdef UNIFI_SNIFF_ARPHRD - case CSR_MA_SNIFFDATA_INDICATION_ID: -#endif - break; - - case CSR_MA_PACKET_INDICATION_ID: - if (!freeBulkData) - { - break; - } - /* FALLS THROUGH... */ - default: - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - if (bulkdata->d[i].data_length != 0) { - unifi_net_data_free(priv, (void *)&bulkdata->d[i]); - } - } - } - -} /* unifi_process_receive_event() */ - - -#ifdef CSR_WIFI_RX_PATH_SPLIT -static u8 signal_buffer_is_full(unifi_priv_t* priv) -{ - return (((priv->rxSignalBuffer.writePointer + 1)% priv->rxSignalBuffer.size) == (priv->rxSignalBuffer.readPointer)); -} - -void unifi_rx_queue_flush(void *ospriv) -{ - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - - unifi_trace(priv, UDBG4, "rx_wq_handler: RdPtr = %d WritePtr = %d\n", - priv->rxSignalBuffer.readPointer, priv->rxSignalBuffer.writePointer); - if(priv != NULL) { - u8 readPointer = priv->rxSignalBuffer.readPointer; - while (readPointer != priv->rxSignalBuffer.writePointer) - { - rx_buff_struct_t *buf = &priv->rxSignalBuffer.rx_buff[readPointer]; - unifi_trace(priv, UDBG6, "rx_wq_handler: RdPtr = %d WritePtr = %d\n", - readPointer, priv->rxSignalBuffer.writePointer); - unifi_process_receive_event(priv, buf->bufptr, buf->sig_len, &buf->data_ptrs); - readPointer ++; - if(readPointer >= priv->rxSignalBuffer.size) { - readPointer = 0; - } - } - priv->rxSignalBuffer.readPointer = readPointer; - } -} - -void rx_wq_handler(struct work_struct *work) -{ - unifi_priv_t *priv = container_of(work, unifi_priv_t, rx_work_struct); - unifi_rx_queue_flush(priv); -} -#endif - - - -/* - * --------------------------------------------------------------------------- - * unifi_receive_event - * - * Dispatcher for received signals. - * - * This function receives the 'to host' signals and forwards - * them to the unifi linux clients. - * - * Arguments: - * ospriv Pointer to driver's private data. - * sigdata Pointer to the packed signal buffer. - * siglen Length of the packed signal. - * bulkdata Pointer to the signal's bulk data. - * - * Returns: - * None. - * - * Notes: - * The signals are received in the format described in the host interface - * specification, i.e wire formatted. Certain clients use the same format - * to interpret them and other clients use the host formatted structures. - * Each client has to call read_unpack_signal() to transform the wire - * formatted signal into the host formatted signal, if necessary. - * The code is in the core, since the signals are defined therefore - * binded to the host interface specification. - * --------------------------------------------------------------------------- - */ -void -unifi_receive_event(void *ospriv, - u8 *sigdata, u32 siglen, - const bulk_data_param_t *bulkdata) -{ -#ifdef CSR_WIFI_RX_PATH_SPLIT - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - u8 writePointer; - int i; - rx_buff_struct_t * rx_buff; - - unifi_trace(priv, UDBG5, "unifi_receive_event: " - "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*0) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*1) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*2) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*3) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*4) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*5) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*6) & 0xFFFF, - CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*7) & 0xFFFF, siglen); - if(signal_buffer_is_full(priv)) { - unifi_error(priv, "TO HOST signal queue FULL dropping the PDU\n"); - for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) { - if (bulkdata->d[i].data_length != 0) { - unifi_net_data_free(priv, (void *)&bulkdata->d[i]); - } - } - return; - } - writePointer = priv->rxSignalBuffer.writePointer; - rx_buff = &priv->rxSignalBuffer.rx_buff[writePointer]; - memcpy(rx_buff->bufptr, sigdata, siglen); - rx_buff->sig_len = siglen; - rx_buff->data_ptrs = *bulkdata; - writePointer++; - if(writePointer >= priv->rxSignalBuffer.size) { - writePointer =0; - } - unifi_trace(priv, UDBG4, "unifi_receive_event:writePtr = %d\n", priv->rxSignalBuffer.writePointer); - priv->rxSignalBuffer.writePointer = writePointer; - -#ifndef CSR_WIFI_RX_PATH_SPLIT_DONT_USE_WQ - queue_work(priv->rx_workqueue, &priv->rx_work_struct); -#endif - -#else - unifi_process_receive_event(ospriv, sigdata, siglen, bulkdata); -#endif -} /* unifi_receive_event() */ - diff --git a/drivers/staging/csr/unifi_native.h b/drivers/staging/csr/unifi_native.h deleted file mode 100644 index a73b38e5e480..000000000000 --- a/drivers/staging/csr/unifi_native.h +++ /dev/null @@ -1,257 +0,0 @@ -/* - ***************************************************************************** - * - * FILE : unifi_native.h - * - * PURPOSE : Private header file for unifi driver support to wireless extensions. - * - * UDI = UniFi Debug Interface - * - * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - ***************************************************************************** - */ -#ifndef __LINUX_UNIFI_NATIVE_H__ -#define __LINUX_UNIFI_NATIVE_H__ 1 - -#include <linux/kernel.h> -#include <linux/if_arp.h> - - -/* - * scan.c wext.c autojoin.c - */ -/* Structure to hold results of a scan */ -typedef struct scan_info { - -/* CSR_MLME_SCAN_INDICATION msi; */ - - unsigned char *info_elems; - int info_elem_length; - -} scan_info_t; - - -#define IE_VECTOR_MAXLEN 1024 - -#ifdef CSR_SUPPORT_WEXT -/* - * Structre to hold the wireless network configuration info. - */ -struct wext_config { - - /* Requested channel when setting up an adhoc network */ - int channel; - - /* wireless extns mode: IW_MODE_AUTO, ADHOC, INFRA, MASTER ... MONITOR */ - int mode; - - /* The capabilities of the currently joined network */ - int capability; - - /* The interval between beacons if we create an IBSS */ - int beacon_period; - - /* - * Power-save parameters - */ - /* The listen interval to ask for in Associate req. */ - int assoc_listen_interval; - /* Power-mode to put UniFi into */ - - unsigned char desired_ssid[UNIFI_MAX_SSID_LEN]; /* the last ESSID set by SIOCSIWESSID */ - int power_mode; - /* Whether to wake for broadcast packets (using DTIM interval) */ - int wakeup_for_dtims; - - /* Currently selected WEP Key ID (0..3) */ - int wep_key_id; - - wep_key_t wep_keys[NUM_WEPKEYS]; - -/* CSR_AUTHENTICATION_TYPE auth_type; */ - int privacy; - - u32 join_failure_timeout; - u32 auth_failure_timeout; - u32 assoc_failure_timeout; - - unsigned char generic_ie[IE_VECTOR_MAXLEN]; - int generic_ie_len; - - struct iw_statistics wireless_stats; - - - /* the ESSID we are currently associated to */ - unsigned char current_ssid[UNIFI_MAX_SSID_LEN]; - /* the BSSID we are currently associated to */ - unsigned char current_bssid[6]; - - /* - * IW_AUTH_WPA_VERSION_DISABLED 0x00000001 - * IW_AUTH_WPA_VERSION_WPA 0x00000002 - * IW_AUTH_WPA_VERSION_WPA2 0x00000004 - */ - unsigned char wpa_version; - - /* - * cipher selection: - * IW_AUTH_CIPHER_NONE 0x00000001 - * IW_AUTH_CIPHER_WEP40 0x00000002 - * IW_AUTH_CIPHER_TKIP 0x00000004 - * IW_AUTH_CIPHER_CCMP 0x00000008 - * IW_AUTH_CIPHER_WEP104 0x00000010 - */ - unsigned char pairwise_cipher_used; - unsigned char group_cipher_used; - - unsigned int frag_thresh; - unsigned int rts_thresh; - - /* U-APSD value, send with Association Request to WMM Enabled APs */ - unsigned char wmm_bss_uapsd_mask; - /* The WMM capabilities of the selected BSS */ - unsigned int bss_wmm_capabilities; - - /* Flag to prevent a join when the ssid is set */ - int disable_join_on_ssid_set; - - /* Scan info */ -#define UNIFI_MAX_SCANS 32 - scan_info_t scan_list[UNIFI_MAX_SCANS]; - int num_scan_info; - - /* Flag on whether non-802.1x packets are allowed out */ -/* CsrWifiRouterPortAction block_controlled_port;*/ - - /* Flag on whether we have completed an authenticate/associate process */ - unsigned int flag_associated : 1; -}; /* struct wext_config */ - -#endif /* CSR_SUPPORT_WEXT */ - - -/* - * wext.c - */ -/*int mlme_set_protection(unifi_priv_t *priv, unsigned char *addr, - CSR_PROTECT_TYPE prot, CSR_KEY_TYPE key_type); -*/ - -/* - * scan.c - */ -/* -void unifi_scan_indication_handler(unifi_priv_t *priv, - const CSR_MLME_SCAN_INDICATION *msg, - const unsigned char *extra, - unsigned int len); -*/ -void unifi_clear_scan_table(unifi_priv_t *priv); -scan_info_t *unifi_get_scan_report(unifi_priv_t *priv, int index); - - -/* - * Utility functions - */ -const unsigned char *unifi_find_info_element(int id, - const unsigned char *info, - int len); -int unifi_add_info_element(unsigned char *info, - int ie_id, - const unsigned char *ie_data, - int ie_len); - -/* - * autojoin.c - */ -/* Higher level fns */ -int unifi_autojoin(unifi_priv_t *priv, const char *ssid); -/* -int unifi_do_scan(unifi_priv_t *priv, int scantype, CSR_BSS_TYPE bsstype, - const char *ssid, int ssid_len); -*/ -int unifi_set_powermode(unifi_priv_t *priv); -int unifi_join_ap(unifi_priv_t *priv, scan_info_t *si); -int unifi_join_bss(unifi_priv_t *priv, unsigned char *macaddr); -int unifi_leave(unifi_priv_t *priv); -unsigned int unifi_get_wmm_bss_capabilities(unifi_priv_t *priv, - unsigned char *ie_vector, - int ie_len, int *ap_capabilities); - -/* - * Status and management. - */ -int uf_init_wext_interface(unifi_priv_t *priv); -void uf_deinit_wext_interface(unifi_priv_t *priv); - -/* - * Function to reset UniFi's 802.11 state by sending MLME-RESET.req - */ -int unifi_reset_state(unifi_priv_t *priv, unsigned char *macaddr, unsigned char set_default_mib); - - -/* - * mlme.c - */ -/* Abort an MLME operation - useful in error recovery */ -int uf_abort_mlme(unifi_priv_t *priv); - -int unifi_mlme_blocking_request(unifi_priv_t *priv, ul_client_t *pcli, - CSR_SIGNAL *sig, bulk_data_param_t *data_ptrs, - int timeout); -void unifi_mlme_copy_reply_and_wakeup_client(ul_client_t *pcli, - CSR_SIGNAL *signal, int signal_len, - const bulk_data_param_t *bulkdata); - -/* - * Utility functions - */ -const char *lookup_reason_code(int reason); -const char *lookup_result_code(int result); - - -/* - * sme_native.c - */ -int uf_sme_init(unifi_priv_t *priv); -void uf_sme_deinit(unifi_priv_t *priv); -int sme_sys_suspend(unifi_priv_t *priv); -int sme_sys_resume(unifi_priv_t *priv); -int sme_mgt_wifi_on(unifi_priv_t *priv); - -/* Callback for event logging to SME clients (unifi_manager) */ -void sme_native_log_event(ul_client_t *client, - const u8 *sig_packed, int sig_len, - const bulk_data_param_t *bulkdata, - int dir); - -void sme_native_mlme_event_handler(ul_client_t *pcli, - const u8 *sig_packed, int sig_len, - const bulk_data_param_t *bulkdata, - int dir); - -/* Task to query statistics from the MIB */ -#define UF_SME_STATS_WQ_TIMEOUT 2000 /* in msecs */ -void uf_sme_stats_wq(struct work_struct *work); - -void uf_native_process_udi_signal(ul_client_t *pcli, - const u8 *packed_signal, - int packed_signal_len, - const bulk_data_param_t *bulkdata, int dir); -#ifdef UNIFI_SNIFF_ARPHRD -/* - * monitor.c - */ -int uf_start_sniff(unifi_priv_t *priv); -/* -void ma_sniffdata_ind(void *ospriv, - const CSR_MA_SNIFFDATA_INDICATION *ind, - const bulk_data_param_t *bulkdata); -*/ -#endif /* ARPHRD_IEEE80211_PRISM */ - -#endif /* __LINUX_UNIFI_NATIVE_H__ */ diff --git a/drivers/staging/csr/unifi_os.h b/drivers/staging/csr/unifi_os.h deleted file mode 100644 index 56a26982070e..000000000000 --- a/drivers/staging/csr/unifi_os.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * - * FILE: os_linux/unifi_os.h - * - * PURPOSE: - * This header file provides the OS-dependent facilities for a linux - * environment. - * - * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#ifndef __UNIFI_OS_LINUX_H__ -#define __UNIFI_OS_LINUX_H__ 1 - -#include <linux/kernel.h> -#include <linux/time.h> -#include <linux/list.h> -#include <linux/delay.h> -#include <linux/string.h> - -/* - * Needed for core/signals.c - */ -#include <stddef.h> - - -/* Define INLINE directive*/ -#define INLINE inline - -/* Malloc and free */ -CsrResult unifi_net_data_malloc(void *ospriv, bulk_data_desc_t *bulk_data_slot, unsigned int size); -void unifi_net_data_free(void *ospriv, bulk_data_desc_t *bulk_data_slot); -#define CSR_WIFI_ALIGN_BYTES 4 -CsrResult unifi_net_dma_align(void *ospriv, bulk_data_desc_t *bulk_data_slot); - -/* - * Byte Order - * Note that __le*_to_cpu and __cpu_to_le* return an unsigned value! - */ -#ifdef __KERNEL__ -#define unifi2host_16(n) (__le16_to_cpu((n))) -#define unifi2host_32(n) (__le32_to_cpu((n))) -#define host2unifi_16(n) (__cpu_to_le16((n))) -#define host2unifi_32(n) (__cpu_to_le32((n))) -#endif - -/* Module parameters */ -extern int unifi_debug; - -/* debugging */ -#ifdef UNIFI_DEBUG -/* - * unifi_debug is a verbosity level for debug messages - * UDBG0 msgs are always printed if UNIFI_DEBUG is defined - * UDBG1 msgs are printed if UNIFI_DEBUG is defined and unifi_debug > 0 - * etc. - */ - -#define ASSERT(cond) \ - do { \ - if (!(cond)) { \ - printk("Assertion failed in %s at %s:%d: %s\n", \ - __FUNCTION__, __FILE__, __LINE__, #cond); \ - } \ - } while (0) - - -void unifi_dump(void *ospriv, int lvl, const char *msg, void *mem, u16 len); -void dump(void *mem, u16 len); -void dump16(void *mem, u16 len); -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -void dump_str(void *mem, u16 len); -#endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */ - -void unifi_error(void* ospriv, const char *fmt, ...); -void unifi_warning(void* ospriv, const char *fmt, ...); -void unifi_notice(void* ospriv, const char *fmt, ...); -void unifi_info(void* ospriv, const char *fmt, ...); - -void unifi_trace(void* ospriv, int level, const char *fmt, ...); - -#else - -/* Stubs */ - -#define ASSERT(cond) - -static inline void unifi_dump(void *ospriv, int lvl, const char *msg, void *mem, u16 len) {} -static inline void dump(void *mem, u16 len) {} -static inline void dump16(void *mem, u16 len) {} -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -static inline void dump_str(void *mem, u16 len) {} -#endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */ - -void unifi_error_nop(void* ospriv, const char *fmt, ...); -void unifi_trace_nop(void* ospriv, int level, const char *fmt, ...); -#define unifi_error if(1);else unifi_error_nop -#define unifi_warning if(1);else unifi_error_nop -#define unifi_notice if(1);else unifi_error_nop -#define unifi_info if(1);else unifi_error_nop -#define unifi_trace if(1);else unifi_trace_nop - -#endif /* UNIFI_DEBUG */ - - -/* Different levels of diagnostic detail... */ -#define UDBG0 0 /* always prints in debug build */ -#define UDBG1 1 -#define UDBG2 2 -#define UDBG3 3 -#define UDBG4 4 -#define UDBG5 5 -#define UDBG6 6 -#define UDBG7 7 - - -#endif /* __UNIFI_OS_LINUX_H__ */ diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c deleted file mode 100644 index 04fe9e2acf0e..000000000000 --- a/drivers/staging/csr/unifi_pdu_processing.c +++ /dev/null @@ -1,3729 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: unifi_pdu_processing.c - * - * PURPOSE: - * This file provides the PDU handling functionality before it gets sent to unfi and after - * receiving a PDU from unifi - * - * Copyright (C) 2010 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ - -#include <linux/types.h> -#include <linux/etherdevice.h> -#include <linux/vmalloc.h> - -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_conversions.h" -#include "csr_time.h" -#include "unifi_priv.h" -#include <net/pkt_sched.h> - -#ifdef CSR_SUPPORT_SME -static void _update_buffered_pkt_params_after_alignment(unifi_priv_t *priv, bulk_data_param_t *bulkdata, - tx_buffered_packets_t* buffered_pkt) -{ - struct sk_buff *skb ; - u32 align_offset; - - if (priv == NULL || bulkdata == NULL || buffered_pkt == NULL){ - return; - } - - skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr; - align_offset = (u32)(long)(bulkdata->d[0].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1); - if(align_offset){ - skb_pull(skb, align_offset); - } - - buffered_pkt->bulkdata.os_data_ptr = bulkdata->d[0].os_data_ptr; - buffered_pkt->bulkdata.data_length = bulkdata->d[0].data_length; - buffered_pkt->bulkdata.os_net_buf_ptr = bulkdata->d[0].os_net_buf_ptr; - buffered_pkt->bulkdata.net_buf_length = bulkdata->d[0].net_buf_length; -} -#endif - -void -unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, - CSR_RATE TransmitRate, CSR_CLIENT_TAG hostTag, - u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, - CSR_PROCESS_ID leSenderProcessId, u8 *peerMacAddress, - CSR_SIGNAL *signal) -{ - - CSR_MA_PACKET_REQUEST *req = &signal->u.MaPacketRequest; - netInterface_priv_t *interfacePriv; - u8 ba_session_idx = 0; - ba_session_tx_struct *ba_session = NULL; - u8 *ba_addr = NULL; - - interfacePriv = priv->interfacePriv[interfaceTag]; - - unifi_trace(priv, UDBG5, - "In unifi_frame_ma_packet_req, Frame for Peer: %pMF\n", - peerMacAddress); - signal->SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID; - signal->SignalPrimitiveHeader.ReceiverProcessId = 0; - signal->SignalPrimitiveHeader.SenderProcessId = leSenderProcessId; - - /* Fill the MA-PACKET.req */ - req->Priority = priority; - unifi_trace(priv, UDBG3, "Tx Frame with Priority: 0x%x\n", req->Priority); - - /* A value of 0 is used for auto selection of rates. But for P2P GO case - * for action frames the rate is governed by SME. Hence instead of 0, - * the rate is filled in with the value passed here - */ - req->TransmitRate = TransmitRate; - - /* packets from netdev then no confirm required but packets from - * Nme/Sme eapol data frames requires the confirmation - */ - req->TransmissionControl = transmissionControl; - req->VirtualInterfaceIdentifier = - uf_get_vif_identifier(interfacePriv->interfaceMode, interfaceTag); - memcpy(req->Ra.x, peerMacAddress, ETH_ALEN); - - if (hostTag == 0xffffffff) { - req->HostTag = interfacePriv->tag++; - req->HostTag |= 0x40000000; - unifi_trace(priv, UDBG3, "new host tag assigned = 0x%x\n", req->HostTag); - interfacePriv->tag &= 0x0fffffff; - } else { - req->HostTag = hostTag; - unifi_trace(priv, UDBG3, "host tag got from SME = 0x%x\n", req->HostTag); - } - /* check if BA session exists for the peer MAC address on same tID */ - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO){ - ba_addr = peerMacAddress; - }else{ - ba_addr = interfacePriv->bssid.a; - } - for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){ - ba_session = interfacePriv->ba_session_tx[ba_session_idx]; - if (ba_session){ - if ((!memcmp(ba_session->macAddress.a, ba_addr, ETH_ALEN)) && (ba_session->tID == priority)){ - req->TransmissionControl |= CSR_ALLOW_BA; - break; - } - } - } - - unifi_trace(priv, UDBG5, "leaving unifi_frame_ma_packet_req\n"); -} - -#ifdef CSR_SUPPORT_SME - -#define TRANSMISSION_CONTROL_TRIGGER_MASK 0x0001 -#define TRANSMISSION_CONTROL_EOSP_MASK 0x0002 - -static -int frame_and_send_queued_pdu(unifi_priv_t* priv, tx_buffered_packets_t* buffered_pkt, - CsrWifiRouterCtrlStaInfo_t *staRecord, u8 moreData , u8 eosp) -{ - - CSR_SIGNAL signal; - bulk_data_param_t bulkdata; - int result; - u8 toDs, fromDs, macHeaderLengthInBytes = MAC_HEADER_SIZE; - u8 *qc; - u16 *fc = (u16*)(buffered_pkt->bulkdata.os_data_ptr); - unsigned long lock_flags; - unifi_trace(priv, UDBG3, "frame_and_send_queued_pdu with moreData: %d , EOSP: %d\n", moreData, eosp); - unifi_frame_ma_packet_req(priv, buffered_pkt->priority, buffered_pkt->rate, buffered_pkt->hostTag, - buffered_pkt->interfaceTag, buffered_pkt->transmissionControl, - buffered_pkt->leSenderProcessId, buffered_pkt->peerMacAddress.a, &signal); - bulkdata.d[0].os_data_ptr = buffered_pkt->bulkdata.os_data_ptr; - bulkdata.d[0].data_length = buffered_pkt->bulkdata.data_length; - bulkdata.d[0].os_net_buf_ptr = buffered_pkt->bulkdata.os_net_buf_ptr; - bulkdata.d[0].net_buf_length = buffered_pkt->bulkdata.net_buf_length; - bulkdata.d[1].os_data_ptr = NULL; - bulkdata.d[1].data_length = 0; - bulkdata.d[1].os_net_buf_ptr =0; - bulkdata.d[1].net_buf_length =0; - - if(moreData) { - *fc |= cpu_to_le16(IEEE802_11_FC_MOREDATA_MASK); - } else { - *fc &= cpu_to_le16(~IEEE802_11_FC_MOREDATA_MASK); - } - - if((staRecord != NULL)&& (staRecord->wmmOrQosEnabled == TRUE)) - { - unifi_trace(priv, UDBG3, "frame_and_send_queued_pdu WMM Enabled: %d \n", staRecord->wmmOrQosEnabled); - - toDs = (*fc & cpu_to_le16(IEEE802_11_FC_TO_DS_MASK))?1 : 0; - fromDs = (*fc & cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK))? 1: 0; - - switch(le16_to_cpu(*fc) & IEEE80211_FC_SUBTYPE_MASK) - { - case IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK: - case IEEE802_11_FC_TYPE_QOS_NULL & IEEE80211_FC_SUBTYPE_MASK: - /* If both are set then the Address4 exists (only for AP) */ - if (fromDs && toDs) { - /* 6 is the size of Address4 field */ - macHeaderLengthInBytes += (QOS_CONTROL_HEADER_SIZE + 6); - } else { - macHeaderLengthInBytes += QOS_CONTROL_HEADER_SIZE; - } - - /* If order bit set then HT control field is the part of MAC header */ - if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) { - macHeaderLengthInBytes += HT_CONTROL_HEADER_SIZE; - qc = (u8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-6)); - } else { - qc = (u8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-2)); - } - *qc = eosp ? *qc | (1 << 4) : *qc & (~(1 << 4)); - break; - default: - if (fromDs && toDs) - macHeaderLengthInBytes += 6; - } - - } - result = ul_send_signal_unpacked(priv, &signal, &bulkdata); - if(result){ - _update_buffered_pkt_params_after_alignment(priv, &bulkdata, buffered_pkt); - } - - /* Decrement the packet counts queued in driver */ - if (result != -ENOSPC) { - /* protect entire counter updation by disabling preemption */ - if (!priv->noOfPktQueuedInDriver) { - unifi_error(priv, "packets queued in driver 0 still decrementing\n"); - } else { - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - priv->noOfPktQueuedInDriver--; - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - } - /* Sta Record is available for all unicast (except genericMgt Frames) & in other case its NULL */ - if (staRecord) { - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - if (!staRecord->noOfPktQueued) { - unifi_error(priv, "packets queued in driver per station is 0 still decrementing\n"); - } else { - staRecord->noOfPktQueued--; - } - /* if the STA alive probe frame has failed then reset the saved host tag */ - if (result){ - if (staRecord->nullDataHostTag == buffered_pkt->hostTag){ - staRecord->nullDataHostTag = INVALID_HOST_TAG; - } - } - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - } - - } - return result; -} -#ifdef CSR_SUPPORT_SME -static -void set_eosp_transmit_ctrl(unifi_priv_t *priv, struct list_head *txList) -{ - /* dequeue the tx data packets from the appropriate queue */ - tx_buffered_packets_t *tx_q_item = NULL; - struct list_head *listHead; - struct list_head *placeHolder; - unsigned long lock_flags; - - - unifi_trace(priv, UDBG5, "entering set_eosp_transmit_ctrl\n"); - /* check for list empty */ - if (list_empty(txList)) { - unifi_warning(priv, "In set_eosp_transmit_ctrl, the list is empty\n"); - return; - } - - /* return the last node , and modify it. */ - - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_for_each_prev_safe(listHead, placeHolder, txList) { - tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); - tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_EOSP_MASK; - tx_q_item->transmissionControl = (tx_q_item->transmissionControl & ~(CSR_NO_CONFIRM_REQUIRED)); - unifi_trace(priv, UDBG1, - "set_eosp_transmit_ctrl Transmission Control = 0x%x hostTag = 0x%x \n", tx_q_item->transmissionControl, tx_q_item->hostTag); - unifi_trace(priv, UDBG3, "in set_eosp_transmit_ctrl no.of buffered frames %d\n", priv->noOfPktQueuedInDriver); - break; - } - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - unifi_trace(priv, UDBG1, "List Empty %d\n", list_empty(txList)); - unifi_trace(priv, UDBG5, "leaving set_eosp_transmit_ctrl\n"); - return; -} - -static -void send_vif_availibility_rsp(unifi_priv_t *priv, CSR_VIF_IDENTIFIER vif, CSR_RESULT_CODE resultCode) -{ - CSR_SIGNAL signal; - CSR_MA_VIF_AVAILABILITY_RESPONSE *rsp; - bulk_data_param_t *bulkdata = NULL; - int r; - - unifi_trace(priv, UDBG3, "send_vif_availibility_rsp : invoked with resultCode = %d \n", resultCode); - - memset(&signal, 0, sizeof(CSR_SIGNAL)); - rsp = &signal.u.MaVifAvailabilityResponse; - rsp->VirtualInterfaceIdentifier = vif; - rsp->ResultCode = resultCode; - signal.SignalPrimitiveHeader.SignalId = CSR_MA_VIF_AVAILABILITY_RESPONSE_ID; - signal.SignalPrimitiveHeader.ReceiverProcessId = 0; - signal.SignalPrimitiveHeader.SenderProcessId = priv->netdev_client->sender_id; - - /* Send the signal to UniFi */ - r = ul_send_signal_unpacked(priv, &signal, bulkdata); - if(r) { - unifi_error(priv, "Availibility response sending failed %x status %d\n", vif, r); - } - else { - unifi_trace(priv, UDBG3, "send_vif_availibility_rsp : status = %d \n", r); - } -} -#endif - -static -void verify_and_accomodate_tx_packet(unifi_priv_t *priv) -{ - tx_buffered_packets_t *tx_q_item; - unsigned long lock_flags; - struct list_head *listHead, *list; - struct list_head *placeHolder; - u8 i, j, eospFramedeleted=0; - u8 thresholdExcedeDueToBroadcast = TRUE; - /* it will be made it interface Specific in the future when multi interfaces are supported , - right now interface 0 is considered */ - netInterface_priv_t *interfacePriv = priv->interfacePriv[0]; - CsrWifiRouterCtrlStaInfo_t *staInfo = NULL; - - unifi_trace(priv, UDBG3, "entering verify_and_accomodate_tx_packet\n"); - - for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { - staInfo = interfacePriv->staInfo[i]; - if (staInfo && (staInfo->noOfPktQueued >= CSR_WIFI_DRIVER_MAX_PKT_QUEUING_THRESHOLD_PER_PEER)) { - /* remove the first(oldest) packet from the all the access catogory, since data - * packets for station record crossed the threshold limit (64 for AP supporting - * 8 peers) - */ - unifi_trace(priv, UDBG3, "number of station pkts queued= %d for sta id = %d\n", staInfo->noOfPktQueued, staInfo->aid); - for(j = 0; j < MAX_ACCESS_CATOGORY; j++) { - list = &staInfo->dataPdu[j]; - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_for_each_safe(listHead, placeHolder, list) { - tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); - list_del(listHead); - thresholdExcedeDueToBroadcast = FALSE; - unifi_net_data_free(priv, &tx_q_item->bulkdata); - kfree(tx_q_item); - tx_q_item = NULL; - if (!priv->noOfPktQueuedInDriver) { - unifi_error(priv, "packets queued in driver 0 still decrementing in %s\n", __FUNCTION__); - } else { - /* protection provided by spinlock */ - priv->noOfPktQueuedInDriver--; - - } - /* Sta Record is available for all unicast (except genericMgt Frames) & in other case its NULL */ - if (!staInfo->noOfPktQueued) { - unifi_error(priv, "packets queued in driver per station is 0 still decrementing in %s\n", __FUNCTION__); - } else { - spin_lock(&priv->staRecord_lock); - staInfo->noOfPktQueued--; - spin_unlock(&priv->staRecord_lock); - } - break; - } - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - } - } - } - if (thresholdExcedeDueToBroadcast && interfacePriv->noOfbroadcastPktQueued > CSR_WIFI_DRIVER_MINIMUM_BROADCAST_PKT_THRESHOLD ) { - /* Remove the packets from genericMulticastOrBroadCastFrames queue - * (the max packets in driver is reached due to broadcast/multicast frames) - */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_for_each_safe(listHead, placeHolder, &interfacePriv->genericMulticastOrBroadCastFrames) { - tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); - if(eospFramedeleted){ - tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_EOSP_MASK; - tx_q_item->transmissionControl = (tx_q_item->transmissionControl & ~(CSR_NO_CONFIRM_REQUIRED)); - unifi_trace(priv, UDBG1, "updating eosp for next packet hostTag:= 0x%x ", tx_q_item->hostTag); - eospFramedeleted =0; - break; - } - - if(tx_q_item->transmissionControl & TRANSMISSION_CONTROL_EOSP_MASK ){ - eospFramedeleted = 1; - } - unifi_trace(priv, UDBG1, "freeing of multicast packets ToC = 0x%x hostTag = 0x%x \n", tx_q_item->transmissionControl, tx_q_item->hostTag); - list_del(listHead); - unifi_net_data_free(priv, &tx_q_item->bulkdata); - kfree(tx_q_item); - priv->noOfPktQueuedInDriver--; - spin_lock(&priv->staRecord_lock); - interfacePriv->noOfbroadcastPktQueued--; - spin_unlock(&priv->staRecord_lock); - if(!eospFramedeleted){ - break; - } - } - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - } - unifi_trace(priv, UDBG3, "leaving verify_and_accomodate_tx_packet\n"); -} - -static -CsrResult enque_tx_data_pdu(unifi_priv_t *priv, bulk_data_param_t *bulkdata, - struct list_head *list, CSR_SIGNAL *signal, - u8 requeueOnSamePos) -{ - - /* queue the tx data packets on to appropriate queue */ - CSR_MA_PACKET_REQUEST *req = &signal->u.MaPacketRequest; - tx_buffered_packets_t *tx_q_item; - unsigned long lock_flags; - - unifi_trace(priv, UDBG5, "entering enque_tx_data_pdu\n"); - if(!list) { - unifi_error(priv, "List is not specified\n"); - return CSR_RESULT_FAILURE; - } - - /* Removes aged packets & adds the incoming packet */ - if (priv->noOfPktQueuedInDriver >= CSR_WIFI_DRIVER_SUPPORT_FOR_MAX_PKT_QUEUEING) { - unifi_trace(priv, UDBG3, "number of pkts queued= %d \n", priv->noOfPktQueuedInDriver); - verify_and_accomodate_tx_packet(priv); - } - - - - tx_q_item = kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC); - if (tx_q_item == NULL) { - unifi_error(priv, - "Failed to allocate %d bytes for tx packet record\n", - sizeof(tx_buffered_packets_t)); - return CSR_RESULT_FAILURE; - } - - /* disable the preemption */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - INIT_LIST_HEAD(&tx_q_item->q); - /* fill the tx_q structure members */ - tx_q_item->bulkdata.os_data_ptr = bulkdata->d[0].os_data_ptr; - tx_q_item->bulkdata.data_length = bulkdata->d[0].data_length; - tx_q_item->bulkdata.os_net_buf_ptr = bulkdata->d[0].os_net_buf_ptr; - tx_q_item->bulkdata.net_buf_length = bulkdata->d[0].net_buf_length; - tx_q_item->interfaceTag = req->VirtualInterfaceIdentifier & 0xff; - tx_q_item->hostTag = req->HostTag; - tx_q_item->leSenderProcessId = signal->SignalPrimitiveHeader.SenderProcessId; - tx_q_item->transmissionControl = req->TransmissionControl; - tx_q_item->priority = req->Priority; - tx_q_item->rate = req->TransmitRate; - memcpy(tx_q_item->peerMacAddress.a, req->Ra.x, ETH_ALEN); - - - - if (requeueOnSamePos) { - list_add(&tx_q_item->q, list); - } else { - list_add_tail(&tx_q_item->q, list); - } - - /* Count of packet queued in driver */ - priv->noOfPktQueuedInDriver++; - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - unifi_trace(priv, UDBG5, "leaving enque_tx_data_pdu\n"); - return CSR_RESULT_SUCCESS; -} - -#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL -CsrResult unifi_reque_ma_packet_request (void *ospriv, u32 host_tag, - u16 txStatus, bulk_data_desc_t *bulkDataDesc) -{ - CsrResult status = CSR_RESULT_SUCCESS; - unifi_priv_t *priv = (unifi_priv_t*)ospriv; - netInterface_priv_t *interfacePriv; - struct list_head *list = NULL; - CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; - bulk_data_param_t bulkData; - CSR_SIGNAL signal; - CSR_PRIORITY priority = 0; - u16 interfaceTag = 0; - unifi_TrafficQueue priority_q; - u16 frameControl = 0, frameType = 0; - unsigned long lock_flags; - - interfacePriv = priv->interfacePriv[interfaceTag]; - - /* If the current mode is not AP or P2PGO then just return failure - * to clear the hip slot - */ - if(!((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP) || - (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO))) { - return CSR_RESULT_FAILURE; - } - - unifi_trace(priv, UDBG6, "unifi_reque_ma_packet_request: host_tag = 0x%x\n", host_tag); - - staRecord = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, - (((u8 *) bulkDataDesc->os_data_ptr) + 4), - interfaceTag); - if (NULL == staRecord) { - unifi_trace(priv, UDBG5, "unifi_reque_ma_packet_request: Invalid STA record \n"); - return CSR_RESULT_FAILURE; - } - - /* Update TIM if MA-PACKET.cfm fails with status as Tx-retry-limit or No-BSS and then just return failure - * to clear the hip slot associated with the Packet - */ - if (CSR_TX_RETRY_LIMIT == txStatus || CSR_TX_NO_BSS == txStatus) { - if (staRecord->timSet == CSR_WIFI_TIM_RESET || staRecord->timSet == CSR_WIFI_TIM_RESETTING) - { - unifi_trace(priv, UDBG2, "unifi_reque_ma_packet_request: CFM failed with Retry Limit or No BSS-->update TIM\n"); - if (!staRecord->timRequestPendingFlag) { - update_tim(priv, staRecord->aid, 1, interfaceTag, staRecord->assignedHandle); - } - else { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - staRecord->updateTimReqQueued = 1; - unifi_trace(priv, UDBG6, "unifi_reque_ma_packet_request: One more UpdateTim Request(:%d)Queued for AID %x\n", - staRecord->updateTimReqQueued, staRecord->aid); - } - } - return CSR_RESULT_FAILURE; - } - else if ((CSR_TX_LIFETIME == txStatus) || (CSR_TX_BLOCK_ACK_TIMEOUT == txStatus) || - (CSR_TX_FAIL_TRANSMISSION_VIF_INTERRUPTED == txStatus) || - (CSR_TX_REJECTED_PEER_STATION_SLEEPING == txStatus) || - (CSR_TX_REJECTED_DTIM_STARTED == txStatus)) { - /* Extract the Frame control and the frame type */ - frameControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(bulkDataDesc->os_data_ptr); - frameType = ((frameControl & IEEE80211_FC_TYPE_MASK) >> FRAME_CONTROL_TYPE_FIELD_OFFSET); - - /* Mgmt frames will not be re-queued for Tx - * so just return failure to clear the hip slot - */ - if (IEEE802_11_FRAMETYPE_MANAGEMENT == frameType) { - return CSR_RESULT_FAILURE; - } - else if (IEEE802_11_FRAMETYPE_DATA == frameType) { - /* QOS NULL and DATA NULL frames will not be re-queued for Tx - * so just return failure to clear the hip slot - */ - if ((((frameControl & IEEE80211_FC_SUBTYPE_MASK) >> FRAME_CONTROL_SUBTYPE_FIELD_OFFSET) == QOS_DATA_NULL) || - (((frameControl & IEEE80211_FC_SUBTYPE_MASK) >> FRAME_CONTROL_SUBTYPE_FIELD_OFFSET)== DATA_NULL )) { - return CSR_RESULT_FAILURE; - } - } - - /* Extract the Packet priority */ - if (TRUE == staRecord->wmmOrQosEnabled) { - u16 qosControl = 0; - u8 dataFrameType = 0; - - dataFrameType =((frameControl & IEEE80211_FC_SUBTYPE_MASK) >> 4); - - if (dataFrameType == QOS_DATA) { - /* QoS control field is offset from frame control by 2 (frame control) - * + 2 (duration/ID) + 2 (sequence control) + 3*ETH_ALEN or 4*ETH_ALEN - */ - if((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK)) { - qosControl= CSR_GET_UINT16_FROM_LITTLE_ENDIAN(bulkDataDesc->os_data_ptr + 30); - } - else { - qosControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(bulkDataDesc->os_data_ptr + 24); - } - } - - priority = (CSR_PRIORITY)(qosControl & IEEE802_11_QC_TID_MASK); - - if (priority < CSR_QOS_UP0 || priority > CSR_QOS_UP7) { - unifi_trace(priv, UDBG5, "unifi_reque_ma_packet_request: Invalid priority:%x \n", priority); - return CSR_RESULT_FAILURE; - } - } - else { - priority = CSR_CONTENTION; - } - - /* Frame Bulk data to requeue it back to HAL Queues */ - bulkData.d[0].os_data_ptr = bulkDataDesc->os_data_ptr; - bulkData.d[0].data_length = bulkDataDesc->data_length; - bulkData.d[0].os_net_buf_ptr = bulkDataDesc->os_net_buf_ptr; - bulkData.d[0].net_buf_length = bulkDataDesc->net_buf_length; - - bulkData.d[1].os_data_ptr = NULL; - bulkData.d[1].os_net_buf_ptr = NULL; - bulkData.d[1].data_length = bulkData.d[1].net_buf_length = 0; - - /* Initialize signal to zero */ - memset(&signal, 0, sizeof(CSR_SIGNAL)); - - /* Frame MA Packet Req */ - unifi_frame_ma_packet_req(priv, priority, 0, host_tag, - interfaceTag, CSR_NO_CONFIRM_REQUIRED, - priv->netdev_client->sender_id, - staRecord->peerMacAddress.a, &signal); - - /* Find the Q-Priority */ - priority_q = unifi_frame_priority_to_queue(priority); - list = &staRecord->dataPdu[priority_q]; - - /* Place the Packet on to HAL Queue */ - status = enque_tx_data_pdu(priv, &bulkData, list, &signal, TRUE); - - /* Update the Per-station queued packet counter */ - if (!status) { - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - staRecord->noOfPktQueued++; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - } - } - else { - /* Packet will not be re-queued for any of the other MA Packet Tx failure - * reasons so just return failure to clear the hip slot - */ - return CSR_RESULT_FAILURE; - } - - return status; -} -#endif - -static void is_all_ac_deliver_enabled_and_moredata(CsrWifiRouterCtrlStaInfo_t *staRecord, u8 *allDeliveryEnabled, u8 *dataAvailable) -{ - u8 i; - *allDeliveryEnabled = TRUE; - for (i = 0 ;i < MAX_ACCESS_CATOGORY; i++) { - if (!IS_DELIVERY_ENABLED(staRecord->powersaveMode[i])) { - /* One is is not Delivery Enabled */ - *allDeliveryEnabled = FALSE; - break; - } - } - if (*allDeliveryEnabled) { - *dataAvailable = (!list_empty(&staRecord->dataPdu[0]) || !list_empty(&staRecord->dataPdu[1]) - ||!list_empty(&staRecord->dataPdu[2]) ||!list_empty(&staRecord->dataPdu[3]) - ||!list_empty(&staRecord->mgtFrames)); - } -} - -/* - * --------------------------------------------------------------------------- - * uf_handle_tim_cfm - * - * - * This function updates tim status in host depending confirm status from firmware - * - * Arguments: - * priv Pointer to device private context struct - * cfm CSR_MLME_SET_TIM_CONFIRM - * receiverProcessId SenderProcessID to fetch handle & timSet status - * - * --------------------------------------------------------------------------- - */ -void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, u16 receiverProcessId) -{ - u8 handle = CSR_WIFI_GET_STATION_HANDLE_FROM_RECEIVER_ID(receiverProcessId); - u8 timSetStatus = CSR_WIFI_GET_TIMSET_STATE_FROM_RECEIVER_ID(receiverProcessId); - u16 interfaceTag = (cfm->VirtualInterfaceIdentifier & 0xff); - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; - /* This variable holds what TIM value we wanted to set in firmware */ - u16 timSetValue = 0; - /* Irrespective of interface the count maintained */ - static u8 retryCount = 0; - unsigned long lock_flags; - unifi_trace(priv, UDBG3, "entering %s, handle = %x, timSetStatus = %x\n", __FUNCTION__, handle, timSetStatus); - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_warning(priv, "bad interfaceTag = %x\n", interfaceTag); - return; - } - - if ((handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) && (handle >= UNIFI_MAX_CONNECTIONS)) { - unifi_warning(priv, "bad station Handle = %x\n", handle); - return; - } - - if (handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) { - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - if ((staRecord = ((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[handle]))) == NULL) { - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - unifi_warning(priv, "uf_handle_tim_cfm: station record is NULL handle = %x\n", handle); - return; - } - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - } - switch(timSetStatus) - { - case CSR_WIFI_TIM_SETTING: - timSetValue = CSR_WIFI_TIM_SET; - break; - case CSR_WIFI_TIM_RESETTING: - timSetValue = CSR_WIFI_TIM_RESET; - break; - default: - unifi_warning(priv, "timSet state is %x: Debug\n", timSetStatus); - return; - } - - /* check TIM confirm for success/failures */ - switch(cfm->ResultCode) - { - case CSR_RC_SUCCESS: - if (handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) { - /* Unicast frame & station record available */ - if (timSetStatus == staRecord->timSet) { - staRecord->timSet = timSetValue; - /* fh_cmd_q can also be full at some point of time!, - * resetting count as queue is cleaned by firmware at this point - */ - retryCount = 0; - unifi_trace(priv, UDBG2, "tim (%s) successfully in firmware\n", (timSetValue)?"SET":"RESET"); - } else { - unifi_trace(priv, UDBG3, "receiver processID = %x, success: request & confirm states are not matching in TIM cfm: Debug status = %x, staRecord->timSet = %x, handle = %x\n", - receiverProcessId, timSetStatus, staRecord->timSet, handle); - } - - /* Reset TIM pending flag to send next TIM request */ - staRecord->timRequestPendingFlag = FALSE; - - /* Make sure that one more UpdateTim request is queued, if Queued its value - * should be CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET - */ - if (0xFF != staRecord->updateTimReqQueued) - { - /* Process the UpdateTim Request which is queued while previous UpdateTim was in progress */ - if (staRecord->timSet != staRecord->updateTimReqQueued) - { - unifi_trace(priv, UDBG2, "uf_handle_tim_cfm : Processing Queued UpdateTimReq \n"); - - update_tim(priv, staRecord->aid, staRecord->updateTimReqQueued, interfaceTag, handle); - - staRecord->updateTimReqQueued = 0xFF; - } - } - } else { - - interfacePriv->bcTimSet = timSetValue; - /* fh_cmd_q can also be full at some point of time!, - * resetting count as queue is cleaned by firmware at this point - */ - retryCount = 0; - unifi_trace(priv, UDBG3, "tim (%s) successfully for broadcast frame in firmware\n", (timSetValue)?"SET":"RESET"); - - /* Reset DTIM pending flag to send next DTIM request */ - interfacePriv->bcTimSetReqPendingFlag = FALSE; - - /* Make sure that one more UpdateDTim request is queued, if Queued its value - * should be CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET - */ - if (0xFF != interfacePriv->bcTimSetReqQueued) - { - /* Process the UpdateTim Request which is queued while previous UpdateTim was in progress */ - if (interfacePriv->bcTimSet != interfacePriv->bcTimSetReqQueued) - { - unifi_trace(priv, UDBG2, "uf_handle_tim_cfm : Processing Queued UpdateDTimReq \n"); - - update_tim(priv, 0, interfacePriv->bcTimSetReqQueued, interfaceTag, 0xFFFFFFFF); - - interfacePriv->bcTimSetReqQueued = 0xFF; - } - } - - } - break; - case CSR_RC_INVALID_PARAMETERS: - case CSR_RC_INSUFFICIENT_RESOURCE: - /* check for max retry limit & send again - * MAX_RETRY_LIMIT is not maintained for each set of transactions..Its generic - * If failure crosses this Limit, we have to take a call to FIX - */ - if (retryCount > UNIFI_MAX_RETRY_LIMIT) { - u8 moreData = FALSE; - retryCount = 0; - /* Because of continuos traffic in fh_cmd_q the tim set request is failing (exceeding retry limit) - * but if we didn't synchronize our timSet varible state with firmware then it can cause below issues - * cond 1. We want to SET tim in firmware if its fails & max retry limit reached - * -> If host set's the timSet to 1, we wont try to send(as max retry reached) update tim but - * firmware is not updated with queue(TIM) status so it wont set TIM in beacon finally host start piling - * up data & wont try to set tim in firmware (This can cause worser performance) - * cond 2. We want to reset tim in firmware it fails & reaches max retry limit - * -> If host sets the timSet to Zero, it wont try to set a TIM request unless we wont have any packets - * to be queued, so beacon unnecessarily advertizes the TIM - */ - - if(staRecord) { - if(!staRecord->wmmOrQosEnabled) { - moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) || - !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]) || - !list_empty(&staRecord->mgtFrames)); - } else { - /* Peer is QSTA */ - u8 allDeliveryEnabled = 0, dataAvailable = 0; - /* Check if all AC's are Delivery Enabled */ - is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); - /*check for more data in non-delivery enabled queues*/ - moreData = (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable)); - - } - /* To avoid cond 1 & 2, check internal Queues status, if we have more Data then set RESET the timSet(0), - * so we are trying to be in sync with firmware & next packets before queuing atleast try to - * set TIM in firmware otherwise it SET timSet(1) - */ - if (moreData) { - staRecord->timSet = CSR_WIFI_TIM_RESET; - } else { - staRecord->timSet = CSR_WIFI_TIM_SET; - } - } else { - /* Its a broadcast frames */ - moreData = (!list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) || - !list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)); - if (moreData) { - update_tim(priv, 0, CSR_WIFI_TIM_SET, interfaceTag, 0xFFFFFFFF); - } else { - update_tim(priv, 0, CSR_WIFI_TIM_RESET, interfaceTag, 0xFFFFFFFF); - } - } - - unifi_error(priv, "no of error's for TIM setting crossed the Limit: verify\n"); - return; - } - retryCount++; - - if (handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) { - if (timSetStatus == staRecord->timSet) { - unifi_warning(priv, "tim request failed, retry for AID = %x\n", staRecord->aid); - update_tim(priv, staRecord->aid, timSetValue, interfaceTag, handle); - } else { - unifi_trace(priv, UDBG1, "failure: request & confirm states are not matching in TIM cfm: Debug status = %x, staRecord->timSet = %x\n", - timSetStatus, staRecord->timSet); - } - } else { - unifi_warning(priv, "tim request failed, retry for broadcast frames\n"); - update_tim(priv, 0, timSetValue, interfaceTag, 0xFFFFFFFF); - } - break; - default: - unifi_warning(priv, "tim update request failed resultcode = %x\n", cfm->ResultCode); - } - - unifi_trace(priv, UDBG2, "leaving %s\n", __FUNCTION__); -} - -/* - * --------------------------------------------------------------------------- - * update_tim - * - * - * This function updates tim status in firmware for AID[1 to UNIFI_MAX_CONNECTIONS] or - * AID[0] for broadcast/multicast packets. - * - * NOTE: The LSB (least significant BYTE) of senderId while sending this MLME premitive - * has been modified(utilized) as below - * - * SenderID in signal's SignalPrimitiveHeader is 2 byte the lowe byte bitmap is below - * - * station handle(6 bits) timSet Status (2 bits) - * --------------------- ---------------------- - * 0 0 0 0 0 0 | 0 0 - * - * timSet Status can be one of below: - * - * CSR_WIFI_TIM_RESET - * CSR_WIFI_TIM_RESETTING - * CSR_WIFI_TIM_SET - * CSR_WIFI_TIM_SETTING - * - * Arguments: - * priv Pointer to device private context struct - * aid can be 1 t0 UNIFI_MAX_CONNECTIONS & 0 means multicast/broadcast - * setTim value SET(1) / RESET(0) - * interfaceTag the interfaceID on which activity going on - * handle from (0 <= handle < UNIFI_MAX_CONNECTIONS) - * - * --------------------------------------------------------------------------- - */ -void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, u32 handle) -{ - CSR_SIGNAL signal; - s32 r; - CSR_MLME_SET_TIM_REQUEST *req = &signal.u.MlmeSetTimRequest; - bulk_data_param_t *bulkdata = NULL; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - u8 senderIdLsb = 0; - CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; - u32 oldTimSetStatus = 0, timSetStatus = 0; - - unifi_trace(priv, UDBG5, "entering the update_tim routine\n"); - - - if (handle == 0xFFFFFFFF) { - handle &= CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE; - if (setTim == interfacePriv->bcTimSet) - { - unifi_trace(priv, UDBG3, "update_tim, Drop:Hdl=%x, timval=%d, globalTim=%d\n", handle, setTim, interfacePriv->bcTimSet); - return; - } - } else if ((handle != 0xFFFFFFFF) && (handle >= UNIFI_MAX_CONNECTIONS)) { - unifi_warning(priv, "bad station Handle = %x\n", handle); - return; - } - - if (setTim) { - timSetStatus = CSR_WIFI_TIM_SETTING; - } else { - timSetStatus = CSR_WIFI_TIM_RESETTING; - } - - if (handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) { - if ((staRecord = ((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[handle]))) == NULL) { - unifi_warning(priv, "station record is NULL in update_tim: handle = %x :debug\n", handle); - return; - } - /* In case of signal sending failed, revert back to old state */ - oldTimSetStatus = staRecord->timSet; - staRecord->timSet = timSetStatus; - } - - /* pack senderID LSB */ - senderIdLsb = CSR_WIFI_PACK_SENDER_ID_LSB_FOR_TIM_REQ(handle, timSetStatus); - - /* initialize signal to zero */ - memset(&signal, 0, sizeof(CSR_SIGNAL)); - - /* Frame the MLME-SET-TIM request */ - signal.SignalPrimitiveHeader.SignalId = CSR_MLME_SET_TIM_REQUEST_ID; - signal.SignalPrimitiveHeader.ReceiverProcessId = 0; - CSR_COPY_UINT16_TO_LITTLE_ENDIAN(((priv->netdev_client->sender_id & 0xff00) | senderIdLsb), - (u8*)&signal.SignalPrimitiveHeader.SenderProcessId); - - /* set The virtual interfaceIdentifier, aid, tim value */ - req->VirtualInterfaceIdentifier = uf_get_vif_identifier(interfacePriv->interfaceMode, interfaceTag); - req->AssociationId = aid; - req->TimValue = setTim; - - - unifi_trace(priv, UDBG2, "update_tim:AID %x,senderIdLsb = 0x%x, handle = 0x%x, timSetStatus = %x, sender proceesID = %x \n", - aid, senderIdLsb, handle, timSetStatus, signal.SignalPrimitiveHeader.SenderProcessId); - - /* Send the signal to UniFi */ - r = ul_send_signal_unpacked(priv, &signal, bulkdata); - if (r) { - /* No need to free bulk data, as TIM request doesn't carries any data */ - unifi_error(priv, "Error queueing CSR_MLME_SET_TIM_REQUEST signal\n"); - if (staRecord) { - staRecord->timSet = oldTimSetStatus ; - } - else - { - /* MLME_SET_TIM.req sending failed here for AID0, so revert back our bcTimSet status */ - interfacePriv->bcTimSet = !setTim; - } - } - else { - /* Update tim request pending flag and ensure no more TIM set requests are send - for the same station until TIM confirm is received */ - if (staRecord) { - staRecord->timRequestPendingFlag = TRUE; - } - else - { - /* Update tim request (for AID 0) pending flag and ensure no more DTIM set requests are send - * for the same station until TIM confirm is received - */ - interfacePriv->bcTimSetReqPendingFlag = TRUE; - } - } - unifi_trace(priv, UDBG5, "leaving the update_tim routine\n"); -} - -static -void process_peer_active_transition(unifi_priv_t * priv, - CsrWifiRouterCtrlStaInfo_t *staRecord, - u16 interfaceTag) -{ - int r, i; - u8 spaceAvail[4] = {TRUE, TRUE, TRUE, TRUE}; - tx_buffered_packets_t * buffered_pkt = NULL; - unsigned long lock_flags; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - - unifi_trace(priv, UDBG5, "entering process_peer_active_transition\n"); - - if(IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag)) { - /* giving more priority to multicast packets so delaying unicast packets*/ - unifi_trace(priv, UDBG2, "Multicast transmission is going on so resume unicast transmission after DTIM over\n"); - - /* As station is active now, even though AP is not able to send frames to it - * because of DTIM, it needs to reset the TIM here - */ - if (!staRecord->timRequestPendingFlag){ - if((staRecord->timSet == CSR_WIFI_TIM_SET) || (staRecord->timSet == CSR_WIFI_TIM_SETTING)){ - update_tim(priv, staRecord->aid, 0, interfaceTag, staRecord->assignedHandle); - } - } - else - { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - staRecord->updateTimReqQueued = 0; - unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, - staRecord->aid); - } - return; - } - while((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->mgtFrames))) { - buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK); - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, 0, FALSE)) == -ENOSPC) { - unifi_trace(priv, UDBG2, "p_p_a_t:(ENOSPC) Mgt Frame queueing \n"); - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, &staRecord->mgtFrames); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - priv->pausedStaHandle[3]=(u8)(staRecord->assignedHandle); - spaceAvail[3] = FALSE; - break; - } else { - if(r){ - unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - } - } - if (!staRecord->timRequestPendingFlag) { - if (staRecord->txSuspend) { - if(staRecord->timSet == CSR_WIFI_TIM_SET) { - update_tim(priv, staRecord->aid, 0, interfaceTag, staRecord->assignedHandle); - } - return; - } - } - else - { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - staRecord->updateTimReqQueued = 0; - unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, - staRecord->aid); - } - for(i=3;i>=0;i--) { - if(!spaceAvail[i]) - continue; - unifi_trace(priv, UDBG6, "p_p_a_t:data pkt sending for AC %d \n", i); - while((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[i]))) { - buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK); - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, 0, FALSE)) == -ENOSPC) { - /* Clear the trigger bit transmission control*/ - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, &staRecord->dataPdu[i]); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - priv->pausedStaHandle[i]=(u8)(staRecord->assignedHandle); - break; - } else { - if(r){ - unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - } - } - } - if (!staRecord->timRequestPendingFlag){ - if((staRecord->timSet == CSR_WIFI_TIM_SET) || (staRecord->timSet == CSR_WIFI_TIM_SETTING)) { - unifi_trace(priv, UDBG3, "p_p_a_t:resetting tim .....\n"); - update_tim(priv, staRecord->aid, 0, interfaceTag, staRecord->assignedHandle); - } - } - else - { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - staRecord->updateTimReqQueued = 0; - unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, - staRecord->aid); - } - unifi_trace(priv, UDBG5, "leaving process_peer_active_transition\n"); -} - - - -void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv, u16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm) -{ - netInterface_priv_t *interfacePriv; - u8 i; - CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; - interfacePriv = priv->interfacePriv[interfaceTag]; - - - if(pkt_cfm->HostTag == interfacePriv->multicastPduHostTag) { - unifi_trace(priv, UDBG2, "CFM for marked Multicast Tag = %x\n", interfacePriv->multicastPduHostTag); - interfacePriv->multicastPduHostTag = 0xffffffff; - resume_suspended_uapsd(priv, interfaceTag); - resume_unicast_buffered_frames(priv, interfaceTag); - if(list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) && - list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)) { - unifi_trace(priv, UDBG1, "Resetting multicastTIM"); - if (!interfacePriv->bcTimSetReqPendingFlag) - { - update_tim(priv, 0, CSR_WIFI_TIM_RESET, interfaceTag, 0xFFFFFFFF); - } - else - { - /* Cache the DTimSet value so that it will processed immidiatly after - * completing the current setDTim Request - */ - interfacePriv->bcTimSetReqQueued = CSR_WIFI_TIM_RESET; - unifi_trace(priv, UDBG2, "uf_process_ma_pkt_cfm_for_ap : One more UpdateDTim Request(%d) Queued \n", - interfacePriv->bcTimSetReqQueued); - } - - } - return; - } - - /* Check if it is a Confirm for null data frame used - * for probing station activity - */ - for(i =0; i < UNIFI_MAX_CONNECTIONS; i++) { - staRecord = (CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i]); - if (staRecord && (staRecord->nullDataHostTag == pkt_cfm->HostTag)) { - - unifi_trace(priv, UDBG1, "CFM for Inactive probe Null frame (tag = %x, status = %d)\n", - pkt_cfm->HostTag, - pkt_cfm->TransmissionStatus - ); - staRecord->nullDataHostTag = INVALID_HOST_TAG; - - if(pkt_cfm->TransmissionStatus == CSR_TX_RETRY_LIMIT){ - u32 now; - u32 inactive_time; - - unifi_trace(priv, UDBG1, "Nulldata to probe STA ALIVE Failed with retry limit\n"); - /* Recheck if there is some activity after null data is sent. - * - * If still there is no activity then send a disconnected indication - * to SME to delete the station record. - */ - if (staRecord->activity_flag){ - return; - } - now = CsrTimeGet(NULL); - - if (staRecord->lastActivity > now) - { - /* simple timer wrap (for 1 wrap) */ - inactive_time = CsrTimeAdd((u32)CsrTimeSub(CSR_SCHED_TIME_MAX, staRecord->lastActivity), - now); - } - else - { - inactive_time = (u32)CsrTimeSub(now, staRecord->lastActivity); - } - - if (inactive_time >= STA_INACTIVE_TIMEOUT_VAL) - { - struct list_head send_cfm_list; - u8 j; - - /* The SME/NME may be waiting for confirmation for requested frames to this station. - * Though this is --VERY UNLIKELY-- in case of station in active mode. But still as a - * a defensive check, it loops through buffered frames for this station and if confirmation - * is requested, send auto confirmation with failure status. Also flush the frames so - * that these are not processed again in PEER_DEL_REQ handler. - */ - INIT_LIST_HEAD(&send_cfm_list); - - uf_prepare_send_cfm_list_for_queued_pkts(priv, - &send_cfm_list, - &(staRecord->mgtFrames)); - - uf_flush_list(priv, &(staRecord->mgtFrames)); - - for(j = 0; j < MAX_ACCESS_CATOGORY; j++){ - uf_prepare_send_cfm_list_for_queued_pkts(priv, - &send_cfm_list, - &(staRecord->dataPdu[j])); - - uf_flush_list(priv, &(staRecord->dataPdu[j])); - } - - send_auto_ma_packet_confirm(priv, staRecord->interfacePriv, &send_cfm_list); - - - - unifi_warning(priv, "uf_process_ma_pkt_cfm_for_ap: Router Disconnected IND Peer (%x-%x-%x-%x-%x-%x)\n", - staRecord->peerMacAddress.a[0], - staRecord->peerMacAddress.a[1], - staRecord->peerMacAddress.a[2], - staRecord->peerMacAddress.a[3], - staRecord->peerMacAddress.a[4], - staRecord->peerMacAddress.a[5]); - - CsrWifiRouterCtrlConnectedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, - 0, - staRecord->interfacePriv->InterfaceTag, - staRecord->peerMacAddress, - CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED); - } - - } - else if (pkt_cfm->TransmissionStatus == CSR_TX_SUCCESSFUL) - { - staRecord->activity_flag = TRUE; - } - } - } -} - -#endif -u16 uf_get_vif_identifier (CsrWifiRouterCtrlMode mode, u16 tag) -{ - switch(mode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_STA: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: - return (0x02<<8|tag); - - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - return (0x03<<8|tag); - - case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: - return (0x01<<8|tag); - - case CSR_WIFI_ROUTER_CTRL_MODE_MONITOR: - return (0x04<<8|tag); - case CSR_WIFI_ROUTER_CTRL_MODE_AMP: - return (0x05<<8|tag); - default: - return tag; - } -} - -#ifdef CSR_SUPPORT_SME - -/* - * --------------------------------------------------------------------------- - * update_macheader - * - * - * These functions updates mac header for intra BSS packet - * routing. - * NOTE: This function always has to be called in rx context which - * is in bh thread context since GFP_KERNEL is used. In soft IRQ/ Interrupt - * context shouldn't be used - * - * Arguments: - * priv Pointer to device private context struct - * skb Socket buffer containing data packet to transmit - * newSkb Socket buffer containing data packet + Mac header if no sufficient headroom in skb - * priority to append QOS control header in Mac header - * bulkdata if newSkb allocated then bulkdata updated to send to unifi - * interfaceTag the interfaceID on which activity going on - * macHeaderLengthInBytes no. of bytes of mac header in received frame - * qosDestination used to append Qos control field - * - * Returns: - * Zero on success or -1 on error. - * --------------------------------------------------------------------------- - */ - -static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb, - struct sk_buff *newSkb, CSR_PRIORITY *priority, - bulk_data_param_t *bulkdata, u16 interfaceTag, - u8 macHeaderLengthInBytes, - u8 qosDestination) -{ - - u16 *fc = NULL; - u8 direction = 0, toDs, fromDs; - u8 *bufPtr = NULL; - u8 sa[ETH_ALEN], da[ETH_ALEN]; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - int headroom; - u8 macHeaderBuf[IEEE802_11_DATA_FRAME_MAC_HEADER_SIZE] = {0}; - - unifi_trace(priv, UDBG5, "entering the update_macheader function\n"); - - /* temporary buffer for the Mac header storage */ - memcpy(macHeaderBuf, skb->data, macHeaderLengthInBytes); - - /* remove the Macheader from the skb */ - skb_pull(skb, macHeaderLengthInBytes); - - /* get the skb headroom for skb_push check */ - headroom = skb_headroom(skb); - - /* pointer to frame control field */ - fc = (u16*) macHeaderBuf; - - toDs = (*fc & cpu_to_le16(IEEE802_11_FC_TO_DS_MASK))?1 : 0; - fromDs = (*fc & cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK))? 1: 0; - unifi_trace(priv, UDBG5, "In update_macheader function, fromDs = %x, toDs = %x\n", fromDs, toDs); - direction = ((fromDs | (toDs << 1)) & 0x3); - - /* Address1 or 3 from the macheader */ - memcpy(da, macHeaderBuf+4+toDs*12, ETH_ALEN); - /* Address2, 3 or 4 from the mac header */ - memcpy(sa, macHeaderBuf+10+fromDs*(6+toDs*8), ETH_ALEN); - - unifi_trace(priv, UDBG3, "update_macheader:direction = %x\n", direction); - /* update the toDs, fromDs & address fields in Mac header */ - switch(direction) - { - case 2: - /* toDs = 1 & fromDs = 0 , toAp when frames received from peer - * while sending this packet to Destination the Mac header changed - * as fromDs = 1 & toDs = 0, fromAp - */ - *fc &= cpu_to_le16(~IEEE802_11_FC_TO_DS_MASK); - *fc |= cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK); - /* Address1: MAC address of the actual destination (4 = 2+2) */ - memcpy(macHeaderBuf + 4, da, ETH_ALEN); - /* Address2: The MAC address of the AP (10 = 2+2+6) */ - memcpy(macHeaderBuf + 10, &interfacePriv->bssid, ETH_ALEN); - /* Address3: MAC address of the actual source from mac header (16 = 2+2+6+6) */ - memcpy(macHeaderBuf + 16, sa, ETH_ALEN); - break; - case 3: - unifi_trace(priv, UDBG3, "when both the toDs & fromDS set, NOT SUPPORTED\n"); - break; - default: - unifi_trace(priv, UDBG3, "problem in decoding packet in update_macheader \n"); - return -1; - } - - /* frameType is Data always, Validation is done before calling this function */ - - /* check for the souce station type */ - switch(le16_to_cpu(*fc) & IEEE80211_FC_SUBTYPE_MASK) - { - case IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK: - /* No need to modify the qos control field */ - if (!qosDestination) { - - /* If source Sta is QOS enabled & if this bit set, then HTC is supported by - * peer station & htc field present in macHeader - */ - if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) { - /* HT control field present in Mac header - * 6 = sizeof(qosControl) + sizeof(htc) - */ - macHeaderLengthInBytes -= 6; - } else { - macHeaderLengthInBytes -= 2; - } - /* Destination STA is non qos so change subtype to DATA */ - *fc &= cpu_to_le16(~IEEE80211_FC_SUBTYPE_MASK); - *fc |= cpu_to_le16(IEEE802_11_FC_TYPE_DATA); - /* remove the qos control field & HTC(if present). new macHeaderLengthInBytes is less than old - * macHeaderLengthInBytes so no need to verify skb headroom - */ - if (headroom < macHeaderLengthInBytes) { - unifi_trace(priv, UDBG1, " sufficient headroom not there to push updated mac header \n"); - return -1; - } - bufPtr = (u8 *) skb_push(skb, macHeaderLengthInBytes); - - /* update bulk data os_data_ptr */ - bulkdata->d[0].os_data_ptr = skb->data; - bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb; - bulkdata->d[0].data_length = skb->len; - - } else { - /* pointing to QOS control field */ - u8 qc; - if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) { - qc = *((u8*)(macHeaderBuf + (macHeaderLengthInBytes - 4 - 2))); - } else { - qc = *((u8*)(macHeaderBuf + (macHeaderLengthInBytes - 2))); - } - - if ((qc & IEEE802_11_QC_TID_MASK) > 7) { - *priority = 7; - } else { - *priority = qc & IEEE802_11_QC_TID_MASK; - } - - unifi_trace(priv, UDBG1, "Incoming packet priority from QSTA is %x\n", *priority); - - if (headroom < macHeaderLengthInBytes) { - unifi_trace(priv, UDBG3, " sufficient headroom not there to push updated mac header \n"); - return -1; - } - bufPtr = (u8 *) skb_push(skb, macHeaderLengthInBytes); - } - break; - default: - { - bulk_data_param_t data_ptrs; - CsrResult csrResult; - unifi_trace(priv, UDBG5, "normal Data packet, NO QOS \n"); - - if (qosDestination) { - u8 qc = 0; - unifi_trace(priv, UDBG3, "destination is QOS station \n"); - - /* Set Ma-Packet.req UP to UP0 */ - *priority = CSR_QOS_UP0; - - /* prepare the qos control field */ - qc |= CSR_QOS_UP0; - /* no Amsdu is in ap buffer so eosp is left 0 */ - if (da[0] & 0x1) { - /* multicast/broadcast frames, no acknowledgement needed */ - qc |= 1 << 5; - } - - /* update new Mac header Length with 2 = sizeof(qos control) */ - macHeaderLengthInBytes += 2; - - /* received DATA frame but destiantion is QOS station so update subtype to QOS*/ - *fc &= cpu_to_le16(~IEEE80211_FC_SUBTYPE_MASK); - *fc |= cpu_to_le16(IEEE802_11_FC_TYPE_QOS_DATA); - - /* appendQosControlOffset = macHeaderLengthInBytes - 2, since source sta is not QOS */ - macHeaderBuf[macHeaderLengthInBytes - 2] = qc; - /* txopLimit is 0 */ - macHeaderBuf[macHeaderLengthInBytes - 1] = 0; - if (headroom < macHeaderLengthInBytes) { - csrResult = unifi_net_data_malloc(priv, &data_ptrs.d[0], skb->len + macHeaderLengthInBytes); - - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, " failed to allocate request_data. in update_macheader func\n"); - return -1; - } - newSkb = (struct sk_buff *)(data_ptrs.d[0].os_net_buf_ptr); - newSkb->len = skb->len + macHeaderLengthInBytes; - - memcpy((void*)data_ptrs.d[0].os_data_ptr + macHeaderLengthInBytes, - skb->data, skb->len); - - bulkdata->d[0].os_data_ptr = newSkb->data; - bulkdata->d[0].os_net_buf_ptr = (unsigned char*)newSkb; - bulkdata->d[0].data_length = newSkb->len; - - bufPtr = (u8*)data_ptrs.d[0].os_data_ptr; - - /* The old skb will not be used again */ - kfree_skb(skb); - } else { - /* skb headroom is sufficient to append Macheader */ - bufPtr = (u8*)skb_push(skb, macHeaderLengthInBytes); - bulkdata->d[0].os_data_ptr = skb->data; - bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb; - bulkdata->d[0].data_length = skb->len; - } - } else { - unifi_trace(priv, UDBG3, "destination is not a QSTA\n"); - if (headroom < macHeaderLengthInBytes) { - csrResult = unifi_net_data_malloc(priv, &data_ptrs.d[0], skb->len + macHeaderLengthInBytes); - - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, " failed to allocate request_data. in update_macheader func\n"); - return -1; - } - newSkb = (struct sk_buff *)(data_ptrs.d[0].os_net_buf_ptr); - newSkb->len = skb->len + macHeaderLengthInBytes; - - memcpy((void*)data_ptrs.d[0].os_data_ptr + macHeaderLengthInBytes, - skb->data, skb->len); - - bulkdata->d[0].os_data_ptr = newSkb->data; - bulkdata->d[0].os_net_buf_ptr = (unsigned char*)newSkb; - bulkdata->d[0].data_length = newSkb->len; - - bufPtr = (u8*)data_ptrs.d[0].os_data_ptr; - - /* The old skb will not be used again */ - kfree_skb(skb); - } else { - /* skb headroom is sufficient to append Macheader */ - bufPtr = (u8*)skb_push(skb, macHeaderLengthInBytes); - bulkdata->d[0].os_data_ptr = skb->data; - bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb; - bulkdata->d[0].data_length = skb->len; - } - } - } - } - - /* prepare the complete skb, by pushing the MAC header to the beginning of the skb->data */ - unifi_trace(priv, UDBG5, "updated Mac Header: %d \n", macHeaderLengthInBytes); - memcpy(bufPtr, macHeaderBuf, macHeaderLengthInBytes); - - unifi_trace(priv, UDBG5, "leaving the update_macheader function\n"); - return 0; -} -/* - * --------------------------------------------------------------------------- - * uf_ap_process_data_pdu - * - * - * Takes care of intra BSS admission control & routing packets within BSS - * - * Arguments: - * priv Pointer to device private context struct - * skb Socket buffer containing data packet to transmit - * ehdr ethernet header to fetch priority of packet - * srcStaInfo source stations record for connection verification - * packed_signal - * signal_len - * signal MA-PACKET.indication signal - * bulkdata if newSkb allocated then bulkdata updated to send to unifi - * macHeaderLengthInBytes no. of bytes of mac header in received frame - * - * Returns: - * Zero on success(ap processing complete) or -1 if packet also have to be sent to NETDEV. - * --------------------------------------------------------------------------- - */ -int -uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, - struct ethhdr *ehdr, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, - const CSR_SIGNAL *signal, - bulk_data_param_t *bulkdata, - u8 macHeaderLengthInBytes) -{ - const CSR_MA_PACKET_INDICATION *ind = &(signal->u.MaPacketIndication); - u16 interfaceTag = (ind->VirtualInterfaceIdentifier & 0x00ff); - struct sk_buff *newSkb = NULL; - /* pointer to skb or private skb created using skb_copy() */ - struct sk_buff *skbPtr = skb; - u8 sendToNetdev = FALSE; - u8 qosDestination = FALSE; - CSR_PRIORITY priority = CSR_CONTENTION; - CsrWifiRouterCtrlStaInfo_t *dstStaInfo = NULL; - netInterface_priv_t *interfacePriv; - - unifi_trace(priv, UDBG5, "entering uf_ap_process_data_pdu %d\n", macHeaderLengthInBytes); - /* InterfaceTag validation from MA_PACKET.indication */ - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_trace(priv, UDBG1, "Interface Tag is Invalid in uf_ap_process_data_pdu\n"); - unifi_net_data_free(priv, &bulkdata->d[0]); - return 0; - } - interfacePriv = priv->interfacePriv[interfaceTag]; - - if((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) && - (interfacePriv->intraBssEnabled == FALSE)) { - unifi_trace(priv, UDBG2, "uf_ap_process_data_pdu:P2P GO intrabssEnabled?= %d\n", interfacePriv->intraBssEnabled); - - /*In P2P GO case, if intraBSS distribution Disabled then don't do IntraBSS routing */ - /* If destination in our BSS then drop otherwise give packet to netdev */ - dstStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, ehdr->h_dest, interfaceTag); - if (dstStaInfo) { - unifi_net_data_free(priv, &bulkdata->d[0]); - return 0; - } - /* May be associated P2PCLI trying to send the packets on backbone (Netdev) */ - return -1; - } - - if(!memcmp(ehdr->h_dest, interfacePriv->bssid.a, ETH_ALEN)) { - /* This packet will be given to the TCP/IP stack since this packet is for us(AP) - * No routing needed */ - unifi_trace(priv, UDBG4, "destination address is csr_ap\n"); - return -1; - } - - /* fetch the destination record from station record database */ - dstStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, ehdr->h_dest, interfaceTag); - - /* AP mode processing, & if packet is unicast */ - if(!dstStaInfo) { - if (!(ehdr->h_dest[0] & 0x1)) { - /* destination not in station record & its a unicast packet, so pass the packet to network stack */ - unifi_trace(priv, UDBG3, "unicast frame & destination record not exist, send to netdev proto = %x\n", htons(skb->protocol)); - return -1; - } else { - /* packet is multicast/broadcast */ - /* copy the skb to skbPtr, send skb to netdev & skbPtr to multicast/broad cast list */ - unifi_trace(priv, UDBG5, "skb_copy, in uf_ap_process_data_pdu, protocol = %x\n", htons(skb->protocol)); - skbPtr = skb_copy(skb, GFP_KERNEL); - if(skbPtr == NULL) { - /* We don't have memory to don't send the frame in BSS*/ - unifi_notice(priv, "broacast/multicast frame can't be sent in BSS No memeory: proto = %x\n", htons(skb->protocol)); - return -1; - } - sendToNetdev = TRUE; - } - } else { - - /* validate the Peer & Destination Station record */ - if (uf_process_station_records_for_sending_data(priv, interfaceTag, srcStaInfo, dstStaInfo)) { - unifi_notice(priv, "uf_ap_process_data_pdu: station record validation failed \n"); - interfacePriv->stats.rx_errors++; - unifi_net_data_free(priv, &bulkdata->d[0]); - return 0; - } - } - - /* BroadCast packet received and it's been sent as non QOS packets. - * Since WMM spec not mandates broadcast/multicast to be sent as QOS data only, - * if all Peers are QSTA - */ - if(sendToNetdev) { - /* BroadCast packet and it's been sent as non QOS packets */ - qosDestination = FALSE; - } else if(dstStaInfo && (dstStaInfo->wmmOrQosEnabled == TRUE)) { - qosDestination = TRUE; - } - - unifi_trace(priv, UDBG3, "uf_ap_process_data_pdu QoS destination = %s\n", (qosDestination)? "TRUE": "FALSE"); - - /* packet is allowed to send to unifi, update the Mac header */ - if (update_macheader(priv, skbPtr, newSkb, &priority, bulkdata, interfaceTag, macHeaderLengthInBytes, qosDestination)) { - interfacePriv->stats.rx_errors++; - unifi_notice(priv, "(Packet Drop) failed to update the Mac header in uf_ap_process_data_pdu\n"); - if (sendToNetdev) { - /* Free's the skb_copy(skbPtr) data since packet processing failed */ - bulkdata->d[0].os_data_ptr = skbPtr->data; - bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skbPtr; - bulkdata->d[0].data_length = skbPtr->len; - unifi_net_data_free(priv, &bulkdata->d[0]); - } - return -1; - } - - unifi_trace(priv, UDBG3, "Mac Header updated...calling uf_process_ma_packet_req \n"); - - /* Packet is ready to send to unifi ,transmissionControl = 0x0004, confirmation is not needed for data packets */ - if (uf_process_ma_packet_req(priv, ehdr->h_dest, 0xffffffff, interfaceTag, CSR_NO_CONFIRM_REQUIRED, (CSR_RATE)0, priority, priv->netdev_client->sender_id, bulkdata)) { - if (sendToNetdev) { - unifi_trace(priv, UDBG1, "In uf_ap_process_data_pdu, (Packet Drop) uf_process_ma_packet_req failed. freeing skb_copy data (original data sent to Netdev)\n"); - /* Free's the skb_copy(skbPtr) data since packet processing failed */ - bulkdata->d[0].os_data_ptr = skbPtr->data; - bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skbPtr; - bulkdata->d[0].data_length = skbPtr->len; - unifi_net_data_free(priv, &bulkdata->d[0]); - } else { - /* This free's the skb data */ - unifi_trace(priv, UDBG1, "In uf_ap_process_data_pdu, (Packet Drop). Unicast data so freeing original skb \n"); - unifi_net_data_free(priv, &bulkdata->d[0]); - } - } - unifi_trace(priv, UDBG5, "leaving uf_ap_process_data_pdu\n"); - - if (sendToNetdev) { - /* The packet is multicast/broadcast, so after AP processing packet has to - * be sent to netdev, if peer port state is open - */ - unifi_trace(priv, UDBG4, "Packet will be routed to NetDev\n"); - return -1; - } - /* Ap handled the packet & its a unicast packet, no need to send to netdev */ - return 0; -} - -#endif - -CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, - u8 *peerMacAddress, - CSR_CLIENT_TAG hostTag, - u16 interfaceTag, - CSR_TRANSMISSION_CONTROL transmissionControl, - CSR_RATE TransmitRate, - CSR_PRIORITY priority, - CSR_PROCESS_ID leSenderProcessId, - bulk_data_param_t *bulkdata) -{ - CsrResult status = CSR_RESULT_SUCCESS; - CSR_SIGNAL signal; - int result; -#ifdef CSR_SUPPORT_SME - CsrWifiRouterCtrlStaInfo_t *staRecord = NULL; - const u8 *macHdrLocation = bulkdata->d[0].os_data_ptr; - CsrWifiPacketType pktType; - int frameType = 0; - u8 queuePacketDozing = FALSE; - u32 priority_q; - u16 frmCtrl; - struct list_head * list = NULL; /* List to which buffered PDUs are to be enqueued*/ - u8 setBcTim=FALSE; - netInterface_priv_t *interfacePriv; - u8 requeueOnSamePos = FALSE; - u32 handle = 0xFFFFFFFF; - unsigned long lock_flags; - - unifi_trace(priv, UDBG5, - "entering uf_process_ma_packet_req, peer: %pMF\n", - peerMacAddress); - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "interfaceTag >= CSR_WIFI_NUM_INTERFACES, interfacetag = %d\n", interfaceTag); - return CSR_RESULT_FAILURE; - } - interfacePriv = priv->interfacePriv[interfaceTag]; - - - /* fetch the station record for corresponding peer mac address */ - if ((staRecord = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, peerMacAddress, interfaceTag))) { - handle = staRecord->assignedHandle; - } - - /* Frame ma-packet.req, this is saved/transmitted depend on queue state */ - unifi_frame_ma_packet_req(priv, priority, TransmitRate, hostTag, - interfaceTag, transmissionControl, leSenderProcessId, - peerMacAddress, &signal); - - /* Since it's common path between STA & AP mode, in case of STA packet - * need not to be queued but in AP case we have to queue PDU's in - * different scenarios - */ - switch(interfacePriv->interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - /* For this mode processing done below */ - break; - default: - /* In case of STA/IBSS/P2PCLI/AMP, no checks needed send the packet down & return */ - unifi_trace(priv, UDBG5, "In %s, interface mode is %x \n", __FUNCTION__, interfacePriv->interfaceMode); - if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_NONE) { - unifi_warning(priv, "In %s, interface mode NONE \n", __FUNCTION__); - } - if ((result = ul_send_signal_unpacked(priv, &signal, bulkdata))) { - status = CSR_RESULT_FAILURE; - } - return status; - } - - /* -----Only AP/P2pGO mode handling falls below----- */ - - /* convert priority to queue */ - priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); - - /* check the powersave status of the peer */ - if (staRecord && (staRecord->currentPeerState == - CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE)) { - /* Peer is dozing & packet have to be delivered, so buffer the packet & - * update the TIM - */ - queuePacketDozing = TRUE; - } - - /* find the type of frame unicast or mulicast/broadcast */ - if (*peerMacAddress & 0x1) { - /* Multicast/broadCast data are always triggered by vif_availability.ind - * at the DTIM - */ - pktType = CSR_WIFI_MULTICAST_PDU; - } else { - pktType = CSR_WIFI_UNICAST_PDU; - } - - /* Fetch the frame control field from mac header & check for frame type */ - frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation); - - /* Processing done according to Frame/Packet type */ - frameType = ((frmCtrl & 0x000c) >> FRAME_CONTROL_TYPE_FIELD_OFFSET); - switch(frameType) - { - case IEEE802_11_FRAMETYPE_MANAGEMENT: - - switch(pktType) - { - case CSR_WIFI_UNICAST_PDU: - unifi_trace(priv, UDBG5, "management unicast PDU in uf_process_ma_packet_req \n"); - /* push the packet in to the queue with appropriate mgt list */ - if (!staRecord) { - /* push the packet to the unifi if list is empty (if packet lost how to re-enque) */ - if (list_empty(&interfacePriv->genericMgtFrames)) { -#ifdef CSR_SUPPORT_SME - if(!(IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag))) { -#endif - - unifi_trace(priv, UDBG3, "genericMgtFrames list is empty uf_process_ma_packet_req \n"); - result = ul_send_signal_unpacked(priv, &signal, bulkdata); - /* reque only on ENOSPC */ - if(result == -ENOSPC) { - /* requeue the failed packet to genericMgtFrame with same position */ - unifi_trace(priv, UDBG1, "(ENOSPC) Sending genericMgtFrames Failed so buffering\n"); - list = &interfacePriv->genericMgtFrames; - requeueOnSamePos = TRUE; - } -#ifdef CSR_SUPPORT_SME - }else{ - list = &interfacePriv->genericMgtFrames; - unifi_trace(priv, UDBG3, "genericMgtFrames queue empty and dtim started\n hosttag is 0x%x,\n", signal.u.MaPacketRequest.HostTag); - update_eosp_to_head_of_broadcast_list_head(priv, interfaceTag); - } -#endif - } else { - /* Queue the packet to genericMgtFrame of unifi_priv_t data structure */ - list = &interfacePriv->genericMgtFrames; - unifi_trace(priv, UDBG2, "genericMgtFrames queue not empty\n"); - } - } else { - /* check peer power state */ - if (queuePacketDozing || !list_empty(&staRecord->mgtFrames) || IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag)) { - /* peer is in dozing mode, so queue packet in mgt frame list of station record */ - /*if multicast traffic is going on, buffer the unicast packets*/ - list = &staRecord->mgtFrames; - - unifi_trace(priv, UDBG1, "staRecord->MgtFrames list empty? = %s, handle = %d, queuePacketDozing = %d\n", - (list_empty(&staRecord->mgtFrames))? "YES": "NO", staRecord->assignedHandle, queuePacketDozing); - if(IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag)){ - update_eosp_to_head_of_broadcast_list_head(priv, interfaceTag); - } - - } else { - unifi_trace(priv, UDBG5, "staRecord->mgtFrames list is empty uf_process_ma_packet_req \n"); - result = ul_send_signal_unpacked(priv, &signal, bulkdata); - if(result == -ENOSPC) { - /* requeue the failed packet to staRecord->mgtFrames with same position */ - list = &staRecord->mgtFrames; - requeueOnSamePos = TRUE; - unifi_trace(priv, UDBG1, "(ENOSPC) Sending MgtFrames Failed handle = %d so buffering\n", staRecord->assignedHandle); - priv->pausedStaHandle[0]=(u8)(staRecord->assignedHandle); - } else if (result) { - status = CSR_RESULT_FAILURE; - } - } - } - break; - case CSR_WIFI_MULTICAST_PDU: - unifi_trace(priv, UDBG5, "management multicast/broadcast PDU in uf_process_ma_packet_req 'QUEUE it' \n"); - /* Queue the packet to genericMulticastOrBroadCastMgtFrames of unifi_priv_t data structure - * will be sent when we receive VIF AVAILABILITY from firmware as part of DTIM - */ - - list = &interfacePriv->genericMulticastOrBroadCastMgtFrames; - if((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_IBSS) && - (list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames))) { - setBcTim=TRUE; - } - break; - default: - unifi_error(priv, "condition never meets: packet type unrecognized\n"); - } - break; - case IEEE802_11_FRAMETYPE_DATA: - switch(pktType) - { - case CSR_WIFI_UNICAST_PDU: - unifi_trace(priv, UDBG5, "data unicast PDU in uf_process_ma_packet_req \n"); - /* check peer power state, list status & peer port status */ - if(!staRecord) { - unifi_error(priv, "In %s unicast but staRecord = NULL\n", __FUNCTION__); - return CSR_RESULT_FAILURE; - } else if (queuePacketDozing || isRouterBufferEnabled(priv, priority_q)|| !list_empty(&staRecord->dataPdu[priority_q]) || IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag)) { - /* peer is in dozing mode, so queue packet in mgt frame list of station record */ - /* if multicast traffic is going on, buffet the unicast packets */ - unifi_trace(priv, UDBG2, "Enqueued to staRecord->dataPdu[%d] queuePacketDozing=%d,\ - Buffering enabled = %d \n", priority_q, queuePacketDozing, isRouterBufferEnabled(priv, priority_q)); - list = &staRecord->dataPdu[priority_q]; - } else { - unifi_trace(priv, UDBG5, "staRecord->dataPdu[%d] list is empty uf_process_ma_packet_req \n", priority_q); - /* Pdu allowed to send to unifi */ - result = ul_send_signal_unpacked(priv, &signal, bulkdata); - if(result == -ENOSPC) { - /* requeue the failed packet to staRecord->dataPdu[priority_q] with same position */ - unifi_trace(priv, UDBG1, "(ENOSPC) Sending Unicast DataPDU to queue %d Failed so buffering\n", priority_q); - requeueOnSamePos = TRUE; - list = &staRecord->dataPdu[priority_q]; - priv->pausedStaHandle[priority_q]=(u8)(staRecord->assignedHandle); - if(!isRouterBufferEnabled(priv, priority_q)) { - unifi_error(priv, "Buffering Not enabled for queue %d \n", priority_q); - } - } else if (result) { - status = CSR_RESULT_FAILURE; - } - } - break; - case CSR_WIFI_MULTICAST_PDU: - unifi_trace(priv, UDBG5, "data multicast/broadcast PDU in uf_process_ma_packet_req \n"); - /* Queue the packet to genericMulticastOrBroadCastFrames list of unifi_priv_t data structure - * will be sent when we receive VIF AVAILABILITY from firmware as part of DTIM - */ - list = &interfacePriv->genericMulticastOrBroadCastFrames; - if(list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)) { - setBcTim = TRUE; - } - break; - default: - unifi_error(priv, "condition never meets: packet type un recognized\n"); - } - break; - default: - unifi_error(priv, "unrecognized frame type\n"); - } - if(list) { - status = enque_tx_data_pdu(priv, bulkdata, list, &signal, requeueOnSamePos); - /* Record no. of packet queued for each peer */ - if (staRecord && (pktType == CSR_WIFI_UNICAST_PDU) && (!status)) { - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - staRecord->noOfPktQueued++; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - } - else if ((pktType == CSR_WIFI_MULTICAST_PDU) && (!status)) - { - /* If broadcast Tim is set && queuing is successful, then only update TIM */ - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - interfacePriv->noOfbroadcastPktQueued++; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - } - } - /* If broadcast Tim is set && queuing is successful, then only update TIM */ - if(setBcTim && !status) { - unifi_trace(priv, UDBG3, "tim set due to broadcast pkt\n"); - if (!interfacePriv->bcTimSetReqPendingFlag) - { - update_tim(priv, 0, CSR_WIFI_TIM_SET, interfaceTag, handle); - } - else - { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - interfacePriv->bcTimSetReqQueued = CSR_WIFI_TIM_SET; - unifi_trace(priv, UDBG2, "uf_process_ma_packet_req : One more UpdateDTim Request(:%d) Queued \n", - interfacePriv->bcTimSetReqQueued); - } - } else if(staRecord && staRecord->currentPeerState == - CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) { - if(staRecord->timSet == CSR_WIFI_TIM_RESET || staRecord->timSet == CSR_WIFI_TIM_RESETTING) { - if(!staRecord->wmmOrQosEnabled) { - if(!list_empty(&staRecord->mgtFrames) || - !list_empty(&staRecord->dataPdu[3]) || - !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION])) { - unifi_trace(priv, UDBG3, "tim set due to unicast pkt & peer in powersave\n"); - if (!staRecord->timRequestPendingFlag){ - update_tim(priv, staRecord->aid, 1, interfaceTag, handle); - } - else - { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - staRecord->updateTimReqQueued = 1; - unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, - staRecord->aid); - } - } - } else { - /* Check for non delivery enable(i.e trigger enable), all delivery enable & legacy AC for TIM update in firmware */ - u8 allDeliveryEnabled = 0, dataAvailable = 0; - /* Check if all AC's are Delivery Enabled */ - is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); - if (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable) - || (!list_empty(&staRecord->mgtFrames))) { - if (!staRecord->timRequestPendingFlag) { - update_tim(priv, staRecord->aid, 1, interfaceTag, handle); - } - else - { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - staRecord->updateTimReqQueued = 1; - unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, - staRecord->aid); - } - } - } - } - } - - if((list) && (pktType == CSR_WIFI_UNICAST_PDU && !queuePacketDozing) && !(isRouterBufferEnabled(priv, priority_q)) && !(IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag))) { - unifi_trace(priv, UDBG2, "buffering cleared for queue = %d So resending buffered frames\n", priority_q); - uf_send_buffered_frames(priv, priority_q); - } - unifi_trace(priv, UDBG5, "leaving uf_process_ma_packet_req \n"); - return status; -#else -#ifdef CSR_NATIVE_LINUX - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "interfaceTag >= CSR_WIFI_NUM_INTERFACES, interfacetag = %d\n", interfaceTag); - return CSR_RESULT_FAILURE; - } - /* Frame ma-packet.req, this is saved/transmitted depend on queue state */ - unifi_frame_ma_packet_req(priv, priority, TransmitRate, hostTag, interfaceTag, - transmissionControl, leSenderProcessId, - peerMacAddress, &signal); - result = ul_send_signal_unpacked(priv, &signal, bulkdata); - if (result) { - return CSR_RESULT_FAILURE; - } -#endif - return status; -#endif -} - -#ifdef CSR_SUPPORT_SME -s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, u16 interfaceTag, const u8 *daddr) -{ - s8 protection = 0; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - - switch(interfacePriv->interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_STA: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI: - case CSR_WIFI_ROUTER_CTRL_MODE_AMP: - case CSR_WIFI_ROUTER_CTRL_MODE_IBSS: - protection = interfacePriv->protect; - break; - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - { - CsrWifiRouterCtrlStaInfo_t *dstStaInfo = NULL; - if (daddr[0] & 0x1) { - unifi_trace(priv, UDBG3, "broadcast/multicast packet in send_ma_pkt_request\n"); - /* In this mode, the protect member of priv structure has an information of how - * AP/P2PGO has started, & the member updated in set mode request for AP/P2PGO - */ - protection = interfacePriv->protect; - } else { - /* fetch the destination record from station record database */ - dstStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, daddr, interfaceTag); - if (!dstStaInfo) { - unifi_trace(priv, UDBG3, "peer not found in station record in send_ma_pkt_request\n"); - return -1; - } - protection = dstStaInfo->protection; - } - } - break; - default: - unifi_trace(priv, UDBG2, "mode unknown in send_ma_pkt_request\n"); - } - return protection; -} -#endif -#ifdef CSR_SUPPORT_SME -u8 send_multicast_frames(unifi_priv_t *priv, u16 interfaceTag) -{ - int r; - tx_buffered_packets_t * buffered_pkt = NULL; - u8 moreData = FALSE; - u8 pduSent =0; - unsigned long lock_flags; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - u32 hostTag = 0xffffffff; - - if(!isRouterBufferEnabled(priv, UNIFI_TRAFFIC_Q_VO)) { - while((interfacePriv->dtimActive)&& (buffered_pkt=dequeue_tx_data_pdu(priv, &interfacePriv->genericMulticastOrBroadCastMgtFrames))) { - buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK); - moreData = (buffered_pkt->transmissionControl & TRANSMISSION_CONTROL_EOSP_MASK)?FALSE:TRUE; - - - unifi_trace(priv, UDBG2, "DTIM Occurred for interface:sending Mgt packet %d\n", interfaceTag); - - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, NULL, moreData, FALSE)) == -ENOSPC) { - unifi_trace(priv, UDBG1, "frame_and_send_queued_pdu failed with ENOSPC for host tag = %x\n", buffered_pkt->hostTag); - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, &interfacePriv->genericMulticastOrBroadCastMgtFrames); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - break; - } else { - unifi_trace(priv, UDBG1, "send_multicast_frames: Send genericMulticastOrBroadCastMgtFrames (%x, %x)\n", - buffered_pkt->hostTag, - r); - if(r) { - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - if(!moreData) { - - interfacePriv->dtimActive = FALSE; - if(!r) { - hostTag = buffered_pkt->hostTag; - pduSent++; - } else { - send_vif_availibility_rsp(priv, uf_get_vif_identifier(interfacePriv->interfaceMode, interfaceTag), CSR_RC_UNSPECIFIED_FAILURE); - } - } - /* Buffered frame sent successfully */ - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - interfacePriv->noOfbroadcastPktQueued--; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - kfree(buffered_pkt); - } - - } - } - if(!isRouterBufferEnabled(priv, UNIFI_TRAFFIC_Q_CONTENTION)) { - while((interfacePriv->dtimActive)&& (buffered_pkt=dequeue_tx_data_pdu(priv, &interfacePriv->genericMulticastOrBroadCastFrames))) { - buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK; - moreData = (buffered_pkt->transmissionControl & TRANSMISSION_CONTROL_EOSP_MASK)?FALSE:TRUE; - - - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, NULL, moreData, FALSE)) == -ENOSPC) { - /* Clear the trigger bit transmission control*/ - buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK); - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, &interfacePriv->genericMulticastOrBroadCastFrames); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - break; - } else { - if(r) { - unifi_trace(priv, UDBG1, "send_multicast_frames: Send genericMulticastOrBroadCastFrame failed (%x, %x)\n", - buffered_pkt->hostTag, - r); - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - if(!moreData) { - interfacePriv->dtimActive = FALSE; - if(!r) { - pduSent ++; - hostTag = buffered_pkt->hostTag; - } else { - send_vif_availibility_rsp(priv, uf_get_vif_identifier(interfacePriv->interfaceMode, interfaceTag), CSR_RC_UNSPECIFIED_FAILURE); - } - } - /* Buffered frame sent successfully */ - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - interfacePriv->noOfbroadcastPktQueued--; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - kfree(buffered_pkt); - } - } - } - if((interfacePriv->dtimActive == FALSE)) { - /* Record the host Tag*/ - unifi_trace(priv, UDBG2, "send_multicast_frames: Recorded hostTag of EOSP packet: = 0x%x\n", hostTag); - interfacePriv->multicastPduHostTag = hostTag; - } - return pduSent; -} -#endif -void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv, u8 *sigdata, - u32 siglen) -{ -#ifdef CSR_SUPPORT_SME - CSR_SIGNAL signal; - CSR_MA_VIF_AVAILABILITY_INDICATION *ind; - int r; - u16 interfaceTag; - u8 pduSent =0; - CSR_RESULT_CODE resultCode = CSR_RC_SUCCESS; - netInterface_priv_t *interfacePriv; - - unifi_trace(priv, UDBG3, - "uf_process_ma_vif_availibility_ind: Process signal 0x%.4X\n", - *((u16*)sigdata)); - - r = read_unpack_signal(sigdata, &signal); - if (r) { - unifi_error(priv, - "uf_process_ma_vif_availibility_ind: Received unknown signal 0x%.4X.\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata)); - return; - } - ind = &signal.u.MaVifAvailabilityIndication; - interfaceTag=ind->VirtualInterfaceIdentifier & 0xff; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "in vif_availability_ind interfaceTag is wrong\n"); - return; - } - - interfacePriv = priv->interfacePriv[interfaceTag]; - - if(ind->Multicast) { - if(list_empty(&interfacePriv->genericMulticastOrBroadCastFrames) && - list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames)) { - /* This condition can occur because of a potential race where the - TIM is not yet reset as host is waiting for confirm but it is sent - by firmware and DTIM occurs*/ - unifi_notice(priv, "ma_vif_availibility_ind recevied for multicast but queues are empty%d\n", interfaceTag); - send_vif_availibility_rsp(priv, ind->VirtualInterfaceIdentifier, CSR_RC_NO_BUFFERED_BROADCAST_MULTICAST_FRAMES); - interfacePriv->dtimActive = FALSE; - if(interfacePriv->multicastPduHostTag == 0xffffffff) { - unifi_notice(priv, "ma_vif_availibility_ind recevied for multicast but queues are empty%d\n", interfaceTag); - /* This may be an extra request in very rare race conditions but it is fine as it would atleast remove the potential lock up */ - if (!interfacePriv->bcTimSetReqPendingFlag) - { - update_tim(priv, 0, CSR_WIFI_TIM_RESET, interfaceTag, 0xFFFFFFFF); - } - else - { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - interfacePriv->bcTimSetReqQueued = CSR_WIFI_TIM_RESET; - unifi_trace(priv, UDBG2, "uf_process_ma_vif_availibility_ind : One more UpdateDTim Request(%d) Queued \n", - interfacePriv->bcTimSetReqQueued); - } - } - return; - } - if(interfacePriv->dtimActive) { - unifi_trace(priv, UDBG2, "DTIM Occurred for already active DTIM interface %d\n", interfaceTag); - return; - } else { - unifi_trace(priv, UDBG2, "DTIM Occurred for interface %d\n", interfaceTag); - if(list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)) { - set_eosp_transmit_ctrl(priv, &interfacePriv->genericMulticastOrBroadCastMgtFrames); - } else { - set_eosp_transmit_ctrl(priv, &interfacePriv->genericMulticastOrBroadCastFrames); - } - } - interfacePriv->dtimActive = TRUE; - pduSent = send_multicast_frames(priv, interfaceTag); - } - else { - unifi_error(priv, "Interface switching is not supported %d\n", interfaceTag); - resultCode = CSR_RC_NOT_SUPPORTED; - send_vif_availibility_rsp(priv, ind->VirtualInterfaceIdentifier, CSR_RC_NOT_SUPPORTED); - } -#endif -} -#ifdef CSR_SUPPORT_SME - -#define GET_ACTIVE_INTERFACE_TAG(priv) 0 - -static u8 uf_is_more_data_for_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t *staRecord) -{ - s8 i; - - for(i=UNIFI_TRAFFIC_Q_VO; i >= UNIFI_TRAFFIC_Q_BK; i--) - { - if(((staRecord->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE) - ||(staRecord->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) - &&(!list_empty(&staRecord->dataPdu[i]))) { - unifi_trace(priv, UDBG2, "uf_is_more_data_for_delivery_ac: Data Available AC = %d\n", i); - return TRUE; - } - } - - unifi_trace(priv, UDBG2, "uf_is_more_data_for_delivery_ac: Data NOT Available \n"); - return FALSE; -} - -static u8 uf_is_more_data_for_usp_delivery(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t *staRecord, unifi_TrafficQueue queue) -{ - s8 i; - - for(i = queue; i >= UNIFI_TRAFFIC_Q_BK; i--) - { - if(((staRecord->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE) - ||(staRecord->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) - &&(!list_empty(&staRecord->dataPdu[i]))) { - unifi_trace(priv, UDBG2, "uf_is_more_data_for_usp_delivery: Data Available AC = %d\n", i); - return TRUE; - } - } - - unifi_trace(priv, UDBG2, "uf_is_more_data_for_usp_delivery: Data NOT Available \n"); - return FALSE; -} - -/* - * --------------------------------------------------------------------------- - * uf_send_buffered_data_from_delivery_ac - * - * This function takes care of - * -> Parsing the delivery enabled queue & sending frame down to HIP - * -> Setting EOSP=1 when USP to be terminated - * -> Depending on MAX SP length services the USP - * - * NOTE:This function always called from uf_handle_uspframes_delivery(), Dont - * call this function from any other location in code - * - * Arguments: - * priv Pointer to device private context struct - * vif interface specific HIP vif instance - * staInfo peer for which UAPSD to be scheduled - * queue AC from which Data to be sent in USP - * txList access category for processing list - * --------------------------------------------------------------------------- - */ -void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, - CsrWifiRouterCtrlStaInfo_t * staInfo, - u8 queue, - struct list_head *txList) -{ - - u16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv); - tx_buffered_packets_t * buffered_pkt = NULL; - unsigned long lock_flags; - u8 eosp=FALSE; - s8 r =0; - u8 moreData = FALSE; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - - unifi_trace(priv, UDBG2, "++uf_send_buffered_data_from_delivery_ac, active=%x\n", staInfo->uapsdActive); - - if (queue > UNIFI_TRAFFIC_Q_VO) - { - return; - } - while((buffered_pkt=dequeue_tx_data_pdu(priv, txList))) { - if((IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag))) { - unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_delivery_ac: DTIM Active, suspend UAPSD, staId: 0x%x\n", - staInfo->aid); - - /* Once resume called, the U-APSD delivery operation will resume */ - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - staInfo->uspSuspend = TRUE; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - /* re-queueing the packet as DTIM started */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, txList); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - break; - } - - buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - - - if((staInfo->wmmOrQosEnabled == TRUE)&&(staInfo->uapsdActive == TRUE)) { - - buffered_pkt->transmissionControl = TRANSMISSION_CONTROL_TRIGGER_MASK; - - /* Check All delivery enables Ac for more data, because caller of this - * function not aware about last packet - * (First check in moreData fetching helps in draining out Mgt frames Q) - */ - moreData = (!list_empty(txList) || uf_is_more_data_for_usp_delivery(priv, staInfo, queue)); - - if(staInfo->noOfSpFramesSent == (staInfo->maxSpLength - 1)) { - moreData = FALSE; - } - - if(moreData == FALSE) { - eosp = TRUE; - buffered_pkt->transmissionControl = - (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - } - } else { - /* Non QoS and non U-APSD */ - unifi_warning(priv, "uf_send_buffered_data_from_delivery_ac: non U-APSD !!! \n"); - } - - unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_delivery_ac : MoreData:%d, EOSP:%d\n", moreData, eosp); - - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staInfo, moreData, eosp)) == -ENOSPC) { - - unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_delivery_ac: UASPD suspended, ENOSPC in hipQ=%x\n", queue); - - /* Once resume called, the U-APSD delivery operation will resume */ - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - staInfo->uspSuspend = TRUE; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, txList); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - priv->pausedStaHandle[queue]=(u8)(staInfo->assignedHandle); - break; - } else { - if(r){ - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - staInfo->noOfSpFramesSent++; - if((!moreData) || (staInfo->noOfSpFramesSent == staInfo->maxSpLength)) { - unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_delivery_ac: Terminating USP\n"); - staInfo->uapsdActive = FALSE; - staInfo->uspSuspend = FALSE; - staInfo->noOfSpFramesSent = 0; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - break; - } - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - } - } - unifi_trace(priv, UDBG2, "--uf_send_buffered_data_from_delivery_ac, active=%x\n", staInfo->uapsdActive); -} - -void uf_send_buffered_data_from_ac(unifi_priv_t *priv, - CsrWifiRouterCtrlStaInfo_t * staInfo, - u8 queue, - struct list_head *txList) -{ - tx_buffered_packets_t * buffered_pkt = NULL; - unsigned long lock_flags; - u8 eosp=FALSE; - u8 moreData = FALSE; - s8 r =0; - - unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_ac :\n"); - - while(!isRouterBufferEnabled(priv, queue) && - ((buffered_pkt=dequeue_tx_data_pdu(priv, txList))!=NULL)){ - - buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK); - - unifi_trace(priv, UDBG3, "uf_send_buffered_data_from_ac : MoreData:%d, EOSP:%d\n", moreData, eosp); - - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staInfo, moreData, eosp)) == -ENOSPC) { - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, txList); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - if(staInfo != NULL){ - priv->pausedStaHandle[queue]=(u8)(staInfo->assignedHandle); - } - unifi_trace(priv, UDBG3, " uf_send_buffered_data_from_ac: PDU sending failed .. no space for queue %d \n", queue); - } else { - if(r){ - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - } - } - -} - -void uf_send_buffered_frames(unifi_priv_t *priv, unifi_TrafficQueue q) -{ - u16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv); - u32 startIndex=0, endIndex=0; - CsrWifiRouterCtrlStaInfo_t * staInfo = NULL; - u8 queue; - u8 moreData = FALSE; - - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - - if(!((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP) || - (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO))) - return; - - queue = (q<=3)?q:0; - - if(interfacePriv->dtimActive) { - /* this function updates dtimActive*/ - send_multicast_frames(priv, interfaceTag); - if(!interfacePriv->dtimActive) { - moreData = (!list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) || - !list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)); - if(!moreData) { - if (!interfacePriv->bcTimSetReqPendingFlag) - { - update_tim(priv, 0, CSR_WIFI_TIM_RESET, interfaceTag, 0XFFFFFFFF); - } - else - { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - interfacePriv->bcTimSetReqQueued = CSR_WIFI_TIM_RESET; - unifi_trace(priv, UDBG2, "uf_send_buffered_frames : One more UpdateDTim Request(%d) Queued \n", - interfacePriv->bcTimSetReqQueued); - } - } - } else { - moreData = (!list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) || - !list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)); - if(!moreData) { - /* This should never happen but if it happens, we need a way out */ - unifi_error(priv, "ERROR: No More Data but DTIM is active sending Response\n"); - send_vif_availibility_rsp(priv, uf_get_vif_identifier(interfacePriv->interfaceMode, interfaceTag), CSR_RC_NO_BUFFERED_BROADCAST_MULTICAST_FRAMES); - interfacePriv->dtimActive = FALSE; - } - } - return; - } - if(priv->pausedStaHandle[queue] > 7) { - priv->pausedStaHandle[queue] = 0; - } - - if(queue == UNIFI_TRAFFIC_Q_VO) { - - - unifi_trace(priv, UDBG2, "uf_send_buffered_frames : trying mgt from queue=%d\n", queue); - for(startIndex= 0; startIndex < UNIFI_MAX_CONNECTIONS;startIndex++) { - staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv, startIndex, interfaceTag); - if(!staInfo ) { - continue; - } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) - &&(staInfo->uapsdActive == FALSE) ) { - continue; - } - - if((staInfo != NULL)&&(staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) - &&(staInfo->uapsdActive == FALSE)){ - /*Non-UAPSD case push the management frames out*/ - if(!list_empty(&staInfo->mgtFrames)){ - uf_send_buffered_data_from_ac(priv, staInfo, UNIFI_TRAFFIC_Q_VO, &staInfo->mgtFrames); - } - } - - if(isRouterBufferEnabled(priv, queue)) { - unifi_notice(priv, "uf_send_buffered_frames : No space Left for queue = %d\n", queue); - break; - } - } - /*push generic management frames out*/ - if(!list_empty(&interfacePriv->genericMgtFrames)) { - unifi_trace(priv, UDBG2, "uf_send_buffered_frames : trying generic mgt from queue=%d\n", queue); - uf_send_buffered_data_from_ac(priv, staInfo, UNIFI_TRAFFIC_Q_VO, &interfacePriv->genericMgtFrames); - } - } - - - unifi_trace(priv, UDBG2, "uf_send_buffered_frames : Resume called for Queue=%d\n", queue); - unifi_trace(priv, UDBG2, "uf_send_buffered_frames : start=%d end=%d\n", startIndex, endIndex); - - startIndex = priv->pausedStaHandle[queue]; - endIndex = (startIndex + UNIFI_MAX_CONNECTIONS -1) % UNIFI_MAX_CONNECTIONS; - - while(startIndex != endIndex) { - staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv, startIndex, interfaceTag); - if(!staInfo) { - startIndex ++; - if(startIndex >= UNIFI_MAX_CONNECTIONS) { - startIndex = 0; - } - continue; - } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) - &&(staInfo->uapsdActive == FALSE)) { - startIndex ++; - if(startIndex >= UNIFI_MAX_CONNECTIONS) { - startIndex = 0; - } - continue; - } - /* Peer is active or U-APSD is active so send PDUs to the peer */ - unifi_trace(priv, UDBG2, "uf_send_buffered_frames : trying data from queue=%d\n", queue); - - - if((staInfo != NULL)&&(staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) - &&(staInfo->uapsdActive == FALSE)) { - if(!list_empty(&staInfo->dataPdu[queue])) { - - /*Non-UAPSD case push the AC frames out*/ - uf_send_buffered_data_from_ac(priv, staInfo, queue, (&staInfo->dataPdu[queue])); - } - } - startIndex ++; - if(startIndex >= UNIFI_MAX_CONNECTIONS) { - startIndex = 0; - } - } - if(isRouterBufferEnabled(priv, queue)) { - priv->pausedStaHandle[queue] = endIndex; - } else { - priv->pausedStaHandle[queue] = 0; - } - - /* U-APSD might have stopped because of ENOSPC in lib_hip (pause activity). - * So restart it if U-APSD was active with any of the station - */ - unifi_trace(priv, UDBG4, "csrWifiHipSendBufferedFrames: UAPSD Resume Q=%x\n", queue); - resume_suspended_uapsd(priv, interfaceTag); -} - - -u8 uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord) -{ - u8 i; - - for(i=0;i<=3;i++) - { - if(((staRecord->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED) - ||(staRecord->powersaveMode[i]==CSR_WIFI_AC_LEGACY_POWER_SAVE)) - &&(!list_empty(&staRecord->dataPdu[i]))){ - - return TRUE; - } - } - - if(((staRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED) - ||(staRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_LEGACY_POWER_SAVE)) - &&(!list_empty(&staRecord->mgtFrames))){ - - return TRUE; - } - - - - return FALSE; -} - - -int uf_process_station_records_for_sending_data(unifi_priv_t *priv, u16 interfaceTag, - CsrWifiRouterCtrlStaInfo_t *srcStaInfo, - CsrWifiRouterCtrlStaInfo_t *dstStaInfo) -{ - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - - unifi_trace(priv, UDBG5, "entering uf_process_station_records_for_sending_data\n"); - - if (srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED) { - unifi_error(priv, "Peer State not connected AID = %x, handle = %x, control port state = %x\n", - srcStaInfo->aid, srcStaInfo->assignedHandle, srcStaInfo->peerControlledPort->port_action); - return -1; - } - switch (interfacePriv->interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - unifi_trace(priv, UDBG5, "mode is AP/P2PGO\n"); - break; - default: - unifi_warning(priv, "mode is nor AP neither P2PGO, packet cant be xmit\n"); - return -1; - } - - switch(dstStaInfo->peerControlledPort->port_action) - { - case CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD: - case CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK: - unifi_trace(priv, UDBG5, "destination port is closed/blocked, discarding the packet\n"); - return -1; - default: - unifi_trace(priv, UDBG5, "destination port state is open\n"); - } - - /* port state is open, destination station record is valid, Power save state is - * validated in uf_process_ma_packet_req function - */ - unifi_trace(priv, UDBG5, "leaving uf_process_station_records_for_sending_data\n"); - return 0; -} - - -/* - * --------------------------------------------------------------------------- - * uf_handle_uspframes_delivery - * - * This function takes care of handling USP session for peer, when - * -> trigger frame from peer - * -> suspended USP to be processed (resumed) - * - * NOTE: uf_send_buffered_data_from_delivery_ac() always called from this function, Dont - * make a direct call to uf_send_buffered_data_from_delivery_ac() from any other part of - * code - * - * Arguments: - * priv Pointer to device private context struct - * staInfo peer for which UAPSD to be scheduled - * interfaceTag virtual interface tag - * --------------------------------------------------------------------------- - */ -static void uf_handle_uspframes_delivery(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t *staInfo, u16 interfaceTag) -{ - - s8 i; - u8 allDeliveryEnabled = 0, dataAvailable = 0; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - unsigned long lock_flags; - - unifi_trace(priv, UDBG2, " ++ uf_handle_uspframes_delivery, uapsd active=%x, suspended?=%x\n", - staInfo->uapsdActive, staInfo->uspSuspend); - - /* Check for Buffered frames according to priority order & deliver it - * 1. AC_VO delivery enable & Mgt frames available - * 2. Process remaining Ac's from order AC_VO to AC_BK - */ - - /* USP initiated by WMMPS enabled peer & SET the status flag to TRUE */ - if (!staInfo->uspSuspend && staInfo->uapsdActive) - { - unifi_notice(priv, "uf_handle_uspframes_delivery: U-APSD already active! STA=%x:%x:%x:%x:%x:%x\n", - staInfo->peerMacAddress.a[0], staInfo->peerMacAddress.a[1], - staInfo->peerMacAddress.a[2], staInfo->peerMacAddress.a[3], - staInfo->peerMacAddress.a[4], staInfo->peerMacAddress.a[5]); - return; - } - - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - staInfo->uapsdActive = TRUE; - staInfo->uspSuspend = FALSE; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - - if(((staInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)|| - (staInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)) - && (!list_empty(&staInfo->mgtFrames))) { - - /* Management queue has data && UNIFI_TRAFFIC_Q_VO is delivery enable */ - unifi_trace(priv, UDBG4, "uf_handle_uspframes_delivery: Sending buffered management frames\n"); - uf_send_buffered_data_from_delivery_ac(priv, staInfo, UNIFI_TRAFFIC_Q_VO, &staInfo->mgtFrames); - } - - if (!uf_is_more_data_for_delivery_ac(priv, staInfo)) { - /* All delivery enable AC's are empty, so QNULL to be sent to terminate the USP - * NOTE: If we have sent Mgt frame also, we must send QNULL followed to terminate USP - */ - if (!staInfo->uspSuspend) { - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - staInfo->uapsdActive = FALSE; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - - unifi_trace(priv, UDBG2, "uf_handle_uspframes_delivery: sending QNull for trigger\n"); - uf_send_qos_null(priv, interfaceTag, staInfo->peerMacAddress.a, (CSR_PRIORITY) staInfo->triggerFramePriority, staInfo); - staInfo->triggerFramePriority = CSR_QOS_UP0; - } else { - unifi_trace(priv, UDBG2, "uf_handle_uspframes_delivery: MgtQ xfer suspended\n"); - } - } else { - for(i = UNIFI_TRAFFIC_Q_VO; i >= UNIFI_TRAFFIC_Q_BK; i--) { - if(((staInfo->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE) - ||(staInfo->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) - && (!list_empty(&staInfo->dataPdu[i]))) { - /* Deliver Data according to AC priority (from VO to BK) as part of USP */ - unifi_trace(priv, UDBG4, "uf_handle_uspframes_delivery: Buffered data frames from Queue (%d) for USP\n", i); - uf_send_buffered_data_from_delivery_ac(priv, staInfo, i, &staInfo->dataPdu[i]); - } - - if ((!staInfo->uapsdActive) || - (staInfo->uspSuspend && IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag))) { - /* If DTIM active found on one AC, No need to parse the remaining AC's - * as USP suspended. Break out of loop - */ - unifi_trace(priv, UDBG2, "uf_handle_uspframes_delivery: suspend=%x, DTIM=%x, USP terminated=%s\n", - staInfo->uspSuspend, IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag), - staInfo->uapsdActive?"NO":"YES"); - break; - } - } - } - - /* Depending on the USP status, update the TIM accordingly for delivery enabled AC only - * (since we are not manipulating any Non-delivery list(AC)) - */ - is_all_ac_deliver_enabled_and_moredata(staInfo, &allDeliveryEnabled, &dataAvailable); - if ((allDeliveryEnabled && !dataAvailable)) { - if ((staInfo->timSet != CSR_WIFI_TIM_RESET) && (staInfo->timSet != CSR_WIFI_TIM_RESETTING)) { - staInfo->updateTimReqQueued = (u8) CSR_WIFI_TIM_RESET; - unifi_trace(priv, UDBG4, " --uf_handle_uspframes_delivery, UAPSD timset\n"); - if (!staInfo->timRequestPendingFlag) { - update_tim(priv, staInfo->aid, 0, interfaceTag, staInfo->assignedHandle); - } - } - } - unifi_trace(priv, UDBG2, " --uf_handle_uspframes_delivery, uapsd active=%x, suspend?=%x\n", - staInfo->uapsdActive, staInfo->uspSuspend); -} - -void uf_process_wmm_deliver_ac_uapsd(unifi_priv_t * priv, - CsrWifiRouterCtrlStaInfo_t * srcStaInfo, - u16 qosControl, - u16 interfaceTag) -{ - CSR_PRIORITY priority; - unifi_TrafficQueue priority_q; - unsigned long lock_flags; - - unifi_trace(priv, UDBG2, "++uf_process_wmm_deliver_ac_uapsd: uapsdactive?=%x\n", srcStaInfo->uapsdActive); - /* If recceived Frames trigger Frame and Devlivery enabled AC has data - * then transmit from High priorty delivery enabled AC - */ - priority = (CSR_PRIORITY)(qosControl & IEEE802_11_QC_TID_MASK); - priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); - - if((srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED) - ||(srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) { - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - srcStaInfo->triggerFramePriority = priority; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - unifi_trace(priv, UDBG2, "uf_process_wmm_deliver_ac_uapsd: trigger frame, Begin U-APSD, triggerQ=%x\n", priority_q); - uf_handle_uspframes_delivery(priv, srcStaInfo, interfaceTag); - } - unifi_trace(priv, UDBG2, "--uf_process_wmm_deliver_ac_uapsd: uapsdactive?=%x\n", srcStaInfo->uapsdActive); -} - - -void uf_send_qos_null(unifi_priv_t * priv, u16 interfaceTag, const u8 *da, CSR_PRIORITY priority, CsrWifiRouterCtrlStaInfo_t * srcStaInfo) -{ - bulk_data_param_t bulkdata; - CsrResult csrResult; - struct sk_buff *skb, *newSkb = NULL; - CsrWifiMacAddress peerAddress; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - CSR_TRANSMISSION_CONTROL transmissionControl = (TRANSMISSION_CONTROL_EOSP_MASK | TRANSMISSION_CONTROL_TRIGGER_MASK); - int r; - CSR_SIGNAL signal; - u32 priority_q; - CSR_RATE transmitRate = 0; - - - /* Send a Null Frame to Peer, - * 32= size of mac header */ - csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], MAC_HEADER_SIZE + QOS_CONTROL_HEADER_SIZE); - - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, " failed to allocate request_data. in uf_send_qos_null func\n"); - return ; - } - skb = (struct sk_buff *)(bulkdata.d[0].os_net_buf_ptr); - skb->len = 0; - bulkdata.d[0].os_data_ptr = skb->data; - bulkdata.d[0].os_net_buf_ptr = (unsigned char*)skb; - bulkdata.d[0].net_buf_length = bulkdata.d[0].data_length = skb->len; - bulkdata.d[1].os_data_ptr = NULL; - bulkdata.d[1].os_net_buf_ptr = NULL; - bulkdata.d[1].net_buf_length = bulkdata.d[1].data_length = 0; - - /* For null frames protection bit should not be set in MAC header, so passing value 0 below for protection field */ - - if (prepare_and_add_macheader(priv, skb, newSkb, priority, &bulkdata, interfaceTag, da, interfacePriv->bssid.a, 0)) { - unifi_error(priv, "failed to create MAC header\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - return; - } - memcpy(peerAddress.a, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); - /* convert priority to queue */ - priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); - - /* Frame ma-packet.req, this is saved/transmitted depend on queue state - * send the null frame at data rate of 1 Mb/s for AP or 6 Mb/s for P2PGO - */ - switch (interfacePriv->interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - transmitRate = 2; - break; - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - transmitRate = 12; - break; - default: - transmitRate = 0; - } - unifi_frame_ma_packet_req(priv, priority, transmitRate, 0xffffffff, interfaceTag, - transmissionControl, priv->netdev_client->sender_id, - peerAddress.a, &signal); - - r = ul_send_signal_unpacked(priv, &signal, &bulkdata); - if(r) { - unifi_error(priv, "failed to send QOS data null packet result: %d\n", r); - unifi_net_data_free(priv, &bulkdata.d[0]); - } - - return; - -} -void uf_send_nulldata(unifi_priv_t * priv, u16 interfaceTag, const u8 *da, CSR_PRIORITY priority, CsrWifiRouterCtrlStaInfo_t * srcStaInfo) -{ - bulk_data_param_t bulkdata; - CsrResult csrResult; - struct sk_buff *skb, *newSkb = NULL; - CsrWifiMacAddress peerAddress; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - CSR_TRANSMISSION_CONTROL transmissionControl = 0; - int r; - CSR_SIGNAL signal; - u32 priority_q; - CSR_RATE transmitRate = 0; - CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest; - unsigned long lock_flags; - - /* Send a Null Frame to Peer, size = 24 for MAC header */ - csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], MAC_HEADER_SIZE); - - if (csrResult != CSR_RESULT_SUCCESS) { - unifi_error(priv, "uf_send_nulldata: Failed to allocate memory for NULL frame\n"); - return ; - } - skb = (struct sk_buff *)(bulkdata.d[0].os_net_buf_ptr); - skb->len = 0; - bulkdata.d[0].os_data_ptr = skb->data; - bulkdata.d[0].os_net_buf_ptr = (unsigned char*)skb; - bulkdata.d[0].net_buf_length = bulkdata.d[0].data_length = skb->len; - bulkdata.d[1].os_data_ptr = NULL; - bulkdata.d[1].os_net_buf_ptr = NULL; - bulkdata.d[1].net_buf_length = bulkdata.d[1].data_length = 0; - - /* For null frames protection bit should not be set in MAC header, so passing value 0 below for protection field */ - if (prepare_and_add_macheader(priv, skb, newSkb, priority, &bulkdata, interfaceTag, da, interfacePriv->bssid.a, 0)) { - unifi_error(priv, "uf_send_nulldata: Failed to create MAC header\n"); - unifi_net_data_free(priv, &bulkdata.d[0]); - return; - } - memcpy(peerAddress.a, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN); - /* convert priority to queue */ - priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority); - transmissionControl &= ~(CSR_NO_CONFIRM_REQUIRED); - - /* Frame ma-packet.req, this is saved/transmitted depend on queue state - * send the null frame at data rate of 1 Mb/s for AP or 6 Mb/s for P2PGO - */ - switch (interfacePriv->interfaceMode) - { - case CSR_WIFI_ROUTER_CTRL_MODE_AP: - transmitRate = 2; - break; - case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO: - transmitRate = 12; - break; - default: - transmitRate = 0; - } - unifi_frame_ma_packet_req(priv, priority, transmitRate, INVALID_HOST_TAG, interfaceTag, - transmissionControl, priv->netdev_client->sender_id, - peerAddress.a, &signal); - - /* Save host tag to check the status on reception of MA packet confirm */ - srcStaInfo->nullDataHostTag = req->HostTag; - unifi_trace(priv, UDBG1, "uf_send_nulldata: STA AID = %d hostTag = %x\n", srcStaInfo->aid, req->HostTag); - - r = ul_send_signal_unpacked(priv, &signal, &bulkdata); - - if(r == -ENOSPC) { - unifi_trace(priv, UDBG1, "uf_send_nulldata: ENOSPC Requeue the Null frame\n"); - enque_tx_data_pdu(priv, &bulkdata, &srcStaInfo->dataPdu[priority_q], &signal, 1); - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - srcStaInfo->noOfPktQueued++; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - - - } - if(r && r != -ENOSPC){ - unifi_error(priv, "uf_send_nulldata: Failed to send Null frame Error = %d\n", r); - unifi_net_data_free(priv, &bulkdata.d[0]); - srcStaInfo->nullDataHostTag = INVALID_HOST_TAG; - } - - return; -} - -u8 uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata) -{ - u8 *bssid = NULL; - static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; - u8 toDs, fromDs; - - toDs = (((bulkdata->d[0].os_data_ptr)[1]) & 0x01) ? 1 : 0; - fromDs =(((bulkdata->d[0].os_data_ptr)[1]) & 0x02) ? 1 : 0; - - if (toDs && fromDs) - { - unifi_trace(priv, UDBG6, "Address 4 present, Don't try to find BSSID\n"); - bssid = NULL; - } - else if((toDs == 0) && (fromDs ==0)) - { - /* BSSID is Address 3 */ - bssid = (u8 *) (bulkdata->d[0].os_data_ptr + 4 + (2 * ETH_ALEN)); - } - else if(toDs) - { - /* BSSID is Address 1 */ - bssid = (u8 *) (bulkdata->d[0].os_data_ptr + 4); - } - else if(fromDs) - { - /* BSSID is Address 2 */ - bssid = (u8 *) (bulkdata->d[0].os_data_ptr + 4 + ETH_ALEN); - } - - if (memcmp(broadcast_address.a, bssid, ETH_ALEN)== 0) - { - return TRUE; - } - else - { - return FALSE; - } -} - - -u8 uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, - u8 pmBit, u16 interfaceTag) -{ - u8 moreData = FALSE; - u8 powerSaveChanged = FALSE; - unsigned long lock_flags; - - unifi_trace(priv, UDBG3, "entering uf_process_pm_bit_for_peer\n"); - if (pmBit) { - priv->allPeerDozing |= (0x01 << (srcStaInfo->assignedHandle)); - } else { - priv->allPeerDozing &= ~(0x01 << (srcStaInfo->assignedHandle)); - } - if(pmBit) { - if(srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) { - - /* disable the preemption */ - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - srcStaInfo->currentPeerState =CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE; - powerSaveChanged = TRUE; - /* enable the preemption */ - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - } else { - return powerSaveChanged; - } - } else { - if(srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) { - /* disable the preemption */ - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - srcStaInfo->currentPeerState = CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE; - powerSaveChanged = TRUE; - /* enable the preemption */ - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - }else { - return powerSaveChanged; - } - } - - - if(srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) { - unifi_trace(priv, UDBG3, "Peer with AID = %d is active now\n", srcStaInfo->aid); - process_peer_active_transition(priv, srcStaInfo, interfaceTag); - } else { - unifi_trace(priv, UDBG3, "Peer with AID = %d is in PS Now\n", srcStaInfo->aid); - /* Set TIM if needed */ - if(!srcStaInfo->wmmOrQosEnabled) { - moreData = (!list_empty(&srcStaInfo->mgtFrames) || - !list_empty(&srcStaInfo->dataPdu[UNIFI_TRAFFIC_Q_VO])|| - !list_empty(&srcStaInfo->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION])); - if(moreData && (srcStaInfo->timSet == CSR_WIFI_TIM_RESET)) { - unifi_trace(priv, UDBG3, "This condition should not occur\n"); - if (!srcStaInfo->timRequestPendingFlag){ - update_tim(priv, srcStaInfo->aid, 1, interfaceTag, srcStaInfo->assignedHandle); - } - else - { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - srcStaInfo->updateTimReqQueued = 1; - unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", srcStaInfo->updateTimReqQueued, - srcStaInfo->aid); - } - - } - } else { - u8 allDeliveryEnabled = 0, dataAvailable = 0; - unifi_trace(priv, UDBG5, "Qos in AP Mode\n"); - /* Check if all AC's are Delivery Enabled */ - is_all_ac_deliver_enabled_and_moredata(srcStaInfo, &allDeliveryEnabled, &dataAvailable); - /*check for more data in non-delivery enabled queues*/ - moreData = (uf_is_more_data_for_non_delivery_ac(srcStaInfo) || (allDeliveryEnabled && dataAvailable)); - - if(moreData && (srcStaInfo->timSet == CSR_WIFI_TIM_RESET)) { - if (!srcStaInfo->timRequestPendingFlag){ - update_tim(priv, srcStaInfo->aid, 1, interfaceTag, srcStaInfo->assignedHandle); - } - else - { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - srcStaInfo->updateTimReqQueued = 1; - unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", srcStaInfo->updateTimReqQueued, - srcStaInfo->aid); - } - } - } - } - unifi_trace(priv, UDBG3, "leaving uf_process_pm_bit_for_peer\n"); - return powerSaveChanged; -} - - - -void uf_process_ps_poll(unifi_priv_t *priv, u8* sa, u8* da, u8 pmBit, u16 interfaceTag) -{ - CsrWifiRouterCtrlStaInfo_t *staRecord = - CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, sa, interfaceTag); - tx_buffered_packets_t * buffered_pkt = NULL; - CsrWifiMacAddress peerMacAddress; - unsigned long lock_flags; - s8 r =0; - u8 moreData = FALSE; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - - unifi_trace(priv, UDBG3, "entering uf_process_ps_poll\n"); - if(!staRecord) { - memcpy(peerMacAddress.a, sa, ETH_ALEN); - unifi_trace(priv, UDBG3, "In uf_process_ps_poll, sta record not found:unexpected frame addr = %x:%x:%x:%x:%x:%x\n", - sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]); - CsrWifiRouterCtrlUnexpectedFrameIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress); - return; - } - - uf_process_pm_bit_for_peer(priv, staRecord, pmBit, interfaceTag); - - /* Update station last activity time */ - staRecord->activity_flag = TRUE; - - /* This should not change the PM bit as PS-POLL has PM bit always set */ - if(!pmBit) { - unifi_notice (priv, " PM bit reset in PS-POLL\n"); - return; - } - - if(IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag)) { - /* giving more priority to multicast packets so dropping ps-poll*/ - unifi_notice (priv, " multicast transmission is going on so don't take action on PS-POLL\n"); - return; - } - - if(!staRecord->wmmOrQosEnabled) { - if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->mgtFrames))) { - buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK; - moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) || - !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]) || - !list_empty(&staRecord->mgtFrames)); - - buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, moreData, FALSE)) == -ENOSPC) { - /* Clear the trigger bit transmission control*/ - buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, &staRecord->mgtFrames); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); - priv->pausedStaHandle[3]=(u8)(staRecord->assignedHandle); - } else { - if(r){ - unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - } - } else if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]))) { - buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK; - moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) || - !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO])); - - buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, moreData, FALSE)) == -ENOSPC) { - /* Clear the trigger bit transmission control*/ - buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - priv->pausedStaHandle[3]=(u8)(staRecord->assignedHandle); - unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); - } else { - if(r){ - unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - } - } else if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]))) { - buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK; - moreData = !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]); - - buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, moreData, FALSE)) == -ENOSPC) { - /* Clear the trigger bit transmission control*/ - buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - priv->pausedStaHandle[0]=(u8)(staRecord->assignedHandle); - unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); - } else { - if(r){ - unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - } - } else { - /* Actually since we have sent an ACK, there - * there is no need to send a NULL frame*/ - } - moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]) || - !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) || - !list_empty(&staRecord->mgtFrames)); - if(!moreData && (staRecord->timSet == CSR_WIFI_TIM_SET)) { - unifi_trace(priv, UDBG3, "more data = NULL, set tim to 0 in uf_process_ps_poll\n"); - if (!staRecord->timRequestPendingFlag){ - update_tim(priv, staRecord->aid, 0, interfaceTag, staRecord->assignedHandle); - } - else - { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - staRecord->updateTimReqQueued = 0; - unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, - staRecord->aid); - } - } - } else { - - u8 allDeliveryEnabled = 0, dataAvailable = 0; - unifi_trace(priv, UDBG3, "Qos Support station.Processing PS-Poll\n"); - - /*Send Data From Management Frames*/ - /* Priority orders for delivering the buffered packets are - * 1. Deliver the Management frames if there - * 2. Other access category frames which are non deliver enable including UNIFI_TRAFFIC_Q_VO - * priority is from VO->BK - */ - - /* Check if all AC's are Delivery Enabled */ - is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); - - if (allDeliveryEnabled) { - unifi_trace(priv, UDBG3, "uf_process_ps_poll: All ACs are delivery enable so Sending QOS Null in response of Ps-poll\n"); - uf_send_qos_null(priv, interfaceTag, sa, CSR_QOS_UP0, staRecord); - return; - } - - if (!list_empty(&staRecord->mgtFrames)) { - if ((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->mgtFrames))) { - /* We dont have packets in non delivery enabled UNIFI_TRAFFIC_Q_VO, So we are looking in management - * queue of the station record - */ - moreData = uf_is_more_data_for_non_delivery_ac(staRecord); - buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - - /* Last parameter is EOSP & its false always for PS-POLL processing */ - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, moreData, FALSE)) == -ENOSPC) { - /* Clear the trigger bit transmission control*/ - buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, &staRecord->mgtFrames); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - priv->pausedStaHandle[0]=(u8)(staRecord->assignedHandle); - unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); - } else { - if(r){ - unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - } - } else { - unifi_error(priv, "uf_process_ps_poll: Mgt frame list empty!! \n"); - } - - } else { - s8 i; - /* We dont have buffered packet in mangement frame queue (1 failed), So proceed with condition 2 - * UNIFI_TRAFFIC_Q_VO -> VI -> BE -> BK - */ - for(i= 3; i>=0; i--) { - if (!IS_DELIVERY_ENABLED(staRecord->powersaveMode[i])) { - /* Send One packet, if queue is NULL then continue */ - if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[i]))) { - moreData = uf_is_more_data_for_non_delivery_ac(staRecord); - - buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - - /* Last parameter is EOSP & its false always for PS-POLL processing */ - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, moreData, FALSE)) == -ENOSPC) { - /* Clear the trigger bit transmission control*/ - buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK); - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, &staRecord->dataPdu[i]); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - priv->pausedStaHandle[0]=(u8)(staRecord->assignedHandle); - unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n"); - } else { - if(r) { - unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - } - break; - } - } - } - } - /* Check if all AC's are Delivery Enabled */ - is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable); - /*check for more data in non-delivery enabled queues*/ - moreData = (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable)); - if(!moreData && (staRecord->timSet == CSR_WIFI_TIM_SET)) { - unifi_trace(priv, UDBG3, "more data = NULL, set tim to 0 in uf_process_ps_poll\n"); - if (!staRecord->timRequestPendingFlag){ - update_tim(priv, staRecord->aid, 0, interfaceTag, staRecord->assignedHandle); - } - else - { - /* Cache the TimSet value so that it will processed immidiatly after - * completing the current setTim Request - */ - staRecord->updateTimReqQueued = 0; - unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued, - staRecord->aid); - } - - } - } - - unifi_trace(priv, UDBG3, "leaving uf_process_ps_poll\n"); -} - - - -void add_to_send_cfm_list(unifi_priv_t * priv, - tx_buffered_packets_t *tx_q_item, - struct list_head *frames_need_cfm_list) -{ - tx_buffered_packets_t *send_cfm_list_item = NULL; - - send_cfm_list_item = kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC); - - if(send_cfm_list_item == NULL){ - unifi_warning(priv, "%s: Failed to allocate memory for new list item \n"); - return; - } - - INIT_LIST_HEAD(&send_cfm_list_item->q); - - send_cfm_list_item->hostTag = tx_q_item->hostTag; - send_cfm_list_item->interfaceTag = tx_q_item->interfaceTag; - send_cfm_list_item->transmissionControl = tx_q_item->transmissionControl; - send_cfm_list_item->leSenderProcessId = tx_q_item->leSenderProcessId; - send_cfm_list_item->rate = tx_q_item->rate; - memcpy(send_cfm_list_item->peerMacAddress.a, tx_q_item->peerMacAddress.a, ETH_ALEN); - send_cfm_list_item->priority = tx_q_item->priority; - - list_add_tail(&send_cfm_list_item->q, frames_need_cfm_list); -} - -void uf_prepare_send_cfm_list_for_queued_pkts(unifi_priv_t * priv, - struct list_head *frames_need_cfm_list, - struct list_head * list) -{ - tx_buffered_packets_t *tx_q_item = NULL; - struct list_head *listHead; - struct list_head *placeHolder; - unsigned long lock_flags; - - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - - /* Search through the list and if confirmation required for any frames, - add it to the send_cfm list */ - list_for_each_safe(listHead, placeHolder, list) { - tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); - - if(!tx_q_item) { - unifi_error(priv, "Entry should exist, otherwise it is a (BUG)\n"); - continue; - } - - /* check if confirmation is requested and if the sender ID - is not netdevice client then save the entry in the list for need cfms */ - if (!(tx_q_item->transmissionControl & CSR_NO_CONFIRM_REQUIRED) && - (tx_q_item->leSenderProcessId != priv->netdev_client->sender_id)){ - unifi_trace(priv, UDBG1, "%s: SenderProcessID=%x host tag=%x transmission control=%x\n", - __FUNCTION__, - tx_q_item->leSenderProcessId, - tx_q_item->hostTag, - tx_q_item->transmissionControl); - - add_to_send_cfm_list(priv, tx_q_item, frames_need_cfm_list); - } - } - - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - -} - - - -void uf_flush_list(unifi_priv_t * priv, struct list_head * list) -{ - tx_buffered_packets_t *tx_q_item; - struct list_head *listHead; - struct list_head *placeHolder; - unsigned long lock_flags; - - unifi_trace(priv, UDBG5, "entering the uf_flush_list \n"); - - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - /* go through list, delete & free memory */ - list_for_each_safe(listHead, placeHolder, list) { - tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); - - if(!tx_q_item) { - unifi_error(priv, "entry should exists, otherwise crashes (bug)\n"); - } - unifi_trace(priv, UDBG5, - "proccess_tx: in uf_flush_list peerMacAddress=%02X%02X%02X%02X%02X%02X senderProcessId=%x\n", - tx_q_item->peerMacAddress.a[0], tx_q_item->peerMacAddress.a[1], - tx_q_item->peerMacAddress.a[2], tx_q_item->peerMacAddress.a[3], - tx_q_item->peerMacAddress.a[4], tx_q_item->peerMacAddress.a[5], - tx_q_item->leSenderProcessId); - - list_del(listHead); - /* free the allocated memory */ - unifi_net_data_free(priv, &tx_q_item->bulkdata); - kfree(tx_q_item); - tx_q_item = NULL; - if (!priv->noOfPktQueuedInDriver) { - unifi_error(priv, "packets queued in driver 0 still decrementing in %s\n", __FUNCTION__); - } else { - priv->noOfPktQueuedInDriver--; - } - } - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); -} - -tx_buffered_packets_t *dequeue_tx_data_pdu(unifi_priv_t *priv, struct list_head *txList) -{ - /* dequeue the tx data packets from the appropriate queue */ - tx_buffered_packets_t *tx_q_item = NULL; - struct list_head *listHead; - struct list_head *placeHolder; - unsigned long lock_flags; - - unifi_trace(priv, UDBG5, "entering dequeue_tx_data_pdu\n"); - /* check for list empty */ - if (list_empty(txList)) { - unifi_trace(priv, UDBG5, "In dequeue_tx_data_pdu, the list is empty\n"); - return NULL; - } - - /* Verification, if packet count is negetive */ - if (priv->noOfPktQueuedInDriver == 0xFFFF) { - unifi_warning(priv, "no packet available in queue: debug"); - return NULL; - } - - /* return first node after header, & delete from the list && atleast one item exist */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_for_each_safe(listHead, placeHolder, txList) { - tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); - list_del(listHead); - break; - } - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - - if (tx_q_item) { - unifi_trace(priv, UDBG5, - "proccess_tx: In dequeue_tx_data_pdu peerMacAddress=%02X%02X%02X%02X%02X%02X senderProcessId=%x\n", - tx_q_item->peerMacAddress.a[0], tx_q_item->peerMacAddress.a[1], - tx_q_item->peerMacAddress.a[2], tx_q_item->peerMacAddress.a[3], - tx_q_item->peerMacAddress.a[4], tx_q_item->peerMacAddress.a[5], - tx_q_item->leSenderProcessId); - } - - unifi_trace(priv, UDBG5, "leaving dequeue_tx_data_pdu\n"); - return tx_q_item; -} -/* generic function to get the station record handler */ -CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(unifi_priv_t *priv, - const u8 *peerMacAddress, - u16 interfaceTag) -{ - u8 i; - netInterface_priv_t *interfacePriv; - unsigned long lock_flags; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "interfaceTag is not proper, interfaceTag = %d\n", interfaceTag); - return NULL; - } - - interfacePriv = priv->interfacePriv[interfaceTag]; - - /* disable the preemption until station record is fetched */ - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - - for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { - if (interfacePriv->staInfo[i]!= NULL) { - if (!memcmp(((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i]))->peerMacAddress.a, peerMacAddress, ETH_ALEN)) { - /* enable the preemption as station record is fetched */ - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - unifi_trace(priv, UDBG5, "peer entry found in station record\n"); - return ((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i])); - } - } - } - /* enable the preemption as station record is fetched */ - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - unifi_trace(priv, UDBG5, "peer entry not found in station record\n"); - return NULL; -} -/* generic function to get the station record handler from the handle */ -CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_priv_t *priv, - u32 handle, - u16 interfaceTag) -{ - netInterface_priv_t *interfacePriv; - - if ((handle >= UNIFI_MAX_CONNECTIONS) || (interfaceTag >= CSR_WIFI_NUM_INTERFACES)) { - unifi_error(priv, "handle/interfaceTag is not proper, handle = %d, interfaceTag = %d\n", handle, interfaceTag); - return NULL; - } - interfacePriv = priv->interfacePriv[interfaceTag]; - return ((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[handle])); -} - -/* Function to do inactivity */ -void uf_check_inactivity(unifi_priv_t *priv, u16 interfaceTag, u32 currentTime) -{ - u32 i; - CsrWifiRouterCtrlStaInfo_t *staInfo; - u32 elapsedTime; /* Time in microseconds */ - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - CsrWifiMacAddress peerMacAddress; - unsigned long lock_flags; - - if (interfacePriv == NULL) { - unifi_trace(priv, UDBG3, "uf_check_inactivity: Interface priv is NULL \n"); - return; - } - - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - /* Go through the list of stations to check for inactivity */ - for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { - staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv, i, interfaceTag); - if(!staInfo ) { - continue; - } - - unifi_trace(priv, UDBG3, "Running Inactivity handler Time %xus station's last activity %xus\n", - currentTime, staInfo->lastActivity); - - - elapsedTime = (currentTime >= staInfo->lastActivity)? - (currentTime - staInfo->lastActivity): - (~((u32)0) - staInfo->lastActivity + currentTime); - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - - if (elapsedTime > MAX_INACTIVITY_INTERVAL) { - memcpy((u8*)&peerMacAddress, (u8*)&staInfo->peerMacAddress, sizeof(CsrWifiMacAddress)); - - /* Indicate inactivity for the station */ - unifi_trace(priv, UDBG3, "Station %x:%x:%x:%x:%x:%x inactive since %xus\n sending Inactive Ind\n", - peerMacAddress.a[0], peerMacAddress.a[1], - peerMacAddress.a[2], peerMacAddress.a[3], - peerMacAddress.a[4], peerMacAddress.a[5], - elapsedTime); - - CsrWifiRouterCtrlStaInactiveIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress); - } - } - - interfacePriv->last_inactivity_check = currentTime; -} - -/* Function to update activity of a station */ -void uf_update_sta_activity(unifi_priv_t *priv, u16 interfaceTag, const u8 *peerMacAddress) -{ - u32 elapsedTime, currentTime; /* Time in microseconds */ - u32 timeHi; /* Not used - Time in microseconds */ - CsrWifiRouterCtrlStaInfo_t *staInfo; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - unsigned long lock_flags; - - if (interfacePriv == NULL) { - unifi_trace(priv, UDBG3, "uf_check_inactivity: Interface priv is NULL \n"); - return; - } - - currentTime = CsrTimeGet(&timeHi); - - - staInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, peerMacAddress, interfaceTag); - - if (staInfo == NULL) { - unifi_trace(priv, UDBG4, "Sta does not exist yet"); - return; - } - - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - /* Update activity */ - staInfo->lastActivity = currentTime; - - /* See if inactivity handler needs to be run - * Here it is theoretically possible that the counter may have wrapped around. But - * since we just want to know when to run the inactivity handler it does not really matter. - * Especially since this is data path it makes sense in keeping it simple and avoiding - * 64 bit handling */ - elapsedTime = (currentTime >= interfacePriv->last_inactivity_check)? - (currentTime - interfacePriv->last_inactivity_check): - (~((u32)0) - interfacePriv->last_inactivity_check + currentTime); - - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - - /* Check if it is time to run the inactivity handler */ - if (elapsedTime > INACTIVITY_CHECK_INTERVAL) { - uf_check_inactivity(priv, interfaceTag, currentTime); - } -} -void resume_unicast_buffered_frames(unifi_priv_t *priv, u16 interfaceTag) -{ - - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - u8 i; - int j; - tx_buffered_packets_t * buffered_pkt = NULL; - u8 hipslotFree[4] = {TRUE, TRUE, TRUE, TRUE}; - int r; - unsigned long lock_flags; - - while(!isRouterBufferEnabled(priv, 3) && - ((buffered_pkt=dequeue_tx_data_pdu(priv, &interfacePriv->genericMgtFrames))!=NULL)) { - buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK); - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, NULL, 0, FALSE)) == -ENOSPC) { - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, &interfacePriv->genericMgtFrames); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - hipslotFree[3]=FALSE; - break; - }else { - if(r){ - unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - } - } - for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { - CsrWifiRouterCtrlStaInfo_t *staInfo = interfacePriv->staInfo[i]; - if(!hipslotFree[0] && !hipslotFree[1] && !hipslotFree[2] && !hipslotFree[3]) { - unifi_trace(priv, UDBG3, "(ENOSPC) in resume_unicast_buffered_frames:: hip slots are full \n"); - break; - } - if (staInfo && (staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE)) { - while((( TRUE == hipslotFree[3] ) && (buffered_pkt=dequeue_tx_data_pdu(priv, &staInfo->mgtFrames)))) { - buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK); - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staInfo, 0, FALSE)) == -ENOSPC) { - unifi_trace(priv, UDBG3, "(ENOSPC) in resume_unicast_buffered_frames:: hip slots are full for voice queue\n"); - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, &staInfo->mgtFrames); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - priv->pausedStaHandle[3]=(u8)(staInfo->assignedHandle); - hipslotFree[3] = FALSE; - break; - } else { - if(r){ - unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - } - } - - for(j=3;j>=0;j--) { - if(!hipslotFree[j]) - continue; - - while((buffered_pkt=dequeue_tx_data_pdu(priv, &staInfo->dataPdu[j]))) { - buffered_pkt->transmissionControl &= - ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK); - if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staInfo, 0, FALSE)) == -ENOSPC) { - /* Enqueue at the head of the queue */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_add(&buffered_pkt->q, &staInfo->dataPdu[j]); - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - priv->pausedStaHandle[j]=(u8)(staInfo->assignedHandle); - hipslotFree[j]=FALSE; - break; - } else { - if(r){ - unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n"); - /* the PDU failed where we can't do any thing so free the storage */ - unifi_net_data_free(priv, &buffered_pkt->bulkdata); - } - kfree(buffered_pkt); - } - } - } - } - } -} -void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv, u16 interfaceTag) -{ - - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - unsigned long lock_flags; - struct list_head *listHead; - struct list_head *placeHolder; - tx_buffered_packets_t *tx_q_item; - - if (interfacePriv->noOfbroadcastPktQueued) { - - /* Update the EOSP to the HEAD of b/c list - * because we have received any mgmt packet so it should not hold for long time - * peer may time out. - */ - spin_lock_irqsave(&priv->tx_q_lock, lock_flags); - list_for_each_safe(listHead, placeHolder, &interfacePriv->genericMulticastOrBroadCastFrames) { - tx_q_item = list_entry(listHead, tx_buffered_packets_t, q); - tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_EOSP_MASK; - tx_q_item->transmissionControl = (tx_q_item->transmissionControl & ~(CSR_NO_CONFIRM_REQUIRED)); - unifi_trace(priv, UDBG1, "updating eosp for list Head hostTag:= 0x%x ", tx_q_item->hostTag); - break; - } - spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags); - } -} - -/* - * --------------------------------------------------------------------------- - * resume_suspended_uapsd - * - * This function takes care processing packets of Unscheduled Service Period, - * which been suspended earlier due to DTIM/HIP ENOSPC scenarios - * - * Arguments: - * priv Pointer to device private context struct - * interfaceTag For which resume should happen - * --------------------------------------------------------------------------- - */ -void resume_suspended_uapsd(unifi_priv_t* priv, u16 interfaceTag) -{ - - u8 startIndex; - CsrWifiRouterCtrlStaInfo_t * staInfo = NULL; - unsigned long lock_flags; - - unifi_trace(priv, UDBG2, "++resume_suspended_uapsd: \n"); - for(startIndex= 0; startIndex < UNIFI_MAX_CONNECTIONS;startIndex++) { - staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv, startIndex, interfaceTag); - - if(!staInfo || !staInfo->wmmOrQosEnabled) { - continue; - } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) - &&staInfo->uapsdActive && staInfo->uspSuspend) { - /* U-APSD Still active & previously suspended either ENOSPC of FH queues OR - * due to DTIM activity - */ - uf_handle_uspframes_delivery(priv, staInfo, interfaceTag); - } else { - unifi_trace(priv, UDBG2, "resume_suspended_uapsd: PS state=%x, uapsdActive?=%x, suspend?=%x\n", - staInfo->currentPeerState, staInfo->uapsdActive, staInfo->uspSuspend); - if (staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) - { - spin_lock_irqsave(&priv->staRecord_lock, lock_flags); - staInfo->uapsdActive = FALSE; - staInfo->uspSuspend = FALSE; - spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags); - } - } - } - unifi_trace(priv, UDBG2, "--resume_suspended_uapsd:\n"); -} - -#endif diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h deleted file mode 100644 index 37302f3c2f6c..000000000000 --- a/drivers/staging/csr/unifi_priv.h +++ /dev/null @@ -1,1136 +0,0 @@ -/* - ***************************************************************************** - * - * FILE : unifi_priv.h - * - * PURPOSE : Private header file for unifi driver. - * - * UDI = UniFi Debug Interface - * - * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - ***************************************************************************** - */ -#ifndef __LINUX_UNIFI_PRIV_H__ -#define __LINUX_UNIFI_PRIV_H__ 1 - -#include <linux/module.h> -#include <linux/string.h> -#include <linux/errno.h> -#include <linux/kernel.h> -#include <linux/wait.h> -#include <linux/sched.h> -#include <linux/delay.h> -#include <linux/netdevice.h> -#include <linux/wireless.h> -#include <linux/cdev.h> -#include <linux/kthread.h> -#include <linux/freezer.h> - -#ifdef CSR_WIFI_SUPPORT_MMC_DRIVER -#include <linux/mmc/core.h> -#include <linux/mmc/card.h> -#include <linux/mmc/host.h> -#include <linux/mmc/sdio_func.h> -#include <linux/mmc/sdio_ids.h> -#include <linux/mmc/sdio.h> -#endif /* CSR_WIFI_SUPPORT_MMC_DRIVER */ - -#include <linux/fs.h> - -#ifdef ANDROID_BUILD -#include <linux/wakelock.h> -#endif - -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_unifi_udi.h" -#include "csr_wifi_router_lib.h" -#include "unifiio.h" -#ifndef CSR_WIFI_HIP_TA_DISABLE -#include "csr_wifi_vif_utils.h" -#endif - -/* Define the unifi_priv_t before include the unifi_native.h */ -struct unifi_priv; -typedef struct unifi_priv unifi_priv_t; -#ifdef CSR_SUPPORT_WEXT_AP -struct CsrWifiSmeApConfig; -typedef struct CsrWifiSmeApConfig CsrWifiSmeApConfig_t; -#endif -#ifdef CSR_SUPPORT_WEXT -#include "unifi_wext.h" -#endif - -#ifdef ANDROID_BUILD -extern struct wake_lock unifi_sdio_wake_lock; -#endif - -#include "unifi_clients.h" - -#ifdef CSR_NATIVE_LINUX -#include "sme_native/unifi_native.h" -#else -#include "unifi_sme.h" -#endif - -/* The device major number to use when registering the udi driver */ -#define UNIFI_NAME "unifi" -/* - * MAX_UNIFI_DEVS defines the maximum number of UniFi devices that can be present. - * This number should be set to the number of SDIO slots supported by the SDIO - * host controller on the platform. - * Note: If MAX_UNIFI_DEVS value changes, fw_init[] needs to be corrected in drv.c - */ -#define MAX_UNIFI_DEVS 2 - -/* 802.11 Mac header offsets */ -#define MAC_HEADER_SIZE 24 -#define QOS_CONTROL_HEADER_SIZE 2 -#define HT_CONTROL_HEADER_SIZE 4 -#define QOS_DATA 0x8 -#define QOS_DATA_NULL 0xc -#define DATA_NULL 0x04 -#define FRAME_CONTROL_ORDER_BIT 0x8000 -#define FRAME_CONTROL_TYPE_FIELD_OFFSET 2 -#define FRAME_CONTROL_SUBTYPE_FIELD_OFFSET 4 -#define IEEE802_11_FRAMETYPE_DATA 0x02 -#define IEEE802_11_FRAMETYPE_CONTROL 0x01 -#define IEEE802_11_FRAMETYPE_MANAGEMENT 0x00 -#define IEEE802_11_FRAMETYPE_RESERVED 0x03 - -/* octet offset from start of mac header for certain fields */ -#define IEEE802_11_ADDR3_OFFSET 16 -#define IEEE802_11_SEQUENCE_CONTROL_OFFSET 22 -#define IEEE802_11_MAX_DATA_LEN 2304 - -/* frame control (FC) masks, for frame control as 16 bit integer */ -#define IEEE802_11_FC_TO_DS_MASK 0x100 -#define IEEE802_11_FC_FROM_DS_MASK 0x200 -#define IEEE802_11_FC_MOREDATA_MASK 0x2000 -#define IEEE802_11_FC_PROTECTED_MASK 0x4000 -#define IEEE80211_FC_ORDER_MASK 0x8000 -#define IEEE80211_FC_SUBTYPE_MASK 0x00f0 -#define IEEE80211_FC_TYPE_MASK 0x000c -#define IEEE80211_FC_PROTO_VERSION_MASK 0x0003 - -/* selected type and subtype combinations as in 7.1.3.1 table 1 - For frame control as 16 bit integer, or for ls octet -*/ -#define IEEE802_11_FC_TYPE_DATA 0x08 -#define IEEE802_11_FC_TYPE_NULL 0x48 -#define IEEE802_11_FC_TYPE_QOS_NULL 0xc8 -#define IEEE802_11_FC_TYPE_QOS_DATA 0x88 - -#define IEEE802_11_FC_TYPE_DATA_SUBTYPE_RESERVED 0x0D - -/* qos control (QC) masks for qos control as 16 bit integer, or for ls octet */ -#define IEEE802_11_QC_TID_MASK 0x0f -#define IEEE802_11_QC_A_MSDU_PRESENT 0x80 - -#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND)) -#define IEEE802_11_QC_NON_TID_BITS_MASK 0xFFF0 -#endif - -#define CSR_WIFI_EAPOL_M4_HOST_TAG 0x50000000 -#define IEEE802_11_DATA_FRAME_MAC_HEADER_SIZE 36 -#define MAX_ACCESS_CATOGORY 4 - -/* Time in us to check for inactivity of stations 5 mins */ -#define INACTIVITY_CHECK_INTERVAL 300000000 -/* Time in us before a station is flagged as inactive */ -#define MAX_INACTIVITY_INTERVAL 300000000 - - -/* Define for maximum BA session */ -#define MAX_SUPPORTED_BA_SESSIONS_TX 1 -#define MAX_SUPPORTED_BA_SESSIONS_RX 4 - -#define MAX_BA_WIND_SIZE 64 -#define MAC_HEADER_ADDR1_OFFSET 4 -#define MAC_HEADER_ADDR2_OFFSET 10 - -/* Define for age (in us) value for frames in MPDU reorder buffer */ -#define CSR_WIFI_BA_MPDU_FRAME_AGE_TIMEOUT 30000 /* 30 milli seconds */ - -/* This macro used in prepare_and_add_macheader*/ -#define ADDRESS_ONE_OFFSET 20 - -/* Defines for STA inactivity detection */ -#define STA_INACTIVE_DETECTION_TRIGGER_THRESHOLD 1 /* in number of stations */ -#define STA_INACTIVE_DETECTION_TIMER_INTERVAL 30 /* in seconds */ -#define STA_INACTIVE_TIMEOUT_VAL 120*1000*1000 /* 120 seconds */ - -/* Test for modes requiring AP firmware patch */ -#define CSR_WIFI_HIP_IS_AP_FW(mode) ((((mode) == CSR_WIFI_ROUTER_CTRL_MODE_AP) || \ - ((mode) == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)) ? TRUE : FALSE) - -/* Defines used in beacon filtering in case of P2P */ -#define CSR_WIFI_P2P_WILDCARD_SSID_LENGTH 0x7 -#define CSR_WIFI_80211_FRAME_SUBTYPE_BEACON 0x8 -#define CSR_WIFI_BEACON_FIXED_LENGTH 12 -#define CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET 4 -#define CSR_WIFI_80211_FRAME_SUBTYPE_BIT_MASK ((u8)(0xF << CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET)) - -#define CSR_WIFI_80211_GET_FRAME_SUBTYPE(frameBuffer) \ - ((u8)(((u8 *)frameBuffer)[0] & CSR_WIFI_80211_FRAME_SUBTYPE_BIT_MASK) >> CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET) - -/* For M4 request received via netdev*/ - -typedef u8 CsrWifiPacketType; -#define CSR_WIFI_UNICAST_PDU ((CsrWifiPacketType) 0x00) -#define CSR_WIFI_MULTICAST_PDU ((CsrWifiPacketType) 0x1) -#define CSR_WIFI_BROADCAST_PDU ((CsrWifiPacketType) 0x2) - -#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20) - -/* Module parameter variables */ -extern int buswidth; -extern int sdio_clock; -extern int use_5g; -extern int disable_hw_reset; -extern int disable_power_control; -extern int enable_wol; -extern int sme_debug; -extern int fw_init[MAX_UNIFI_DEVS]; -extern int tl_80211d; -extern int sdio_byte_mode; -extern int sdio_block_size; -extern int coredump_max; -extern int run_bh_once; -extern int bh_priority; -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -extern int log_hip_signals; -#endif - -struct dlpriv { - const unsigned char *dl_data; - int dl_len; - void *fw_desc; -}; - - -struct uf_thread { - - struct task_struct *thread_task; - - /* wait_queue for waking the unifi_thread kernel thread */ - wait_queue_head_t wakeup_q; - unsigned int wakeup_flag; - - /* - * Use it to block the I/O thread when - * an error occurs or UniFi is reinitialised. - */ - int block_thread; - - char name[16]; - int prio; -}; - -/* - * Link list to hold the received packets for the period the port - * remains closed. - */ -typedef struct rx_buffered_packets { - /* List link structure */ - struct list_head q; - /* Packet to indicate when the port reopens */ - struct sk_buff *skb; - /* Bulkdata to free in case the port closes and need to discard the packet */ - bulk_data_param_t bulkdata; - /* The source address of the packet */ - CsrWifiMacAddress sa; - /* The destination address of the packet */ - CsrWifiMacAddress da; - /* Corresponding signal */ - CSR_SIGNAL signal; -} rx_buffered_packets_t; - - -typedef u8 CsrWifiAcPowersaveMode; -#define CSR_WIFI_AC_TRIGGER_ONLY_ENABLED 0x00 -#define CSR_WIFI_AC_DELIVERY_ONLY_ENABLE 0X01 -#define CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED 0X03 -#define CSR_WIFI_AC_LEGACY_POWER_SAVE 0X02 - - -#define IS_DELIVERY_ENABLED(mode) (mode & CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)? 1: 0 -#define IS_DELIVERY_AND_TRIGGER_ENABLED(mode) ((mode & CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)||(mode & CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED))? 1: 0 -#define IS_DTIM_ACTIVE(flag, hostTag) ((flag == TRUE || hostTag != INVALID_HOST_TAG)) -#define INVALID_HOST_TAG 0xFFFFFFFF -#define UNIFI_TRAFFIC_Q_CONTENTION UNIFI_TRAFFIC_Q_BE - - - - -/* Queue to be used for contention priority */ - -/* - * Link list to hold the tx packets for the period the peer - * powersave/free slots in unifi - */ -typedef struct tx_buffered_packets { - /* List link structure */ - struct list_head q; - u16 interfaceTag; - CSR_CLIENT_TAG hostTag; - CSR_PROCESS_ID leSenderProcessId; - CSR_TRANSMISSION_CONTROL transmissionControl; - CSR_RATE rate; - /* Bulkdata to free in case the port closes and need to discard the packet */ - bulk_data_desc_t bulkdata; - /* The source address of the packet */ - CsrWifiMacAddress peerMacAddress; - CSR_PRIORITY priority; -} tx_buffered_packets_t; - -/* station record has this data structure */ -typedef struct CsrWifiRouterCtrlStaInfo_t { - - /* Sme sends these parameters */ - CsrWifiMacAddress peerMacAddress; - u32 assignedHandle; - u8 wmmOrQosEnabled; - CsrWifiAcPowersaveMode powersaveMode[MAX_ACCESS_CATOGORY]; - u16 maxSpLength; - u8 uapsdActive; - u16 noOfSpFramesSent; - - /* Router/Driver database */ -#ifdef CSR_SUPPORT_SME - unifi_port_cfg_t *peerControlledPort; - unifi_port_cfg_t *peerUnControlledPort; - - /* Inactivity feature parameters */ - struct netInterface_priv *interfacePriv; - struct work_struct send_disconnected_ind_task; - u8 activity_flag; - u16 listenIntervalInTus; - CSR_CLIENT_TAG nullDataHostTag; - - /* Activity timestamps for the station */ - u32 lastActivity; - - /* during m/c transmission sp suspended */ - u8 uspSuspend; - CSR_PRIORITY triggerFramePriority; -#endif - CsrWifiRouterCtrlPeerStatus currentPeerState; - struct list_head dataPdu[MAX_ACCESS_CATOGORY]; - struct list_head mgtFrames; - u8 spStatus; - u8 prevFrmType; - u8 prevFrmAccessCatogory; - u8 protection; - u16 aid; - u8 txSuspend; - u8 timSet; - /* Dont change the value of below macro for SET & RESET */ -#define CSR_WIFI_TIM_RESET 0 -#define CSR_WIFI_TIM_SET 1 -#define CSR_WIFI_TIM_RESETTING 2 -#define CSR_WIFI_TIM_SETTING 3 - - u8 timRequestPendingFlag; - u8 updateTimReqQueued; - u16 noOfPktQueued; -}CsrWifiRouterCtrlStaInfo_t; - -#ifdef CSR_SUPPORT_WEXT_AP -struct CsrWifiSmeApConfig { - CsrWifiSsid ssid; - u16 channel; - CsrWifiNmeApCredentials credentials; - u8 max_connections; - u8 if_index; -}; -#endif - -#ifdef CSR_WIFI_RX_PATH_SPLIT -/* This is a test code and may be removed later*/ -#define CSR_WIFI_RX_SIGNAL_BUFFER_SIZE (60+1) - -typedef struct -{ - u8 *bufptr; /* Signal Primitive */ - bulk_data_param_t data_ptrs; /* Bulk Data pointers */ - u16 sig_len; -}rx_buff_struct_t; - -typedef struct -{ - u8 writePointer; /**< write pointer */ - u8 readPointer; /**< read pointer */ - u8 size; /**< size of circular buffer */ - rx_buff_struct_t rx_buff[CSR_WIFI_RX_SIGNAL_BUFFER_SIZE]; /**< Element of ciruclar buffer */ -} rxCircularBuffer_t; - -void rx_wq_handler(struct work_struct *work); -#endif - -struct unifi_priv { - - card_t *card; - CsrSdioFunction *sdio; - - /* Index into Unifi_instances[] for this device. */ - int instance; - /* Reference count for this instance */ - int ref_count; - - /* Firmware images */ - struct dlpriv fw_sta; - struct dlpriv fw_conv; /* used for conversion of production test image */ - - /* Char device related structures */ - struct cdev unifi_cdev; - struct cdev unifiudi_cdev; - struct device *unifi_device; - - /* Which wireless interface to use (1 - 2.4GHz, 2 - 5GHz) */ - CSR_IFINTERFACE if_index; - - /* For multiple interface support */ - struct net_device *netdev[CSR_WIFI_NUM_INTERFACES]; - struct netInterface_priv *interfacePriv[CSR_WIFI_NUM_INTERFACES]; - - u8 totalInterfaceCount; - - int prev_queue; - - /* Name of node under /proc */ - char proc_entry_name[64]; - - /* - * Flags: - * drop_unencrypted - * - Not used? - * netdev_registered - * - whether the netdev has been registered. - */ - unsigned int drop_unencrypted : 1; - - /* Our list of unifi linux clients. */ - ul_client_t ul_clients[MAX_UDI_CLIENTS]; - - /* Mutex to protect using the logging hook after UDI client is gone */ - struct semaphore udi_logging_mutex; - /* Pointer to the ul_clients[] array */ - ul_client_t *logging_client; - - /* A ul_client_t* used to send the netdev related MIB requests. */ - ul_client_t *netdev_client; - - /* The SME ul_client_t pointer. */ - ul_client_t *sme_cli; - - /* The AMP ul_client_t pointer. */ - ul_client_t *amp_client; - - /* - * Semaphore for locking the top-half to one user process. - * This is necessary to prevent multiple processes calling driver - * operations. This can happen because the network driver entry points - * can be called from multiple processes. - */ -#ifdef USE_DRIVER_LOCK - struct semaphore lock; -#endif /* USE_DRIVER_LOCK */ - - /* Flag to say that an operation was aborted */ - int io_aborted; - - struct uf_thread bh_thread; - -#define UNIFI_INIT_NONE 0x00 -#define UNIFI_INIT_IN_PROGRESS 0x01 -#define UNIFI_INIT_FW_DOWNLOADED 0x02 -#define UNIFI_INIT_COMPLETED 0x04 - unsigned char init_progress; - - int sme_is_present; - - /* The WMM features that UniFi uses in the current BSS */ - unsigned int sta_wmm_capabilities; - - /* Debug only */ - char last_debug_string[256]; - unsigned short last_debug_word16[16]; - -#ifdef CSR_SUPPORT_SME - /* lock to protect the tx queues list */ - spinlock_t tx_q_lock; - u8 allPeerDozing; - u8 pausedStaHandle[MAX_ACCESS_CATOGORY]; - /* Max packet the driver can queue, irrespective of interface number */ - u16 noOfPktQueuedInDriver; -#define CSR_WIFI_DRIVER_SUPPORT_FOR_MAX_PKT_QUEUEING 512 -#define CSR_WIFI_DRIVER_MAX_PKT_QUEUING_THRESHOLD_PER_PEER 64 -#define CSR_WIFI_DRIVER_MINIMUM_BROADCAST_PKT_THRESHOLD 3 - - u8 routerBufferEnable[MAX_ACCESS_CATOGORY]; - /* lock to protect stainfo members and priv members*/ - spinlock_t staRecord_lock; -#endif -#ifdef CSR_NATIVE_LINUX -#ifdef CSR_SUPPORT_WEXT - /* wireless config */ - struct wext_config wext_conf; -#endif - - /* Mutex to protect the MLME blocking requests */ - struct semaphore mlme_blocking_mutex; - - /* The ul_client that provides the blocking API for WEXT calls */ - ul_client_t *wext_client; - -#endif /* CSR_NATIVE_LINUX */ - -#ifdef CSR_SUPPORT_SME - wait_queue_head_t sme_request_wq; - /* Semaphore to protect the SME blocking requests */ - struct semaphore sme_sem; - /* Structure to hold the SME blocking requests data*/ - sme_reply_t sme_reply; - - /* Structure to hold a traffic protocol indication */ - struct ta_ind { - struct work_struct task; - CsrWifiRouterCtrlTrafficPacketType packet_type; - CsrWifiRouterCtrlProtocolDirection direction; - CsrWifiMacAddress src_addr; - int in_use; - } ta_ind_work; - - struct ta_sample_ind { - struct work_struct task; - CsrWifiRouterCtrlTrafficStats stats; - int in_use; - } ta_sample_ind_work; - - __be32 sta_ip_address; - CsrWifiRouterCtrlSmeVersions sme_versions; - - /* - * Flag to reflect state of unifi_sys_wifi_on_*() progress. - * This indicates whether we are in an "wifi on" state when we are - * allowed to indication errors with unifi_mgt_wifi_off_ind() - */ - enum { - wifi_on_unspecified = -1, - wifi_on_in_progress = 0, - wifi_on_done = 1, - } wifi_on_state; - - /* Userspace TaskId for the SME Set when a wifi on req is received */ - CsrSchedQid CSR_WIFI_SME_IFACEQUEUE; - - struct work_struct multicast_list_task; - /* - * The SME installs filters to ask for specific MA-UNITDATA.req - * to be passed to different SME components. - */ -#define MAX_MA_UNIDATA_IND_FILTERS 8 - sme_ma_unidata_ind_filter_t sme_unidata_ind_filters[MAX_MA_UNIDATA_IND_FILTERS]; - -/* UNIFI_CFG related parameters */ - uf_cfg_bcast_packet_filter_t packet_filters; - unsigned char *filter_tclas_ies; - /* The structure that holds all the connection configuration. */ - CsrWifiSmeConnectionConfig connection_config; -#ifdef CSR_SUPPORT_WEXT - - int ignore_bssid_join; - struct iw_statistics wext_wireless_stats; - - /* The MIB and MAC address files contents, read from userspace */ - CsrWifiSmeDataBlock mib_data; - CsrWifiMacAddress sta_mac_address; - - int wep_tx_key_index; - wep_key_t wep_keys[NUM_WEPKEYS]; - - -#ifdef CSR_SUPPORT_WEXT_AP - CsrWifiSmeApMacConfig ap_mac_config; - CsrWifiNmeApConfig group_sec_config; - CsrWifiSmeApConfig_t ap_config; -#endif - struct work_struct sme_config_task; - -#endif /* CSR_SUPPORT_WEXT */ - -#endif /* CSR_SUPPORT_SME */ - -#ifdef CSR_SME_USERSPACE - void *smepriv; -#endif /* CSR_SME_USERSPACE */ - - card_info_t card_info; - - /* Mutex to protect unifi_send_signal() */ - spinlock_t send_signal_lock; - - - /* - * The workqueue to offload the TA run - * and the multicast addresses list set - */ - struct workqueue_struct *unifi_workqueue; - - unsigned char *mib_cfm_buffer; - unsigned int mib_cfm_buffer_length; - - int ptest_mode; /* Set when in production test mode */ - int coredump_mode; /* Set when SME has requested a coredump */ - u8 wol_suspend; /* Set when suspending with UniFi powered */ - -#define UF_UNCONTROLLED_PORT_Q 0 -#define UF_CONTROLLED_PORT_Q 1 - - /* Semaphore to protect the rx queues list */ - struct semaphore rx_q_sem; - - /* Spinlock to protect M4 data */ - spinlock_t m4_lock; - /* Mutex to protect BA RX data */ - struct semaphore ba_mutex; - -#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) - /* Spinlock to protect the WAPI data */ - spinlock_t wapi_lock; -#endif - - /* Array to indicate if a particular Tx queue is paused, this may not be - * required in a multiqueue implementation since we can directly stop kernel - * queues */ - u8 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX]; - -#ifdef CSR_WIFI_RX_PATH_SPLIT - struct workqueue_struct *rx_workqueue; - struct work_struct rx_work_struct; - rxCircularBuffer_t rxSignalBuffer; - -#endif - - u32 rxTcpThroughput; - u32 txTcpThroughput; - u32 rxUdpThroughput; - u32 txUdpThroughput; - -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - /*Set if multicast KeyID = 1*/ - u8 wapi_multicast_filter; - /*Set if unicast KeyID = 1*/ - u8 wapi_unicast_filter; - u8 wapi_unicast_queued_pkt_filter; -#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND - u8 isWapiConnection; -#endif -#endif - -#ifdef CSR_WIFI_SPLIT_PATCH - CsrWifiRouterCtrlModeSetReq pending_mode_set; -#endif - - u8 cmanrTestMode; - CSR_RATE cmanrTestModeTransmitRate; - -}; - -typedef struct { - u16 queue_length[4]; - u8 os_queue_paused; -} unifi_OsQosInfo; - - -typedef struct { - u8 active; - bulk_data_param_t bulkdata; - CSR_SIGNAL signal; - u16 sn; - u32 recv_time; -} frame_desc_struct; - -typedef struct { - frame_desc_struct *buffer; - u16 wind_size; - u16 occupied_slots; - struct timer_list timer; - u16 timeout; - u16 expected_sn; - u16 start_sn; - u8 trigger_ba_after_ssn; - struct netInterface_priv *interfacePriv; - u16 tID; - CsrWifiMacAddress macAddress; - struct work_struct send_ba_err_task; -} ba_session_rx_struct; - - -typedef struct { - struct netInterface_priv *interfacePriv; - u16 tID; - CsrWifiMacAddress macAddress; -} ba_session_tx_struct; - -typedef struct netInterface_priv -{ - u16 InterfaceTag; - struct unifi_priv *privPtr; - ba_session_tx_struct *ba_session_tx[MAX_SUPPORTED_BA_SESSIONS_TX]; - ba_session_rx_struct *ba_session_rx[MAX_SUPPORTED_BA_SESSIONS_RX]; - frame_desc_struct ba_complete[MAX_BA_WIND_SIZE]; - u8 ba_complete_index; - u8 queueEnabled[UNIFI_NO_OF_TX_QS]; - struct work_struct send_m4_ready_task; -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - struct work_struct send_pkt_to_encrypt; -#endif - struct net_device_stats stats; - u8 interfaceMode; - u8 protect; - CsrWifiMacAddress bssid; - /* - * Flag to reflect state of CONNECTED indication signal. - * This indicates whether we are "joined" an Access Point (i.e. have - * nominated an AP and are receiving beacons) but give no indication - * of whether we are authenticated and/or associated. - */ - enum { - UnifiConnectedUnknown = -1, - UnifiNotConnected = 0, - UnifiConnected = 1, - } connected; -#ifdef CSR_SUPPORT_WEXT - /* Tracks when we are waiting for a netdevice state change callback */ - u8 wait_netdev_change; - /* True if we have successfully registered for netdev callbacks */ - u8 netdev_callback_registered; -#endif /* CSR_SUPPORT_WEXT */ - unsigned int netdev_registered; -#define UNIFI_MAX_MULTICAST_ADDRESSES 10 - /* The multicast addresses list that the thread needs to set. */ - u8 mc_list[UNIFI_MAX_MULTICAST_ADDRESSES*ETH_ALEN]; - /* The multicast addresses count that the thread needs to set. */ - int mc_list_count; - u32 tag; -#ifdef CSR_SUPPORT_SME - /* (un)controlled port configuration */ - unifi_port_config_t controlled_data_port; - unifi_port_config_t uncontrolled_data_port; - - /* station record maintenance related data structures */ - u8 num_stations_joined; - CsrWifiRouterCtrlStaInfo_t *(staInfo)[UNIFI_MAX_CONNECTIONS]; - struct list_head genericMgtFrames; - struct list_head genericMulticastOrBroadCastFrames; - struct list_head genericMulticastOrBroadCastMgtFrames; - - /* Timer for detecting station inactivity */ - struct timer_list sta_activity_check_timer; - u8 sta_activity_check_enabled; - - /* Timestamp when the last inactivity check was done */ - u32 last_inactivity_check; - - /*number of multicast or borad cast packets queued*/ - u16 noOfbroadcastPktQueued; -#endif - /* A list to hold the buffered uncontrolled port packets */ - struct list_head rx_uncontrolled_list; - /* A list to hold the buffered controlled port packets */ - struct list_head rx_controlled_list; - /* Buffered M4 signal to take care of WPA race condition */ - CSR_SIGNAL m4_signal; - bulk_data_desc_t m4_bulk_data; - -#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) - /* Buffered WAPI Unicast MA Packet Request for encryption in Sme */ - CSR_SIGNAL wapi_unicast_ma_pkt_sig; - bulk_data_desc_t wapi_unicast_bulk_data; -#endif - - /* This should be removed and m4_hostTag should be used for checking*/ - u8 m4_sent; - CSR_CLIENT_TAG m4_hostTag; - u8 dtimActive; - u8 intraBssEnabled; - u32 multicastPduHostTag; /* Used to set the tim after getting - a confirm for it */ - u8 bcTimSet; - u8 bcTimSetReqPendingFlag; - u8 bcTimSetReqQueued; -} netInterface_priv_t; - -#ifdef CSR_SUPPORT_SME -#define routerStartBuffering(priv, queue) priv->routerBufferEnable[(queue)] = TRUE; -#define routerStopBuffering(priv, queue) priv->routerBufferEnable[(queue)] = FALSE; -#define isRouterBufferEnabled(priv, queue) priv->routerBufferEnable[(queue)] -#endif - -#ifdef USE_DRIVER_LOCK -#define LOCK_DRIVER(_p) down_interruptible(&(_p)->lock) -#define UNLOCK_DRIVER(_p) up(&(_p)->lock) -#else -#define LOCK_DRIVER(_p) (void)(_p); /* as nothing */ -#define UNLOCK_DRIVER(_p) (void)(_p); /* as nothing */ -#endif /* USE_DRIVER_LOCK */ - -s32 CsrHipResultToStatus(CsrResult csrResult); - - -/* - * SDIO related functions and callbacks - */ -int uf_sdio_load(void); -void uf_sdio_unload(void); -unifi_priv_t *uf_find_instance(int inst); -int uf_find_priv(unifi_priv_t *priv); -int uf_find_netdev_priv(netInterface_priv_t *priv); -unifi_priv_t *uf_get_instance(int inst); -void uf_put_instance(int inst); -int csr_sdio_linux_install_irq(CsrSdioFunction *sdio); -int csr_sdio_linux_remove_irq(CsrSdioFunction *sdio); - -void uf_add_os_device(int bus_id, struct device *os_device); -void uf_remove_os_device(int bus_id); - - - -/* - * Claim/release SDIO - * - * For multifunction cards, we cannot grub the SDIO lock around the unifi_bh() - * as this prevents other functions using SDIO. - * Since some of CSR SDIO API is used regardless of trying to lock unifi_bh() - * we have followed this scheme: - * 1. If a function needs protection only when CSR_WIFI_SINGLE_FUNCTION is defined - * then we call CsrSdioClaim/CsrSdioRelease(). - * 2. If a function needs protection only when CSR_WIFI_SINGLE_FUNCTION is not defined - * then we call _sdio_claim_host/_sdio_claim_host(). Use of this should be restricted - * to the SDIO glue layer only (e.g. sdio_mmc.c). - * 3. If a function needs protection, regardless of the CSR_WIFI_SINGLE_FUNCTION - * then we call directly the sdio_claim_host/sdio_release_host(). - * Use of this must be restricted to the SDIO glue layer only (e.g. sdio_mmc.c). - * - * Note: The _func and function pointers are _not_ the same. - * The former is the (struct sdio_func*) context, which restricts the use to the SDIO glue layer. - * The latter is the (CsrSdioFunction*) context, which allows calls from all layers. - */ - -#ifdef CSR_WIFI_SUPPORT_MMC_DRIVER - -#ifdef CSR_WIFI_SINGLE_FUNCTION -#define CsrSdioClaim(function) sdio_claim_host((function)->priv); -#define CsrSdioRelease(function) sdio_release_host((function)->priv); - -#define _sdio_claim_host(_func) -#define _sdio_release_host(_func) - -#else -#define CsrSdioClaim(function) -#define CsrSdioRelease(function) - -#define _sdio_claim_host(_func) sdio_claim_host(_func) -#define _sdio_release_host(_func) sdio_release_host(_func) - -#endif /* CSR_WIFI_SINGLE_FUNCTION */ - -#else -#define _sdio_claim_host(_func) -#define _sdio_release_host(_func) - -#define CsrSdioClaim(function) -#define CsrSdioRelease(function) - -#endif /* CSR_WIFI_SUPPORT_MMC_DRIVER */ - - -/* - * Functions to allocate and free an ethernet device. - */ -unifi_priv_t *uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id); -int uf_free_netdevice(unifi_priv_t *priv); - -/* Allocating function for other interfaces */ -u8 uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, u16 interfaceTag); - -/* - * Firmware download related functions. - */ -int uf_run_unifihelper(unifi_priv_t *priv); -int uf_request_firmware_files(unifi_priv_t *priv, int is_fw); -int uf_release_firmware_files(unifi_priv_t *priv); -int uf_release_firmware(unifi_priv_t *priv, struct dlpriv *to_free); - -/* - * Functions to create and delete the device nodes. - */ -int uf_create_device_nodes(unifi_priv_t *priv, int bus_id); -void uf_destroy_device_nodes(unifi_priv_t *priv); - -/* - * Upper Edge Initialisation functions - */ -int uf_init_bh(unifi_priv_t *priv); -int uf_init_hw(unifi_priv_t *priv); - -/* Thread related helper functions */ -int uf_start_thread(unifi_priv_t *priv, struct uf_thread *thread, int (*func)(void *)); -void uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread); -void uf_wait_for_thread_to_stop(unifi_priv_t *priv, struct uf_thread *thread); - - -/* - * Unifi Linux functions - */ -void ul_init_clients(unifi_priv_t *priv); - -/* Configuration flags */ -#define CLI_USING_WIRE_FORMAT 0x0002 -#define CLI_SME_USERSPACE 0x0020 -ul_client_t *ul_register_client(unifi_priv_t *priv, - unsigned int configuration, - udi_event_t udi_event_clbk); -int ul_deregister_client(ul_client_t *pcli); - -int ul_send_signal_unpacked(unifi_priv_t *priv, - CSR_SIGNAL *sigptr, - bulk_data_param_t *bulkdata); -int ul_send_signal_raw(unifi_priv_t *priv, - unsigned char *sigptr, int siglen, - bulk_data_param_t *bulkdata); - -void ul_log_config_ind(unifi_priv_t *priv, u8 *conf_param, int len); - - -/* - * Data plane operations - */ -/* - * data_tx.c - */ -int uf_verify_m4(unifi_priv_t *priv, const unsigned char *packet, - unsigned int length); - -#ifdef CSR_SUPPORT_SME -u8 uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata); -u8 uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, u8 pmBit, u16 interfaceTag); -void uf_process_ps_poll(unifi_priv_t *priv, u8* sa, u8* da, u8 pmBit, u16 interfaceTag); -int uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb, - struct ethhdr *ehdr, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, - const CSR_SIGNAL *signal, - bulk_data_param_t *bulkdata, - u8 macHeaderLengthInBytes); -u8 uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord); -void uf_process_wmm_deliver_ac_uapsd ( unifi_priv_t * priv, - CsrWifiRouterCtrlStaInfo_t * srcStaInfo, - u16 qosControl, - u16 interfaceTag); - -void uf_send_buffered_data_from_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, u8 queue, struct list_head *txList); -void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, u8 queue, struct list_head *txList); - -void uf_continue_uapsd(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo); -void uf_send_qos_null(unifi_priv_t * priv, u16 interfaceTag, const u8 *da, CSR_PRIORITY priority, CsrWifiRouterCtrlStaInfo_t * srcStaInfo); -void uf_send_nulldata(unifi_priv_t * priv, u16 interfaceTag, const u8 *da, CSR_PRIORITY priority, CsrWifiRouterCtrlStaInfo_t * srcStaInfo); - - - -#endif -CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, u8 *peerMacAddress, CSR_CLIENT_TAG hostTag, u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, CSR_RATE TransmitRate, CSR_PRIORITY priority, CSR_PROCESS_ID senderId, bulk_data_param_t *bulkdata); -void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv, u8 *sigdata, u32 siglen); -#ifdef CSR_SUPPORT_SME -void uf_send_buffered_frames(unifi_priv_t *priv, unifi_TrafficQueue queue); -int uf_process_station_records_for_sending_data(unifi_priv_t *priv, u16 interfaceTag, - CsrWifiRouterCtrlStaInfo_t *srcStaInfo, - CsrWifiRouterCtrlStaInfo_t *dstStaInfo); -void uf_prepare_send_cfm_list_for_queued_pkts(unifi_priv_t * priv, - struct list_head *frames_need_cfm_list, - struct list_head * list); -void send_auto_ma_packet_confirm(unifi_priv_t *priv, - netInterface_priv_t *interfacePriv, - struct list_head *buffered_frames_list); -void uf_flush_list(unifi_priv_t * priv, struct list_head * list); -tx_buffered_packets_t *dequeue_tx_data_pdu(unifi_priv_t *priv, struct list_head *txList); -void resume_unicast_buffered_frames(unifi_priv_t *priv, u16 interfaceTag); -void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv, u16 interfaceTag); -void resume_suspended_uapsd(unifi_priv_t* priv, u16 interfaceTag); -#endif -/* - * netdev.c - */ - -#ifndef P80211_OUI_LEN -#define P80211_OUI_LEN 3 -#endif -typedef struct { - u8 dsap; /* always 0xAA */ - u8 ssap; /* always 0xAA */ - u8 ctrl; /* always 0x03 */ - u8 oui[P80211_OUI_LEN]; /* organizational universal id */ - u16 protocol; -} __attribute__ ((packed)) llc_snap_hdr_t; -int skb_add_llc_snap(struct net_device *dev, struct sk_buff *skb, int proto); -int skb_80211_to_ether(unifi_priv_t *priv, struct sk_buff *skb, - const unsigned char *daddr, const unsigned char *saddr, - const CSR_SIGNAL *signal, - bulk_data_param_t *bulkdata); - -const char *result_code_str(int result); - - -/* prepares & appends the Mac header for the payload */ -int prepare_and_add_macheader(unifi_priv_t *priv, - struct sk_buff *skb, - struct sk_buff *newSkb, - CSR_PRIORITY priority, - bulk_data_param_t *bulkdata, - u16 interfaceTag, - const u8 *daddr, - const u8 *saddr, - u8 protection); -CSR_PRIORITY -get_packet_priority(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, netInterface_priv_t *interfacePriv); - -void -unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority, - CSR_RATE TransmitRate, CSR_CLIENT_TAG hostTag, - u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, - CSR_PROCESS_ID leSenderProcessId, u8 *peerMacAddress, - CSR_SIGNAL *signal); - - -/* Pack the LSB to include station handle & status of tim set */ -#define CSR_WIFI_PACK_SENDER_ID_LSB_FOR_TIM_REQ(handle, timState) ((handle << 2) | timState) -/* get the station record handle from the sender ID */ -#define CSR_WIFI_GET_STATION_HANDLE_FROM_RECEIVER_ID(receiverProcessId) (u8) ((receiverProcessId & 0xff) >> 2) -/* get the timSet status from the sender ID */ -#define CSR_WIFI_GET_TIMSET_STATE_FROM_RECEIVER_ID(receiverProcessId) (u8) (receiverProcessId & 0x03) - -/* handle is 6 bits to accomodate in senderId LSB (only 64 station can be associated) */ -#define CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE 0x3F - -void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, u32 handle); -void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, u16 senderProcessId); - -/* Clear the Peer station Record, in case of wifioff/unexpected card removal */ -void CsrWifiRouterCtrlInterfaceReset(unifi_priv_t *priv, u16 interfaceTag); - -void scroll_ba_window(unifi_priv_t *priv, - netInterface_priv_t *interfacePriv, - ba_session_rx_struct *ba_session, - u16 sn); - -u8 blockack_session_stop(unifi_priv_t *priv, - u16 interfaceTag, - CsrWifiRouterCtrlBlockAckRole role, - u16 tID, - CsrWifiMacAddress macAddress); -#ifdef CSR_SUPPORT_SME -/* Fetch the protection information from interface Mode */ -s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, u16 interfaceTag, const u8 *daddr); -#endif - -/* Fetch the station record handler from data base for matching Mac address */ -#ifdef CSR_SUPPORT_SME -CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(unifi_priv_t *priv, - const u8 *peerMacAddress, - u16 interfaceTag); - -/* Fetch the station record handler from data base for matching handle */ -CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_priv_t *priv, - u32 handle, - u16 interfaceTag); - -void uf_update_sta_activity(unifi_priv_t *priv, u16 interfaceTag, const u8 *peerMacAddress); -void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv, u16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm); -#endif - -void uf_resume_data_plane(unifi_priv_t *priv, int queue, - CsrWifiMacAddress peer_address, - u16 interfaceTag); -void uf_free_pending_rx_packets(unifi_priv_t *priv, int queue, - CsrWifiMacAddress peer_address, u16 interfaceTag); - -int uf_register_netdev(unifi_priv_t *priv, int numOfInterface); -void uf_unregister_netdev(unifi_priv_t *priv); - -void uf_net_get_name(struct net_device *dev, char *name, int len); - -void uf_send_queue_info(unifi_priv_t *priv); -u16 uf_get_vif_identifier(CsrWifiRouterCtrlMode mode, u16 tag); - -void uf_process_rx_pending_queue(unifi_priv_t *priv, int queue, - CsrWifiMacAddress source_address, - int indicate, u16 interfaceTag); - -#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE -int uf_register_hip_offline_debug(unifi_priv_t *priv); -int uf_unregister_hip_offline_debug(unifi_priv_t *priv); -#endif - -/* - * inet.c - */ -void uf_register_inet_notifier(void); -void uf_unregister_inet_notifier(void); - - -/* - * Suspend / Resume handlers - */ -void unifi_resume(void *ospriv); -void unifi_suspend(void *ospriv); - - -#define QOS_CAPABILITY_WMM_ENABLED 0x0001 -#define QOS_CAPABILITY_WMM_UAPSD 0x0002 -#define QOS_CAPABILITY_ACM_BE_ENABLED 0x0010 -#define QOS_CAPABILITY_ACM_BK_ENABLED 0x0020 -#define QOS_CAPABILITY_ACM_VI_ENABLED 0x0040 -#define QOS_CAPABILITY_ACM_VO_ENABLED 0x0080 -#define QOS_CAPABILITY_TS_BE_ENABLED 0x0100 -#define QOS_CAPABILITY_TS_BK_ENABLED 0x0200 -#define QOS_CAPABILITY_TS_VI_ENABLED 0x0400 -#define QOS_CAPABILITY_TS_VO_ENABLED 0x0800 - - -/* EAPOL PDUS */ -#ifndef ETH_P_PAE -#define ETH_P_PAE 0x888e -#endif -#ifndef ETH_P_WAI -#define ETH_P_WAI 0x88b4 -#endif -/* - * unifi_dbg.c - */ -void debug_string_indication(unifi_priv_t *priv, - const unsigned char *extra, - unsigned int extralen); -void debug_word16_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr); -void debug_generic_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr); - - -/* - * putest.c - */ -int unifi_putest_start(unifi_priv_t *priv, unsigned char *arg); -int unifi_putest_cmd52_block_read(unifi_priv_t *priv, unsigned char *arg); -int unifi_putest_stop(unifi_priv_t *priv, unsigned char *arg); -int unifi_putest_set_sdio_clock(unifi_priv_t *priv, unsigned char *arg); -int unifi_putest_cmd52_read(unifi_priv_t *priv, unsigned char *arg); -int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg); -int unifi_putest_cmd52_write(unifi_priv_t *priv, unsigned char *arg); -int unifi_putest_gp_read16(unifi_priv_t *priv, unsigned char *arg); -int unifi_putest_gp_write16(unifi_priv_t *priv, unsigned char *arg); - -int unifi_putest_dl_fw(unifi_priv_t *priv, unsigned char *arg); -int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg); - -#endif /* __LINUX_UNIFI_PRIV_H__ */ diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c deleted file mode 100644 index 50908822b3c8..000000000000 --- a/drivers/staging/csr/unifi_sme.c +++ /dev/null @@ -1,1225 +0,0 @@ -/* - * *************************************************************************** - * FILE: unifi_sme.c - * - * PURPOSE: SME related functions. - * - * Copyright (C) 2007-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * *************************************************************************** - */ - -#include "unifi_priv.h" -#include "csr_wifi_hip_unifi.h" -#include "csr_wifi_hip_conversions.h" -#include <linux/sched/rt.h> - - - - int -convert_sme_error(CsrResult error) -{ - switch (error) { - case CSR_RESULT_SUCCESS: - return 0; - case CSR_RESULT_FAILURE: - case CSR_WIFI_RESULT_NOT_FOUND: - case CSR_WIFI_RESULT_TIMED_OUT: - case CSR_WIFI_RESULT_CANCELLED: - case CSR_WIFI_RESULT_UNAVAILABLE: - return -EIO; - case CSR_WIFI_RESULT_NO_ROOM: - return -EBUSY; - case CSR_WIFI_RESULT_INVALID_PARAMETER: - return -EINVAL; - case CSR_WIFI_RESULT_UNSUPPORTED: - return -EOPNOTSUPP; - default: - return -EIO; - } -} - - -/* - * --------------------------------------------------------------------------- - * sme_log_event - * - * Callback function to be registered as the SME event callback. - * Copies the signal content into a new udi_log_t struct and adds - * it to the read queue for the SME client. - * - * Arguments: - * arg This is the value given to unifi_add_udi_hook, in - * this case a pointer to the client instance. - * signal Pointer to the received signal. - * signal_len Size of the signal structure in bytes. - * bulkdata Pointers to any associated bulk data. - * dir Direction of the signal. Zero means from host, - * non-zero means to host. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ - void -sme_log_event(ul_client_t *pcli, - const u8 *signal, int signal_len, - const bulk_data_param_t *bulkdata, - int dir) -{ - unifi_priv_t *priv; - CSR_SIGNAL unpacked_signal; - CsrWifiSmeDataBlock mlmeCommand; - CsrWifiSmeDataBlock dataref1; - CsrWifiSmeDataBlock dataref2; - CsrResult result = CSR_RESULT_SUCCESS; - int r; - - /* Just a sanity check */ - if ((signal == NULL) || (signal_len <= 0)) { - return; - } - - priv = uf_find_instance(pcli->instance); - if (!priv) { - unifi_error(priv, "sme_log_event: invalid priv\n"); - return; - } - - if (priv->smepriv == NULL) { - unifi_error(priv, "sme_log_event: invalid smepriv\n"); - return; - } - - unifi_trace(priv, UDBG3, - "sme_log_event: Process signal 0x%.4X\n", - CSR_GET_UINT16_FROM_LITTLE_ENDIAN(signal)); - - - /* If the signal is known, then do any filtering required, otherwise it pass it to the SME. */ - r = read_unpack_signal(signal, &unpacked_signal); - if (r == CSR_RESULT_SUCCESS) { - if ((unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_DEBUG_STRING_INDICATION_ID) || - (unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_DEBUG_WORD16_INDICATION_ID)) - { - return; - } - if (unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_INDICATION_ID) - { - u16 frmCtrl; - u8 unicastPdu = TRUE; - u8 *macHdrLocation; - u8 *raddr = NULL, *taddr = NULL; - CsrWifiMacAddress peerMacAddress; - /* Check if we need to send CsrWifiRouterCtrlMicFailureInd*/ - CSR_MA_PACKET_INDICATION *ind = &unpacked_signal.u.MaPacketIndication; - - macHdrLocation = (u8 *) bulkdata->d[0].os_data_ptr; - /* Fetch the frame control value from mac header */ - frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation); - - /* Point to the addresses */ - raddr = macHdrLocation + MAC_HEADER_ADDR1_OFFSET; - taddr = macHdrLocation + MAC_HEADER_ADDR2_OFFSET; - - memcpy(peerMacAddress.a, taddr, ETH_ALEN); - - if(ind->ReceptionStatus == CSR_MICHAEL_MIC_ERROR) - { - if (*raddr & 0x1) - unicastPdu = FALSE; - - CsrWifiRouterCtrlMicFailureIndSend (priv->CSR_WIFI_SME_IFACEQUEUE, 0, - (ind->VirtualInterfaceIdentifier & 0xff), peerMacAddress, - unicastPdu); - return; - } - else - { - if(ind->ReceptionStatus == CSR_RX_SUCCESS) - { - u8 pmBit = (frmCtrl & 0x1000)?0x01:0x00; - u16 interfaceTag = (ind->VirtualInterfaceIdentifier & 0xff); - CsrWifiRouterCtrlStaInfo_t *srcStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, taddr, interfaceTag); - if((srcStaInfo != NULL) && (uf_check_broadcast_bssid(priv, bulkdata)== FALSE)) - { - uf_process_pm_bit_for_peer(priv, srcStaInfo, pmBit, interfaceTag); - - /* Update station last activity flag */ - srcStaInfo->activity_flag = TRUE; - } - } - } - } - - if (unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_CONFIRM_ID) - { - CSR_MA_PACKET_CONFIRM *cfm = &unpacked_signal.u.MaPacketConfirm; - u16 interfaceTag = (cfm->VirtualInterfaceIdentifier & 0xff); - netInterface_priv_t *interfacePriv; - CSR_MA_PACKET_REQUEST *req; - CsrWifiMacAddress peerMacAddress; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) - { - unifi_error(priv, "Bad MA_PACKET_CONFIRM interfaceTag %d\n", interfaceTag); - return; - } - - unifi_trace(priv, UDBG1, "MA-PACKET Confirm (%x, %x)\n", cfm->HostTag, cfm->TransmissionStatus); - - interfacePriv = priv->interfacePriv[interfaceTag]; -#ifdef CSR_SUPPORT_SME - if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP || - interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) { - - if(cfm->HostTag == interfacePriv->multicastPduHostTag){ - uf_process_ma_pkt_cfm_for_ap(priv, interfaceTag, cfm); - } - } -#endif - - req = &interfacePriv->m4_signal.u.MaPacketRequest; - - if(cfm->HostTag & 0x80000000) - { - if (cfm->TransmissionStatus != CSR_TX_SUCCESSFUL) - { - result = CSR_RESULT_FAILURE; - } -#ifdef CSR_SUPPORT_SME - memcpy(peerMacAddress.a, req->Ra.x, ETH_ALEN); - /* Check if this is a confirm for EAPOL M4 frame and we need to send transmistted ind*/ - if (interfacePriv->m4_sent && (cfm->HostTag == interfacePriv->m4_hostTag)) - { - unifi_trace(priv, UDBG1, "%s: Sending M4 Transmit CFM\n", __FUNCTION__); - CsrWifiRouterCtrlM4TransmittedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, - interfaceTag, - peerMacAddress, - result); - interfacePriv->m4_sent = FALSE; - interfacePriv->m4_hostTag = 0xffffffff; - } -#endif - /* If EAPOL was requested via router APIs then send cfm else ignore*/ - if((cfm->HostTag & 0x80000000) != CSR_WIFI_EAPOL_M4_HOST_TAG) { - CsrWifiRouterMaPacketCfmSend((u16)signal[2], - cfm->VirtualInterfaceIdentifier, - result, - (cfm->HostTag & 0x3fffffff), cfm->Rate); - } else { - unifi_trace(priv, UDBG1, "%s: M4 received from netdevice\n", __FUNCTION__); - } - return; - } - } - } - - mlmeCommand.length = signal_len; - mlmeCommand.data = (u8*)signal; - - dataref1.length = bulkdata->d[0].data_length; - if (dataref1.length > 0) { - dataref1.data = (u8 *) bulkdata->d[0].os_data_ptr; - } else - { - dataref1.data = NULL; - } - - dataref2.length = bulkdata->d[1].data_length; - if (dataref2.length > 0) { - dataref2.data = (u8 *) bulkdata->d[1].os_data_ptr; - } else - { - dataref2.data = NULL; - } - - CsrWifiRouterCtrlHipIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, mlmeCommand.length, mlmeCommand.data, - dataref1.length, dataref1.data, - dataref2.length, dataref2.data); - -} /* sme_log_event() */ - - -/* - * --------------------------------------------------------------------------- - * uf_sme_port_state - * - * Return the state of the controlled port. - * - * Arguments: - * priv Pointer to device private context struct - * address Pointer to the destination for tx or sender for rx address - * queue Controlled or uncontrolled queue - * - * Returns: - * An unifi_ControlledPortAction value. - * --------------------------------------------------------------------------- - */ -CsrWifiRouterCtrlPortAction -uf_sme_port_state(unifi_priv_t *priv, unsigned char *address, int queue, u16 interfaceTag) -{ - int i; - unifi_port_config_t *port; - netInterface_priv_t *interfacePriv; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "uf_sme_port_state: bad interfaceTag\n"); - return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; - } - - interfacePriv = priv->interfacePriv[interfaceTag]; - - if (queue == UF_CONTROLLED_PORT_Q) { - port = &interfacePriv->controlled_data_port; - } else { - port = &interfacePriv->uncontrolled_data_port; - } - - if (!port->entries_in_use) { - unifi_trace(priv, UDBG5, "No port configurations, return Discard.\n"); - return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD; - } - - /* If the port configuration is common for all destinations, return it. */ - if (port->overide_action == UF_DATA_PORT_OVERIDE) { - unifi_trace(priv, UDBG5, "Single port configuration (%d).\n", - port->port_cfg[0].port_action); - return port->port_cfg[0].port_action; - } - - unifi_trace(priv, UDBG5, "Multiple (%d) port configurations.\n", port->entries_in_use); - - /* If multiple configurations exist.. */ - for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { - /* .. go through the list and match the destination address. */ - if (port->port_cfg[i].in_use && - memcmp(address, port->port_cfg[i].mac_address.a, ETH_ALEN) == 0) { - /* Return the desired action. */ - return port->port_cfg[i].port_action; - } - } - - /* Could not find any information, return Open. */ - unifi_trace(priv, UDBG5, "port configuration not found, return Open.\n"); - return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN; -} /* uf_sme_port_state() */ - -/* - * --------------------------------------------------------------------------- - * uf_sme_port_config_handle - * - * Return the port config handle of the controlled/uncontrolled port. - * - * Arguments: - * priv Pointer to device private context struct - * address Pointer to the destination for tx or sender for rx address - * queue Controlled or uncontrolled queue - * - * Returns: - * An unifi_port_cfg_t* . - * --------------------------------------------------------------------------- - */ -unifi_port_cfg_t* -uf_sme_port_config_handle(unifi_priv_t *priv, unsigned char *address, int queue, u16 interfaceTag) -{ - int i; - unifi_port_config_t *port; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "uf_sme_port_config_handle: bad interfaceTag\n"); - return NULL; - } - - if (queue == UF_CONTROLLED_PORT_Q) { - port = &interfacePriv->controlled_data_port; - } else { - port = &interfacePriv->uncontrolled_data_port; - } - - if (!port->entries_in_use) { - unifi_trace(priv, UDBG5, "No port configurations, return Discard.\n"); - return NULL; - } - - /* If the port configuration is common for all destinations, return it. */ - if (port->overide_action == UF_DATA_PORT_OVERIDE) { - unifi_trace(priv, UDBG5, "Single port configuration (%d).\n", - port->port_cfg[0].port_action); - if (address) { - unifi_trace(priv, UDBG5, "addr[0] = %x, addr[1] = %x, addr[2] = %x, addr[3] = %x\n", address[0], address[1], address[2], address[3]); - } - return &port->port_cfg[0]; - } - - unifi_trace(priv, UDBG5, "Multiple port configurations.\n"); - - /* If multiple configurations exist.. */ - for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) { - /* .. go through the list and match the destination address. */ - if (port->port_cfg[i].in_use && - memcmp(address, port->port_cfg[i].mac_address.a, ETH_ALEN) == 0) { - /* Return the desired action. */ - return &port->port_cfg[i]; - } - } - - /* Could not find any information, return Open. */ - unifi_trace(priv, UDBG5, "port configuration not found, returning NULL (debug).\n"); - return NULL; -} /* uf_sme_port_config_handle */ - -void -uf_multicast_list_wq(struct work_struct *work) -{ - unifi_priv_t *priv = container_of(work, unifi_priv_t, - multicast_list_task); - int i; - u16 interfaceTag = 0; - CsrWifiMacAddress* multicast_address_list = NULL; - int mc_count; - u8 *mc_list; - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "uf_multicast_list_wq: bad interfaceTag\n"); - return; - } - - unifi_trace(priv, UDBG5, - "uf_multicast_list_wq: list count = %d\n", - interfacePriv->mc_list_count); - - /* Flush the current list */ - CsrWifiRouterCtrlMulticastAddressIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, CSR_WIFI_SME_LIST_ACTION_FLUSH, 0, NULL); - - mc_count = interfacePriv->mc_list_count; - mc_list = interfacePriv->mc_list; - /* - * Allocate a new list, need to free it later - * in unifi_mgt_multicast_address_cfm(). - */ - multicast_address_list = kmalloc(mc_count * sizeof(CsrWifiMacAddress), GFP_KERNEL); - - if (multicast_address_list == NULL) { - return; - } - - for (i = 0; i < mc_count; i++) { - memcpy(multicast_address_list[i].a, mc_list, ETH_ALEN); - mc_list += ETH_ALEN; - } - - if (priv->smepriv == NULL) { - kfree(multicast_address_list); - return; - } - - CsrWifiRouterCtrlMulticastAddressIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, - interfaceTag, - CSR_WIFI_SME_LIST_ACTION_ADD, - mc_count, multicast_address_list); - - /* The SME will take a copy of the addreses*/ - kfree(multicast_address_list); -} - - -int unifi_cfg_power(unifi_priv_t *priv, unsigned char *arg) -{ - unifi_cfg_power_t cfg_power; - int rc; - int wol; - - if (get_user(cfg_power, (unifi_cfg_power_t*)(((unifi_cfg_command_t*)arg) + 1))) { - unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n"); - return -EFAULT; - } - - switch (cfg_power) { - case UNIFI_CFG_POWER_OFF: - priv->wol_suspend = (enable_wol == UNIFI_WOL_OFF) ? FALSE : TRUE; - rc = sme_sys_suspend(priv); - if (rc) { - return rc; - } - break; - case UNIFI_CFG_POWER_ON: - wol = priv->wol_suspend; - rc = sme_sys_resume(priv); - if (rc) { - return rc; - } - if (wol) { - /* Kick the BH to ensure pending transfers are handled when - * a suspend happened with card powered. - */ - unifi_send_signal(priv->card, NULL, 0, NULL); - } - break; - default: - unifi_error(priv, "WIFI POWER: Unknown value.\n"); - return -EINVAL; - } - - return 0; -} - - -int unifi_cfg_power_save(unifi_priv_t *priv, unsigned char *arg) -{ - unifi_cfg_powersave_t cfg_power_save; - CsrWifiSmePowerConfig powerConfig; - int rc; - - if (get_user(cfg_power_save, (unifi_cfg_powersave_t*)(((unifi_cfg_command_t*)arg) + 1))) { - unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n"); - return -EFAULT; - } - - /* Get the coex info from the SME */ - rc = sme_mgt_power_config_get(priv, &powerConfig); - if (rc) { - unifi_error(priv, "UNIFI_CFG: Get unifi_PowerConfigValue failed.\n"); - return rc; - } - - switch (cfg_power_save) { - case UNIFI_CFG_POWERSAVE_NONE: - powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW; - break; - case UNIFI_CFG_POWERSAVE_FAST: - powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_MED; - break; - case UNIFI_CFG_POWERSAVE_FULL: - powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH; - break; - case UNIFI_CFG_POWERSAVE_AUTO: - powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO; - break; - default: - unifi_error(priv, "POWERSAVE: Unknown value.\n"); - return -EINVAL; - } - - rc = sme_mgt_power_config_set(priv, &powerConfig); - - if (rc) { - unifi_error(priv, "UNIFI_CFG: Set unifi_PowerConfigValue failed.\n"); - } - - return rc; -} - - -int unifi_cfg_power_supply(unifi_priv_t *priv, unsigned char *arg) -{ - unifi_cfg_powersupply_t cfg_power_supply; - CsrWifiSmeHostConfig hostConfig; - int rc; - - if (get_user(cfg_power_supply, (unifi_cfg_powersupply_t*)(((unifi_cfg_command_t*)arg) + 1))) { - unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n"); - return -EFAULT; - } - - /* Get the coex info from the SME */ - rc = sme_mgt_host_config_get(priv, &hostConfig); - if (rc) { - unifi_error(priv, "UNIFI_CFG: Get unifi_HostConfigValue failed.\n"); - return rc; - } - - switch (cfg_power_supply) { - case UNIFI_CFG_POWERSUPPLY_MAINS: - hostConfig.powerMode = CSR_WIFI_SME_HOST_POWER_MODE_ACTIVE; - break; - case UNIFI_CFG_POWERSUPPLY_BATTERIES: - hostConfig.powerMode = CSR_WIFI_SME_HOST_POWER_MODE_POWER_SAVE; - break; - default: - unifi_error(priv, "POWERSUPPLY: Unknown value.\n"); - return -EINVAL; - } - - rc = sme_mgt_host_config_set(priv, &hostConfig); - if (rc) { - unifi_error(priv, "UNIFI_CFG: Set unifi_HostConfigValue failed.\n"); - } - - return rc; -} - - -int unifi_cfg_packet_filters(unifi_priv_t *priv, unsigned char *arg) -{ - unsigned char *tclas_buffer; - unsigned int tclas_buffer_length; - tclas_t *dhcp_tclas; - int rc; - - /* Free any TCLASs previously allocated */ - if (priv->packet_filters.tclas_ies_length) { - kfree(priv->filter_tclas_ies); - priv->filter_tclas_ies = NULL; - } - - tclas_buffer = ((unsigned char*)arg) + sizeof(unifi_cfg_command_t) + sizeof(unsigned int); - if (copy_from_user(&priv->packet_filters, (void*)tclas_buffer, - sizeof(uf_cfg_bcast_packet_filter_t))) { - unifi_error(priv, "UNIFI_CFG: Failed to get the filter struct\n"); - return -EFAULT; - } - - tclas_buffer_length = priv->packet_filters.tclas_ies_length; - - /* Allocate TCLASs if necessary */ - if (priv->packet_filters.dhcp_filter) { - priv->packet_filters.tclas_ies_length += sizeof(tclas_t); - } - if (priv->packet_filters.tclas_ies_length > 0) { - priv->filter_tclas_ies = kmalloc(priv->packet_filters.tclas_ies_length, GFP_KERNEL); - if (priv->filter_tclas_ies == NULL) { - return -ENOMEM; - } - if (tclas_buffer_length) { - tclas_buffer += sizeof(uf_cfg_bcast_packet_filter_t) - sizeof(unsigned char*); - if (copy_from_user(priv->filter_tclas_ies, - tclas_buffer, - tclas_buffer_length)) { - unifi_error(priv, "UNIFI_CFG: Failed to get the TCLAS buffer\n"); - return -EFAULT; - } - } - } - - if(priv->packet_filters.dhcp_filter) - { - /* Append the DHCP tclas IE */ - dhcp_tclas = (tclas_t*)(priv->filter_tclas_ies + tclas_buffer_length); - memset(dhcp_tclas, 0, sizeof(tclas_t)); - dhcp_tclas->element_id = 14; - dhcp_tclas->length = sizeof(tcpip_clsfr_t) + 1; - dhcp_tclas->user_priority = 0; - dhcp_tclas->tcp_ip_cls_fr.cls_fr_type = 1; - dhcp_tclas->tcp_ip_cls_fr.version = 4; - ((u8*)(&dhcp_tclas->tcp_ip_cls_fr.source_port))[0] = 0x00; - ((u8*)(&dhcp_tclas->tcp_ip_cls_fr.source_port))[1] = 0x44; - ((u8*)(&dhcp_tclas->tcp_ip_cls_fr.dest_port))[0] = 0x00; - ((u8*)(&dhcp_tclas->tcp_ip_cls_fr.dest_port))[1] = 0x43; - dhcp_tclas->tcp_ip_cls_fr.protocol = 0x11; - dhcp_tclas->tcp_ip_cls_fr.cls_fr_mask = 0x58; //bits: 3,4,6 - } - - rc = sme_mgt_packet_filter_set(priv); - - return rc; -} - - -int unifi_cfg_wmm_qos_info(unifi_priv_t *priv, unsigned char *arg) -{ - u8 wmm_qos_info; - int rc = 0; - - if (get_user(wmm_qos_info, (u8*)(((unifi_cfg_command_t*)arg) + 1))) { - unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n"); - return -EFAULT; - } - - /* Store the value in the connection info */ - priv->connection_config.wmmQosInfo = wmm_qos_info; - - return rc; -} - - -int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg) -{ - u32 addts_tid; - u8 addts_ie_length; - u8 *addts_ie; - u8 *addts_params; - CsrWifiSmeDataBlock tspec; - CsrWifiSmeDataBlock tclas; - int rc; - - addts_params = (u8*)(((unifi_cfg_command_t*)arg) + 1); - if (get_user(addts_tid, (u32*)addts_params)) { - unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the argument\n"); - return -EFAULT; - } - - addts_params += sizeof(u32); - if (get_user(addts_ie_length, (u8*)addts_params)) { - unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the argument\n"); - return -EFAULT; - } - - unifi_trace(priv, UDBG4, "addts: tid = 0x%x ie_length = %d\n", - addts_tid, addts_ie_length); - - addts_ie = kmalloc(addts_ie_length, GFP_KERNEL); - if (addts_ie == NULL) { - unifi_error(priv, - "unifi_cfg_wmm_addts: Failed to malloc %d bytes for addts_ie buffer\n", - addts_ie_length); - return -ENOMEM; - } - - addts_params += sizeof(u8); - rc = copy_from_user(addts_ie, addts_params, addts_ie_length); - if (rc) { - unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the addts buffer\n"); - kfree(addts_ie); - return -EFAULT; - } - - tspec.data = addts_ie; - tspec.length = addts_ie_length; - tclas.data = NULL; - tclas.length = 0; - - rc = sme_mgt_tspec(priv, CSR_WIFI_SME_LIST_ACTION_ADD, addts_tid, - &tspec, &tclas); - - kfree(addts_ie); - return rc; -} - - -int unifi_cfg_wmm_delts(unifi_priv_t *priv, unsigned char *arg) -{ - u32 delts_tid; - u8 *delts_params; - CsrWifiSmeDataBlock tspec; - CsrWifiSmeDataBlock tclas; - int rc; - - delts_params = (u8*)(((unifi_cfg_command_t*)arg) + 1); - if (get_user(delts_tid, (u32*)delts_params)) { - unifi_error(priv, "unifi_cfg_wmm_delts: Failed to get the argument\n"); - return -EFAULT; - } - - unifi_trace(priv, UDBG4, "delts: tid = 0x%x\n", delts_tid); - - tspec.data = tclas.data = NULL; - tspec.length = tclas.length = 0; - - rc = sme_mgt_tspec(priv, CSR_WIFI_SME_LIST_ACTION_REMOVE, delts_tid, - &tspec, &tclas); - - return rc; -} - -int unifi_cfg_strict_draft_n(unifi_priv_t *priv, unsigned char *arg) -{ - u8 strict_draft_n; - u8 *strict_draft_n_params; - int rc; - - CsrWifiSmeStaConfig staConfig; - CsrWifiSmeDeviceConfig deviceConfig; - - strict_draft_n_params = (u8*)(((unifi_cfg_command_t*)arg) + 1); - if (get_user(strict_draft_n, (u8*)strict_draft_n_params)) { - unifi_error(priv, "unifi_cfg_strict_draft_n: Failed to get the argument\n"); - return -EFAULT; - } - - unifi_trace(priv, UDBG4, "strict_draft_n: = %s\n", ((strict_draft_n) ? "yes":"no")); - - rc = sme_mgt_sme_config_get(priv, &staConfig, &deviceConfig); - - if (rc) { - unifi_warning(priv, "unifi_cfg_strict_draft_n: Get unifi_SMEConfigValue failed.\n"); - return -EFAULT; - } - - deviceConfig.enableStrictDraftN = strict_draft_n; - - rc = sme_mgt_sme_config_set(priv, &staConfig, &deviceConfig); - if (rc) { - unifi_warning(priv, "unifi_cfg_strict_draft_n: Set unifi_SMEConfigValue failed.\n"); - rc = -EFAULT; - } - - return rc; -} - - -int unifi_cfg_enable_okc(unifi_priv_t *priv, unsigned char *arg) -{ - u8 enable_okc; - u8 *enable_okc_params; - int rc; - - CsrWifiSmeStaConfig staConfig; - CsrWifiSmeDeviceConfig deviceConfig; - - enable_okc_params = (u8*)(((unifi_cfg_command_t*)arg) + 1); - if (get_user(enable_okc, (u8*)enable_okc_params)) { - unifi_error(priv, "unifi_cfg_enable_okc: Failed to get the argument\n"); - return -EFAULT; - } - - unifi_trace(priv, UDBG4, "enable_okc: = %s\n", ((enable_okc) ? "yes":"no")); - - rc = sme_mgt_sme_config_get(priv, &staConfig, &deviceConfig); - if (rc) { - unifi_warning(priv, "unifi_cfg_enable_okc: Get unifi_SMEConfigValue failed.\n"); - return -EFAULT; - } - - staConfig.enableOpportunisticKeyCaching = enable_okc; - - rc = sme_mgt_sme_config_set(priv, &staConfig, &deviceConfig); - if (rc) { - unifi_warning(priv, "unifi_cfg_enable_okc: Set unifi_SMEConfigValue failed.\n"); - rc = -EFAULT; - } - - return rc; -} - - -int unifi_cfg_get_info(unifi_priv_t *priv, unsigned char *arg) -{ - unifi_cfg_get_t get_cmd; - char inst_name[IFNAMSIZ]; - int rc; - - if (get_user(get_cmd, (unifi_cfg_get_t*)(((unifi_cfg_command_t*)arg) + 1))) { - unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n"); - return -EFAULT; - } - - switch (get_cmd) { - case UNIFI_CFG_GET_COEX: - { - CsrWifiSmeCoexInfo coexInfo; - /* Get the coex info from the SME */ - rc = sme_mgt_coex_info_get(priv, &coexInfo); - if (rc) { - unifi_error(priv, "UNIFI_CFG: Get unifi_CoexInfoValue failed.\n"); - return rc; - } - - /* Copy the info to the out buffer */ - if (copy_to_user((void*)arg, - &coexInfo, - sizeof(CsrWifiSmeCoexInfo))) { - unifi_error(priv, "UNIFI_CFG: Failed to copy the coex info\n"); - return -EFAULT; - } - break; - } - case UNIFI_CFG_GET_POWER_MODE: - { - CsrWifiSmePowerConfig powerConfig; - rc = sme_mgt_power_config_get(priv, &powerConfig); - if (rc) { - unifi_error(priv, "UNIFI_CFG: Get unifi_PowerConfigValue failed.\n"); - return rc; - } - - /* Copy the info to the out buffer */ - if (copy_to_user((void*)arg, - &powerConfig.powerSaveLevel, - sizeof(CsrWifiSmePowerSaveLevel))) { - unifi_error(priv, "UNIFI_CFG: Failed to copy the power save info\n"); - return -EFAULT; - } - break; - } - case UNIFI_CFG_GET_POWER_SUPPLY: - { - CsrWifiSmeHostConfig hostConfig; - rc = sme_mgt_host_config_get(priv, &hostConfig); - if (rc) { - unifi_error(priv, "UNIFI_CFG: Get unifi_HostConfigValue failed.\n"); - return rc; - } - - /* Copy the info to the out buffer */ - if (copy_to_user((void*)arg, - &hostConfig.powerMode, - sizeof(CsrWifiSmeHostPowerMode))) { - unifi_error(priv, "UNIFI_CFG: Failed to copy the host power mode\n"); - return -EFAULT; - } - break; - } - case UNIFI_CFG_GET_VERSIONS: - break; - case UNIFI_CFG_GET_INSTANCE: - { - u16 InterfaceId=0; - uf_net_get_name(priv->netdev[InterfaceId], &inst_name[0], sizeof(inst_name)); - - /* Copy the info to the out buffer */ - if (copy_to_user((void*)arg, - &inst_name[0], - sizeof(inst_name))) { - unifi_error(priv, "UNIFI_CFG: Failed to copy the instance name\n"); - return -EFAULT; - } - } - break; - - case UNIFI_CFG_GET_AP_CONFIG: - { -#ifdef CSR_SUPPORT_WEXT_AP - uf_cfg_ap_config_t cfg_ap_config; - - memset(&cfg_ap_config, 0, sizeof(cfg_ap_config)); - cfg_ap_config.channel = priv->ap_config.channel; - cfg_ap_config.beaconInterval = priv->ap_mac_config.beaconInterval; - cfg_ap_config.wmmEnabled = priv->ap_mac_config.wmmEnabled; - cfg_ap_config.dtimPeriod = priv->ap_mac_config.dtimPeriod; - cfg_ap_config.phySupportedBitmap = priv->ap_mac_config.phySupportedBitmap; - if (copy_to_user((void*)arg, - &cfg_ap_config, - sizeof(uf_cfg_ap_config_t))) { - unifi_error(priv, "UNIFI_CFG: Failed to copy the AP configuration\n"); - return -EFAULT; - } -#else - return -EPERM; -#endif - } - break; - - - default: - unifi_error(priv, "unifi_cfg_get_info: Unknown value.\n"); - return -EINVAL; - } - - return 0; -} -#ifdef CSR_SUPPORT_WEXT_AP -int - uf_configure_supported_rates(u8 * supportedRates, u8 phySupportedBitmap) -{ - int i=0; - u8 b=FALSE, g = FALSE, n = FALSE; - b = phySupportedBitmap & CSR_WIFI_SME_AP_PHY_SUPPORT_B; - n = phySupportedBitmap & CSR_WIFI_SME_AP_PHY_SUPPORT_N; - g = phySupportedBitmap & CSR_WIFI_SME_AP_PHY_SUPPORT_G; - if(b || g) { - supportedRates[i++]=0x82; - supportedRates[i++]=0x84; - supportedRates[i++]=0x8b; - supportedRates[i++]=0x96; - } else if(n) { - /* For some strange reasons WiFi stack needs both b and g rates*/ - supportedRates[i++]=0x02; - supportedRates[i++]=0x04; - supportedRates[i++]=0x0b; - supportedRates[i++]=0x16; - supportedRates[i++]=0x0c; - supportedRates[i++]=0x12; - supportedRates[i++]=0x18; - supportedRates[i++]=0x24; - supportedRates[i++]=0x30; - supportedRates[i++]=0x48; - supportedRates[i++]=0x60; - supportedRates[i++]=0x6c; - } - if(g) { - if(!b) { - supportedRates[i++]=0x8c; - supportedRates[i++]=0x98; - supportedRates[i++]=0xb0; - } else { - supportedRates[i++]=0x0c; - supportedRates[i++]=0x18; - supportedRates[i++]=0x30; - } - supportedRates[i++]=0x48; - supportedRates[i++]=0x12; - supportedRates[i++]=0x24; - supportedRates[i++]=0x60; - supportedRates[i++]=0x6c; - } - return i; -} -int unifi_cfg_set_ap_config(unifi_priv_t * priv, unsigned char* arg) -{ - uf_cfg_ap_config_t cfg_ap_config; - char *buffer; - - buffer = ((unsigned char*)arg) + sizeof(unifi_cfg_command_t) + sizeof(unsigned int); - if (copy_from_user(&cfg_ap_config, (void*)buffer, - sizeof(uf_cfg_ap_config_t))) { - unifi_error(priv, "UNIFI_CFG: Failed to get the ap config struct\n"); - return -EFAULT; - } - priv->ap_config.channel = cfg_ap_config.channel; - priv->ap_mac_config.dtimPeriod = cfg_ap_config.dtimPeriod; - priv->ap_mac_config.beaconInterval = cfg_ap_config.beaconInterval; - priv->group_sec_config.apGroupkeyTimeout = cfg_ap_config.groupkeyTimeout; - priv->group_sec_config.apStrictGtkRekey = cfg_ap_config.strictGtkRekeyEnabled; - priv->group_sec_config.apGmkTimeout = cfg_ap_config.gmkTimeout; - priv->group_sec_config.apResponseTimeout = cfg_ap_config.responseTimeout; - priv->group_sec_config.apRetransLimit = cfg_ap_config.retransLimit; - - priv->ap_mac_config.shortSlotTimeEnabled = cfg_ap_config.shortSlotTimeEnabled; - priv->ap_mac_config.ctsProtectionType=cfg_ap_config.ctsProtectionType; - - priv->ap_mac_config.wmmEnabled = cfg_ap_config.wmmEnabled; - - priv->ap_mac_config.apHtParams.rxStbc=cfg_ap_config.rxStbc; - priv->ap_mac_config.apHtParams.rifsModeAllowed=cfg_ap_config.rifsModeAllowed; - - priv->ap_mac_config.phySupportedBitmap = cfg_ap_config.phySupportedBitmap; - priv->ap_mac_config.maxListenInterval=cfg_ap_config.maxListenInterval; - - priv->ap_mac_config.supportedRatesCount= uf_configure_supported_rates(priv->ap_mac_config.supportedRates, priv->ap_mac_config.phySupportedBitmap); - - return 0; -} - -#endif -#ifdef CSR_SUPPORT_WEXT - - void -uf_sme_config_wq(struct work_struct *work) -{ - CsrWifiSmeStaConfig staConfig; - CsrWifiSmeDeviceConfig deviceConfig; - unifi_priv_t *priv = container_of(work, unifi_priv_t, sme_config_task); - - /* Register to receive indications from the SME */ - CsrWifiSmeEventMaskSetReqSend(0, - CSR_WIFI_SME_INDICATIONS_WIFIOFF | CSR_WIFI_SME_INDICATIONS_CONNECTIONQUALITY | - CSR_WIFI_SME_INDICATIONS_MEDIASTATUS | CSR_WIFI_SME_INDICATIONS_MICFAILURE); - - if (sme_mgt_sme_config_get(priv, &staConfig, &deviceConfig)) { - unifi_warning(priv, "uf_sme_config_wq: Get unifi_SMEConfigValue failed.\n"); - return; - } - - if (priv->if_index == CSR_INDEX_5G) { - staConfig.ifIndex = CSR_WIFI_SME_RADIO_IF_GHZ_5_0; - } else { - staConfig.ifIndex = CSR_WIFI_SME_RADIO_IF_GHZ_2_4; - } - - deviceConfig.trustLevel = (CsrWifiSme80211dTrustLevel)tl_80211d; - if (sme_mgt_sme_config_set(priv, &staConfig, &deviceConfig)) { - unifi_warning(priv, - "SME config for 802.11d Trust Level and Radio Band failed.\n"); - return; - } - -} /* uf_sme_config_wq() */ - -#endif /* CSR_SUPPORT_WEXT */ - - -/* - * --------------------------------------------------------------------------- - * uf_ta_ind_wq - * - * Deferred work queue function to send Traffic Analysis protocols - * indications to the SME. - * These are done in a deferred work queue for two reasons: - * - the CsrWifiRouterCtrl...Send() functions are not safe for atomic context - * - we want to load the main driver data path as lightly as possible - * - * The TA classifications already come from a workqueue. - * - * Arguments: - * work Pointer to work queue item. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ - void -uf_ta_ind_wq(struct work_struct *work) -{ - struct ta_ind *ind = container_of(work, struct ta_ind, task); - unifi_priv_t *priv = container_of(ind, unifi_priv_t, ta_ind_work); - u16 interfaceTag = 0; - - - CsrWifiRouterCtrlTrafficProtocolIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, - interfaceTag, - ind->packet_type, - ind->direction, - ind->src_addr); - ind->in_use = 0; - -} /* uf_ta_ind_wq() */ - - -/* - * --------------------------------------------------------------------------- - * uf_ta_sample_ind_wq - * - * Deferred work queue function to send Traffic Analysis sample - * indications to the SME. - * These are done in a deferred work queue for two reasons: - * - the CsrWifiRouterCtrl...Send() functions are not safe for atomic context - * - we want to load the main driver data path as lightly as possible - * - * The TA classifications already come from a workqueue. - * - * Arguments: - * work Pointer to work queue item. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ - void -uf_ta_sample_ind_wq(struct work_struct *work) -{ - struct ta_sample_ind *ind = container_of(work, struct ta_sample_ind, task); - unifi_priv_t *priv = container_of(ind, unifi_priv_t, ta_sample_ind_work); - u16 interfaceTag = 0; - - unifi_trace(priv, UDBG5, "rxtcp %d txtcp %d rxudp %d txudp %d prio %d\n", - priv->rxTcpThroughput, - priv->txTcpThroughput, - priv->rxUdpThroughput, - priv->txUdpThroughput, - priv->bh_thread.prio); - - if(priv->rxTcpThroughput > 1000) - { - if (bh_priority == -1 && priv->bh_thread.prio != 1) - { - struct sched_param param; - priv->bh_thread.prio = 1; - unifi_trace(priv, UDBG1, "%s new thread (RT) priority = %d\n", - priv->bh_thread.name, priv->bh_thread.prio); - param.sched_priority = priv->bh_thread.prio; - sched_setscheduler(priv->bh_thread.thread_task, SCHED_FIFO, ¶m); - } - } else - { - if (bh_priority == -1 && priv->bh_thread.prio != DEFAULT_PRIO) - { - struct sched_param param; - param.sched_priority = 0; - sched_setscheduler(priv->bh_thread.thread_task, SCHED_NORMAL, ¶m); - priv->bh_thread.prio = DEFAULT_PRIO; - unifi_trace(priv, UDBG1, "%s new thread priority = %d\n", - priv->bh_thread.name, priv->bh_thread.prio); - set_user_nice(priv->bh_thread.thread_task, PRIO_TO_NICE(priv->bh_thread.prio)); - } - } - - CsrWifiRouterCtrlTrafficSampleIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, ind->stats); - - ind->in_use = 0; - -} /* uf_ta_sample_ind_wq() */ - - -/* - * --------------------------------------------------------------------------- - * uf_send_m4_ready_wq - * - * Deferred work queue function to send M4 ReadyToSend inds to the SME. - * These are done in a deferred work queue for two reasons: - * - the CsrWifiRouterCtrl...Send() functions are not safe for atomic context - * - we want to load the main driver data path as lightly as possible - * - * Arguments: - * work Pointer to work queue item. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void -uf_send_m4_ready_wq(struct work_struct *work) -{ - netInterface_priv_t *InterfacePriv = container_of(work, netInterface_priv_t, send_m4_ready_task); - u16 iface = InterfacePriv->InterfaceTag; - unifi_priv_t *priv = InterfacePriv->privPtr; - CSR_MA_PACKET_REQUEST *req = &InterfacePriv->m4_signal.u.MaPacketRequest; - CsrWifiMacAddress peer; - unsigned long flags; - - /* The peer address was stored in the signal */ - spin_lock_irqsave(&priv->m4_lock, flags); - memcpy(peer.a, req->Ra.x, sizeof(peer.a)); - spin_unlock_irqrestore(&priv->m4_lock, flags); - - /* Send a signal to SME */ - CsrWifiRouterCtrlM4ReadyToSendIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, iface, peer); - - unifi_trace(priv, UDBG1, "M4ReadyToSendInd sent for peer %pMF\n", - peer.a); - -} /* uf_send_m4_ready_wq() */ - -#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) -/* - * --------------------------------------------------------------------------- - * uf_send_pkt_to_encrypt - * - * Deferred work queue function to send the WAPI data pkts to SME when unicast KeyId = 1 - * These are done in a deferred work queue for two reasons: - * - the CsrWifiRouterCtrl...Send() functions are not safe for atomic context - * - we want to load the main driver data path as lightly as possible - * - * Arguments: - * work Pointer to work queue item. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -void uf_send_pkt_to_encrypt(struct work_struct *work) -{ - netInterface_priv_t *interfacePriv = container_of(work, netInterface_priv_t, send_pkt_to_encrypt); - u16 interfaceTag = interfacePriv->InterfaceTag; - unifi_priv_t *priv = interfacePriv->privPtr; - - u32 pktBulkDataLength; - u8 *pktBulkData; - unsigned long flags; - - if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA) { - - pktBulkDataLength = interfacePriv->wapi_unicast_bulk_data.data_length; - - if (pktBulkDataLength > 0) { - pktBulkData = kmalloc(pktBulkDataLength, GFP_KERNEL); - } else { - unifi_error(priv, "uf_send_pkt_to_encrypt() : invalid buffer\n"); - return; - } - - spin_lock_irqsave(&priv->wapi_lock, flags); - /* Copy over the MA PKT REQ bulk data */ - memcpy(pktBulkData, (u8*)interfacePriv->wapi_unicast_bulk_data.os_data_ptr, pktBulkDataLength); - /* Free any bulk data buffers allocated for the WAPI Data pkt */ - unifi_net_data_free(priv, &interfacePriv->wapi_unicast_bulk_data); - interfacePriv->wapi_unicast_bulk_data.net_buf_length = 0; - interfacePriv->wapi_unicast_bulk_data.data_length = 0; - interfacePriv->wapi_unicast_bulk_data.os_data_ptr = interfacePriv->wapi_unicast_bulk_data.os_net_buf_ptr = NULL; - spin_unlock_irqrestore(&priv->wapi_lock, flags); - - CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, pktBulkDataLength, pktBulkData); - unifi_trace(priv, UDBG1, "WapiUnicastTxEncryptInd sent to SME\n"); - - kfree(pktBulkData); /* Would have been copied over by the SME Handler */ - - } else { - unifi_warning(priv, "uf_send_pkt_to_encrypt() is NOT applicable for interface mode - %d\n", interfacePriv->interfaceMode); - } -}/* uf_send_pkt_to_encrypt() */ -#endif diff --git a/drivers/staging/csr/unifi_sme.h b/drivers/staging/csr/unifi_sme.h deleted file mode 100644 index aff9aa178124..000000000000 --- a/drivers/staging/csr/unifi_sme.h +++ /dev/null @@ -1,245 +0,0 @@ -/* - * *************************************************************************** - * FILE: unifi_sme.h - * - * PURPOSE: SME related definitions. - * - * Copyright (C) 2007-2011 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * *************************************************************************** - */ -#ifndef __LINUX_UNIFI_SME_H__ -#define __LINUX_UNIFI_SME_H__ 1 - -#include <linux/kernel.h> - -#ifdef CSR_SME_USERSPACE -#include "sme_userspace.h" -#endif - -#include "csr_wifi_sme_lib.h" - -typedef int unifi_data_port_action; - -typedef struct unifi_port_cfg -{ - /* TRUE if this port entry is allocated */ - u8 in_use; - CsrWifiRouterCtrlPortAction port_action; - CsrWifiMacAddress mac_address; -} unifi_port_cfg_t; - -#define UNIFI_MAX_CONNECTIONS 8 -#define UNIFI_MAX_RETRY_LIMIT 5 -#define UF_DATA_PORT_NOT_OVERIDE 0 -#define UF_DATA_PORT_OVERIDE 1 - -typedef struct unifi_port_config -{ - int entries_in_use; - int overide_action; - unifi_port_cfg_t port_cfg[UNIFI_MAX_CONNECTIONS]; -} unifi_port_config_t; - - -enum sme_request_status { - SME_REQUEST_EMPTY, - SME_REQUEST_PENDING, - SME_REQUEST_RECEIVED, - SME_REQUEST_TIMEDOUT, - SME_REQUEST_CANCELLED, -}; - -/* Structure to hold a UDI logged signal */ -typedef struct { - - /* The current status of the request */ - enum sme_request_status request_status; - - /* The status the SME has passed to us */ - CsrResult reply_status; - - /* SME's reply to a get request */ - CsrWifiSmeVersions versions; - CsrWifiSmePowerConfig powerConfig; - CsrWifiSmeHostConfig hostConfig; - CsrWifiSmeStaConfig staConfig; - CsrWifiSmeDeviceConfig deviceConfig; - CsrWifiSmeCoexInfo coexInfo; - CsrWifiSmeCoexConfig coexConfig; - CsrWifiSmeMibConfig mibConfig; - CsrWifiSmeConnectionInfo connectionInfo; - CsrWifiSmeConnectionConfig connectionConfig; - CsrWifiSmeConnectionStats connectionStats; - - - /* SME's reply to a scan request */ - u16 reply_scan_results_count; - CsrWifiSmeScanResult* reply_scan_results; - -} sme_reply_t; - - -typedef struct { - u16 appHandle; - CsrWifiRouterEncapsulation encapsulation; - u16 protocol; - u8 oui[3]; - u8 in_use; -} sme_ma_unidata_ind_filter_t; - - -CsrWifiRouterCtrlPortAction uf_sme_port_state(unifi_priv_t *priv, - unsigned char *address, - int queue, - u16 interfaceTag); -unifi_port_cfg_t *uf_sme_port_config_handle(unifi_priv_t *priv, - unsigned char *address, - int queue, - u16 interfaceTag); - - - -/* Callback for event logging to SME clients */ -void sme_log_event(ul_client_t *client, const u8 *signal, int signal_len, - const bulk_data_param_t *bulkdata, int dir); - -/* The workqueue task to the set the multicast addresses list */ -void uf_multicast_list_wq(struct work_struct *work); - -/* The workqueue task to execute the TA module */ -void uf_ta_wq(struct work_struct *work); - - -/* - * SME blocking helper functions - */ -#ifdef UNIFI_DEBUG -# define sme_complete_request(priv, status) uf_sme_complete_request(priv, status, __func__) -#else -# define sme_complete_request(priv, status) uf_sme_complete_request(priv, status, NULL) -#endif - -void uf_sme_complete_request(unifi_priv_t *priv, CsrResult reply_status, const char *func); -void uf_sme_cancel_request(unifi_priv_t *priv, CsrResult reply_status); - - -/* - * Blocking functions using the SME SYS API. - */ -int sme_sys_suspend(unifi_priv_t *priv); -int sme_sys_resume(unifi_priv_t *priv); - - -/* - * Traffic Analysis workqueue jobs - */ -void uf_ta_ind_wq(struct work_struct *work); -void uf_ta_sample_ind_wq(struct work_struct *work); - -/* - * SME config workqueue job - */ -void uf_sme_config_wq(struct work_struct *work); - -/* - * To send M4 read to send IND - */ -void uf_send_m4_ready_wq(struct work_struct *work); - -#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) -/* - * To send data pkt to Sme for encryption - */ -void uf_send_pkt_to_encrypt(struct work_struct *work); -#endif - -int sme_mgt_power_config_set(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig); -int sme_mgt_power_config_get(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig); -int sme_mgt_host_config_set(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig); -int sme_mgt_host_config_get(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig); -int sme_mgt_sme_config_set(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig); -int sme_mgt_sme_config_get(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig); -int sme_mgt_coex_info_get(unifi_priv_t *priv, CsrWifiSmeCoexInfo *coexInfo); -int sme_mgt_packet_filter_set(unifi_priv_t *priv); -int sme_mgt_tspec(unifi_priv_t *priv, CsrWifiSmeListAction action, - u32 tid, CsrWifiSmeDataBlock *tspec, CsrWifiSmeDataBlock *tclas); - -#ifdef CSR_SUPPORT_WEXT -/* - * Blocking functions using the SME MGT API. - */ -int sme_mgt_wifi_on(unifi_priv_t *priv); -int sme_mgt_wifi_off(unifi_priv_t *priv); -/*int sme_mgt_set_value_async(unifi_priv_t *priv, unifi_AppValue *app_value); -int sme_mgt_get_value_async(unifi_priv_t *priv, unifi_AppValue *app_value); -int sme_mgt_get_value(unifi_priv_t *priv, unifi_AppValue *app_value); -int sme_mgt_set_value(unifi_priv_t *priv, unifi_AppValue *app_value); -*/ -int sme_mgt_coex_config_set(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig); -int sme_mgt_coex_config_get(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig); -int sme_mgt_mib_config_set(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig); -int sme_mgt_mib_config_get(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig); - -int sme_mgt_connection_info_set(unifi_priv_t *priv, CsrWifiSmeConnectionInfo *connectionInfo); -int sme_mgt_connection_info_get(unifi_priv_t *priv, CsrWifiSmeConnectionInfo *connectionInfo); -int sme_mgt_connection_config_set(unifi_priv_t *priv, CsrWifiSmeConnectionConfig *connectionConfig); -int sme_mgt_connection_config_get(unifi_priv_t *priv, CsrWifiSmeConnectionConfig *connectionConfig); -int sme_mgt_connection_stats_get(unifi_priv_t *priv, CsrWifiSmeConnectionStats *connectionStats); - -int sme_mgt_versions_get(unifi_priv_t *priv, CsrWifiSmeVersions *versions); - - -int sme_mgt_scan_full(unifi_priv_t *priv, CsrWifiSsid *specific_ssid, - int num_channels, unsigned char *channel_list); -int sme_mgt_scan_results_get_async(unifi_priv_t *priv, - struct iw_request_info *info, - char *scan_results, - long scan_results_len); -int sme_mgt_disconnect(unifi_priv_t *priv); -int sme_mgt_connect(unifi_priv_t *priv); -int sme_mgt_key(unifi_priv_t *priv, CsrWifiSmeKey *sme_key, - CsrWifiSmeListAction action); -int sme_mgt_pmkid(unifi_priv_t *priv, CsrWifiSmeListAction action, - CsrWifiSmePmkidList *pmkid_list); -int sme_mgt_mib_get(unifi_priv_t *priv, - unsigned char *varbind, int *length); -int sme_mgt_mib_set(unifi_priv_t *priv, - unsigned char *varbind, int length); -#ifdef CSR_SUPPORT_WEXT_AP -int sme_ap_start(unifi_priv_t *priv, u16 interface_tag, CsrWifiSmeApConfig_t *ap_config); -int sme_ap_stop(unifi_priv_t *priv, u16 interface_tag); -int sme_ap_config(unifi_priv_t *priv, CsrWifiSmeApMacConfig *ap_mac_config, CsrWifiNmeApConfig *group_security_config); -int uf_configure_supported_rates(u8 * supportedRates, u8 phySupportedBitmap); -#endif -int unifi_translate_scan(struct net_device *dev, - struct iw_request_info *info, - char *current_ev, char *end_buf, - CsrWifiSmeScanResult *scan_data, - int scan_index); - -#endif /* CSR_SUPPORT_WEXT */ - -int unifi_cfg_power(unifi_priv_t *priv, unsigned char *arg); -int unifi_cfg_power_save(unifi_priv_t *priv, unsigned char *arg); -int unifi_cfg_power_supply(unifi_priv_t *priv, unsigned char *arg); -int unifi_cfg_packet_filters(unifi_priv_t *priv, unsigned char *arg); -int unifi_cfg_wmm_qos_info(unifi_priv_t *priv, unsigned char *arg); -int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg); -int unifi_cfg_wmm_delts(unifi_priv_t *priv, unsigned char *arg); -int unifi_cfg_get_info(unifi_priv_t *priv, unsigned char *arg); -int unifi_cfg_strict_draft_n(unifi_priv_t *priv, unsigned char *arg); -int unifi_cfg_enable_okc(unifi_priv_t *priv, unsigned char *arg); -#ifdef CSR_SUPPORT_WEXT_AP -int unifi_cfg_set_ap_config(unifi_priv_t * priv, unsigned char* arg); -#endif - - - -int convert_sme_error(CsrResult error); - - -#endif /* __LINUX_UNIFI_SME_H__ */ diff --git a/drivers/staging/csr/unifi_wext.h b/drivers/staging/csr/unifi_wext.h deleted file mode 100644 index beba089e2e35..000000000000 --- a/drivers/staging/csr/unifi_wext.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - ***************************************************************************** - * - * FILE : unifi_wext.h - * - * PURPOSE : Private header file for unifi driver support to wireless extensions. - * - * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * -***************************************************************************** - */ -#ifndef __LINUX_UNIFI_WEXT_H__ -#define __LINUX_UNIFI_WEXT_H__ 1 - -#include <linux/kernel.h> -#include <net/iw_handler.h> -#include "csr_wifi_sme_prim.h" - -/* - * wext.c - */ -/* A few details needed for WEP (Wireless Equivalent Privacy) */ -#define UNIFI_MAX_KEY_SIZE 16 -#define NUM_WEPKEYS 4 -#define SMALL_KEY_SIZE 5 -#define LARGE_KEY_SIZE 13 -typedef struct wep_key_t { - int len; - unsigned char key[UNIFI_MAX_KEY_SIZE]; /* 40-bit and 104-bit keys */ -} wep_key_t; - -#define UNIFI_SCAN_ACTIVE 0 -#define UNIFI_SCAN_PASSIVE 1 -#define UNIFI_MAX_SSID_LEN 32 - -#define MAX_WPA_IE_LEN 64 -#define MAX_RSN_IE_LEN 255 - -/* - * Function to register in the netdev to report wireless stats. - */ -struct iw_statistics *unifi_get_wireless_stats(struct net_device *dev); - -void uf_sme_wext_set_defaults(unifi_priv_t *priv); - - -/* - * wext_events.c - */ -/* Functions to generate Wireless Extension events */ -void wext_send_scan_results_event(unifi_priv_t *priv); -void wext_send_assoc_event(unifi_priv_t *priv, unsigned char *bssid, - unsigned char *req_ie, int req_ie_len, - unsigned char *resp_ie, int resp_ie_len, - unsigned char *scan_ie, unsigned int scan_ie_len); -void wext_send_disassoc_event(unifi_priv_t *priv); -void wext_send_michaelmicfailure_event(unifi_priv_t *priv, - u16 count, CsrWifiMacAddress address, - CsrWifiSmeKeyType keyType, u16 interfaceTag); -void wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, u8 preauth_allowed, u16 interfaceTag); -void wext_send_started_event(unifi_priv_t *priv); - - -static inline int -uf_iwe_stream_add_point(struct iw_request_info *info, char *start, char *stop, - struct iw_event *piwe, char *extra) -{ - char *new_start; - - new_start = iwe_stream_add_point(info, start, stop, piwe, extra); - if (unlikely(new_start == start)) - return -E2BIG; - - return (new_start - start); -} - - -static inline int -uf_iwe_stream_add_event(struct iw_request_info *info, char *start, char *stop, - struct iw_event *piwe, int len) -{ - char *new_start; - - new_start = iwe_stream_add_event(info, start, stop, piwe, len); - if (unlikely(new_start == start)) - return -E2BIG; - - return (new_start - start); -} - -static inline int -uf_iwe_stream_add_value(struct iw_request_info *info, char *stream, char *start, - char *stop, struct iw_event *piwe, int len) -{ - char *new_start; - - new_start = iwe_stream_add_value(info, stream, start, stop, piwe, len); - if (unlikely(new_start == start)) - return -E2BIG; - - return (new_start - start); -} - - -#endif /* __LINUX_UNIFI_WEXT_H__ */ diff --git a/drivers/staging/csr/unifiio.h b/drivers/staging/csr/unifiio.h deleted file mode 100644 index b9de0cb94e9a..000000000000 --- a/drivers/staging/csr/unifiio.h +++ /dev/null @@ -1,398 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * - * FILE: unifiio.h - * - * Public definitions for the UniFi linux driver. - * This is mostly ioctl command values and structs. - * - * Include <sys/ioctl.h> or similar before this file - * - * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#ifndef __UNIFIIO_H__ -#define __UNIFIIO_H__ - -#include <linux/types.h> - -#define UNIFI_GET_UDI_ENABLE _IOR('u', 1, int) -#define UNIFI_SET_UDI_ENABLE _IOW('u', 2, int) -/* Values for UDI_ENABLE */ -#define UDI_ENABLE_DATA 0x1 -#define UDI_ENABLE_CONTROL 0x2 - -/* MIB set/get. Arg is a pointer to a varbind */ -#define UNIFI_GET_MIB _IOWR('u', 3, unsigned char *) -#define UNIFI_SET_MIB _IOW ('u', 4, unsigned char *) -#define MAX_VARBIND_LENGTH 127 - -/* Private IOCTLs */ -#define SIOCIWS80211POWERSAVEPRIV SIOCIWFIRSTPRIV -#define SIOCIWG80211POWERSAVEPRIV SIOCIWFIRSTPRIV + 1 -#define SIOCIWS80211RELOADDEFAULTSPRIV SIOCIWFIRSTPRIV + 2 -#define SIOCIWSCONFWAPIPRIV SIOCIWFIRSTPRIV + 4 -#define SIOCIWSWAPIKEYPRIV SIOCIWFIRSTPRIV + 6 -#define SIOCIWSSMEDEBUGPRIV SIOCIWFIRSTPRIV + 8 -#define SIOCIWSAPCFGPRIV SIOCIWFIRSTPRIV + 10 -#define SIOCIWSAPSTARTPRIV SIOCIWFIRSTPRIV + 12 -#define SIOCIWSAPSTOPPRIV SIOCIWFIRSTPRIV + 14 -#define SIOCIWSFWRELOADPRIV SIOCIWFIRSTPRIV + 16 -#define SIOCIWSSTACKSTART SIOCIWFIRSTPRIV + 18 -#define SIOCIWSSTACKSTOP SIOCIWFIRSTPRIV + 20 - - - -#define IWPRIV_POWER_SAVE_MAX_STRING 32 -#define IWPRIV_SME_DEBUG_MAX_STRING 32 -#define IWPRIV_SME_MAX_STRING 120 - - -/* Private configuration commands */ -#define UNIFI_CFG _IOWR('u', 5, unsigned char *) -/* - * <------------------ Read/Write Buffer --------------------> - * _____________________________________________________________ - * | Cmd | Arg | ... Buffer (opt) ... | - * ------------------------------------------------------------- - * <-- uint --><-- uint --><----- unsigned char buffer ------> - * - * Cmd: A unifi_cfg_command_t command. - * Arg: Out:Length if Cmd==UNIFI_CFG_GET - * In:PowerOnOff if Cmd==UNIFI_CFG_POWER - * In:PowerMode if Cmd==UNIFI_CFG_POWERSAVE - * In:Length if Cmd==UNIFI_CFG_FILTER - * In:WMM Qos Info if Cmd==UNIFI_CFG_WMM_QOS_INFO - * Buffer: Out:Data if Cmd==UNIFI_CFG_GET - * NULL if Cmd==UNIFI_CFG_POWER - * NULL if Cmd==UNIFI_CFG_POWERSAVE - * In:Filters if Cmd==UNIFI_CFG_FILTER - * - * where Filters is a uf_cfg_bcast_packet_filter_t structure - * followed by 0 - n tclas_t structures. The length of the tclas_t - * structures is obtained by uf_cfg_bcast_packet_filter_t::tclas_ies_length. - */ - - -#define UNIFI_PUTEST _IOWR('u', 6, unsigned char *) -/* - * <------------------ Read/Write Buffer --------------------> - * _____________________________________________________________ - * | Cmd | Arg | ... Buffer (opt) ... | - * ------------------------------------------------------------- - * <-- uint --><-- uint --><----- unsigned char buffer ------> - * - * Cmd: A unifi_putest_command_t command. - * Arg: N/A if Cmd==UNIFI_PUTEST_START - * N/A if Cmd==UNIFI_PUTEST_STOP - * In:int (Clock Speed) if Cmd==UNIFI_PUTEST_SET_SDIO_CLOCK - * In/Out:sizeof(unifi_putest_cmd52) if Cmd==UNIFI_PUTEST_CMD52_READ - * In:sizeof(unifi_putest_cmd52) if Cmd==UNIFI_PUTEST_CMD52_WRITE - * In:uint (f/w file name length) if Cmd==UNIFI_PUTEST_DL_FW - * Buffer: NULL if Cmd==UNIFI_PUTEST_START - * NULL if Cmd==UNIFI_PUTEST_STOP - * NULL if Cmd==UNIFI_PUTEST_SET_SDIO_CLOCK - * In/Out:unifi_putest_cmd52 if Cmd==UNIFI_PUTEST_CMD52_READ - * In:unifi_putest_cmd52 if Cmd==UNIFI_PUTEST_CMD52_WRITE - * In:f/w file name if Cmd==UNIFI_PUTEST_DL_FW - */ - -#define UNIFI_BUILD_TYPE _IOWR('u', 7, unsigned char) -#define UNIFI_BUILD_NME 1 -#define UNIFI_BUILD_WEXT 2 -#define UNIFI_BUILD_AP 3 - -/* debugging */ -#define UNIFI_KICK _IO ('u', 0x10) -#define UNIFI_SET_DEBUG _IO ('u', 0x11) -#define UNIFI_SET_TRACE _IO ('u', 0x12) - -#define UNIFI_GET_INIT_STATUS _IOR ('u', 0x15, int) -#define UNIFI_SET_UDI_LOG_MASK _IOR('u', 0x18, unifiio_filter_t) -#define UNIFI_SET_UDI_SNAP_MASK _IOW('u', 0x1a, unifiio_snap_filter_t) -#define UNIFI_SET_AMP_ENABLE _IOWR('u', 0x1b, int) - -#define UNIFI_INIT_HW _IOR ('u', 0x13, unsigned char) -#define UNIFI_INIT_NETDEV _IOW ('u', 0x14, unsigned char[6]) -#define UNIFI_SME_PRESENT _IOW ('u', 0x19, int) - -#define UNIFI_CFG_PERIOD_TRAFFIC _IOW ('u', 0x21, unsigned char *) -#define UNIFI_CFG_UAPSD_TRAFFIC _IOW ('u', 0x22, unsigned char) - -#define UNIFI_COREDUMP_GET_REG _IOWR('u', 0x23, unifiio_coredump_req_t) - - -/* - * Following reset, f/w may only be downloaded using CMD52. - * This is slow, so there is a facility to download a secondary - * loader first which supports CMD53. - * If loader_len is > 0, then loader_data is assumed to point to - * a suitable secondary loader that can be used to download the - * main image. - * - * The driver will run the host protocol initialisation sequence - * after downloading the image. - * - * If both lengths are zero, then the f/w is assumed to have been - * booted from Flash and the host protocol initialisation sequence - * is run. - */ -typedef struct { - - /* Number of bytes in the image */ - int img_len; - - /* Pointer to image data. */ - unsigned char *img_data; - - - /* Number of bytes in the loader image */ - int loader_len; - - /* Pointer to loader image data. */ - unsigned char *loader_data; - -} unifiio_img_t; - - -/* Structure of data read from the unifi device. */ -typedef struct -{ - /* Length (in bytes) of entire structure including appended bulk data */ - int length; - - /* System time (in milliseconds) that signal was transferred */ - int timestamp; - - /* Direction in which signal was transferred. */ - int direction; -#define UDI_FROM_HOST 0 -#define UDI_TO_HOST 1 -#define UDI_CONFIG_IND 2 - - /* The length of the signal (in bytes) not including bulk data */ - int signal_length; - - /* Signal body follows, then any bulk data */ - -} udi_msg_t; - - -typedef enum -{ - UfSigFil_AllOn = 0, /* Log all signal IDs */ - UfSigFil_AllOff = 1, /* Don't log any signal IDs */ - UfSigFil_SelectOn = 2, /* Log these signal IDs */ - UfSigFil_SelectOff = 3 /* Don't log these signal IDs */ -} uf_sigfilter_action_t; - -typedef struct { - - /* Number of 16-bit ints in the sig_ids array */ - int num_sig_ids; - /* The action to perform */ - uf_sigfilter_action_t action; - /* List of signal IDs to pass or block */ - unsigned short *sig_ids; - -} unifiio_filter_t; - - -typedef struct { - /* Number of 16-bit ints in the protocols array */ - u16 count; - /* List of protocol ids to pass */ - u16 *protocols; -} unifiio_snap_filter_t; - - - -typedef u8 unifi_putest_command_t; - -#define UNIFI_PUTEST_START 0 -#define UNIFI_PUTEST_STOP 1 -#define UNIFI_PUTEST_SET_SDIO_CLOCK 2 -#define UNIFI_PUTEST_CMD52_READ 3 -#define UNIFI_PUTEST_CMD52_WRITE 4 -#define UNIFI_PUTEST_DL_FW 5 -#define UNIFI_PUTEST_DL_FW_BUFF 6 -#define UNIFI_PUTEST_CMD52_BLOCK_READ 7 -#define UNIFI_PUTEST_COREDUMP_PREPARE 8 -#define UNIFI_PUTEST_GP_READ16 9 -#define UNIFI_PUTEST_GP_WRITE16 10 - - -struct unifi_putest_cmd52 { - int funcnum; - unsigned long addr; - unsigned char data; -}; - - -struct unifi_putest_block_cmd52_r { - int funcnum; - unsigned long addr; - unsigned int length; - unsigned char *data; -}; - -struct unifi_putest_gp_rw16 { - unsigned long addr; /* generic address */ - unsigned short data; -}; - -typedef enum unifi_cfg_command { - UNIFI_CFG_GET, - UNIFI_CFG_POWER, - UNIFI_CFG_POWERSAVE, - UNIFI_CFG_FILTER, - UNIFI_CFG_POWERSUPPLY, - UNIFI_CFG_WMM_QOSINFO, - UNIFI_CFG_WMM_ADDTS, - UNIFI_CFG_WMM_DELTS, - UNIFI_CFG_STRICT_DRAFT_N, - UNIFI_CFG_ENABLE_OKC, - UNIFI_CFG_SET_AP_CONFIG, - UNIFI_CFG_CORE_DUMP /* request to take a fw core dump */ -} unifi_cfg_command_t; - -typedef enum unifi_cfg_power { - UNIFI_CFG_POWER_UNSPECIFIED, - UNIFI_CFG_POWER_OFF, - UNIFI_CFG_POWER_ON -} unifi_cfg_power_t; - -typedef enum unifi_cfg_powersupply { - UNIFI_CFG_POWERSUPPLY_UNSPECIFIED, - UNIFI_CFG_POWERSUPPLY_MAINS, - UNIFI_CFG_POWERSUPPLY_BATTERIES -} unifi_cfg_powersupply_t; - -typedef enum unifi_cfg_powersave { - UNIFI_CFG_POWERSAVE_UNSPECIFIED, - UNIFI_CFG_POWERSAVE_NONE, - UNIFI_CFG_POWERSAVE_FAST, - UNIFI_CFG_POWERSAVE_FULL, - UNIFI_CFG_POWERSAVE_AUTO -} unifi_cfg_powersave_t; - -typedef enum unifi_cfg_get { - UNIFI_CFG_GET_COEX, - UNIFI_CFG_GET_POWER_MODE, - UNIFI_CFG_GET_VERSIONS, - UNIFI_CFG_GET_POWER_SUPPLY, - UNIFI_CFG_GET_INSTANCE, - UNIFI_CFG_GET_AP_CONFIG -} unifi_cfg_get_t; - -#define UNIFI_CFG_FILTER_NONE 0x0000 -#define UNIFI_CFG_FILTER_DHCP 0x0001 -#define UNIFI_CFG_FILTER_ARP 0x0002 -#define UNIFI_CFG_FILTER_NBNS 0x0004 -#define UNIFI_CFG_FILTER_NBDS 0x0008 -#define UNIFI_CFG_FILTER_CUPS 0x0010 -#define UNIFI_CFG_FILTER_ALL 0xFFFF - - -typedef struct uf_cfg_bcast_packet_filter -{ - unsigned long filter_mode; //as defined by HIP protocol - unsigned char arp_filter; - unsigned char dhcp_filter; - unsigned long tclas_ies_length; // length of tclas_ies in bytes - unsigned char tclas_ies[1]; // variable length depending on above field -} uf_cfg_bcast_packet_filter_t; - -typedef struct uf_cfg_ap_config -{ - u8 phySupportedBitmap; - u8 channel; - u16 beaconInterval; - u8 dtimPeriod; - u8 wmmEnabled; - u8 shortSlotTimeEnabled; - u16 groupkeyTimeout; - u8 strictGtkRekeyEnabled; - u16 gmkTimeout; - u16 responseTimeout; - u8 retransLimit; - u8 rxStbc; - u8 rifsModeAllowed; - u8 dualCtsProtection; - u8 ctsProtectionType; - u16 maxListenInterval; -}uf_cfg_ap_config_t; - -typedef struct tcpic_clsfr -{ - __u8 cls_fr_type; - __u8 cls_fr_mask; - __u8 version; - __u8 source_ip_addr[4]; - __u8 dest_ip_addr[4]; - __u16 source_port; - __u16 dest_port; - __u8 dscp; - __u8 protocol; - __u8 reserved; -} __attribute__ ((packed)) tcpip_clsfr_t; - -typedef struct tclas { - __u8 element_id; - __u8 length; - __u8 user_priority; - tcpip_clsfr_t tcp_ip_cls_fr; -} __attribute__ ((packed)) tclas_t; - - -#define CONFIG_IND_ERROR 0x01 -#define CONFIG_IND_EXIT 0x02 -#define CONFIG_SME_NOT_PRESENT 0x10 -#define CONFIG_SME_PRESENT 0x20 - -/* WAPI Key */ -typedef struct -{ - u8 unicastKey; - /* If non zero, then unicast key otherwise group key */ - u8 keyIndex; - u8 keyRsc[16]; - u8 authenticator; - /* If non zero, then authenticator otherwise supplicant */ - u8 address[6]; - u8 key[32]; -} unifiio_wapi_key_t; - -/* Values describing XAP memory regions captured by the mini-coredump system */ -typedef enum unifiio_coredump_space { - UNIFIIO_COREDUMP_MAC_REG, - UNIFIIO_COREDUMP_PHY_REG, - UNIFIIO_COREDUMP_SH_DMEM, - UNIFIIO_COREDUMP_MAC_DMEM, - UNIFIIO_COREDUMP_PHY_DMEM, - UNIFIIO_COREDUMP_TRIGGER_MAGIC = 0xFEED -} unifiio_coredump_space_t; - -/* Userspace tool uses this structure to retrieve a register value from a - * mini-coredump buffer previously saved by the HIP - */ -typedef struct unifiio_coredump_req { - /* From user */ - int index; /* 0=newest, -1=oldest */ - unsigned int offset; /* register offset in space */ - unifiio_coredump_space_t space; /* memory space */ - /* Filled by driver */ - unsigned int drv_build; /* driver build id */ - unsigned int chip_ver; /* chip version */ - unsigned int fw_ver; /* firmware version */ - int requestor; /* requestor: 0=auto dump, 1=manual */ - unsigned int timestamp; /* time of capture by driver */ - unsigned int serial; /* capture serial number */ - int value; /* 16 bit register value, -ve for error */ -} unifiio_coredump_req_t; /* Core-dumped register value request */ - -#endif /* __UNIFIIO_H__ */ diff --git a/drivers/staging/csr/wext_events.c b/drivers/staging/csr/wext_events.c deleted file mode 100644 index 9860ea30da25..000000000000 --- a/drivers/staging/csr/wext_events.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * --------------------------------------------------------------------------- - * FILE: wext_events.c - * - * PURPOSE: - * Code to generate iwevents. - * - * Copyright (C) 2006-2008 by Cambridge Silicon Radio Ltd. - * - * Refer to LICENSE.txt included with this source code for details on - * the license terms. - * - * --------------------------------------------------------------------------- - */ -#include <linux/types.h> -#include <linux/etherdevice.h> -#include <linux/if_arp.h> -#include "csr_wifi_hip_unifi.h" -#include "unifi_priv.h" - - - -/* - * --------------------------------------------------------------------------- - * wext_send_assoc_event - * - * Send wireless-extension events up to userland to announce - * successful association with an AP. - * - * Arguments: - * priv Pointer to driver context. - * bssid MAC address of AP we associated with - * req_ie, req_ie_len IEs in the original request - * resp_ie, resp_ie_len IEs in the response - * - * Returns: - * None. - * - * Notes: - * This is sent on first successful association, and again if we - * roam to another AP. - * --------------------------------------------------------------------------- - */ -void -wext_send_assoc_event(unifi_priv_t *priv, unsigned char *bssid, - unsigned char *req_ie, int req_ie_len, - unsigned char *resp_ie, int resp_ie_len, - unsigned char *scan_ie, unsigned int scan_ie_len) -{ -#if WIRELESS_EXT > 17 - union iwreq_data wrqu; - - if (req_ie_len == 0) req_ie = NULL; - wrqu.data.length = req_ie_len; - wrqu.data.flags = 0; - wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], IWEVASSOCREQIE, &wrqu, req_ie); - - if (resp_ie_len == 0) resp_ie = NULL; - wrqu.data.length = resp_ie_len; - wrqu.data.flags = 0; - wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], IWEVASSOCRESPIE, &wrqu, resp_ie); - - if (scan_ie_len > 0) { - wrqu.data.length = scan_ie_len; - wrqu.data.flags = 0; - wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], IWEVGENIE, &wrqu, scan_ie); - } - - memcpy(&wrqu.ap_addr.sa_data, bssid, ETH_ALEN); - wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], SIOCGIWAP, &wrqu, NULL); -#endif -} /* wext_send_assoc_event() */ - - - -/* - * --------------------------------------------------------------------------- - * wext_send_disassoc_event - * - * Send a wireless-extension event up to userland to announce - * that we disassociated from an AP. - * - * Arguments: - * priv Pointer to driver context. - * - * Returns: - * None. - * - * Notes: - * The semantics of wpa_supplicant (the userland SME application) are - * that a SIOCGIWAP event with MAC address of all zero means - * disassociate. - * --------------------------------------------------------------------------- - */ -void -wext_send_disassoc_event(unifi_priv_t *priv) -{ -#if WIRELESS_EXT > 17 - union iwreq_data wrqu; - - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); - wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], SIOCGIWAP, &wrqu, NULL); -#endif -} /* wext_send_disassoc_event() */ - - - -/* - * --------------------------------------------------------------------------- - * wext_send_scan_results_event - * - * Send wireless-extension events up to userland to announce - * completion of a scan. - * - * Arguments: - * priv Pointer to driver context. - * - * Returns: - * None. - * - * Notes: - * This doesn't actually report the results, they are retrieved - * using the SIOCGIWSCAN ioctl command. - * --------------------------------------------------------------------------- - */ -void -wext_send_scan_results_event(unifi_priv_t *priv) -{ -#if WIRELESS_EXT > 17 - union iwreq_data wrqu; - - wrqu.data.length = 0; - wrqu.data.flags = 0; - wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], SIOCGIWSCAN, &wrqu, NULL); - -#endif -} /* wext_send_scan_results_event() */ - - - -/* - * --------------------------------------------------------------------------- - * wext_send_michaelmicfailure_event - * - * Send wireless-extension events up to userland to announce - * completion of a scan. - * - * Arguments: - * priv Pointer to driver context. - * count, macaddr, key_type, key_idx, tsc - * Parameters from report from UniFi. - * - * Returns: - * None. - * --------------------------------------------------------------------------- - */ -#if WIRELESS_EXT >= 18 -static inline void -_send_michaelmicfailure_event(struct net_device *dev, - int count, const unsigned char *macaddr, - int key_type, int key_idx, - unsigned char *tsc) -{ - union iwreq_data wrqu; - struct iw_michaelmicfailure mmf; - - memset(&mmf, 0, sizeof(mmf)); - - mmf.flags = key_idx & IW_MICFAILURE_KEY_ID; - if (key_type == CSR_GROUP) { - mmf.flags |= IW_MICFAILURE_GROUP; - } else { - mmf.flags |= IW_MICFAILURE_PAIRWISE; - } - mmf.flags |= ((count << 5) & IW_MICFAILURE_COUNT); - - mmf.src_addr.sa_family = ARPHRD_ETHER; - memcpy(mmf.src_addr.sa_data, macaddr, ETH_ALEN); - - memcpy(mmf.tsc, tsc, IW_ENCODE_SEQ_MAX_SIZE); - - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = sizeof(mmf); - - wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&mmf); -} -#elif WIRELESS_EXT >= 15 -static inline void -_send_michaelmicfailure_event(struct net_device *dev, - int count, const unsigned char *macaddr, - int key_type, int key_idx, - unsigned char *tsc) -{ - union iwreq_data wrqu; - char buf[128]; - - sprintf(buf, - "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=%pM)", - key_idx, (key_type == CSR_GROUP) ? "broad" : "uni", macaddr); - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = strlen(buf); - wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); -} -#else /* WIRELESS_EXT >= 15 */ -static inline void -_send_michaelmicfailure_event(struct net_device *dev, - int count, const unsigned char *macaddr, - int key_type, int key_idx, - unsigned char *tsc) -{ - /* Not supported before WEXT 15 */ -} -#endif /* WIRELESS_EXT >= 15 */ - - -void -wext_send_michaelmicfailure_event(unifi_priv_t *priv, - u16 count, - CsrWifiMacAddress address, - CsrWifiSmeKeyType keyType, - u16 interfaceTag) -{ - unsigned char tsc[8] = {0}; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "wext_send_michaelmicfailure_event bad interfaceTag\n"); - return; - } - - _send_michaelmicfailure_event(priv->netdev[interfaceTag], - count, - address.a, - keyType, - 0, - tsc); -} /* wext_send_michaelmicfailure_event() */ - -void -wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, u8 preauth_allowed, u16 interfaceTag) -{ -#if WIRELESS_EXT > 17 - union iwreq_data wrqu; - struct iw_pmkid_cand pmkid_cand; - - if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) { - unifi_error(priv, "wext_send_pmkid_candidate_event bad interfaceTag\n"); - return; - } - - memset(&pmkid_cand, 0, sizeof(pmkid_cand)); - - if (preauth_allowed) { - pmkid_cand.flags |= IW_PMKID_CAND_PREAUTH; - } - pmkid_cand.bssid.sa_family = ARPHRD_ETHER; - memcpy(pmkid_cand.bssid.sa_data, bssid.a, ETH_ALEN); - /* Used as priority, smaller the number higher the priority, not really used in our case */ - pmkid_cand.index = 1; - - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = sizeof(pmkid_cand); - - wireless_send_event(priv->netdev[interfaceTag], IWEVPMKIDCAND, &wrqu, (char *)&pmkid_cand); -#endif -} /* wext_send_pmkid_candidate_event() */ - -/* - * Send a custom WEXT event to say we have completed initialisation - * and are now ready for WEXT ioctls. Used by Android wpa_supplicant. - */ -void -wext_send_started_event(unifi_priv_t *priv) -{ -#if WIRELESS_EXT > 17 - union iwreq_data wrqu; - char data[] = "STARTED"; - - wrqu.data.length = sizeof(data); - wrqu.data.flags = 0; - wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], IWEVCUSTOM, &wrqu, data); -#endif -} /* wext_send_started_event() */ - From 84672369ffb98a51d4ddf74c20a23636da3ad615 Mon Sep 17 00:00:00 2001 From: Fernando Soto <fsoto@bluecatnetworks.com> Date: Fri, 14 Jun 2013 23:13:35 +0000 Subject: [PATCH 170/913] Drivers: hv: vmbus: incorrect device name is printed when child device is unregistered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Whenever a device is unregistered in vmbus_device_unregister (drivers/hv/vmbus_drv.c), the device name in the log message may contain garbage as the memory has already been freed by the time pr_info is called. Log example: [ 3149.170475] hv_vmbus: child device àõsèè0_5 unregistered By logging the message just before calling device_unregister, the correct device name is printed: [ 3145.034652] hv_vmbus: child device vmbus_0_5 unregistered Also changing register & unregister messages to debug to avoid unnecessarily cluttering the kernel log. Signed-off-by: Fernando M Soto <fsoto@bluecatnetworks.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/hv/vmbus_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index a2464bf07c49..e8e071fc1d6d 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -690,7 +690,7 @@ int vmbus_device_register(struct hv_device *child_device_obj) if (ret) pr_err("Unable to register child device\n"); else - pr_info("child device %s registered\n", + pr_debug("child device %s registered\n", dev_name(&child_device_obj->device)); return ret; @@ -702,14 +702,14 @@ int vmbus_device_register(struct hv_device *child_device_obj) */ void vmbus_device_unregister(struct hv_device *device_obj) { + pr_debug("child device %s unregistered\n", + dev_name(&device_obj->device)); + /* * Kick off the process of unregistering the device. * This will call vmbus_remove() and eventually vmbus_device_release() */ device_unregister(&device_obj->device); - - pr_info("child device %s unregistered\n", - dev_name(&device_obj->device)); } From ed07ec93e83ec471d365ce084e43ad90fd205903 Mon Sep 17 00:00:00 2001 From: "K. Y. Srinivasan" <kys@microsoft.com> Date: Sun, 14 Jul 2013 22:38:11 -0700 Subject: [PATCH 171/913] Drivers: hv: balloon: Fix a bug in the hot-add code As we hot-add 128 MB chunks of memory, we wait to ensure that the memory is onlined before attempting to hot-add the next chunk. If the udev rule for memory hot-add is not executed within the allowed time, we would rollback the state and abort further hot-add. Since the hot-add has succeeded and the only failure is that the memory is not onlined within the allowed time, we should not be rolling back the state. Fix this bug. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Cc: Stable <stable@vger.kernel.org> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/hv/hv_balloon.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index 4c605c70ebf9..61b7351df1d4 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -562,7 +562,7 @@ static void hv_mem_hot_add(unsigned long start, unsigned long size, struct hv_hotadd_state *has) { int ret = 0; - int i, nid, t; + int i, nid; unsigned long start_pfn; unsigned long processed_pfn; unsigned long total_pfn = pfn_count; @@ -607,14 +607,11 @@ static void hv_mem_hot_add(unsigned long start, unsigned long size, /* * Wait for the memory block to be onlined. + * Since the hot add has succeeded, it is ok to + * proceed even if the pages in the hot added region + * have not been "onlined" within the allowed time. */ - t = wait_for_completion_timeout(&dm_device.ol_waitevent, 5*HZ); - if (t == 0) { - pr_info("hot_add memory timedout\n"); - has->ha_end_pfn -= HA_CHUNK; - has->covered_end_pfn -= processed_pfn; - break; - } + wait_for_completion_timeout(&dm_device.ol_waitevent, 5*HZ); } From c5e2254f8d63a6654149aa32ac5f2b7dd66a976d Mon Sep 17 00:00:00 2001 From: "K. Y. Srinivasan" <kys@microsoft.com> Date: Sun, 14 Jul 2013 22:38:12 -0700 Subject: [PATCH 172/913] Drivers: hv: balloon: Do not post pressure status if interrupted When we are posting pressure status, we may get interrupted and handle the un-balloon operation. In this case just don't post the status as we know the pressure status is stale. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Cc: Stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/hv/hv_balloon.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index 61b7351df1d4..deb5c25305af 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -975,6 +975,14 @@ static void post_status(struct hv_dynmem_device *dm) dm->num_pages_ballooned + compute_balloon_floor(); + /* + * If our transaction ID is no longer current, just don't + * send the status. This can happen if we were interrupted + * after we picked our transaction ID. + */ + if (status.hdr.trans_id != atomic_read(&trans_id)) + return; + vmbus_sendpacket(dm->dev->channel, &status, sizeof(struct dm_status), (unsigned long)NULL, From ed4bb9744b41d39ba35080c2390e201575121dc7 Mon Sep 17 00:00:00 2001 From: "K. Y. Srinivasan" <kys@microsoft.com> Date: Thu, 11 Jul 2013 12:03:31 -0700 Subject: [PATCH 173/913] Tools: hv: KVP: Fix a bug in IPV6 subnet enumeration Each subnet string needs to be separated with a semicolon. Fix this bug. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Cc: Stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- tools/hv/hv_kvp_daemon.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index ca9fa4d32e07..07819bfa7dba 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c @@ -1026,9 +1026,10 @@ kvp_get_ip_info(int family, char *if_name, int op, if (sn_offset == 0) strcpy(sn_str, cidr_mask); - else + else { + strcat((char *)ip_buffer->sub_net, ";"); strcat(sn_str, cidr_mask); - strcat((char *)ip_buffer->sub_net, ";"); + } sn_offset += strlen(sn_str) + 1; } From 7dcd2677ea912573d9ed4bcd629b0023b2d11505 Mon Sep 17 00:00:00 2001 From: Konstantin Khlebnikov <khlebnikov@openvz.org> Date: Wed, 17 Jul 2013 10:22:58 +0400 Subject: [PATCH 174/913] drm/i915: fix long-standing SNB regression in power consumption after resume v2 This patch fixes regression in power consumtion of sandy bridge gpu, which exists since v3.6 Sometimes after resuming from s2ram gpu starts thinking that it's extremely busy. After that it never reaches rc6 state. Bug exists since kernel v3.6: commit b4ae3f22d238617ca11610b29fde16cf8c0bc6e0 Author: Jesse Barnes <jbarnes@virtuousgeek.org> Date: Thu Jun 14 11:04:48 2012 -0700 drm/i915: load boot context at driver init time For some reason RC6 is already enabled at the beginning of resuming process. Following initliaztion breaks some internal state and confuses RPS engine. This patch disables RC6 at the beginnig of resume and initialization. I've rearranged initialization sequence, because intel_disable_gt_powersave() needs initialized force_wake_get/put and some locks from the dev_priv. Note: The culprit in the initialization sequence seems to be the write to MBCTL added in the above mentioned commit. The first version of this patch just held a forcewake reference across the clock gating init functions, which seems to have been enought to gather quite a few positive test reports. But since that smelled a bit like ad-hoc duct-tape v2 now just disables rps/rc6 across the entire hw setup. References: https://bugs.freedesktop.org/show_bug.cgi?id=54089 References: https://bugzilla.kernel.org/show_bug.cgi?id=58971 References: https://patchwork.kernel.org/patch/2827634/ (patch v1) Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> [danvet: Add note about v1 vs. v2 of this patch and use standard layout for the commit citation. Also add the tested-bys from v1 and a cc: stable.] Cc: stable@vger.kernel.org (Note: tiny conflict due to the addition of the backlight lock in 3.11) Tested-by: Alexander Kaltsas <alexkaltsas@gmail.com> (v1) Tested-by: rocko <rockorequin@hotmail.com> (v1) Tested-by: JohnMB <johnmbryant@sky.com> (v1) Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/i915_dma.c | 18 +++++++++--------- drivers/gpu/drm/i915/intel_pm.c | 5 +++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index adb319b53ecd..5c0663f58aff 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1495,6 +1495,14 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) dev_priv->dev = dev; dev_priv->info = info; + spin_lock_init(&dev_priv->irq_lock); + spin_lock_init(&dev_priv->gpu_error.lock); + spin_lock_init(&dev_priv->rps.lock); + spin_lock_init(&dev_priv->backlight.lock); + mutex_init(&dev_priv->dpio_lock); + mutex_init(&dev_priv->rps.hw_lock); + mutex_init(&dev_priv->modeset_restore_lock); + i915_dump_device_info(dev_priv); if (i915_get_bridge_dev(dev)) { @@ -1586,6 +1594,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) intel_irq_init(dev); intel_gt_init(dev); + intel_gt_reset(dev); /* Try to make sure MCHBAR is enabled before poking at it */ intel_setup_mchbar(dev); @@ -1610,15 +1619,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) if (!IS_I945G(dev) && !IS_I945GM(dev)) pci_enable_msi(dev->pdev); - spin_lock_init(&dev_priv->irq_lock); - spin_lock_init(&dev_priv->gpu_error.lock); - spin_lock_init(&dev_priv->rps.lock); - spin_lock_init(&dev_priv->backlight.lock); - mutex_init(&dev_priv->dpio_lock); - - mutex_init(&dev_priv->rps.hw_lock); - mutex_init(&dev_priv->modeset_restore_lock); - dev_priv->num_plane = 1; if (IS_VALLEYVIEW(dev)) dev_priv->num_plane = 2; diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index d10e6735771f..828c426b4b92 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5487,6 +5487,9 @@ void intel_gt_reset(struct drm_device *dev) if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) __gen6_gt_force_wake_mt_reset(dev_priv); } + + /* BIOS often leaves RC6 enabled, but disable it for hw init */ + intel_disable_gt_powersave(dev); } void intel_gt_init(struct drm_device *dev) @@ -5495,8 +5498,6 @@ void intel_gt_init(struct drm_device *dev) spin_lock_init(&dev_priv->gt_lock); - intel_gt_reset(dev); - if (IS_VALLEYVIEW(dev)) { dev_priv->gt.force_wake_get = vlv_force_wake_get; dev_priv->gt.force_wake_put = vlv_force_wake_put; From c1f01be4060b6f1932e428c209a6c14d6b22fc1c Mon Sep 17 00:00:00 2001 From: Kishon Vijay Abraham I <kishon@ti.com> Date: Wed, 17 Jul 2013 10:51:22 +0300 Subject: [PATCH 175/913] usb: musb: fix resource passed from glue layer to musb some MUSB incarnations, such as those governed by omap2430.c and tusb6010.c, have three resources, not two. Fix the bug created by commit 09fc7d2 (usb: musb: fix incorrect usage of resource pointer) where only two of the three resources would be passed to musb_core.c [ balbi@ti.com : add tusb6010.c to original patch ] Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/musb/omap2430.c | 7 ++++++- drivers/usb/musb/tusb6010.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 6708a3b78ad8..f44e8b5e00c9 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -481,7 +481,7 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32); static int omap2430_probe(struct platform_device *pdev) { - struct resource musb_resources[2]; + struct resource musb_resources[3]; struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; struct omap_musb_board_data *data; struct platform_device *musb; @@ -581,6 +581,11 @@ static int omap2430_probe(struct platform_device *pdev) musb_resources[1].end = pdev->resource[1].end; musb_resources[1].flags = pdev->resource[1].flags; + musb_resources[2].name = pdev->resource[2].name; + musb_resources[2].start = pdev->resource[2].start; + musb_resources[2].end = pdev->resource[2].end; + musb_resources[2].flags = pdev->resource[2].flags; + ret = platform_device_add_resources(musb, musb_resources, ARRAY_SIZE(musb_resources)); if (ret) { diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 2c06a8969a9f..6f8a9ca96ae7 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -1156,7 +1156,7 @@ static u64 tusb_dmamask = DMA_BIT_MASK(32); static int tusb_probe(struct platform_device *pdev) { - struct resource musb_resources[2]; + struct resource musb_resources[3]; struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; struct platform_device *musb; struct tusb6010_glue *glue; @@ -1199,6 +1199,11 @@ static int tusb_probe(struct platform_device *pdev) musb_resources[1].end = pdev->resource[1].end; musb_resources[1].flags = pdev->resource[1].flags; + musb_resources[2].name = pdev->resource[2].name; + musb_resources[2].start = pdev->resource[2].start; + musb_resources[2].end = pdev->resource[2].end; + musb_resources[2].flags = pdev->resource[2].flags; + ret = platform_device_add_resources(musb, musb_resources, ARRAY_SIZE(musb_resources)); if (ret) { From 35c95375f69ceec721fea67a0532bc17ceb5cf64 Mon Sep 17 00:00:00 2001 From: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Wed, 17 Jul 2013 06:55:04 +0200 Subject: [PATCH 176/913] drm/i915: Sanitize shared dpll state There seems to be no limit to the amount of gunk the firmware can leave behind. Some platforms leave pch dplls on which are not in active use at all. The example in the bug report is a Apple Macbook Pro. Note that this escape scrunity of the hw state checker until we've tried to use this enabled, but unused pll since we did only check for the inverse case of a in-used, but disabled pll. v2: Add a WARN in the pll state checker which would have caught this case. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66952 Reported-and-tested-by: shui yangwei <yangweix.shui@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/intel_display.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index c59335ce84f4..76b01c16a0e8 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -8314,6 +8314,8 @@ check_shared_dpll_state(struct drm_device *dev) pll->active, pll->refcount); WARN(pll->active && !pll->on, "pll in active use but not on in sw tracking\n"); + WARN(pll->on && !pll->active, + "pll in on but not on in use in sw tracking\n"); WARN(pll->on != active, "pll on state mismatch (expected %i, found %i)\n", pll->on, active); @@ -9814,8 +9816,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) } pll->refcount = pll->active; - DRM_DEBUG_KMS("%s hw state readout: refcount %i\n", - pll->name, pll->refcount); + DRM_DEBUG_KMS("%s hw state readout: refcount %i, on %i\n", + pll->name, pll->refcount, pll->on); } list_for_each_entry(encoder, &dev->mode_config.encoder_list, @@ -9866,6 +9868,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, struct drm_plane *plane; struct intel_crtc *crtc; struct intel_encoder *encoder; + int i; intel_modeset_readout_hw_state(dev); @@ -9881,6 +9884,18 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, intel_dump_pipe_config(crtc, &crtc->config, "[setup_hw_state]"); } + for (i = 0; i < dev_priv->num_shared_dpll; i++) { + struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i]; + + if (!pll->on || pll->active) + continue; + + DRM_DEBUG_KMS("%s enabled but not in use, disabling\n", pll->name); + + pll->disable(dev_priv, pll); + pll->on = false; + } + if (force_restore) { /* * We need to use raw interfaces for restoring state to avoid From 393536f8b9bbcafce2d334153783c0b7382ca457 Mon Sep 17 00:00:00 2001 From: Nishanth Menon <nm@ti.com> Date: Tue, 16 Jul 2013 11:41:09 -0500 Subject: [PATCH 177/913] regulator: palmas-pmic: doc: fix typo for sleep-mode commit 3c870e3f9d9d98f1ab98614b3b1fd5c79287d361 (regulator: palmas: Change the DT node property names to follow the convention) Missed updating mode-sleep from sleep-mode. Fix the same. Documentation example seems proper for this property. Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org> --- Documentation/devicetree/bindings/regulator/palmas-pmic.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/regulator/palmas-pmic.txt b/Documentation/devicetree/bindings/regulator/palmas-pmic.txt index d5a308629c57..04d67f092383 100644 --- a/Documentation/devicetree/bindings/regulator/palmas-pmic.txt +++ b/Documentation/devicetree/bindings/regulator/palmas-pmic.txt @@ -31,7 +31,7 @@ Optional nodes: Optional sub-node properties: ti,warm-reset - maintain voltage during warm reset(boolean) ti,roof-floor - control voltage selection by pin(boolean) - ti,sleep-mode - mode to adopt in pmic sleep 0 - off, 1 - auto, + ti,mode-sleep - mode to adopt in pmic sleep 0 - off, 1 - auto, 2 - eco, 3 - forced pwm ti,tstep - slope control 0 - Jump, 1 10mV/us, 2 5mV/us, 3 2.5mV/us ti,smps-range - OTP has the wrong range set for the hardware so override From 386c90ac747913f1a31a0cdacb14f2347114474d Mon Sep 17 00:00:00 2001 From: Nishanth Menon <nm@ti.com> Date: Tue, 16 Jul 2013 11:41:10 -0500 Subject: [PATCH 178/913] regulator: palmas-pmic: doc: remove ti,tstep commit 28d1e8cd671a53d6b4f967abbbc2a55f7bd333f6 (regulator: palma: add ramp delay support through regulator constraints) Removed the regulator's ti,step option from driver without updating the documentation. So, remove from documentation and example as well. Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org> --- Documentation/devicetree/bindings/regulator/palmas-pmic.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/Documentation/devicetree/bindings/regulator/palmas-pmic.txt b/Documentation/devicetree/bindings/regulator/palmas-pmic.txt index 04d67f092383..30b0581bb1ce 100644 --- a/Documentation/devicetree/bindings/regulator/palmas-pmic.txt +++ b/Documentation/devicetree/bindings/regulator/palmas-pmic.txt @@ -33,7 +33,6 @@ Optional nodes: ti,roof-floor - control voltage selection by pin(boolean) ti,mode-sleep - mode to adopt in pmic sleep 0 - off, 1 - auto, 2 - eco, 3 - forced pwm - ti,tstep - slope control 0 - Jump, 1 10mV/us, 2 5mV/us, 3 2.5mV/us ti,smps-range - OTP has the wrong range set for the hardware so override 0 - low range, 1 - high range. @@ -59,7 +58,6 @@ pmic { ti,warm-reset; ti,roof-floor; ti,mode-sleep = <0>; - ti,tstep = <0>; ti,smps-range = <1>; }; From 2e57f47d317dd035b18634b0c602272529368fcc Mon Sep 17 00:00:00 2001 From: Chris Wilson <chris@chris-wilson.co.uk> Date: Wed, 17 Jul 2013 12:14:40 +0100 Subject: [PATCH 179/913] drm/i915: Fix dereferencing invalid connectors in is_crtc_connector_off() In commit e3de42b68478a8c95dd27520e9adead2af9477a5 Author: Imre Deak <imre.deak@intel.com> Date: Fri May 3 19:44:07 2013 +0200 drm/i915: force full modeset if the connector is in DPMS OFF mode a new function was added that walked over the set of connectors to see if any of the currently associated CRTC was switched off. This function walked an array of connectors, rather than the array of pointers to connectors contained in the drm_mode_set - i.e. it was dereferencing far past the end of the first connector. This only becomes an issue if we attempt to use a clone mode (i.e. more than one connector per CRTC) such that set->num_connectors > 1. Reported-by: Timo Aaltonen <tjaalton@ubuntu.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65927 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.com> Cc: Egbert Eich <eich@suse.de> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: stable@vger.kernel.org Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/intel_display.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 76b01c16a0e8..76b034be2c7c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -8540,15 +8540,20 @@ static void intel_set_config_restore_state(struct drm_device *dev, } static bool -is_crtc_connector_off(struct drm_crtc *crtc, struct drm_connector *connectors, - int num_connectors) +is_crtc_connector_off(struct drm_mode_set *set) { int i; - for (i = 0; i < num_connectors; i++) - if (connectors[i].encoder && - connectors[i].encoder->crtc == crtc && - connectors[i].dpms != DRM_MODE_DPMS_ON) + if (set->num_connectors == 0) + return false; + + if (WARN_ON(set->connectors == NULL)) + return false; + + for (i = 0; i < set->num_connectors; i++) + if (set->connectors[i]->encoder && + set->connectors[i]->encoder->crtc == set->crtc && + set->connectors[i]->dpms != DRM_MODE_DPMS_ON) return true; return false; @@ -8561,10 +8566,8 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set, /* We should be able to check here if the fb has the same properties * and then just flip_or_move it */ - if (set->connectors != NULL && - is_crtc_connector_off(set->crtc, *set->connectors, - set->num_connectors)) { - config->mode_changed = true; + if (is_crtc_connector_off(set)) { + config->mode_changed = true; } else if (set->crtc->fb != set->fb) { /* If we have no fb then treat it as a full mode set */ if (set->crtc->fb == NULL) { From 53ce9a3364de0723b27d861de93bfc882f7db050 Mon Sep 17 00:00:00 2001 From: Niels de Vos <ndevos@redhat.com> Date: Wed, 17 Jul 2013 14:53:53 +0200 Subject: [PATCH 180/913] fuse: readdirplus: fix dentry leak In case d_lookup() returns a dentry with d_inode == NULL, the dentry is not returned with dput(). This results in triggering a BUG() in shrink_dcache_for_umount_subtree(): BUG: Dentry ...{i=0,n=...} still in use (1) [unmount of fuse fuse] [SzM: need to d_drop() as well] Reported-by: Justin Clift <jclift@redhat.com> Signed-off-by: Niels de Vos <ndevos@redhat.com> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Tested-by: Brian Foster <bfoster@redhat.com> Tested-by: Niels de Vos <ndevos@redhat.com> CC: stable@vger.kernel.org --- fs/fuse/dir.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 0eda52738ec4..2ae5308174e2 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1227,9 +1227,15 @@ static int fuse_direntplus_link(struct file *file, name.hash = full_name_hash(name.name, name.len); dentry = d_lookup(parent, &name); - if (dentry && dentry->d_inode) { + if (dentry) { inode = dentry->d_inode; - if (get_node_id(inode) == o->nodeid) { + if (!inode) { + d_drop(dentry); + } else if (get_node_id(inode) != o->nodeid) { + err = d_invalidate(dentry); + if (err) + goto out; + } else { struct fuse_inode *fi; fi = get_fuse_inode(inode); spin_lock(&fc->lock); @@ -1242,9 +1248,6 @@ static int fuse_direntplus_link(struct file *file, */ goto found; } - err = d_invalidate(dentry); - if (err) - goto out; dput(dentry); dentry = NULL; } From a28ef45cbb1e7fadd5159deb17b02de15c6e4aaf Mon Sep 17 00:00:00 2001 From: Miklos Szeredi <mszeredi@suse.cz> Date: Wed, 17 Jul 2013 14:53:53 +0200 Subject: [PATCH 181/913] fuse: readdirplus: sanity checks Add sanity checks before adding or updating an entry with data received from readdirplus. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> CC: stable@vger.kernel.org --- fs/fuse/dir.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 2ae5308174e2..bb6829720dd6 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1223,6 +1223,12 @@ static int fuse_direntplus_link(struct file *file, if (name.name[1] == '.' && name.len == 2) return 0; } + + if (invalid_nodeid(o->nodeid)) + return -EIO; + if (!fuse_valid_type(o->attr.mode)) + return -EIO; + fc = get_fuse_conn(dir); name.hash = full_name_hash(name.name, name.len); @@ -1231,10 +1237,14 @@ static int fuse_direntplus_link(struct file *file, inode = dentry->d_inode; if (!inode) { d_drop(dentry); - } else if (get_node_id(inode) != o->nodeid) { + } else if (get_node_id(inode) != o->nodeid || + ((o->attr.mode ^ inode->i_mode) & S_IFMT)) { err = d_invalidate(dentry); if (err) goto out; + } else if (is_bad_inode(inode)) { + err = -EIO; + goto out; } else { struct fuse_inode *fi; fi = get_fuse_inode(inode); From 2914941e3178d84a216fc4eb85292dfef3b6d628 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi <mszeredi@suse.cz> Date: Wed, 17 Jul 2013 14:53:53 +0200 Subject: [PATCH 182/913] fuse: readdirplus: fix instantiate Fuse does instantiation slightly differently from NFS/CIFS which use d_materialise_unique(). Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> CC: stable@vger.kernel.org --- fs/fuse/dir.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index bb6829720dd6..5dfbb5439e4e 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1272,10 +1272,19 @@ static int fuse_direntplus_link(struct file *file, if (!inode) goto out; - alias = d_materialise_unique(dentry, inode); - err = PTR_ERR(alias); - if (IS_ERR(alias)) - goto out; + if (S_ISDIR(inode->i_mode)) { + mutex_lock(&fc->inst_mutex); + alias = fuse_d_add_directory(dentry, inode); + mutex_unlock(&fc->inst_mutex); + err = PTR_ERR(alias); + if (IS_ERR(alias)) { + iput(inode); + goto out; + } + } else { + alias = d_splice_alias(inode, dentry); + } + if (alias) { dput(dentry); dentry = alias; From fa2b7213600f8110ebac64acebc78a885b0594a0 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi <mszeredi@suse.cz> Date: Wed, 17 Jul 2013 14:53:53 +0200 Subject: [PATCH 183/913] fuse: readdirplus: change attributes once If we got the inode through fuse_iget() then the attributes are already up-to-date. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> --- fs/fuse/dir.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 5dfbb5439e4e..37d85e05b1f5 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1252,6 +1252,10 @@ static int fuse_direntplus_link(struct file *file, fi->nlookup++; spin_unlock(&fc->lock); + fuse_change_attributes(inode, &o->attr, + entry_attr_timeout(o), + attr_version); + /* * The other branch to 'found' comes via fuse_iget() * which bumps nlookup inside @@ -1291,9 +1295,6 @@ static int fuse_direntplus_link(struct file *file, } found: - fuse_change_attributes(inode, &o->attr, entry_attr_timeout(o), - attr_version); - fuse_change_entry_timeout(dentry, o); err = 0; From c7263bcdc4d150e3c718b711a5f6fad496d9f662 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi <mszeredi@suse.cz> Date: Wed, 17 Jul 2013 14:53:54 +0200 Subject: [PATCH 184/913] fuse: readdirplus: cleanup Niels noted that we don't need the 'dentry = NULL' line. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> CC: Niels de Vos <ndevos@redhat.com> --- fs/fuse/dir.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 37d85e05b1f5..72a5d5b04494 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1263,7 +1263,6 @@ static int fuse_direntplus_link(struct file *file, goto found; } dput(dentry); - dentry = NULL; } dentry = d_alloc(parent, &name); @@ -1299,8 +1298,7 @@ found: err = 0; out: - if (dentry) - dput(dentry); + dput(dentry); return err; } From a47bde9b7cbeb87dbb1c5554e90b770d3cc06c5c Mon Sep 17 00:00:00 2001 From: Ralf Baechle <ralf@linux-mips.org> Date: Wed, 17 Jul 2013 17:28:48 +0200 Subject: [PATCH 185/913] MIPS: Delete dead invocation of exception_exit(). panic() doesn't return so this call was useless. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Reported-by: Alexander Sverdlin <alexander.sverdlin@nsn.com> --- arch/mips/kernel/traps.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 0903d70b2cfe..3035a40c4559 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c @@ -1242,7 +1242,6 @@ asmlinkage void do_mcheck(struct pt_regs *regs) panic("Caught Machine Check exception - %scaused by multiple " "matching entries in the TLB.", (multi_match) ? "" : "not "); - exception_exit(prev_state); } asmlinkage void do_mt(struct pt_regs *regs) From bcfb879432094c267c35a7ff75d953d3a66c193a Mon Sep 17 00:00:00 2001 From: Larry Finger <Larry.Finger@lwfinger.net> Date: Fri, 28 Jun 2013 09:12:53 -0500 Subject: [PATCH 186/913] rtlwifi: Initialize power-setting callback for USB devices Commit a269913c5 entitled "rtlwifi: Rework rtl_lps_leave() and rtl_lps_enter() to use work queue" has two bugs for USB drivers. Firstly, the work queue in question was not initialized. Secondly, the callback routine used by this queue is contained within the file used for PCI devices. As a result, it is not available for architectures without PCI hardware. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Reported-by: Richard Genoud <richard.genoud@gmail.com> Tested-by: Richard Genoud <richard.genoud@gmail.com> Cc: Richard Genoud <richard.genoud@gmail.com> Cc: Stable <stable@vger.kernel.org> [3.10] Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/rtlwifi/pci.c | 13 ------------- drivers/net/wireless/rtlwifi/ps.c | 12 ++++++++++++ drivers/net/wireless/rtlwifi/ps.h | 1 + drivers/net/wireless/rtlwifi/usb.c | 2 ++ 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index c97e9d327331..e70b4ffaf97f 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c @@ -1008,19 +1008,6 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) return; } -static void rtl_lps_change_work_callback(struct work_struct *work) -{ - struct rtl_works *rtlworks = - container_of(work, struct rtl_works, lps_change_work); - struct ieee80211_hw *hw = rtlworks->hw; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->enter_ps) - rtl_lps_enter(hw); - else - rtl_lps_leave(hw); -} - static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw) { struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c index 884bceae38a9..71e917db8338 100644 --- a/drivers/net/wireless/rtlwifi/ps.c +++ b/drivers/net/wireless/rtlwifi/ps.c @@ -611,6 +611,18 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw) MSECS(sleep_intv * mac->vif->bss_conf.beacon_int - 40)); } +void rtl_lps_change_work_callback(struct work_struct *work) +{ + struct rtl_works *rtlworks = + container_of(work, struct rtl_works, lps_change_work); + struct ieee80211_hw *hw = rtlworks->hw; + struct rtl_priv *rtlpriv = rtl_priv(hw); + + if (rtlpriv->enter_ps) + rtl_lps_enter(hw); + else + rtl_lps_leave(hw); +} void rtl_swlps_wq_callback(void *data) { diff --git a/drivers/net/wireless/rtlwifi/ps.h b/drivers/net/wireless/rtlwifi/ps.h index 4d682b753f50..88bd76ea88f7 100644 --- a/drivers/net/wireless/rtlwifi/ps.h +++ b/drivers/net/wireless/rtlwifi/ps.h @@ -49,5 +49,6 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw); void rtl_swlps_rf_sleep(struct ieee80211_hw *hw); void rtl_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len); +void rtl_lps_change_work_callback(struct work_struct *work); #endif diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index a3532e077871..1feebdc92f41 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c @@ -1070,6 +1070,8 @@ int rtl_usb_probe(struct usb_interface *intf, spin_lock_init(&rtlpriv->locks.usb_lock); INIT_WORK(&rtlpriv->works.fill_h2c_cmd, rtl_fill_h2c_cmd_work_callback); + INIT_WORK(&rtlpriv->works.lps_change_work, + rtl_lps_change_work_callback); rtlpriv->usb_data_index = 0; init_completion(&rtlpriv->firmware_loading_complete); From a4943ccbc316fd74d3612d7a5984a91ab7e5dc8c Mon Sep 17 00:00:00 2001 From: Felix Fietkau <nbd@openwrt.org> Date: Sun, 30 Jun 2013 12:02:13 +0200 Subject: [PATCH 187/913] ath9k: fix tx pending frames accounting for dropped packets When dropping packets that have gone far enough into the tx path, the pending frame counter needs to be decreased. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/ath/ath9k/xmit.c | 44 +++++++++++++++++---------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index c59ae43b9b35..927992732620 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -146,6 +146,28 @@ static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, ARRAY_SIZE(bf->rates)); } +static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq, + struct sk_buff *skb) +{ + int q; + + q = skb_get_queue_mapping(skb); + if (txq == sc->tx.uapsdq) + txq = sc->tx.txq_map[q]; + + if (txq != sc->tx.txq_map[q]) + return; + + if (WARN_ON(--txq->pending_frames < 0)) + txq->pending_frames = 0; + + if (txq->stopped && + txq->pending_frames < sc->tx.txq_max_pending[q]) { + ieee80211_wake_queue(sc->hw, q); + txq->stopped = false; + } +} + static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) { struct ath_txq *txq = tid->ac->txq; @@ -167,6 +189,7 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) if (!bf) { bf = ath_tx_setup_buffer(sc, txq, tid, skb); if (!bf) { + ath_txq_skb_done(sc, txq, skb); ieee80211_free_txskb(sc->hw, skb); continue; } @@ -811,6 +834,7 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq, if (!bf) { __skb_unlink(skb, &tid->buf_q); + ath_txq_skb_done(sc, txq, skb); ieee80211_free_txskb(sc->hw, skb); continue; } @@ -1824,6 +1848,7 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_txq *txq, bf = ath_tx_setup_buffer(sc, txq, tid, skb); if (!bf) { + ath_txq_skb_done(sc, txq, skb); ieee80211_free_txskb(sc->hw, skb); return; } @@ -2090,6 +2115,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, bf = ath_tx_setup_buffer(sc, txq, tid, skb); if (!bf) { + ath_txq_skb_done(sc, txq, skb); if (txctl->paprd) dev_kfree_skb_any(skb); else @@ -2189,7 +2215,7 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data; - int q, padpos, padsize; + int padpos, padsize; unsigned long flags; ath_dbg(common, XMIT, "TX complete: skb: %p\n", skb); @@ -2225,21 +2251,7 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, spin_unlock_irqrestore(&sc->sc_pm_lock, flags); __skb_queue_tail(&txq->complete_q, skb); - - q = skb_get_queue_mapping(skb); - if (txq == sc->tx.uapsdq) - txq = sc->tx.txq_map[q]; - - if (txq == sc->tx.txq_map[q]) { - if (WARN_ON(--txq->pending_frames < 0)) - txq->pending_frames = 0; - - if (txq->stopped && - txq->pending_frames < sc->tx.txq_max_pending[q]) { - ieee80211_wake_queue(sc->hw, q); - txq->stopped = false; - } - } + ath_txq_skb_done(sc, txq, skb); } static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, From 9494849e53e74048ee14d512feade01db402eef7 Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov <khoroshilov@ispras.ru> Date: Tue, 2 Jul 2013 00:43:42 +0400 Subject: [PATCH 188/913] ath9k_htc: fix data race between request_firmware_nowait() callback and suspend() ath9k_hif_usb_probe() requests firmware asynchronically and there is some initialization postponed till firmware is ready. In particular, ath9k_hif_usb_firmware_cb() callback initializes hif_dev->tx.tx_buf and hif_dev->tx.tx_pending lists. At the same time, ath9k_hif_usb_suspend() iterates that lists through ath9k_hif_usb_dealloc_urbs(). If suspend happens before request_firmware_nowait() callback is called, it can lead to oops. Similar issue could be in ath9k_hif_usb_disconnect(), but it is prevented using hif_dev->fw_done completion and HIF_USB_READY flag. The patch extends this approach to suspend() as well. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/ath/ath9k/hif_usb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 9e582e14da74..2469db5a5bb1 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -1082,7 +1082,7 @@ static void ath9k_hif_usb_firmware_fail(struct hif_device_usb *hif_dev) struct device *dev = &hif_dev->udev->dev; struct device *parent = dev->parent; - complete(&hif_dev->fw_done); + complete_all(&hif_dev->fw_done); if (parent) device_lock(parent); @@ -1131,7 +1131,7 @@ static void ath9k_hif_usb_firmware_cb(const struct firmware *fw, void *context) release_firmware(fw); hif_dev->flags |= HIF_USB_READY; - complete(&hif_dev->fw_done); + complete_all(&hif_dev->fw_done); return; @@ -1316,7 +1316,10 @@ static int ath9k_hif_usb_suspend(struct usb_interface *interface, if (!(hif_dev->flags & HIF_USB_START)) ath9k_htc_suspend(hif_dev->htc_handle); - ath9k_hif_usb_dealloc_urbs(hif_dev); + wait_for_completion(&hif_dev->fw_done); + + if (hif_dev->flags & HIF_USB_READY) + ath9k_hif_usb_dealloc_urbs(hif_dev); return 0; } From b4a2cf76ab7c08628c62b2062dacefa496b59dfd Mon Sep 17 00:00:00 2001 From: Trond Myklebust <Trond.Myklebust@netapp.com> Date: Wed, 17 Jul 2013 16:43:16 -0400 Subject: [PATCH 189/913] NFSv4: Fix a regression against the FreeBSD server Technically, the Linux client is allowed by the NFSv4 spec to send 3 word bitmaps as part of an OPEN request. However, this causes the current FreeBSD server to return NFS4ERR_ATTRNOTSUPP errors. Fix the regression by making the Linux client use a 2 word bitmap unless doing NFSv4.2 with labeled NFS. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> --- fs/nfs/nfs4xdr.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 0abfb8466e79..c74d6168db99 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -999,6 +999,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, __be32 *p; __be32 *q; int len; + uint32_t bmval_len = 2; uint32_t bmval0 = 0; uint32_t bmval1 = 0; uint32_t bmval2 = 0; @@ -1010,7 +1011,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, * = 40 bytes, plus any contribution from variable-length fields * such as owner/group. */ - len = 20; + len = 8; /* Sigh */ if (iap->ia_valid & ATTR_SIZE) @@ -1040,8 +1041,6 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, } len += 4 + (XDR_QUADLEN(owner_grouplen) << 2); } - if (label) - len += 4 + 4 + 4 + (XDR_QUADLEN(label->len) << 2); if (iap->ia_valid & ATTR_ATIME_SET) len += 16; else if (iap->ia_valid & ATTR_ATIME) @@ -1050,15 +1049,22 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, len += 16; else if (iap->ia_valid & ATTR_MTIME) len += 4; + if (label) { + len += 4 + 4 + 4 + (XDR_QUADLEN(label->len) << 2); + bmval_len = 3; + } + + len += bmval_len << 2; p = reserve_space(xdr, len); /* * We write the bitmap length now, but leave the bitmap and the attribute * buffer length to be backfilled at the end of this routine. */ - *p++ = cpu_to_be32(3); + *p++ = cpu_to_be32(bmval_len); q = p; - p += 4; + /* Skip bitmap entries + attrlen */ + p += bmval_len + 1; if (iap->ia_valid & ATTR_SIZE) { bmval0 |= FATTR4_WORD0_SIZE; @@ -1112,10 +1118,11 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, len, ((char *)p - (char *)q) + 4); BUG(); } - len = (char *)p - (char *)q - 16; + len = (char *)p - (char *)q - (bmval_len << 2); *q++ = htonl(bmval0); *q++ = htonl(bmval1); - *q++ = htonl(bmval2); + if (bmval_len == 3) + *q++ = htonl(bmval2); *q = htonl(len); /* out: */ From 242b2287cd7f27521c8b54a4101d569e53e7a0ca Mon Sep 17 00:00:00 2001 From: Aaron Lu <aaron.lu@intel.com> Date: Tue, 2 Jul 2013 21:59:10 +0800 Subject: [PATCH 190/913] ACPICA: expose OSI version Expose acpi_gbl_osi_data so that code outside of ACPICA can check the value of the last successfull _OSI call. The definitions for OSI versions are moved to actypes.h so that other components can access them too. Based on a patch from Matthew Garrett which in turn was based on an earlier patch from Seth Forshee. [rjw: Changelog] Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/acpica/aclocal.h | 13 ------------- include/acpi/acpixf.h | 1 + include/acpi/actypes.h | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index dfed26545ba2..d4a4901637cd 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h @@ -931,19 +931,6 @@ struct acpi_bit_register_info { /* Structs and definitions for _OSI support and I/O port validation */ -#define ACPI_OSI_WIN_2000 0x01 -#define ACPI_OSI_WIN_XP 0x02 -#define ACPI_OSI_WIN_XP_SP1 0x03 -#define ACPI_OSI_WINSRV_2003 0x04 -#define ACPI_OSI_WIN_XP_SP2 0x05 -#define ACPI_OSI_WINSRV_2003_SP1 0x06 -#define ACPI_OSI_WIN_VISTA 0x07 -#define ACPI_OSI_WINSRV_2008 0x08 -#define ACPI_OSI_WIN_VISTA_SP1 0x09 -#define ACPI_OSI_WIN_VISTA_SP2 0x0A -#define ACPI_OSI_WIN_7 0x0B -#define ACPI_OSI_WIN_8 0x0C - #define ACPI_ALWAYS_ILLEGAL 0x00 struct acpi_interface_info { diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 1b09300810e6..22d497ee6ef9 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -62,6 +62,7 @@ extern u32 acpi_current_gpe_count; extern struct acpi_table_fadt acpi_gbl_FADT; extern u8 acpi_gbl_system_awake_and_running; extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */ +extern u8 acpi_gbl_osi_data; /* Runtime configuration of debug print levels */ diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index a64adcc29ae5..22b03c9286e9 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -1144,4 +1144,19 @@ struct acpi_memory_list { #endif }; +/* Definitions for _OSI support */ + +#define ACPI_OSI_WIN_2000 0x01 +#define ACPI_OSI_WIN_XP 0x02 +#define ACPI_OSI_WIN_XP_SP1 0x03 +#define ACPI_OSI_WINSRV_2003 0x04 +#define ACPI_OSI_WIN_XP_SP2 0x05 +#define ACPI_OSI_WINSRV_2003_SP1 0x06 +#define ACPI_OSI_WIN_VISTA 0x07 +#define ACPI_OSI_WINSRV_2008 0x08 +#define ACPI_OSI_WIN_VISTA_SP1 0x09 +#define ACPI_OSI_WIN_VISTA_SP2 0x0A +#define ACPI_OSI_WIN_7 0x0B +#define ACPI_OSI_WIN_8 0x0C + #endif /* __ACTYPES_H__ */ From c04c697cf1fe8f0962ccd3c2392a9b637a5307aa Mon Sep 17 00:00:00 2001 From: Matthew Garrett <matthew.garrett@nebula.com> Date: Tue, 16 Jul 2013 17:08:16 +0000 Subject: [PATCH 191/913] ACPI / video: Always call acpi_video_init_brightness() on init We have to call acpi_video_init_brightness() even if we're not going to initialise the backlight - Thinkpads seem to use this as the trigger for enabling ACPI notifications rather than handling it in firmware. [rjw: Drop the brightness object created by acpi_video_init_brightness() if we are not going to use it.] Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/video.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 5d7075d25700..f236e172d948 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -898,6 +898,9 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) device->cap._DDC = 1; } + if (acpi_video_init_brightness(device)) + return; + if (acpi_video_backlight_support()) { struct backlight_properties props; struct pci_dev *pdev; @@ -907,9 +910,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) static int count = 0; char *name; - result = acpi_video_init_brightness(device); - if (result) - return; name = kasprintf(GFP_KERNEL, "acpi_video%d", count); if (!name) return; @@ -969,6 +969,11 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) if (result) printk(KERN_ERR PREFIX "Create sysfs link\n"); + } else { + /* Remove the brightness object. */ + kfree(device->brightness->levels); + kfree(device->brightness); + device->brightness = NULL; } } From 3c0fc0710185e618a661528eed2183102e25c2f8 Mon Sep 17 00:00:00 2001 From: Liu ShuoX <shuox.liu@intel.com> Date: Tue, 16 Jul 2013 16:23:44 +0800 Subject: [PATCH 192/913] PNP / ACPI: avoid garbage in resource name Set temporary variable as 0 to avoid garbage string output from /proc/iomem after register resources and reset to PNP dev name later. Signed-off-by: Liu ShuoX <shuox.liu@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/pnp/pnpacpi/rsparser.c | 2 +- drivers/pnp/resource.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 9847ab163829..167f3d00c916 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c @@ -180,7 +180,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, struct pnp_dev *dev = data; struct acpi_resource_dma *dma; struct acpi_resource_vendor_typed *vendor_typed; - struct resource r; + struct resource r = {0}; int i, flags; if (acpi_dev_resource_memory(res, &r) diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index 3e6db1c1dc29..d95e101ffb43 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c @@ -515,6 +515,7 @@ struct pnp_resource *pnp_add_resource(struct pnp_dev *dev, } pnp_res->res = *res; + pnp_res->res.name = dev->name; dev_dbg(&dev->dev, "%pR\n", res); return pnp_res; } From 8c5bd7adb2ce47e6aa39d17b2375f69b0c0aa255 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Date: Thu, 18 Jul 2013 02:08:06 +0200 Subject: [PATCH 193/913] ACPI / video / i915: No ACPI backlight if firmware expects Windows 8 According to Matthew Garrett, "Windows 8 leaves backlight control up to individual graphics drivers rather than making ACPI calls itself. There's plenty of evidence to suggest that the Intel driver for Windows [8] doesn't use the ACPI interface, including the fact that it's broken on a bunch of machines when the OS claims to support Windows 8. The simplest thing to do appears to be to disable the ACPI backlight interface on these systems". There's a problem with that approach, however, because simply avoiding to register the ACPI backlight interface if the firmware calls _OSI for Windows 8 may not work in the following situations: (1) The ACPI backlight interface actually works on the given system and the i915 driver is not loaded (e.g. another graphics driver is used). (2) The ACPI backlight interface doesn't work on the given system, but there is a vendor platform driver that will register its own, equally broken, backlight interface if not prevented from doing so by the ACPI subsystem. Therefore we need to allow the ACPI backlight interface to be registered until the i915 driver is loaded which then will unregister it if the firmware has called _OSI for Windows 8 (or will register the ACPI video driver without backlight support if not already present). For this reason, introduce an alternative function for registering ACPI video, acpi_video_register_with_quirks(), that will check whether or not the ACPI video driver has already been registered and whether or not the backlight Windows 8 quirk has to be applied. If the quirk has to be applied, it will block the ACPI backlight support and either unregister the backlight interface if the ACPI video driver has already been registered, or register the ACPI video driver without the backlight interface otherwise. Make the i915 driver use acpi_video_register_with_quirks() instead of acpi_video_register() in i915_driver_load(). This change is based on earlier patches from Matthew Garrett, Chun-Yi Lee and Seth Forshee and includes a fix from Aaron Lu's. References: https://bugzilla.kernel.org/show_bug.cgi?id=51231 Tested-by: Aaron Lu <aaron.lu@intel.com> Tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com> Tested-by: Yves-Alexis Perez <corsac@debian.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Aaron Lu <aaron.lu@intel.com> Acked-by: Matthew Garrett <matthew.garrett@nebula.com> --- drivers/acpi/internal.h | 11 ++++++ drivers/acpi/video.c | 69 +++++++++++++++++++++++++++++---- drivers/acpi/video_detect.c | 21 ++++++++++ drivers/gpu/drm/i915/i915_dma.c | 2 +- include/acpi/video.h | 11 +++++- include/linux/acpi.h | 1 + 6 files changed, 105 insertions(+), 10 deletions(-) diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 3a50a34fe176..227aca77ee1e 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -164,4 +164,15 @@ struct platform_device; int acpi_create_platform_device(struct acpi_device *adev, const struct acpi_device_id *id); +/*-------------------------------------------------------------------------- + Video + -------------------------------------------------------------------------- */ +#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) +bool acpi_video_backlight_quirks(void); +bool acpi_video_verify_backlight_support(void); +#else +static inline bool acpi_video_backlight_quirks(void) { return false; } +static inline bool acpi_video_verify_backlight_support(void) { return false; } +#endif + #endif /* _ACPI_INTERNAL_H_ */ diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index f236e172d948..e9d4bb60c35c 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -44,6 +44,8 @@ #include <linux/suspend.h> #include <acpi/video.h> +#include "internal.h" + #define PREFIX "ACPI: " #define ACPI_VIDEO_BUS_NAME "Video Bus" @@ -901,7 +903,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) if (acpi_video_init_brightness(device)) return; - if (acpi_video_backlight_support()) { + if (acpi_video_verify_backlight_support()) { struct backlight_properties props; struct pci_dev *pdev; acpi_handle acpi_parent; @@ -1356,8 +1358,8 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) unsigned long long level_current, level_next; int result = -EINVAL; - /* no warning message if acpi_backlight=vendor is used */ - if (!acpi_video_backlight_support()) + /* no warning message if acpi_backlight=vendor or a quirk is used */ + if (!acpi_video_verify_backlight_support()) return 0; if (!device->brightness) @@ -1859,6 +1861,46 @@ static int acpi_video_bus_remove(struct acpi_device *device) return 0; } +static acpi_status video_unregister_backlight(acpi_handle handle, u32 lvl, + void *context, void **rv) +{ + struct acpi_device *acpi_dev; + struct acpi_video_bus *video; + struct acpi_video_device *dev, *next; + + if (acpi_bus_get_device(handle, &acpi_dev)) + return AE_OK; + + if (acpi_match_device_ids(acpi_dev, video_device_ids)) + return AE_OK; + + video = acpi_driver_data(acpi_dev); + if (!video) + return AE_OK; + + acpi_video_bus_stop_devices(video); + mutex_lock(&video->device_list_lock); + list_for_each_entry_safe(dev, next, &video->video_device_list, entry) { + if (dev->backlight) { + backlight_device_unregister(dev->backlight); + dev->backlight = NULL; + kfree(dev->brightness->levels); + kfree(dev->brightness); + } + if (dev->cooling_dev) { + sysfs_remove_link(&dev->dev->dev.kobj, + "thermal_cooling"); + sysfs_remove_link(&dev->cooling_dev->device.kobj, + "device"); + thermal_cooling_device_unregister(dev->cooling_dev); + dev->cooling_dev = NULL; + } + } + mutex_unlock(&video->device_list_lock); + acpi_video_bus_start_devices(video); + return AE_OK; +} + static int __init is_i740(struct pci_dev *dev) { if (dev->device == 0x00D1) @@ -1890,14 +1932,25 @@ static int __init intel_opregion_present(void) return opregion; } -int acpi_video_register(void) +int __acpi_video_register(bool backlight_quirks) { - int result = 0; + bool no_backlight; + int result; + + no_backlight = backlight_quirks ? acpi_video_backlight_quirks() : false; + if (register_count) { /* - * if the function of acpi_video_register is already called, - * don't register the acpi_vide_bus again and return no error. + * If acpi_video_register() has been called already, don't try + * to register acpi_video_bus, but unregister backlight devices + * if no backlight support is requested. */ + if (no_backlight) + acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, + video_unregister_backlight, + NULL, NULL, NULL); + return 0; } @@ -1913,7 +1966,7 @@ int acpi_video_register(void) return 0; } -EXPORT_SYMBOL(acpi_video_register); +EXPORT_SYMBOL(__acpi_video_register); void acpi_video_unregister(void) { diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index e6bd910bc6ed..826e52def080 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -38,6 +38,8 @@ #include <linux/dmi.h> #include <linux/pci.h> +#include "internal.h" + #define PREFIX "ACPI: " ACPI_MODULE_NAME("video"); @@ -234,6 +236,17 @@ static void acpi_video_caps_check(void) acpi_video_get_capabilities(NULL); } +bool acpi_video_backlight_quirks(void) +{ + if (acpi_gbl_osi_data >= ACPI_OSI_WIN_8) { + acpi_video_caps_check(); + acpi_video_support |= ACPI_VIDEO_SKIP_BACKLIGHT; + return true; + } + return false; +} +EXPORT_SYMBOL(acpi_video_backlight_quirks); + /* Promote the vendor interface instead of the generic video module. * This function allow DMI blacklists to be implemented by externals * platform drivers instead of putting a big blacklist in video_detect.c @@ -278,6 +291,14 @@ int acpi_video_backlight_support(void) } EXPORT_SYMBOL(acpi_video_backlight_support); +/* For the ACPI video driver use only. */ +bool acpi_video_verify_backlight_support(void) +{ + return (acpi_video_support & ACPI_VIDEO_SKIP_BACKLIGHT) ? + false : acpi_video_backlight_support(); +} +EXPORT_SYMBOL(acpi_video_verify_backlight_support); + /* * Use acpi_backlight=vendor/video to force that backlight switching * is processed by vendor specific acpi drivers or video.ko driver. diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index adb319b53ecd..cf188ab7051a 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1648,7 +1648,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) if (INTEL_INFO(dev)->num_pipes) { /* Must be done after probing outputs */ intel_opregion_init(dev); - acpi_video_register(); + acpi_video_register_with_quirks(); } if (IS_GEN5(dev)) diff --git a/include/acpi/video.h b/include/acpi/video.h index 61109f2609fc..b26dc4fb7ba8 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -17,12 +17,21 @@ struct acpi_device; #define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200 #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) -extern int acpi_video_register(void); +extern int __acpi_video_register(bool backlight_quirks); +static inline int acpi_video_register(void) +{ + return __acpi_video_register(false); +} +static inline int acpi_video_register_with_quirks(void) +{ + return __acpi_video_register(true); +} extern void acpi_video_unregister(void); extern int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid); #else static inline int acpi_video_register(void) { return 0; } +static inline int acpi_video_register_with_quirks(void) { return 0; } static inline void acpi_video_unregister(void) { return; } static inline int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid) diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 353ba256f368..6ad72f92469c 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -191,6 +191,7 @@ extern bool wmi_has_guid(const char *guid); #define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800 +#define ACPI_VIDEO_SKIP_BACKLIGHT 0x1000 #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) From efaa14c7e981bdf8d3c8d39d3ed12bdc60faabb8 Mon Sep 17 00:00:00 2001 From: Aaron Lu <aaron.lu@intel.com> Date: Tue, 16 Jul 2013 13:08:05 +0800 Subject: [PATCH 194/913] ACPI / video: no automatic brightness changes by win8-compatible firmware Starting from win8, MS backlight control driver will set bit 2 of the parameter of control method _DOS, to inform firmware it should not perform any automatic brightness changes. This mostly affects hotkey notification deliver - if we do not set this bit, on hotkey press, firmware may choose to adjust brightness level instead of sending out notification and doing nothing. So this patch sets bit 2 when calling _DOS so that GUIs can show the notification window on hotkey press. This behavior change is only necessary for win8 systems. The MS document on win8 backlight control is here: http://msdn.microsoft.com/en-US/library/windows/hardware/jj159305 References: https://bugzilla.kernel.org/show_bug.cgi?id=52951 References: https://bugzilla.kernel.org/show_bug.cgi?id=56711 Reported-by: Micael Dias <kam1kaz3@gmail.com> Reported-by: Dan Garton <dan.garton@gmail.com> Reported-by: Bob Ziuchkovski <bob.ziuchkovski@gmail.com> Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/video.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index e9d4bb60c35c..c9fa4621ed25 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -1539,14 +1539,20 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) /* acpi_video interface */ +/* + * Win8 requires setting bit2 of _DOS to let firmware know it shouldn't + * preform any automatic brightness change on receiving a notification. + */ static int acpi_video_bus_start_devices(struct acpi_video_bus *video) { - return acpi_video_bus_DOS(video, 0, 0); + return acpi_video_bus_DOS(video, 0, + acpi_video_backlight_quirks() ? 1 : 0); } static int acpi_video_bus_stop_devices(struct acpi_video_bus *video) { - return acpi_video_bus_DOS(video, 0, 1); + return acpi_video_bus_DOS(video, 0, + acpi_video_backlight_quirks() ? 0 : 1); } static void acpi_video_bus_notify(struct acpi_device *device, u32 event) From 1c118b8226922d225a7df4127926ed2a2d73baaf Mon Sep 17 00:00:00 2001 From: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Date: Thu, 18 Jul 2013 12:52:37 +0800 Subject: [PATCH 195/913] KVM: MMU: avoid fast page fault fixing mmio page fault Currently, fast page fault incorrectly tries to fix mmio page fault when the generation number is invalid (spte.gen != kvm.gen). It then returns to guest to retry the fault since it sees the last spte is nonpresent. This causes an infinite loop. Since fast page fault only works for direct mmu, the issue exists when 1) tdp is enabled. It is only triggered only on AMD host since on Intel host the mmio page fault is recognized as ept-misconfig whose handler call fault-page path with error_code = 0 2) guest paging is disabled. Under this case, the issue is hardly discovered since paging disable is short-lived and the sptes will be invalid after memslot changed for 150 times Fix it by filtering out MMIO page faults in page_fault_can_be_fast. Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de> Tested-by: Markus Trippelsdorf <markus@trippelsdorf.de> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- arch/x86/kvm/mmu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 0d094da49541..9e9285ae9b94 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -2810,6 +2810,13 @@ exit: static bool page_fault_can_be_fast(struct kvm_vcpu *vcpu, u32 error_code) { + /* + * Do not fix the mmio spte with invalid generation number which + * need to be updated by slow page fault path. + */ + if (unlikely(error_code & PFERR_RSVD_MASK)) + return false; + /* * #PF can be fast only if the shadow page table is present and it * is caused by write-protect, that means we just need change the From 1eeb74782d354175ef9f3bff02fae62c6e0aef24 Mon Sep 17 00:00:00 2001 From: Heiko Carstens <heiko.carstens@de.ibm.com> Date: Tue, 16 Jul 2013 10:24:48 +0200 Subject: [PATCH 196/913] s390/bpf,jit: call module_free() from any context The workqueue workaround is no longer needed. Same as 5199dfe531 "sparc: bpf_jit_comp: can call module_free() from any context". Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- arch/s390/net/bpf_jit_comp.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 82f165f8078c..a41f0b15faa1 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c @@ -772,8 +772,7 @@ void bpf_jit_compile(struct sk_filter *fp) } else if (jit.prg == cjit.prg && jit.lit == cjit.lit) { prg_len = jit.prg - jit.start; lit_len = jit.lit - jit.mid; - size = max_t(unsigned long, prg_len + lit_len, - sizeof(struct work_struct)); + size = prg_len + lit_len; if (size >= BPF_SIZE_MAX) goto out; jit.start = module_alloc(size); @@ -804,21 +803,8 @@ out: kfree(addrs); } -static void jit_free_defer(struct work_struct *arg) -{ - module_free(NULL, arg); -} - -/* run from softirq, we must use a work_struct to call - * module_free() from process context - */ void bpf_jit_free(struct sk_filter *fp) { - struct work_struct *work; - - if (fp->bpf_func == sk_run_filter) - return; - work = (struct work_struct *)fp->bpf_func; - INIT_WORK(work, jit_free_defer); - schedule_work(work); + if (fp->bpf_func != sk_run_filter) + module_free(NULL, fp->bpf_func); } From fee1b5488d76396d8f95989624d37f436b3fba44 Mon Sep 17 00:00:00 2001 From: Heiko Carstens <heiko.carstens@de.ibm.com> Date: Tue, 16 Jul 2013 10:36:06 +0200 Subject: [PATCH 197/913] s390/bpf,jit: use generic jit dumper This is the s390 backend of 79617801 "filter: bpf_jit_comp: refactor and unify BPF JIT image dump output". Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- arch/s390/net/bpf_jit_comp.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index a41f0b15faa1..80828bfee2ec 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c @@ -787,15 +787,9 @@ void bpf_jit_compile(struct sk_filter *fp) cjit = jit; } if (bpf_jit_enable > 1) { - pr_err("flen=%d proglen=%lu pass=%d image=%p\n", - fp->len, jit.end - jit.start, pass, jit.start); - if (jit.start) { - printk(KERN_ERR "JIT code:\n"); + bpf_jit_dump(fp->len, jit.end - jit.start, pass, jit.start); + if (jit.start) print_fn_code(jit.start, jit.mid - jit.start); - print_hex_dump(KERN_ERR, "JIT literals:\n", - DUMP_PREFIX_ADDRESS, 16, 1, - jit.mid, jit.end - jit.mid, false); - } } if (jit.start) fp->bpf_func = (void *) jit.start; From aa2d2c73c21f22ce4c643128b671aa7e7bbff54f Mon Sep 17 00:00:00 2001 From: Heiko Carstens <heiko.carstens@de.ibm.com> Date: Tue, 16 Jul 2013 13:25:49 +0200 Subject: [PATCH 198/913] s390/bpf,jit: address randomize and write protect jit code This is the s390 variant of 314beb9b "x86: bpf_jit_comp: secure bpf jit against spraying attacks". With this change the whole jit code and literal pool will be write protected after creation. In addition the start address of the jit code won't be always on a page boundary anymore. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- arch/s390/net/bpf_jit_comp.c | 51 ++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 80828bfee2ec..788e22395acd 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c @@ -9,6 +9,7 @@ #include <linux/netdevice.h> #include <linux/if_vlan.h> #include <linux/filter.h> +#include <linux/random.h> #include <asm/cacheflush.h> #include <asm/processor.h> #include <asm/facility.h> @@ -738,8 +739,41 @@ out: return -1; } +/* + * Note: for security reasons, bpf code will follow a randomly + * sized amount of illegal instructions. + */ +struct bpf_binary_header { + unsigned int pages; + u8 image[]; +}; + +static struct bpf_binary_header *bpf_alloc_binary(unsigned int bpfsize, + u8 **image_ptr) +{ + struct bpf_binary_header *header; + unsigned int sz, hole; + + /* Most BPF filters are really small, but if some of them fill a page, + * allow at least 128 extra bytes for illegal instructions. + */ + sz = round_up(bpfsize + sizeof(*header) + 128, PAGE_SIZE); + header = module_alloc(sz); + if (!header) + return NULL; + memset(header, 0, sz); + header->pages = sz / PAGE_SIZE; + hole = sz - bpfsize + sizeof(*header); + /* Insert random number of illegal instructions before BPF code + * and make sure the first instruction starts at an even address. + */ + *image_ptr = &header->image[(prandom_u32() % hole) & -2]; + return header; +} + void bpf_jit_compile(struct sk_filter *fp) { + struct bpf_binary_header *header = NULL; unsigned long size, prg_len, lit_len; struct bpf_jit jit, cjit; unsigned int *addrs; @@ -775,8 +809,8 @@ void bpf_jit_compile(struct sk_filter *fp) size = prg_len + lit_len; if (size >= BPF_SIZE_MAX) goto out; - jit.start = module_alloc(size); - if (!jit.start) + header = bpf_alloc_binary(size, &jit.start); + if (!header) goto out; jit.prg = jit.mid = jit.start + prg_len; jit.lit = jit.end = jit.start + prg_len + lit_len; @@ -791,14 +825,21 @@ void bpf_jit_compile(struct sk_filter *fp) if (jit.start) print_fn_code(jit.start, jit.mid - jit.start); } - if (jit.start) + if (jit.start) { + set_memory_ro((unsigned long)header, header->pages); fp->bpf_func = (void *) jit.start; + } out: kfree(addrs); } void bpf_jit_free(struct sk_filter *fp) { - if (fp->bpf_func != sk_run_filter) - module_free(NULL, fp->bpf_func); + unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK; + struct bpf_binary_header *header = (void *)addr; + + if (fp->bpf_func == sk_run_filter) + return; + set_memory_rw(addr, header->pages); + module_free(NULL, header); } From c9a7afa380ecaeb0fbeec2e82f86ec5548ad2963 Mon Sep 17 00:00:00 2001 From: Heiko Carstens <heiko.carstens@de.ibm.com> Date: Wed, 17 Jul 2013 14:26:50 +0200 Subject: [PATCH 199/913] s390/bpf,jit: add pkt_type support s390 version of 3b58908a "x86: bpf_jit_comp: add pkt_type support". Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> --- arch/s390/net/bpf_jit_comp.c | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 788e22395acd..d5f10a43a58f 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c @@ -10,6 +10,7 @@ #include <linux/if_vlan.h> #include <linux/filter.h> #include <linux/random.h> +#include <linux/init.h> #include <asm/cacheflush.h> #include <asm/processor.h> #include <asm/facility.h> @@ -222,6 +223,37 @@ static void bpf_jit_epilogue(struct bpf_jit *jit) EMIT2(0x07fe); } +/* Helper to find the offset of pkt_type in sk_buff + * Make sure its still a 3bit field starting at the MSBs within a byte. + */ +#define PKT_TYPE_MAX 0xe0 +static int pkt_type_offset; + +static int __init bpf_pkt_type_offset_init(void) +{ + struct sk_buff skb_probe = { + .pkt_type = ~0, + }; + char *ct = (char *)&skb_probe; + int off; + + pkt_type_offset = -1; + for (off = 0; off < sizeof(struct sk_buff); off++) { + if (!ct[off]) + continue; + if (ct[off] == PKT_TYPE_MAX) + pkt_type_offset = off; + else { + /* Found non matching bit pattern, fix needed. */ + WARN_ON_ONCE(1); + pkt_type_offset = -1; + return -1; + } + } + return 0; +} +device_initcall(bpf_pkt_type_offset_init); + /* * make sure we dont leak kernel information to user */ @@ -721,6 +753,16 @@ call_fn: /* lg %r1,<d(function)>(%r13) */ EMIT4_DISP(0x88500000, 12); } break; + case BPF_S_ANC_PKTTYPE: + if (pkt_type_offset < 0) + goto out; + /* lhi %r5,0 */ + EMIT4(0xa7580000); + /* ic %r5,<d(pkt_type_offset)>(%r2) */ + EMIT4_DISP(0x43502000, pkt_type_offset); + /* srl %r5,5 */ + EMIT4_DISP(0x88500000, 5); + break; case BPF_S_ANC_CPU: /* A = smp_processor_id() */ #ifdef CONFIG_SMP /* l %r5,<d(cpu_nr)> */ From 9a9b1c618d835e7a6a4097eb47ee47991202a3c1 Mon Sep 17 00:00:00 2001 From: Boris BREZILLON <b.brezillon@overkiz.com> Date: Thu, 18 Jul 2013 09:48:40 +0200 Subject: [PATCH 200/913] ASoC: atmel-ssc: remove clk_disable_unprepare call from critical section clk_prepare/unprepare (and indirectly clk_prepare_enable/disable_unprepare) may sleep and thus cannot be called in critical section. This patch fix a bug introduced by commit 6f0d94790efe9f4481bbd7c174ef0e9b5e5db7c4 where clk_disable_unprepare was called with user_lock hold. Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com> Signed-off-by: Mark Brown <broonie@linaro.org> --- drivers/misc/atmel-ssc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index f7b90661e321..e068a76a5f6f 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c @@ -66,14 +66,19 @@ EXPORT_SYMBOL(ssc_request); void ssc_free(struct ssc_device *ssc) { + bool disable_clk = true; + spin_lock(&user_lock); - if (ssc->user) { + if (ssc->user) ssc->user--; - clk_disable_unprepare(ssc->clk); - } else { + else { + disable_clk = false; dev_dbg(&ssc->pdev->dev, "device already free\n"); } spin_unlock(&user_lock); + + if (disable_clk) + clk_disable_unprepare(ssc->clk); } EXPORT_SYMBOL(ssc_free); From 5a74953ff56aa870d6913ef4d81934f5c620c59d Mon Sep 17 00:00:00 2001 From: Michael Holzheu <holzheu@linux.vnet.ibm.com> Date: Thu, 18 Jul 2013 12:17:57 +0200 Subject: [PATCH 201/913] s390/kdump: Disable mmap for s390 The kdump mmap patch series (git commit 83086978c63afd7c73e1c) directly map the PT_LOADs to memory. On s390 this does not work because the copy_from_oldmem() function swaps [0,crashkernel size] with [crashkernel base, crashkernel base+crashkernel size]. The swap int copy_from_oldmem() was done in order correctly implement /dev/oldmem. See: http://marc.info/?l=kexec&m=136940802511603&w=2 Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- fs/proc/vmcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 28503172f2e4..a1a16eb97c7b 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -223,7 +223,7 @@ static inline char *alloc_elfnotes_buf(size_t notes_sz) * regions in the 1st kernel pointed to by PT_LOAD entries) into * virtually contiguous user-space in ELF layout. */ -#ifdef CONFIG_MMU +#if defined(CONFIG_MMU) && !defined(CONFIG_S390) static int mmap_vmcore(struct file *file, struct vm_area_struct *vma) { size_t size = vma->vm_end - vma->vm_start; From 191a2fa0a8d2bbb64c98f9b1976fcb37ee5eae6b Mon Sep 17 00:00:00 2001 From: Michael Holzheu <holzheu@linux.vnet.ibm.com> Date: Thu, 18 Jul 2013 12:18:27 +0200 Subject: [PATCH 202/913] s390/kdump: Allow copy_oldmem_page() copy to virtual memory The kdump mmap patch series (git commit 83086978c63afd7c73e1c) changed the requirements for copy_oldmem_page(). Now this function is used for copying to virtual memory. So implement vmalloc support for the s390 version of copy_oldmem_page(). Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- arch/s390/kernel/crash_dump.c | 51 ++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index f703d91bf720..d8f355657171 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c @@ -21,6 +21,48 @@ #define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y))) #define PTR_DIFF(x, y) ((unsigned long)(((char *) (x)) - ((unsigned long) (y)))) + +/* + * Return physical address for virtual address + */ +static inline void *load_real_addr(void *addr) +{ + unsigned long real_addr; + + asm volatile( + " lra %0,0(%1)\n" + " jz 0f\n" + " la %0,0\n" + "0:" + : "=a" (real_addr) : "a" (addr) : "cc"); + return (void *)real_addr; +} + +/* + * Copy up to one page to vmalloc or real memory + */ +static ssize_t copy_page_real(void *buf, void *src, size_t csize) +{ + size_t size; + + if (is_vmalloc_addr(buf)) { + BUG_ON(csize >= PAGE_SIZE); + /* If buf is not page aligned, copy first part */ + size = min(roundup(__pa(buf), PAGE_SIZE) - __pa(buf), csize); + if (size) { + if (memcpy_real(load_real_addr(buf), src, size)) + return -EFAULT; + buf += size; + src += size; + } + /* Copy second part */ + size = csize - size; + return (size) ? memcpy_real(load_real_addr(buf), src, size) : 0; + } else { + return memcpy_real(buf, src, csize); + } +} + /* * Copy one page from "oldmem" * @@ -32,6 +74,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, size_t csize, unsigned long offset, int userbuf) { unsigned long src; + int rc; if (!csize) return 0; @@ -43,11 +86,11 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, src < OLDMEM_BASE + OLDMEM_SIZE) src -= OLDMEM_BASE; if (userbuf) - copy_to_user_real((void __force __user *) buf, (void *) src, - csize); + rc = copy_to_user_real((void __force __user *) buf, + (void *) src, csize); else - memcpy_real(buf, (void *) src, csize); - return csize; + rc = copy_page_real(buf, (void *) src, csize); + return (rc == 0) ? csize : rc; } /* From 9657a565a476d517451c10b0bcc106e300785aff Mon Sep 17 00:00:00 2001 From: Lan Tianyu <tianyu.lan@intel.com> Date: Tue, 16 Jul 2013 10:07:21 +0800 Subject: [PATCH 203/913] ACPI / video: ignore BIOS initial backlight value for Fujitsu E753 The BIOS of FUjitsu E753 reports an incorrect initial backlight value for WIN8 compatible OS, causing backlight to be dark during startup. This change causes the incorrect initial value from BIOS to be ignored. References: https://bugzilla.kernel.org/show_bug.cgi?id=60161 Reported-and-tested-by: Jan Hinnerk Stosch <janhinnerk.stosch@gmail.com> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> Cc: 3.7+ <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/video.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 5d7075d25700..e441876f5d5b 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -448,6 +448,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13 - 2000 Notebook PC"), }, }, + { + .callback = video_ignore_initial_backlight, + .ident = "Fujitsu E753", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "FUJITSU"), + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E753"), + }, + }, { .callback = video_ignore_initial_backlight, .ident = "HP Pavilion dm4", From a39a9f7b6608c83b89ae404cc39e6607ccdccdde Mon Sep 17 00:00:00 2001 From: Rohit Vaswani <rvaswani@codeaurora.org> Date: Tue, 18 Jun 2013 18:53:31 -0700 Subject: [PATCH 204/913] ARM: msm: dts: Fix the gpio register address for msm8960 Fix the the gpio reg address for the device tree entry. Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org> Signed-off-by: David Brown <davidb@codeaurora.org> --- arch/arm/boot/dts/msm8960-cdp.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/msm8960-cdp.dts b/arch/arm/boot/dts/msm8960-cdp.dts index db2060c46540..9c1167b0459b 100644 --- a/arch/arm/boot/dts/msm8960-cdp.dts +++ b/arch/arm/boot/dts/msm8960-cdp.dts @@ -26,7 +26,7 @@ cpu-offset = <0x80000>; }; - msmgpio: gpio@fd510000 { + msmgpio: gpio@800000 { compatible = "qcom,msm-gpio"; gpio-controller; #gpio-cells = <2>; @@ -34,7 +34,7 @@ interrupts = <0 32 0x4>; interrupt-controller; #interrupt-cells = <2>; - reg = <0xfd510000 0x4000>; + reg = <0x800000 0x4000>; }; serial@16440000 { From b01a60be7a4a161ac0a11df30569d21a20795aef Mon Sep 17 00:00:00 2001 From: Arnd Bergmann <arnd@arndb.de> Date: Fri, 5 Jul 2013 17:43:56 +0200 Subject: [PATCH 205/913] ssb: fix alignment of struct bcma_device_id The ARM OABI and EABI disagree on the alignment of structures with small members, so module init tools may interpret the ssb device table incorrectly, as shown by this warning when building the b43 device driver in an OABI kernel: FATAL: drivers/net/wireless/b43/b43: sizeof(struct ssb_device_id)=6 is not a modulo of the size of section __mod_ssb_device_table=88. Forcing the default (EABI) alignment on the structure makes this problem go away. Since the ssb_device_id may have the same problem, better fix both structures. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Russell King <linux@arm.linux.org.uk> Cc: John W. Linville <linville@tuxdriver.com> Cc: Michael Buesch <mb@bu3sch.de> Cc: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- include/linux/mod_devicetable.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index b62d4af6c667..45e921401b06 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -361,7 +361,8 @@ struct ssb_device_id { __u16 vendor; __u16 coreid; __u8 revision; -}; + __u8 __pad; +} __attribute__((packed, aligned(2))); #define SSB_DEVICE(_vendor, _coreid, _revision) \ { .vendor = _vendor, .coreid = _coreid, .revision = _revision, } #define SSB_DEVTABLE_END \ @@ -377,7 +378,7 @@ struct bcma_device_id { __u16 id; __u8 rev; __u8 class; -}; +} __attribute__((packed,aligned(2))); #define BCMA_CORE(_manuf, _id, _rev, _class) \ { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, } #define BCMA_CORETABLE_END \ From 6a08483926bf26d9e5274b4dd5086d583971f1ea Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven <geert@linux-m68k.org> Date: Wed, 10 Jul 2013 23:03:35 +0200 Subject: [PATCH 206/913] rt2x00: RT2X00 should depend on HAS_DMA If NO_DMA=y: drivers/built-in.o: In function `rt2x00queue_unmap_skb': drivers/net/wireless/rt2x00/rt2x00queue.c:129: undefined reference to `dma_unmap_single' drivers/net/wireless/rt2x00/rt2x00queue.c:133: undefined reference to `dma_unmap_single' drivers/built-in.o: In function `rt2x00queue_map_txskb': drivers/net/wireless/rt2x00/rt2x00queue.c:112: undefined reference to `dma_map_single' drivers/net/wireless/rt2x00/rt2x00queue.c:115: undefined reference to `dma_mapping_error' drivers/built-in.o: In function `rt2x00queue_alloc_rxskb': drivers/net/wireless/rt2x00/rt2x00queue.c:93: undefined reference to `dma_map_single' drivers/net/wireless/rt2x00/rt2x00queue.c:95: undefined reference to `dma_mapping_error' Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: linux-wireless@vger.kernel.org Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/rt2x00/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index 9b915d3a44be..3e60a31582f8 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig @@ -1,6 +1,6 @@ menuconfig RT2X00 tristate "Ralink driver support" - depends on MAC80211 + depends on MAC80211 && HAS_DMA ---help--- This will enable the support for the Ralink drivers, developed in the rt2x00 project <http://rt2x00.serialmonkey.com>. From f287cbd01f2e8e1b325b96233c373619c2d25ee2 Mon Sep 17 00:00:00 2001 From: Bob Copeland <me@bobcopeland.com> Date: Thu, 11 Jul 2013 09:19:13 -0400 Subject: [PATCH 207/913] ath5k: fix extra set bit in multicast mask Bit 32 was always set which looks to have been accidental, according to git history. Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/ath/ath5k/mac80211-ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c index 81b686c6a376..40825d43322e 100644 --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c @@ -325,7 +325,7 @@ ath5k_prepare_multicast(struct ieee80211_hw *hw, struct netdev_hw_addr *ha; mfilt[0] = 0; - mfilt[1] = 1; + mfilt[1] = 0; netdev_hw_addr_list_for_each(ha, mc_list) { /* calculate XOR of eight 6-bit values */ From 6f334c2b3966f10cbd089bb124ec0e114d8d8c77 Mon Sep 17 00:00:00 2001 From: Larry Finger <Larry.Finger@lwfinger.net> Date: Fri, 12 Jul 2013 15:32:15 -0500 Subject: [PATCH 208/913] rtlwifi: Fix build errors for unusual cases The present build configuration for the rtlwifi family of drivers will fail under two known conditions: (1) If rtlwifi is selected without selecting any of the dependent drivers, there are errors in the build. (2) If the PCI drivers are built into the kernel and the USB drivers are modules, or vice versa, there are missing globals. The first condition is fixed by never building rtlwifi unless at least one of the device drivers is selected. The second failure is fixed by splitting the PCI and USB codes out of rtlwifi, and creating their own mini drivers. If the drivers that use them are modules, they will also be modules. Although a number of files are touched by this patch, only Makefile and Kconfig have undergone significant changes. The only modifications to the other files were to export entry points needed by the new rtl_pci and rtl_usb units, or to rename two variables that had names that were likely to cause namespace collisions. Reported-by: Fengguang Wu <fengguang.wu@intel.com> [Condition 1] Reported-by: Ben Hutchings <bhutchings@solarflare.com> [Condition 2] Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: Ben Hutchings <bhutchings@solarflare.com> Cc: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/rtlwifi/Kconfig | 154 +++++++++++++++----------- drivers/net/wireless/rtlwifi/Makefile | 10 +- drivers/net/wireless/rtlwifi/base.c | 19 +++- drivers/net/wireless/rtlwifi/base.h | 2 +- drivers/net/wireless/rtlwifi/core.c | 1 + drivers/net/wireless/rtlwifi/debug.c | 1 + drivers/net/wireless/rtlwifi/efuse.c | 1 + drivers/net/wireless/rtlwifi/pci.c | 9 +- drivers/net/wireless/rtlwifi/ps.c | 4 + drivers/net/wireless/rtlwifi/usb.c | 7 ++ 10 files changed, 132 insertions(+), 76 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/Kconfig b/drivers/net/wireless/rtlwifi/Kconfig index 7253de3d8c66..c2ffce7a907c 100644 --- a/drivers/net/wireless/rtlwifi/Kconfig +++ b/drivers/net/wireless/rtlwifi/Kconfig @@ -1,13 +1,91 @@ -config RTLWIFI - tristate "Realtek wireless card support" - depends on MAC80211 - select FW_LOADER +menuconfig RTL_CARDS + tristate "Realtek rtlwifi family of devices" + depends on MAC80211 && (PCI || USB) + default y ---help--- - This is common code for RTL8192CE/RTL8192CU/RTL8192SE/RTL8723AE - drivers. This module does nothing by itself - the various front-end - drivers need to be enabled to support any desired devices. + This option will enable support for the Realtek mac80211-based + wireless drivers. Drivers rtl8192ce, rtl8192cu, rtl8192se, rtl8192de, + rtl8723eu, and rtl8188eu share some common code. - If you choose to build as a module, it'll be called rtlwifi. +if RTL_CARDS + +config RTL8192CE + tristate "Realtek RTL8192CE/RTL8188CE Wireless Network Adapter" + depends on PCI + select RTL8192C_COMMON + select RTLWIFI + select RTLWIFI_PCI + ---help--- + This is the driver for Realtek RTL8192CE/RTL8188CE 802.11n PCIe + wireless network adapters. + + If you choose to build it as a module, it will be called rtl8192ce + +config RTL8192SE + tristate "Realtek RTL8192SE/RTL8191SE PCIe Wireless Network Adapter" + depends on PCI + select RTLWIFI + select RTLWIFI_PCI + ---help--- + This is the driver for Realtek RTL8192SE/RTL8191SE 802.11n PCIe + wireless network adapters. + + If you choose to build it as a module, it will be called rtl8192se + +config RTL8192DE + tristate "Realtek RTL8192DE/RTL8188DE PCIe Wireless Network Adapter" + depends on PCI + select RTLWIFI + select RTLWIFI_PCI + ---help--- + This is the driver for Realtek RTL8192DE/RTL8188DE 802.11n PCIe + wireless network adapters. + + If you choose to build it as a module, it will be called rtl8192de + +config RTL8723AE + tristate "Realtek RTL8723AE PCIe Wireless Network Adapter" + depends on PCI + select RTLWIFI + select RTLWIFI_PCI + ---help--- + This is the driver for Realtek RTL8723AE 802.11n PCIe + wireless network adapters. + + If you choose to build it as a module, it will be called rtl8723ae + +config RTL8188EE + tristate "Realtek RTL8188EE Wireless Network Adapter" + depends on PCI + select RTLWIFI + select RTLWIFI_PCI + ---help--- + This is the driver for Realtek RTL8188EE 802.11n PCIe + wireless network adapters. + + If you choose to build it as a module, it will be called rtl8188ee + +config RTL8192CU + tristate "Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter" + depends on USB + select RTLWIFI + select RTLWIFI_USB + select RTL8192C_COMMON + ---help--- + This is the driver for Realtek RTL8192CU/RTL8188CU 802.11n USB + wireless network adapters. + + If you choose to build it as a module, it will be called rtl8192cu + +config RTLWIFI + tristate + select FW_LOADER + +config RTLWIFI_PCI + tristate + +config RTLWIFI_USB + tristate config RTLWIFI_DEBUG bool "Debugging output for rtlwifi driver family" @@ -18,63 +96,9 @@ config RTLWIFI_DEBUG the front-end driver, this parameter must be "Y". For memory-limited systems, choose "N". If in doubt, choose "Y". -config RTL8192CE - tristate "Realtek RTL8192CE/RTL8188CE Wireless Network Adapter" - depends on RTLWIFI && PCI - select RTL8192C_COMMON - ---help--- - This is the driver for Realtek RTL8192CE/RTL8188CE 802.11n PCIe - wireless network adapters. - - If you choose to build it as a module, it will be called rtl8192ce - -config RTL8192SE - tristate "Realtek RTL8192SE/RTL8191SE PCIe Wireless Network Adapter" - depends on RTLWIFI && PCI - ---help--- - This is the driver for Realtek RTL8192SE/RTL8191SE 802.11n PCIe - wireless network adapters. - - If you choose to build it as a module, it will be called rtl8192se - -config RTL8192DE - tristate "Realtek RTL8192DE/RTL8188DE PCIe Wireless Network Adapter" - depends on RTLWIFI && PCI - ---help--- - This is the driver for Realtek RTL8192DE/RTL8188DE 802.11n PCIe - wireless network adapters. - - If you choose to build it as a module, it will be called rtl8192de - -config RTL8723AE - tristate "Realtek RTL8723AE PCIe Wireless Network Adapter" - depends on RTLWIFI && PCI - ---help--- - This is the driver for Realtek RTL8723AE 802.11n PCIe - wireless network adapters. - - If you choose to build it as a module, it will be called rtl8723ae - -config RTL8188EE - tristate "Realtek RTL8188EE Wireless Network Adapter" - depends on RTLWIFI && PCI - ---help--- - This is the driver for Realtek RTL8188EE 802.11n PCIe - wireless network adapters. - - If you choose to build it as a module, it will be called rtl8188ee - -config RTL8192CU - tristate "Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter" - depends on RTLWIFI && USB - select RTL8192C_COMMON - ---help--- - This is the driver for Realtek RTL8192CU/RTL8188CU 802.11n USB - wireless network adapters. - - If you choose to build it as a module, it will be called rtl8192cu - config RTL8192C_COMMON tristate depends on RTL8192CE || RTL8192CU - default m + default y + +endif diff --git a/drivers/net/wireless/rtlwifi/Makefile b/drivers/net/wireless/rtlwifi/Makefile index ff02b874f8d8..d56f023a4b90 100644 --- a/drivers/net/wireless/rtlwifi/Makefile +++ b/drivers/net/wireless/rtlwifi/Makefile @@ -12,13 +12,11 @@ rtlwifi-objs := \ rtl8192c_common-objs += \ -ifneq ($(CONFIG_PCI),) -rtlwifi-objs += pci.o -endif +obj-$(CONFIG_RTLWIFI_PCI) += rtl_pci.o +rtl_pci-objs := pci.o -ifneq ($(CONFIG_USB),) -rtlwifi-objs += usb.o -endif +obj-$(CONFIG_RTLWIFI_USB) += rtl_usb.o +rtl_usb-objs := usb.o obj-$(CONFIG_RTL8192C_COMMON) += rtl8192c/ obj-$(CONFIG_RTL8192CE) += rtl8192ce/ diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 9d558ac77b0c..7651f5acc14b 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c @@ -172,6 +172,7 @@ u8 rtl_tid_to_ac(u8 tid) { return tid_to_ac[tid]; } +EXPORT_SYMBOL_GPL(rtl_tid_to_ac); static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw, struct ieee80211_sta_ht_cap *ht_cap) @@ -406,6 +407,7 @@ void rtl_deinit_deferred_work(struct ieee80211_hw *hw) cancel_delayed_work(&rtlpriv->works.ps_rfon_wq); cancel_delayed_work(&rtlpriv->works.fwevt_wq); } +EXPORT_SYMBOL_GPL(rtl_deinit_deferred_work); void rtl_init_rfkill(struct ieee80211_hw *hw) { @@ -439,6 +441,7 @@ void rtl_deinit_rfkill(struct ieee80211_hw *hw) { wiphy_rfkill_stop_polling(hw->wiphy); } +EXPORT_SYMBOL_GPL(rtl_deinit_rfkill); int rtl_init_core(struct ieee80211_hw *hw) { @@ -489,10 +492,12 @@ int rtl_init_core(struct ieee80211_hw *hw) return 0; } +EXPORT_SYMBOL_GPL(rtl_init_core); void rtl_deinit_core(struct ieee80211_hw *hw) { } +EXPORT_SYMBOL_GPL(rtl_deinit_core); void rtl_init_rx_config(struct ieee80211_hw *hw) { @@ -501,6 +506,7 @@ void rtl_init_rx_config(struct ieee80211_hw *hw) rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *) (&mac->rx_conf)); } +EXPORT_SYMBOL_GPL(rtl_init_rx_config); /********************************************************* * @@ -879,6 +885,7 @@ bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb) return true; } +EXPORT_SYMBOL_GPL(rtl_tx_mgmt_proc); void rtl_get_tcb_desc(struct ieee80211_hw *hw, struct ieee80211_tx_info *info, @@ -1052,6 +1059,7 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) return true; } +EXPORT_SYMBOL_GPL(rtl_action_proc); /*should call before software enc*/ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) @@ -1125,6 +1133,7 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) return false; } +EXPORT_SYMBOL_GPL(rtl_is_special_data); /********************************************************* * @@ -1300,6 +1309,7 @@ void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb) rtlpriv->link_info.bcn_rx_inperiod++; } +EXPORT_SYMBOL_GPL(rtl_beacon_statistic); void rtl_watchdog_wq_callback(void *data) { @@ -1793,6 +1803,7 @@ void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len) mac->vendor = vendor; } +EXPORT_SYMBOL_GPL(rtl_recognize_peer); /********************************************************* * @@ -1849,6 +1860,7 @@ struct attribute_group rtl_attribute_group = { .name = "rtlsysfs", .attrs = rtl_sysfs_entries, }; +EXPORT_SYMBOL_GPL(rtl_attribute_group); MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>"); @@ -1856,7 +1868,8 @@ MODULE_AUTHOR("Larry Finger <Larry.FInger@lwfinger.net>"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Realtek 802.11n PCI wireless core"); -struct rtl_global_var global_var = {}; +struct rtl_global_var rtl_global_var = {}; +EXPORT_SYMBOL_GPL(rtl_global_var); static int __init rtl_core_module_init(void) { @@ -1864,8 +1877,8 @@ static int __init rtl_core_module_init(void) pr_err("Unable to register rtl_rc, use default RC !!\n"); /* init some global vars */ - INIT_LIST_HEAD(&global_var.glb_priv_list); - spin_lock_init(&global_var.glb_list_lock); + INIT_LIST_HEAD(&rtl_global_var.glb_priv_list); + spin_lock_init(&rtl_global_var.glb_list_lock); return 0; } diff --git a/drivers/net/wireless/rtlwifi/base.h b/drivers/net/wireless/rtlwifi/base.h index 8576bc34b032..0e5fe0902daf 100644 --- a/drivers/net/wireless/rtlwifi/base.h +++ b/drivers/net/wireless/rtlwifi/base.h @@ -147,7 +147,7 @@ void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len); u8 rtl_tid_to_ac(u8 tid); extern struct attribute_group rtl_attribute_group; void rtl_easy_concurrent_retrytimer_callback(unsigned long data); -extern struct rtl_global_var global_var; +extern struct rtl_global_var rtl_global_var; int rtlwifi_rate_mapping(struct ieee80211_hw *hw, bool isht, u8 desc_rate, bool first_ampdu); bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb); diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c index ee84844be008..733b7ce7f0e2 100644 --- a/drivers/net/wireless/rtlwifi/core.c +++ b/drivers/net/wireless/rtlwifi/core.c @@ -1330,3 +1330,4 @@ const struct ieee80211_ops rtl_ops = { .rfkill_poll = rtl_op_rfkill_poll, .flush = rtl_op_flush, }; +EXPORT_SYMBOL_GPL(rtl_ops); diff --git a/drivers/net/wireless/rtlwifi/debug.c b/drivers/net/wireless/rtlwifi/debug.c index 7d52d3d7769f..76e2086e137e 100644 --- a/drivers/net/wireless/rtlwifi/debug.c +++ b/drivers/net/wireless/rtlwifi/debug.c @@ -51,3 +51,4 @@ void rtl_dbgp_flag_init(struct ieee80211_hw *hw) /*Init Debug flag enable condition */ } +EXPORT_SYMBOL_GPL(rtl_dbgp_flag_init); diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c index 9e3894178e77..838a1ed3f194 100644 --- a/drivers/net/wireless/rtlwifi/efuse.c +++ b/drivers/net/wireless/rtlwifi/efuse.c @@ -229,6 +229,7 @@ void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf) *pbuf = (u8) (value32 & 0xff); } +EXPORT_SYMBOL_GPL(read_efuse_byte); void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf) { diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index e70b4ffaf97f..703f839af6ca 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c @@ -35,6 +35,13 @@ #include "efuse.h" #include <linux/export.h> #include <linux/kmemleak.h> +#include <linux/module.h> + +MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); +MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>"); +MODULE_AUTHOR("Larry Finger <Larry.FInger@lwfinger.net>"); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("PCI basic driver for rtlwifi"); static const u16 pcibridge_vendors[PCI_BRIDGE_VENDOR_MAX] = { PCI_VENDOR_ID_INTEL, @@ -1886,7 +1893,7 @@ int rtl_pci_probe(struct pci_dev *pdev, rtlpriv->rtlhal.interface = INTF_PCI; rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_data); rtlpriv->intf_ops = &rtl_pci_ops; - rtlpriv->glb_var = &global_var; + rtlpriv->glb_var = &rtl_global_var; /* *init dbgp flags before all diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c index 71e917db8338..298b615964e8 100644 --- a/drivers/net/wireless/rtlwifi/ps.c +++ b/drivers/net/wireless/rtlwifi/ps.c @@ -269,6 +269,7 @@ void rtl_ips_nic_on(struct ieee80211_hw *hw) spin_unlock_irqrestore(&rtlpriv->locks.ips_lock, flags); } +EXPORT_SYMBOL_GPL(rtl_ips_nic_on); /*for FW LPS*/ @@ -518,6 +519,7 @@ void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len) "u_bufferd: %x, m_buffered: %x\n", u_buffed, m_buffed); } } +EXPORT_SYMBOL_GPL(rtl_swlps_beacon); void rtl_swlps_rf_awake(struct ieee80211_hw *hw) { @@ -623,6 +625,7 @@ void rtl_lps_change_work_callback(struct work_struct *work) else rtl_lps_leave(hw); } +EXPORT_SYMBOL_GPL(rtl_lps_change_work_callback); void rtl_swlps_wq_callback(void *data) { @@ -934,3 +937,4 @@ void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len) else rtl_p2p_noa_ie(hw, data, len - FCS_LEN); } +EXPORT_SYMBOL_GPL(rtl_p2p_info); diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 1feebdc92f41..e56778cac9bf 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c @@ -32,6 +32,13 @@ #include "ps.h" #include "rtl8192c/fw_common.h" #include <linux/export.h> +#include <linux/module.h> + +MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); +MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>"); +MODULE_AUTHOR("Larry Finger <Larry.FInger@lwfinger.net>"); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("USB basic driver for rtlwifi"); #define REALTEK_USB_VENQT_READ 0xC0 #define REALTEK_USB_VENQT_WRITE 0x40 From 64b6f46f1141ad938e354f37af62e28da972e8eb Mon Sep 17 00:00:00 2001 From: Sujith Manoharan <c_manoha@qca.qualcomm.com> Date: Mon, 15 Jul 2013 11:03:57 +0530 Subject: [PATCH 209/913] ath9k_hw: Fix multicast search for AR9002 family The multicast search bit is disabled for the AR9003 family, but this is required for AR9002 too. Fix this in the INI override routine. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/ath/ath9k/ar5008_phy.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index d1acfe98918a..1576d58291d4 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c @@ -610,7 +610,15 @@ static void ar5008_hw_override_ini(struct ath_hw *ah, REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); if (AR_SREV_9280_20_OR_LATER(ah)) { - val = REG_READ(ah, AR_PCU_MISC_MODE2); + /* + * For AR9280 and above, there is a new feature that allows + * Multicast search based on both MAC Address and Key ID. + * By default, this feature is enabled. But since the driver + * is not using this feature, we switch it off; otherwise + * multicast search based on MAC addr only will fail. + */ + val = REG_READ(ah, AR_PCU_MISC_MODE2) & + (~AR_ADHOC_MCAST_KEYID_ENABLE); if (!AR_SREV_9271(ah)) val &= ~AR_PCU_MISC_MODE2_HWWAR1; From 94a335dba34ff47cad3d6d0c29b452d43a1be3c8 Mon Sep 17 00:00:00 2001 From: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Wed, 17 Jul 2013 14:51:28 +0200 Subject: [PATCH 210/913] drm/i915: correctly restore fences with objects attached MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid stalls we delay tiling changes and especially hold of committing the new fence state for as long as possible. Synchronization points are in the execbuf code and in our gtt fault handler. Unfortunately we've missed that tricky detail when adding proper fence restore code in commit 19b2dbde5732170a03bd82cc8bd442cf88d856f7 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Wed Jun 12 10:15:12 2013 +0100 drm/i915: Restore fences after resume and GPU resets The result was that we've restored fences for objects with no tiling, since the object<->fence link still existed after resume. Now that wouldn't have been too bad since any subsequent access would have fixed things up, but if we've changed from tiled to untiled real havoc happened: The tiling stride is stored -1 in the fence register, so a stride of 0 resulted in all 1s in the top 32bits, and so a completely bogus fence spanning everything from the start of the object to the top of the GTT. The tell-tale in the register dumps looks like: FENCE START 2: 0x0214d001 FENCE END 2: 0xfffff3ff Bit 11 isn't set since the hw doesn't store it, even when writing all 1s (at least on my snb here). To prevent such a gaffle in the future add a sanity check for fences with an untiled object attached in i915_gem_write_fence. v2: Fix the WARN, spotted by Chris. v3: Trying to reuse get_fences looked ugly and obfuscated the code. Instead reuse update_fence and to make it really dtrt also move the fence dirty state clearing into update_fence. Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Stéphane Marchesin <marcheu@chromium.org> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60530 Cc: stable@vger.kernel.org (for 3.10 only) Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Tested-by: Matthew Garrett <matthew.garrett@nebula.com> Tested-by: Björn Bidar <theodorstormgrade@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/i915_gem.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 97afd2639fb6..d9e2208cfe98 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2258,7 +2258,17 @@ void i915_gem_restore_fences(struct drm_device *dev) for (i = 0; i < dev_priv->num_fence_regs; i++) { struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i]; - i915_gem_write_fence(dev, i, reg->obj); + + /* + * Commit delayed tiling changes if we have an object still + * attached to the fence, otherwise just clear the fence. + */ + if (reg->obj) { + i915_gem_object_update_fence(reg->obj, reg, + reg->obj->tiling_mode); + } else { + i915_gem_write_fence(dev, i, NULL); + } } } @@ -2795,6 +2805,10 @@ static void i915_gem_write_fence(struct drm_device *dev, int reg, if (i915_gem_object_needs_mb(dev_priv->fence_regs[reg].obj)) mb(); + WARN(obj && (!obj->stride || !obj->tiling_mode), + "bogus fence setup with stride: 0x%x, tiling mode: %i\n", + obj->stride, obj->tiling_mode); + switch (INTEL_INFO(dev)->gen) { case 7: case 6: @@ -2836,6 +2850,7 @@ static void i915_gem_object_update_fence(struct drm_i915_gem_object *obj, fence->obj = NULL; list_del_init(&fence->lru_list); } + obj->fence_dirty = false; } static int @@ -2965,7 +2980,6 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj) return 0; i915_gem_object_update_fence(obj, reg, enable); - obj->fence_dirty = false; return 0; } From 146c3442f2dd0f50d9431aea5d0d10dfd97c9999 Mon Sep 17 00:00:00 2001 From: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com> Date: Mon, 15 Jul 2013 16:32:44 +0800 Subject: [PATCH 211/913] tracing: Use trace_seq_puts()/trace_seq_putc() where possible For string without format specifiers, use trace_seq_puts() or trace_seq_putc(). Link: http://lkml.kernel.org/r/51E3B3AC.1000605@huawei.com Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com> [ fixed a trace_seq_putc(s, " ") to trace_seq_putc(s, ' ') ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/ring_buffer.c | 10 +++--- kernel/trace/trace_events_filter.c | 4 +-- kernel/trace/trace_functions_graph.c | 52 ++++++++++++++-------------- kernel/trace/trace_mmiotrace.c | 8 ++--- kernel/trace/trace_output.c | 14 ++++---- kernel/trace/trace_syscalls.c | 2 +- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index e444ff88f0a4..eef2e566b2e7 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -36,11 +36,11 @@ int ring_buffer_print_entry_header(struct trace_seq *s) { int ret; - ret = trace_seq_printf(s, "# compressed entry header\n"); - ret = trace_seq_printf(s, "\ttype_len : 5 bits\n"); - ret = trace_seq_printf(s, "\ttime_delta : 27 bits\n"); - ret = trace_seq_printf(s, "\tarray : 32 bits\n"); - ret = trace_seq_printf(s, "\n"); + ret = trace_seq_puts(s, "# compressed entry header\n"); + ret = trace_seq_puts(s, "\ttype_len : 5 bits\n"); + ret = trace_seq_puts(s, "\ttime_delta : 27 bits\n"); + ret = trace_seq_puts(s, "\tarray : 32 bits\n"); + ret = trace_seq_putc(s, '\n'); ret = trace_seq_printf(s, "\tpadding : type == %d\n", RINGBUF_TYPE_PADDING); ret = trace_seq_printf(s, "\ttime_extend : type == %d\n", diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 0d883dc057d6..0c7b75a8acc8 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -646,7 +646,7 @@ void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s) if (filter && filter->filter_string) trace_seq_printf(s, "%s\n", filter->filter_string); else - trace_seq_printf(s, "none\n"); + trace_seq_puts(s, "none\n"); mutex_unlock(&event_mutex); } @@ -660,7 +660,7 @@ void print_subsystem_event_filter(struct event_subsystem *system, if (filter && filter->filter_string) trace_seq_printf(s, "%s\n", filter->filter_string); else - trace_seq_printf(s, DEFAULT_SYS_FILTER_MESSAGE "\n"); + trace_seq_puts(s, DEFAULT_SYS_FILTER_MESSAGE "\n"); mutex_unlock(&event_mutex); } diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 8388bc99f2ee..d56ae9bae00b 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -446,7 +446,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid) /* First spaces to align center */ for (i = 0; i < spaces / 2; i++) { - ret = trace_seq_printf(s, " "); + ret = trace_seq_putc(s, ' '); if (!ret) return TRACE_TYPE_PARTIAL_LINE; } @@ -457,7 +457,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid) /* Last spaces to align center */ for (i = 0; i < spaces - (spaces / 2); i++) { - ret = trace_seq_printf(s, " "); + ret = trace_seq_putc(s, ' '); if (!ret) return TRACE_TYPE_PARTIAL_LINE; } @@ -503,7 +503,7 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data) ------------------------------------------ */ - ret = trace_seq_printf(s, + ret = trace_seq_puts(s, " ------------------------------------------\n"); if (!ret) return TRACE_TYPE_PARTIAL_LINE; @@ -516,7 +516,7 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data) if (ret == TRACE_TYPE_PARTIAL_LINE) return TRACE_TYPE_PARTIAL_LINE; - ret = trace_seq_printf(s, " => "); + ret = trace_seq_puts(s, " => "); if (!ret) return TRACE_TYPE_PARTIAL_LINE; @@ -524,7 +524,7 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data) if (ret == TRACE_TYPE_PARTIAL_LINE) return TRACE_TYPE_PARTIAL_LINE; - ret = trace_seq_printf(s, + ret = trace_seq_puts(s, "\n ------------------------------------------\n\n"); if (!ret) return TRACE_TYPE_PARTIAL_LINE; @@ -645,7 +645,7 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr, ret = print_graph_proc(s, pid); if (ret == TRACE_TYPE_PARTIAL_LINE) return TRACE_TYPE_PARTIAL_LINE; - ret = trace_seq_printf(s, " | "); + ret = trace_seq_puts(s, " | "); if (!ret) return TRACE_TYPE_PARTIAL_LINE; } @@ -657,9 +657,9 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr, return ret; if (type == TRACE_GRAPH_ENT) - ret = trace_seq_printf(s, "==========>"); + ret = trace_seq_puts(s, "==========>"); else - ret = trace_seq_printf(s, "<=========="); + ret = trace_seq_puts(s, "<=========="); if (!ret) return TRACE_TYPE_PARTIAL_LINE; @@ -668,7 +668,7 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr, if (ret != TRACE_TYPE_HANDLED) return ret; - ret = trace_seq_printf(s, "\n"); + ret = trace_seq_putc(s, '\n'); if (!ret) return TRACE_TYPE_PARTIAL_LINE; @@ -705,13 +705,13 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s) len += strlen(nsecs_str); } - ret = trace_seq_printf(s, " us "); + ret = trace_seq_puts(s, " us "); if (!ret) return TRACE_TYPE_PARTIAL_LINE; /* Print remaining spaces to fit the row's width */ for (i = len; i < 7; i++) { - ret = trace_seq_printf(s, " "); + ret = trace_seq_putc(s, ' '); if (!ret) return TRACE_TYPE_PARTIAL_LINE; } @@ -731,13 +731,13 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s, /* No real adata, just filling the column with spaces */ switch (duration) { case DURATION_FILL_FULL: - ret = trace_seq_printf(s, " | "); + ret = trace_seq_puts(s, " | "); return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE; case DURATION_FILL_START: - ret = trace_seq_printf(s, " "); + ret = trace_seq_puts(s, " "); return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE; case DURATION_FILL_END: - ret = trace_seq_printf(s, " |"); + ret = trace_seq_puts(s, " |"); return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE; } @@ -745,10 +745,10 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s, if (flags & TRACE_GRAPH_PRINT_OVERHEAD) { /* Duration exceeded 100 msecs */ if (duration > 100000ULL) - ret = trace_seq_printf(s, "! "); + ret = trace_seq_puts(s, "! "); /* Duration exceeded 10 msecs */ else if (duration > 10000ULL) - ret = trace_seq_printf(s, "+ "); + ret = trace_seq_puts(s, "+ "); } /* @@ -757,7 +757,7 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s, * to fill out the space. */ if (ret == -1) - ret = trace_seq_printf(s, " "); + ret = trace_seq_puts(s, " "); /* Catching here any failure happenned above */ if (!ret) @@ -767,7 +767,7 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s, if (ret != TRACE_TYPE_HANDLED) return ret; - ret = trace_seq_printf(s, "| "); + ret = trace_seq_puts(s, "| "); if (!ret) return TRACE_TYPE_PARTIAL_LINE; @@ -817,7 +817,7 @@ print_graph_entry_leaf(struct trace_iterator *iter, /* Function */ for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) { - ret = trace_seq_printf(s, " "); + ret = trace_seq_putc(s, ' '); if (!ret) return TRACE_TYPE_PARTIAL_LINE; } @@ -858,7 +858,7 @@ print_graph_entry_nested(struct trace_iterator *iter, /* Function */ for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) { - ret = trace_seq_printf(s, " "); + ret = trace_seq_putc(s, ' '); if (!ret) return TRACE_TYPE_PARTIAL_LINE; } @@ -917,7 +917,7 @@ print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s, if (ret == TRACE_TYPE_PARTIAL_LINE) return TRACE_TYPE_PARTIAL_LINE; - ret = trace_seq_printf(s, " | "); + ret = trace_seq_puts(s, " | "); if (!ret) return TRACE_TYPE_PARTIAL_LINE; } @@ -1117,7 +1117,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, /* Closing brace */ for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++) { - ret = trace_seq_printf(s, " "); + ret = trace_seq_putc(s, ' '); if (!ret) return TRACE_TYPE_PARTIAL_LINE; } @@ -1129,7 +1129,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, * belongs to, write out the function name. */ if (func_match) { - ret = trace_seq_printf(s, "}\n"); + ret = trace_seq_puts(s, "}\n"); if (!ret) return TRACE_TYPE_PARTIAL_LINE; } else { @@ -1179,13 +1179,13 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent, /* Indentation */ if (depth > 0) for (i = 0; i < (depth + 1) * TRACE_GRAPH_INDENT; i++) { - ret = trace_seq_printf(s, " "); + ret = trace_seq_putc(s, ' '); if (!ret) return TRACE_TYPE_PARTIAL_LINE; } /* The comment */ - ret = trace_seq_printf(s, "/* "); + ret = trace_seq_puts(s, "/* "); if (!ret) return TRACE_TYPE_PARTIAL_LINE; @@ -1216,7 +1216,7 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent, s->len--; } - ret = trace_seq_printf(s, " */\n"); + ret = trace_seq_puts(s, " */\n"); if (!ret) return TRACE_TYPE_PARTIAL_LINE; diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c index a5e8f4878bfa..b3dcfb2f0fef 100644 --- a/kernel/trace/trace_mmiotrace.c +++ b/kernel/trace/trace_mmiotrace.c @@ -90,7 +90,7 @@ static int mmio_print_pcidev(struct trace_seq *s, const struct pci_dev *dev) if (drv) ret += trace_seq_printf(s, " %s\n", drv->name); else - ret += trace_seq_printf(s, " \n"); + ret += trace_seq_puts(s, " \n"); return ret; } @@ -107,7 +107,7 @@ static void mmio_pipe_open(struct trace_iterator *iter) struct header_iter *hiter; struct trace_seq *s = &iter->seq; - trace_seq_printf(s, "VERSION 20070824\n"); + trace_seq_puts(s, "VERSION 20070824\n"); hiter = kzalloc(sizeof(*hiter), GFP_KERNEL); if (!hiter) @@ -209,7 +209,7 @@ static enum print_line_t mmio_print_rw(struct trace_iterator *iter) (rw->value >> 0) & 0xff, rw->pc, 0); break; default: - ret = trace_seq_printf(s, "rw what?\n"); + ret = trace_seq_puts(s, "rw what?\n"); break; } if (ret) @@ -245,7 +245,7 @@ static enum print_line_t mmio_print_map(struct trace_iterator *iter) secs, usec_rem, m->map_id, 0UL, 0); break; default: - ret = trace_seq_printf(s, "map what?\n"); + ret = trace_seq_puts(s, "map what?\n"); break; } if (ret) diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index bb922d9ee51b..34e7cbac0c9c 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -78,7 +78,7 @@ enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter) trace_assign_type(field, entry); - ret = trace_seq_printf(s, "%s", field->buf); + ret = trace_seq_puts(s, field->buf); if (!ret) return TRACE_TYPE_PARTIAL_LINE; @@ -558,14 +558,14 @@ seq_print_userip_objs(const struct userstack_entry *entry, struct trace_seq *s, if (ret) ret = trace_seq_puts(s, "??"); if (ret) - ret = trace_seq_puts(s, "\n"); + ret = trace_seq_putc(s, '\n'); continue; } if (!ret) break; if (ret) ret = seq_print_user_ip(s, mm, ip, sym_flags); - ret = trace_seq_puts(s, "\n"); + ret = trace_seq_putc(s, '\n'); } if (mm) @@ -579,7 +579,7 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags) int ret; if (!ip) - return trace_seq_printf(s, "0"); + return trace_seq_putc(s, '0'); if (sym_flags & TRACE_ITER_SYM_OFFSET) ret = seq_print_sym_offset(s, "%s", ip); @@ -964,14 +964,14 @@ static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags, goto partial; if ((flags & TRACE_ITER_PRINT_PARENT) && field->parent_ip) { - if (!trace_seq_printf(s, " <-")) + if (!trace_seq_puts(s, " <-")) goto partial; if (!seq_print_ip_sym(s, field->parent_ip, flags)) goto partial; } - if (!trace_seq_printf(s, "\n")) + if (!trace_seq_putc(s, '\n')) goto partial; return TRACE_TYPE_HANDLED; @@ -1210,7 +1210,7 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter, if (!seq_print_ip_sym(s, *p, flags)) goto partial; - if (!trace_seq_puts(s, "\n")) + if (!trace_seq_putc(s, '\n')) goto partial; } diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 322e16461072..061156215721 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c @@ -175,7 +175,7 @@ print_syscall_exit(struct trace_iterator *iter, int flags, entry = syscall_nr_to_meta(syscall); if (!entry) { - trace_seq_printf(s, "\n"); + trace_seq_putc(s, '\n'); return TRACE_TYPE_HANDLED; } From d611851b421731e2afd9cb956daae001af57a423 Mon Sep 17 00:00:00 2001 From: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com> Date: Mon, 15 Jul 2013 16:32:50 +0800 Subject: [PATCH 212/913] tracing: Typo fix on ring buffer comments There have some mismatch between comments with real function name, update it. This patch also add some missed function arguments description. Link: http://lkml.kernel.org/r/51E3B3B2.4080307@huawei.com Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/ring_buffer.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index eef2e566b2e7..cc2f66f68dc5 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -1066,7 +1066,7 @@ static int rb_check_list(struct ring_buffer_per_cpu *cpu_buffer, } /** - * check_pages - integrity check of buffer pages + * rb_check_pages - integrity check of buffer pages * @cpu_buffer: CPU buffer with pages to test * * As a safety measure we check to make sure the data pages have not @@ -1258,7 +1258,7 @@ static int rb_cpu_notify(struct notifier_block *self, #endif /** - * ring_buffer_alloc - allocate a new ring_buffer + * __ring_buffer_alloc - allocate a new ring_buffer * @size: the size in bytes per cpu that is needed. * @flags: attributes to set for the ring buffer. * @@ -1607,6 +1607,7 @@ static void update_pages_handler(struct work_struct *work) * ring_buffer_resize - resize the ring buffer * @buffer: the buffer to resize. * @size: the new size. + * @cpu_id: the cpu buffer to resize * * Minimum size is 2 * BUF_PAGE_SIZE. * @@ -3956,11 +3957,11 @@ EXPORT_SYMBOL_GPL(ring_buffer_consume); * expected. * * After a sequence of ring_buffer_read_prepare calls, the user is - * expected to make at least one call to ring_buffer_prepare_sync. + * expected to make at least one call to ring_buffer_read_prepare_sync. * Afterwards, ring_buffer_read_start is invoked to get things going * for real. * - * This overall must be paired with ring_buffer_finish. + * This overall must be paired with ring_buffer_read_finish. */ struct ring_buffer_iter * ring_buffer_read_prepare(struct ring_buffer *buffer, int cpu) @@ -4009,7 +4010,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_read_prepare_sync); * an intervening ring_buffer_read_prepare_sync must have been * performed. * - * Must be paired with ring_buffer_finish. + * Must be paired with ring_buffer_read_finish. */ void ring_buffer_read_start(struct ring_buffer_iter *iter) @@ -4031,7 +4032,7 @@ ring_buffer_read_start(struct ring_buffer_iter *iter) EXPORT_SYMBOL_GPL(ring_buffer_read_start); /** - * ring_buffer_finish - finish reading the iterator of the buffer + * ring_buffer_read_finish - finish reading the iterator of the buffer * @iter: The iterator retrieved by ring_buffer_start * * This re-enables the recording to the buffer, and frees the @@ -4346,6 +4347,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_swap_cpu); /** * ring_buffer_alloc_read_page - allocate a page to read from buffer * @buffer: the buffer to allocate for. + * @cpu: the cpu buffer to allocate. * * This function is used in conjunction with ring_buffer_read_page. * When reading a full page from the ring buffer, these functions @@ -4403,7 +4405,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_free_read_page); * to swap with a page in the ring buffer. * * for example: - * rpage = ring_buffer_alloc_read_page(buffer); + * rpage = ring_buffer_alloc_read_page(buffer, cpu); * if (!rpage) * return error; * ret = ring_buffer_read_page(buffer, &rpage, len, cpu, 0); From b8ebfd3f7113b63dda93d76bfec638c00e6bd514 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Mon, 17 Jun 2013 19:02:04 +0200 Subject: [PATCH 213/913] tracing/function: Avoid perf_trace_buf_*() if event_function.perf_events is empty perf_trace_buf_prepare() + perf_trace_buf_submit(head, task => NULL) make no sense if hlist_empty(head). Change perf_ftrace_function_call() to check event_function.perf_events beforehand. Link: http://lkml.kernel.org/r/20130617170204.GA19803@redhat.com Acked-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_event_perf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c index 84b1e045faba..12df5573086e 100644 --- a/kernel/trace/trace_event_perf.c +++ b/kernel/trace/trace_event_perf.c @@ -266,6 +266,10 @@ perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip, struct pt_regs regs; int rctx; + head = this_cpu_ptr(event_function.perf_events); + if (hlist_empty(head)) + return; + #define ENTRY_SIZE (ALIGN(sizeof(struct ftrace_entry) + sizeof(u32), \ sizeof(u64)) - sizeof(u32)) @@ -279,8 +283,6 @@ perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip, entry->ip = ip; entry->parent_ip = parent_ip; - - head = this_cpu_ptr(event_function.perf_events); perf_trace_buf_submit(entry, ENTRY_SIZE, rctx, 0, 1, ®s, head, NULL); From 421c7860c6e1989da3962fafdd6699316c9f8e20 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Mon, 17 Jun 2013 19:02:07 +0200 Subject: [PATCH 214/913] tracing/syscall: Avoid perf_trace_buf_*() if sys_data->perf_events is empty perf_trace_buf_prepare() + perf_trace_buf_submit(head, task => NULL) make no sense if hlist_empty(head). Change perf_syscall_enter/exit() to check sys_data->{enter,exit}_event->perf_events beforehand. Link: http://lkml.kernel.org/r/20130617170207.GA19806@redhat.com Acked-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_syscalls.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 061156215721..ac0085777fbd 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c @@ -566,6 +566,10 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) if (!sys_data) return; + head = this_cpu_ptr(sys_data->enter_event->perf_events); + if (hlist_empty(head)) + return; + /* get the size after alignment with the u32 buffer size field */ size = sizeof(unsigned long) * sys_data->nb_args + sizeof(*rec); size = ALIGN(size + sizeof(u32), sizeof(u64)); @@ -583,8 +587,6 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) rec->nr = syscall_nr; syscall_get_arguments(current, regs, 0, sys_data->nb_args, (unsigned long *)&rec->args); - - head = this_cpu_ptr(sys_data->enter_event->perf_events); perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head, NULL); } @@ -642,6 +644,10 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret) if (!sys_data) return; + head = this_cpu_ptr(sys_data->exit_event->perf_events); + if (hlist_empty(head)) + return; + /* We can probably do that at build time */ size = ALIGN(sizeof(*rec) + sizeof(u32), sizeof(u64)); size -= sizeof(u32); @@ -661,8 +667,6 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret) rec->nr = syscall_nr; rec->ret = syscall_get_return_value(current, regs); - - head = this_cpu_ptr(sys_data->exit_event->perf_events); perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head, NULL); } From cd92bf61d6d70bd3eb33b46d600e3f3eb9c5778a Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Mon, 17 Jun 2013 19:02:11 +0200 Subject: [PATCH 215/913] tracing/perf: Move the PERF_MAX_TRACE_SIZE check into perf_trace_buf_prepare() Every perf_trace_buf_prepare() caller does WARN_ONCE(size > PERF_MAX_TRACE_SIZE, message) and "message" is almost the same. Shift this WARN_ONCE() into perf_trace_buf_prepare(). This changes the meaning of _ONCE, but I think this is fine. - 4947014 2932448 10104832 17984294 1126b26 vmlinux + 4948422 2932448 10104832 17985702 11270a6 vmlinux on my build. Link: http://lkml.kernel.org/r/20130617170211.GA19813@redhat.com Acked-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- include/trace/ftrace.h | 4 ---- kernel/trace/trace_event_perf.c | 4 ++++ kernel/trace/trace_kprobe.c | 6 ------ kernel/trace/trace_syscalls.c | 12 ------------ kernel/trace/trace_uprobe.c | 2 -- 5 files changed, 4 insertions(+), 24 deletions(-) diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index d615f78cc6b6..41a6643e2136 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h @@ -670,10 +670,6 @@ perf_trace_##call(void *__data, proto) \ sizeof(u64)); \ __entry_size -= sizeof(u32); \ \ - if (WARN_ONCE(__entry_size > PERF_MAX_TRACE_SIZE, \ - "profile buffer not large enough")) \ - return; \ - \ entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare( \ __entry_size, event_call->event.type, &__regs, &rctx); \ if (!entry) \ diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c index 12df5573086e..80c36bcf66e8 100644 --- a/kernel/trace/trace_event_perf.c +++ b/kernel/trace/trace_event_perf.c @@ -236,6 +236,10 @@ __kprobes void *perf_trace_buf_prepare(int size, unsigned short type, BUILD_BUG_ON(PERF_MAX_TRACE_SIZE % sizeof(unsigned long)); + if (WARN_ONCE(size > PERF_MAX_TRACE_SIZE, + "perf buffer not large enough")) + return NULL; + pc = preempt_count(); *rctxp = perf_swevent_get_recursion_context(); diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 7ed6976493c8..ae6ce835b023 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1087,9 +1087,6 @@ kprobe_perf_func(struct trace_probe *tp, struct pt_regs *regs) __size = sizeof(*entry) + tp->size + dsize; size = ALIGN(__size + sizeof(u32), sizeof(u64)); size -= sizeof(u32); - if (WARN_ONCE(size > PERF_MAX_TRACE_SIZE, - "profile buffer not large enough")) - return; entry = perf_trace_buf_prepare(size, call->event.type, regs, &rctx); if (!entry) @@ -1120,9 +1117,6 @@ kretprobe_perf_func(struct trace_probe *tp, struct kretprobe_instance *ri, __size = sizeof(*entry) + tp->size + dsize; size = ALIGN(__size + sizeof(u32), sizeof(u64)); size -= sizeof(u32); - if (WARN_ONCE(size > PERF_MAX_TRACE_SIZE, - "profile buffer not large enough")) - return; entry = perf_trace_buf_prepare(size, call->event.type, regs, &rctx); if (!entry) diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index ac0085777fbd..8fd03657bc7d 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c @@ -575,10 +575,6 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) size = ALIGN(size + sizeof(u32), sizeof(u64)); size -= sizeof(u32); - if (WARN_ONCE(size > PERF_MAX_TRACE_SIZE, - "perf buffer not large enough")) - return; - rec = (struct syscall_trace_enter *)perf_trace_buf_prepare(size, sys_data->enter_event->event.type, regs, &rctx); if (!rec) @@ -652,14 +648,6 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret) size = ALIGN(sizeof(*rec) + sizeof(u32), sizeof(u64)); size -= sizeof(u32); - /* - * Impossible, but be paranoid with the future - * How to put this check outside runtime? - */ - if (WARN_ONCE(size > PERF_MAX_TRACE_SIZE, - "exit event has grown above perf buffer size")) - return; - rec = (struct syscall_trace_exit *)perf_trace_buf_prepare(size, sys_data->exit_event->event.type, regs, &rctx); if (!rec) diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index d5d0cd368a56..a23d2d71188e 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -818,8 +818,6 @@ static void uprobe_perf_print(struct trace_uprobe *tu, size = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); size = ALIGN(size + tu->size + sizeof(u32), sizeof(u64)) - sizeof(u32); - if (WARN_ONCE(size > PERF_MAX_TRACE_SIZE, "profile buffer not large enough")) - return; preempt_disable(); head = this_cpu_ptr(call->perf_events); From a232e270dcb55a70ad3241bc6fc160fd9b5c9e6c Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Date: Tue, 9 Jul 2013 18:35:26 +0900 Subject: [PATCH 216/913] tracing/kprobe: Wait for disabling all running kprobe handlers Wait for disabling all running kprobe handlers when a kprobe event is disabled, since the caller, trace_remove_event_call() supposes that a removing event is disabled completely by disabling the event. With this change, ftrace can ensure that there is no running event handlers after disabling it. Link: http://lkml.kernel.org/r/20130709093526.20138.93100.stgit@mhiramat-M0-7522 Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_kprobe.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index ae6ce835b023..3811487e7a7a 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -243,11 +243,11 @@ find_event_file_link(struct trace_probe *tp, struct ftrace_event_file *file) static int disable_trace_probe(struct trace_probe *tp, struct ftrace_event_file *file) { + struct event_file_link *link = NULL; + int wait = 0; int ret = 0; if (file) { - struct event_file_link *link; - link = find_event_file_link(tp, file); if (!link) { ret = -EINVAL; @@ -255,10 +255,7 @@ disable_trace_probe(struct trace_probe *tp, struct ftrace_event_file *file) } list_del_rcu(&link->list); - /* synchronize with kprobe_trace_func/kretprobe_trace_func */ - synchronize_sched(); - kfree(link); - + wait = 1; if (!list_empty(&tp->files)) goto out; @@ -271,8 +268,22 @@ disable_trace_probe(struct trace_probe *tp, struct ftrace_event_file *file) disable_kretprobe(&tp->rp); else disable_kprobe(&tp->rp.kp); + wait = 1; } out: + if (wait) { + /* + * Synchronize with kprobe_trace_func/kretprobe_trace_func + * to ensure disabled (all running handlers are finished). + * This is not only for kfree(), but also the caller, + * trace_remove_event_call() supposes it for releasing + * event_call related objects, which will be accessed in + * the kprobe_trace_func/kretprobe_trace_func. + */ + synchronize_sched(); + kfree(link); /* Ignored if link == NULL */ + } + return ret; } From 609e85a70bcd0eedf4ec60639dbcfb1ab011e054 Mon Sep 17 00:00:00 2001 From: Alexander Z Lam <azl@google.com> Date: Wed, 10 Jul 2013 17:34:34 -0700 Subject: [PATCH 217/913] tracing: Fix error handling to ensure instances can always be removed Remove debugfs directories for tracing instances during creation if an error occurs causing the trace_array for that instance to not be added to ftrace_trace_arrays. If the directory continues to exist after the error, it cannot be removed because the respective trace_array is not in ftrace_trace_arrays. Link: http://lkml.kernel.org/r/1373502874-1706-2-git-send-email-azl@google.com Cc: stable@vger.kernel.org # 3.10 Cc: Vaibhav Nagarnaik <vnagarnaik@google.com> Cc: David Sharp <dhsharp@google.com> Cc: Alexander Z Lam <lambchop468@gmail.com> Signed-off-by: Alexander Z Lam <azl@google.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 25b91afc29e0..7c3da7bca05b 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -5973,8 +5973,10 @@ static int new_instance_create(const char *name) goto out_free_tr; ret = event_trace_add_tracer(tr->dir, tr); - if (ret) + if (ret) { + debugfs_remove_recursive(tr->dir); goto out_free_tr; + } init_tracer_debugfs(tr, tr->dir); From f77d09a384676bde6445413949d9d2c508ff3e62 Mon Sep 17 00:00:00 2001 From: Alexander Z Lam <azl@google.com> Date: Thu, 18 Jul 2013 11:18:44 -0700 Subject: [PATCH 218/913] tracing: Miscellaneous fixes for trace_array ref counting Some error paths did not handle ref counting properly, and some trace files need ref counting. Link: http://lkml.kernel.org/r/1374171524-11948-1-git-send-email-azl@google.com Cc: stable@vger.kernel.org # 3.10 Cc: Vaibhav Nagarnaik <vnagarnaik@google.com> Cc: David Sharp <dhsharp@google.com> Cc: Alexander Z Lam <lambchop468@gmail.com> Signed-off-by: Alexander Z Lam <azl@google.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 24 ++++++++++++++++++------ kernel/trace/trace_events.c | 21 +++++++++++++++++++-- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 7c3da7bca05b..7d9ceab42564 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -3008,7 +3008,6 @@ static int tracing_release(struct inode *inode, struct file *file) iter = m->private; tr = iter->tr; - trace_array_put(tr); mutex_lock(&trace_types_lock); @@ -3023,6 +3022,9 @@ static int tracing_release(struct inode *inode, struct file *file) if (!iter->snapshot) /* reenable tracing if it was previously enabled */ tracing_start_tr(tr); + + __trace_array_put(tr); + mutex_unlock(&trace_types_lock); mutex_destroy(&iter->mutex); @@ -3447,6 +3449,7 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf, static int tracing_trace_options_open(struct inode *inode, struct file *file) { struct trace_array *tr = inode->i_private; + int ret; if (tracing_disabled) return -ENODEV; @@ -3454,7 +3457,11 @@ static int tracing_trace_options_open(struct inode *inode, struct file *file) if (trace_array_get(tr) < 0) return -ENODEV; - return single_open(file, tracing_trace_options_show, inode->i_private); + ret = single_open(file, tracing_trace_options_show, inode->i_private); + if (ret < 0) + trace_array_put(tr); + + return ret; } static const struct file_operations tracing_iter_fops = { @@ -3958,6 +3965,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp) iter = kzalloc(sizeof(*iter), GFP_KERNEL); if (!iter) { ret = -ENOMEM; + __trace_array_put(tr); goto out; } @@ -4704,21 +4712,24 @@ static int tracing_snapshot_open(struct inode *inode, struct file *file) ret = PTR_ERR(iter); } else { /* Writes still need the seq_file to hold the private data */ + ret = -ENOMEM; m = kzalloc(sizeof(*m), GFP_KERNEL); if (!m) - return -ENOMEM; + goto out; iter = kzalloc(sizeof(*iter), GFP_KERNEL); if (!iter) { kfree(m); - return -ENOMEM; + goto out; } + ret = 0; + iter->tr = tr; iter->trace_buffer = &tc->tr->max_buffer; iter->cpu_file = tc->cpu; m->private = iter; file->private_data = m; } - +out: if (ret < 0) trace_array_put(tr); @@ -5328,9 +5339,10 @@ tracing_stats_read(struct file *filp, char __user *ubuf, } static const struct file_operations tracing_stats_fops = { - .open = tracing_open_generic, + .open = tracing_open_generic_tc, .read = tracing_stats_read, .llseek = generic_file_llseek, + .release = tracing_release_generic_tc, }; #ifdef CONFIG_DYNAMIC_FTRACE diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 7d854290bf81..7a75cb22eab7 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -1218,6 +1218,7 @@ show_header(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) static int ftrace_event_avail_open(struct inode *inode, struct file *file); static int ftrace_event_set_open(struct inode *inode, struct file *file); +static int ftrace_event_release(struct inode *inode, struct file *file); static const struct seq_operations show_event_seq_ops = { .start = t_start, @@ -1245,7 +1246,7 @@ static const struct file_operations ftrace_set_event_fops = { .read = seq_read, .write = ftrace_event_write, .llseek = seq_lseek, - .release = seq_release, + .release = ftrace_event_release, }; static const struct file_operations ftrace_enable_fops = { @@ -1323,6 +1324,15 @@ ftrace_event_open(struct inode *inode, struct file *file, return ret; } +static int ftrace_event_release(struct inode *inode, struct file *file) +{ + struct trace_array *tr = inode->i_private; + + trace_array_put(tr); + + return seq_release(inode, file); +} + static int ftrace_event_avail_open(struct inode *inode, struct file *file) { @@ -1336,12 +1346,19 @@ ftrace_event_set_open(struct inode *inode, struct file *file) { const struct seq_operations *seq_ops = &show_set_event_seq_ops; struct trace_array *tr = inode->i_private; + int ret; + + if (trace_array_get(tr) < 0) + return -ENODEV; if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) ftrace_clear_events(tr); - return ftrace_event_open(inode, file, seq_ops); + ret = ftrace_event_open(inode, file, seq_ops); + if (ret < 0) + trace_array_put(tr); + return ret; } static struct event_subsystem * From 8f768993394a8c0d3801033c11fd86ce8c88dcac Mon Sep 17 00:00:00 2001 From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org> Date: Thu, 18 Jul 2013 14:41:51 -0400 Subject: [PATCH 219/913] tracing: Add ref_data to function and fgraph tracer structs The selftest for function and function graph tracers are defined as __init, as they are only executed at boot up. The "tracer" structs that are associated to those tracers are not setup as __init as they are used after boot. To stop mismatch warnings, those structures need to be annotated with __ref_data. Currently, the tracer structures are defined to __read_mostly, as they do not really change. But in the future they should be converted to consts, but that will take a little work because they have a "next" pointer that gets updated when they are registered. That will have to wait till the next major release. Link: http://lkml.kernel.org/r/1373596735.17876.84.camel@gandalf.local.home Reported-by: kbuild test robot <fengguang.wu@intel.com> Reported-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.h | 9 +++++++++ kernel/trace/trace_functions.c | 2 +- kernel/trace/trace_functions_graph.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 4a4f6e1828b6..57b7bb0d39b7 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -680,6 +680,15 @@ extern int trace_selftest_startup_sched_switch(struct tracer *trace, struct trace_array *tr); extern int trace_selftest_startup_branch(struct tracer *trace, struct trace_array *tr); +/* + * Tracer data references selftest functions that only occur + * on boot up. These can be __init functions. Thus, when selftests + * are enabled, then the tracers need to reference __init functions. + */ +#define __tracer_data __refdata +#else +/* Tracers are seldom changed. Optimize when selftests are disabled. */ +#define __tracer_data __read_mostly #endif /* CONFIG_FTRACE_STARTUP_TEST */ extern void *head_page(struct trace_array_cpu *data); diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index b863f93b30f3..38fe1483c508 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c @@ -199,7 +199,7 @@ static int func_set_flag(u32 old_flags, u32 bit, int set) return 0; } -static struct tracer function_trace __read_mostly = +static struct tracer function_trace __tracer_data = { .name = "function", .init = function_trace_init, diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index d56ae9bae00b..b5c09242683d 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -1448,7 +1448,7 @@ static struct trace_event graph_trace_ret_event = { .funcs = &graph_functions }; -static struct tracer graph_trace __read_mostly = { +static struct tracer graph_trace __tracer_data = { .name = "function_graph", .open = graph_trace_open, .pipe_open = graph_trace_open, From 7710b639953b791610f0022a7d52d9801c93b969 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Thu, 18 Jul 2013 20:47:10 +0200 Subject: [PATCH 220/913] tracing: Simplify the iteration logic in f_start/f_next f_next() looks overcomplicated, and it is not strictly correct even if this doesn't matter. Say, FORMAT_FIELD_SEPERATOR should not return NULL (means EOF) if trace_get_fields() returns an empty list, we should simply advance to FORMAT_PRINTFMT as we do when we find the end of list. 1. Change f_next() to return "struct list_head *" rather than "ftrace_event_field *", and change f_show() to do list_entry(). This simplifies the code a bit, only f_show() needs to know about ftrace_event_field, and f_next() can play with ->prev directly 2. Change f_next() to not play with ->prev / return inside the switch() statement. It can simply set node = head/common_head, the prev-or-advance-to-the-next-magic below does all work. While at it. f_start() looks overcomplicated too. I don't think *pos == 0 makes sense as a separate case, just change this code to do "while" instead of "do/while". The patch also moves f_start() down, close to f_stop(). This is purely cosmetic, just to make the locking added by the next patch more clear/visible. Link: http://lkml.kernel.org/r/20130718184710.GA4783@redhat.com Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_events.c | 60 ++++++++++++++----------------------- 1 file changed, 22 insertions(+), 38 deletions(-) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 7a75cb22eab7..76defd91f9b4 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -826,59 +826,33 @@ enum { static void *f_next(struct seq_file *m, void *v, loff_t *pos) { struct ftrace_event_call *call = m->private; - struct ftrace_event_field *field; struct list_head *common_head = &ftrace_common_fields; struct list_head *head = trace_get_fields(call); + struct list_head *node = v; (*pos)++; switch ((unsigned long)v) { case FORMAT_HEADER: - if (unlikely(list_empty(common_head))) - return NULL; - - field = list_entry(common_head->prev, - struct ftrace_event_field, link); - return field; + node = common_head; + break; case FORMAT_FIELD_SEPERATOR: - if (unlikely(list_empty(head))) - return NULL; - - field = list_entry(head->prev, struct ftrace_event_field, link); - return field; + node = head; + break; case FORMAT_PRINTFMT: /* all done */ return NULL; } - field = v; - if (field->link.prev == common_head) + node = node->prev; + if (node == common_head) return (void *)FORMAT_FIELD_SEPERATOR; - else if (field->link.prev == head) + else if (node == head) return (void *)FORMAT_PRINTFMT; - - field = list_entry(field->link.prev, struct ftrace_event_field, link); - - return field; -} - -static void *f_start(struct seq_file *m, loff_t *pos) -{ - loff_t l = 0; - void *p; - - /* Start by showing the header */ - if (!*pos) - return (void *)FORMAT_HEADER; - - p = (void *)FORMAT_HEADER; - do { - p = f_next(m, p, &l); - } while (p && l < *pos); - - return p; + else + return node; } static int f_show(struct seq_file *m, void *v) @@ -904,8 +878,7 @@ static int f_show(struct seq_file *m, void *v) return 0; } - field = v; - + field = list_entry(v, struct ftrace_event_field, link); /* * Smartly shows the array type(except dynamic array). * Normal: @@ -932,6 +905,17 @@ static int f_show(struct seq_file *m, void *v) return 0; } +static void *f_start(struct seq_file *m, loff_t *pos) +{ + void *p = (void *)FORMAT_HEADER; + loff_t l = 0; + + while (l < *pos && p) + p = f_next(m, p, &l); + + return p; +} + static void f_stop(struct seq_file *m, void *p) { } From cd458ba9d5a5592d37b5145e560071e91ea762ac Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Thu, 18 Jul 2013 20:47:12 +0200 Subject: [PATCH 221/913] tracing: Do not (ab)use trace_seq in event_id_read() event_id_read() has no reason to kmalloc "struct trace_seq" (more than PAGE_SIZE!), it can use a small buffer instead. Note: "if (*ppos) return 0" looks strange and even wrong, simple_read_from_buffer() handles ppos != 0 case corrrectly. And it seems that almost every user of trace_seq in this file should be converted too. Unless you use seq_open(), trace_seq buys nothing compared to the raw buffer, but it needs a bit more memory and code. Link: http://lkml.kernel.org/r/20130718184712.GA4786@redhat.com Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_events.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 76defd91f9b4..898f868833f2 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -947,23 +947,14 @@ static ssize_t event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { struct ftrace_event_call *call = filp->private_data; - struct trace_seq *s; - int r; + char buf[32]; + int len; if (*ppos) return 0; - s = kmalloc(sizeof(*s), GFP_KERNEL); - if (!s) - return -ENOMEM; - - trace_seq_init(s); - trace_seq_printf(s, "%d\n", call->event.type); - - r = simple_read_from_buffer(ubuf, cnt, ppos, - s->buffer, s->len); - kfree(s); - return r; + len = sprintf(buf, "%d\n", call->event.type); + return simple_read_from_buffer(ubuf, cnt, ppos, buf, len); } static ssize_t From 1ea9a69d1a36a5b62bf281ba8bb304fcac656dad Mon Sep 17 00:00:00 2001 From: Takashi Iwai <tiwai@suse.de> Date: Fri, 19 Jul 2013 07:58:02 +0200 Subject: [PATCH 222/913] ALSA: hda - Fix EAPD GPIO control for Sigmatel codecs The EAPD GPIO is dynamically turned on/off for some machines with Sigmatel codecs, but this didn't work as expected, and it resulted in spontaneous lost of speaker outputs per HP plugging or power-saving. This patch fixes the bug by simply including spec->eapd_mask into spec->gpio_mask and spec->gpio_data bits. Reported-and-tested-by: Eric Shattow <lucent@gmail.com> Cc: <stable@vger.kernel.org> [v3.9+] Signed-off-by: Takashi Iwai <tiwai@suse.de> --- sound/pci/hda/patch_sigmatel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index e2f83591161b..766e56754c64 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -417,9 +417,11 @@ static void stac_update_outputs(struct hda_codec *codec) val &= ~spec->eapd_mask; else val |= spec->eapd_mask; - if (spec->gpio_data != val) + if (spec->gpio_data != val) { + spec->gpio_data = val; stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, val); + } } } @@ -3612,20 +3614,18 @@ static int stac_parse_auto_config(struct hda_codec *codec) static int stac_init(struct hda_codec *codec) { struct sigmatel_spec *spec = codec->spec; - unsigned int gpio; int i; /* override some hints */ stac_store_hints(codec); /* set up GPIO */ - gpio = spec->gpio_data; /* turn on EAPD statically when spec->eapd_switch isn't set. * otherwise, unsol event will turn it on/off dynamically */ if (!spec->eapd_switch) - gpio |= spec->eapd_mask; - stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio); + spec->gpio_data |= spec->eapd_mask; + stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data); snd_hda_gen_init(codec); @@ -3915,6 +3915,7 @@ static void stac_setup_gpio(struct hda_codec *codec) { struct sigmatel_spec *spec = codec->spec; + spec->gpio_mask |= spec->eapd_mask; if (spec->gpio_led) { if (!spec->vref_mute_led_nid) { spec->gpio_mask |= spec->gpio_led; From f3e351eef3a7fd1e36a3e18d4f2f069b00deb23c Mon Sep 17 00:00:00 2001 From: Takashi Iwai <tiwai@suse.de> Date: Fri, 19 Jul 2013 08:02:25 +0200 Subject: [PATCH 223/913] ALSA: hda - Remove NO_PRESENCE bit override for Dell 1420n Laptop The quirk for Dell laptops with STAC9228 overrides the pin default config of NID 0x0f to the value with AC_DEFCFG_MISC_NO_PRESENCE bit on. I'm not quite sure why this was done so, but can guess that this was introduced for avoiding this to be muted by another headphone plug. Now, after transition to the generic parser, this workaround rather causes a problem (notably as unexpected speaker mutes) because the pin is seen as if it's always plugged in. Since the generic parser can handle multiple headphone plugging gracefully, we can get rid of this override now. Reported-and-tested-by: Eric Shattow <lucent@gmail.com> Cc: <stable@vger.kernel.org> [v3.9+] Signed-off-by: Takashi Iwai <tiwai@suse.de> --- sound/pci/hda/patch_sigmatel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 766e56754c64..92b9b4324372 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -3233,7 +3233,7 @@ static const struct hda_fixup stac927x_fixups[] = { /* configure the analog microphone on some laptops */ { 0x0c, 0x90a79130 }, /* correct the front output jack as a hp out */ - { 0x0f, 0x0227011f }, + { 0x0f, 0x0221101f }, /* correct the front input jack as a mic */ { 0x0e, 0x02a79130 }, {} From 9da3545d827cdb9163697a1dc4471fbb5540e85f Mon Sep 17 00:00:00 2001 From: Ingo Tuchscherer <ingo.tuchscherer@linux.vnet.ibm.com> Date: Thu, 18 Jul 2013 16:28:26 +0200 Subject: [PATCH 224/913] s390/zcrypt: Alias for new zcrypt device driver base module The zcrypt device driver has been split into base/bus module, api-module, card modules and message type modules. The base module has been renamed from z90crypt to ap. A module alias (with the well-known z90crypt identifier) will be introduced that enable users to use their existing way to load the zcrypt device driver. Signed-off-by: Ingo Tuchscherer <ingo.tuchscherer@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- drivers/s390/crypto/ap_bus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index f446a7705c3b..d4174b82a1a9 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c @@ -71,6 +71,7 @@ MODULE_AUTHOR("IBM Corporation"); MODULE_DESCRIPTION("Adjunct Processor Bus driver, " \ "Copyright IBM Corp. 2006, 2012"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("z90crypt"); /* * Module parameter From 976f39b139cdd06a88a5aadd8202b0c30cac9cda Mon Sep 17 00:00:00 2001 From: Florian Fainelli <florian@openwrt.org> Date: Wed, 17 Jul 2013 17:56:31 +0000 Subject: [PATCH 225/913] MIPS: BMIPS: Fix thinko to release slave TP from reset Commit 4df715aa ["MIPS: BMIPS: support booting from physical CPU other than 0"] introduced a thinko which will prevents slave CPUs from being released from reset on systems where we boot from TP0. The problem is that we are checking whether the slave CPU logical CPU map is 0, which is never true for systems booting from TP0, so we do not release the slave TP from reset and we are just stuck. Fix this by properly checking that the CPU we intend to boot really is the physical slave CPU (logical and physical value being 1). Signed-off-by: Florian Fainelli <florian@openwrt.org> Cc: linux-mips@linux-mips.org Cc: blogic@openwrt.org Cc: jogo@openwrt.org Cc: cernekee@gmail.com Cc: Florian Fainelli <florian@openwrt.org> Patchwork: https://patchwork.linux-mips.org/patch/5598/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/kernel/smp-bmips.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index aea6c0885838..67445374014f 100644 --- a/arch/mips/kernel/smp-bmips.c +++ b/arch/mips/kernel/smp-bmips.c @@ -173,7 +173,7 @@ static void bmips_boot_secondary(int cpu, struct task_struct *idle) else { #if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) /* Reset slave TP1 if booting from TP0 */ - if (cpu_logical_map(cpu) == 0) + if (cpu_logical_map(cpu) == 1) set_c0_brcm_cmt_ctrl(0x01); #elif defined(CONFIG_CPU_BMIPS5000) if (cpu & 0x01) From afc813ae6d01eb4bb03fe67ed74c76608e3db089 Mon Sep 17 00:00:00 2001 From: Tony Wu <tung7970@gmail.com> Date: Thu, 18 Jul 2013 09:45:47 +0000 Subject: [PATCH 226/913] MIPS: tlbex: Fix typo in r3000 tlb store handler commit 6ba045f (MIPS: Move generated code to .text for microMIPS) causes a panic at boot. The handler builder should test against handle_tlbs_end, not handle_tlbs. Signed-off-by: Tony Wu <tung7970@gmail.com> Acked-by: Jayachandran C. <jchandra@broadcom.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5600/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/mm/tlbex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 9ab0f907a52c..605b6fc13697 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c @@ -1803,7 +1803,7 @@ static void __cpuinit build_r3000_tlb_store_handler(void) uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); uasm_i_nop(&p); - if (p >= handle_tlbs) + if (p >= handle_tlbs_end) panic("TLB store handler fastpath space exceeded"); uasm_resolve_relocs(relocs, labels); From 35ac7840bca23a0fcfb53cc433ae1fd6dc6d35c0 Mon Sep 17 00:00:00 2001 From: Ganesan Ramalingam <ganesanr@broadcom.com> Date: Wed, 17 Jul 2013 10:27:25 +0000 Subject: [PATCH 227/913] MIPS: Netlogic: Fix USB block's coherent DMA mask The on-chip USB controller on Netlogic XLP does not suppport DMA beyond 32-bit physical address. Set the coherent_dma_mask of the USB in its PCI fixup to support this. Signed-off-by: Ganesan Ramalingam <ganesanr@broadcom.com> Signed-off-by: Jayachandran C. <jchandra@broadcom.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5596/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/netlogic/xlp/usb-init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/netlogic/xlp/usb-init.c b/arch/mips/netlogic/xlp/usb-init.c index 9c401dd78337..ef3897ef0dc7 100644 --- a/arch/mips/netlogic/xlp/usb-init.c +++ b/arch/mips/netlogic/xlp/usb-init.c @@ -119,7 +119,7 @@ static u64 xlp_usb_dmamask = ~(u32)0; static void nlm_usb_fixup_final(struct pci_dev *dev) { dev->dev.dma_mask = &xlp_usb_dmamask; - dev->dev.coherent_dma_mask = DMA_BIT_MASK(64); + dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); switch (dev->devfn) { case 0x10: dev->irq = PIC_EHCI_0_IRQ; From 628f0650ea65ef2ec0a2bde141c271dea1d18904 Mon Sep 17 00:00:00 2001 From: Jayachandran C <jchandra@broadcom.com> Date: Wed, 17 Jul 2013 10:27:26 +0000 Subject: [PATCH 228/913] MIPS: Netlogic: Add XLP PIC irqdomain Add a legacy irq domain for the XLP PIC interrupts. This will be used when interrupts are assigned from the device tree. This change is required after commit c5cdc67 "irqdomain: Remove temporary MIPS workaround code". Signed-off-by: Jayachandran C <jchandra@broadcom.com> Cc: linux-mips@linux-mips.org Cc: Jayachandran C <jchandra@broadcom.com> Patchwork: https://patchwork.linux-mips.org/patch/5597/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/netlogic/common/irq.c | 68 +++++++++++++++++++++++++----- arch/mips/netlogic/dts/xlp_evp.dts | 3 +- arch/mips/netlogic/dts/xlp_svp.dts | 3 +- 3 files changed, 61 insertions(+), 13 deletions(-) diff --git a/arch/mips/netlogic/common/irq.c b/arch/mips/netlogic/common/irq.c index 73facb2b33bb..1c7e3a1b81ab 100644 --- a/arch/mips/netlogic/common/irq.c +++ b/arch/mips/netlogic/common/irq.c @@ -40,6 +40,10 @@ #include <linux/slab.h> #include <linux/irq.h> +#include <linux/irqdomain.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> + #include <asm/errno.h> #include <asm/signal.h> #include <asm/ptrace.h> @@ -223,17 +227,6 @@ static void nlm_init_node_irqs(int node) nodep->irqmask = irqmask; } -void __init arch_init_irq(void) -{ - /* Initialize the irq descriptors */ - nlm_init_percpu_irqs(); - nlm_init_node_irqs(0); - write_c0_eimr(nlm_current_node()->irqmask); -#if defined(CONFIG_CPU_XLR) - nlm_setup_fmn_irq(); -#endif -} - void nlm_smp_irq_init(int hwcpuid) { int node, cpu; @@ -266,3 +259,56 @@ asmlinkage void plat_irq_dispatch(void) /* top level irq handling */ do_IRQ(nlm_irq_to_xirq(node, i)); } + +#ifdef CONFIG_OF +static struct irq_domain *xlp_pic_domain; + +static const struct irq_domain_ops xlp_pic_irq_domain_ops = { + .xlate = irq_domain_xlate_onetwocell, +}; + +static int __init xlp_of_pic_init(struct device_node *node, + struct device_node *parent) +{ + const int n_picirqs = PIC_IRT_LAST_IRQ - PIC_IRQ_BASE + 1; + struct resource res; + int socid, ret; + + /* we need a hack to get the PIC's SoC chip id */ + ret = of_address_to_resource(node, 0, &res); + if (ret < 0) { + pr_err("PIC %s: reg property not found!\n", node->name); + return -EINVAL; + } + socid = (res.start >> 18) & 0x3; + xlp_pic_domain = irq_domain_add_legacy(node, n_picirqs, + nlm_irq_to_xirq(socid, PIC_IRQ_BASE), PIC_IRQ_BASE, + &xlp_pic_irq_domain_ops, NULL); + if (xlp_pic_domain == NULL) { + pr_err("PIC %s: Creating legacy domain failed!\n", node->name); + return -EINVAL; + } + pr_info("Node %d: IRQ domain created for PIC@%pa\n", socid, + &res.start); + return 0; +} + +static struct of_device_id __initdata xlp_pic_irq_ids[] = { + { .compatible = "netlogic,xlp-pic", .data = xlp_of_pic_init }, + {}, +}; +#endif + +void __init arch_init_irq(void) +{ + /* Initialize the irq descriptors */ + nlm_init_percpu_irqs(); + nlm_init_node_irqs(0); + write_c0_eimr(nlm_current_node()->irqmask); +#if defined(CONFIG_CPU_XLR) + nlm_setup_fmn_irq(); +#endif +#if defined(CONFIG_OF) + of_irq_init(xlp_pic_irq_ids); +#endif +} diff --git a/arch/mips/netlogic/dts/xlp_evp.dts b/arch/mips/netlogic/dts/xlp_evp.dts index e14f42308064..06407033678e 100644 --- a/arch/mips/netlogic/dts/xlp_evp.dts +++ b/arch/mips/netlogic/dts/xlp_evp.dts @@ -76,10 +76,11 @@ }; }; pic: pic@4000 { - interrupt-controller; + compatible = "netlogic,xlp-pic"; #address-cells = <0>; #interrupt-cells = <1>; reg = <0 0x4000 0x200>; + interrupt-controller; }; nor_flash@1,0 { diff --git a/arch/mips/netlogic/dts/xlp_svp.dts b/arch/mips/netlogic/dts/xlp_svp.dts index 8af4bdbe5d99..9c5db102df53 100644 --- a/arch/mips/netlogic/dts/xlp_svp.dts +++ b/arch/mips/netlogic/dts/xlp_svp.dts @@ -76,10 +76,11 @@ }; }; pic: pic@4000 { - interrupt-controller; + compatible = "netlogic,xlp-pic"; #address-cells = <0>; #interrupt-cells = <1>; reg = <0 0x4000 0x200>; + interrupt-controller; }; nor_flash@1,0 { From 38a997a70e6cf0ee9fc26de146601ba10fa552a4 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen <aaro.koskinen@iki.fi> Date: Mon, 15 Jul 2013 07:21:57 +0000 Subject: [PATCH 229/913] MIPS: tlbex: fix broken build in v3.11-rc1 Commit 6ba045f9fbdafb48da42aa8576ea7a3980443136 (MIPS: Move generated code to .text for microMIPS) deleted tlbmiss_handler_setup_pgd_array, but some references were not converted. Fix that to enable building a MIPS kernel. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Acked-by: Jayachandran C. <jchandra@broadcom.com> Acked-by: David Daney <david.daney@cavium.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5589/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/mm/tlbex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 605b6fc13697..523775d7a20e 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c @@ -1466,7 +1466,7 @@ static void __cpuinit build_r4000_setup_pgd(void) { const int a0 = 4; const int a1 = 5; - u32 *p = tlbmiss_handler_setup_pgd_array; + u32 *p = tlbmiss_handler_setup_pgd; const int tlbmiss_handler_setup_pgd_size = tlbmiss_handler_setup_pgd_end - tlbmiss_handler_setup_pgd; struct uasm_label *l = labels; From f2a5b1d78c076c525d20176d227faf2e6a20257c Mon Sep 17 00:00:00 2001 From: James Hogan <james.hogan@imgtec.com> Date: Fri, 12 Jul 2013 10:26:11 +0000 Subject: [PATCH 230/913] MIPS: KVM: Mark KVM_GUEST (T&E KVM) as BROKEN_ON_SMP Make KVM_GUEST depend on BROKEN_ON_SMP so that it cannot be enabled with SMP. SMP kernels use ll/sc instructions for an atomic section in the tlb fill handler, with a tlbp instruction contained in the middle. This cannot be emulated with trap & emulate KVM because the tlbp instruction traps and the eret to return to the guest code clears the LLbit which makes the sc instruction always fail. Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Sanjay Lal <sanjayl@kymasys.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: David Daney <david.daney@cavium.com> Cc: linux-mips@linux-mips.org Cc: kvm@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/5588/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 4758a8fd3e99..c3abed332301 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -1702,6 +1702,7 @@ endchoice config KVM_GUEST bool "KVM Guest Kernel" + depends on BROKEN_ON_SMP help Select this option if building a guest kernel for KVM (Trap & Emulate) mode From 3179ce7254ffa43f3ba4409f31a954ecc4a8d408 Mon Sep 17 00:00:00 2001 From: Richard Weinberger <richard@nod.at> Date: Sat, 11 May 2013 15:35:32 +0200 Subject: [PATCH 231/913] um: Fix return value of strnlen_user() In case of an error it must not return -EFAULT. Return 0 like all other archs do. Reported-by: toralf.foerster@gmx.de Signed-off-by: Richard Weinberger <richard@nod.at> --- arch/um/kernel/skas/uaccess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c index 1d3e0c17340b..4ffb644d6c07 100644 --- a/arch/um/kernel/skas/uaccess.c +++ b/arch/um/kernel/skas/uaccess.c @@ -254,6 +254,6 @@ int strnlen_user(const void __user *str, int len) n = buffer_op((unsigned long) str, len, 0, strnlen_chunk, &count); if (n == 0) return count + 1; - return -EFAULT; + return 0; } EXPORT_SYMBOL(strnlen_user); From dee20035b42d569984d2c16041b51e4d75e233b5 Mon Sep 17 00:00:00 2001 From: Richard Weinberger <richard@nod.at> Date: Sun, 12 May 2013 23:26:03 +0200 Subject: [PATCH 232/913] um: Mark stub pages mapping with VM_PFNMAP Ensure that a process cannot destroy his stub pages with using MADV_DONTNEED and friends. Reported-by: toralf.foerster@gmx.de Signed-off-by: Richard Weinberger <richard@nod.at> --- arch/um/kernel/skas/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c index ff03067a3b14..007d5503f49b 100644 --- a/arch/um/kernel/skas/mmu.c +++ b/arch/um/kernel/skas/mmu.c @@ -123,7 +123,7 @@ void uml_setup_stubs(struct mm_struct *mm) /* dup_mmap already holds mmap_sem */ err = install_special_mapping(mm, STUB_START, STUB_END - STUB_START, VM_READ | VM_MAYREAD | VM_EXEC | - VM_MAYEXEC | VM_DONTCOPY, + VM_MAYEXEC | VM_DONTCOPY | VM_PFNMAP, mm->context.stub_pages); if (err) { printk(KERN_ERR "install_special_mapping returned %d\n", err); From 0974a9cadc7886f7baaa458bb0c89f5c5f9d458e Mon Sep 17 00:00:00 2001 From: Richard Weinberger <richard@nod.at> Date: Fri, 17 May 2013 14:21:01 +0200 Subject: [PATCH 233/913] um: Fix wait_stub_done() error handling If we die within a stub handler we only way to reliable kill the (obviously) dying uml guest process is killing it's host twin on the host side. Signed-off-by: Richard Weinberger <richard@nod.at> --- arch/um/os-Linux/skas/process.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index 4625949bf1e4..441e4ba074f4 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c @@ -54,7 +54,7 @@ static int ptrace_dump_regs(int pid) void wait_stub_done(int pid) { - int n, status, err; + int n, status, err, bad_stop = 0; while (1) { CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL)); @@ -74,6 +74,8 @@ void wait_stub_done(int pid) if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0) return; + else + bad_stop = 1; bad_wait: err = ptrace_dump_regs(pid); @@ -83,7 +85,10 @@ bad_wait: printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, " "pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno, status); - fatal_sigsegv(); + if (bad_stop) + kill(pid, SIGKILL); + else + fatal_sigsegv(); } extern unsigned long current_stub_stack(void); From 7473534130c3156d199512c99ff1b796233e8547 Mon Sep 17 00:00:00 2001 From: Tristan Schmelcher <tschmelcher@google.com> Date: Mon, 8 Jul 2013 16:19:49 -0400 Subject: [PATCH 234/913] uml: Fix which_tmpdir failure when /dev/shm is a symlink, and in other edge cases which_tmpdir did the wrong thing if /dev/shm was a symlink (e.g., to /run/shm), if there were multiple mounts on top of each other, if the mount(s) were obscured by a later mount, or if /dev/shm was a prefix of another mount point. This fixes these cases. Applies to 3.9.6. Signed-off-by: Tristan Schmelcher <tschmelcher@google.com> Signed-off-by: Richard Weinberger <richard@nod.at> --- arch/um/os-Linux/mem.c | 230 +++++++++++++++++++++++++++++++++-------- 1 file changed, 189 insertions(+), 41 deletions(-) diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c index ba4398056fe9..3c4af77e51a2 100644 --- a/arch/um/os-Linux/mem.c +++ b/arch/um/os-Linux/mem.c @@ -52,6 +52,25 @@ static void __init find_tempdir(void) strcat(tempdir, "/"); } +/* + * Remove bytes from the front of the buffer and refill it so that if there's a + * partial string that we care about, it will be completed, and we can recognize + * it. + */ +static int pop(int fd, char *buf, size_t size, size_t npop) +{ + ssize_t n; + size_t len = strlen(&buf[npop]); + + memmove(buf, &buf[npop], len + 1); + n = read(fd, &buf[len], size - len - 1); + if (n < 0) + return -errno; + + buf[len + n] = '\0'; + return 1; +} + /* * This will return 1, with the first character in buf being the * character following the next instance of c in the file. This will @@ -61,7 +80,6 @@ static void __init find_tempdir(void) static int next(int fd, char *buf, size_t size, char c) { ssize_t n; - size_t len; char *ptr; while ((ptr = strchr(buf, c)) == NULL) { @@ -74,20 +92,129 @@ static int next(int fd, char *buf, size_t size, char c) buf[n] = '\0'; } - ptr++; - len = strlen(ptr); - memmove(buf, ptr, len + 1); + return pop(fd, buf, size, ptr - buf + 1); +} + +/* + * Decode an octal-escaped and space-terminated path of the form used by + * /proc/mounts. May be used to decode a path in-place. "out" must be at least + * as large as the input. The output is always null-terminated. "len" gets the + * length of the output, excluding the trailing null. Returns 0 if a full path + * was successfully decoded, otherwise an error. + */ +static int decode_path(const char *in, char *out, size_t *len) +{ + char *first = out; + int c; + int i; + int ret = -EINVAL; + while (1) { + switch (*in) { + case '\0': + goto out; + + case ' ': + ret = 0; + goto out; + + case '\\': + in++; + c = 0; + for (i = 0; i < 3; i++) { + if (*in < '0' || *in > '7') + goto out; + c = (c << 3) | (*in++ - '0'); + } + *(unsigned char *)out++ = (unsigned char) c; + break; + + default: + *out++ = *in++; + break; + } + } + +out: + *out = '\0'; + *len = out - first; + return ret; +} + +/* + * Computes the length of s when encoded with three-digit octal escape sequences + * for the characters in chars. + */ +static size_t octal_encoded_length(const char *s, const char *chars) +{ + size_t len = strlen(s); + while ((s = strpbrk(s, chars)) != NULL) { + len += 3; + s++; + } + + return len; +} + +enum { + OUTCOME_NOTHING_MOUNTED, + OUTCOME_TMPFS_MOUNT, + OUTCOME_NON_TMPFS_MOUNT, +}; + +/* Read a line of /proc/mounts data looking for a tmpfs mount at "path". */ +static int read_mount(int fd, char *buf, size_t bufsize, const char *path, + int *outcome) +{ + int found; + int match; + char *space; + size_t len; + + enum { + MATCH_NONE, + MATCH_EXACT, + MATCH_PARENT, + }; + + found = next(fd, buf, bufsize, ' '); + if (found != 1) + return found; /* - * Refill the buffer so that if there's a partial string that we care - * about, it will be completed, and we can recognize it. + * If there's no following space in the buffer, then this path is + * truncated, so it can't be the one we're looking for. */ - n = read(fd, &buf[len], size - len - 1); - if (n < 0) - return -errno; + space = strchr(buf, ' '); + if (space) { + match = MATCH_NONE; + if (!decode_path(buf, buf, &len)) { + if (!strcmp(buf, path)) + match = MATCH_EXACT; + else if (!strncmp(buf, path, len) + && (path[len] == '/' || !strcmp(buf, "/"))) + match = MATCH_PARENT; + } - buf[len + n] = '\0'; - return 1; + found = pop(fd, buf, bufsize, space - buf + 1); + if (found != 1) + return found; + + switch (match) { + case MATCH_EXACT: + if (!strncmp(buf, "tmpfs", strlen("tmpfs"))) + *outcome = OUTCOME_TMPFS_MOUNT; + else + *outcome = OUTCOME_NON_TMPFS_MOUNT; + break; + + case MATCH_PARENT: + /* This mount obscures any previous ones. */ + *outcome = OUTCOME_NOTHING_MOUNTED; + break; + } + } + + return next(fd, buf, bufsize, '\n'); } /* which_tmpdir is called only during early boot */ @@ -106,8 +233,12 @@ static int checked_tmpdir = 0; */ static void which_tmpdir(void) { - int fd, found; - char buf[128] = { '\0' }; + int fd; + int found; + int outcome; + char *path; + char *buf; + size_t bufsize; if (checked_tmpdir) return; @@ -116,49 +247,66 @@ static void which_tmpdir(void) printf("Checking for tmpfs mount on /dev/shm..."); + path = realpath("/dev/shm", NULL); + if (!path) { + printf("failed to check real path, errno = %d\n", errno); + return; + } + printf("%s...", path); + + /* + * The buffer needs to be able to fit the full octal-escaped path, a + * space, and a trailing null in order to successfully decode it. + */ + bufsize = octal_encoded_length(path, " \t\n\\") + 2; + + if (bufsize < 128) + bufsize = 128; + + buf = malloc(bufsize); + if (!buf) { + printf("malloc failed, errno = %d\n", errno); + goto out; + } + buf[0] = '\0'; + fd = open("/proc/mounts", O_RDONLY); if (fd < 0) { printf("failed to open /proc/mounts, errno = %d\n", errno); - return; + goto out1; } + outcome = OUTCOME_NOTHING_MOUNTED; while (1) { - found = next(fd, buf, ARRAY_SIZE(buf), ' '); - if (found != 1) - break; - - if (!strncmp(buf, "/dev/shm", strlen("/dev/shm"))) - goto found; - - found = next(fd, buf, ARRAY_SIZE(buf), '\n'); + found = read_mount(fd, buf, bufsize, path, &outcome); if (found != 1) break; } -err: - if (found == 0) - printf("nothing mounted on /dev/shm\n"); - else if (found < 0) + if (found < 0) { printf("read returned errno %d\n", -found); + } else { + switch (outcome) { + case OUTCOME_TMPFS_MOUNT: + printf("OK\n"); + default_tmpdir = "/dev/shm"; + break; -out: - close(fd); + case OUTCOME_NON_TMPFS_MOUNT: + printf("not tmpfs\n"); + break; - return; - -found: - found = next(fd, buf, ARRAY_SIZE(buf), ' '); - if (found != 1) - goto err; - - if (strncmp(buf, "tmpfs", strlen("tmpfs"))) { - printf("not tmpfs\n"); - goto out; + default: + printf("nothing mounted on /dev/shm\n"); + break; + } } - printf("OK\n"); - default_tmpdir = "/dev/shm"; - goto out; + close(fd); +out1: + free(buf); +out: + free(path); } static int __init make_tempfile(const char *template, char **out_tempname, From ab2bb148c5932712d2717a7f3a452846f07a660a Mon Sep 17 00:00:00 2001 From: Faidon Liambotis <paravoid@debian.org> Date: Thu, 11 Jul 2013 21:08:09 +0000 Subject: [PATCH 235/913] MIPS: Octeon: Fix DT pruning bug with pip ports During the pruning of the device tree octeon_fdt_pip_iface() is called for each PIP interface and every port up to the port count is removed from the device tree. However, the count was set to the return value of cvmx_helper_interface_enumerate() which doesn't actually return the count but just returns zero on success. This effectively removed *all* ports from the tree. Use cvmx_helper_ports_on_interface() instead to fix this. This successfully restores the 3 ports of my ERLite-3 and fixes the "kernel assigns random MAC addresses" issue. Signed-off-by: Faidon Liambotis <paravoid@debian.org> Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Acked-by: David Daney <david.daney@cavium.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5587/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/cavium-octeon/octeon-platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index 7b746e7bf7a1..1830874ff1e2 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -334,9 +334,10 @@ static void __init octeon_fdt_pip_iface(int pip, int idx, u64 *pmac) char name_buffer[20]; int iface; int p; - int count; + int count = 0; - count = cvmx_helper_interface_enumerate(idx); + if (cvmx_helper_interface_enumerate(idx) == 0) + count = cvmx_helper_ports_on_interface(idx); snprintf(name_buffer, sizeof(name_buffer), "interface@%d", idx); iface = fdt_subnode_offset(initial_boot_params, pip, name_buffer); From 9a8c1359571c5d5e2fbc43cf457a6486b70a70cb Mon Sep 17 00:00:00 2001 From: Richard Weinberger <richard@nod.at> Date: Fri, 19 Jul 2013 11:31:36 +0200 Subject: [PATCH 236/913] um: siginfo cleanup Currently we use both struct siginfo and siginfo_t. Let's use struct siginfo internally to avoid ongoing compiler warning. We are allowed to do so because struct siginfo and siginfo_t are equivalent. Signed-off-by: Richard Weinberger <richard@nod.at> --- arch/um/include/shared/frame_kern.h | 8 ++++---- arch/um/kernel/signal.c | 4 ++-- arch/um/os-Linux/signal.c | 8 ++++---- arch/um/os-Linux/skas/process.c | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/um/include/shared/frame_kern.h b/arch/um/include/shared/frame_kern.h index e584e40ee832..f2ca5702a4e2 100644 --- a/arch/um/include/shared/frame_kern.h +++ b/arch/um/include/shared/frame_kern.h @@ -6,13 +6,13 @@ #ifndef __FRAME_KERN_H_ #define __FRAME_KERN_H_ -extern int setup_signal_stack_sc(unsigned long stack_top, int sig, +extern int setup_signal_stack_sc(unsigned long stack_top, int sig, struct k_sigaction *ka, - struct pt_regs *regs, + struct pt_regs *regs, sigset_t *mask); -extern int setup_signal_stack_si(unsigned long stack_top, int sig, +extern int setup_signal_stack_si(unsigned long stack_top, int sig, struct k_sigaction *ka, - struct pt_regs *regs, siginfo_t *info, + struct pt_regs *regs, struct siginfo *info, sigset_t *mask); #endif diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index 3e831b3fd07b..f57e02e7910f 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c @@ -19,7 +19,7 @@ EXPORT_SYMBOL(unblock_signals); * OK, we're invoking a handler */ static void handle_signal(struct pt_regs *regs, unsigned long signr, - struct k_sigaction *ka, siginfo_t *info) + struct k_sigaction *ka, struct siginfo *info) { sigset_t *oldset = sigmask_to_save(); int singlestep = 0; @@ -71,7 +71,7 @@ static void handle_signal(struct pt_regs *regs, unsigned long signr, static int kern_do_signal(struct pt_regs *regs) { struct k_sigaction ka_copy; - siginfo_t info; + struct siginfo info; int sig, handled_sig = 0; while ((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0) { diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c index 9d9f1b4bf826..905924b773d3 100644 --- a/arch/um/os-Linux/signal.c +++ b/arch/um/os-Linux/signal.c @@ -25,7 +25,7 @@ void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = { [SIGIO] = sigio_handler, [SIGVTALRM] = timer_handler }; -static void sig_handler_common(int sig, siginfo_t *si, mcontext_t *mc) +static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc) { struct uml_pt_regs r; int save_errno = errno; @@ -61,7 +61,7 @@ static void sig_handler_common(int sig, siginfo_t *si, mcontext_t *mc) static int signals_enabled; static unsigned int signals_pending; -void sig_handler(int sig, siginfo_t *si, mcontext_t *mc) +void sig_handler(int sig, struct siginfo *si, mcontext_t *mc) { int enabled; @@ -120,7 +120,7 @@ void set_sigstack(void *sig_stack, int size) panic("enabling signal stack failed, errno = %d\n", errno); } -static void (*handlers[_NSIG])(int sig, siginfo_t *si, mcontext_t *mc) = { +static void (*handlers[_NSIG])(int sig, struct siginfo *si, mcontext_t *mc) = { [SIGSEGV] = sig_handler, [SIGBUS] = sig_handler, [SIGILL] = sig_handler, @@ -162,7 +162,7 @@ static void hard_handler(int sig, siginfo_t *si, void *p) while ((sig = ffs(pending)) != 0){ sig--; pending &= ~(1 << sig); - (*handlers[sig])(sig, si, mc); + (*handlers[sig])(sig, (struct siginfo *)si, mc); } /* diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index 441e4ba074f4..d531879a4617 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c @@ -414,7 +414,7 @@ void userspace(struct uml_pt_regs *regs) if (WIFSTOPPED(status)) { int sig = WSTOPSIG(status); - ptrace(PTRACE_GETSIGINFO, pid, 0, &si); + ptrace(PTRACE_GETSIGINFO, pid, 0, (struct siginfo *)&si); switch (sig) { case SIGSEGV: @@ -422,7 +422,7 @@ void userspace(struct uml_pt_regs *regs) !ptrace_faultinfo) { get_skas_faultinfo(pid, ®s->faultinfo); - (*sig_info[SIGSEGV])(SIGSEGV, &si, + (*sig_info[SIGSEGV])(SIGSEGV, (struct siginfo *)&si, regs); } else handle_segv(pid, regs); @@ -431,14 +431,14 @@ void userspace(struct uml_pt_regs *regs) handle_trap(pid, regs, local_using_sysemu); break; case SIGTRAP: - relay_signal(SIGTRAP, &si, regs); + relay_signal(SIGTRAP, (struct siginfo *)&si, regs); break; case SIGVTALRM: now = os_nsecs(); if (now < nsecs) break; block_signals(); - (*sig_info[sig])(sig, &si, regs); + (*sig_info[sig])(sig, (struct siginfo *)&si, regs); unblock_signals(); nsecs = timer.it_value.tv_sec * UM_NSEC_PER_SEC + @@ -452,7 +452,7 @@ void userspace(struct uml_pt_regs *regs) case SIGFPE: case SIGWINCH: block_signals(); - (*sig_info[sig])(sig, &si, regs); + (*sig_info[sig])(sig, (struct siginfo *)&si, regs); unblock_signals(); break; default: From 9e82d450531c79b18ab18c9b9645cdd9db31ee98 Mon Sep 17 00:00:00 2001 From: Richard Weinberger <richard@nod.at> Date: Fri, 19 Jul 2013 11:35:32 +0200 Subject: [PATCH 237/913] um: remove dead code "me" is not used. Signed-off-by: Richard Weinberger <richard@nod.at> --- arch/x86/um/signal.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c index ae7319db18ee..5e04a1c899fa 100644 --- a/arch/x86/um/signal.c +++ b/arch/x86/um/signal.c @@ -508,7 +508,6 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, { struct rt_sigframe __user *frame; int err = 0; - struct task_struct *me = current; frame = (struct rt_sigframe __user *) round_down(stack_top - sizeof(struct rt_sigframe), 16); From f1b7001903dd5a80bdc9f777d2a741ccfd22ed4e Mon Sep 17 00:00:00 2001 From: Markos Chandras <markos.chandras@imgtec.com> Date: Tue, 11 Jun 2013 09:02:33 +0000 Subject: [PATCH 238/913] MIPS: kvm: Kconfig: Drop HAVE_KVM dependency from VIRTUALIZATION Virtualization does not always need KVM capabilities so drop the dependency. The KVM symbol already depends on HAVE_KVM. Fixes the following problem on a randconfig: warning: (REMOTEPROC && RPMSG) selects VIRTUALIZATION which has unmet direct dependencies (HAVE_KVM) warning: (REMOTEPROC && RPMSG) selects VIRTUALIZATION which has unmet direct dependencies (HAVE_KVM) Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Acked-by: Steven J. Hill <Steven.Hill@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5443/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/kvm/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/mips/kvm/Kconfig b/arch/mips/kvm/Kconfig index 2c15590e55f7..30e334e823bd 100644 --- a/arch/mips/kvm/Kconfig +++ b/arch/mips/kvm/Kconfig @@ -5,7 +5,6 @@ source "virt/kvm/Kconfig" menuconfig VIRTUALIZATION bool "Virtualization" - depends on HAVE_KVM ---help--- Say Y here to get to see options for using your Linux host to run other operating systems inside virtual machines (guests). From 233a26e85f9a72bcd0cdb7a95d1d5abcd052369f Mon Sep 17 00:00:00 2001 From: Maximilian Schneider <max@schneidersoft.net> Date: Tue, 2 Jul 2013 23:43:29 +0000 Subject: [PATCH 239/913] net: can: esd_usb2: check index of array before accessing The esd_usb2_read_bulk_callback() function is parsing the data that comes from the USB CAN adapter. One datum is used as an index to access the dev->nets[] array. This patch adds the missing bounds checking. Acked-by: Matthias Fuchs <matthias.fuchs@esd.eu> Signed-off-by: Maximilian Schneider <max@schneidersoft.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- drivers/net/can/usb/esd_usb2.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index 6aa7b3266c80..ac6177d3befc 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c @@ -412,10 +412,20 @@ static void esd_usb2_read_bulk_callback(struct urb *urb) switch (msg->msg.hdr.cmd) { case CMD_CAN_RX: + if (msg->msg.rx.net >= dev->net_count) { + dev_err(dev->udev->dev.parent, "format error\n"); + break; + } + esd_usb2_rx_can_msg(dev->nets[msg->msg.rx.net], msg); break; case CMD_CAN_TX: + if (msg->msg.txdone.net >= dev->net_count) { + dev_err(dev->udev->dev.parent, "format error\n"); + break; + } + esd_usb2_tx_done_msg(dev->nets[msg->msg.txdone.net], msg); break; From 7671986839f9207f8d76e8ef92b2d3f263a794cc Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov <khoroshilov@ispras.ru> Date: Thu, 18 Jul 2013 01:20:33 +0400 Subject: [PATCH 240/913] can: usb_8dev: fix urb leak on failure path in usb_8dev_start() If usb_8dev_start() fails to submit urb, it unanchors the urb but forgets to free it. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- drivers/net/can/usb/usb_8dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c index cbd388eea682..8becd3d838b5 100644 --- a/drivers/net/can/usb/usb_8dev.c +++ b/drivers/net/can/usb/usb_8dev.c @@ -779,6 +779,7 @@ static int usb_8dev_start(struct usb_8dev_priv *priv) usb_unanchor_urb(urb); usb_free_coherent(priv->udev, RX_BUFFER_SIZE, buf, urb->transfer_dma); + usb_free_urb(urb); break; } From 53ae3acd4390ffeecb3a11dbd5be347b5a3d98f2 Mon Sep 17 00:00:00 2001 From: Catalin Marinas <catalin.marinas@arm.com> Date: Fri, 19 Jul 2013 15:08:15 +0100 Subject: [PATCH 241/913] arm64: Only enable local interrupts after the CPU is marked online There is a slight chance that (timer) interrupts are triggered before a secondary CPU has been marked online with implications on softirq thread affinity. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Reported-by: Kirill Tkhai <tkhai@yandex.ru> --- arch/arm64/kernel/smp.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 5d54e3717bf8..9c93e126328c 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -199,13 +199,6 @@ asmlinkage void __cpuinit secondary_start_kernel(void) raw_spin_lock(&boot_lock); raw_spin_unlock(&boot_lock); - /* - * Enable local interrupts. - */ - notify_cpu_starting(cpu); - local_irq_enable(); - local_fiq_enable(); - /* * OK, now it's safe to let the boot CPU continue. Wait for * the CPU migration code to notice that the CPU is online @@ -214,6 +207,14 @@ asmlinkage void __cpuinit secondary_start_kernel(void) set_cpu_online(cpu, true); complete(&cpu_running); + /* + * Enable GIC and timers. + */ + notify_cpu_starting(cpu); + + local_irq_enable(); + local_fiq_enable(); + /* * OK, it's off to the idle thread for us */ From c783c2815e13bbb0c0b99997cc240bd7e91b6bb8 Mon Sep 17 00:00:00 2001 From: Chen Gang <gang.chen@asianux.com> Date: Mon, 24 Jun 2013 10:27:49 +0100 Subject: [PATCH 242/913] arm64: add '#ifdef CONFIG_COMPAT' for aarch32_break_handler() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If 'COMPAT' not defined, aarch32_break_handler() cannot pass compiling, and it can work independent with 'COMPAT', so remove dummy definition. The related error: arch/arm64/kernel/debug-monitors.c:249:5: error: redefinition of ‘aarch32_break_handler’ In file included from arch/arm64/kernel/debug-monitors.c:29:0: /root/linux-next/arch/arm64/include/asm/debug-monitors.h:89:12: note: previous definition of ‘aarch32_break_handler’ was here Signed-off-by: Chen Gang <gang.chen@asianux.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- arch/arm64/include/asm/debug-monitors.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h index ef8235c68c09..a2232d07be9d 100644 --- a/arch/arm64/include/asm/debug-monitors.h +++ b/arch/arm64/include/asm/debug-monitors.h @@ -83,14 +83,7 @@ static inline int reinstall_suspended_bps(struct pt_regs *regs) } #endif -#ifdef CONFIG_COMPAT int aarch32_break_handler(struct pt_regs *regs); -#else -static int aarch32_break_handler(struct pt_regs *regs) -{ - return -EFAULT; -} -#endif #endif /* __ASSEMBLY */ #endif /* __KERNEL__ */ From db6f41063cbdb58b14846e600e6bc3f4e4c2e888 Mon Sep 17 00:00:00 2001 From: Will Deacon <will.deacon@arm.com> Date: Fri, 19 Jul 2013 15:37:12 +0100 Subject: [PATCH 243/913] arm64: mm: don't treat user cache maintenance faults as writes On arm64, cache maintenance faults appear as data aborts with the CM bit set in the ESR. The WnR bit, usually used to distinguish between faulting loads and stores, always reads as 1 and (slightly confusingly) the instructions are treated as reads by the architecture. This patch fixes our fault handling code to treat cache maintenance faults in the same way as loads. Signed-off-by: Will Deacon <will.deacon@arm.com> Cc: <stable@vger.kernel.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- arch/arm64/mm/fault.c | 46 +++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 0ecac8980aae..6c8ba25bf6bb 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -152,25 +152,8 @@ void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *regs) #define ESR_CM (1 << 8) #define ESR_LNX_EXEC (1 << 24) -/* - * Check that the permissions on the VMA allow for the fault which occurred. - * If we encountered a write fault, we must have write permission, otherwise - * we allow any permission. - */ -static inline bool access_error(unsigned int esr, struct vm_area_struct *vma) -{ - unsigned int mask = VM_READ | VM_WRITE | VM_EXEC; - - if (esr & ESR_WRITE) - mask = VM_WRITE; - if (esr & ESR_LNX_EXEC) - mask = VM_EXEC; - - return vma->vm_flags & mask ? false : true; -} - static int __do_page_fault(struct mm_struct *mm, unsigned long addr, - unsigned int esr, unsigned int flags, + unsigned int mm_flags, unsigned long vm_flags, struct task_struct *tsk) { struct vm_area_struct *vma; @@ -188,12 +171,17 @@ static int __do_page_fault(struct mm_struct *mm, unsigned long addr, * it. */ good_area: - if (access_error(esr, vma)) { + /* + * Check that the permissions on the VMA allow for the fault which + * occurred. If we encountered a write or exec fault, we must have + * appropriate permissions, otherwise we allow any permission. + */ + if (!(vma->vm_flags & vm_flags)) { fault = VM_FAULT_BADACCESS; goto out; } - return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags); + return handle_mm_fault(mm, vma, addr & PAGE_MASK, mm_flags); check_stack: if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr)) @@ -208,9 +196,15 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, struct task_struct *tsk; struct mm_struct *mm; int fault, sig, code; - bool write = (esr & ESR_WRITE) && !(esr & ESR_CM); - unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | - (write ? FAULT_FLAG_WRITE : 0); + unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC; + unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; + + if (esr & ESR_LNX_EXEC) { + vm_flags = VM_EXEC; + } else if ((esr & ESR_WRITE) && !(esr & ESR_CM)) { + vm_flags = VM_WRITE; + mm_flags |= FAULT_FLAG_WRITE; + } tsk = current; mm = tsk->mm; @@ -248,7 +242,7 @@ retry: #endif } - fault = __do_page_fault(mm, addr, esr, flags, tsk); + fault = __do_page_fault(mm, addr, mm_flags, vm_flags, tsk); /* * If we need to retry but a fatal signal is pending, handle the @@ -265,7 +259,7 @@ retry: */ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr); - if (flags & FAULT_FLAG_ALLOW_RETRY) { + if (mm_flags & FAULT_FLAG_ALLOW_RETRY) { if (fault & VM_FAULT_MAJOR) { tsk->maj_flt++; perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, @@ -280,7 +274,7 @@ retry: * Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk of * starvation. */ - flags &= ~FAULT_FLAG_ALLOW_RETRY; + mm_flags &= ~FAULT_FLAG_ALLOW_RETRY; goto retry; } } From 7427b370e0aa6226c763af94fc5c4e3433383543 Mon Sep 17 00:00:00 2001 From: Frederic Danis <frederic.danis@linux.intel.com> Date: Thu, 20 Jun 2013 11:11:04 +0200 Subject: [PATCH 244/913] NFC: Fix NCI over SPI build kbuild test robot found following error: net/built-in.o: In function `nci_spi_send': >> spi.c:(.text+0x19a76f): undefined reference to `crc_ccitt' Add CRC_CCITT module to Kconfig to fix it Reported-by: kbuild test robot. Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> --- net/nfc/nci/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/net/nfc/nci/Kconfig b/net/nfc/nci/Kconfig index 2a2416080b4f..a4f1e42e3481 100644 --- a/net/nfc/nci/Kconfig +++ b/net/nfc/nci/Kconfig @@ -11,6 +11,7 @@ config NFC_NCI config NFC_NCI_SPI depends on NFC_NCI && SPI + select CRC_CCITT bool "NCI over SPI protocol support" default n help From a644a7e9587802eabb2e229177606f6a74a60fc1 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Fri, 19 Jul 2013 16:20:36 +0200 Subject: [PATCH 245/913] tracing: Kill trace_array->waiter Trivial. trace_array->waiter has no users since 6eaaa5d5 "tracing/core: use appropriate waiting on trace_pipe". Link: http://lkml.kernel.org/r/20130719142036.GA1594@redhat.com Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.h | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 57b7bb0d39b7..e7d643b8a907 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -214,7 +214,6 @@ struct trace_array { struct dentry *event_dir; struct list_head systems; struct list_head events; - struct task_struct *waiter; int ref; }; From ff701306cd49aaff80fb852323b387812bc76491 Mon Sep 17 00:00:00 2001 From: Marc Zyngier <marc.zyngier@arm.com> Date: Thu, 11 Jul 2013 12:13:00 +0100 Subject: [PATCH 246/913] arm64: use common reboot infrastructure Commit 7b6d864b48d9 (reboot: arm: change reboot_mode to use enum reboot_mode) changed the way reboot is handled on arm, which has a direct impact on arm64 as we share the reset driver on the VE platform. The obvious fix is to move arm64 to use the same infrastructure. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> [catalin.marinas@arm.com: removed reboot_mode = REBOOT_HARD default setting] Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- arch/arm64/include/asm/system_misc.h | 3 ++- arch/arm64/kernel/process.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h index a6e1750369ef..7a18fabbe0f6 100644 --- a/arch/arm64/include/asm/system_misc.h +++ b/arch/arm64/include/asm/system_misc.h @@ -23,6 +23,7 @@ #include <linux/compiler.h> #include <linux/linkage.h> #include <linux/irqflags.h> +#include <linux/reboot.h> struct pt_regs; @@ -41,7 +42,7 @@ extern void show_pte(struct mm_struct *mm, unsigned long addr); extern void __show_regs(struct pt_regs *); void soft_restart(unsigned long); -extern void (*arm_pm_restart)(char str, const char *cmd); +extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); #define UDBG_UNDEFINED (1 << 0) #define UDBG_SYSCALL (1 << 1) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 46f02c3b5015..1788bf6b471f 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -132,7 +132,7 @@ void machine_restart(char *cmd) /* Now call the architecture specific reboot code. */ if (arm_pm_restart) - arm_pm_restart('h', cmd); + arm_pm_restart(reboot_mode, cmd); /* * Whoops - the architecture was unable to reboot. From e70e78e3c83b536730e31231dd9b979768d8df3c Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Fri, 19 Jul 2013 17:36:44 +0200 Subject: [PATCH 247/913] tracing: Kill the unbalanced tr->ref++ in tracing_buffers_open() tracing_buffers_open() does trace_array_get() and then it wrongly inrcements tr->ref again under trace_types_lock. This means that every caller leaks trace_array: # cd /sys/kernel/debug/tracing/ # mkdir instances/X # true < instances/X/per_cpu/cpu0/trace_pipe_raw # rmdir instances/X rmdir: failed to remove `instances/X': Device or resource busy Link: http://lkml.kernel.org/r/20130719153644.GA18899@redhat.com Cc: Ingo Molnar <mingo@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: stable@vger.kernel.org # 3.10 Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 7d9ceab42564..3f2477713aca 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -4959,8 +4959,6 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp) mutex_lock(&trace_types_lock); - tr->ref++; - info->iter.tr = tr; info->iter.cpu_file = tc->cpu; info->iter.trace = tr->current_trace; From 83e2e4eeb85fd45ff592b79ea11a19df49df872e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten <hsweeten@visionengravers.com> Date: Fri, 19 Jul 2013 09:53:25 -0700 Subject: [PATCH 248/913] ASoC: ep93xx: fix build of ep93xx-ac97.c Fix the build of this driver. It was broken by: Commit 453807f3006757a5661c4000262d7d9284b5214c ASoC: ep93xx: Use ep93xx_dma_params instead of ep93xx_pcm_dma_params The removed struct ep93xx_pcm_dma_params use the member 'dma_port' to select the dma channel. The struct ep93xx_dma_data uses the member 'port'. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ryan Mallon <rmallon@gmail.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Mark Brown <broonie@kernel.org> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@linaro.org> --- sound/soc/cirrus/ep93xx-ac97.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c index ac73c607410a..04491f0e8d1b 100644 --- a/sound/soc/cirrus/ep93xx-ac97.c +++ b/sound/soc/cirrus/ep93xx-ac97.c @@ -102,13 +102,13 @@ static struct ep93xx_ac97_info *ep93xx_ac97_info; static struct ep93xx_dma_data ep93xx_ac97_pcm_out = { .name = "ac97-pcm-out", - .dma_port = EP93XX_DMA_AAC1, + .port = EP93XX_DMA_AAC1, .direction = DMA_MEM_TO_DEV, }; static struct ep93xx_dma_data ep93xx_ac97_pcm_in = { .name = "ac97-pcm-in", - .dma_port = EP93XX_DMA_AAC1, + .port = EP93XX_DMA_AAC1, .direction = DMA_DEV_TO_MEM, }; From 3c8f24225752fba30f7265202ce6092318ed9fac Mon Sep 17 00:00:00 2001 From: Josef Bacik <jbacik@fusionio.com> Date: Mon, 15 Jul 2013 11:57:06 -0400 Subject: [PATCH 249/913] Btrfs: update drop progress before stopping snapshot dropping Alex pointed out a problem and fix that exists in the drop one snapshot at a time patch. If we decide we need to exit for whatever reason (umount for example) we will just exit the snapshot dropping without updating the drop progress. So the next time we go to resume we will BUG_ON() because we can't find the extent we left off at because we never updated it. This patch fixes the problem. Cc: stable@vger.kernel.org Reported-by: Alex Lyakas <alex.btrfs@zadarastorage.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> --- fs/btrfs/extent-tree.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 0236de711989..a429704dd95f 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -7552,11 +7552,6 @@ int btrfs_drop_snapshot(struct btrfs_root *root, wc->reada_count = BTRFS_NODEPTRS_PER_BLOCK(root); while (1) { - if (!for_reloc && btrfs_need_cleaner_sleep(root)) { - pr_debug("btrfs: drop snapshot early exit\n"); - err = -EAGAIN; - goto out_end_trans; - } ret = walk_down_tree(trans, root, path, wc); if (ret < 0) { @@ -7584,7 +7579,8 @@ int btrfs_drop_snapshot(struct btrfs_root *root, } BUG_ON(wc->level == 0); - if (btrfs_should_end_transaction(trans, tree_root)) { + if (btrfs_should_end_transaction(trans, tree_root) || + (!for_reloc && btrfs_need_cleaner_sleep(root))) { ret = btrfs_update_root(trans, tree_root, &root->root_key, root_item); @@ -7595,6 +7591,12 @@ int btrfs_drop_snapshot(struct btrfs_root *root, } btrfs_end_transaction_throttle(trans, tree_root); + if (!for_reloc && btrfs_need_cleaner_sleep(root)) { + pr_debug("btrfs: drop snapshot early exit\n"); + err = -EAGAIN; + goto out_free; + } + trans = btrfs_start_transaction(tree_root, 0); if (IS_ERR(trans)) { err = PTR_ERR(trans); From fec386ac1428f9c0e672df952cbca5cebd4e4e2f Mon Sep 17 00:00:00 2001 From: Josef Bacik <jbacik@fusionio.com> Date: Mon, 15 Jul 2013 12:41:42 -0400 Subject: [PATCH 250/913] Btrfs: fix lock leak when resuming snapshot deletion We aren't setting path->locks[level] when we resume a snapshot deletion which means we won't unlock the buffer when we free the path. This causes deadlocks if we happen to re-allocate the block before we've evicted the extent buffer from cache. Thanks, Cc: stable@vger.kernel.org Reported-by: Alex Lyakas <alex.btrfs@zadarastorage.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> --- fs/btrfs/extent-tree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a429704dd95f..e814b1312511 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -7523,6 +7523,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, while (1) { btrfs_tree_lock(path->nodes[level]); btrfs_set_lock_blocking(path->nodes[level]); + path->locks[level] = BTRFS_WRITE_LOCK_BLOCKING; ret = btrfs_lookup_extent_info(trans, root, path->nodes[level]->start, @@ -7538,6 +7539,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, break; btrfs_tree_unlock(path->nodes[level]); + path->locks[level] = 0; WARN_ON(wc->refs[level] != 1); level--; } From d29a9f629e009c9b90e5859bce581070fd6247fc Mon Sep 17 00:00:00 2001 From: Josef Bacik <jbacik@fusionio.com> Date: Wed, 17 Jul 2013 19:30:20 -0400 Subject: [PATCH 251/913] Btrfs: re-add root to dead root list if we stop dropping it If we stop dropping a root for whatever reason we need to add it back to the dead root list so that we will re-start the dropping next transaction commit. The other case this happens is if we recover a drop because we will add a root without adding it to the fs radix tree, so we can leak it's root and commit root extent buffer, adding this to the dead root list makes this cleanup happen. Thanks, Cc: stable@vger.kernel.org Reported-by: Alex Lyakas <alex.btrfs@zadarastorage.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> --- fs/btrfs/extent-tree.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index e814b1312511..1204c8ef6f32 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -7466,6 +7466,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int err = 0; int ret; int level; + bool root_dropped = false; path = btrfs_alloc_path(); if (!path) { @@ -7643,12 +7644,22 @@ int btrfs_drop_snapshot(struct btrfs_root *root, free_extent_buffer(root->commit_root); btrfs_put_fs_root(root); } + root_dropped = true; out_end_trans: btrfs_end_transaction_throttle(trans, tree_root); out_free: kfree(wc); btrfs_free_path(path); out: + /* + * So if we need to stop dropping the snapshot for whatever reason we + * need to make sure to add it back to the dead root list so that we + * keep trying to do the work later. This also cleans up roots if we + * don't have it in the radix (like when we recover after a power fail + * or unmount) so we don't leak memory. + */ + if (root_dropped == false) + btrfs_add_dead_root(root); if (err) btrfs_std_error(root->fs_info, err); return err; From 115930cb2d444a684975cf2325759cb48ebf80cc Mon Sep 17 00:00:00 2001 From: Stefan Behrens <sbehrens@giantdisaster.de> Date: Thu, 4 Jul 2013 16:14:23 +0200 Subject: [PATCH 252/913] Btrfs: fix wrong write offset when replacing a device Miao Xie reported the following issue: The filesystem was corrupted after we did a device replace. Steps to reproduce: # mkfs.btrfs -f -m single -d raid10 <device0>..<device3> # mount <device0> <mnt> # btrfs replace start -rfB 1 <device4> <mnt> # umount <mnt> # btrfsck <device4> The reason for the issue is that we changed the write offset by mistake, introduced by commit 625f1c8dc. We read the data from the source device at first, and then write the data into the corresponding place of the new device. In order to implement the "-r" option, the source location is remapped using btrfs_map_block(). The read takes place on the mapped location, and the write needs to take place on the unmapped location. Currently the write is using the mapped location, and this commit changes it back by undoing the change to the write address that the aforementioned commit added by mistake. Reported-by: Miao Xie <miaox@cn.fujitsu.com> Cc: <stable@vger.kernel.org> # 3.10+ Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> Signed-off-by: Josef Bacik <jbacik@fusionio.com> --- fs/btrfs/scrub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 4ba2a69a60ad..64a157becbe5 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -2495,7 +2495,7 @@ again: ret = scrub_extent(sctx, extent_logical, extent_len, extent_physical, extent_dev, flags, generation, extent_mirror_num, - extent_physical); + extent_logical - logical + physical); if (ret) goto out; From 29b7a47a9df2534ed62c4783dcf76153ceb76a73 Mon Sep 17 00:00:00 2001 From: Joe Perches <joe@perches.com> Date: Wed, 12 Dec 2012 10:18:51 -0800 Subject: [PATCH 253/913] alpha: Convert print_symbol to %pSR Use the new vsprintf extension to avoid any possible message interleaving. Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Joe Perches <joe@perches.com> --- arch/alpha/kernel/traps.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index be1fba334bd0..bd0665cdc840 100644 --- a/arch/alpha/kernel/traps.c +++ b/arch/alpha/kernel/traps.c @@ -66,8 +66,8 @@ dik_show_regs(struct pt_regs *regs, unsigned long *r9_15) { printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx %s\n", regs->pc, regs->r26, regs->ps, print_tainted()); - print_symbol("pc is at %s\n", regs->pc); - print_symbol("ra is at %s\n", regs->r26 ); + printk("pc is at %pSR\n", (void *)regs->pc); + printk("ra is at %pSR\n", (void *)regs->r26); printk("v0 = %016lx t0 = %016lx t1 = %016lx\n", regs->r0, regs->r1, regs->r2); printk("t2 = %016lx t3 = %016lx t4 = %016lx\n", @@ -132,9 +132,7 @@ dik_show_trace(unsigned long *sp) continue; if (tmp >= (unsigned long) &_etext) continue; - printk("[<%lx>]", tmp); - print_symbol(" %s", tmp); - printk("\n"); + printk("[<%lx>] %pSR\n", tmp, (void *)tmp); if (i > 40) { printk(" ..."); break; From 00ee03092a6e4b1d0ddc6b861ebb9ed8d13cc29b Mon Sep 17 00:00:00 2001 From: Chen Gang <gang.chen@asianux.com> Date: Wed, 29 May 2013 18:51:28 +0800 Subject: [PATCH 254/913] alpha: kernel: using memcpy() instead of strcpy() When sending message in send_secondary_console_msg(), the length is not include the NUL byte, and also not copy NUL to 'ipc_buffer'. When receive message in recv_secondary_console_msg(), the 'cnt' also excludes NUL. So when get string from ipc_buffer, it may not be NUL terminated. Then use memcpy() instead of strcpy(), and set last byte NUL. Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Chen Gang <gang.chen@asianux.com> --- arch/alpha/kernel/smp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index 53b18a620e1c..4bc3c414d075 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c @@ -266,7 +266,8 @@ recv_secondary_console_msg(void) else { cp1 = (char *) &cpu->ipc_buffer[11]; cp2 = buf; - strcpy(cp2, cp1); + memcpy(cp2, cp1, cnt); + cp2[cnt] = '\0'; while ((cp2 = strchr(cp2, '\r')) != 0) { *cp2 = ' '; From 91b678c8edb7d8abd444705df63b80af31ad13e8 Mon Sep 17 00:00:00 2001 From: Chen Gang <gang.chen@asianux.com> Date: Wed, 29 May 2013 19:04:09 +0800 Subject: [PATCH 255/913] alpha: kernel: typo issue, using '1' instead of '11' For sending message: *(unsigned int *)&cpu->ipc_buffer[0] = len; cp1 = (char *) &cpu->ipc_buffer[1]; But for receive message: cnt = cpu->ipc_buffer[0] >> 32; ... cp1 = (char *) &cpu->ipc_buffer[11]; They are not pairs, it is typo issue of the redundency '1'. So need use '1' instead of '11'. Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Chen Gang <gang.chen@asianux.com> --- arch/alpha/kernel/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index 4bc3c414d075..9dbbcb3b9146 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c @@ -264,7 +264,7 @@ recv_secondary_console_msg(void) if (cnt <= 0 || cnt >= 80) strcpy(buf, "<<< BOGUS MSG >>>"); else { - cp1 = (char *) &cpu->ipc_buffer[11]; + cp1 = (char *) &cpu->ipc_buffer[1]; cp2 = buf; memcpy(cp2, cp1, cnt); cp2[cnt] = '\0'; From 8b3ed3c002666540d9782a5219fa75c8a3fba98f Mon Sep 17 00:00:00 2001 From: Will Deacon <will.deacon@arm.com> Date: Fri, 21 Jun 2013 18:17:22 +0100 Subject: [PATCH 256/913] alpha: locks: remove unused arch_*_relax operations The arch_{spin,read,write}_relax macros are not used anywhere in the kernel and are typically just aliases for cpu_relax(). This patch removes the unused definitions for Alpha. Cc: Al Viro <viro@zeniv.linux.org.uk> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Will Deacon <will.deacon@arm.com> --- arch/alpha/include/asm/spinlock.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/alpha/include/asm/spinlock.h b/arch/alpha/include/asm/spinlock.h index 3bba21e41b81..37b570d01202 100644 --- a/arch/alpha/include/asm/spinlock.h +++ b/arch/alpha/include/asm/spinlock.h @@ -168,8 +168,4 @@ static inline void arch_write_unlock(arch_rwlock_t * lock) #define arch_read_lock_flags(lock, flags) arch_read_lock(lock) #define arch_write_lock_flags(lock, flags) arch_write_lock(lock) -#define arch_spin_relax(lock) cpu_relax() -#define arch_read_relax(lock) cpu_relax() -#define arch_write_relax(lock) cpu_relax() - #endif /* _ALPHA_SPINLOCK_H */ From 01350eb6c0d6fa7831b387d50e19830d8d0da354 Mon Sep 17 00:00:00 2001 From: Richard Henderson <rth@twiddle.net> Date: Sat, 13 Jul 2013 13:31:51 -0700 Subject: [PATCH 257/913] alpha: Add kcmp and finit_module syscalls Reviewed-and-Tested-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net> --- arch/alpha/include/asm/unistd.h | 3 +-- arch/alpha/include/uapi/asm/unistd.h | 2 ++ arch/alpha/kernel/systbls.S | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h index 43baee17acdf..f2c94402e2c8 100644 --- a/arch/alpha/include/asm/unistd.h +++ b/arch/alpha/include/asm/unistd.h @@ -3,8 +3,7 @@ #include <uapi/asm/unistd.h> - -#define NR_SYSCALLS 506 +#define NR_SYSCALLS 508 #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_STAT64 diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h index 801d28bcea51..53ae7bb1bfd1 100644 --- a/arch/alpha/include/uapi/asm/unistd.h +++ b/arch/alpha/include/uapi/asm/unistd.h @@ -467,5 +467,7 @@ #define __NR_sendmmsg 503 #define __NR_process_vm_readv 504 #define __NR_process_vm_writev 505 +#define __NR_kcmp 506 +#define __NR_finit_module 507 #endif /* _UAPI_ALPHA_UNISTD_H */ diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S index 4284ec798ec9..dca9b3fb0071 100644 --- a/arch/alpha/kernel/systbls.S +++ b/arch/alpha/kernel/systbls.S @@ -524,6 +524,8 @@ sys_call_table: .quad sys_sendmmsg .quad sys_process_vm_readv .quad sys_process_vm_writev /* 505 */ + .quad sys_kcmp + .quad sys_finit_module .size sys_call_table, . - sys_call_table .type sys_call_table, @object From a5c6eae4d6763e50101494b392ef6518c0ef96e9 Mon Sep 17 00:00:00 2001 From: Richard Henderson <rth@twiddle.net> Date: Wed, 10 Jul 2013 11:05:59 -0700 Subject: [PATCH 258/913] alpha: Modernize lib/mpi/longlong.h Remove the compile warning for __udiv_qrnnd not having a prototype. Use the __builtin_alpha_umulh introduced in gcc 4.0. Reviewed-and-Tested-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net> --- lib/mpi/longlong.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/mpi/longlong.h b/lib/mpi/longlong.h index d411355f238e..aac511417ad1 100644 --- a/lib/mpi/longlong.h +++ b/lib/mpi/longlong.h @@ -151,15 +151,12 @@ do { \ #endif /* __a29k__ */ #if defined(__alpha) && W_TYPE_SIZE == 64 -#define umul_ppmm(ph, pl, m0, m1) \ -do { \ - UDItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("umulh %r1,%2,%0" \ - : "=r" ((UDItype) ph) \ - : "%rJ" (__m0), \ - "rI" (__m1)); \ - (pl) = __m0 * __m1; \ - } while (0) +#define umul_ppmm(ph, pl, m0, m1) \ +do { \ + UDItype __m0 = (m0), __m1 = (m1); \ + (ph) = __builtin_alpha_umulh(__m0, __m1); \ + (pl) = __m0 * __m1; \ +} while (0) #define UMUL_TIME 46 #ifndef LONGLONG_STANDALONE #define udiv_qrnnd(q, r, n1, n0, d) \ @@ -167,7 +164,7 @@ do { UDItype __r; \ (q) = __udiv_qrnnd(&__r, (n1), (n0), (d)); \ (r) = __r; \ } while (0) -extern UDItype __udiv_qrnnd(); +extern UDItype __udiv_qrnnd(UDItype *, UDItype, UDItype, UDItype); #define UDIV_TIME 220 #endif /* LONGLONG_STANDALONE */ #endif /* __alpha */ From 6da7539734d4e0f5caeea1e0efbb74d7b83db1ca Mon Sep 17 00:00:00 2001 From: Richard Henderson <rth@twiddle.net> Date: Thu, 11 Jul 2013 07:42:14 -0700 Subject: [PATCH 259/913] alpha: Improve atomic_add_unless Use ll/sc loops instead of C loops around cmpxchg. Update the atomic64_add_unless block comment to match the code. Reviewed-and-Tested-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net> --- arch/alpha/include/asm/atomic.h | 60 ++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h index c2cbe4fc391c..0dc18fc4d925 100644 --- a/arch/alpha/include/asm/atomic.h +++ b/arch/alpha/include/asm/atomic.h @@ -186,17 +186,24 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v) */ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u) { - int c, old; - c = atomic_read(v); - for (;;) { - if (unlikely(c == (u))) - break; - old = atomic_cmpxchg((v), c, c + (a)); - if (likely(old == c)) - break; - c = old; - } - return c; + int c, new, old; + smp_mb(); + __asm__ __volatile__( + "1: ldl_l %[old],%[mem]\n" + " cmpeq %[old],%[u],%[c]\n" + " addl %[old],%[a],%[new]\n" + " bne %[c],2f\n" + " stl_c %[new],%[mem]\n" + " beq %[new],3f\n" + "2:\n" + ".subsection 2\n" + "3: br 1b\n" + ".previous" + : [old] "=&r"(old), [new] "=&r"(new), [c] "=&r"(c) + : [mem] "m"(*v), [a] "rI"(a), [u] "rI"((long)u) + : "memory"); + smp_mb(); + return old; } @@ -207,21 +214,28 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u) * @u: ...unless v is equal to u. * * Atomically adds @a to @v, so long as it was not @u. - * Returns the old value of @v. + * Returns true iff @v was not @u. */ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) { - long c, old; - c = atomic64_read(v); - for (;;) { - if (unlikely(c == (u))) - break; - old = atomic64_cmpxchg((v), c, c + (a)); - if (likely(old == c)) - break; - c = old; - } - return c != (u); + long c, tmp; + smp_mb(); + __asm__ __volatile__( + "1: ldq_l %[tmp],%[mem]\n" + " cmpeq %[tmp],%[u],%[c]\n" + " addq %[tmp],%[a],%[tmp]\n" + " bne %[c],2f\n" + " stq_c %[tmp],%[mem]\n" + " beq %[tmp],3f\n" + "2:\n" + ".subsection 2\n" + "3: br 1b\n" + ".previous" + : [tmp] "=&r"(tmp), [c] "=&r"(c) + : [mem] "m"(*v), [a] "rI"(a), [u] "rI"(u) + : "memory"); + smp_mb(); + return !c; } #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) From 748a76b5152e8f38edf8afbf6f4cd6e326ad9e62 Mon Sep 17 00:00:00 2001 From: Richard Henderson <rth@twiddle.net> Date: Thu, 11 Jul 2013 08:04:20 -0700 Subject: [PATCH 260/913] alpha: Implement atomic64_dec_if_positive Reviewed-and-Tested-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net> --- arch/alpha/Kconfig | 1 + arch/alpha/include/asm/atomic.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 837a1f2d8b96..082d9b4b5472 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -15,6 +15,7 @@ config ALPHA select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_IPC_PARSE_VERSION select ARCH_HAVE_NMI_SAFE_CMPXCHG + select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select GENERIC_SMP_IDLE_THREAD select GENERIC_CMOS_UPDATE select GENERIC_STRNCPY_FROM_USER diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h index 0dc18fc4d925..78b03ef39f6f 100644 --- a/arch/alpha/include/asm/atomic.h +++ b/arch/alpha/include/asm/atomic.h @@ -238,6 +238,34 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) return !c; } +/* + * atomic64_dec_if_positive - decrement by 1 if old value positive + * @v: pointer of type atomic_t + * + * The function returns the old value of *v minus 1, even if + * the atomic variable, v, was not decremented. + */ +static inline long atomic64_dec_if_positive(atomic64_t *v) +{ + long old, tmp; + smp_mb(); + __asm__ __volatile__( + "1: ldq_l %[old],%[mem]\n" + " subq %[old],1,%[tmp]\n" + " ble %[old],2f\n" + " stq_c %[tmp],%[mem]\n" + " beq %[tmp],3f\n" + "2:\n" + ".subsection 2\n" + "3: br 1b\n" + ".previous" + : [old] "=&r"(old), [tmp] "=&r"(tmp) + : [mem] "m"(*v) + : "memory"); + smp_mb(); + return old - 1; +} + #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) From 231b0bedf55325ee5a1c7bdd47d00131dafc9ab7 Mon Sep 17 00:00:00 2001 From: Richard Henderson <rth@twiddle.net> Date: Tue, 12 Apr 2011 14:45:12 -0700 Subject: [PATCH 261/913] alpha: Generate dwarf2 unwind info for various kernel entry points. Having unwind info past the PALcode generated stack frame makes debugging the kernel significantly easier. Acked-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net> --- arch/alpha/kernel/entry.S | 399 +++++++++++++++++++++++++++----------- 1 file changed, 288 insertions(+), 111 deletions(-) diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index f62a994ef126..a969b95ee5ac 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S @@ -12,11 +12,32 @@ .text .set noat + .cfi_sections .debug_frame /* Stack offsets. */ #define SP_OFF 184 #define SWITCH_STACK_SIZE 320 +.macro CFI_START_OSF_FRAME func + .align 4 + .globl \func + .type \func,@function +\func: + .cfi_startproc simple + .cfi_return_column 64 + .cfi_def_cfa $sp, 48 + .cfi_rel_offset 64, 8 + .cfi_rel_offset $gp, 16 + .cfi_rel_offset $16, 24 + .cfi_rel_offset $17, 32 + .cfi_rel_offset $18, 40 +.endm + +.macro CFI_END_OSF_FRAME func + .cfi_endproc + .size \func, . - \func +.endm + /* * This defines the normal kernel pt-regs layout. * @@ -27,100 +48,158 @@ * the palcode-provided values are available to the signal handler. */ -#define SAVE_ALL \ - subq $sp, SP_OFF, $sp; \ - stq $0, 0($sp); \ - stq $1, 8($sp); \ - stq $2, 16($sp); \ - stq $3, 24($sp); \ - stq $4, 32($sp); \ - stq $28, 144($sp); \ - lda $2, alpha_mv; \ - stq $5, 40($sp); \ - stq $6, 48($sp); \ - stq $7, 56($sp); \ - stq $8, 64($sp); \ - stq $19, 72($sp); \ - stq $20, 80($sp); \ - stq $21, 88($sp); \ - ldq $2, HAE_CACHE($2); \ - stq $22, 96($sp); \ - stq $23, 104($sp); \ - stq $24, 112($sp); \ - stq $25, 120($sp); \ - stq $26, 128($sp); \ - stq $27, 136($sp); \ - stq $2, 152($sp); \ - stq $16, 160($sp); \ - stq $17, 168($sp); \ +.macro SAVE_ALL + subq $sp, SP_OFF, $sp + .cfi_adjust_cfa_offset SP_OFF + stq $0, 0($sp) + stq $1, 8($sp) + stq $2, 16($sp) + stq $3, 24($sp) + stq $4, 32($sp) + stq $28, 144($sp) + .cfi_rel_offset $0, 0 + .cfi_rel_offset $1, 8 + .cfi_rel_offset $2, 16 + .cfi_rel_offset $3, 24 + .cfi_rel_offset $4, 32 + .cfi_rel_offset $28, 144 + lda $2, alpha_mv + stq $5, 40($sp) + stq $6, 48($sp) + stq $7, 56($sp) + stq $8, 64($sp) + stq $19, 72($sp) + stq $20, 80($sp) + stq $21, 88($sp) + ldq $2, HAE_CACHE($2) + stq $22, 96($sp) + stq $23, 104($sp) + stq $24, 112($sp) + stq $25, 120($sp) + stq $26, 128($sp) + stq $27, 136($sp) + stq $2, 152($sp) + stq $16, 160($sp) + stq $17, 168($sp) stq $18, 176($sp) + .cfi_rel_offset $5, 40 + .cfi_rel_offset $6, 48 + .cfi_rel_offset $7, 56 + .cfi_rel_offset $8, 64 + .cfi_rel_offset $19, 72 + .cfi_rel_offset $20, 80 + .cfi_rel_offset $21, 88 + .cfi_rel_offset $22, 96 + .cfi_rel_offset $23, 104 + .cfi_rel_offset $24, 112 + .cfi_rel_offset $25, 120 + .cfi_rel_offset $26, 128 + .cfi_rel_offset $27, 136 +.endm -#define RESTORE_ALL \ - lda $19, alpha_mv; \ - ldq $0, 0($sp); \ - ldq $1, 8($sp); \ - ldq $2, 16($sp); \ - ldq $3, 24($sp); \ - ldq $21, 152($sp); \ - ldq $20, HAE_CACHE($19); \ - ldq $4, 32($sp); \ - ldq $5, 40($sp); \ - ldq $6, 48($sp); \ - ldq $7, 56($sp); \ - subq $20, $21, $20; \ - ldq $8, 64($sp); \ - beq $20, 99f; \ - ldq $20, HAE_REG($19); \ - stq $21, HAE_CACHE($19); \ - stq $21, 0($20); \ -99:; \ - ldq $19, 72($sp); \ - ldq $20, 80($sp); \ - ldq $21, 88($sp); \ - ldq $22, 96($sp); \ - ldq $23, 104($sp); \ - ldq $24, 112($sp); \ - ldq $25, 120($sp); \ - ldq $26, 128($sp); \ - ldq $27, 136($sp); \ - ldq $28, 144($sp); \ +.macro RESTORE_ALL + lda $19, alpha_mv + ldq $0, 0($sp) + ldq $1, 8($sp) + ldq $2, 16($sp) + ldq $3, 24($sp) + ldq $21, 152($sp) + ldq $20, HAE_CACHE($19) + ldq $4, 32($sp) + ldq $5, 40($sp) + ldq $6, 48($sp) + ldq $7, 56($sp) + subq $20, $21, $20 + ldq $8, 64($sp) + beq $20, 99f + ldq $20, HAE_REG($19) + stq $21, HAE_CACHE($19) + stq $21, 0($20) +99: ldq $19, 72($sp) + ldq $20, 80($sp) + ldq $21, 88($sp) + ldq $22, 96($sp) + ldq $23, 104($sp) + ldq $24, 112($sp) + ldq $25, 120($sp) + ldq $26, 128($sp) + ldq $27, 136($sp) + ldq $28, 144($sp) addq $sp, SP_OFF, $sp + .cfi_restore $0 + .cfi_restore $1 + .cfi_restore $2 + .cfi_restore $3 + .cfi_restore $4 + .cfi_restore $5 + .cfi_restore $6 + .cfi_restore $7 + .cfi_restore $8 + .cfi_restore $19 + .cfi_restore $20 + .cfi_restore $21 + .cfi_restore $22 + .cfi_restore $23 + .cfi_restore $24 + .cfi_restore $25 + .cfi_restore $26 + .cfi_restore $27 + .cfi_restore $28 + .cfi_adjust_cfa_offset -SP_OFF +.endm + +.macro DO_SWITCH_STACK + bsr $1, do_switch_stack + .cfi_adjust_cfa_offset SWITCH_STACK_SIZE + .cfi_rel_offset $9, 0 + .cfi_rel_offset $10, 8 + .cfi_rel_offset $11, 16 + .cfi_rel_offset $12, 24 + .cfi_rel_offset $13, 32 + .cfi_rel_offset $14, 40 + .cfi_rel_offset $15, 48 + /* We don't really care about the FP registers for debugging. */ +.endm + +.macro UNDO_SWITCH_STACK + bsr $1, undo_switch_stack + .cfi_restore $9 + .cfi_restore $10 + .cfi_restore $11 + .cfi_restore $12 + .cfi_restore $13 + .cfi_restore $14 + .cfi_restore $15 + .cfi_adjust_cfa_offset -SWITCH_STACK_SIZE +.endm /* * Non-syscall kernel entry points. */ - .align 4 - .globl entInt - .ent entInt -entInt: +CFI_START_OSF_FRAME entInt SAVE_ALL lda $8, 0x3fff lda $26, ret_from_sys_call bic $sp, $8, $8 mov $sp, $19 jsr $31, do_entInt -.end entInt +CFI_END_OSF_FRAME entInt - .align 4 - .globl entArith - .ent entArith -entArith: +CFI_START_OSF_FRAME entArith SAVE_ALL lda $8, 0x3fff lda $26, ret_from_sys_call bic $sp, $8, $8 mov $sp, $18 jsr $31, do_entArith -.end entArith +CFI_END_OSF_FRAME entArith - .align 4 - .globl entMM - .ent entMM -entMM: +CFI_START_OSF_FRAME entMM SAVE_ALL /* save $9 - $15 so the inline exception code can manipulate them. */ subq $sp, 56, $sp + .cfi_adjust_cfa_offset 56 stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp) @@ -128,6 +207,13 @@ entMM: stq $13, 32($sp) stq $14, 40($sp) stq $15, 48($sp) + .cfi_rel_offset $9, 0 + .cfi_rel_offset $10, 8 + .cfi_rel_offset $11, 16 + .cfi_rel_offset $12, 24 + .cfi_rel_offset $13, 32 + .cfi_rel_offset $14, 40 + .cfi_rel_offset $15, 48 addq $sp, 56, $19 /* handle the fault */ lda $8, 0x3fff @@ -142,28 +228,33 @@ entMM: ldq $14, 40($sp) ldq $15, 48($sp) addq $sp, 56, $sp + .cfi_restore $9 + .cfi_restore $10 + .cfi_restore $11 + .cfi_restore $12 + .cfi_restore $13 + .cfi_restore $14 + .cfi_restore $15 + .cfi_adjust_cfa_offset -56 /* finish up the syscall as normal. */ br ret_from_sys_call -.end entMM +CFI_END_OSF_FRAME entMM - .align 4 - .globl entIF - .ent entIF -entIF: +CFI_START_OSF_FRAME entIF SAVE_ALL lda $8, 0x3fff lda $26, ret_from_sys_call bic $sp, $8, $8 mov $sp, $17 jsr $31, do_entIF -.end entIF +CFI_END_OSF_FRAME entIF - .align 4 - .globl entUna - .ent entUna -entUna: +CFI_START_OSF_FRAME entUna lda $sp, -256($sp) + .cfi_adjust_cfa_offset 256 stq $0, 0($sp) + .cfi_rel_offset $0, 0 + .cfi_remember_state ldq $0, 256($sp) /* get PS */ stq $1, 8($sp) stq $2, 16($sp) @@ -195,6 +286,32 @@ entUna: stq $28, 224($sp) mov $sp, $19 stq $gp, 232($sp) + .cfi_rel_offset $1, 1*8 + .cfi_rel_offset $2, 2*8 + .cfi_rel_offset $3, 3*8 + .cfi_rel_offset $4, 4*8 + .cfi_rel_offset $5, 5*8 + .cfi_rel_offset $6, 6*8 + .cfi_rel_offset $7, 7*8 + .cfi_rel_offset $8, 8*8 + .cfi_rel_offset $9, 9*8 + .cfi_rel_offset $10, 10*8 + .cfi_rel_offset $11, 11*8 + .cfi_rel_offset $12, 12*8 + .cfi_rel_offset $13, 13*8 + .cfi_rel_offset $14, 14*8 + .cfi_rel_offset $15, 15*8 + .cfi_rel_offset $19, 19*8 + .cfi_rel_offset $20, 20*8 + .cfi_rel_offset $21, 21*8 + .cfi_rel_offset $22, 22*8 + .cfi_rel_offset $23, 23*8 + .cfi_rel_offset $24, 24*8 + .cfi_rel_offset $25, 25*8 + .cfi_rel_offset $26, 26*8 + .cfi_rel_offset $27, 27*8 + .cfi_rel_offset $28, 28*8 + .cfi_rel_offset $29, 29*8 lda $8, 0x3fff stq $31, 248($sp) bic $sp, $8, $8 @@ -228,16 +345,45 @@ entUna: ldq $28, 224($sp) ldq $gp, 232($sp) lda $sp, 256($sp) + .cfi_restore $1 + .cfi_restore $2 + .cfi_restore $3 + .cfi_restore $4 + .cfi_restore $5 + .cfi_restore $6 + .cfi_restore $7 + .cfi_restore $8 + .cfi_restore $9 + .cfi_restore $10 + .cfi_restore $11 + .cfi_restore $12 + .cfi_restore $13 + .cfi_restore $14 + .cfi_restore $15 + .cfi_restore $19 + .cfi_restore $20 + .cfi_restore $21 + .cfi_restore $22 + .cfi_restore $23 + .cfi_restore $24 + .cfi_restore $25 + .cfi_restore $26 + .cfi_restore $27 + .cfi_restore $28 + .cfi_restore $29 + .cfi_adjust_cfa_offset -256 call_pal PAL_rti -.end entUna .align 4 - .ent entUnaUser entUnaUser: + .cfi_restore_state ldq $0, 0($sp) /* restore original $0 */ lda $sp, 256($sp) /* pop entUna's stack frame */ + .cfi_restore $0 + .cfi_adjust_cfa_offset -256 SAVE_ALL /* setup normal kernel stack */ lda $sp, -56($sp) + .cfi_adjust_cfa_offset 56 stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp) @@ -245,6 +391,13 @@ entUnaUser: stq $13, 32($sp) stq $14, 40($sp) stq $15, 48($sp) + .cfi_rel_offset $9, 0 + .cfi_rel_offset $10, 8 + .cfi_rel_offset $11, 16 + .cfi_rel_offset $12, 24 + .cfi_rel_offset $13, 32 + .cfi_rel_offset $14, 40 + .cfi_rel_offset $15, 48 lda $8, 0x3fff addq $sp, 56, $19 bic $sp, $8, $8 @@ -257,20 +410,25 @@ entUnaUser: ldq $14, 40($sp) ldq $15, 48($sp) lda $sp, 56($sp) + .cfi_restore $9 + .cfi_restore $10 + .cfi_restore $11 + .cfi_restore $12 + .cfi_restore $13 + .cfi_restore $14 + .cfi_restore $15 + .cfi_adjust_cfa_offset -56 br ret_from_sys_call -.end entUnaUser +CFI_END_OSF_FRAME entUna - .align 4 - .globl entDbg - .ent entDbg -entDbg: +CFI_START_OSF_FRAME entDbg SAVE_ALL lda $8, 0x3fff lda $26, ret_from_sys_call bic $sp, $8, $8 mov $sp, $16 jsr $31, do_entDbg -.end entDbg +CFI_END_OSF_FRAME entDbg /* * The system call entry point is special. Most importantly, it looks @@ -285,8 +443,12 @@ entDbg: .align 4 .globl entSys - .globl ret_from_sys_call - .ent entSys + .type entSys, @function + .cfi_startproc simple + .cfi_return_column 64 + .cfi_def_cfa $sp, 48 + .cfi_rel_offset 64, 8 + .cfi_rel_offset $gp, 16 entSys: SAVE_ALL lda $8, 0x3fff @@ -300,6 +462,9 @@ entSys: stq $17, SP_OFF+32($sp) s8addq $0, $5, $5 stq $18, SP_OFF+40($sp) + .cfi_rel_offset $16, SP_OFF+24 + .cfi_rel_offset $17, SP_OFF+32 + .cfi_rel_offset $18, SP_OFF+40 blbs $3, strace beq $4, 1f ldq $27, 0($5) @@ -310,6 +475,7 @@ entSys: stq $31, 72($sp) /* a3=0 => no error */ .align 4 + .globl ret_from_sys_call ret_from_sys_call: cmovne $26, 0, $18 /* $18 = 0 => non-restartable */ ldq $0, SP_OFF($sp) @@ -324,10 +490,12 @@ ret_to_user: and $17, _TIF_WORK_MASK, $2 bne $2, work_pending restore_all: + .cfi_remember_state RESTORE_ALL call_pal PAL_rti ret_to_kernel: + .cfi_restore_state lda $16, 7 call_pal PAL_swpipl br restore_all @@ -356,7 +524,6 @@ $ret_success: stq $0, 0($sp) stq $31, 72($sp) /* a3=0 => no error */ br ret_from_sys_call -.end entSys /* * Do all cleanup when returning from all interrupts and system calls. @@ -370,7 +537,7 @@ $ret_success: */ .align 4 - .ent work_pending + .type work_pending, @function work_pending: and $17, _TIF_NOTIFY_RESUME | _TIF_SIGPENDING, $2 bne $2, $work_notifysig @@ -387,23 +554,22 @@ $work_resched: $work_notifysig: mov $sp, $16 - bsr $1, do_switch_stack + DO_SWITCH_STACK jsr $26, do_work_pending - bsr $1, undo_switch_stack + UNDO_SWITCH_STACK br restore_all -.end work_pending /* * PTRACE syscall handler */ .align 4 - .ent strace + .type strace, @function strace: /* set up signal stack, call syscall_trace */ - bsr $1, do_switch_stack + DO_SWITCH_STACK jsr $26, syscall_trace_enter /* returns the syscall number */ - bsr $1, undo_switch_stack + UNDO_SWITCH_STACK /* get the arguments back.. */ ldq $16, SP_OFF+24($sp) @@ -431,9 +597,9 @@ ret_from_straced: $strace_success: stq $0, 0($sp) /* save return value */ - bsr $1, do_switch_stack + DO_SWITCH_STACK jsr $26, syscall_trace_leave - bsr $1, undo_switch_stack + UNDO_SWITCH_STACK br $31, ret_from_sys_call .align 3 @@ -447,26 +613,31 @@ $strace_error: stq $0, 0($sp) stq $1, 72($sp) /* a3 for return */ - bsr $1, do_switch_stack + DO_SWITCH_STACK mov $18, $9 /* save old syscall number */ mov $19, $10 /* save old a3 */ jsr $26, syscall_trace_leave mov $9, $18 mov $10, $19 - bsr $1, undo_switch_stack + UNDO_SWITCH_STACK mov $31, $26 /* tell "ret_from_sys_call" we can restart */ br ret_from_sys_call -.end strace +CFI_END_OSF_FRAME entSys /* * Save and restore the switch stack -- aka the balance of the user context. */ .align 4 - .ent do_switch_stack + .type do_switch_stack, @function + .cfi_startproc simple + .cfi_return_column 64 + .cfi_def_cfa $sp, 0 + .cfi_register 64, $1 do_switch_stack: lda $sp, -SWITCH_STACK_SIZE($sp) + .cfi_adjust_cfa_offset SWITCH_STACK_SIZE stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp) @@ -510,10 +681,14 @@ do_switch_stack: stt $f0, 312($sp) # save fpcr in slot of $f31 ldt $f0, 64($sp) # dont let "do_switch_stack" change fp state. ret $31, ($1), 1 -.end do_switch_stack + .cfi_endproc + .size do_switch_stack, .-do_switch_stack .align 4 - .ent undo_switch_stack + .type undo_switch_stack, @function + .cfi_startproc simple + .cfi_def_cfa $sp, 0 + .cfi_register 64, $1 undo_switch_stack: ldq $9, 0($sp) ldq $10, 8($sp) @@ -558,7 +733,8 @@ undo_switch_stack: ldt $f30, 304($sp) lda $sp, SWITCH_STACK_SIZE($sp) ret $31, ($1), 1 -.end undo_switch_stack + .cfi_endproc + .size undo_switch_stack, .-undo_switch_stack /* * The meat of the context switch code. @@ -566,17 +742,18 @@ undo_switch_stack: .align 4 .globl alpha_switch_to - .ent alpha_switch_to + .type alpha_switch_to, @function + .cfi_startproc alpha_switch_to: - .prologue 0 - bsr $1, do_switch_stack + DO_SWITCH_STACK call_pal PAL_swpctx lda $8, 0x3fff - bsr $1, undo_switch_stack + UNDO_SWITCH_STACK bic $sp, $8, $8 mov $17, $0 ret -.end alpha_switch_to + .cfi_endproc + .size alpha_switch_to, .-alpha_switch_to /* * New processes begin life here. From e40600997249844933293859c2effa8b7468c97a Mon Sep 17 00:00:00 2001 From: Richard Henderson <rth@twiddle.net> Date: Sat, 13 Jul 2013 16:21:05 -0700 Subject: [PATCH 262/913] alpha: Fix type compatibility warning for marvel_map_irq Acked-by: Phil Carmody <pc+lkml@asdf.org> Reviewed-and-Tested-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net> --- arch/alpha/kernel/sys_marvel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c index 407accc80877..c92e389ff219 100644 --- a/arch/alpha/kernel/sys_marvel.c +++ b/arch/alpha/kernel/sys_marvel.c @@ -317,8 +317,9 @@ marvel_init_irq(void) } static int -marvel_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +marvel_map_irq(const struct pci_dev *cdev, u8 slot, u8 pin) { + struct pci_dev *dev = (struct pci_dev *)cdev; struct pci_controller *hose = dev->sysdata; struct io7_port *io7_port = hose->sysdata; struct io7 *io7 = io7_port->io7; From 91531b0535e5556783a7da900cc115b5fec8e63f Mon Sep 17 00:00:00 2001 From: Richard Henderson <rth@twiddle.net> Date: Thu, 18 Jul 2013 14:47:37 -0700 Subject: [PATCH 263/913] alpha: Use __builtin_alpha_rpcc As introduced in gcc 3.2. Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net> --- arch/alpha/kernel/time.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c index e336694ca042..ea3395036556 100644 --- a/arch/alpha/kernel/time.c +++ b/arch/alpha/kernel/time.c @@ -105,9 +105,7 @@ void arch_irq_work_raise(void) static inline __u32 rpcc(void) { - __u32 result; - asm volatile ("rpcc %0" : "=r"(result)); - return result; + return __builtin_alpha_rpcc(); } int update_persistent_clock(struct timespec now) From 984ac6c0c7ad612d3e7d045243805de0a2702142 Mon Sep 17 00:00:00 2001 From: Richard Henderson <rth@twiddle.net> Date: Thu, 28 Apr 2011 09:22:39 -0700 Subject: [PATCH 264/913] alpha: Don't if-out dp264_device_interrupt. The code as written is correct, and will be used by QEMU emulation. Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net> --- arch/alpha/kernel/sys_dp264.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c index 5bf401f7ea97..6c35159bc00e 100644 --- a/arch/alpha/kernel/sys_dp264.c +++ b/arch/alpha/kernel/sys_dp264.c @@ -190,9 +190,6 @@ static struct irq_chip clipper_irq_type = { static void dp264_device_interrupt(unsigned long vector) { -#if 1 - printk("dp264_device_interrupt: NOT IMPLEMENTED YET!!\n"); -#else unsigned long pld; unsigned int i; @@ -210,12 +207,7 @@ dp264_device_interrupt(unsigned long vector) isa_device_interrupt(vector); else handle_irq(16 + i); -#if 0 - TSUNAMI_cchip->dir0.csr = 1UL << i; mb(); - tmp = TSUNAMI_cchip->dir0.csr; -#endif } -#endif } static void From 46931bf67c188d026879e943fa0426704991bed9 Mon Sep 17 00:00:00 2001 From: Richard Henderson <rth@twiddle.net> Date: Thu, 21 Apr 2011 16:01:02 -0700 Subject: [PATCH 265/913] alpha: Force the user-visible HZ to a constant 1024. This kernel/user split was done long ago for other architectures. Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net> --- arch/alpha/include/asm/param.h | 8 +++++--- arch/alpha/include/uapi/asm/param.h | 7 ------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/alpha/include/asm/param.h b/arch/alpha/include/asm/param.h index bf46af51941b..a5b68b268bcf 100644 --- a/arch/alpha/include/asm/param.h +++ b/arch/alpha/include/asm/param.h @@ -3,7 +3,9 @@ #include <uapi/asm/param.h> -#define HZ CONFIG_HZ -#define USER_HZ HZ -# define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ +# undef HZ +# define HZ CONFIG_HZ +# define USER_HZ 1024 +# define CLOCKS_PER_SEC USER_HZ /* frequency at which times() counts */ + #endif /* _ASM_ALPHA_PARAM_H */ diff --git a/arch/alpha/include/uapi/asm/param.h b/arch/alpha/include/uapi/asm/param.h index 29daed819ebd..dbcd9834af6d 100644 --- a/arch/alpha/include/uapi/asm/param.h +++ b/arch/alpha/include/uapi/asm/param.h @@ -1,13 +1,7 @@ #ifndef _UAPI_ASM_ALPHA_PARAM_H #define _UAPI_ASM_ALPHA_PARAM_H -/* ??? Gross. I don't want to parameterize this, and supposedly the - hardware ignores reprogramming. We also need userland buy-in to the - change in HZ, since this is visible in the wait4 resources etc. */ - -#ifndef __KERNEL__ #define HZ 1024 -#endif #define EXEC_PAGESIZE 8192 @@ -17,5 +11,4 @@ #define MAXHOSTNAMELEN 64 /* max length of hostname */ - #endif /* _UAPI_ASM_ALPHA_PARAM_H */ From dff64649e757870e9351e7d85917ae681d20ee54 Mon Sep 17 00:00:00 2001 From: Richard Henderson <rth@twiddle.net> Date: Fri, 19 Jul 2013 12:43:07 -0700 Subject: [PATCH 266/913] alpha: Use handle_percpu_irq for the timer interrupt Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Richard Henderson <rth@twiddle.net> --- arch/alpha/kernel/irq_alpha.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c index f433fc11877a..28e4429596f3 100644 --- a/arch/alpha/kernel/irq_alpha.c +++ b/arch/alpha/kernel/irq_alpha.c @@ -236,7 +236,7 @@ void __init init_rtc_irq(void) { irq_set_chip_and_handler_name(RTC_IRQ, &dummy_irq_chip, - handle_simple_irq, "RTC"); + handle_percpu_irq, "RTC"); setup_irq(RTC_IRQ, &timer_irqaction); } From ba57ea64cb1820deb37637de0fdb107f0dc90089 Mon Sep 17 00:00:00 2001 From: Al Viro <viro@zeniv.linux.org.uk> Date: Sat, 20 Jul 2013 03:11:32 +0400 Subject: [PATCH 267/913] allow O_TMPFILE to work with O_WRONLY Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> --- fs/open.c | 2 ++ include/uapi/asm-generic/fcntl.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/open.c b/fs/open.c index 9156cb050d08..d53e29895082 100644 --- a/fs/open.c +++ b/fs/open.c @@ -844,6 +844,8 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o if ((flags & O_TMPFILE_MASK) != O_TMPFILE) return -EINVAL; acc_mode = MAY_OPEN | ACC_MODE(flags); + if (!(acc_mode & MAY_WRITE)) + return -EINVAL; } else if (flags & O_PATH) { /* * If we have O_PATH in the open flag. Then we diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h index 05ac354e124d..95e46c8e05f9 100644 --- a/include/uapi/asm-generic/fcntl.h +++ b/include/uapi/asm-generic/fcntl.h @@ -89,8 +89,8 @@ #endif /* a horrid kludge trying to make sure that this will fail on old kernels */ -#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY | O_RDWR) -#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT | O_ACCMODE) +#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) +#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT) #ifndef O_NDELAY #define O_NDELAY O_NONBLOCK From 372675a4a9ac0a0af962d44dadeea69926ce45e0 Mon Sep 17 00:00:00 2001 From: stephen hemminger <stephen@networkplumber.org> Date: Thu, 18 Jul 2013 08:38:26 -0700 Subject: [PATCH 268/913] vxlan: unregister on namespace exit Fix memory leaks and other badness from VXLAN network namespace teardown. When network namespace is removed, all the vxlan devices should be unregistered (not closed). Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/vxlan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index a5ba8dd7e6be..f101034a297a 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -1878,10 +1878,12 @@ static __net_exit void vxlan_exit_net(struct net *net) { struct vxlan_net *vn = net_generic(net, vxlan_net_id); struct vxlan_dev *vxlan; + LIST_HEAD(list); rtnl_lock(); list_for_each_entry(vxlan, &vn->vxlan_list, next) - dev_close(vxlan->dev); + unregister_netdevice_queue(vxlan->dev, &list); + unregister_netdevice_many(&list); rtnl_unlock(); } From 3fc2de2faba387218bdf9dbc6b13f513ac3b060a Mon Sep 17 00:00:00 2001 From: stephen hemminger <stephen@networkplumber.org> Date: Thu, 18 Jul 2013 08:40:15 -0700 Subject: [PATCH 269/913] vxlan: fix igmp races There are two race conditions in existing code for doing IGMP management in workqueue in vxlan. First, the vxlan_group_used function checks the list of vxlan's without any protection, and it is possible for open followed by close to occur before the igmp work queue runs. To solve these move the check into vxlan_open/stop so it is protected by RTNL. And split into two work structures so that there is no racy reference to underlying device state. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/vxlan.c | 53 ++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index f101034a297a..f4c6db419ddb 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -136,7 +136,8 @@ struct vxlan_dev { u32 flags; /* VXLAN_F_* below */ struct work_struct sock_work; - struct work_struct igmp_work; + struct work_struct igmp_join; + struct work_struct igmp_leave; unsigned long age_interval; struct timer_list age_timer; @@ -736,7 +737,6 @@ static bool vxlan_snoop(struct net_device *dev, return false; } - /* See if multicast group is already in use by other ID */ static bool vxlan_group_used(struct vxlan_net *vn, __be32 remote_ip) { @@ -770,12 +770,13 @@ static void vxlan_sock_release(struct vxlan_net *vn, struct vxlan_sock *vs) queue_work(vxlan_wq, &vs->del_work); } -/* Callback to update multicast group membership. - * Scheduled when vxlan goes up/down. +/* Callback to update multicast group membership when first VNI on + * multicast asddress is brought up + * Done as workqueue because ip_mc_join_group acquires RTNL. */ -static void vxlan_igmp_work(struct work_struct *work) +static void vxlan_igmp_join(struct work_struct *work) { - struct vxlan_dev *vxlan = container_of(work, struct vxlan_dev, igmp_work); + struct vxlan_dev *vxlan = container_of(work, struct vxlan_dev, igmp_join); struct vxlan_net *vn = net_generic(dev_net(vxlan->dev), vxlan_net_id); struct vxlan_sock *vs = vxlan->vn_sock; struct sock *sk = vs->sock->sk; @@ -785,10 +786,27 @@ static void vxlan_igmp_work(struct work_struct *work) }; lock_sock(sk); - if (vxlan_group_used(vn, vxlan->default_dst.remote_ip)) - ip_mc_join_group(sk, &mreq); - else - ip_mc_leave_group(sk, &mreq); + ip_mc_join_group(sk, &mreq); + release_sock(sk); + + vxlan_sock_release(vn, vs); + dev_put(vxlan->dev); +} + +/* Inverse of vxlan_igmp_join when last VNI is brought down */ +static void vxlan_igmp_leave(struct work_struct *work) +{ + struct vxlan_dev *vxlan = container_of(work, struct vxlan_dev, igmp_leave); + struct vxlan_net *vn = net_generic(dev_net(vxlan->dev), vxlan_net_id); + struct vxlan_sock *vs = vxlan->vn_sock; + struct sock *sk = vs->sock->sk; + struct ip_mreqn mreq = { + .imr_multiaddr.s_addr = vxlan->default_dst.remote_ip, + .imr_ifindex = vxlan->default_dst.remote_ifindex, + }; + + lock_sock(sk); + ip_mc_leave_group(sk, &mreq); release_sock(sk); vxlan_sock_release(vn, vs); @@ -1359,6 +1377,7 @@ static void vxlan_uninit(struct net_device *dev) /* Start ageing timer and join group when device is brought up */ static int vxlan_open(struct net_device *dev) { + struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); struct vxlan_dev *vxlan = netdev_priv(dev); struct vxlan_sock *vs = vxlan->vn_sock; @@ -1366,10 +1385,11 @@ static int vxlan_open(struct net_device *dev) if (!vs) return -ENOTCONN; - if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip))) { + if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) && + ! vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { vxlan_sock_hold(vs); dev_hold(dev); - queue_work(vxlan_wq, &vxlan->igmp_work); + queue_work(vxlan_wq, &vxlan->igmp_join); } if (vxlan->age_interval) @@ -1400,13 +1420,15 @@ static void vxlan_flush(struct vxlan_dev *vxlan) /* Cleanup timer and forwarding table on shutdown */ static int vxlan_stop(struct net_device *dev) { + struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); struct vxlan_dev *vxlan = netdev_priv(dev); struct vxlan_sock *vs = vxlan->vn_sock; - if (vs && IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip))) { + if (vs && IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) && + ! vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { vxlan_sock_hold(vs); dev_hold(dev); - queue_work(vxlan_wq, &vxlan->igmp_work); + queue_work(vxlan_wq, &vxlan->igmp_leave); } del_timer_sync(&vxlan->age_timer); @@ -1471,7 +1493,8 @@ static void vxlan_setup(struct net_device *dev) INIT_LIST_HEAD(&vxlan->next); spin_lock_init(&vxlan->hash_lock); - INIT_WORK(&vxlan->igmp_work, vxlan_igmp_work); + INIT_WORK(&vxlan->igmp_join, vxlan_igmp_join); + INIT_WORK(&vxlan->igmp_leave, vxlan_igmp_leave); INIT_WORK(&vxlan->sock_work, vxlan_sock_work); init_timer_deferrable(&vxlan->age_timer); From 2deb535af7c824f37d6bc8657fd09e3d10696ee8 Mon Sep 17 00:00:00 2001 From: Shahed Shaikh <shahed.shaikh@qlogic.com> Date: Fri, 19 Jul 2013 16:56:26 -0400 Subject: [PATCH 270/913] qlcnic: Fix invalid register offset calculation 83xx adapter specific code was accessing 82xx register which resulted in invalid register offset. This patch uses proper register access method. Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com> Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 700a46324d09..05a847e599c6 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c @@ -1540,7 +1540,7 @@ qlcnic_set_dump(struct net_device *netdev, struct ethtool_dump *val) return 0; case QLCNIC_SET_QUIESCENT: case QLCNIC_RESET_QUIESCENT: - state = QLCRD32(adapter, QLCNIC_CRB_DEV_STATE); + state = QLC_SHARED_REG_RD32(adapter, QLCNIC_CRB_DEV_STATE); if (state == QLCNIC_DEV_FAILED || (state == QLCNIC_DEV_BADBAD)) netdev_info(netdev, "Device in FAILED state\n"); return 0; From cfacb172fa699263a4f74a63d886e171fe3eafbe Mon Sep 17 00:00:00 2001 From: Pratik Pujar <pratik.pujar@qlogic.com> Date: Fri, 19 Jul 2013 16:56:27 -0400 Subject: [PATCH 271/913] qlcnic: Set __QLCNIC_DEV_UP in adapter state before enabling interrupts NAPI poll function does not re-enable the interrupt, if __QLCNIC_DEV_UP is not set in adapter state. This was preventing driver from receiving any packet. Signed-off-by: Pratik Pujar <pratik.pujar@qlogic.com> Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 4528f8ec333b..41635f2b9399 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -1531,12 +1531,12 @@ int __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev) if (netdev->features & NETIF_F_LRO) qlcnic_config_hw_lro(adapter, QLCNIC_LRO_ENABLED); + set_bit(__QLCNIC_DEV_UP, &adapter->state); qlcnic_napi_enable(adapter); qlcnic_linkevent_request(adapter, 1); adapter->ahw->reset_context = 0; - set_bit(__QLCNIC_DEV_UP, &adapter->state); return 0; } From e9a355a9b407da41b7cb22767f3898d4628411b2 Mon Sep 17 00:00:00 2001 From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Date: Fri, 19 Jul 2013 16:56:28 -0400 Subject: [PATCH 272/913] qlcnic: Fix NULL pointer dereference in VF probe path. o Check for non-NULL set_mac_filter_count function pointer before calling it fixes the panic. This patch fixes regression introduced by patch "qlcnic: Secondary unicast MAC address support." with commit id 168e4fb54c11865668ad50eff81b5f2729e0e0f4. Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index b00cf5665eab..f4bb8f5d7453 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h @@ -1869,7 +1869,8 @@ static inline void qlcnic_free_mac_list(struct qlcnic_adapter *adapter) static inline void qlcnic_set_mac_filter_count(struct qlcnic_adapter *adapter) { - adapter->ahw->hw_ops->set_mac_filter_count(adapter); + if (adapter->ahw->hw_ops->set_mac_filter_count) + adapter->ahw->hw_ops->set_mac_filter_count(adapter); } static inline void qlcnic_dev_request_reset(struct qlcnic_adapter *adapter, From 8dc394af2e6159d3799b1219625db47c42a1964f Mon Sep 17 00:00:00 2001 From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Date: Fri, 19 Jul 2013 16:56:29 -0400 Subject: [PATCH 273/913] qlcnic: Fix multicast packet handling for PF and VF. o Multicast MAC was not getting programmed due to which multicast packets were being dropped by FW. This patch fixes commit 168e4fb54c11865668ad50eff81b5f2729e0e0f4 ("qlcnic: Secondary unicast MAC address support.") which introduced bug in handling multicast packets. Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- .../net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index 5b5d2edf125d..4ed7e73d88d3 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c @@ -516,20 +516,18 @@ void __qlcnic_set_multi(struct net_device *netdev, u16 vlan) if (netdev->flags & IFF_PROMISC) { if (!(adapter->flags & QLCNIC_PROMISC_DISABLED)) mode = VPORT_MISS_MODE_ACCEPT_ALL; - } else if (netdev->flags & IFF_ALLMULTI) { - if (netdev_mc_count(netdev) > ahw->max_mc_count) { - mode = VPORT_MISS_MODE_ACCEPT_MULTI; - } else if (!netdev_mc_empty(netdev) && - !qlcnic_sriov_vf_check(adapter)) { - netdev_for_each_mc_addr(ha, netdev) - qlcnic_nic_add_mac(adapter, ha->addr, - vlan); - } - if (mode != VPORT_MISS_MODE_ACCEPT_MULTI && - qlcnic_sriov_vf_check(adapter)) - qlcnic_vf_add_mc_list(netdev, vlan); + } else if ((netdev->flags & IFF_ALLMULTI) || + (netdev_mc_count(netdev) > ahw->max_mc_count)) { + mode = VPORT_MISS_MODE_ACCEPT_MULTI; + } else if (!netdev_mc_empty(netdev) && + !qlcnic_sriov_vf_check(adapter)) { + netdev_for_each_mc_addr(ha, netdev) + qlcnic_nic_add_mac(adapter, ha->addr, vlan); } + if (qlcnic_sriov_vf_check(adapter)) + qlcnic_vf_add_mc_list(netdev, vlan); + /* configure unicast MAC address, if there is not sufficient space * to store all the unicast addresses then enable promiscuous mode */ From cab150b5874babb0a3d558c10d28c936fdf6ac69 Mon Sep 17 00:00:00 2001 From: Manish Chopra <manish.chopra@qlogic.com> Date: Fri, 19 Jul 2013 16:56:30 -0400 Subject: [PATCH 274/913] qlcnic: Fix panic while setting VF's MAC address o "qlcnic_sriov" structure pointer should be accessed only when SR-IOV is enabled. Access this pointer after SR-IOV PF check. Signed-off-by: Manish Chopra <manish.chopra@qlogic.com> Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index ee0c1d307966..b9b88f3a7b51 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c @@ -1621,13 +1621,15 @@ int qlcnic_sriov_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) { struct qlcnic_adapter *adapter = netdev_priv(netdev); struct qlcnic_sriov *sriov = adapter->ahw->sriov; - int i, num_vfs = sriov->num_vfs; + int i, num_vfs; struct qlcnic_vf_info *vf_info; u8 *curr_mac; if (!qlcnic_sriov_pf_check(adapter)) return -EOPNOTSUPP; + num_vfs = sriov->num_vfs; + if (!is_valid_ether_addr(mac) || vf >= num_vfs) return -EINVAL; From 15d79747b57159fc1e063f1404e4f379cb5be026 Mon Sep 17 00:00:00 2001 From: Himanshu Madhani <himanshu.madhani@qlogic.com> Date: Fri, 19 Jul 2013 16:56:31 -0400 Subject: [PATCH 275/913] qlcnic: Fix ethtool display for 83xx adapter. o Commit b938662d88264c1a92611ca1b82fdff5a4e87121 ("qlcnic: Fix ethtool supported port status for 83xx") introduced regression for display of link status for 83xx adapter while refactoring port status display. This patch is to fix the link status display for 83xx adapter. Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index 0913c623a67e..bc483e1881a3 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c @@ -3014,8 +3014,8 @@ int qlcnic_83xx_get_settings(struct qlcnic_adapter *adapter, } if (ahw->port_type == QLCNIC_XGBE) { - ecmd->supported = SUPPORTED_1000baseT_Full; - ecmd->advertising = ADVERTISED_1000baseT_Full; + ecmd->supported = SUPPORTED_10000baseT_Full; + ecmd->advertising = ADVERTISED_10000baseT_Full; } else { ecmd->supported = (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | From 744b66dde0dcdf3a0c31e1f6540d1f59d779ddd0 Mon Sep 17 00:00:00 2001 From: Shahed Shaikh <shahed.shaikh@qlogic.com> Date: Fri, 19 Jul 2013 16:56:32 -0400 Subject: [PATCH 276/913] qlcnic: Fix dump template version mask Driver was using wrong mask for template version. Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com> Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c index ab8a6744d402..79e54efe07b9 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c @@ -1084,7 +1084,7 @@ flash_temp: tmpl_hdr = ahw->fw_dump.tmpl_hdr; tmpl_hdr->drv_cap_mask = QLCNIC_DUMP_MASK_DEF; - if ((tmpl_hdr->version & 0xffffff) >= 0x20001) + if ((tmpl_hdr->version & 0xfffff) >= 0x20001) ahw->fw_dump.use_pex_dma = true; else ahw->fw_dump.use_pex_dma = false; From b662eca098184184a4d9df09835c3740401fb6a0 Mon Sep 17 00:00:00 2001 From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> Date: Fri, 19 Jul 2013 16:56:33 -0400 Subject: [PATCH 277/913] qlcnic: Fix releasing of Tx frag which was never mapped. o Driver was freeing Tx frag which was never mapped before which result into panic as kernel was unable to handle paging request. BUG: unable to handle kernel paging request at ffffc9002552a000 IP: [<ffffffffa05ed762>] qlcnic_release_tx_buffers+0x72/0x170 [qlcnic] PGD 87fc15067 PUD 47febf067 PMD 4758c5067 PTE 0 Oops: 0000 [#1] SMP crash> bt PID: 27343 TASK: ffff8802a5de8080 CPU: 27 COMMAND: "ifconfig" [ffff8802a34b3850] machine_kexec at ffffffff81035b7b [ffff8802a34b38b0] crash_kexec at ffffffff810c0db2 [ffff8802a34b3980] oops_end at ffffffff815111d0 [ffff8802a34b39b0] no_context at ffffffff81046bfb [ffff8802a34b3a00] __bad_area_nosemaphore at ffffffff81046e85 [ffff8802a34b3a50] bad_area_nosemaphore at ffffffff81046f53 [ffff8802a34b3a60] __do_page_fault at ffffffff810476b1 [ffff8802a34b3b80] do_page_fault at ffffffff8151311e [ffff8802a34b3bb0] page_fault at ffffffff815104d5 [exception RIP: qlcnic_release_tx_buffers+114] RIP: ffffffffa05ed762 RSP: ffff8802a34b3c68 RFLAGS: 00010246 RAX: ffff88087989c000 RBX: ffffc90025529ff8 RCX: 0000000000000001 RDX: 0000000000000013 RSI: 0000000000000013 RDI: 0000000000000000 RBP: ffff8802a34b3ca8 R8: 0000000000000000 R9: 0000000000000000 R10: 000000000000000c R11: 0000000000000000 R12: 0000000000000012 R13: ffffc90025529ec0 R14: ffff880761e876e0 R15: 00000000000003ff ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 [ffff8802a34b3cb0] __qlcnic_down at ffffffffa05e8b15 [qlcnic] [ffff8802a34b3d00] qlcnic_close at ffffffffa05e8b78 [qlcnic] [ffff8802a34b3d10] dev_close at ffffffff81449d81 [ffff8802a34b3d30] dev_change_flags at ffffffff814495c1 Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c index d28336fc65ab..a2023090e866 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c @@ -142,7 +142,7 @@ void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter) buffrag->length, PCI_DMA_TODEVICE); buffrag->dma = 0ULL; } - for (j = 0; j < cmd_buf->frag_count; j++) { + for (j = 1; j < cmd_buf->frag_count; j++) { buffrag++; if (buffrag->dma) { pci_unmap_page(adapter->pdev, buffrag->dma, From 2f0a9afaefcedfdb803e1347b0fe429cbd84d525 Mon Sep 17 00:00:00 2001 From: Manish Chopra <manish.chopra@qlogic.com> Date: Fri, 19 Jul 2013 16:56:34 -0400 Subject: [PATCH 278/913] qlcnic: Fix guest VLAN o Clear cached vport vlan variable(vp->vlan) in PF on PCI FLR and back-channel termination which will allow to configure guest VLAN on VF after force off/shut down the guest VM. Signed-off-by: Manish Chopra <manish.chopra@qlogic.com> Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index b9b88f3a7b51..46aeb593fd52 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c @@ -635,10 +635,12 @@ static int qlcnic_sriov_pf_channel_cfg_cmd(struct qlcnic_bc_trans *trans, struct qlcnic_cmd_args *cmd) { struct qlcnic_vf_info *vf = trans->vf; - struct qlcnic_adapter *adapter = vf->adapter; - int err; + struct qlcnic_vport *vp = vf->vp; + struct qlcnic_adapter *adapter; u16 func = vf->pci_func; + int err; + adapter = vf->adapter; cmd->rsp.arg[0] = trans->req_hdr->cmd_op; cmd->rsp.arg[0] |= (1 << 16); @@ -650,6 +652,8 @@ static int qlcnic_sriov_pf_channel_cfg_cmd(struct qlcnic_bc_trans *trans, qlcnic_sriov_pf_config_vport(adapter, 0, func); } } else { + if (vp->vlan_mode == QLC_GUEST_VLAN_MODE) + vp->vlan = 0; err = qlcnic_sriov_pf_config_vport(adapter, 0, func); } @@ -1561,6 +1565,7 @@ void qlcnic_sriov_pf_handle_flr(struct qlcnic_sriov *sriov, struct qlcnic_vf_info *vf) { struct net_device *dev = vf->adapter->netdev; + struct qlcnic_vport *vp = vf->vp; if (!test_and_clear_bit(QLC_BC_VF_STATE, &vf->state)) { clear_bit(QLC_BC_VF_FLR, &vf->state); @@ -1573,6 +1578,9 @@ void qlcnic_sriov_pf_handle_flr(struct qlcnic_sriov *sriov, return; } + if (vp->vlan_mode == QLC_GUEST_VLAN_MODE) + vp->vlan = 0; + qlcnic_sriov_schedule_flr(sriov, vf, qlcnic_sriov_pf_process_flr); netdev_info(dev, "FLR received for PCI func %d\n", vf->pci_func); } From b69bbddfa136dc53ac319d58bc38b41f8aefffea Mon Sep 17 00:00:00 2001 From: Flavio Leitner <fbl@redhat.com> Date: Thu, 18 Jul 2013 16:15:11 -0300 Subject: [PATCH 279/913] veth: add vlan features The veth device doesn't provide the vlan features, so TSO for example is disabled and that causes performance issues when using tagged traffic. The test topology looks like this: br0 br1 / \ / \ vnet veth0.10 ----- veth1.10 vnet VM VM The netperf results with current veth driver: MIGRATED TCP STREAM TEST from 192.168.1.1 () port 0 AF_INET to 192.168.1.2 () port 0 AF_INET Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 87380 16384 16384 10.01 2210.22 Now after applying the proposed patch: MIGRATED TCP STREAM TEST from 192.168.1.1 () port 0 AF_INET to 192.168.1.2 () port 0 AF_INET Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 87380 16384 16384 10.00 13067.47 Signed-off-by: Flavio Leitner <fbl@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/veth.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index da866523cf20..eee1f19ef1e9 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -269,6 +269,7 @@ static void veth_setup(struct net_device *dev) dev->ethtool_ops = &veth_ethtool_ops; dev->features |= NETIF_F_LLTX; dev->features |= VETH_FEATURES; + dev->vlan_features = dev->features; dev->destructor = veth_dev_free; dev->hw_features = VETH_FEATURES; From 087d273caf4f7d3f2159256f255f1f432bc84a5b Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Fri, 19 Jul 2013 08:48:05 +0300 Subject: [PATCH 280/913] arcnet: cleanup sizeof parameter This patch doesn't change the compiled code because ARC_HDR_SIZE is 4 and sizeof(int) is 4, but the intent was to use the header size and not the sizeof the header size. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/arcnet/arcnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index a746ba272f04..a956053608f9 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -1007,7 +1007,7 @@ static void arcnet_rx(struct net_device *dev, int bufnum) soft = &pkt.soft.rfc1201; - lp->hw.copy_from_card(dev, bufnum, 0, &pkt, sizeof(ARC_HDR_SIZE)); + lp->hw.copy_from_card(dev, bufnum, 0, &pkt, ARC_HDR_SIZE); if (pkt.hard.offset[0]) { ofs = pkt.hard.offset[0]; length = 256 - ofs; From 651e92716aaae60fc41b9652f54cb6803896e0da Mon Sep 17 00:00:00 2001 From: Michal Tesar <mtesar@redhat.com> Date: Fri, 19 Jul 2013 14:09:01 +0200 Subject: [PATCH 281/913] sysctl net: Keep tcp_syn_retries inside the boundary Limit the min/max value passed to the /proc/sys/net/ipv4/tcp_syn_retries. Signed-off-by: Michal Tesar <mtesar@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/ipv4/sysctl_net_ipv4.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index b2c123c44d69..610e324348d1 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -36,6 +36,8 @@ static int tcp_adv_win_scale_min = -31; static int tcp_adv_win_scale_max = 31; static int ip_ttl_min = 1; static int ip_ttl_max = 255; +static int tcp_syn_retries_min = 1; +static int tcp_syn_retries_max = MAX_TCP_SYNCNT; static int ip_ping_group_range_min[] = { 0, 0 }; static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; @@ -332,7 +334,9 @@ static struct ctl_table ipv4_table[] = { .data = &sysctl_tcp_syn_retries, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec + .proc_handler = proc_dointvec_minmax, + .extra1 = &tcp_syn_retries_min, + .extra2 = &tcp_syn_retries_max }, { .procname = "tcp_synack_retries", From acfec9a5a892f98461f52ed5770de99a3e571ae2 Mon Sep 17 00:00:00 2001 From: Al Viro <viro@zeniv.linux.org.uk> Date: Sat, 20 Jul 2013 03:13:55 +0400 Subject: [PATCH 282/913] livelock avoidance in sget() Eric Sandeen has found a nasty livelock in sget() - take a mount(2) about to fail. The superblock is on ->fs_supers, ->s_umount is held exclusive, ->s_active is 1. Along comes two more processes, trying to mount the same thing; sget() in each is picking that superblock, bumping ->s_count and trying to grab ->s_umount. ->s_active is 3 now. Original mount(2) finally gets to deactivate_locked_super() on failure; ->s_active is 2, superblock is still ->fs_supers because shutdown will *not* happen until ->s_active hits 0. ->s_umount is dropped and now we have two processes chasing each other: s_active = 2, A acquired ->s_umount, B blocked A sees that the damn thing is stillborn, does deactivate_locked_super() s_active = 1, A drops ->s_umount, B gets it A restarts the search and finds the same superblock. And bumps it ->s_active. s_active = 2, B holds ->s_umount, A blocked on trying to get it ... and we are in the earlier situation with A and B switched places. The root cause, of course, is that ->s_active should not grow until we'd got MS_BORN. Then failing ->mount() will have deactivate_locked_super() shut the damn thing down. Fortunately, it's easy to do - the key point is that grab_super() is called only for superblocks currently on ->fs_supers, so it can bump ->s_count and grab ->s_umount first, then check MS_BORN and bump ->s_active; we must never increment ->s_count for superblocks past ->kill_sb(), but grab_super() is never called for those. The bug is pretty old; we would've caught it by now, if not for accidental exclusion between sget() for block filesystems; the things like cgroup or e.g. mtd-based filesystems don't have anything of that sort, so they get bitten. The right way to deal with that is obviously to fix sget()... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> --- fs/super.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/fs/super.c b/fs/super.c index 7465d4364208..68307c029228 100644 --- a/fs/super.c +++ b/fs/super.c @@ -336,19 +336,19 @@ EXPORT_SYMBOL(deactivate_super); * and want to turn it into a full-blown active reference. grab_super() * is called with sb_lock held and drops it. Returns 1 in case of * success, 0 if we had failed (superblock contents was already dead or - * dying when grab_super() had been called). + * dying when grab_super() had been called). Note that this is only + * called for superblocks not in rundown mode (== ones still on ->fs_supers + * of their type), so increment of ->s_count is OK here. */ static int grab_super(struct super_block *s) __releases(sb_lock) { - if (atomic_inc_not_zero(&s->s_active)) { - spin_unlock(&sb_lock); - return 1; - } - /* it's going away */ s->s_count++; spin_unlock(&sb_lock); - /* wait for it to die */ down_write(&s->s_umount); + if ((s->s_flags & MS_BORN) && atomic_inc_not_zero(&s->s_active)) { + put_super(s); + return 1; + } up_write(&s->s_umount); put_super(s); return 0; @@ -463,11 +463,6 @@ retry: destroy_super(s); s = NULL; } - down_write(&old->s_umount); - if (unlikely(!(old->s_flags & MS_BORN))) { - deactivate_locked_super(old); - goto retry; - } return old; } } @@ -660,10 +655,10 @@ restart: if (hlist_unhashed(&sb->s_instances)) continue; if (sb->s_bdev == bdev) { - if (grab_super(sb)) /* drops sb_lock */ - return sb; - else + if (!grab_super(sb)) goto restart; + up_write(&sb->s_umount); + return sb; } } spin_unlock(&sb_lock); From 24924a20dab603089011f9d3eb7622f0f6ef93c0 Mon Sep 17 00:00:00 2001 From: Peng Tao <bergwolf@gmail.com> Date: Thu, 18 Jul 2013 22:09:08 +0800 Subject: [PATCH 283/913] vfs: constify dentry parameter in d_count() so that it can be used in places like d_compare/d_hash without causing a compiler warning. Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> --- include/linux/dcache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 3092df3614ae..b90337c9d468 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -324,7 +324,7 @@ static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq) return ret; } -static inline unsigned d_count(struct dentry *dentry) +static inline unsigned d_count(const struct dentry *dentry) { return dentry->d_count; } From 1faabf2aab1fdaa1ace4e8c829d1b9cf7bfec2f1 Mon Sep 17 00:00:00 2001 From: Eric Dumazet <edumazet@google.com> Date: Fri, 19 Jul 2013 20:07:16 -0700 Subject: [PATCH 284/913] bridge: do not call setup_timer() multiple times commit 9f00b2e7cf24 ("bridge: only expire the mdb entry when query is received") added a nasty bug as an active timer can be reinitialized. setup_timer() must be done once, no matter how many time mod_timer() is called. br_multicast_new_group() is the right place to do this. Reported-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Diagnosed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Eric Dumazet <edumazet@google.com> Tested-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Cc: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/bridge/br_multicast.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 69af490cce44..4b99c9a27044 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -619,6 +619,9 @@ rehash: mp->br = br; mp->addr = *group; + setup_timer(&mp->timer, br_multicast_group_expired, + (unsigned long)mp); + hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); mdb->size++; @@ -1126,7 +1129,6 @@ static int br_ip4_multicast_query(struct net_bridge *br, if (!mp) goto out; - setup_timer(&mp->timer, br_multicast_group_expired, (unsigned long)mp); mod_timer(&mp->timer, now + br->multicast_membership_interval); mp->timer_armed = true; @@ -1204,7 +1206,6 @@ static int br_ip6_multicast_query(struct net_bridge *br, if (!mp) goto out; - setup_timer(&mp->timer, br_multicast_group_expired, (unsigned long)mp); mod_timer(&mp->timer, now + br->multicast_membership_interval); mp->timer_armed = true; From e85843bec6c2ea7c10ec61238396891cc2b753a9 Mon Sep 17 00:00:00 2001 From: Kamal Mostafa <kamal@canonical.com> Date: Fri, 19 Jul 2013 15:02:01 -0700 Subject: [PATCH 285/913] drm/i915: quirk no PCH_PWM_ENABLE for Dell XPS13 backlight BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=47941 BugLink: https://bugs.launchpad.net/bugs/1163720 BugLink: https://bugs.launchpad.net/bugs/1162026 Some machines suffer from non-functional backlight controls if BLM_PCH_PWM_ENABLE is set, so provide a quirk to avoid doing so. Apply this quirk to Dell XPS 13 models. Tested-by: Eric Griffith <EGriffith92@gmail.com> Tested-by: Kent Baxley <kent.baxley@canonical.com> Cc: <stable@vger.kernel.org> # v3.8+ Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_display.c | 16 ++++++++++++++++ drivers/gpu/drm/i915/intel_panel.c | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index a416645bcd23..204c3eca0fb2 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -555,6 +555,7 @@ enum intel_sbi_destination { #define QUIRK_PIPEA_FORCE (1<<0) #define QUIRK_LVDS_SSC_DISABLE (1<<1) #define QUIRK_INVERT_BRIGHTNESS (1<<2) +#define QUIRK_NO_PCH_PWM_ENABLE (1<<3) struct intel_fbdev; struct intel_fbc_work; diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 76b034be2c7c..5fb305840db8 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -9400,6 +9400,17 @@ static void quirk_invert_brightness(struct drm_device *dev) DRM_INFO("applying inverted panel brightness quirk\n"); } +/* + * Some machines (Dell XPS13) suffer broken backlight controls if + * BLM_PCH_PWM_ENABLE is set. + */ +static void quirk_no_pcm_pwm_enable(struct drm_device *dev) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + dev_priv->quirks |= QUIRK_NO_PCH_PWM_ENABLE; + DRM_INFO("applying no-PCH_PWM_ENABLE quirk\n"); +} + struct intel_quirk { int device; int subsystem_vendor; @@ -9469,6 +9480,11 @@ static struct intel_quirk intel_quirks[] = { /* Acer Aspire 4736Z */ { 0x2a42, 0x1025, 0x0260, quirk_invert_brightness }, + + /* Dell XPS13 HD Sandy Bridge */ + { 0x0116, 0x1028, 0x052e, quirk_no_pcm_pwm_enable }, + /* Dell XPS13 HD and XPS13 FHD Ivy Bridge */ + { 0x0166, 0x1028, 0x058b, quirk_no_pcm_pwm_enable }, }; static void intel_init_quirks(struct drm_device *dev) diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 45010bb5d132..67e2c1f1c9a8 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -583,7 +583,8 @@ void intel_panel_enable_backlight(struct drm_device *dev, POSTING_READ(reg); I915_WRITE(reg, tmp | BLM_PWM_ENABLE); - if (HAS_PCH_SPLIT(dev)) { + if (HAS_PCH_SPLIT(dev) && + !(dev_priv->quirks & QUIRK_NO_PCH_PWM_ENABLE)) { tmp = I915_READ(BLC_PWM_PCH_CTL1); tmp |= BLM_PCH_PWM_ENABLE; tmp &= ~BLM_PCH_OVERRIDE_ENABLE; From a7cd1b8fea2f341b626b255d9898a5ca5fabbf0a Mon Sep 17 00:00:00 2001 From: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri, 19 Jul 2013 20:36:51 +0100 Subject: [PATCH 286/913] drm/i915: Serialize almost all register access In theory, the different register blocks were meant to be only ever touched when holding either the struct_mutex, mode_config.lock or even a specific localised lock. This does not seem to be the case, and the hardware reacts extremely badly if we attempt to concurrently access two registers within the same cacheline. The HSD suggests that we only need to do this workaround for display range registers. However, upon review we need to serialize the multiple stages in our register write functions - if only for preemption protection. Irrespective of the hardware requirements, the current io functions are a little too loose with respect to the combination of pre- and post-condition testing that we do in conjunction with the actual io. As a result, we may be pre-empted and generate both false-postive and false-negative errors. Note well that this is a "90%" solution, there remains a few direct users of ioread/iowrite which will be fixed up in the next few patches. Since they are more invasive and that this simple change will prevent almost all lockups on Haswell, we kept this patch simple to facilitate backporting to stable. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63914 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: stable@vger.kernel.org Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/i915_drv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index f4af1ca0fb62..6ddc5677ea2f 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -1253,21 +1253,21 @@ hsw_unclaimed_reg_check(struct drm_i915_private *dev_priv, u32 reg) #define __i915_read(x, y) \ u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ + unsigned long irqflags; \ u##x val = 0; \ + spin_lock_irqsave(&dev_priv->gt_lock, irqflags); \ if (IS_GEN5(dev_priv->dev)) \ ilk_dummy_write(dev_priv); \ if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ - unsigned long irqflags; \ - spin_lock_irqsave(&dev_priv->gt_lock, irqflags); \ if (dev_priv->forcewake_count == 0) \ dev_priv->gt.force_wake_get(dev_priv); \ val = read##y(dev_priv->regs + reg); \ if (dev_priv->forcewake_count == 0) \ dev_priv->gt.force_wake_put(dev_priv); \ - spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags); \ } else { \ val = read##y(dev_priv->regs + reg); \ } \ + spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags); \ trace_i915_reg_rw(false, reg, val, sizeof(val)); \ return val; \ } @@ -1280,8 +1280,10 @@ __i915_read(64, q) #define __i915_write(x, y) \ void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val) { \ + unsigned long irqflags; \ u32 __fifo_ret = 0; \ trace_i915_reg_rw(true, reg, val, sizeof(val)); \ + spin_lock_irqsave(&dev_priv->gt_lock, irqflags); \ if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ __fifo_ret = __gen6_gt_wait_for_fifo(dev_priv); \ } \ @@ -1293,6 +1295,7 @@ void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val) { \ gen6_gt_check_fifodbg(dev_priv); \ } \ hsw_unclaimed_reg_check(dev_priv, reg); \ + spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags); \ } __i915_write(8, b) __i915_write(16, w) From a1a8e1dc111d6f05e7164e851e58219d428359e1 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen <lars@metafoo.de> Date: Tue, 16 Jul 2013 15:28:00 +0100 Subject: [PATCH 287/913] iio:trigger: Fix use_count race condition When using more than one trigger consumer it can happen that multiple threads perform a read-modify-update cycle on 'use_count' concurrently. This can cause updates to be lost and use_count can get stuck at non-zero value, in which case the IIO core assumes that at least one thread is still running and will wait for it to finish before running any trigger handlers again. This effectively renders the trigger disabled and a reboot is necessary before it can be used again. To fix this make use_count an atomic variable. Also set it to the number of consumers before starting the first consumer, otherwise it might happen that use_count drops to 0 even though not all consumers have been run yet. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Tested-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> --- drivers/iio/industrialio-trigger.c | 34 +++++++++++++++++++----------- include/linux/iio/trigger.h | 3 ++- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index ea8a4146620d..0dd9bb873130 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -127,12 +127,17 @@ static struct iio_trigger *iio_trigger_find_by_name(const char *name, void iio_trigger_poll(struct iio_trigger *trig, s64 time) { int i; - if (!trig->use_count) - for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) - if (trig->subirqs[i].enabled) { - trig->use_count++; + + if (!atomic_read(&trig->use_count)) { + atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER); + + for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { + if (trig->subirqs[i].enabled) generic_handle_irq(trig->subirq_base + i); - } + else + iio_trigger_notify_done(trig); + } + } } EXPORT_SYMBOL(iio_trigger_poll); @@ -146,19 +151,24 @@ EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll); void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time) { int i; - if (!trig->use_count) - for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) - if (trig->subirqs[i].enabled) { - trig->use_count++; + + if (!atomic_read(&trig->use_count)) { + atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER); + + for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { + if (trig->subirqs[i].enabled) handle_nested_irq(trig->subirq_base + i); - } + else + iio_trigger_notify_done(trig); + } + } } EXPORT_SYMBOL(iio_trigger_poll_chained); void iio_trigger_notify_done(struct iio_trigger *trig) { - trig->use_count--; - if (trig->use_count == 0 && trig->ops && trig->ops->try_reenable) + if (atomic_dec_and_test(&trig->use_count) && trig->ops && + trig->ops->try_reenable) if (trig->ops->try_reenable(trig)) /* Missed an interrupt so launch new poll now */ iio_trigger_poll(trig, 0); diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h index 3869c525b052..369cf2cd5144 100644 --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h @@ -8,6 +8,7 @@ */ #include <linux/irq.h> #include <linux/module.h> +#include <linux/atomic.h> #ifndef _IIO_TRIGGER_H_ #define _IIO_TRIGGER_H_ @@ -61,7 +62,7 @@ struct iio_trigger { struct list_head list; struct list_head alloc_list; - int use_count; + atomic_t use_count; struct irq_chip subirq_chip; int subirq_base; From 9af588736f48401cca6a39a96a59fb994068237f Mon Sep 17 00:00:00 2001 From: Ulf Hansson <ulf.hansson@linaro.org> Date: Mon, 27 May 2013 15:16:06 +0200 Subject: [PATCH 288/913] ARM: nomadik: Update MMC defconfigs Enable MMC_UNSAFE_RESUME to accomplish a proper suspend/resume cycle for SD/SDIO/(e)MMC. ARMMMCI host driver supports clock gating through runtime PM, thus MMC_CLKGATE is not needed. Moreover ARMMMCI can do scatter-gather which means we can explicity disable MMC_BLOCK_BOUNCE, since it's default enabled, to skip unnecessary bounce buffer copying. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- arch/arm/configs/nhk8815_defconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig index 35f8cf299fa2..b605575f3225 100644 --- a/arch/arm/configs/nhk8815_defconfig +++ b/arch/arm/configs/nhk8815_defconfig @@ -95,7 +95,8 @@ CONFIG_I2C_NOMADIK=y CONFIG_DEBUG_GPIO=y # CONFIG_HWMON is not set CONFIG_MMC=y -CONFIG_MMC_CLKGATE=y +CONFIG_MMC_UNSAFE_RESUME=y +# CONFIG_MMC_BLOCK_BOUNCE is not set CONFIG_MMC_ARMMMCI=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y From 931f57378631c19545ec933d2df0f4fb46d16659 Mon Sep 17 00:00:00 2001 From: Linus Walleij <linus.walleij@linaro.org> Date: Tue, 28 May 2013 16:40:29 +0200 Subject: [PATCH 289/913] ARM: nomadik: update defconfig base Update the Nomadik defconfig enabling: - GPIO keyboard input - Regulators - LED class driver - LED heartbeat trigger Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- arch/arm/configs/nhk8815_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig index b605575f3225..e4cb5a420424 100644 --- a/arch/arm/configs/nhk8815_defconfig +++ b/arch/arm/configs/nhk8815_defconfig @@ -48,7 +48,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" CONFIG_MTD=y CONFIG_MTD_TESTS=m CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_CHAR=y CONFIG_MTD_BLOCK=y CONFIG_MTD_NAND_ECC_SMC=y CONFIG_MTD_NAND=y @@ -94,6 +93,7 @@ CONFIG_I2C_GPIO=y CONFIG_I2C_NOMADIK=y CONFIG_DEBUG_GPIO=y # CONFIG_HWMON is not set +CONFIG_REGULATOR=y CONFIG_MMC=y CONFIG_MMC_UNSAFE_RESUME=y # CONFIG_MMC_BLOCK_BOUNCE is not set From fec57e15527ab2e3d22cfbf04f2b98f823f294ff Mon Sep 17 00:00:00 2001 From: Linus Walleij <linus.walleij@linaro.org> Date: Thu, 20 Jun 2013 13:48:16 +0200 Subject: [PATCH 290/913] ARM: nomadik: configure for NO_HZ and HRTIMERS This enables tickless idle (NO_HZ_IDLE) and high resolution timers for the Nomadik. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- arch/arm/configs/nhk8815_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig index e4cb5a420424..263ae3869e32 100644 --- a/arch/arm/configs/nhk8815_defconfig +++ b/arch/arm/configs/nhk8815_defconfig @@ -1,6 +1,8 @@ # CONFIG_LOCALVERSION_AUTO is not set # CONFIG_SWAP is not set CONFIG_SYSVIPC=y +CONFIG_NO_HZ_IDLE=y +CONFIG_HIGH_RES_TIMERS=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_LOG_BUF_SHIFT=14 From 0e970cec05635adbe7b686063e2548a8e4afb8f4 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Date: Fri, 28 Jun 2013 17:27:02 +0200 Subject: [PATCH 291/913] gpio/omap: don't create an IRQ mapping for every GPIO on DT When a GPIO is defined as an interrupt line using Device Tree, a call to irq_create_of_mapping() is made that calls irq_create_mapping(). So, is not necessary to do the mapping for all OMAP GPIO lines and explicitly call irq_create_mapping() on the driver probe() when booting with Device Tree. Add a custom IRQ domain .map function handler that will be called by irq_create_mapping() to map the GPIO lines used as IRQ. This also allows to execute needed setup code such as configuring a GPIO as input and enabling the GPIO bank. Changes since v3: - Use bank->chip.of_node instead of_have_populated_dt() to check DT or legacy boot as suggested by Jean-Christophe PLAGNIOL-VILLARD Changes since v2: - Unconditionally do the IRQ setup in the .map() function and only call irq_create_mapping() in the gpio chip init to avoid code duplication as suggested by Grant Likely. Changes since v1: - Split the addition of the .map function handler and the automatic gpio request in two different patches. - Add GPIO IRQ setup logic to the irq domain mapping function. - Only call irq_create_mapping for every GPIO on legacy boot. - Only setup a GPIO IRQ on the .map function for DeviceTree boot. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Tested-by: Enric Balletbo i Serra <eballetbo@gmail.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/gpio/gpio-omap.c | 54 +++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index dfeb3a3a8f20..5e667ff91dc3 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1068,24 +1068,50 @@ static void omap_gpio_chip_init(struct gpio_bank *bank) gpiochip_add(&bank->chip); - for (j = 0; j < bank->width; j++) { - int irq = irq_create_mapping(bank->domain, j); - irq_set_lockdep_class(irq, &gpio_lock_class); - irq_set_chip_data(irq, bank); - if (bank->is_mpuio) { - omap_mpuio_alloc_gc(bank, irq, bank->width); - } else { - irq_set_chip_and_handler(irq, &gpio_irq_chip, - handle_simple_irq); - set_irq_flags(irq, IRQF_VALID); - } - } + /* + * REVISIT these explicit calls to irq_create_mapping() + * to do the GPIO to IRQ domain mapping for each GPIO in + * the bank can be removed once all OMAP platforms have + * been migrated to Device Tree boot only. + * Since in DT boot irq_create_mapping() is called from + * irq_create_of_mapping() only for the GPIO lines that + * are used as interrupts. + */ + if (!bank->chip.of_node) + for (j = 0; j < bank->width; j++) + irq_create_mapping(bank->domain, j); irq_set_chained_handler(bank->irq, gpio_irq_handler); irq_set_handler_data(bank->irq, bank); } static const struct of_device_id omap_gpio_match[]; +static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq, + irq_hw_number_t hwirq) +{ + struct gpio_bank *bank = d->host_data; + + if (!bank) + return -EINVAL; + + irq_set_lockdep_class(virq, &gpio_lock_class); + irq_set_chip_data(virq, bank); + if (bank->is_mpuio) { + omap_mpuio_alloc_gc(bank, virq, bank->width); + } else { + irq_set_chip_and_handler(virq, &gpio_irq_chip, + handle_simple_irq); + set_irq_flags(virq, IRQF_VALID); + } + + return 0; +} + +static struct irq_domain_ops omap_gpio_irq_ops = { + .xlate = irq_domain_xlate_onetwocell, + .map = omap_gpio_irq_map, +}; + static int omap_gpio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1151,10 +1177,10 @@ static int omap_gpio_probe(struct platform_device *pdev) } bank->domain = irq_domain_add_legacy(node, bank->width, irq_base, - 0, &irq_domain_simple_ops, NULL); + 0, &omap_gpio_irq_ops, bank); #else bank->domain = irq_domain_add_linear(node, bank->width, - &irq_domain_simple_ops, NULL); + &omap_gpio_irq_ops, bank); #endif if (!bank->domain) { dev_err(dev, "Couldn't register an IRQ domain\n"); From b4419e1a15905191661ffe75ba2f9e649f5d565e Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Date: Fri, 28 Jun 2013 17:27:03 +0200 Subject: [PATCH 292/913] gpio/omap: auto request GPIO as input if used as IRQ via DT When an OMAP GPIO is used as an IRQ line, a call to gpio_request() has to be made to initialize the OMAP GPIO bank before a driver request the IRQ. Otherwise the call to request_irq() fails. Drives should not be aware of this neither care wether an IRQ line is a GPIO or not. They should just request the IRQ and this has to be handled by the irq_chip driver. With the current OMAP GPIO DT binding, if we define: gpio6: gpio@49058000 { compatible = "ti,omap3-gpio"; reg = <0x49058000 0x200>; interrupts = <34>; ti,hwmods = "gpio6"; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupt-cells = <2>; }; interrupt-parent = <&gpio6>; interrupts = <16 8>; The GPIO is correctly mapped as an IRQ but a call to gpio_request() is never made. Since a call to the custom IRQ domain .map function handler is made for each GPIO used as an IRQ, the GPIO can be setup and configured as input there automatically. Changes since v3: - Use bank->chip.of_node instead of_have_populated_dt() to check DT or legacy boot as suggested by Jean-Christophe PLAGNIOL-VILLARD - Add a comment that this is just a temporary solution until and that it has to be removed once is handled by the IRQ core. Changes since v2: - Only make the call to gpio_request_one() conditional in the DT case as suggested by Grant Likely. Changes since v1: - Split the irq domain mapping function handler and the GPIO request in two different patches. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Tested-by: Enric Balletbo i Serra <eballetbo@gmail.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/gpio/gpio-omap.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 5e667ff91dc3..3a0c1606f885 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1090,6 +1090,8 @@ static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq, irq_hw_number_t hwirq) { struct gpio_bank *bank = d->host_data; + int gpio; + int ret; if (!bank) return -EINVAL; @@ -1104,6 +1106,22 @@ static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq, set_irq_flags(virq, IRQF_VALID); } + /* + * REVISIT most GPIO IRQ chip drivers need to call + * gpio_request() before a GPIO line can be used as an + * IRQ. Ideally this should be handled by the IRQ core + * but until then this has to be done on a per driver + * basis. Remove this once this is managed by the core. + */ + if (bank->chip.of_node) { + gpio = irq_to_gpio(bank, hwirq); + ret = gpio_request_one(gpio, GPIOF_IN, NULL); + if (ret) { + dev_err(bank->dev, "Could not request GPIO%d\n", gpio); + return ret; + } + } + return 0; } From 949eb1a4d29dc75e0b5b16b03747886b52ecf854 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Date: Tue, 2 Jul 2013 21:46:30 +0200 Subject: [PATCH 293/913] gpio/omap: fix build error when OF_GPIO is not defined. The OMAP GPIO driver check if the chip has an associated Device Tree node using the struct gpio_chip of_node member. But this is only build if CONFIG_OF_GPIO is defined which leads to the following error when using omap1_defconfig: linux/drivers/gpio/gpio-omap.c: In function 'omap_gpio_chip_init': linux/drivers/gpio/gpio-omap.c:1080:17: error: 'struct gpio_chip' has no member named 'of_node' linux/drivers/gpio/gpio-omap.c: In function 'omap_gpio_irq_map': linux/drivers/gpio/gpio-omap.c:1116:16: error: 'struct gpio_chip' has no member named 'of_node' Reported-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/gpio/gpio-omap.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 3a0c1606f885..c57244ef428b 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1037,6 +1037,18 @@ omap_mpuio_alloc_gc(struct gpio_bank *bank, unsigned int irq_start, IRQ_NOREQUEST | IRQ_NOPROBE, 0); } +#if defined(CONFIG_OF_GPIO) +static inline bool omap_gpio_chip_boot_dt(struct gpio_chip *chip) +{ + return chip->of_node != NULL; +} +#else +static inline bool omap_gpio_chip_boot_dt(struct gpio_chip *chip) +{ + return false; +} +#endif + static void omap_gpio_chip_init(struct gpio_bank *bank) { int j; @@ -1077,7 +1089,7 @@ static void omap_gpio_chip_init(struct gpio_bank *bank) * irq_create_of_mapping() only for the GPIO lines that * are used as interrupts. */ - if (!bank->chip.of_node) + if (!omap_gpio_chip_boot_dt(&bank->chip)) for (j = 0; j < bank->width; j++) irq_create_mapping(bank->domain, j); irq_set_chained_handler(bank->irq, gpio_irq_handler); @@ -1113,7 +1125,7 @@ static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq, * but until then this has to be done on a per driver * basis. Remove this once this is managed by the core. */ - if (bank->chip.of_node) { + if (omap_gpio_chip_boot_dt(&bank->chip)) { gpio = irq_to_gpio(bank, hwirq); ret = gpio_request_one(gpio, GPIOF_IN, NULL); if (ret) { From afe8ce9b29c487ea7f62faa936b6abb84e0b8815 Mon Sep 17 00:00:00 2001 From: Rohit Vaswani <rvaswani@codeaurora.org> Date: Thu, 18 Jul 2013 13:07:14 -0700 Subject: [PATCH 294/913] drivers: gpio: msm: Fix the error condition for reading ngpio of_property_read_u32 return 0 on success. The check was using a ! to return error. Fix the if condition. Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Pankaj Jangra <jangra.pankaj9@gmail.com> Cc: "Bird, Tim" <Tim.Bird@sonymobile.com> Signed-off-by: David Brown <davidb@codeaurora.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/gpio/gpio-msm-v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-msm-v2.c b/drivers/gpio/gpio-msm-v2.c index f4491a497cc8..c2fa77086eb5 100644 --- a/drivers/gpio/gpio-msm-v2.c +++ b/drivers/gpio/gpio-msm-v2.c @@ -378,7 +378,7 @@ static int msm_gpio_probe(struct platform_device *pdev) int ret, ngpio; struct resource *res; - if (!of_property_read_u32(pdev->dev.of_node, "ngpio", &ngpio)) { + if (of_property_read_u32(pdev->dev.of_node, "ngpio", &ngpio)) { dev_err(&pdev->dev, "%s: ngpio property missing\n", __func__); return -EINVAL; } From e94bd3490f4ef342801cfc76b33d8baf9ccc9437 Mon Sep 17 00:00:00 2001 From: Zheng Liu <wenqing.lz@taobao.com> Date: Sat, 20 Jul 2013 21:58:38 -0400 Subject: [PATCH 295/913] ext4: fix a BUG when opening a file with O_TMPFILE flag When we try to open a file with O_TMPFILE flag, we will trigger a bug. The root cause is that in ext4_orphan_add() we check ->i_nlink == 0 and this check always fails because we set ->i_nlink = 1 in inode_init_always(). We can use the following program to trigger it: int main(int argc, char *argv[]) { int fd; fd = open(argv[1], O_TMPFILE, 0666); if (fd < 0) { perror("open "); return -1; } close(fd); return 0; } The oops message looks like this: kernel BUG at fs/ext4/namei.c:2572! invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC Modules linked in: dlci bridge stp hidp cmtp kernelcapi l2tp_ppp l2tp_netlink l2tp_core sctp libcrc32c rfcomm tun fuse nfnetli nk can_raw ipt_ULOG can_bcm x25 scsi_transport_iscsi ipx p8023 p8022 appletalk phonet psnap vmw_vsock_vmci_transport af_key vmw_vmci rose vsock atm can netrom ax25 af_rxrpc ir da pppoe pppox ppp_generic slhc bluetooth nfc rfkill rds caif_socket caif crc_ccitt af_802154 llc2 llc snd_hda_codec_realtek snd_hda_intel snd_hda_codec serio_raw snd_pcm pcsp kr edac_core snd_page_alloc snd_timer snd soundcore r8169 mii sr_mod cdrom pata_atiixp radeon backlight drm_kms_helper ttm CPU: 1 PID: 1812571 Comm: trinity-child2 Not tainted 3.11.0-rc1+ #12 Hardware name: Gigabyte Technology Co., Ltd. GA-MA78GM-S2H/GA-MA78GM-S2H, BIOS F12a 04/23/2010 task: ffff88007dfe69a0 ti: ffff88010f7b6000 task.ti: ffff88010f7b6000 RIP: 0010:[<ffffffff8125ce69>] [<ffffffff8125ce69>] ext4_orphan_add+0x299/0x2b0 RSP: 0018:ffff88010f7b7cf8 EFLAGS: 00010202 RAX: 0000000000000000 RBX: ffff8800966d3020 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffff88007dfe70b8 RDI: 0000000000000001 RBP: ffff88010f7b7d40 R08: ffff880126a3c4e0 R09: ffff88010f7b7ca0 R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801271fd668 R13: ffff8800966d2f78 R14: ffff88011d7089f0 R15: ffff88007dfe69a0 FS: 00007f70441a3740(0000) GS:ffff88012a800000(0000) knlGS:00000000f77c96c0 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000002834000 CR3: 0000000107964000 CR4: 00000000000007e0 DR0: 0000000000780000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600 Stack: 0000000000002000 00000020810b6dde 0000000000000000 ffff88011d46db00 ffff8800966d3020 ffff88011d7089f0 ffff88009c7f4c10 ffff88010f7b7f2c ffff88007dfe69a0 ffff88010f7b7da8 ffffffff8125cfac ffff880100000004 Call Trace: [<ffffffff8125cfac>] ext4_tmpfile+0x12c/0x180 [<ffffffff811cba78>] path_openat+0x238/0x700 [<ffffffff8100afc4>] ? native_sched_clock+0x24/0x80 [<ffffffff811cc647>] do_filp_open+0x47/0xa0 [<ffffffff811db73f>] ? __alloc_fd+0xaf/0x200 [<ffffffff811ba2e4>] do_sys_open+0x124/0x210 [<ffffffff81010725>] ? syscall_trace_enter+0x25/0x290 [<ffffffff811ba3ee>] SyS_open+0x1e/0x20 [<ffffffff816ca8d4>] tracesys+0xdd/0xe2 [<ffffffff81001001>] ? start_thread_common.constprop.6+0x1/0xa0 Code: 04 00 00 00 89 04 24 31 c0 e8 c4 77 04 00 e9 43 fe ff ff 66 25 00 d0 66 3d 00 80 0f 84 0e fe ff ff 83 7b 48 00 0f 84 04 fe ff ff <0f> 0b 49 8b 8c 24 50 07 00 00 e9 88 fe ff ff 0f 1f 84 00 00 00 Here we couldn't call clear_nlink() directly because in d_tmpfile() we will call inode_dec_link_count() to decrease ->i_nlink. So this commit tries to call d_tmpfile() before ext4_orphan_add() to fix this problem. Reported-by: Dave Jones <davej@redhat.com> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Tested-by: Darrick J. Wong <darrick.wong@oracle.com> Tested-by: Dave Jones <davej@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Acked-by: Al Viro <viro@zeniv.linux.org.uk> --- fs/ext4/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 234b834d5a97..35f55a0dbc4b 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -2316,11 +2316,11 @@ retry: inode->i_op = &ext4_file_inode_operations; inode->i_fop = &ext4_file_operations; ext4_set_aops(inode); + d_tmpfile(dentry, inode); err = ext4_orphan_add(handle, inode); if (err) goto err_drop_inode; mark_inode_dirty(inode); - d_tmpfile(dentry, inode); unlock_new_inode(inode); } if (handle) From dda5690defe4af62ee120f055e98e40d97e4c760 Mon Sep 17 00:00:00 2001 From: Zheng Liu <wenqing.lz@taobao.com> Date: Sat, 20 Jul 2013 22:03:20 -0400 Subject: [PATCH 296/913] ext3: fix a BUG when opening a file with O_TMPFILE flag When we try to open a file with O_TMPFILE flag, we will trigger a bug. The root cause is that in ext4_orphan_add() we check ->i_nlink == 0 and this check always fails because we set ->i_nlink = 1 in inode_init_always(). We can use the following program to trigger it: int main(int argc, char *argv[]) { int fd; fd = open(argv[1], O_TMPFILE, 0666); if (fd < 0) { perror("open "); return -1; } close(fd); return 0; } The oops message looks like this: kernel: kernel BUG at fs/ext3/namei.c:1992! kernel: invalid opcode: 0000 [#1] SMP kernel: Modules linked in: ext4 jbd2 crc16 cpufreq_ondemand ipv6 dm_mirror dm_region_hash dm_log dm_mod parport_pc parport serio_raw sg dcdbas pcspkr i2c_i801 ehci_pci ehci_hcd button acpi_cpufreq mperf e1000e ptp pps_core ttm drm_kms_helper drm hwmon i2c_algo_bit i2c_core ext3 jbd sd_mod ahci libahci libata scsi_mod uhci_hcd kernel: CPU: 0 PID: 2882 Comm: tst_tmpfile Not tainted 3.11.0-rc1+ #4 kernel: Hardware name: Dell Inc. OptiPlex 780 /0V4W66, BIOS A05 08/11/2010 kernel: task: ffff880112d30050 ti: ffff8801124d4000 task.ti: ffff8801124d4000 kernel: RIP: 0010:[<ffffffffa00db5ae>] [<ffffffffa00db5ae>] ext3_orphan_add+0x6a/0x1eb [ext3] kernel: RSP: 0018:ffff8801124d5cc8 EFLAGS: 00010202 kernel: RAX: 0000000000000000 RBX: ffff880111510128 RCX: ffff8801114683a0 kernel: RDX: 0000000000000000 RSI: ffff880111510128 RDI: ffff88010fcf65a8 kernel: RBP: ffff8801124d5d18 R08: 0080000000000000 R09: ffffffffa00d3b7f kernel: R10: ffff8801114683a0 R11: ffff8801032a2558 R12: 0000000000000000 kernel: R13: ffff88010fcf6800 R14: ffff8801032a2558 R15: ffff8801115100d8 kernel: FS: 00007f5d172b5700(0000) GS:ffff880117c00000(0000) knlGS:0000000000000000 kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b kernel: CR2: 00007f5d16df15d0 CR3: 0000000110b1d000 CR4: 00000000000407f0 kernel: Stack: kernel: 000000000000000c ffff8801048a7dc8 ffff8801114685a8 ffffffffa00b80d7 kernel: ffff8801124d5e38 ffff8801032a2558 ffff88010ce24d68 0000000000000000 kernel: ffff88011146b300 ffff8801124d5d44 ffff8801124d5d78 ffffffffa00db7e1 kernel: Call Trace: kernel: [<ffffffffa00b80d7>] ? journal_start+0x8c/0xbd [jbd] kernel: [<ffffffffa00db7e1>] ext3_tmpfile+0xb2/0x13b [ext3] kernel: [<ffffffff821076f8>] path_openat+0x11f/0x5e7 kernel: [<ffffffff821c86b4>] ? list_del+0x11/0x30 kernel: [<ffffffff82065fa2>] ? __dequeue_entity+0x33/0x38 kernel: [<ffffffff82107cd5>] do_filp_open+0x3f/0x8d kernel: [<ffffffff82112532>] ? __alloc_fd+0x50/0x102 kernel: [<ffffffff820f9296>] do_sys_open+0x13b/0x1cd kernel: [<ffffffff820f935c>] SyS_open+0x1e/0x20 kernel: [<ffffffff82398c02>] system_call_fastpath+0x16/0x1b kernel: Code: 39 c7 0f 85 67 01 00 00 0f b7 03 25 00 f0 00 00 3d 00 40 00 00 74 18 3d 00 80 00 00 74 11 3d 00 a0 00 00 74 0a 83 7b 48 00 74 04 <0f> 0b eb fe 49 8b 85 50 03 00 00 4c 89 f6 48 c7 c7 c0 99 0e a0 kernel: RIP [<ffffffffa00db5ae>] ext3_orphan_add+0x6a/0x1eb [ext3] kernel: RSP <ffff8801124d5cc8> Here we couldn't call clear_nlink() directly because in d_tmpfile() we will call inode_dec_link_count() to decrease ->i_nlink. So this commit tries to call d_tmpfile() before ext4_orphan_add() to fix this problem. Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: Jan Kara <jack@suse.cz> Cc: Al Viro <viro@zeniv.linux.org.uk> --- fs/ext3/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 998ea111e537..1194b1f0f839 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c @@ -1780,11 +1780,11 @@ retry: inode->i_op = &ext3_file_inode_operations; inode->i_fop = &ext3_file_operations; ext3_set_aops(inode); + d_tmpfile(dentry, inode); err = ext3_orphan_add(handle, inode); if (err) goto err_drop_inode; mark_inode_dirty(inode); - d_tmpfile(dentry, inode); unlock_new_inode(inode); } ext3_journal_stop(handle); From be2f93a4c4981b3646b6f98f477154411b8516cb Mon Sep 17 00:00:00 2001 From: Eldad Zack <eldad@fogrefinery.com> Date: Fri, 19 Jul 2013 18:26:53 +0200 Subject: [PATCH 297/913] ALSA: usb-audio: 6fire: return correct XRUN indication Return SNDRV_PCM_POS_XRUN (snd_pcm_uframes_t) instead of SNDRV_PCM_STATE_XRUN (snd_pcm_state_t) from the pointer function of 6fire, as expected by snd_pcm_update_hw_ptr0(). Caught by sparse. Signed-off-by: Eldad Zack <eldad@fogrefinery.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> --- sound/usb/6fire/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c index 2aa4e13063a8..3d2551cc10f2 100644 --- a/sound/usb/6fire/pcm.c +++ b/sound/usb/6fire/pcm.c @@ -543,7 +543,7 @@ static snd_pcm_uframes_t usb6fire_pcm_pointer( snd_pcm_uframes_t ret; if (rt->panic || !sub) - return SNDRV_PCM_STATE_XRUN; + return SNDRV_PCM_POS_XRUN; spin_lock_irqsave(&sub->lock, flags); ret = sub->dma_off; From 181d1b9e31c668259d3798c521672afb8edd355c Mon Sep 17 00:00:00 2001 From: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Sun, 21 Jul 2013 13:16:24 +0200 Subject: [PATCH 298/913] drm/i915: fix up gt init sequence fallout The regression fix for gen6+ rps fallout commit 7dcd2677ea912573d9ed4bcd629b0023b2d11505 Author: Konstantin Khlebnikov <khlebnikov@openvz.org> Date: Wed Jul 17 10:22:58 2013 +0400 drm/i915: fix long-standing SNB regression in power consumption after resume unintentionally also changed the init sequence ordering between gt_init and gt_reset - we need to reset BIOS damage like leftover forcewake references before we run our own code. Otherwise we can get nasty dmesg noise like [drm:__gen6_gt_force_wake_mt_get] *ERROR* Timed out waiting for forcewake old ack to clear. again. Since _reset suggests that we first need to have stuff initialized (which isn't the case here) call it sanitze instead. While at it also block out the rps disable introduced by the above commit on ilk: We don't have any knowledge of ilk rps being broken in similar ways. And the disable functions uses the default hw state which is only read out when we're enabling rps. So essentially we've been writing random grabage into that register. Reported-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: stable@vger.kernel.org Tested-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/i915_dma.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 4 ++-- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_pm.c | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 5c0663f58aff..abf158da9b30 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1593,8 +1593,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) intel_detect_pch(dev); intel_irq_init(dev); + intel_gt_sanitize(dev); intel_gt_init(dev); - intel_gt_reset(dev); /* Try to make sure MCHBAR is enabled before poking at it */ intel_setup_mchbar(dev); diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 6ddc5677ea2f..45b3c030f483 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -706,7 +706,7 @@ static int i915_drm_thaw(struct drm_device *dev) { int error = 0; - intel_gt_reset(dev); + intel_gt_sanitize(dev); if (drm_core_check_feature(dev, DRIVER_MODESET)) { mutex_lock(&dev->struct_mutex); @@ -732,7 +732,7 @@ int i915_resume(struct drm_device *dev) pci_set_master(dev->pdev); - intel_gt_reset(dev); + intel_gt_sanitize(dev); /* * Platforms with opregion should have sane BIOS, older ones (gen3 and diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 204c3eca0fb2..d2ee3343c943 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1584,7 +1584,7 @@ void i915_handle_error(struct drm_device *dev, bool wedged); extern void intel_irq_init(struct drm_device *dev); extern void intel_hpd_init(struct drm_device *dev); extern void intel_gt_init(struct drm_device *dev); -extern void intel_gt_reset(struct drm_device *dev); +extern void intel_gt_sanitize(struct drm_device *dev); void i915_error_state_free(struct kref *error_ref); diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 828c426b4b92..6a347f54d39f 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5476,7 +5476,7 @@ static void vlv_force_wake_put(struct drm_i915_private *dev_priv) gen6_gt_check_fifodbg(dev_priv); } -void intel_gt_reset(struct drm_device *dev) +void intel_gt_sanitize(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -5489,7 +5489,8 @@ void intel_gt_reset(struct drm_device *dev) } /* BIOS often leaves RC6 enabled, but disable it for hw init */ - intel_disable_gt_powersave(dev); + if (INTEL_INFO(dev)->gen >= 6) + intel_disable_gt_powersave(dev); } void intel_gt_init(struct drm_device *dev) From b1451e546899bc8f450773b2af02e0cd000cf1fa Mon Sep 17 00:00:00 2001 From: "Patil, Rachna" <rachna@ti.com> Date: Sat, 20 Jul 2013 17:27:00 +0100 Subject: [PATCH 299/913] iio: ti_am335x_adc: Fix wrong samples received on 1st read Previously we tried to read data form ADC even before ADC sequencer finished sampling. This led to wrong samples. We now wait on ADC status register idle bit to be set. Signed-off-by: Patil, Rachna <rachna@ti.com> Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> --- drivers/iio/adc/ti_am335x_adc.c | 30 ++++++++++++++++++++-------- include/linux/mfd/ti_am335x_tscadc.h | 16 +++++++++++++++ 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index 0ad208a69c29..3ceac3e91dde 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c @@ -60,7 +60,6 @@ static void tiadc_step_config(struct tiadc_device *adc_dev) { unsigned int stepconfig; int i, steps; - u32 step_en; /* * There are 16 configurable steps and 8 analog input @@ -86,8 +85,7 @@ static void tiadc_step_config(struct tiadc_device *adc_dev) adc_dev->channel_step[i] = steps; steps++; } - step_en = get_adc_step_mask(adc_dev); - am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en); + } static const char * const chan_name_ain[] = { @@ -142,10 +140,22 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, int *val, int *val2, long mask) { struct tiadc_device *adc_dev = iio_priv(indio_dev); - int i; - unsigned int fifo1count, read; + int i, map_val; + unsigned int fifo1count, read, stepid; u32 step = UINT_MAX; bool found = false; + u32 step_en; + unsigned long timeout = jiffies + usecs_to_jiffies + (IDLE_TIMEOUT * adc_dev->channels); + step_en = get_adc_step_mask(adc_dev); + am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en); + + /* Wait for ADC sequencer to complete sampling */ + while (tiadc_readl(adc_dev, REG_ADCFSM) & SEQ_STATUS) { + if (time_after(jiffies, timeout)) + return -EAGAIN; + } + map_val = chan->channel + TOTAL_CHANNELS; /* * When the sub-system is first enabled, @@ -170,12 +180,16 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); for (i = 0; i < fifo1count; i++) { read = tiadc_readl(adc_dev, REG_FIFO1); - if (read >> 16 == step) { - *val = read & 0xfff; + stepid = read & FIFOREAD_CHNLID_MASK; + stepid = stepid >> 0x10; + + if (stepid == map_val) { + read = read & FIFOREAD_DATA_MASK; found = true; + *val = read; } } - am335x_tsc_se_update(adc_dev->mfd_tscadc); + if (found == false) return -EBUSY; return IIO_VAL_INT; diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h index 8d73fe29796a..db1791bb997a 100644 --- a/include/linux/mfd/ti_am335x_tscadc.h +++ b/include/linux/mfd/ti_am335x_tscadc.h @@ -113,11 +113,27 @@ #define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3) #define CNTRLREG_TSCENB BIT(7) +/* FIFO READ Register */ +#define FIFOREAD_DATA_MASK (0xfff << 0) +#define FIFOREAD_CHNLID_MASK (0xf << 16) + +/* Sequencer Status */ +#define SEQ_STATUS BIT(5) + #define ADC_CLK 3000000 #define MAX_CLK_DIV 7 #define TOTAL_STEPS 16 #define TOTAL_CHANNELS 8 +/* +* ADC runs at 3MHz, and it takes +* 15 cycles to latch one data output. +* Hence the idle time for ADC to +* process one sample data would be +* around 5 micro seconds. +*/ +#define IDLE_TIMEOUT 5 /* microsec */ + #define TSCADC_CELLS 2 struct ti_tscadc_dev { From c5f167d31530b9b1aa7beb469aeca10f869eff5a Mon Sep 17 00:00:00 2001 From: Ian Campbell <ian.campbell@citrix.com> Date: Wed, 3 Jul 2013 09:44:50 +0100 Subject: [PATCH 300/913] pinctrl: am33xx dt binding: correct include path Using #include <include/...> is a bit odd. It happens to work because the DTC flags include -Iarch/FOO/boot/dts as well as arch/FOO/boot/dts/include and arch/FOO/boot/dts/include/dt-bindings is a symlink to include/dt-bindings. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: linux-kernel@vger.kernel.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- include/dt-bindings/pinctrl/am33xx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dt-bindings/pinctrl/am33xx.h b/include/dt-bindings/pinctrl/am33xx.h index 469e0325e6f4..2fbc804e1a45 100644 --- a/include/dt-bindings/pinctrl/am33xx.h +++ b/include/dt-bindings/pinctrl/am33xx.h @@ -5,7 +5,7 @@ #ifndef _DT_BINDINGS_PINCTRL_AM33XX_H #define _DT_BINDINGS_PINCTRL_AM33XX_H -#include <include/dt-bindings/pinctrl/omap.h> +#include <dt-bindings/pinctrl/omap.h> /* am33xx specific mux bit defines */ #undef PULL_ENA From 3b2f64d00c46e1e4e9bd0bb9bb12619adac27a4b Mon Sep 17 00:00:00 2001 From: Linus Torvalds <torvalds@linux-foundation.org> Date: Sun, 21 Jul 2013 12:05:29 -0700 Subject: [PATCH 301/913] Linux 3.11-rc2 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9262ba8da4f9..a35f72a420c0 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 11 SUBLEVEL = 0 -EXTRAVERSION = -rc1 +EXTRAVERSION = -rc2 NAME = Linux for Workgroups # *DOCUMENTATION* From 42a708c9328b1b23ed5f415401975e37a64f2747 Mon Sep 17 00:00:00 2001 From: Qipan Li <Qipan.Li@csr.com> Date: Thu, 4 Jul 2013 15:55:25 +0800 Subject: [PATCH 302/913] pinctrl: sirf: fix the pin number and mux bit for usp0 we missed a pin and related mux bit for usp pin group, this patch fixes it. Signed-off-by: Qipan Li <Qipan.Li@csr.com> Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/pinctrl/sirf/pinctrl-atlas6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/sirf/pinctrl-atlas6.c b/drivers/pinctrl/sirf/pinctrl-atlas6.c index 1fa39a444171..c641be9c5b80 100644 --- a/drivers/pinctrl/sirf/pinctrl-atlas6.c +++ b/drivers/pinctrl/sirf/pinctrl-atlas6.c @@ -496,7 +496,7 @@ static const unsigned sdmmc5_pins[] = { 24, 25, 26 }; static const struct sirfsoc_muxmask usp0_muxmask[] = { { .group = 1, - .mask = BIT(19) | BIT(20) | BIT(21) | BIT(22), + .mask = BIT(19) | BIT(20) | BIT(21) | BIT(22) | BIT(23), }, }; @@ -507,7 +507,7 @@ static const struct sirfsoc_padmux usp0_padmux = { .funcval = 0, }; -static const unsigned usp0_pins[] = { 51, 52, 53, 54 }; +static const unsigned usp0_pins[] = { 51, 52, 53, 54, 55 }; static const struct sirfsoc_muxmask usp1_muxmask[] = { { From d58e9a02e1435744d80a99742d1135a6921318eb Mon Sep 17 00:00:00 2001 From: Qipan Li <Qipan.Li@csr.com> Date: Thu, 4 Jul 2013 15:55:26 +0800 Subject: [PATCH 303/913] pinctrl: sirf: add usp0_uart_nostreamctrl pin group for usp-uart without flowctrl this patch adds the lost pin group which supports to let USP0 to simulate a UART without hardware flow control. Signed-off-by: Qipan Li <Qipan.Li@csr.com> Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- arch/arm/boot/dts/atlas6.dtsi | 6 ++++++ drivers/pinctrl/sirf/pinctrl-atlas6.c | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/arch/arm/boot/dts/atlas6.dtsi b/arch/arm/boot/dts/atlas6.dtsi index 9866cd736dee..537041253db7 100644 --- a/arch/arm/boot/dts/atlas6.dtsi +++ b/arch/arm/boot/dts/atlas6.dtsi @@ -485,6 +485,12 @@ sirf,function = "usp0"; }; }; + usp0_uart_nostreamctrl_pins_a: usp0@1 { + usp0 { + sirf,pins = "usp0_uart_nostreamctrl_grp"; + sirf,function = "usp0_uart_nostreamctrl"; + }; + }; usp1_pins_a: usp1@0 { usp1 { sirf,pins = "usp1grp"; diff --git a/drivers/pinctrl/sirf/pinctrl-atlas6.c b/drivers/pinctrl/sirf/pinctrl-atlas6.c index c641be9c5b80..867c9681763c 100644 --- a/drivers/pinctrl/sirf/pinctrl-atlas6.c +++ b/drivers/pinctrl/sirf/pinctrl-atlas6.c @@ -509,6 +509,19 @@ static const struct sirfsoc_padmux usp0_padmux = { static const unsigned usp0_pins[] = { 51, 52, 53, 54, 55 }; +static const struct sirfsoc_muxmask usp0_uart_nostreamctrl_muxmask[] = { + { + .group = 1, + .mask = BIT(20) | BIT(21), + }, +}; + +static const struct sirfsoc_padmux usp0_uart_nostreamctrl_padmux = { + .muxmask_counts = ARRAY_SIZE(usp0_uart_nostreamctrl_muxmask), + .muxmask = usp0_uart_nostreamctrl_muxmask, +}; + +static const unsigned usp0_uart_nostreamctrl_pins[] = { 52, 53 }; static const struct sirfsoc_muxmask usp1_muxmask[] = { { .group = 0, @@ -822,6 +835,8 @@ static const struct sirfsoc_pin_group sirfsoc_pin_groups[] = { SIRFSOC_PIN_GROUP("uart2grp", uart2_pins), SIRFSOC_PIN_GROUP("uart2_nostreamctrlgrp", uart2_nostreamctrl_pins), SIRFSOC_PIN_GROUP("usp0grp", usp0_pins), + SIRFSOC_PIN_GROUP("usp0_uart_nostreamctrl_grp", + usp0_uart_nostreamctrl_pins), SIRFSOC_PIN_GROUP("usp1grp", usp1_pins), SIRFSOC_PIN_GROUP("i2c0grp", i2c0_pins), SIRFSOC_PIN_GROUP("i2c1grp", i2c1_pins), @@ -862,6 +877,8 @@ static const char * const uart0grp[] = { "uart0grp" }; static const char * const uart1grp[] = { "uart1grp" }; static const char * const uart2grp[] = { "uart2grp" }; static const char * const uart2_nostreamctrlgrp[] = { "uart2_nostreamctrlgrp" }; +static const char * const usp0_uart_nostreamctrl_grp[] = { + "usp0_uart_nostreamctrl_grp" }; static const char * const usp0grp[] = { "usp0grp" }; static const char * const usp1grp[] = { "usp1grp" }; static const char * const i2c0grp[] = { "i2c0grp" }; @@ -904,6 +921,9 @@ static const struct sirfsoc_pmx_func sirfsoc_pmx_functions[] = { SIRFSOC_PMX_FUNCTION("uart2", uart2grp, uart2_padmux), SIRFSOC_PMX_FUNCTION("uart2_nostreamctrl", uart2_nostreamctrlgrp, uart2_nostreamctrl_padmux), SIRFSOC_PMX_FUNCTION("usp0", usp0grp, usp0_padmux), + SIRFSOC_PMX_FUNCTION("usp0_uart_nostreamctrl", + usp0_uart_nostreamctrl_grp, + usp0_uart_nostreamctrl_padmux), SIRFSOC_PMX_FUNCTION("usp1", usp1grp, usp1_padmux), SIRFSOC_PMX_FUNCTION("i2c0", i2c0grp, i2c0_padmux), SIRFSOC_PMX_FUNCTION("i2c1", i2c1grp, i2c1_padmux), From c8078de853d51e9b86a2f025ee281b5a81c80655 Mon Sep 17 00:00:00 2001 From: Barry Song <Baohua.Song@csr.com> Date: Thu, 4 Jul 2013 15:55:27 +0800 Subject: [PATCH 304/913] arm/dts: sirf: fix the pingroup name mismatch between drivers and dts in drivers/pinctrl/sirf, pingroup name is cko0 and cko1, but in dts, they are cko0 and cko1_rst. this patch fixes the error in dts. Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- arch/arm/boot/dts/atlas6.dtsi | 16 ++++++++-------- arch/arm/boot/dts/prima2.dtsi | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/arm/boot/dts/atlas6.dtsi b/arch/arm/boot/dts/atlas6.dtsi index 537041253db7..a0f2721ea583 100644 --- a/arch/arm/boot/dts/atlas6.dtsi +++ b/arch/arm/boot/dts/atlas6.dtsi @@ -521,16 +521,16 @@ sirf,function = "pulse_count"; }; }; - cko0_rst_pins_a: cko0_rst@0 { - cko0_rst { - sirf,pins = "cko0_rstgrp"; - sirf,function = "cko0_rst"; + cko0_pins_a: cko0@0 { + cko0 { + sirf,pins = "cko0grp"; + sirf,function = "cko0"; }; }; - cko1_rst_pins_a: cko1_rst@0 { - cko1_rst { - sirf,pins = "cko1_rstgrp"; - sirf,function = "cko1_rst"; + cko1_pins_a: cko1@0 { + cko1 { + sirf,pins = "cko1grp"; + sirf,function = "cko1"; }; }; }; diff --git a/arch/arm/boot/dts/prima2.dtsi b/arch/arm/boot/dts/prima2.dtsi index 05e9489cf95c..bbeb623fc2c6 100644 --- a/arch/arm/boot/dts/prima2.dtsi +++ b/arch/arm/boot/dts/prima2.dtsi @@ -515,16 +515,16 @@ sirf,function = "pulse_count"; }; }; - cko0_rst_pins_a: cko0_rst@0 { - cko0_rst { - sirf,pins = "cko0_rstgrp"; - sirf,function = "cko0_rst"; + cko0_pins_a: cko0@0 { + cko0 { + sirf,pins = "cko0grp"; + sirf,function = "cko0"; }; }; - cko1_rst_pins_a: cko1_rst@0 { - cko1_rst { - sirf,pins = "cko1_rstgrp"; - sirf,function = "cko1_rst"; + cko1_pins_a: cko1@0 { + cko1 { + sirf,pins = "cko1grp"; + sirf,function = "cko1"; }; }; }; From 25f397a429dfa43f22c278d0119a60a343aa568f Mon Sep 17 00:00:00 2001 From: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Fri, 19 Jul 2013 18:57:11 +0200 Subject: [PATCH 305/913] drm/crtc-helper: explicit DPMS on after modeset Atm the crtc helper implementation of set_config has really inconsisten semantics: If just an fb update is good enough, dpms state will be left as-is, but if we do a full modeset we force everything to dpms on. This change has already been applied to the i915 modeset code in commit e3de42b68478a8c95dd27520e9adead2af9477a5 Author: Imre Deak <imre.deak@intel.com> Date: Fri May 3 19:44:07 2013 +0200 drm/i915: force full modeset if the connector is in DPMS OFF mode which according to Greg KH seems to aim for a new record in most Bugzilla: links in a commit message. The history of this dpms forcing is pretty interesting. This patch here is an almost-revert of commit 811aaa55ba21ab37407018cfc01770d6b037d3fb Author: Keith Packard <keithp@keithp.com> Date: Thu Feb 3 16:57:28 2011 -0800 drm: Only set DPMS ON when actually configuring a mode which fixed the bug of trying to dpms on disabled outputs, but introduced the new discrepancy between an fb update only and full modesets. The actual introduction of this goes back to commit bf9dc102e284a5aa78c73fc9d72e11d5ccd8669f Author: Keith Packard <keithp@keithp.com> Date: Fri Nov 26 10:45:58 2010 -0800 drm: Set connector DPMS status to ON in drm_crtc_helper_set_config And if you'd dig around in the i915 driver code there's even more fun around forcing dpms on and losing our heads and temper of the resulting inconsistencies. Especially the DP re-training code had tons of funny stuff in it. v2: So v1 totally blew up on resume on my radeon system here. After much head-scraching I've figured out that the radeon resume functions resumes the console system _before_ it actually restores all the modeset state. And resuming the console systems means that fbdev doeas an immediate ->set_par call. Now up to this patch that ->set_par did absolutely nothing: All the old sw state from pre-suspend was still around (since the modeset reset wasn't done yet), which means that the set_config calls done as a result of the ->set_par where all treated as no-ops (despite that the real hw state was obviously something completely different). Since v1 of this patch just added a bunch of ->dpms calls if the crtc was enabled, those set_config calls suddenly stopped being no-ops. But because the hw state wasn't restored the ->dpms callbacks resulted in decent amounts of hilarity and eventual full hangs. Since I can't review all kms drivers for such tricky ordering constraints v2 opts for a different approach and forces a full modeset if the connector dpms state isnt' DPMS_ON. Since the ->dpms callbacks implemented by the modeset helpers update the connector->dpms property we have the same effect of ensuring that the pipe is ultimately turned on, even if we just end up updating the fb. This is the same approac we ended up using in the intel driver. Note that besides i915.ko only all other drivers eventually call drm_helper_connector_dpms with the exception of vmwgfx, which does not support dmps at all. v3: Dave Airlie merged the broken first version of this patch, so squash in the revert of commit 372835a8527f85b3eff20a18c2c339e827dfd4e4 Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Sat Jun 15 00:13:13 2013 +0200 drm/crtc-helper: explicit DPMS on after modeset Also fix up the spelling fail a bit in the commit message while at it. Cc: Dave Airlie <airlied@redhat.com> Reviewed-by: Alex Deucher <alexdeucher@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67043 Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/drm_crtc_helper.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 738a4294d820..6a647493ca7f 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -677,6 +677,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) /* don't break so fail path works correct */ fail = 1; break; + + if (connector->dpms != DRM_MODE_DPMS_ON) { + DRM_DEBUG_KMS("connector dpms not on, full mode switch\n"); + mode_changed = true; + } } } @@ -754,6 +759,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ret = -EINVAL; goto fail; } + DRM_DEBUG_KMS("Setting connector DPMS state to on\n"); + for (i = 0; i < set->num_connectors; i++) { + DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id, + drm_get_connector_name(set->connectors[i])); + set->connectors[i]->funcs->dpms(set->connectors[i], DRM_MODE_DPMS_ON); + } } drm_helper_disable_unused_functions(dev); } else if (fb_changed) { @@ -771,22 +782,6 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) } } - /* - * crtc set_config helpers implicit set the crtc and all connected - * encoders to DPMS on for a full mode set. But for just an fb update it - * doesn't do that. To not confuse userspace, do an explicit DPMS_ON - * unconditionally. This will also ensure driver internal dpms state is - * consistent again. - */ - if (set->crtc->enabled) { - DRM_DEBUG_KMS("Setting connector DPMS state to on\n"); - for (i = 0; i < set->num_connectors; i++) { - DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id, - drm_get_connector_name(set->connectors[i])); - set->connectors[i]->funcs->dpms(set->connectors[i], DRM_MODE_DPMS_ON); - } - } - kfree(save_connectors); kfree(save_encoders); kfree(save_crtcs); From ace120dcf23b3bbba00d797a898481997381052f Mon Sep 17 00:00:00 2001 From: Steven Rostedt <rostedt@goodmis.org> Date: Tue, 16 Jul 2013 14:02:28 -0400 Subject: [PATCH 306/913] Thermal: Fix lockup of cpu_down() Commit f1a18a105 "Thermal: CPU Package temperature thermal" had code that did a get_online_cpus(), run a loop and then do a put_online_cpus(). The problem is that the loop had an error exit that would skip the put_online_cpus() part. In the error exit part of the function, it also did a get_online_cpus(), run a loop and then put_online_cpus(). The only way to get to the error exit part is with get_online_cpus() already performed. If this error condition is hit, the system will be prevented from taking CPUs offline. The process taking the CPU offline will lock up hard. Removing the get_online_cpus() removes the lockup as the hotplug CPU refcount is back to zero. This was bisected with ktest. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com> --- drivers/thermal/x86_pkg_temp_thermal.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c index 810143a6aa33..f36950e4134f 100644 --- a/drivers/thermal/x86_pkg_temp_thermal.c +++ b/drivers/thermal/x86_pkg_temp_thermal.c @@ -599,7 +599,6 @@ static int __init pkg_temp_thermal_init(void) return 0; err_ret: - get_online_cpus(); for_each_online_cpu(i) put_core_offline(i); put_online_cpus(); From 07b155031fb32b3c6ab7f9933a9c280146e4a7b2 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven <geert@linux-m68k.org> Date: Wed, 10 Jul 2013 23:03:36 +0200 Subject: [PATCH 307/913] ath10k: ATH10K should depend on HAS_DMA If NO_DMA=y: drivers/built-in.o: In function `ath10k_skb_unmap': drivers/net/wireless/ath/ath10k/core.h:98: undefined reference to `dma_unmap_single' drivers/built-in.o: In function `ath10k_skb_map': drivers/net/wireless/ath/ath10k/core.h:83: undefined reference to `dma_map_single' drivers/net/wireless/ath/ath10k/core.h:86: undefined reference to `dma_mapping_error' drivers/built-in.o: In function `ath10k_htt_rx_ring_free': drivers/net/wireless/ath/ath10k/htt_rx.c:113: undefined reference to `dma_unmap_single' drivers/built-in.o: In function `ath10k_htt_rx_amsdu_pop': drivers/net/wireless/ath/ath10k/htt_rx.c:296: undefined reference to `dma_unmap_single' drivers/net/wireless/ath/ath10k/htt_rx.c:389: undefined reference to `dma_unmap_single' drivers/built-in.o: In function `__ath10k_htt_rx_ring_fill_n': drivers/net/wireless/ath/ath10k/htt_rx.c:146: undefined reference to `dma_map_single' drivers/net/wireless/ath/ath10k/htt_rx.c:150: undefined reference to `dma_mapping_error' drivers/built-in.o: In function `ath10k_htt_rx_attach': drivers/net/wireless/ath/ath10k/htt_rx.c:474: undefined reference to `dma_alloc_coherent' drivers/net/wireless/ath/ath10k/htt_rx.c:509: undefined reference to `dma_free_coherent' drivers/net/wireless/ath/ath10k/htt_rx.c:514: undefined reference to `dma_free_coherent' drivers/built-in.o: In function `ath10k_htt_rx_detach': drivers/net/wireless/ath/ath10k/htt_rx.c:220: undefined reference to `dma_unmap_single' drivers/net/wireless/ath/ath10k/htt_rx.c:228: undefined reference to `dma_free_coherent' drivers/built-in.o: In function `ath10k_skb_map': drivers/net/wireless/ath/ath10k/core.h:83: undefined reference to `dma_map_single' drivers/net/wireless/ath/ath10k/core.h:86: undefined reference to `dma_mapping_error' drivers/built-in.o: In function `ath10k_skb_unmap': drivers/net/wireless/ath/ath10k/core.h:98: undefined reference to `dma_unmap_single' drivers/built-in.o: In function `ath10k_skb_map': drivers/net/wireless/ath/ath10k/core.h:83: undefined reference to `dma_map_single' drivers/net/wireless/ath/ath10k/core.h:86: undefined reference to `dma_mapping_error' drivers/net/wireless/ath/ath10k/core.h:83: undefined reference to `dma_map_single' drivers/net/wireless/ath/ath10k/core.h:86: undefined reference to `dma_mapping_error' drivers/built-in.o: In function `ath10k_skb_unmap': drivers/net/wireless/ath/ath10k/core.h:98: undefined reference to `dma_unmap_single' drivers/net/wireless/ath/ath10k/core.h:98: undefined reference to `dma_unmap_single' drivers/net/wireless/ath/ath10k/core.h:98: undefined reference to `dma_unmap_single' drivers/net/wireless/ath/ath10k/core.h:98: undefined reference to `dma_unmap_single' Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: linux-wireless@vger.kernel.org Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com> --- drivers/net/wireless/ath/ath10k/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/Kconfig b/drivers/net/wireless/ath/ath10k/Kconfig index cde58fe96254..82e8088ca9b4 100644 --- a/drivers/net/wireless/ath/ath10k/Kconfig +++ b/drivers/net/wireless/ath/ath10k/Kconfig @@ -1,6 +1,6 @@ config ATH10K tristate "Atheros 802.11ac wireless cards support" - depends on MAC80211 + depends on MAC80211 && HAS_DMA select ATH_COMMON ---help--- This module adds support for wireless adapters based on From 2ea0ffcbc0993d5c41b47f6cec858fd178fb09ac Mon Sep 17 00:00:00 2001 From: Kalle Valo <kvalo@qca.qualcomm.com> Date: Mon, 22 Jul 2013 12:22:19 +0300 Subject: [PATCH 308/913] MAINTAINERS: add ath10k I forgot to add an entry to MAINTAINERS when submitting the driver. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com> --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index bf61e04291ab..44626b82d630 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6719,6 +6719,14 @@ T: git git://linuxtv.org/anttip/media_tree.git S: Maintained F: drivers/media/tuners/qt1010* +QUALCOMM ATHEROS ATH10K WIRELESS DRIVER +M: Kalle Valo <kvalo@qca.qualcomm.com> +L: ath10k@lists.infradead.org +W: http://wireless.kernel.org/en/users/Drivers/ath10k +T: git git://github.com/kvalo/ath.git +S: Supported +F: drivers/net/wireless/ath/ath10k/ + QUALCOMM HEXAGON ARCHITECTURE M: Richard Kuo <rkuo@codeaurora.org> L: linux-hexagon@vger.kernel.org From 27abb2ffb07a70bdebf9a785658f68f10600281c Mon Sep 17 00:00:00 2001 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Wed, 17 Jul 2013 08:34:59 +0800 Subject: [PATCH 309/913] pch_dma: fix error return code in pch_dma_probe() Fix to return -ENODEV when no proper base address found error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Vinod Koul <vinod.koul@intel.com> --- drivers/dma/pch_dma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c index ce3dc3e9688c..0bbdea5059f3 100644 --- a/drivers/dma/pch_dma.c +++ b/drivers/dma/pch_dma.c @@ -867,6 +867,7 @@ static int pch_dma_probe(struct pci_dev *pdev, if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { dev_err(&pdev->dev, "Cannot find proper base address\n"); + err = -ENODEV; goto err_disable_pdev; } From 58cfb681bffb43654776a218a087028ff425ba9e Mon Sep 17 00:00:00 2001 From: Kalle Valo <kvalo@qca.qualcomm.com> Date: Mon, 22 Jul 2013 12:26:12 +0300 Subject: [PATCH 310/913] MAINTAINERS: update ath6kl git location The git tree is in github.com nowadays. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com> --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 44626b82d630..7a403ba167d2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1406,7 +1406,7 @@ ATHEROS ATH6KL WIRELESS DRIVER M: Kalle Valo <kvalo@qca.qualcomm.com> L: linux-wireless@vger.kernel.org W: http://wireless.kernel.org/en/users/Drivers/ath6kl -T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath6kl.git +T: git git://github.com/kvalo/ath.git S: Supported F: drivers/net/wireless/ath/ath6kl/ From b5c745fb75b7e5ab06e9c99d63427595a234cc89 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Mon, 22 Jul 2013 09:56:54 +0300 Subject: [PATCH 311/913] ASoC: core: double free in snd_soc_add_platform() There are three callers for this function, and none of them want it to free platform for them. It leads to a double free. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@linaro.org> --- sound/soc/soc-core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 0ec070cf7231..d82ee386eab5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3908,10 +3908,8 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, { /* create platform component name */ platform->name = fmt_single_name(dev, &platform->id); - if (platform->name == NULL) { - kfree(platform); + if (platform->name == NULL) return -ENOMEM; - } platform->dev = dev; platform->driver = platform_drv; From b6992fa9a74862c5addb62cde1657c7479615d86 Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Wed, 17 Jul 2013 17:54:27 +0100 Subject: [PATCH 312/913] ARM: document DEBUG_UNCOMPRESS Kconfig option This non-user visible option lacked any kind of documentation. This is quite common for non-user visible options; certian people can't understand the point of documenting such options with help text. However, here we have a case in point: developers don't understand the option either, as they were thinking that when the option is not set, the decompressor should produce no output what so ever. This is incorrect, as the purpose of this option is to control whether a multiplatform kernel uses the kernel debugging macros to produce output or not. So let's document this via help rather than commentry to prevent others falling into this misunderstanding. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/Kconfig.debug | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index e401a766c0bd..583f4a00ec32 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -804,9 +804,19 @@ config DEBUG_LL_INCLUDE config DEBUG_UNCOMPRESS bool - default y if ARCH_MULTIPLATFORM && DEBUG_LL && \ - !DEBUG_OMAP2PLUS_UART && \ + depends on ARCH_MULTIPLATFORM + default y if DEBUG_LL && !DEBUG_OMAP2PLUS_UART && \ !DEBUG_TEGRA_UART + help + This option influences the normal decompressor output for + multiplatform kernels. Normally, multiplatform kernels disable + decompressor output because it is not possible to know where to + send the decompressor output. + + When this option is set, the selected DEBUG_LL output method + will be re-used for normal decompressor output on multiplatform + kernels. + config UNCOMPRESS_INCLUDE string From 647ab784c507763bfda79155f125b6edd1244806 Mon Sep 17 00:00:00 2001 From: Richard Zhao <rizhao@nvidia.com> Date: Sun, 21 Jul 2013 10:34:09 +0800 Subject: [PATCH 313/913] ASoC: tegra: correct playback_dma_data setup The errors were caused by copy/paste mistake in below commit since v3.10: 3489d50 ASoC: tegra: Use common DAI DMA data struct It also corrects slave_id initialization in tegra20_ac97 driver. Signed-off-by: Richard Zhao <rizhao@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com> Acked-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: <stable@vger.kernel.org> # 3.10 --- sound/soc/tegra/tegra20_ac97.c | 6 +++--- sound/soc/tegra/tegra20_spdif.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c index e58233f7df61..6c486625321b 100644 --- a/sound/soc/tegra/tegra20_ac97.c +++ b/sound/soc/tegra/tegra20_ac97.c @@ -389,9 +389,9 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) ac97->capture_dma_data.slave_id = of_dma[1]; ac97->playback_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_TX1; - ac97->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; - ac97->capture_dma_data.maxburst = 4; - ac97->capture_dma_data.slave_id = of_dma[0]; + ac97->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + ac97->playback_dma_data.maxburst = 4; + ac97->playback_dma_data.slave_id = of_dma[1]; ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev); if (ret) diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c index 5eaa12cdc6eb..551b3c93ce93 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -323,8 +323,8 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev) } spdif->playback_dma_data.addr = mem->start + TEGRA20_SPDIF_DATA_OUT; - spdif->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; - spdif->capture_dma_data.maxburst = 4; + spdif->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + spdif->playback_dma_data.maxburst = 4; spdif->playback_dma_data.slave_id = dmareq->start; pm_runtime_enable(&pdev->dev); From bf3f0f332f76a85ff3a0b393aaded5a8533769c0 Mon Sep 17 00:00:00 2001 From: Will Deacon <will.deacon@arm.com> Date: Mon, 15 Jul 2013 14:26:19 +0100 Subject: [PATCH 314/913] ARM: 7784/1: mm: ensure SMP alternates assemble to exactly 4 bytes with Thumb-2 Commit ae8a8b9553bd ("ARM: 7691/1: mm: kill unused TLB_CAN_READ_FROM_L1_CACHE and use ALT_SMP instead") added early function returns for page table cache flushing operations on ARMv7 SMP CPUs. Unfortunately, when targetting Thumb-2, these `mov pc, lr' sequences assemble to 2 bytes which can lead to corruption of the instruction stream after code patching. This patch fixes the alternates to use wide (32-bit) instructions for Thumb-2, therefore ensuring that the patching code works correctly. Cc: <stable@vger.kernel.org> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/mm/proc-v7-2level.S | 2 +- arch/arm/mm/proc-v7-3level.S | 2 +- arch/arm/mm/proc-v7.S | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S index f64afb9f1bd5..bdd3be4be77a 100644 --- a/arch/arm/mm/proc-v7-2level.S +++ b/arch/arm/mm/proc-v7-2level.S @@ -110,7 +110,7 @@ ENTRY(cpu_v7_set_pte_ext) ARM( str r3, [r0, #2048]! ) THUMB( add r0, r0, #2048 ) THUMB( str r3, [r0] ) - ALT_SMP(mov pc,lr) + ALT_SMP(W(nop)) ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte #endif mov pc, lr diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S index c36ac69488c8..01a719e18bb0 100644 --- a/arch/arm/mm/proc-v7-3level.S +++ b/arch/arm/mm/proc-v7-3level.S @@ -81,7 +81,7 @@ ENTRY(cpu_v7_set_pte_ext) tst r3, #1 << (55 - 32) @ L_PTE_DIRTY orreq r2, #L_PTE_RDONLY 1: strd r2, r3, [r0] - ALT_SMP(mov pc, lr) + ALT_SMP(W(nop)) ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte #endif mov pc, lr diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 5c6d5a3050ea..73398bcf9bd8 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S @@ -75,13 +75,14 @@ ENTRY(cpu_v7_do_idle) ENDPROC(cpu_v7_do_idle) ENTRY(cpu_v7_dcache_clean_area) - ALT_SMP(mov pc, lr) @ MP extensions imply L1 PTW - ALT_UP(W(nop)) - dcache_line_size r2, r3 -1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry + ALT_SMP(W(nop)) @ MP extensions imply L1 PTW + ALT_UP_B(1f) + mov pc, lr +1: dcache_line_size r2, r3 +2: mcr p15, 0, r0, c7, c10, 1 @ clean D entry add r0, r0, r2 subs r1, r1, r2 - bhi 1b + bhi 2b dsb mov pc, lr ENDPROC(cpu_v7_dcache_clean_area) From c65b7e98b4edce7faf534154b28eae8fb579144b Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Wed, 17 Jul 2013 17:53:04 +0100 Subject: [PATCH 315/913] ARM: 7785/1: mm: restrict early_alloc to section-aligned memory When map_lowmem() runs, and processes a memory bank whose start or end is not section-aligned, memory must be allocated to store the 2nd-level page tables. Those allocations are made by calling memblock_alloc(). At this point, the only memory that is free *and* mapped is memory which has already been mapped by map_lowmem() itself. For this reason, we must calculate the first point at which map_lowmem() will need to allocate memory, and set the memblock allocation limit to a lower address, so that memblock_alloc() is guaranteed to return memory that is already mapped. This patch enhances sanity_check_meminfo() to calculate that memory address, and pass it to memblock_set_current_limit(), rather than just assuming the limit is arm_lowmem_limit. The algorithm applied is: * Default memblock_limit to arm_lowmem_limit in the absence of any other limit; arm_lowmem_limit is the highest memory that is mapped by map_lowmem(). * While walking the list of memblocks, if the start of a block is not aligned, 2nd-level page tables will need to be allocated to map the first few pages of the block. Hence, the memblock_limit must be before the start of the block. * Similarly, if the end of any block is not aligned, 2nd-level page tables will need to be allocated to map the last few pages of the block. Hence, the memblock_limit must point at the end of the block, rounded down to section-alignment. * The memory blocks are assumed to be sorted in address order, so the first unaligned block start or end is used to set the limit. With this algorithm, the start or end of almost any bank can be non- section-aligned. The only exception is that the start of bank 0 must be section-aligned, since otherwise memory would need to be allocated when mapping the start of bank 0, which occurs before any free memory is mapped. [swarren, wrote commit description, rewrote calculation of memblock_limit] Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/mm/mmu.c | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 4f56617a2392..b3fdb63783e3 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -989,6 +989,7 @@ phys_addr_t arm_lowmem_limit __initdata = 0; void __init sanity_check_meminfo(void) { + phys_addr_t memblock_limit = 0; int i, j, highmem = 0; phys_addr_t vmalloc_limit = __pa(vmalloc_min - 1) + 1; @@ -1052,9 +1053,32 @@ void __init sanity_check_meminfo(void) bank->size = size_limit; } #endif - if (!bank->highmem && bank->start + bank->size > arm_lowmem_limit) - arm_lowmem_limit = bank->start + bank->size; + if (!bank->highmem) { + phys_addr_t bank_end = bank->start + bank->size; + if (bank_end > arm_lowmem_limit) + arm_lowmem_limit = bank_end; + + /* + * Find the first non-section-aligned page, and point + * memblock_limit at it. This relies on rounding the + * limit down to be section-aligned, which happens at + * the end of this function. + * + * With this algorithm, the start or end of almost any + * bank can be non-section-aligned. The only exception + * is that the start of the bank 0 must be section- + * aligned, since otherwise memory would need to be + * allocated when mapping the start of bank 0, which + * occurs before any free memory is mapped. + */ + if (!memblock_limit) { + if (!IS_ALIGNED(bank->start, SECTION_SIZE)) + memblock_limit = bank->start; + else if (!IS_ALIGNED(bank_end, SECTION_SIZE)) + memblock_limit = bank_end; + } + } j++; } #ifdef CONFIG_HIGHMEM @@ -1079,7 +1103,18 @@ void __init sanity_check_meminfo(void) #endif meminfo.nr_banks = j; high_memory = __va(arm_lowmem_limit - 1) + 1; - memblock_set_current_limit(arm_lowmem_limit); + + /* + * Round the memblock limit down to a section size. This + * helps to ensure that we will allocate memory from the + * last full section, which should be mapped. + */ + if (memblock_limit) + memblock_limit = round_down(memblock_limit, SECTION_SIZE); + if (!memblock_limit) + memblock_limit = arm_lowmem_limit; + + memblock_set_current_limit(memblock_limit); } static inline void prepare_page_table(void) @@ -1276,8 +1311,6 @@ void __init paging_init(struct machine_desc *mdesc) { void *zero_page; - memblock_set_current_limit(arm_lowmem_limit); - build_mem_type_table(); prepare_page_table(); map_lowmem(); From b60d5db690f72a7cfe5e39f191f0719a9ef3a096 Mon Sep 17 00:00:00 2001 From: Mark Rutland <mark.rutland@arm.com> Date: Thu, 18 Jul 2013 17:20:32 +0100 Subject: [PATCH 316/913] ARM: 7786/1: hyp: fix macro parameterisation Currently, compare_cpu_mode_with_primary uses a mixture of macro arguments and hardcoded registers, and does so incorrectly, as it stores (__boot_cpu_mode_offset | BOOT_CPU_MODE_MISMATCH) to (__boot_cpu_mode + &__boot_cpu_mode_offset), which could corrupt an arbitrary portion of memory. This patch fixes up compare_cpu_mode_with_primary to use the macro arguments, correctly updating __boot_cpu_mode. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Dave Martin <Dave.Martin@arm.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Cc: Christoffer Dall <cdall@cs.columbia.edu> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/kernel/hyp-stub.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S index 4910232c4833..797b1a6a4906 100644 --- a/arch/arm/kernel/hyp-stub.S +++ b/arch/arm/kernel/hyp-stub.S @@ -56,8 +56,8 @@ ENTRY(__boot_cpu_mode) ldr \reg3, [\reg2] ldr \reg1, [\reg2, \reg3] cmp \mode, \reg1 @ matches primary CPU boot mode? - orrne r7, r7, #BOOT_CPU_MODE_MISMATCH - strne r7, [r5, r6] @ record what happened and give up + orrne \reg1, \reg1, #BOOT_CPU_MODE_MISMATCH + strne \reg1, [\reg2, \reg3] @ record what happened and give up .endm #else /* ZIMAGE */ From 40d18ff959fe8b847be4f7b03f84644a7c18211e Mon Sep 17 00:00:00 2001 From: Chun-Yeow Yeoh <yeohchunyeow@gmail.com> Date: Fri, 19 Jul 2013 17:37:39 +0800 Subject: [PATCH 317/913] mac80211: prevent the buffering or frame transmission to non-assoc mesh STA This patch is intended to avoid the buffering to non-assoc mesh STA and also to avoid the triggering of frame to non-assoc mesh STA which could cause kernel panic in specific hw. One of the examples, is kernel panic happens to ath9k if user space inserts the mesh STA and not proceed with the SAE and AMPE, and later the same mesh STA is detected again. The sta_state of the mesh STA remains at IEEE80211_STA_NONE and if the ieee80211_sta_ps_deliver_wakeup is called and subsequently the ath_tx_aggr_wakeup, the kernel panic due to ath_tx_node_init is not called before to initialize the require data structures. This issue is reported by Cedric Voncken before. http://www.spinics.net/lists/linux-wireless/msg106342.html [<831ea6b4>] ath_tx_aggr_wakeup+0x44/0xcc [ath9k] [<83084214>] ieee80211_sta_ps_deliver_wakeup+0xb8/0x208 [mac80211] [<830b9824>] ieee80211_mps_sta_status_update+0x94/0x108 [mac80211] [<83099398>] ieee80211_sta_ps_transition+0xc94/0x34d8 [mac80211] [<8022399c>] nf_iterate+0x98/0x104 [<8309bb60>] ieee80211_sta_ps_transition+0x345c/0x34d8 [mac80211] Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- net/mac80211/mesh_ps.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mac80211/mesh_ps.c b/net/mac80211/mesh_ps.c index 3b7bfc01ee36..22290a929b94 100644 --- a/net/mac80211/mesh_ps.c +++ b/net/mac80211/mesh_ps.c @@ -229,6 +229,10 @@ void ieee80211_mps_sta_status_update(struct sta_info *sta) enum nl80211_mesh_power_mode pm; bool do_buffer; + /* For non-assoc STA, prevent buffering or frame transmission */ + if (sta->sta_state < IEEE80211_STA_ASSOC) + return; + /* * use peer-specific power mode if peering is established and the * peer's power mode is known From a1923f1d4723e5757cefdd60f7c7ab30e472007a Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Date: Thu, 18 Jul 2013 19:11:26 +0300 Subject: [PATCH 318/913] iwlwifi: add DELL SKU for 5150 HMC This SKU was missing in the list of supported devices https://bugzilla.kernel.org/show_bug.cgi?id=60577 Cc: <stable@vger.kernel.org> [all versions] Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- drivers/net/wireless/iwlwifi/pcie/drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index 81f3ea5b09a4..ff13458efc27 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c @@ -130,6 +130,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { {IWL_PCI_DEVICE(0x423C, 0x1306, iwl5150_abg_cfg)}, /* Half Mini Card */ {IWL_PCI_DEVICE(0x423C, 0x1221, iwl5150_agn_cfg)}, /* Mini Card */ {IWL_PCI_DEVICE(0x423C, 0x1321, iwl5150_agn_cfg)}, /* Half Mini Card */ + {IWL_PCI_DEVICE(0x423C, 0x1326, iwl5150_abg_cfg)}, /* Half Mini Card */ {IWL_PCI_DEVICE(0x423D, 0x1211, iwl5150_agn_cfg)}, /* Mini Card */ {IWL_PCI_DEVICE(0x423D, 0x1311, iwl5150_agn_cfg)}, /* Half Mini Card */ From c63e0e370028d7e4033bd40165f18499872b5183 Mon Sep 17 00:00:00 2001 From: Nestor Lopez Casado <nlopezcasad@logitech.com> Date: Thu, 18 Jul 2013 06:21:30 -0700 Subject: [PATCH 319/913] HID: Revert "Revert "HID: Fix logitech-dj: missing Unifying device issue"" This reverts commit 8af6c08830b1ae114d1a8b548b1f8b056e068887. This patch re-adds the workaround introduced by 596264082f10dd4 which was reverted by 8af6c08830b1ae114. The original patch 596264 was needed to overcome a situation where the hid-core would drop incoming reports while probe() was being executed. This issue was solved by c849a6143bec520af which added hid_device_io_start() and hid_device_io_stop() that enable a specific hid driver to opt-in for input reports while its probe() is being executed. Commit a9dd22b730857347 modified hid-logitech-dj so as to use the functionality added to hid-core. Having done that, workaround 596264 was no longer necessary and was reverted by 8af6c08. We now encounter a different problem that ends up 'again' thwarting the Unifying receiver enumeration. The problem is time and usb controller dependent. Ocasionally the reports sent to the usb receiver to start the paired devices enumeration fail with -EPIPE and the receiver never gets to enumerate the paired devices. With dcd9006b1b053c7b1c the problem was "hidden" as the call to the usb driver became asynchronous and none was catching the error from the failing URB. As the root cause for this failing SET_REPORT is not understood yet, -possibly a race on the usb controller drivers or a problem with the Unifying receiver- reintroducing this workaround solves the problem. Overall what this workaround does is: If an input report from an unknown device is received, then a (re)enumeration is performed. related bug: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1194649 Signed-off-by: Nestor Lopez Casado <nlopezcasad@logitech.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> --- drivers/hid/hid-logitech-dj.c | 45 +++++++++++++++++++++++++++++++++++ drivers/hid/hid-logitech-dj.h | 1 + 2 files changed, 46 insertions(+) diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 5207591a598c..cd33084c7860 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c @@ -192,6 +192,7 @@ static struct hid_ll_driver logi_dj_ll_driver; static int logi_dj_output_hidraw_report(struct hid_device *hid, u8 * buf, size_t count, unsigned char report_type); +static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev); static void logi_dj_recv_destroy_djhid_device(struct dj_receiver_dev *djrcv_dev, struct dj_report *dj_report) @@ -232,6 +233,7 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] & SPFUNCTION_DEVICE_LIST_EMPTY) { dbg_hid("%s: device list is empty\n", __func__); + djrcv_dev->querying_devices = false; return; } @@ -242,6 +244,12 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, return; } + if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { + /* The device is already known. No need to reallocate it. */ + dbg_hid("%s: device is already known\n", __func__); + return; + } + dj_hiddev = hid_allocate_device(); if (IS_ERR(dj_hiddev)) { dev_err(&djrcv_hdev->dev, "%s: hid_allocate_device failed\n", @@ -305,6 +313,7 @@ static void delayedwork_callback(struct work_struct *work) struct dj_report dj_report; unsigned long flags; int count; + int retval; dbg_hid("%s\n", __func__); @@ -337,6 +346,25 @@ static void delayedwork_callback(struct work_struct *work) logi_dj_recv_destroy_djhid_device(djrcv_dev, &dj_report); break; default: + /* A normal report (i. e. not belonging to a pair/unpair notification) + * arriving here, means that the report arrived but we did not have a + * paired dj_device associated to the report's device_index, this + * means that the original "device paired" notification corresponding + * to this dj_device never arrived to this driver. The reason is that + * hid-core discards all packets coming from a device while probe() is + * executing. */ + if (!djrcv_dev->paired_dj_devices[dj_report.device_index]) { + /* ok, we don't know the device, just re-ask the + * receiver for the list of connected devices. */ + retval = logi_dj_recv_query_paired_devices(djrcv_dev); + if (!retval) { + /* everything went fine, so just leave */ + break; + } + dev_err(&djrcv_dev->hdev->dev, + "%s:logi_dj_recv_query_paired_devices " + "error:%d\n", __func__, retval); + } dbg_hid("%s: unexpected report type\n", __func__); } } @@ -367,6 +395,12 @@ static void logi_dj_recv_forward_null_report(struct dj_receiver_dev *djrcv_dev, if (!djdev) { dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" " is NULL, index %d\n", dj_report->device_index); + kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report)); + + if (schedule_work(&djrcv_dev->work) == 0) { + dbg_hid("%s: did not schedule the work item, was already " + "queued\n", __func__); + } return; } @@ -397,6 +431,12 @@ static void logi_dj_recv_forward_report(struct dj_receiver_dev *djrcv_dev, if (dj_device == NULL) { dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" " is NULL, index %d\n", dj_report->device_index); + kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report)); + + if (schedule_work(&djrcv_dev->work) == 0) { + dbg_hid("%s: did not schedule the work item, was already " + "queued\n", __func__); + } return; } @@ -444,6 +484,10 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) struct dj_report *dj_report; int retval; + /* no need to protect djrcv_dev->querying_devices */ + if (djrcv_dev->querying_devices) + return 0; + dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); if (!dj_report) return -ENOMEM; @@ -455,6 +499,7 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) return retval; } + static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, unsigned timeout) { diff --git a/drivers/hid/hid-logitech-dj.h b/drivers/hid/hid-logitech-dj.h index fd28a5e0ca3b..4a4000340ce1 100644 --- a/drivers/hid/hid-logitech-dj.h +++ b/drivers/hid/hid-logitech-dj.h @@ -101,6 +101,7 @@ struct dj_receiver_dev { struct work_struct work; struct kfifo notif_fifo; spinlock_t lock; + bool querying_devices; }; struct dj_device { From 407a2c2a4d85100c8c67953e4bac2f4a6c942335 Mon Sep 17 00:00:00 2001 From: Nestor Lopez Casado <nlopezcasad@logitech.com> Date: Thu, 18 Jul 2013 06:21:31 -0700 Subject: [PATCH 320/913] HID: hid-logitech-dj: querying_devices was never set Set querying_devices flag to true when we start the enumeration process. This was missing from the original patch. It never produced undesirable effects as it is highly improbable to have a second enumeration triggered while a first one was still in progress. Signed-off-by: Nestor Lopez Casado <nlopezcasad@logitech.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> --- drivers/hid/hid-logitech-dj.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index cd33084c7860..7a5764843bfb 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c @@ -488,6 +488,8 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) if (djrcv_dev->querying_devices) return 0; + djrcv_dev->querying_devices = true; + dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); if (!dj_report) return -ENOMEM; From ab8d46c0609843a83aef3f486365ca5e7c21d537 Mon Sep 17 00:00:00 2001 From: Tetsuyuki Kobayashi <koba@kmckk.co.jp> Date: Mon, 22 Jul 2013 14:58:17 +0100 Subject: [PATCH 321/913] ARM: 7788/1: elf: fix lpae hwcap feature reporting in proc/cpuinfo Commit a469abd0f868 ("ARM: elf: add new hwcap for identifying atomic ldrd/strd instructions") added a new hwcap to identify LPAE on CPUs which support it. Whilst the hwcap data is correct, the string reported in /proc/cpuinfo actually matches on HWCAP_VFPD32, which was missing an entry in the string table. This patch fixes this problem by adding a "vfpd32" string at the correct offset, preventing us from falsely advertising LPAE on CPUs which do not support it. [will: added commit message] Acked-by: Will Deacon <will.deacon@arm.com> Tested-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/kernel/setup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 63af9a7ae512..96286cb383bd 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -971,6 +971,7 @@ static const char *hwcap_str[] = { "vfpv4", "idiva", "idivt", + "vfpd32", "lpae", NULL }; From 90625070c4253377025878c4e82feed8b35c7116 Mon Sep 17 00:00:00 2001 From: Luiz Angelo Daros de Luca <luizluca@gmail.com> Date: Mon, 1 Jul 2013 23:56:25 -0300 Subject: [PATCH 322/913] usb: serial: cp210x: Add USB ID for Netgear Switches embedded serial adapter This adds NetGear Managed Switch M4100 series, M5300 series, M7100 series USB ID (0846:0110) to the cp210x driver. Without this, the serial adapter is not recognized in Linux. Description was obtained from an Netgear Eng. Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index d6ef2f8da37d..55852fe13218 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -53,6 +53,7 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ { USB_DEVICE(0x0489, 0xE003) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ { USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */ + { USB_DEVICE(0x0846, 0x1100) }, /* NetGear Managed Switch M4100 series, M5300 series, M7100 series */ { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */ { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */ From e7a6121f4929c17215f0cdca3726f4bf3e4e9529 Mon Sep 17 00:00:00 2001 From: Ren Bigcren <bigcren.ren@sonymobile.com> Date: Tue, 2 Jul 2013 13:34:30 +0200 Subject: [PATCH 323/913] USB: storage: Add MicroVault Flash Drive to unusual_devs The device report an error capacity when read_capacity_16(). Using read_capacity_10() can get the correct capacity. Signed-off-by: Ren Bigcren <bigcren.ren@sonymobile.com> Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net> Signed-off-by: Oskar Andero <oskar.andero@sonymobile.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/storage/unusual_devs.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 1799335288bd..c015f2c16729 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -665,6 +665,13 @@ UNUSUAL_DEV( 0x054c, 0x016a, 0x0000, 0x9999, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_INQUIRY ), +/* Submitted by Ren Bigcren <bigcren.ren@sonymobile.com> */ +UNUSUAL_DEV( 0x054c, 0x02a5, 0x0100, 0x0100, + "Sony Corp.", + "MicroVault Flash Drive", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_NO_READ_CAPACITY_16 ), + /* floppy reports multiple luns */ UNUSUAL_DEV( 0x055d, 0x2020, 0x0000, 0x0210, "SAMSUNG", From 58fc90db8261b571c026bb8bf23aad48a7233118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3hann=20B=2E=20Gu=C3=B0mundsson?= <johannbg@gmail.com> Date: Thu, 4 Jul 2013 21:47:52 +0000 Subject: [PATCH 324/913] USB: misc: Add Manhattan Hi-Speed USB DVI Converter to sisusbvga MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jóhann B. Guðmundsson <johannbg@fedoraproject.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/misc/sisusbvga/sisusb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index c21386ec5d35..de98906f786d 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c @@ -3247,6 +3247,7 @@ static const struct usb_device_id sisusb_table[] = { { USB_DEVICE(0x0711, 0x0903) }, { USB_DEVICE(0x0711, 0x0918) }, { USB_DEVICE(0x0711, 0x0920) }, + { USB_DEVICE(0x0711, 0x0950) }, { USB_DEVICE(0x182d, 0x021c) }, { USB_DEVICE(0x182d, 0x0269) }, { } From c38e83b6cc2adf80e3f091fd92cfbeacc9748347 Mon Sep 17 00:00:00 2001 From: Daniil Bolsun <dan.bolsun@gmail.com> Date: Fri, 19 Jul 2013 10:21:23 +0300 Subject: [PATCH 325/913] USB: option: append Petatel NP10T device to GSM modems list This patch was tested on 3.10.1 kernel. Same models of Petatel NP10T modems have different device IDs. Unfortunately they have no additional revision information on a board which may treat them as different devices. Currently I've seen only two NP10T devices with various IDs. Possibly Petatel NP10T list will be appended upon devices with new IDs will appear. Signed-off-by: Daniil Bolsun <dan.bolsun@gmail.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/option.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 5dd857de05b0..418746b557ad 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -444,7 +444,8 @@ static void option_instat_callback(struct urb *urb); /* Hyundai Petatel Inc. products */ #define PETATEL_VENDOR_ID 0x1ff4 -#define PETATEL_PRODUCT_NP10T 0x600e +#define PETATEL_PRODUCT_NP10T_600A 0x600a +#define PETATEL_PRODUCT_NP10T_600E 0x600e /* TP-LINK Incorporated products */ #define TPLINK_VENDOR_ID 0x2357 @@ -1329,7 +1330,8 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x02, 0x01) }, { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) }, { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, - { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) }, + { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600A) }, + { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600E) }, { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180), .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE(CHANGHONG_VENDOR_ID, CHANGHONG_PRODUCT_CH690) }, From b579fa52f6be0b4157ca9cc5e94d44a2c89a7e95 Mon Sep 17 00:00:00 2001 From: Barry Grussling <barry@grussling.com> Date: Fri, 19 Jul 2013 14:46:12 -0700 Subject: [PATCH 326/913] usb: cp210x support SEL C662 Vendor/Device This patch adds support for the Schweitzer Engineering Laboratories C662 USB cable based off the CP210x driver. Signed-off-by: Barry Grussling <barry@grussling.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 55852fe13218..f68024ba726a 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -149,6 +149,7 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ + { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ From 7681156982026ebf7eafd7301eb0374d7648d068 Mon Sep 17 00:00:00 2001 From: Sami Rahman <sami.rahman@mmbresearch.com> Date: Mon, 8 Jul 2013 14:28:55 -0400 Subject: [PATCH 327/913] USB: cp210x: add MMB and PI ZigBee USB Device Support Added support for MMB Networks and Planet Innovation Ingeni ZigBee USB devices using customized Silicon Labs' CP210x.c USB to UART bridge drivers with PIDs: 88A4, 88A5. Signed-off-by: Sami Rahman <sami.rahman@mmbresearch.com> Tested-by: Sami Rahman <sami.rahman@mmbresearch.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/cp210x.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index f68024ba726a..0eae4ba3760e 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -119,6 +119,8 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ + { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ + { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ From 47a64a13d54f6c669b00542848d5550be3d3310e Mon Sep 17 00:00:00 2001 From: Roger Quadros <rogerq@ti.com> Date: Tue, 9 Jul 2013 17:03:50 +0300 Subject: [PATCH 328/913] USB: EHCI: Fix resume signalling on remote wakeup Set the ehci->resuming flag for the port we receive a remote wakeup on so that resume signalling can be completed. Without this, the root hub timer will not fire again to check if the resume was completed and there will be a never-ending wait on on the port. This effect is only observed if the HUB IRQ IN does not come after we have initiated the port resume. Signed-off-by: Roger Quadros <rogerq@ti.com> Cc: stable <stable@vger.kernel.org> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/host/ehci-hub.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 2b702772d04d..6dce37555c4f 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -874,6 +874,7 @@ static int ehci_hub_control ( ehci->reset_done[wIndex] = jiffies + msecs_to_jiffies(20); usb_hcd_start_port_resume(&hcd->self, wIndex); + set_bit(wIndex, &ehci->resuming_ports); /* check the port again */ mod_timer(&ehci_to_hcd(ehci)->rh_timer, ehci->reset_done[wIndex]); From a0062d4e3a0a9cf3ba6a91bca7e66ec89defc228 Mon Sep 17 00:00:00 2001 From: Grant Likely <grant.likely@linaro.org> Date: Thu, 11 Jul 2013 11:34:12 +0100 Subject: [PATCH 329/913] MAINTAINERS: Remove Grant Likely Unfortunately, I'm no longer to spend the time needed on maintainership. It is time for me to step aside and pass maintainership to other engineers. I'm not disappearing from Linux development, but it would be irresponsible for me to hold onto a job that I am unable to do. v2: Leave my name on devicetree core code maintainership. Rob NAKed that part of the patch. :) Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Linux Walleij <linus.walleij@linaro.org> Cc: Mark Brown <broonie@kernel.org> Cc: Rob Herring <rob.herring@calxeda.com> --- MAINTAINERS | 5 ----- 1 file changed, 5 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index bf61e04291ab..844d7e81b018 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3622,11 +3622,9 @@ F: drivers/isdn/gigaset/ F: include/uapi/linux/gigaset_dev.h GPIO SUBSYSTEM -M: Grant Likely <grant.likely@linaro.org> M: Linus Walleij <linus.walleij@linaro.org> S: Maintained L: linux-gpio@vger.kernel.org -T: git git://git.secretlab.ca/git/linux-2.6.git F: Documentation/gpio.txt F: drivers/gpio/ F: include/linux/gpio* @@ -4472,8 +4470,6 @@ F: drivers/irqchip/ IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY) M: Benjamin Herrenschmidt <benh@kernel.crashing.org> -M: Grant Likely <grant.likely@linaro.org> -T: git git://git.secretlab.ca/git/linux-2.6.git irqdomain/next S: Maintained F: Documentation/IRQ-domain.txt F: include/linux/irqdomain.h @@ -7746,7 +7742,6 @@ F: drivers/clk/spear/ SPI SUBSYSTEM M: Mark Brown <broonie@kernel.org> -M: Grant Likely <grant.likely@linaro.org> L: linux-spi@vger.kernel.org T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git Q: http://patchwork.kernel.org/project/spi-devel-general/list/ From d0fb18c5c0caf2ed0eecf3d0145450ae708ed75a Mon Sep 17 00:00:00 2001 From: Grant Likely <grant.likely@linaro.org> Date: Fri, 19 Jul 2013 20:10:12 -0700 Subject: [PATCH 330/913] MAINTAINERS: Change device tree mailing list New list on vger.kernel.org. The old list was a pain to moderate. Signed-off-by: Grant Likely <grant.likely@linaro.org> --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 844d7e81b018..bc286e44b575 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5882,7 +5882,7 @@ OMAP DEVICE TREE SUPPORT M: Benoît Cousson <b-cousson@ti.com> M: Tony Lindgren <tony@atomide.com> L: linux-omap@vger.kernel.org -L: devicetree-discuss@lists.ozlabs.org (moderated for non-subscribers) +L: devicetree@vger.kernel.org S: Maintained F: arch/arm/boot/dts/*omap* F: arch/arm/boot/dts/*am3* @@ -6046,7 +6046,7 @@ F: drivers/i2c/busses/i2c-ocores.c OPEN FIRMWARE AND FLATTENED DEVICE TREE M: Grant Likely <grant.likely@linaro.org> M: Rob Herring <rob.herring@calxeda.com> -L: devicetree-discuss@lists.ozlabs.org (moderated for non-subscribers) +L: devicetree@vger.kernel.org W: http://fdt.secretlab.ca T: git git://git.secretlab.ca/git/linux-2.6.git S: Maintained From f882820556af33b5aee5b9f0ba459620a9ab1c22 Mon Sep 17 00:00:00 2001 From: Grant Likely <grant.likely@linaro.org> Date: Fri, 19 Jul 2013 18:57:39 -0700 Subject: [PATCH 331/913] MAINTAINERS: Refactor device tree maintainership Device tree bindings require a lot more attention than they used to. We've got a group of volunteers willing to take over maintaining bindings. This patch adds them to the MAINTAINERS file. This group still needs to work out a process for maintainership and how they are going to work together. I recommend that they set up a shared tree on git.kernel.org that they each have commit access to similar to the tip tree or the arm-soc tree, but it is up to them. Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Pawel Moll <pawel.moll@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Stephen Warren <swarren@wwwdotorg.org> Cc: Ian Campbell <ian.campbell@citrix.com> Cc: Rob Herring <rob.herring@calxeda.com> Acked-by: Olof Johansson <olof@lixom.net> Acked-by: Linus Walleij <linus.walleij@linaro.org> --- MAINTAINERS | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index bc286e44b575..02064ac6b75e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6050,13 +6050,24 @@ L: devicetree@vger.kernel.org W: http://fdt.secretlab.ca T: git git://git.secretlab.ca/git/linux-2.6.git S: Maintained -F: Documentation/devicetree -F: drivers/of +F: drivers/of/ F: include/linux/of*.h -F: scripts/dtc +F: scripts/dtc/ K: of_get_property K: of_match_table +OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS +M: Rob Herring <rob.herring@calxeda.com> +M: Pawel Moll <pawel.moll@arm.com> +M: Mark Rutland <mark.rutland@arm.com> +M: Stephen Warren <swarren@wwwdotorg.org> +M: Ian Campbell <ian.campbell@citrix.com> +L: devicetree@vger.kernel.org +S: Maintained +F: Documentation/devicetree/ +F: arch/*/boot/dts/ +F: include/dt-bindings/ + OPENRISC ARCHITECTURE M: Jonas Bonn <jonas@southpole.se> W: http://openrisc.net From cdeb89943bfc301aa5711cbb5edc2c86e6630dab Mon Sep 17 00:00:00 2001 From: Grant Likely <grant.likely@linaro.org> Date: Mon, 22 Jul 2013 01:38:32 +0100 Subject: [PATCH 332/913] MAINTAINERS: Fix incorrect status tag When I removed myself from the xilinx drivers I used the wrong tag. Fix it. Signed-off-by: Grant Likely <grant.likely@linaro.org> --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 02064ac6b75e..ece549058c3f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4986,7 +4986,7 @@ F: arch/powerpc/platforms/44x/ LINUX FOR POWERPC EMBEDDED XILINX VIRTEX L: linuxppc-dev@lists.ozlabs.org -S: Unmaintained +S: Orphan F: arch/powerpc/*/*virtex* F: arch/powerpc/*/*/*virtex* @@ -9294,7 +9294,7 @@ S: Maintained F: drivers/net/ethernet/xilinx/xilinx_axienet* XILINX SYSTEMACE DRIVER -S: Unmaintained +S: Orphan F: drivers/block/xsysace.c XILINX UARTLITE SERIAL DRIVER From 7d4ddbaa1466f0c06bbca8ad702f4f4b313b8f33 Mon Sep 17 00:00:00 2001 From: Gabor Juhos <juhosg@openwrt.org> Date: Wed, 1 May 2013 10:53:54 +0200 Subject: [PATCH 333/913] of: add vendor prefix for Qualcomm Atheros, Inc. This prefix will be used in various compatible properties for the devices from Qualcomm Atheros, Inc. Cc: Luis R. Rodriguez <rodrigue@qca.qualcomm.com> Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Grant Likely <grant.likely@linaro.org> --- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index d5a79caec147..1e4aa2e2b617 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -43,6 +43,7 @@ nxp NXP Semiconductors onnn ON Semiconductor Corp. picochip Picochip Ltd powervr PowerVR (deprecated, use img) +qca Qualcomm Atheros, Inc. qcom Qualcomm, Inc. ralink Mediatek/Ralink Technology Corp. ramtron Ramtron International From cfd1ee3e37360ac6ec8c737e63e70c5d583f1e51 Mon Sep 17 00:00:00 2001 From: Zhangfei Gao <zhangfei.gao@linaro.org> Date: Mon, 17 Jun 2013 13:04:59 +0800 Subject: [PATCH 334/913] of: add vendor prefixes for hisilicon Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org> Signed-off-by: Grant Likely <grant.likely@linaro.org> --- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 1e4aa2e2b617..366ce9b87240 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -26,6 +26,7 @@ est ESTeem Wireless Modems fsl Freescale Semiconductor GEFanuc GE Fanuc Intelligent Platforms Embedded Systems, Inc. gef GE Fanuc Intelligent Platforms Embedded Systems, Inc. +hisilicon Hisilicon Limited. hp Hewlett Packard ibm International Business Machines (IBM) idt Integrated Device Technologies, Inc. From c0cdfaa0a5e7a346ac2f661f63f543cdc5f7cbbe Mon Sep 17 00:00:00 2001 From: Axel Lin <axel.lin@ingics.com> Date: Sun, 23 Jun 2013 15:50:07 +0800 Subject: [PATCH 335/913] of/irq: Avoid calling list_first_entry() for empty list list_first_entry() expects the list is not empty, we need to check if list is empty before calling list_first_entry(). Thus use list_first_entry_or_null() instead of list_first_entry(). Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> --- drivers/of/irq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index a3c1c5aae6a9..5c645c7227b8 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -482,8 +482,9 @@ void __init of_irq_init(const struct of_device_id *matches) } /* Get the next pending parent that might have children */ - desc = list_first_entry(&intc_parent_list, typeof(*desc), list); - if (list_empty(&intc_parent_list) || !desc) { + desc = list_first_entry_or_null(&intc_parent_list, + typeof(*desc), list); + if (!desc) { pr_err("of_irq_init: children remain, but no parents\n"); break; } From cf9e2368655d86cd800e4d9fe65a407b39d29373 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Date: Thu, 18 Jul 2013 12:24:10 +0200 Subject: [PATCH 336/913] of/irq: init struct resource to 0 in of_irq_to_resource() It almost does not matter because most users use only the ->start member of the struct. However if this struct is passed to a platform device which is then added via platform_device_add() then the ->parent member is also used. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Grant Likely <grant.likely@linaro.org> --- drivers/of/irq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 5c645c7227b8..1264923ade0f 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -345,6 +345,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) if (r && irq) { const char *name = NULL; + memset(r, 0, sizeof(*r)); /* * Get optional "interrupts-names" property to add a name * to the resource. From 74b843512906e60be24ed6aafa2fa2876f294fab Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Date: Tue, 9 Jul 2013 16:27:24 +0200 Subject: [PATCH 337/913] pinctrl: sh-pfc: fix SDHI0 VccQ regulator on sh73a0 with DT The PFC pinctrl driver on sh73a0 is also regiatering a VccQ regulator for SDHI0. However, its consumers list only included the platform-data based SDHI device name. When booted with DT SDHI0 couldn't enable VccQ and therefore was unusable. Fix this by adding a consumer with DT-based name. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Acked-by: Simon Horman <horms+renesas@verge.net.au> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/pinctrl/sh-pfc/pfc-sh73a0.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c index 7956df58d751..31f7d0e04aaa 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c @@ -3785,6 +3785,7 @@ static const struct regulator_desc sh73a0_vccq_mc0_desc = { static struct regulator_consumer_supply sh73a0_vccq_mc0_consumers[] = { REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), + REGULATOR_SUPPLY("vqmmc", "ee100000.sdhi"), }; static const struct regulator_init_data sh73a0_vccq_mc0_init_data = { From 745a39a9e6b2901cd341af01fc9bac78a9649e23 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Thu, 18 Jul 2013 09:24:37 -0400 Subject: [PATCH 338/913] drm/radeon: wait for 3D idle before using CP DMA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure the 3D engine is idle before using CP DMA for bo copies. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: Marek Olšák <maraeo@gmail.com> --- drivers/gpu/drm/radeon/r600.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 393880a09412..10f712e37003 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -3166,7 +3166,7 @@ int r600_copy_cpdma(struct radeon_device *rdev, size_in_bytes = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT); num_loops = DIV_ROUND_UP(size_in_bytes, 0x1fffff); - r = radeon_ring_lock(rdev, ring, num_loops * 6 + 21); + r = radeon_ring_lock(rdev, ring, num_loops * 6 + 24); if (r) { DRM_ERROR("radeon: moving bo (%d).\n", r); radeon_semaphore_free(rdev, &sem, NULL); @@ -3181,6 +3181,9 @@ int r600_copy_cpdma(struct radeon_device *rdev, radeon_semaphore_free(rdev, &sem, NULL); } + radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1)); + radeon_ring_write(ring, (WAIT_UNTIL - PACKET3_SET_CONFIG_REG_OFFSET) >> 2); + radeon_ring_write(ring, WAIT_3D_IDLE_bit); for (i = 0; i < num_loops; i++) { cur_size_in_bytes = size_in_bytes; if (cur_size_in_bytes > 0x1fffff) From 3e3e53f86bee87bb14474213c879595605e35112 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Thu, 18 Jul 2013 13:11:56 -0400 Subject: [PATCH 339/913] drm/radeon/vm: only align the pt base to 32k fixes: https://bugs.freedesktop.org/show_bug.cgi?id=67016 Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org --- drivers/gpu/drm/radeon/radeon_gart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index d9d31a383276..6a51d943ccf4 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c @@ -466,7 +466,7 @@ int radeon_vm_manager_init(struct radeon_device *rdev) size += rdev->vm_manager.max_pfn * 8; size *= 2; r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager, - RADEON_VM_PTB_ALIGN(size), + RADEON_GPU_PAGE_ALIGN(size), RADEON_VM_PTB_ALIGN_SIZE, RADEON_GEM_DOMAIN_VRAM); if (r) { @@ -621,7 +621,7 @@ int radeon_vm_alloc_pt(struct radeon_device *rdev, struct radeon_vm *vm) } retry: - pd_size = RADEON_VM_PTB_ALIGN(radeon_vm_directory_size(rdev)); + pd_size = radeon_vm_directory_size(rdev); r = radeon_sa_bo_new(rdev, &rdev->vm_manager.sa_manager, &vm->page_directory, pd_size, RADEON_VM_PTB_ALIGN_SIZE, false); @@ -953,8 +953,8 @@ static int radeon_vm_update_pdes(struct radeon_device *rdev, retry: r = radeon_sa_bo_new(rdev, &rdev->vm_manager.sa_manager, &vm->page_tables[pt_idx], - RADEON_VM_PTB_ALIGN(RADEON_VM_PTE_COUNT * 8), - RADEON_VM_PTB_ALIGN_SIZE, false); + RADEON_VM_PTE_COUNT * 8, + RADEON_GPU_PAGE_SIZE, false); if (r == -ENOMEM) { r = radeon_vm_evict(rdev, vm); From 34be8c9af7b8728465963740fc11136ae90dfc36 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Thu, 18 Jul 2013 11:13:53 -0400 Subject: [PATCH 340/913] drm/radeon: fix endian issues with DP handling (v3) The atom interpreter expects data in LE format, so swap the message buffer as apprioriate. v2: properly handle non-dw aligned byte counts. v3: properly handle remainder Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: Dong He <hedonghust@gmail.com> Cc: stable@vger.kernel.org --- drivers/gpu/drm/radeon/atombios_dp.c | 43 +++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 064023bed480..32501f6ec991 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c @@ -44,6 +44,41 @@ static char *pre_emph_names[] = { }; /***** radeon AUX functions *****/ + +/* Atom needs data in little endian format + * so swap as appropriate when copying data to + * or from atom. Note that atom operates on + * dw units. + */ +static void radeon_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le) +{ +#ifdef __BIG_ENDIAN + u8 src_tmp[20], dst_tmp[20]; /* used for byteswapping */ + u32 *dst32, *src32; + int i; + + memcpy(src_tmp, src, num_bytes); + src32 = (u32 *)src_tmp; + dst32 = (u32 *)dst_tmp; + if (to_le) { + for (i = 0; i < ((num_bytes + 3) / 4); i++) + dst32[i] = cpu_to_le32(src32[i]); + memcpy(dst, dst_tmp, num_bytes); + } else { + u8 dws = num_bytes & ~3; + for (i = 0; i < ((num_bytes + 3) / 4); i++) + dst32[i] = le32_to_cpu(src32[i]); + memcpy(dst, dst_tmp, dws); + if (num_bytes % 4) { + for (i = 0; i < (num_bytes % 4); i++) + dst[dws+i] = dst_tmp[dws+i]; + } + } +#else + memcpy(dst, src, num_bytes); +#endif +} + union aux_channel_transaction { PROCESS_AUX_CHANNEL_TRANSACTION_PS_ALLOCATION v1; PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS_V2 v2; @@ -65,10 +100,10 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan, base = (unsigned char *)(rdev->mode_info.atom_context->scratch + 1); - memcpy(base, send, send_bytes); + radeon_copy_swap(base, send, send_bytes, true); - args.v1.lpAuxRequest = 0 + 4; - args.v1.lpDataOut = 16 + 4; + args.v1.lpAuxRequest = cpu_to_le16((u16)(0 + 4)); + args.v1.lpDataOut = cpu_to_le16((u16)(16 + 4)); args.v1.ucDataOutLen = 0; args.v1.ucChannelID = chan->rec.i2c_id; args.v1.ucDelay = delay / 10; @@ -102,7 +137,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan, recv_bytes = recv_size; if (recv && recv_size) - memcpy(recv, base + 16, recv_bytes); + radeon_copy_swap(recv, base + 16, recv_bytes, false); return recv_bytes; } From f7929f34fa0e0bb6736a2484fdc07d77a1653081 Mon Sep 17 00:00:00 2001 From: Ondrej Zary <linux@rainbow-software.org> Date: Fri, 19 Jul 2013 21:08:48 +0200 Subject: [PATCH 341/913] drm/radeon: Another card with wrong primary dac adj Hello, got another card with "too bright" problem: Sapphire Radeon VE 7000 DDR (VGA+S-Video) lspci -vnn: 01:00.0 VGA compatible controller [0300]: Advanced Micro Devices [AMD] nee ATI RV100 QY [Radeon 7000/VE] [1002:5159] (prog-if 00 [VGA controller]) Subsystem: PC Partner Limited Sapphire Radeon VE 7000 DDR [174b:7c28] The patch below fixes the problem for this card. But I don't like the blacklist, couldn't some heuristic be used instead? The interesting thing is that the manufacturer is the same as the other card needing the same quirk. I wonder how many different types are broken this way. The "wrong" ps2_pdac_adj value that comes from BIOS on this card is 0x300. ==================== drm/radeon: Add primary dac adj quirk for Sapphire Radeon VE 7000 DDR Values from BIOS are wrong, causing too bright colors. Use default values instead. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org --- drivers/gpu/drm/radeon/radeon_combios.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 78edadc9e86b..8528b81cd64f 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c @@ -971,10 +971,14 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct } /* quirks */ - /* Radeon 9100 (R200) */ - if ((dev->pdev->device == 0x514D) && + /* Radeon 7000 (RV100) */ + if (((dev->pdev->device == 0x5159) && (dev->pdev->subsystem_vendor == 0x174B) && - (dev->pdev->subsystem_device == 0x7149)) { + (dev->pdev->subsystem_device == 0x7c28)) || + /* Radeon 9100 (R200) */ + ((dev->pdev->device == 0x514D) && + (dev->pdev->subsystem_vendor == 0x174B) && + (dev->pdev->subsystem_device == 0x7149))) { /* vbios value is bad, use the default */ found = 0; } From 03ed8cf9b28d886c64c7e705c7bb1a365fd8fb95 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Fri, 19 Jul 2013 17:44:43 -0400 Subject: [PATCH 342/913] drm/radeon: improve dac adjust heuristics for legacy pdac Hopefully avoid more quirks in the future due to bogus vbios dac data. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org --- drivers/gpu/drm/radeon/radeon_combios.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 8528b81cd64f..485f82c9929d 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c @@ -965,8 +965,10 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct dac = RBIOS8(dac_info + 0x3) & 0xf; p_dac->ps2_pdac_adj = (bg << 8) | (dac); } - /* if the values are all zeros, use the table */ - if (p_dac->ps2_pdac_adj) + /* if the values are zeros, use the table */ + if ((dac == 0) || (bg == 0)) + found = 0; + else found = 1; } From cef1d00cd56f600121ad121875655ad410a001b8 Mon Sep 17 00:00:00 2001 From: Mark Kettenis <kettenis@openbsd.org> Date: Sun, 21 Jul 2013 16:44:09 -0400 Subject: [PATCH 343/913] drm/radeon: fix combios tables on older cards Noticed that my old Radeon 7500 hung after printing drm: GPU not posted. posting now... when it wasn't selected as the primary card the BIOS. Some digging revealed that it was hanging in combios_parse_mmio_table() while parsing the ASIC INIT 3 table. Looking at the BIOS ROM for the card, it becomes obvious that there is no ASIC INIT 3 table in the BIOS. The code is just processing random garbage. No surprise it hangs! Why do I say that there is no ASIC INIT 3 table is the BIOS? This table is found through the MISC INFO table. The MISC INFO table can be found at offset 0x5e in the COMBIOS header. But the header is smaller than that. The COMBIOS header starts at offset 0x126. The standard PCI Data Structure (the bit that starts with 'PCIR') lives at offset 0x180. That means that the COMBIOS header can not be larger than 0x5a bytes and therefore cannot contain a MISC INFO table. I looked at a dozen or so BIOS images, some my own, some downloaded from: <http://www.techpowerup.com/vgabios/index.php?manufacturer=ATI&page=1> It is fairly obvious that the size of the COMBIOS header can be found at offset 0x6 of the header. Not sure if it is a 16-bit number or just an 8-bit number, but that doesn't really matter since the tables seems to be always smaller than 256 bytes. So I think combios_get_table_offset() should check if the requested table is present. This can be done by checking the offset against the size of the header. See the diff below. The diff is against the WIP OpenBSD codebase that roughly corresponds to Linux 3.8.13 at this point. But I don't think this bit of the code changed much since then. For what it is worth: Signed-off-by: Mark Kettenis <kettenis@openbsd.org> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org --- drivers/gpu/drm/radeon/radeon_combios.c | 145 +++++++----------------- 1 file changed, 41 insertions(+), 104 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 485f82c9929d..68ce36056019 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c @@ -147,7 +147,7 @@ static uint16_t combios_get_table_offset(struct drm_device *dev, enum radeon_combios_table_offset table) { struct radeon_device *rdev = dev->dev_private; - int rev; + int rev, size; uint16_t offset = 0, check_offset; if (!rdev->bios) @@ -156,174 +156,106 @@ static uint16_t combios_get_table_offset(struct drm_device *dev, switch (table) { /* absolute offset tables */ case COMBIOS_ASIC_INIT_1_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0xc); - if (check_offset) - offset = check_offset; + check_offset = 0xc; break; case COMBIOS_BIOS_SUPPORT_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x14); - if (check_offset) - offset = check_offset; + check_offset = 0x14; break; case COMBIOS_DAC_PROGRAMMING_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x2a); - if (check_offset) - offset = check_offset; + check_offset = 0x2a; break; case COMBIOS_MAX_COLOR_DEPTH_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x2c); - if (check_offset) - offset = check_offset; + check_offset = 0x2c; break; case COMBIOS_CRTC_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x2e); - if (check_offset) - offset = check_offset; + check_offset = 0x2e; break; case COMBIOS_PLL_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x30); - if (check_offset) - offset = check_offset; + check_offset = 0x30; break; case COMBIOS_TV_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x32); - if (check_offset) - offset = check_offset; + check_offset = 0x32; break; case COMBIOS_DFP_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x34); - if (check_offset) - offset = check_offset; + check_offset = 0x34; break; case COMBIOS_HW_CONFIG_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x36); - if (check_offset) - offset = check_offset; + check_offset = 0x36; break; case COMBIOS_MULTIMEDIA_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x38); - if (check_offset) - offset = check_offset; + check_offset = 0x38; break; case COMBIOS_TV_STD_PATCH_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x3e); - if (check_offset) - offset = check_offset; + check_offset = 0x3e; break; case COMBIOS_LCD_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x40); - if (check_offset) - offset = check_offset; + check_offset = 0x40; break; case COMBIOS_MOBILE_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x42); - if (check_offset) - offset = check_offset; + check_offset = 0x42; break; case COMBIOS_PLL_INIT_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x46); - if (check_offset) - offset = check_offset; + check_offset = 0x46; break; case COMBIOS_MEM_CONFIG_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x48); - if (check_offset) - offset = check_offset; + check_offset = 0x48; break; case COMBIOS_SAVE_MASK_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x4a); - if (check_offset) - offset = check_offset; + check_offset = 0x4a; break; case COMBIOS_HARDCODED_EDID_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x4c); - if (check_offset) - offset = check_offset; + check_offset = 0x4c; break; case COMBIOS_ASIC_INIT_2_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x4e); - if (check_offset) - offset = check_offset; + check_offset = 0x4e; break; case COMBIOS_CONNECTOR_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x50); - if (check_offset) - offset = check_offset; + check_offset = 0x50; break; case COMBIOS_DYN_CLK_1_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x52); - if (check_offset) - offset = check_offset; + check_offset = 0x52; break; case COMBIOS_RESERVED_MEM_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x54); - if (check_offset) - offset = check_offset; + check_offset = 0x54; break; case COMBIOS_EXT_TMDS_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x58); - if (check_offset) - offset = check_offset; + check_offset = 0x58; break; case COMBIOS_MEM_CLK_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x5a); - if (check_offset) - offset = check_offset; + check_offset = 0x5a; break; case COMBIOS_EXT_DAC_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x5c); - if (check_offset) - offset = check_offset; + check_offset = 0x5c; break; case COMBIOS_MISC_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x5e); - if (check_offset) - offset = check_offset; + check_offset = 0x5e; break; case COMBIOS_CRT_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x60); - if (check_offset) - offset = check_offset; + check_offset = 0x60; break; case COMBIOS_INTEGRATED_SYSTEM_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x62); - if (check_offset) - offset = check_offset; + check_offset = 0x62; break; case COMBIOS_COMPONENT_VIDEO_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x64); - if (check_offset) - offset = check_offset; + check_offset = 0x64; break; case COMBIOS_FAN_SPEED_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x66); - if (check_offset) - offset = check_offset; + check_offset = 0x66; break; case COMBIOS_OVERDRIVE_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x68); - if (check_offset) - offset = check_offset; + check_offset = 0x68; break; case COMBIOS_OEM_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x6a); - if (check_offset) - offset = check_offset; + check_offset = 0x6a; break; case COMBIOS_DYN_CLK_2_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x6c); - if (check_offset) - offset = check_offset; + check_offset = 0x6c; break; case COMBIOS_POWER_CONNECTOR_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x6e); - if (check_offset) - offset = check_offset; + check_offset = 0x6e; break; case COMBIOS_I2C_INFO_TABLE: - check_offset = RBIOS16(rdev->bios_header_start + 0x70); - if (check_offset) - offset = check_offset; + check_offset = 0x70; break; /* relative offset tables */ case COMBIOS_ASIC_INIT_3_TABLE: /* offset from misc info */ @@ -439,11 +371,16 @@ static uint16_t combios_get_table_offset(struct drm_device *dev, } break; default: + check_offset = 0; break; } - return offset; + size = RBIOS8(rdev->bios_header_start + 0x6); + /* check absolute offset tables */ + if (table < COMBIOS_ASIC_INIT_3_TABLE && check_offset && check_offset < size) + offset = RBIOS16(rdev->bios_header_start + check_offset); + return offset; } bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev) From 232fde062e0a2cc52e8e18a50cda361b4ba88f34 Mon Sep 17 00:00:00 2001 From: Daniel Drake <dsd@laptop.org> Date: Sat, 13 Jul 2013 10:57:10 -0400 Subject: [PATCH 344/913] mwifiex: fix IRQ enable/disable During tear down (e.g. mwifiex_sdio_remove during system suspend), mwifiex left IRQs enabled for a significant period of time when it was unable to handle them correctly. This caused interrupt storms and interfered with the bluetooth interface on the same SDIO card. Solve this by disabling interrupts at the point when they can no longer be handled correctly, which is at the start of mwifiex_remove_card(). For cleanliness, we now enable interrupts in the mwifiex_add_card() path, to be symmetrical with the disabling of interrupts. We also couple the registration of the sdio IRQ handler with the actual enable/disable of interrupts at the hardware level. I also removed a write to this register in mwifiex_init_sdio which seemed pointless and won't cause any ill effects now that we only register the SDIO IRQ handler when we are ready to accept interrupts. Includes some corrections from Amitkumar Karwar. Signed-off-by: Daniel Drake <dsd@laptop.org> Acked-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/mwifiex/init.c | 10 +--- drivers/net/wireless/mwifiex/main.c | 13 ++++- drivers/net/wireless/mwifiex/main.h | 1 + drivers/net/wireless/mwifiex/sdio.c | 91 +++++++++++++---------------- drivers/net/wireless/mwifiex/sdio.h | 3 - 5 files changed, 57 insertions(+), 61 deletions(-) diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index caaf4bd56b30..2cf8b964e966 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c @@ -693,7 +693,7 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, if (!ret) { dev_notice(adapter->dev, "WLAN FW already running! Skip FW dnld\n"); - goto done; + return 0; } poll_num = MAX_FIRMWARE_POLL_TRIES; @@ -719,14 +719,8 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, poll_fw: /* Check if the firmware is downloaded successfully or not */ ret = adapter->if_ops.check_fw_status(adapter, poll_num); - if (ret) { + if (ret) dev_err(adapter->dev, "FW failed to be active in time\n"); - return -1; - } -done: - /* re-enable host interrupt for mwifiex after fw dnld is successful */ - if (adapter->if_ops.enable_int) - adapter->if_ops.enable_int(adapter); return ret; } diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index e15ab72fb03d..1753431de361 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c @@ -427,6 +427,10 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) "Cal data request_firmware() failed\n"); } + /* enable host interrupt after fw dnld is successful */ + if (adapter->if_ops.enable_int) + adapter->if_ops.enable_int(adapter); + adapter->init_wait_q_woken = false; ret = mwifiex_init_fw(adapter); if (ret == -1) { @@ -478,6 +482,8 @@ err_add_intf: mwifiex_del_virtual_intf(adapter->wiphy, priv->wdev); rtnl_unlock(); err_init_fw: + if (adapter->if_ops.disable_int) + adapter->if_ops.disable_int(adapter); pr_debug("info: %s: unregister device\n", __func__); adapter->if_ops.unregister_dev(adapter); done: @@ -855,7 +861,7 @@ mwifiex_add_card(void *card, struct semaphore *sem, INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); /* Register the device. Fill up the private data structure with relevant - information from the card and request for the required IRQ. */ + information from the card. */ if (adapter->if_ops.register_dev(adapter)) { pr_err("%s: failed to register mwifiex device\n", __func__); goto err_registerdev; @@ -919,6 +925,11 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) if (!adapter) goto exit_remove; + /* We can no longer handle interrupts once we start doing the teardown + * below. */ + if (adapter->if_ops.disable_int) + adapter->if_ops.disable_int(adapter); + adapter->surprise_removed = true; /* Stop data */ diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 3da73d36acdf..253e0bd38e25 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h @@ -601,6 +601,7 @@ struct mwifiex_if_ops { int (*register_dev) (struct mwifiex_adapter *); void (*unregister_dev) (struct mwifiex_adapter *); int (*enable_int) (struct mwifiex_adapter *); + void (*disable_int) (struct mwifiex_adapter *); int (*process_int_status) (struct mwifiex_adapter *); int (*host_to_card) (struct mwifiex_adapter *, u8, struct sk_buff *, struct mwifiex_tx_param *); diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c index 5ee5ed02eccd..5ef49f2e375a 100644 --- a/drivers/net/wireless/mwifiex/sdio.c +++ b/drivers/net/wireless/mwifiex/sdio.c @@ -51,6 +51,7 @@ static struct mwifiex_if_ops sdio_ops; static struct semaphore add_remove_card_sem; static int mwifiex_sdio_resume(struct device *dev); +static void mwifiex_sdio_interrupt(struct sdio_func *func); /* * SDIO probe. @@ -296,6 +297,15 @@ static struct sdio_driver mwifiex_sdio = { } }; +/* Write data into SDIO card register. Caller claims SDIO device. */ +static int +mwifiex_write_reg_locked(struct sdio_func *func, u32 reg, u8 data) +{ + int ret = -1; + sdio_writeb(func, data, reg, &ret); + return ret; +} + /* * This function writes data into SDIO card register. */ @@ -303,10 +313,10 @@ static int mwifiex_write_reg(struct mwifiex_adapter *adapter, u32 reg, u8 data) { struct sdio_mmc_card *card = adapter->card; - int ret = -1; + int ret; sdio_claim_host(card->func); - sdio_writeb(card->func, data, reg, &ret); + ret = mwifiex_write_reg_locked(card->func, reg, data); sdio_release_host(card->func); return ret; @@ -685,23 +695,15 @@ mwifiex_sdio_read_fw_status(struct mwifiex_adapter *adapter, u16 *dat) * The host interrupt mask is read, the disable bit is reset and * written back to the card host interrupt mask register. */ -static int mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter) +static void mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter) { - u8 host_int_mask, host_int_disable = HOST_INT_DISABLE; + struct sdio_mmc_card *card = adapter->card; + struct sdio_func *func = card->func; - /* Read back the host_int_mask register */ - if (mwifiex_read_reg(adapter, HOST_INT_MASK_REG, &host_int_mask)) - return -1; - - /* Update with the mask and write back to the register */ - host_int_mask &= ~host_int_disable; - - if (mwifiex_write_reg(adapter, HOST_INT_MASK_REG, host_int_mask)) { - dev_err(adapter->dev, "disable host interrupt failed\n"); - return -1; - } - - return 0; + sdio_claim_host(func); + mwifiex_write_reg_locked(func, HOST_INT_MASK_REG, 0); + sdio_release_irq(func); + sdio_release_host(func); } /* @@ -713,14 +715,29 @@ static int mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter) static int mwifiex_sdio_enable_host_int(struct mwifiex_adapter *adapter) { struct sdio_mmc_card *card = adapter->card; + struct sdio_func *func = card->func; + int ret; + + sdio_claim_host(func); + + /* Request the SDIO IRQ */ + ret = sdio_claim_irq(func, mwifiex_sdio_interrupt); + if (ret) { + dev_err(adapter->dev, "claim irq failed: ret=%d\n", ret); + goto out; + } /* Simply write the mask to the register */ - if (mwifiex_write_reg(adapter, HOST_INT_MASK_REG, - card->reg->host_int_enable)) { + ret = mwifiex_write_reg_locked(func, HOST_INT_MASK_REG, + card->reg->host_int_enable); + if (ret) { dev_err(adapter->dev, "enable host interrupt failed\n"); - return -1; + sdio_release_irq(func); } - return 0; + +out: + sdio_release_host(func); + return ret; } /* @@ -997,9 +1014,6 @@ mwifiex_sdio_interrupt(struct sdio_func *func) } adapter = card->adapter; - if (adapter->surprise_removed) - return; - if (!adapter->pps_uapsd_mode && adapter->ps_state == PS_STATE_SLEEP) adapter->ps_state = PS_STATE_AWAKE; @@ -1728,9 +1742,7 @@ mwifiex_unregister_dev(struct mwifiex_adapter *adapter) struct sdio_mmc_card *card = adapter->card; if (adapter->card) { - /* Release the SDIO IRQ */ sdio_claim_host(card->func); - sdio_release_irq(card->func); sdio_disable_func(card->func); sdio_release_host(card->func); sdio_set_drvdata(card->func, NULL); @@ -1744,7 +1756,7 @@ mwifiex_unregister_dev(struct mwifiex_adapter *adapter) */ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) { - int ret = 0; + int ret; struct sdio_mmc_card *card = adapter->card; struct sdio_func *func = card->func; @@ -1753,22 +1765,14 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) sdio_claim_host(func); - /* Request the SDIO IRQ */ - ret = sdio_claim_irq(func, mwifiex_sdio_interrupt); - if (ret) { - pr_err("claim irq failed: ret=%d\n", ret); - goto disable_func; - } - /* Set block size */ ret = sdio_set_block_size(card->func, MWIFIEX_SDIO_BLOCK_SIZE); + sdio_release_host(func); if (ret) { pr_err("cannot set SDIO block size\n"); - ret = -1; - goto release_irq; + return ret; } - sdio_release_host(func); sdio_set_drvdata(func, card); adapter->dev = &func->dev; @@ -1776,15 +1780,6 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) strcpy(adapter->fw_name, card->firmware); return 0; - -release_irq: - sdio_release_irq(func); -disable_func: - sdio_disable_func(func); - sdio_release_host(func); - adapter->card = NULL; - - return -1; } /* @@ -1813,9 +1808,6 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) */ mwifiex_read_reg(adapter, HOST_INTSTATUS_REG, &sdio_ireg); - /* Disable host interrupt mask register for SDIO */ - mwifiex_sdio_disable_host_int(adapter); - /* Get SDIO ioport */ mwifiex_init_sdio_ioport(adapter); @@ -1957,6 +1949,7 @@ static struct mwifiex_if_ops sdio_ops = { .register_dev = mwifiex_register_dev, .unregister_dev = mwifiex_unregister_dev, .enable_int = mwifiex_sdio_enable_host_int, + .disable_int = mwifiex_sdio_disable_host_int, .process_int_status = mwifiex_process_int_status, .host_to_card = mwifiex_sdio_host_to_card, .wakeup = mwifiex_pm_wakeup_card, diff --git a/drivers/net/wireless/mwifiex/sdio.h b/drivers/net/wireless/mwifiex/sdio.h index 6d51dfdd8251..532ae0ac4dfb 100644 --- a/drivers/net/wireless/mwifiex/sdio.h +++ b/drivers/net/wireless/mwifiex/sdio.h @@ -92,9 +92,6 @@ /* Host Control Registers : Download host interrupt mask */ #define DN_LD_HOST_INT_MASK (0x2U) -/* Disable Host interrupt mask */ -#define HOST_INT_DISABLE 0xff - /* Host Control Registers : Host interrupt status */ #define HOST_INTSTATUS_REG 0x03 /* Host Control Registers : Upload host interrupt status */ From dc2a87f519a4d8cb376ab54f22b6b98a943b51ce Mon Sep 17 00:00:00 2001 From: Oleksij Rempel <linux@rempel-privat.de> Date: Fri, 19 Jul 2013 20:16:17 +0200 Subject: [PATCH 345/913] ath9k_htc: do some initial hardware configuration Currently we configure harwdare and clock, only after interface start. In this case, if we reload module or reboot PC without configuring adapter, firmware will freeze. There is no software way to reset adpter. This patch add initial configuration and set it in disabled state, to avoid this freeze. Behaviour of this patch should be similar to: ifconfig wlan0 up; ifconfig wlan0 down. Bug: https://github.com/qca/open-ath9k-htc-firmware/issues/1 Tested-by: Bo Shi <cnshibo@gmail.com> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Cc: <stable@vger.kernel.org> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 71a183ffc77f..c3676bf1d6c4 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -861,6 +861,7 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv, if (error != 0) goto err_rx; + ath9k_hw_disable(priv->ah); #ifdef CONFIG_MAC80211_LEDS /* must be initialized before ieee80211_register_hw */ priv->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(priv->hw, From 4928bd2ef8ece262f4f314630219999a91eaa440 Mon Sep 17 00:00:00 2001 From: Oleksij Rempel <linux@rempel-privat.de> Date: Fri, 19 Jul 2013 20:16:18 +0200 Subject: [PATCH 346/913] ath9k_htc: reboot firmware if it was loaded Currently ath9k_htc will reboot firmware only if interface was ever started. Which lead to the problem in case where interface was never started but module need to be reloaded. This patch will partially fix bug "ath9k_htc: Target is unresponsive" https://github.com/qca/open-ath9k-htc-firmware/issues/1 Reproduction case: - plug adapter - make sure nothing will touch it. Stop Networkmanager or blacklist mac address of this adapter. - rmmod ath9k_htc; sleep 1; modprobe ath9k_htc Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Cc: <stable@vger.kernel.org> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/ath/ath9k/hif_usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 2469db5a5bb1..5205a3625e84 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -1295,7 +1295,9 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface) usb_set_intfdata(interface, NULL); - if (!unplugged && (hif_dev->flags & HIF_USB_START)) + /* If firmware was loaded we should drop it + * go back to first stage bootloader. */ + if (!unplugged && (hif_dev->flags & HIF_USB_READY)) ath9k_hif_usb_reboot(udev); kfree(hif_dev); From 16ec75b5de6479637993ad0f7c11a49aae069f68 Mon Sep 17 00:00:00 2001 From: Solomon Peachy <pizza@shaftnet.org> Date: Fri, 19 Jul 2013 23:31:27 -0400 Subject: [PATCH 347/913] cw1200: Fix OOPS in monitor mode In monitor mode, priv->vif is NULL, but at one point in the receive path we blindly attempt to dereference it. Add a test to prevent this. Signed-off-by: Solomon Peachy <pizza@shaftnet.org> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/cw1200/txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/cw1200/txrx.c b/drivers/net/wireless/cw1200/txrx.c index 5862c373d714..e824d4d4a18d 100644 --- a/drivers/net/wireless/cw1200/txrx.c +++ b/drivers/net/wireless/cw1200/txrx.c @@ -1165,7 +1165,7 @@ void cw1200_rx_cb(struct cw1200_common *priv, if (cw1200_handle_action_rx(priv, skb)) return; } else if (ieee80211_is_beacon(frame->frame_control) && - !arg->status && + !arg->status && priv->vif && !memcmp(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid, ETH_ALEN)) { const u8 *tim_ie; From 5d21608a592a9afcac8d82c6478a564e911ce70b Mon Sep 17 00:00:00 2001 From: Larry Finger <Larry.Finger@lwfinger.net> Date: Sat, 20 Jul 2013 21:46:48 -0500 Subject: [PATCH 348/913] ath: wil6210: Fix build error Building driver wil6210 in 3.10 and 3.11 kernels yields the following errors: CC [M] drivers/net/wireless/ath/wil6210/debugfs.o drivers/net/wireless/ath/wil6210/debugfs.c: In function 'wil_print_ring': drivers/net/wireless/ath/wil6210/debugfs.c:163:11: error: pointer targets in passing argument 5 of 'hex_dump_to_buffer' differ in signedness [-Werror=pointer-sign] false); ^ In file included from include/linux/kernel.h:13:0, from include/linux/cache.h:4, from include/linux/time.h:4, from include/linux/stat.h:18, from include/linux/module.h:10, from drivers/net/wireless/ath/wil6210/debugfs.c:17: include/linux/printk.h:361:13: note: expected 'char *' but argument is of type 'unsigned char *' extern void hex_dump_to_buffer(const void *buf, size_t len, ^ drivers/net/wireless/ath/wil6210/debugfs.c: In function 'wil_txdesc_debugfs_show': drivers/net/wireless/ath/wil6210/debugfs.c:429:10: error: pointer targets in passing argument 5 of 'hex_dump_to_buffer' differ in signedness [-Werror=pointer-sign] sizeof(printbuf), false); ^ In file included from include/linux/kernel.h:13:0, from include/linux/cache.h:4, from include/linux/time.h:4, from include/linux/stat.h:18, from include/linux/module.h:10, from drivers/net/wireless/ath/wil6210/debugfs.c:17: include/linux/printk.h:361:13: note: expected 'char *' but argument is of type 'unsigned char *' extern void hex_dump_to_buffer(const void *buf, size_t len, ^ cc1: all warnings being treated as errors make[5]: *** [drivers/net/wireless/ath/wil6210/debugfs.o] Error 1 make[4]: *** [drivers/net/wireless/ath/wil6210] Error 2 make[3]: *** [drivers/net/wireless/ath] Error 2 make[2]: *** [drivers/net/wireless] Error 2 make[1]: *** [drivers/net] Error 2 make: *** [drivers] Error 2 These errors are fixed by changing the type of the buffer from "unsigned char *" to "char *". Reported-by: Thomas Fjellstrom <thomas@fjellstrom.ca> Tested-by: Thomas Fjellstrom <thomas@fjellstrom.ca> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: Stable <stable@vger.kernel.org> [3.10] Cc: Thomas Fjellstrom <thomas@fjellstrom.ca> Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/ath/wil6210/debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index e8308ec30970..ab636767fbde 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -145,7 +145,7 @@ static void wil_print_ring(struct seq_file *s, const char *prefix, le16_to_cpu(hdr.type), hdr.flags); if (len <= MAX_MBOXITEM_SIZE) { int n = 0; - unsigned char printbuf[16 * 3 + 2]; + char printbuf[16 * 3 + 2]; unsigned char databuf[MAX_MBOXITEM_SIZE]; void __iomem *src = wmi_buffer(wil, d.addr) + sizeof(struct wil6210_mbox_hdr); @@ -416,7 +416,7 @@ static int wil_txdesc_debugfs_show(struct seq_file *s, void *data) seq_printf(s, " SKB = %p\n", skb); if (skb) { - unsigned char printbuf[16 * 3 + 2]; + char printbuf[16 * 3 + 2]; int i = 0; int len = le16_to_cpu(d->dma.length); void *p = skb->data; From 28a905b51c2b3fabbb0eb53af229fc365200e398 Mon Sep 17 00:00:00 2001 From: Arend van Spriel <arend@broadcom.com> Date: Mon, 22 Jul 2013 20:31:22 +0200 Subject: [PATCH 349/913] brcmfmac: decrement pending 8021x count upon tx failure If the transmit fails because there are no hanger slots or any other reason and the packet was an EAPOL packet the pending counter should be decreased although it was not transmitted so the driver does not end up in a dead-lock. Reviewed-by: Hante Meuleman <meuleman@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c index f0d9f7f6c83d..29b1f24c2d0f 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c @@ -1744,13 +1744,14 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) ulong flags; int fifo = BRCMF_FWS_FIFO_BCMC; bool multicast = is_multicast_ether_addr(eh->h_dest); + bool pae = eh->h_proto == htons(ETH_P_PAE); /* determine the priority */ if (!skb->priority) skb->priority = cfg80211_classify8021d(skb); drvr->tx_multicast += !!multicast; - if (ntohs(eh->h_proto) == ETH_P_PAE) + if (pae) atomic_inc(&ifp->pend_8021x_cnt); if (!brcmf_fws_fc_active(fws)) { @@ -1781,6 +1782,11 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) brcmf_fws_schedule_deq(fws); } else { brcmf_err("drop skb: no hanger slot\n"); + if (pae) { + atomic_dec(&ifp->pend_8021x_cnt); + if (waitqueue_active(&ifp->pend_8021x_wait)) + wake_up(&ifp->pend_8021x_wait); + } brcmu_pkt_buf_free_skb(skb); } brcmf_fws_unlock(drvr, flags); From 23d412a2e94f55b84dbf9d5e64f381677bc90575 Mon Sep 17 00:00:00 2001 From: Arend van Spriel <arend@broadcom.com> Date: Mon, 22 Jul 2013 12:46:24 +0200 Subject: [PATCH 350/913] brcmfmac: bail out of brcmf_txflowblock_if() for non-netdev interface To avoid ending up in a NULL-pointer access, the function brcmf_txflowblock_if() should only be called for interfaces that have a netdev associated with it. Reviewed-by: Hante Meuleman <meuleman@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 8e8975562ec3..80099016d21f 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c @@ -242,7 +242,7 @@ void brcmf_txflowblock_if(struct brcmf_if *ifp, { unsigned long flags; - if (!ifp) + if (!ifp || !ifp->ndev) return; brcmf_dbg(TRACE, "enter: idx=%d stop=0x%X reason=%d state=%d\n", From 42b9ab7ab798c1fc812bd2032cb506a93080130f Mon Sep 17 00:00:00 2001 From: Jingoo Han <jg1.han@samsung.com> Date: Fri, 19 Jul 2013 15:56:41 +0900 Subject: [PATCH 351/913] libata: replace strict_strtol() with kstrtol() The usage of strict_strtol() is not preferred, because strict_strtol() is obsolete. Thus, kstrtol() should be used. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Tejun Heo <tj@kernel.org> --- drivers/ata/libata-scsi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 83c08907e042..b1e880a3c3da 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -206,8 +206,10 @@ static ssize_t ata_scsi_park_store(struct device *device, unsigned long flags; int rc; - rc = strict_strtol(buf, 10, &input); - if (rc || input < -2) + rc = kstrtol(buf, 10, &input); + if (rc) + return rc; + if (input < -2) return -EINVAL; if (input > ATA_TMOUT_MAX_PARK) { rc = -EOVERFLOW; From 8cb440ab709fb1f7e3f71a6159ebab9403760472 Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine <moinejf@free.fr> Date: Mon, 15 Jul 2013 10:14:26 +0200 Subject: [PATCH 352/913] pinctrl: pinctrl-single: fix compile warning when no CONFIG_PM This warning has been introduced by the commit 0f9bc4bcdf4f pinctrl: single: adopt pinctrl sleep mode management Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/pinctrl/pinctrl-single.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index 6866548fab31..7323cca440b5 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -1483,6 +1483,7 @@ static int pcs_add_gpio_func(struct device_node *node, struct pcs_device *pcs) return ret; } +#ifdef CONFIG_PM static int pinctrl_single_suspend(struct platform_device *pdev, pm_message_t state) { @@ -1505,6 +1506,7 @@ static int pinctrl_single_resume(struct platform_device *pdev) return pinctrl_force_default(pcs->pctl); } +#endif static int pcs_probe(struct platform_device *pdev) { From bb9696192826a7d9279caf872e95b41bc26c7eff Mon Sep 17 00:00:00 2001 From: Tejun Heo <tj@kernel.org> Date: Mon, 22 Jul 2013 16:53:36 -0400 Subject: [PATCH 353/913] libata: make it clear that sata_inic162x is experimental sata_inic162x never reached a state where it's reliable enough for production use and data corruption is a relatively common occurrence. Make the driver generate warning about the issues and mark the Kconfig option as experimental. If the situation doesn't improve, we'd be better off making it depend on CONFIG_BROKEN. Let's wait for several cycles and see if the kernel message draws any attention. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Martin Braure de Calignon <braurede@free.fr> Reported-by: Ben Hutchings <ben@decadent.org.uk> Reported-by: risc4all@yahoo.com --- drivers/ata/Kconfig | 2 +- drivers/ata/sata_inic162x.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 80dc988f01e4..5cddaf86cd0a 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -107,7 +107,7 @@ config SATA_FSL If unsure, say N. config SATA_INIC162X - tristate "Initio 162x SATA support" + tristate "Initio 162x SATA support (Very Experimental)" depends on PCI help This option enables support for Initio 162x Serial ATA. diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index e45131748248..5c54d957370a 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c @@ -6,6 +6,18 @@ * * This file is released under GPL v2. * + * **** WARNING **** + * + * This driver never worked properly and unfortunately data corruption is + * relatively common. There isn't anyone working on the driver and there's + * no support from the vendor. Do not use this driver in any production + * environment. + * + * http://thread.gmane.org/gmane.linux.debian.devel.bugs.rc/378525/focus=54491 + * https://bugzilla.kernel.org/show_bug.cgi?id=60565 + * + * ***************** + * * This controller is eccentric and easily locks up if something isn't * right. Documentation is available at initio's website but it only * documents registers (not programming model). @@ -807,6 +819,8 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ata_print_version_once(&pdev->dev, DRV_VERSION); + dev_alert(&pdev->dev, "inic162x support is broken with common data corruption issues and will be disabled by default, contact linux-ide@vger.kernel.org if in production use\n"); + /* alloc host */ host = ata_host_alloc_pinfo(&pdev->dev, ppi, NR_PORTS); hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); From f0e61604d747bf541808a1ebde6eeaef57e904e4 Mon Sep 17 00:00:00 2001 From: Jiri Slaby <jslaby@suse.cz> Date: Fri, 19 Jul 2013 08:26:09 +0200 Subject: [PATCH 354/913] net: pch_gbe depends on x86 Since 4bb1667255a86360721291fe59991d033bbc2f2a (build some drivers only when compile-testing), PTP_1588_CLOCK_PCH depends on (X86 || COMPILE_TEST). But PCH_GBE selects PTP_1588_CLOCK_PCH without depending on x86. Fix this by adding the same dependency here. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Reported-by: <fengguang.wu@intel.com> [intel's build test robot] Cc: "David S. Miller" <davem@davemloft.net> Cc: Ben Hutchings <ben@decadent.org.uk> Cc: netdev@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: kbuild-all@01.org Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/oki-semi/pch_gbe/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig index cb22341a14a8..a588ffde9700 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig +++ b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig @@ -4,7 +4,7 @@ config PCH_GBE tristate "OKI SEMICONDUCTOR IOH(ML7223/ML7831) GbE" - depends on PCI + depends on PCI && (X86 || COMPILE_TEST) select MII select PTP_1588_CLOCK_PCH ---help--- From 7aa0076c497d6f0d5d957b431d0d80e1e9780274 Mon Sep 17 00:00:00 2001 From: Ben Hutchings <bhutchings@solarflare.com> Date: Tue, 23 Jul 2013 00:17:25 +0100 Subject: [PATCH 355/913] sfc: Enable RX scatter for flows steered by RFS Received packets are only scattered if this is enabled in both the matching filter and the receiving queue. This was not being done for filters inserted for RFS, so any packet requiring more than a single descriptor was dropped. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/sfc/filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sfc/filter.c b/drivers/net/ethernet/sfc/filter.c index b74a60ab9ac7..2a469b27a506 100644 --- a/drivers/net/ethernet/sfc/filter.c +++ b/drivers/net/ethernet/sfc/filter.c @@ -1209,7 +1209,9 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + 4 * ip->ihl + 4); ports = (const __be16 *)(skb->data + nhoff + 4 * ip->ihl); - efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT, 0, rxq_index); + efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT, + efx->rx_scatter ? EFX_FILTER_FLAG_RX_SCATTER : 0, + rxq_index); rc = efx_filter_set_ipv4_full(&spec, ip->protocol, ip->daddr, ports[1], ip->saddr, ports[0]); if (rc) From 2134ed4d614349b2b4e8d7bb593baa9179b8dd1e Mon Sep 17 00:00:00 2001 From: Dirk Brandewie <dirk.j.brandewie@intel.com> Date: Thu, 18 Jul 2013 08:48:42 -0700 Subject: [PATCH 356/913] cpufreq / intel_pstate: Change to scale off of max P-state Change to using max P-state instead of max turbo P-state. This change resolves two issues. On a quiet system intel_pstate can fail to respond to a load change. On CPU SKUs that have a limited number of P-states and no turbo range intel_pstate fails to select the highest available P-state. This change is suitable for stable v3.9+ References: https://bugzilla.kernel.org/show_bug.cgi?id=59481 Reported-and-tested-by: Arjan van de Ven <arjan@linux.intel.com> Reported-and-tested-by: dsmythies@telus.net Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Cc: 3.9+ <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/cpufreq/intel_pstate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index b012d7600e1a..7cde885011ed 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -103,10 +103,10 @@ struct pstate_adjust_policy { static struct pstate_adjust_policy default_policy = { .sample_rate_ms = 10, .deadband = 0, - .setpoint = 109, - .p_gain_pct = 17, + .setpoint = 97, + .p_gain_pct = 20, .d_gain_pct = 0, - .i_gain_pct = 4, + .i_gain_pct = 0, }; struct perf_limits { @@ -468,12 +468,12 @@ static inline void intel_pstate_set_sample_time(struct cpudata *cpu) static inline int intel_pstate_get_scaled_busy(struct cpudata *cpu) { int32_t busy_scaled; - int32_t core_busy, turbo_pstate, current_pstate; + int32_t core_busy, max_pstate, current_pstate; core_busy = int_tofp(cpu->samples[cpu->sample_ptr].core_pct_busy); - turbo_pstate = int_tofp(cpu->pstate.turbo_pstate); + max_pstate = int_tofp(cpu->pstate.max_pstate); current_pstate = int_tofp(cpu->pstate.current_pstate); - busy_scaled = mul_fp(core_busy, div_fp(turbo_pstate, current_pstate)); + busy_scaled = mul_fp(core_busy, div_fp(max_pstate, current_pstate)); return fp_toint(busy_scaled); } From 334ab91d5818256befbf083755d0bb9e7dbd2325 Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla <srinivas.kandagatla@st.com> Date: Tue, 9 Jul 2013 08:26:24 +0100 Subject: [PATCH 357/913] ARM: dts: STi: Fix pinconf setup for STiH416 serial2 This patch fixes a bug in pinctrl setup of serial2 device, Some of the pins in the pinctrl node of serial2 do not belong to that pin-controller. This patch divides them in the pins into there respective pin controller nodes. Without this patch serial on StiH416-B2000 Board will not work as it fails with: "st-pinctrl pin-controller-rear.3: failed to get pin(99) name st-pinctrl pin-controller-rear.3: maps: function serial2 group serial2-0 num 4 pinconfig core: failed to register map default (3): no group/pin given" Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Signed-off-by: Olof Johansson <olof@lixom.net> --- arch/arm/boot/dts/stih416-pinctrl.dtsi | 10 +++++++++- arch/arm/boot/dts/stih416.dtsi | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/stih416-pinctrl.dtsi b/arch/arm/boot/dts/stih416-pinctrl.dtsi index 957b21a71b4b..0f246c979262 100644 --- a/arch/arm/boot/dts/stih416-pinctrl.dtsi +++ b/arch/arm/boot/dts/stih416-pinctrl.dtsi @@ -166,6 +166,15 @@ reg = <0x9000 0x100>; st,bank-name = "PIO31"; }; + + serial2-oe { + pinctrl_serial2_oe: serial2-1 { + st,pins { + output-enable = <&PIO11 3 ALT2 OUT>; + }; + }; + }; + }; pin-controller-rear { @@ -218,7 +227,6 @@ st,pins { tx = <&PIO17 4 ALT2 OUT>; rx = <&PIO17 5 ALT2 IN>; - output-enable = <&PIO11 3 ALT2 OUT>; }; }; }; diff --git a/arch/arm/boot/dts/stih416.dtsi b/arch/arm/boot/dts/stih416.dtsi index 3cecd9689a49..1a0326ea7d07 100644 --- a/arch/arm/boot/dts/stih416.dtsi +++ b/arch/arm/boot/dts/stih416.dtsi @@ -79,7 +79,7 @@ interrupts = <0 197 0>; clocks = <&CLK_S_ICN_REG_0>; pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_serial2>; + pinctrl-0 = <&pinctrl_serial2 &pinctrl_serial2_oe>; }; /* SBC_UART1 */ From c9250073cdd54339a320b78719761d3ea33714fe Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla <srinivas.kandagatla@st.com> Date: Tue, 9 Jul 2013 08:26:33 +0100 Subject: [PATCH 358/913] ARM: STi: Set correct ARM ERRATAs. Some of the ARM_ERRATA selection is not done in the initial SOC support patches. This patch selects 2 new ARM_ERRATA's and removes one which was actually fixed. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> [olof: reorder new errata entries] Signed-off-by: Olof Johansson <olof@lixom.net> --- arch/arm/mach-sti/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-sti/Kconfig b/arch/arm/mach-sti/Kconfig index d04e3bfe1918..835833e3c4f8 100644 --- a/arch/arm/mach-sti/Kconfig +++ b/arch/arm/mach-sti/Kconfig @@ -11,8 +11,9 @@ menuconfig ARCH_STI select HAVE_SMP select HAVE_ARM_SCU if SMP select ARCH_REQUIRE_GPIOLIB - select ARM_ERRATA_720789 select ARM_ERRATA_754322 + select ARM_ERRATA_764369 + select ARM_ERRATA_775420 select PL310_ERRATA_753970 if CACHE_PL310 select PL310_ERRATA_769419 if CACHE_PL310 help From ab116a4df4942c78c189d9b0744dd940ab9e00b9 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Date: Wed, 10 Jul 2013 11:09:12 +0900 Subject: [PATCH 359/913] dmaengine: shdma: fix a build failure on platforms with no DMA support On platforms with no support for the shdma dmaengine driver build is currently failing with drivers/built-in.o: In function `sh_mobile_sdhi_probe': drivers/mmc/host/sh_mobile_sdhi.c:170: undefined reference to`shdma_chan_filter' Fix the breakage by defining shdma_chan_filter to NULL in such configurations. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> [horms+renesas@verge.net.au: Apply change to shdma-base.h instead of sh_dma.h] Signed-off-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Olof Johansson <olof@lixom.net> --- include/linux/shdma-base.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h index 382cf710ca9a..5b1c9848124c 100644 --- a/include/linux/shdma-base.h +++ b/include/linux/shdma-base.h @@ -124,6 +124,10 @@ void shdma_chan_remove(struct shdma_chan *schan); int shdma_init(struct device *dev, struct shdma_dev *sdev, int chan_num); void shdma_cleanup(struct shdma_dev *sdev); +#if IS_ENABLED(CONFIG_SH_DMAE_BASE) bool shdma_chan_filter(struct dma_chan *chan, void *arg); +#else +#define shdma_chan_filter NULL +#endif #endif From 68c034fefe20eaf7d5569aae84584b07987ce50a Mon Sep 17 00:00:00 2001 From: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com> Date: Tue, 23 Jul 2013 11:30:49 +0930 Subject: [PATCH 360/913] virtio/console: Quit from splice_write if pipe->nrbufs is 0 Quit from splice_write if pipe->nrbufs is 0 for avoiding oops in virtio-serial. When an application was doing splice from a kernel buffer to virtio-serial on a guest, the application received signal(SIGINT). This situation will normally happen, but the kernel executed a kernel panic by oops as follows: BUG: unable to handle kernel paging request at ffff882071c8ef28 IP: [<ffffffff812de48f>] sg_init_table+0x2f/0x50 PGD 1fac067 PUD 0 Oops: 0000 [#1] SMP Modules linked in: lockd sunrpc bnep bluetooth rfkill ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_page_alloc snd_timer snd microcode virtio_balloon virtio_net pcspkr soundcore i2c_piix4 i2c_core uinput floppy CPU: 1 PID: 908 Comm: trace-cmd Not tainted 3.10.0+ #49 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007 task: ffff880071c64650 ti: ffff88007bf24000 task.ti: ffff88007bf24000 RIP: 0010:[<ffffffff812de48f>] [<ffffffff812de48f>] sg_init_table+0x2f/0x50 RSP: 0018:ffff88007bf25dd8 EFLAGS: 00010286 RAX: 0000001fffffffe0 RBX: ffff882071c8ef28 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880071c8ef48 RBP: ffff88007bf25de8 R08: ffff88007fd15d40 R09: ffff880071c8ef48 R10: ffffea0001c71040 R11: ffffffff8139c555 R12: 0000000000000000 R13: ffff88007506a3c0 R14: ffff88007c862500 R15: ffff880071c8ef00 FS: 00007f0a3646c740(0000) GS:ffff88007fd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff882071c8ef28 CR3: 000000007acbb000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Stack: ffff880071c8ef48 ffff88007bf25e20 ffff88007bf25e88 ffffffff8139d6fa ffff88007bf25e28 ffffffff8127a3f4 0000000000000000 0000000000000000 ffff880071c8ef48 0000100000000000 0000000000000003 ffff88007bf25e08 Call Trace: [<ffffffff8139d6fa>] port_fops_splice_write+0xaa/0x130 [<ffffffff8127a3f4>] ? selinux_file_permission+0xc4/0x120 [<ffffffff8139d650>] ? wait_port_writable+0x1b0/0x1b0 [<ffffffff811a6fe0>] do_splice_from+0xa0/0x110 [<ffffffff811a951f>] SyS_splice+0x5ff/0x6b0 [<ffffffff8161f8c2>] system_call_fastpath+0x16/0x1b Code: c1 e2 05 48 89 e5 48 83 ec 10 4c 89 65 f8 41 89 f4 31 f6 48 89 5d f0 48 89 fb e8 8d ce ff ff 41 8d 44 24 ff 48 c1 e0 05 48 01 c3 <48> 8b 03 48 83 e0 fe 48 83 c8 02 48 89 03 48 8b 5d f0 4c 8b 65 RIP [<ffffffff812de48f>] sg_init_table+0x2f/0x50 RSP <ffff88007bf25dd8> CR2: ffff882071c8ef28 ---[ end trace 86323505eb42ea8f ]--- It seems to induce pagefault in sg_init_tabel() when pipe->nrbufs is equal to zero. This may happen in a following situation: (1) The application normally does splice(read) from a kernel buffer, then does splice(write) to virtio-serial. (2) The application receives SIGINT when is doing splice(read), so splice(read) is failed by EINTR. However, the application does not finish the operation. (3) The application tries to do splice(write) without pipe->nrbufs. (4) The virtio-console driver tries to touch scatterlist structure sgl in sg_init_table(), but the region is out of bound. To avoid the case, a kernel should check whether pipe->nrbufs is empty or not when splice_write is executed in the virtio-console driver. V3: Add Reviewed-by lines and stable@ line in sign-off area. Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Amit Shah <amit.shah@redhat.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: stable@vger.kernel.org Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/char/virtio_console.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 1b456fe9b87a..8722656cdebf 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -932,6 +932,13 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, if (is_rproc_serial(port->out_vq->vdev)) return -EINVAL; + /* + * pipe->nrbufs == 0 means there are no data to transfer, + * so this returns just 0 for no data. + */ + if (!pipe->nrbufs) + return 0; + ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); if (ret < 0) return ret; From 2b4fbf029dff5a28d9bf646346dea891ec43398a Mon Sep 17 00:00:00 2001 From: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com> Date: Tue, 23 Jul 2013 11:30:49 +0930 Subject: [PATCH 361/913] virtio/console: Add pipe_lock/unlock for splice_write Add pipe_lock/unlock for splice_write to avoid oops by following competition: (1) An application gets fds of a trace buffer, virtio-serial, pipe. (2) The application does fork() (3) The processes execute splice_read(trace buffer) and splice_write(virtio-serial) via same pipe. <parent> <child> get fds of a trace buffer, virtio-serial, pipe | fork()----------create--------+ | | splice(read) | ---+ splice(write) | +-- no competition | splice(read) | | splice(write) ---+ | | splice(read) | splice(write) splice(read) ------ competition | splice(write) Two processes share a pipe_inode_info structure. If the child execute splice(read) when the parent tries to execute splice(write), the structure can be broken. Existing virtio-serial driver does not get lock for the structure in splice_write, so this competition will induce oops. <oops messages> BUG: unable to handle kernel NULL pointer dereference at 0000000000000018 IP: [<ffffffff811a6b5f>] splice_from_pipe_feed+0x6f/0x130 PGD 7223e067 PUD 72391067 PMD 0 Oops: 0000 [#1] SMP Modules linked in: lockd bnep bluetooth rfkill sunrpc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_page_alloc snd_timer snd soundcore pcspkr virtio_net virtio_balloon i2c_piix4 i2c_core microcode uinput floppy CPU: 0 PID: 1072 Comm: compete-test Not tainted 3.10.0ws+ #55 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007 task: ffff880071b98000 ti: ffff88007b55e000 task.ti: ffff88007b55e000 RIP: 0010:[<ffffffff811a6b5f>] [<ffffffff811a6b5f>] splice_from_pipe_feed+0x6f/0x130 RSP: 0018:ffff88007b55fd78 EFLAGS: 00010287 RAX: 0000000000000000 RBX: ffff88007b55fe20 RCX: 0000000000000000 RDX: 0000000000001000 RSI: ffff88007a95ba30 RDI: ffff880036f9e6c0 RBP: ffff88007b55fda8 R08: 00000000000006ec R09: ffff880077626708 R10: 0000000000000003 R11: ffffffff8139ca59 R12: ffff88007a95ba30 R13: 0000000000000000 R14: ffffffff8139dd00 R15: ffff880036f9e6c0 FS: 00007f2e2e3a0740(0000) GS:ffff88007fc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000018 CR3: 0000000071bd1000 CR4: 00000000000006f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Stack: ffffffff8139ca59 ffff88007b55fe20 ffff880036f9e6c0 ffffffff8139dd00 ffff8800776266c0 ffff880077626708 ffff88007b55fde8 ffffffff811a6e8e ffff88007b55fde8 ffffffff8139ca59 ffff880036f9e6c0 ffff88007b55fe20 Call Trace: [<ffffffff8139ca59>] ? alloc_buf.isra.13+0x39/0xb0 [<ffffffff8139dd00>] ? virtcons_restore+0x100/0x100 [<ffffffff811a6e8e>] __splice_from_pipe+0x7e/0x90 [<ffffffff8139ca59>] ? alloc_buf.isra.13+0x39/0xb0 [<ffffffff8139d739>] port_fops_splice_write+0xe9/0x140 [<ffffffff8127a3f4>] ? selinux_file_permission+0xc4/0x120 [<ffffffff8139d650>] ? wait_port_writable+0x1b0/0x1b0 [<ffffffff811a6fe0>] do_splice_from+0xa0/0x110 [<ffffffff811a951f>] SyS_splice+0x5ff/0x6b0 [<ffffffff8161facf>] tracesys+0xdd/0xe2 Code: 49 8b 87 80 00 00 00 4c 8d 24 d0 8b 53 04 41 8b 44 24 0c 4d 8b 6c 24 10 39 d0 89 03 76 02 89 13 49 8b 44 24 10 4c 89 e6 4c 89 ff <ff> 50 18 85 c0 0f 85 aa 00 00 00 48 89 da 4c 89 e6 4c 89 ff 41 RIP [<ffffffff811a6b5f>] splice_from_pipe_feed+0x6f/0x130 RSP <ffff88007b55fd78> CR2: 0000000000000018 ---[ end trace 24572beb7764de59 ]--- V2: Fix a locking problem for error V3: Add Reviewed-by lines and stable@ line in sign-off area Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Amit Shah <amit.shah@redhat.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: stable@vger.kernel.org Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/char/virtio_console.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 8722656cdebf..8a15af3e1a9d 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -936,16 +936,21 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, * pipe->nrbufs == 0 means there are no data to transfer, * so this returns just 0 for no data. */ - if (!pipe->nrbufs) - return 0; + pipe_lock(pipe); + if (!pipe->nrbufs) { + ret = 0; + goto error_out; + } ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); if (ret < 0) - return ret; + goto error_out; buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); - if (!buf) - return -ENOMEM; + if (!buf) { + ret = -ENOMEM; + goto error_out; + } sgl.n = 0; sgl.len = 0; @@ -953,12 +958,17 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, sgl.sg = buf->sg; sg_init_table(sgl.sg, sgl.size); ret = __splice_from_pipe(pipe, &sd, pipe_to_sg); + pipe_unlock(pipe); if (likely(ret > 0)) ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true); if (unlikely(ret <= 0)) free_buf(buf, true); return ret; + +error_out: + pipe_unlock(pipe); + return ret; } static unsigned int port_fops_poll(struct file *filp, poll_table *wait) From 6287e7319870ec949fb809e4eb4154c2b05b221f Mon Sep 17 00:00:00 2001 From: Mike Frysinger <vapier@gentoo.org> Date: Thu, 27 Jun 2013 22:42:36 -0400 Subject: [PATCH 362/913] ARM: footbridge: fix overlapping PCI mappings Commit 8ef6e6201b26cb9fde79c1baa08145af6aca2815 (ARM: footbridge: use fixed PCI i/o mapping) broke booting on my netwinder. Before that, everything boots fine. Since then, it crashes on boot. With earlyprintk, I see it BUG-ing like so: kernel BUG at lib/ioremap.c:27! Internal error: Oops - BUG: 0 [#1] ARM ... [<c0139b54>] (ioremap_page_range+0x128/0x154) from [<c02e6a6c>] (dc21285_setup+0xd0/0x114) [<c02e6a6c>] (dc21285_setup+0xd0/0x114) from [<c02e4874>] (pci_common_init+0xa0/0x298) [<c02e4874>] (pci_common_init+0xa0/0x298) from [<c02e793c>] (netwinder_pci_init+0xc/0x18) [<c02e793c>] (netwinder_pci_init+0xc/0x18) from [<c02e27d0>] (do_one_initcall+0xb4/0x180) ... Russell points out it's because of overlapping PCI mappings that was added with the aforementioned commit. Rob thought the code would re-use the static mapping, but that turns out to not be the case and instead hits the BUG further down. After deleting this hunk as suggested by Russel, the system boots up fine again and all my PCI devices work (IDE, ethernet, the DC21285). Signed-off-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Rob Herring <rob.herring@calxeda.com> Cc: stable@vger.kernel.org # v3.5+ Signed-off-by: Olof Johansson <olof@lixom.net> --- arch/arm/mach-footbridge/dc21285.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c index a7cd2cf5e08d..3490a24f969e 100644 --- a/arch/arm/mach-footbridge/dc21285.c +++ b/arch/arm/mach-footbridge/dc21285.c @@ -276,8 +276,6 @@ int __init dc21285_setup(int nr, struct pci_sys_data *sys) sys->mem_offset = DC21285_PCI_MEM; - pci_ioremap_io(0, DC21285_PCI_IO); - pci_add_resource_offset(&sys->resources, &res[0], sys->mem_offset); pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset); From e64bf95e68bf92e7f6d906da4715b937cec5646c Mon Sep 17 00:00:00 2001 From: Rob Herring <rob.herring@calxeda.com> Date: Sun, 21 Jul 2013 14:53:37 -0500 Subject: [PATCH 363/913] ARM: highbank: Only touch common coherency control register fields Midway adds new register fields to the coherency control registers, so writing absolute values will break on Midway. Change the register accesses to only modify the necessary and common fields in order to support both Midway and Highbank. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Olof Johansson <olof@lixom.net> --- arch/arm/mach-highbank/highbank.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index dc5d6becd8c7..88815795fe26 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c @@ -115,6 +115,7 @@ static int highbank_platform_notifier(struct notifier_block *nb, { struct resource *res; int reg = -1; + u32 val; struct device *dev = __dev; if (event != BUS_NOTIFY_ADD_DEVICE) @@ -141,10 +142,10 @@ static int highbank_platform_notifier(struct notifier_block *nb, return NOTIFY_DONE; if (of_property_read_bool(dev->of_node, "dma-coherent")) { - writel(0xff31, sregs_base + reg); + val = readl(sregs_base + reg); + writel(val | 0xff01, sregs_base + reg); set_dma_ops(dev, &arm_coherent_dma_ops); - } else - writel(0, sregs_base + reg); + } return NOTIFY_OK; } From 7d148ef51a657fd04036c3ed7803da600dd0d451 Mon Sep 17 00:00:00 2001 From: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Mon, 22 Jul 2013 18:02:39 +0200 Subject: [PATCH 364/913] drm/i915: fix hdmi portclock limits In commit 325b9d048810f7689ec644595061c0b700e64bce Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Fri Apr 19 11:24:33 2013 +0200 drm/i915: fixup 12bpc hdmi dotclock handling I've errornously claimed that we don't yet support the hdmi 1.4 dotclocks > 225 MHz on Haswell. But a bug report and a closer look at the wrpll table showed that we've supported port clocks up to 300MHz. With the new code to dynamically compute wrpll limits we should have no issues going up to the full 340 MHz range of hdmi 1.4, so let's just use that to fix this regression. That'll allow 4k over hdmi for free! v2: Drop the random hunk that somehow slipped in. v3: Cantiga has the original HDMI dotclock limit of 165MHz. And also patch up the mode filtering. To do so extract the dotclock limits into a little helper function. v4: Use 300MHz (from Bspec) instead of 340MHz (upper limit for hdmi 1.3), apparently hw is not required to be able to drive the highest dotclocks. Suggested by Damien. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67048 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67030 Tested-by: Andreas Reis <andreas.reis@gmail.com> (v2) Cc: Damien Lespiau <damien.lespiau@intel.com> Reviewed-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/intel_hdmi.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 98df2a0c85bd..2fd3fd5b943e 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -785,10 +785,22 @@ static void intel_disable_hdmi(struct intel_encoder *encoder) } } +static int hdmi_portclock_limit(struct intel_hdmi *hdmi) +{ + struct drm_device *dev = intel_hdmi_to_dev(hdmi); + + if (IS_G4X(dev)) + return 165000; + else if (IS_HASWELL(dev)) + return 300000; + else + return 225000; +} + static int intel_hdmi_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { - if (mode->clock > 165000) + if (mode->clock > hdmi_portclock_limit(intel_attached_hdmi(connector))) return MODE_CLOCK_HIGH; if (mode->clock < 20000) return MODE_CLOCK_LOW; @@ -806,6 +818,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, struct drm_device *dev = encoder->base.dev; struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; int clock_12bpc = pipe_config->requested_mode.clock * 3 / 2; + int portclock_limit = hdmi_portclock_limit(intel_hdmi); int desired_bpp; if (intel_hdmi->color_range_auto) { @@ -829,7 +842,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, * outputs. We also need to check that the higher clock still fits * within limits. */ - if (pipe_config->pipe_bpp > 8*3 && clock_12bpc <= 225000 + if (pipe_config->pipe_bpp > 8*3 && clock_12bpc <= portclock_limit && HAS_PCH_SPLIT(dev)) { DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n"); desired_bpp = 12*3; @@ -846,7 +859,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, pipe_config->pipe_bpp = desired_bpp; } - if (adjusted_mode->clock > 225000) { + if (adjusted_mode->clock > portclock_limit) { DRM_DEBUG_KMS("too high HDMI clock, rejecting mode\n"); return false; } From 803075dba31c17af110e1d9a915fe7262165b213 Mon Sep 17 00:00:00 2001 From: Neil Horman <nhorman@tuxdriver.com> Date: Wed, 17 Jul 2013 07:13:59 -0400 Subject: [PATCH 365/913] x86/iommu/vt-d: Expand interrupt remapping quirk to cover x58 chipset Recently we added an early quirk to detect 5500/5520 chipsets with early revisions that had problems with irq draining with interrupt remapping enabled: commit 03bbcb2e7e292838bb0244f5a7816d194c911d62 Author: Neil Horman <nhorman@tuxdriver.com> Date: Tue Apr 16 16:38:32 2013 -0400 iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets It turns out this same problem is present in the intel X58 chipset as well. See errata 69 here: http://www.intel.com/content/www/us/en/chipsets/x58-express-specification-update.html This patch extends the pci early quirk so that the chip devices/revisions specified in the above update are also covered in the same way: Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Acked-by: Donald Dutile <ddutile@redhat.com> Cc: Joerg Roedel <joro@8bytes.org> Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: Malcolm Crossley <malcolm.crossley@citrix.com> Cc: Prarit Bhargava <prarit@redhat.com> Cc: Don Zickus <dzickus@redhat.com> Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/1374059639-8631-1-git-send-email-nhorman@tuxdriver.com [ Small edits. ] Signed-off-by: Ingo Molnar <mingo@kernel.org> --- arch/x86/kernel/early-quirks.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 94ab6b90dd3f..63bdb29b2549 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -196,15 +196,23 @@ static void __init ati_bugs_contd(int num, int slot, int func) static void __init intel_remapping_check(int num, int slot, int func) { u8 revision; + u16 device; + device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID); revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID); /* - * Revision 0x13 of this chipset supports irq remapping - * but has an erratum that breaks its behavior, flag it as such + * Revision 13 of all triggering devices id in this quirk have + * a problem draining interrupts when irq remapping is enabled, + * and should be flagged as broken. Additionally revisions 0x12 + * and 0x22 of device id 0x3405 has this problem. */ if (revision == 0x13) set_irq_remapping_broken(); + else if ((device == 0x3405) && + ((revision == 0x12) || + (revision == 0x22))) + set_irq_remapping_broken(); } @@ -239,6 +247,8 @@ static struct chipset early_qrk[] __initdata = { PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, { PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST, PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, + { PCI_VENDOR_ID_INTEL, 0x3405, PCI_CLASS_BRIDGE_HOST, + PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, {} From 82b2f495fba338d1e3098dde1df54944a9c19751 Mon Sep 17 00:00:00 2001 From: Mark Rutland <mark.rutland@arm.com> Date: Tue, 9 Jul 2013 15:16:06 +0100 Subject: [PATCH 366/913] arm64: virt: ensure visibility of __boot_cpu_mode Secondary CPUs write to __boot_cpu_mode with caches disabled, and thus a cached value of __boot_cpu_mode may be incoherent with that in memory. This could lead to a failure to detect mismatched boot modes. This patch adds flushing to ensure that writes by secondaries to __boot_cpu_mode are made visible before we test against it. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Christoffer Dall <cdall@cs.columbia.edu> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- arch/arm64/include/asm/virt.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/include/asm/virt.h b/arch/arm64/include/asm/virt.h index 439827271e3d..26e310c54344 100644 --- a/arch/arm64/include/asm/virt.h +++ b/arch/arm64/include/asm/virt.h @@ -21,6 +21,7 @@ #define BOOT_CPU_MODE_EL2 (0x0e12b007) #ifndef __ASSEMBLY__ +#include <asm/cacheflush.h> /* * __boot_cpu_mode records what mode CPUs were booted in. @@ -36,9 +37,20 @@ extern u32 __boot_cpu_mode[2]; void __hyp_set_vectors(phys_addr_t phys_vector_base); phys_addr_t __hyp_get_vectors(void); +static inline void sync_boot_mode(void) +{ + /* + * As secondaries write to __boot_cpu_mode with caches disabled, we + * must flush the corresponding cache entries to ensure the visibility + * of their writes. + */ + __flush_dcache_area(__boot_cpu_mode, sizeof(__boot_cpu_mode)); +} + /* Reports the availability of HYP mode */ static inline bool is_hyp_mode_available(void) { + sync_boot_mode(); return (__boot_cpu_mode[0] == BOOT_CPU_MODE_EL2 && __boot_cpu_mode[1] == BOOT_CPU_MODE_EL2); } @@ -46,6 +58,7 @@ static inline bool is_hyp_mode_available(void) /* Check if the bootloader has booted CPUs in different modes */ static inline bool is_hyp_mode_mismatched(void) { + sync_boot_mode(); return __boot_cpu_mode[0] != __boot_cpu_mode[1]; } From b0946fc84628b8d60e7a2034b48d1aff7da9d1df Mon Sep 17 00:00:00 2001 From: Catalin Marinas <catalin.marinas@arm.com> Date: Tue, 23 Jul 2013 11:05:10 +0100 Subject: [PATCH 367/913] arm64: Fix definition of arm_pm_restart to match the declaration Commit ff70130 (arm64: use common reboot infrastructure) converted the arm_pm_restart declaration to the new reboot infrastructure but missed the actual definition. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- arch/arm64/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 1788bf6b471f..57fb55c44c90 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -81,7 +81,7 @@ void soft_restart(unsigned long addr) void (*pm_power_off)(void); EXPORT_SYMBOL_GPL(pm_power_off); -void (*arm_pm_restart)(char str, const char *cmd); +void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); EXPORT_SYMBOL_GPL(arm_pm_restart); void arch_cpu_idle_prepare(void) From cd34f647a78e7f2296fcb72392b9e5c832793e65 Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka <sgruszka@redhat.com> Date: Tue, 23 Jul 2013 13:56:50 +0200 Subject: [PATCH 368/913] mac80211: fix monitor interface suspend crash regression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit My commit: commit 12e7f517029dad819c45eca9ca01fdb9ba57616b Author: Stanislaw Gruszka <sgruszka@redhat.com> Date: Thu Feb 28 10:55:26 2013 +0100 mac80211: cleanup generic suspend/resume procedures removed check for deleting MONITOR and AP_VLAN when suspend. That can cause a crash (i.e. in iwlagn_mac_remove_interface()) since we remove interface in the driver that we did not add before. Reference: http://marc.info/?l=linux-kernel&m=137391815113860&w=2 Bisected-by: Ortwin Glück <odi@odi.ch> Reported-and-tested-by: Ortwin Glück <odi@odi.ch> Cc: stable@vger.kernel.org # 3.10 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- net/mac80211/pm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c index 7fc5d0d8149a..340126204343 100644 --- a/net/mac80211/pm.c +++ b/net/mac80211/pm.c @@ -99,10 +99,13 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) } mutex_unlock(&local->sta_mtx); - /* remove all interfaces */ + /* remove all interfaces that were created in the driver */ list_for_each_entry(sdata, &local->interfaces, list) { - if (!ieee80211_sdata_running(sdata)) + if (!ieee80211_sdata_running(sdata) || + sdata->vif.type == NL80211_IFTYPE_AP_VLAN || + sdata->vif.type == NL80211_IFTYPE_MONITOR) continue; + drv_remove_interface(local, sdata); } From 2451ade070ef9b0a0f118ac41896da856e72b5a1 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Date: Sun, 21 Jul 2013 15:17:54 +0000 Subject: [PATCH 369/913] xen/arm,arm64: update xen_restart after ff701306cd49 and 7b6d864b48d9 Commit 7b6d864b48d9 (reboot: arm: change reboot_mode to use enum reboot_mode) and ff701306cd49 (arm64: use common reboot infrastructure) change the prototype of arm_pm_restart on arm and arm64. Update xen_restart accordingly. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- arch/arm/xen/enlighten.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index f71c37edca26..c9770ba5c7df 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c @@ -172,7 +172,7 @@ static void __init xen_percpu_init(void *unused) enable_percpu_irq(xen_events_irq, 0); } -static void xen_restart(char str, const char *cmd) +static void xen_restart(enum reboot_mode reboot_mode, const char *cmd) { struct sched_shutdown r = { .reason = SHUTDOWN_reboot }; int rc; From 96f15f29038e58e1b0a96483e2b369ff446becf1 Mon Sep 17 00:00:00 2001 From: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Date: Thu, 11 Jul 2013 17:18:58 -0700 Subject: [PATCH 370/913] [SCSI] isci: Fix a race condition in the SSP task management path This commit fixes a race condition in the isci driver abort task and SSP device task management path. The race is caused when an I/O termination in the SCU hardware is necessary because of an SSP target timeout condition, and the check of the I/O end state races against the HW-termination-driven end state. The failure of the race meant that no TMF was sent to the device to clean-up the pending I/O. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Reviewed-by: Lukasz Dorau <lukasz.dorau@intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: James Bottomley <JBottomley@Parallels.com> --- drivers/scsi/isci/task.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c index 9bb020ac089c..0d30ca849e8f 100644 --- a/drivers/scsi/isci/task.c +++ b/drivers/scsi/isci/task.c @@ -491,6 +491,7 @@ int isci_task_abort_task(struct sas_task *task) struct isci_tmf tmf; int ret = TMF_RESP_FUNC_FAILED; unsigned long flags; + int target_done_already = 0; /* Get the isci_request reference from the task. Note that * this check does not depend on the pending request list @@ -505,9 +506,11 @@ int isci_task_abort_task(struct sas_task *task) /* If task is already done, the request isn't valid */ if (!(task->task_state_flags & SAS_TASK_STATE_DONE) && (task->task_state_flags & SAS_TASK_AT_INITIATOR) && - old_request) + old_request) { idev = isci_get_device(task->dev->lldd_dev); - + target_done_already = test_bit(IREQ_COMPLETE_IN_TARGET, + &old_request->flags); + } spin_unlock(&task->task_state_lock); spin_unlock_irqrestore(&ihost->scic_lock, flags); @@ -561,7 +564,7 @@ int isci_task_abort_task(struct sas_task *task) if (task->task_proto == SAS_PROTOCOL_SMP || sas_protocol_ata(task->task_proto) || - test_bit(IREQ_COMPLETE_IN_TARGET, &old_request->flags) || + target_done_already || test_bit(IDEV_GONE, &idev->flags)) { spin_unlock_irqrestore(&ihost->scic_lock, flags); From c3ccb1d7cf4c4549151876dd37c0944a682fd9e1 Mon Sep 17 00:00:00 2001 From: Saurav Kashyap <saurav.kashyap@qlogic.com> Date: Fri, 12 Jul 2013 14:47:51 -0400 Subject: [PATCH 371/913] [SCSI] qla2xxx: Properly set the tagging for commands. This fixes a regression where Xyratex controllers and disks were lost by the driver: https://bugzilla.kernel.org/show_bug.cgi?id=59601 Reported-by: Jack Hill <jackhill@jackhill.us> Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com> Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com> Cc: <stable@vger.kernel.org> Signed-off-by: James Bottomley <JBottomley@Parallels.com> --- drivers/scsi/qla2xxx/qla_iocb.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 42ef481db942..ef0a5481b9dd 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -419,6 +419,8 @@ qla2x00_start_scsi(srb_t *sp) __constant_cpu_to_le16(CF_SIMPLE_TAG); break; } + } else { + cmd_pkt->control_flags = __constant_cpu_to_le16(CF_SIMPLE_TAG); } /* Load SCSI command packet. */ @@ -1307,11 +1309,11 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, fcp_cmnd->task_attribute = TSK_ORDERED; break; default: - fcp_cmnd->task_attribute = 0; + fcp_cmnd->task_attribute = TSK_SIMPLE; break; } } else { - fcp_cmnd->task_attribute = 0; + fcp_cmnd->task_attribute = TSK_SIMPLE; } cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */ @@ -1525,7 +1527,12 @@ qla24xx_start_scsi(srb_t *sp) case ORDERED_QUEUE_TAG: cmd_pkt->task = TSK_ORDERED; break; + default: + cmd_pkt->task = TSK_SIMPLE; + break; } + } else { + cmd_pkt->task = TSK_SIMPLE; } /* Load SCSI command packet. */ From c91bc6ccd13254826fdfceddba0f3b5e308aa93e Mon Sep 17 00:00:00 2001 From: Xiaotian Feng <xtfeng@gmail.com> Date: Tue, 23 Jul 2013 11:54:10 +0800 Subject: [PATCH 372/913] ahci: fix Null pointer dereference in achi_host_active() commit b29900e6 (AHCI: Make distinct names for ports in /proc/interrupts) introuded a regression, which resulted Null pointer dereference for achi host with dummy ports. For ahci ports, when the port is dummy port, its private_data will be NULL, as ata_dummy_port_ops doesn't support ->port_start. changes in v2: use pp to check dummy ports, update comments Reported-and-tested-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Xiaotian Feng <xtfeng@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Alexander Gordeev <agordeev@redhat.com> Cc: linux-ide@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/ata/ahci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 5064f3ea20f1..db4380d70031 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1146,11 +1146,18 @@ int ahci_host_activate(struct ata_host *host, int irq, unsigned int n_msis) return rc; for (i = 0; i < host->n_ports; i++) { + const char* desc; struct ahci_port_priv *pp = host->ports[i]->private_data; + /* pp is NULL for dummy ports */ + if (pp) + desc = pp->irq_desc; + else + desc = dev_driver_string(host->dev); + rc = devm_request_threaded_irq(host->dev, irq + i, ahci_hw_interrupt, ahci_thread_fn, IRQF_SHARED, - pp->irq_desc, host->ports[i]); + desc, host->ports[i]); if (rc) goto out_free_irqs; } From 085b513f97d8d799d28491239be4b451bcd8c2c5 Mon Sep 17 00:00:00 2001 From: "Ewan D. Milne" <emilne@redhat.com> Date: Fri, 2 Nov 2012 09:38:34 -0400 Subject: [PATCH 373/913] [SCSI] sd: fix crash when UA received on DIF enabled device sd_prep_fn will allocate a larger CDB for the command via mempool_alloc for devices using DIF type 2 protection. This CDB was being freed in sd_done, which results in a kernel crash if the command is retried due to a UNIT ATTENTION. This change moves the code to free the larger CDB into sd_unprep_fn instead, which is invoked after the request is complete. It is no longer necessary to call scsi_print_command separately for this case as the ->cmnd will no longer be NULL in the normal code path. Also removed conditional test for DIF type 2 when freeing the larger CDB because the protection_type could have been changed via sysfs while the command was executing. Signed-off-by: Ewan D. Milne <emilne@redhat.com> Acked-by: Martin K. Petersen <martin.petersen@oracle.com> Cc: <stable@vger.kernel.org> Signed-off-by: James Bottomley <JBottomley@Parallels.com> --- drivers/scsi/sd.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 80f39b8b0223..86fcf2c313ad 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -838,10 +838,17 @@ static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq) static void sd_unprep_fn(struct request_queue *q, struct request *rq) { + struct scsi_cmnd *SCpnt = rq->special; + if (rq->cmd_flags & REQ_DISCARD) { free_page((unsigned long)rq->buffer); rq->buffer = NULL; } + if (SCpnt->cmnd != rq->cmd) { + mempool_free(SCpnt->cmnd, sd_cdb_pool); + SCpnt->cmnd = NULL; + SCpnt->cmd_len = 0; + } } /** @@ -1720,21 +1727,6 @@ static int sd_done(struct scsi_cmnd *SCpnt) if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt)) sd_dif_complete(SCpnt, good_bytes); - if (scsi_host_dif_capable(sdkp->device->host, sdkp->protection_type) - == SD_DIF_TYPE2_PROTECTION && SCpnt->cmnd != SCpnt->request->cmd) { - - /* We have to print a failed command here as the - * extended CDB gets freed before scsi_io_completion() - * is called. - */ - if (result) - scsi_print_command(SCpnt); - - mempool_free(SCpnt->cmnd, sd_cdb_pool); - SCpnt->cmnd = NULL; - SCpnt->cmd_len = 0; - } - return good_bytes; } From e4daf1ffbe6cc3b12aab4d604e627829e93e9914 Mon Sep 17 00:00:00 2001 From: Harshula Jayasuriya <harshula@redhat.com> Date: Tue, 23 Jul 2013 14:21:35 +1000 Subject: [PATCH 374/913] nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file The following call chain: ------------------------------------------------------------ nfs4_get_vfs_file - nfsd_open - dentry_open - do_dentry_open - __get_file_write_access - get_write_access - return atomic_inc_unless_negative(&inode->i_writecount) ? 0 : -ETXTBSY; ------------------------------------------------------------ can result in the following state: ------------------------------------------------------------ struct nfs4_file { ... fi_fds = {0xffff880c1fa65c80, 0xffffffffffffffe6, 0x0}, fi_access = {{ counter = 0x1 }, { counter = 0x0 }}, ... ------------------------------------------------------------ 1) First time around, in nfs4_get_vfs_file() fp->fi_fds[O_WRONLY] is NULL, hence nfsd_open() is called where we get status set to an error and fp->fi_fds[O_WRONLY] to -ETXTBSY. Thus we do not reach nfs4_file_get_access() and fi_access[O_WRONLY] is not incremented. 2) Second time around, in nfs4_get_vfs_file() fp->fi_fds[O_WRONLY] is NOT NULL (-ETXTBSY), so nfsd_open() is NOT called, but nfs4_file_get_access() IS called and fi_access[O_WRONLY] is incremented. Thus we leave a landmine in the form of the nfs4_file data structure in an incorrect state. 3) Eventually, when __nfs4_file_put_access() is called it finds fi_access[O_WRONLY] being non-zero, it decrements it and calls nfs4_file_put_fd() which tries to fput -ETXTBSY. ------------------------------------------------------------ ... [exception RIP: fput+0x9] RIP: ffffffff81177fa9 RSP: ffff88062e365c90 RFLAGS: 00010282 RAX: ffff880c2b3d99cc RBX: ffff880c2b3d9978 RCX: 0000000000000002 RDX: dead000000100101 RSI: 0000000000000001 RDI: ffffffffffffffe6 RBP: ffff88062e365c90 R8: ffff88041fe797d8 R9: ffff88062e365d58 R10: 0000000000000008 R11: 0000000000000000 R12: 0000000000000001 R13: 0000000000000007 R14: 0000000000000000 R15: 0000000000000000 ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 #9 [ffff88062e365c98] __nfs4_file_put_access at ffffffffa0562334 [nfsd] #10 [ffff88062e365cc8] nfs4_file_put_access at ffffffffa05623ab [nfsd] #11 [ffff88062e365ce8] free_generic_stateid at ffffffffa056634d [nfsd] #12 [ffff88062e365d18] release_open_stateid at ffffffffa0566e4b [nfsd] #13 [ffff88062e365d38] nfsd4_close at ffffffffa0567401 [nfsd] #14 [ffff88062e365d88] nfsd4_proc_compound at ffffffffa0557f28 [nfsd] #15 [ffff88062e365dd8] nfsd_dispatch at ffffffffa054543e [nfsd] #16 [ffff88062e365e18] svc_process_common at ffffffffa04ba5a4 [sunrpc] #17 [ffff88062e365e98] svc_process at ffffffffa04babe0 [sunrpc] #18 [ffff88062e365eb8] nfsd at ffffffffa0545b62 [nfsd] #19 [ffff88062e365ee8] kthread at ffffffff81090886 #20 [ffff88062e365f48] kernel_thread at ffffffff8100c14a ------------------------------------------------------------ Cc: stable@vger.kernel.org Signed-off-by: Harshula Jayasuriya <harshula@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> --- fs/nfsd/vfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 8ff6a0019b0b..c827acb0e943 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -830,9 +830,10 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, flags = O_WRONLY|O_LARGEFILE; } *filp = dentry_open(&path, flags, current_cred()); - if (IS_ERR(*filp)) + if (IS_ERR(*filp)) { host_err = PTR_ERR(*filp); - else { + *filp = NULL; + } else { host_err = ima_file_check(*filp, may_flags); if (may_flags & NFSD_MAY_64BIT_COOKIE) From ca24763588844b14f019ffc45c7df6d9e8f932c5 Mon Sep 17 00:00:00 2001 From: "Alexandr \\\"Sky\\\" Ivanov" <alexandr.sky@gmail.com> Date: Tue, 23 Jul 2013 17:46:40 +0400 Subject: [PATCH 375/913] USB: option: add D-Link DWM-152/C1 and DWM-156/C1 Adding support for D-Link DWM-152/C1 and DWM-156/C1 devices. DWM-152/C1: T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 6 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=07d1 ProdID=3e01 Rev= 0.00 S: Product=USB Configuration S: SerialNumber=1234567890ABCDEF C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms DWM-156/C1: T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 8 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=07d1 ProdID=3e02 Rev= 0.00 S: Product=DataCard Device S: SerialNumber=1234567890ABCDEF C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms Signed-off-by: Alexandr Ivanov <alexandr.sky@gmail.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 418746b557ad..9cc40031c23c 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -1341,6 +1341,8 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d02, 0xff, 0x00, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x02, 0x01) }, { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) }, + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, option_ids); From ed882c3e72d6037589baa4328585c2b0450e673c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= <vincent.stehle@freescale.com> Date: Thu, 27 Jun 2013 14:49:27 +0200 Subject: [PATCH 376/913] ARM: keystone: fix compilation warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the following compilation warning: arch/arm/mach-keystone/keystone.c:74:2: warning: initialization from incompatible pointer type [enabled by default] arch/arm/mach-keystone/keystone.c:74:2: warning: (near initialization for ‘__mach_desc_KEYSTONE.restart’) [enabled by default] Signed-off-by: Vincent Stehlé <vincent.stehle@freescale.com> Cc: Robin Holt <holt@sgi.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: trivial@kernel.org Signed-off-by: Olof Johansson <olof@lixom.net> --- arch/arm/mach-keystone/keystone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c index fe4d9ff93a7e..b661c5c2870a 100644 --- a/arch/arm/mach-keystone/keystone.c +++ b/arch/arm/mach-keystone/keystone.c @@ -49,7 +49,7 @@ static const char *keystone_match[] __initconst = { NULL, }; -void keystone_restart(char mode, const char *cmd) +void keystone_restart(enum reboot_mode mode, const char *cmd) { u32 val; From fe08bf9f46d6ae8e08de32d29234a2c928eebf8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= <vincent.stehle@freescale.com> Date: Thu, 27 Jun 2013 14:42:41 +0200 Subject: [PATCH 377/913] ARM: zynq: fix compilation warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the following compilation warning: arch/arm/mach-zynq/common.c:110:2: warning: initialization from incompatible pointer type [enabled by default] arch/arm/mach-zynq/common.c:110:2: warning: (near initialization for ‘__mach_desc_XILINX_EP107.restart’) [enabled by default] Signed-off-by: Vincent Stehlé <vincent.stehle@freescale.com> Cc: Robin Holt <holt@sgi.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: trivial@kernel.org Signed-off-by: Olof Johansson <olof@lixom.net> --- arch/arm/mach-zynq/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 5b799c29886e..5f252569c689 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -91,7 +91,7 @@ static void __init zynq_map_io(void) zynq_scu_map_io(); } -static void zynq_system_reset(char mode, const char *cmd) +static void zynq_system_reset(enum reboot_mode mode, const char *cmd) { zynq_slcr_system_reset(); } From a829abf8daa2dcf8223a9284b76d221e61130e13 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann <arnd@arndb.de> Date: Fri, 5 Jul 2013 17:51:20 +0200 Subject: [PATCH 378/913] ARM: pxa: propagate errors from regulator_enable() to pxamci The em_x270_mci_setpower() and em_x270_usb_hub_init() functions call regulator_enable(), which may return an error that must be checked. This changes the em_x270_usb_hub_init() function to bail out if it fails, and changes the pxamci_platform_data->setpower callback so that the a failed em_x270_mci_setpower call can be propagated by the pxamci driver into the mmc core. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Mike Rapoport <mike@compulab.co.il> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Haojian Zhuang <haojian.zhuang@gmail.com> Acked-by: Chris Ball <cjb@laptop.org> [olof: fixed order of regulator_enable() and test in em_x270_usb_hub_init] Signed-off-by: Olof Johansson <olof@lixom.net> --- arch/arm/mach-pxa/em-x270.c | 17 +++++++++++++---- arch/arm/mach-pxa/mainstone.c | 3 ++- arch/arm/mach-pxa/pcm990-baseboard.c | 3 ++- arch/arm/mach-pxa/poodle.c | 4 +++- arch/arm/mach-pxa/spitz.c | 4 +++- arch/arm/mach-pxa/stargate2.c | 3 ++- drivers/mmc/host/pxamci.c | 2 +- include/linux/platform_data/mmc-pxamci.h | 2 +- 8 files changed, 27 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index f6726bb4eb95..3a3362fa793e 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c @@ -477,16 +477,24 @@ static int em_x270_usb_hub_init(void) /* USB Hub power-on and reset */ gpio_direction_output(usb_hub_reset, 1); gpio_direction_output(GPIO9_USB_VBUS_EN, 0); - regulator_enable(em_x270_usb_ldo); + err = regulator_enable(em_x270_usb_ldo); + if (err) + goto err_free_rst_gpio; + gpio_set_value(usb_hub_reset, 0); gpio_set_value(usb_hub_reset, 1); regulator_disable(em_x270_usb_ldo); - regulator_enable(em_x270_usb_ldo); + err = regulator_enable(em_x270_usb_ldo); + if (err) + goto err_free_rst_gpio; + gpio_set_value(usb_hub_reset, 0); gpio_set_value(GPIO9_USB_VBUS_EN, 1); return 0; +err_free_rst_gpio: + gpio_free(usb_hub_reset); err_free_vbus_gpio: gpio_free(GPIO9_USB_VBUS_EN); err_free_usb_ldo: @@ -592,7 +600,7 @@ err_irq: return err; } -static void em_x270_mci_setpower(struct device *dev, unsigned int vdd) +static int em_x270_mci_setpower(struct device *dev, unsigned int vdd) { struct pxamci_platform_data* p_d = dev->platform_data; @@ -600,10 +608,11 @@ static void em_x270_mci_setpower(struct device *dev, unsigned int vdd) int vdd_uV = (2000 + (vdd - __ffs(MMC_VDD_20_21)) * 100) * 1000; regulator_set_voltage(em_x270_sdio_ldo, vdd_uV, vdd_uV); - regulator_enable(em_x270_sdio_ldo); + return regulator_enable(em_x270_sdio_ldo); } else { regulator_disable(em_x270_sdio_ldo); } + return 0; } static void em_x270_mci_exit(struct device *dev, void *data) diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index d2c652318376..dd70343c8708 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c @@ -408,7 +408,7 @@ static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_in return err; } -static void mainstone_mci_setpower(struct device *dev, unsigned int vdd) +static int mainstone_mci_setpower(struct device *dev, unsigned int vdd) { struct pxamci_platform_data* p_d = dev->platform_data; @@ -420,6 +420,7 @@ static void mainstone_mci_setpower(struct device *dev, unsigned int vdd) printk(KERN_DEBUG "%s: off\n", __func__); MST_MSCWR1 &= ~MST_MSCWR1_MMC_ON; } + return 0; } static void mainstone_mci_exit(struct device *dev, void *data) diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c index fb7f1d1627dc..13e5b00eae90 100644 --- a/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/arch/arm/mach-pxa/pcm990-baseboard.c @@ -335,7 +335,7 @@ static int pcm990_mci_init(struct device *dev, irq_handler_t mci_detect_int, return err; } -static void pcm990_mci_setpower(struct device *dev, unsigned int vdd) +static int pcm990_mci_setpower(struct device *dev, unsigned int vdd) { struct pxamci_platform_data *p_d = dev->platform_data; u8 val; @@ -348,6 +348,7 @@ static void pcm990_mci_setpower(struct device *dev, unsigned int vdd) val &= ~PCM990_CTRL_MMC2PWR; pcm990_cpld_writeb(PCM990_CTRL_MMC2PWR, PCM990_CTRL_REG5); + return 0; } static void pcm990_mci_exit(struct device *dev, void *data) diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 711d37e26bd8..aedf053a1de5 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c @@ -258,7 +258,7 @@ err_free_2: return err; } -static void poodle_mci_setpower(struct device *dev, unsigned int vdd) +static int poodle_mci_setpower(struct device *dev, unsigned int vdd) { struct pxamci_platform_data* p_d = dev->platform_data; @@ -270,6 +270,8 @@ static void poodle_mci_setpower(struct device *dev, unsigned int vdd) gpio_set_value(POODLE_GPIO_SD_PWR1, 0); gpio_set_value(POODLE_GPIO_SD_PWR, 0); } + + return 0; } static void poodle_mci_exit(struct device *dev, void *data) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 2125df0444e7..4c29173026e8 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -598,7 +598,7 @@ static inline void spitz_spi_init(void) {} * NOTE: The card detect interrupt isn't debounced so we delay it by 250ms to * give the card a chance to fully insert/eject. */ -static void spitz_mci_setpower(struct device *dev, unsigned int vdd) +static int spitz_mci_setpower(struct device *dev, unsigned int vdd) { struct pxamci_platform_data* p_d = dev->platform_data; @@ -606,6 +606,8 @@ static void spitz_mci_setpower(struct device *dev, unsigned int vdd) spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, SCOOP_CPR_SD_3V); else spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, 0x0); + + return 0; } static struct pxamci_platform_data spitz_mci_platform_data = { diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c index 88fde43c948c..62aea3e835f3 100644 --- a/arch/arm/mach-pxa/stargate2.c +++ b/arch/arm/mach-pxa/stargate2.c @@ -734,9 +734,10 @@ static int stargate2_mci_init(struct device *dev, * * Very simple control. Either it is on or off and is controlled by * a gpio pin */ -static void stargate2_mci_setpower(struct device *dev, unsigned int vdd) +static int stargate2_mci_setpower(struct device *dev, unsigned int vdd) { gpio_set_value(SG2_SD_POWER_ENABLE, !!vdd); + return 0; } static void stargate2_mci_exit(struct device *dev, void *data) diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index 847b1996ce8e..2c5a91bb8ec3 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c @@ -128,7 +128,7 @@ static inline int pxamci_set_power(struct pxamci_host *host, !!on ^ host->pdata->gpio_power_invert); } if (!host->vcc && host->pdata && host->pdata->setpower) - host->pdata->setpower(mmc_dev(host->mmc), vdd); + return host->pdata->setpower(mmc_dev(host->mmc), vdd); return 0; } diff --git a/include/linux/platform_data/mmc-pxamci.h b/include/linux/platform_data/mmc-pxamci.h index 9eb515bb799d..1706b3597ce0 100644 --- a/include/linux/platform_data/mmc-pxamci.h +++ b/include/linux/platform_data/mmc-pxamci.h @@ -12,7 +12,7 @@ struct pxamci_platform_data { unsigned long detect_delay_ms; /* delay in millisecond before detecting cards after interrupt */ int (*init)(struct device *, irq_handler_t , void *); int (*get_ro)(struct device *); - void (*setpower)(struct device *, unsigned int); + int (*setpower)(struct device *, unsigned int); void (*exit)(struct device *, void *); int gpio_card_detect; /* gpio detecting card insertion */ int gpio_card_ro; /* gpio detecting read only toggle */ From a520a9b7edc940fc735c526470313cf963fc72da Mon Sep 17 00:00:00 2001 From: Fabio Estevam <fabio.estevam@freescale.com> Date: Tue, 23 Jul 2013 14:02:06 -0300 Subject: [PATCH 379/913] ARM: multi_v7_defconfig: Select USB chipidea driver CONFIG_USB_EHCI_MXC selects the old i.mx USB driver, which does not support device tree. Select the USB chipidea driver instead, so that USB can be functional on i.mx. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Olof Johansson <olof@lixom.net> --- arch/arm/configs/multi_v7_defconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 120b08edb9a9..6e572c64cf5a 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -114,11 +114,12 @@ CONFIG_FB_SIMPLE=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y -CONFIG_USB_EHCI_MXC=y CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_EHCI_HCD_PLATFORM=y CONFIG_USB_ISP1760_HCD=y CONFIG_USB_STORAGE=y +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_HOST=y CONFIG_AB8500_USB=y CONFIG_NOP_USB_XCEIV=y CONFIG_OMAP_USB2=y From 4f3cc4809a98a165a9708b72b47de71643797bbd Mon Sep 17 00:00:00 2001 From: Trond Myklebust <Trond.Myklebust@netapp.com> Date: Tue, 23 Jul 2013 12:53:39 -0400 Subject: [PATCH 380/913] NFSv4: Fix brainfart in attribute length calculation The calculation of the attribute length was 4 bytes off. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Tested-by: Andre Heider <a.heider@gmail.com> Reported-and-tested-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- fs/nfs/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index c74d6168db99..3850b018815f 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -1118,11 +1118,11 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, len, ((char *)p - (char *)q) + 4); BUG(); } - len = (char *)p - (char *)q - (bmval_len << 2); *q++ = htonl(bmval0); *q++ = htonl(bmval1); if (bmval_len == 3) *q++ = htonl(bmval2); + len = (char *)p - (char *)(q + 1); *q = htonl(len); /* out: */ From 69acbaac303e8cb948801a9ddd0ac24e86cc4a1b Mon Sep 17 00:00:00 2001 From: Ian Abbott <abbotti@mev.co.uk> Date: Mon, 8 Jul 2013 13:36:19 +0100 Subject: [PATCH 381/913] staging: comedi: COMEDI_CANCEL ioctl should wake up read/write Comedi devices can do blocking read() or write() (or poll()) if an asynchronous command has been set up, blocking for data (for read()) or buffer space (for write()). Various events associated with the asynchronous command will wake up the blocked reader or writer (or poller). It is also possible to force the asynchronous command to terminate by issuing a `COMEDI_CANCEL` ioctl. That shuts down the asynchronous command, but does not currently wake up the blocked reader or writer (or poller). If the blocked task could be woken up, it would see that the command is no longer active and return. The caller of the `COMEDI_CANCEL` ioctl could attempt to wake up the blocked task by sending a signal, but that's a nasty workaround. Change `do_cancel_ioctl()` to wake up the wait queue after it returns from `do_cancel()`. `do_cancel()` can propagate an error return value from the low-level comedi driver's cancel routine, but it always shuts the command down regardless, so `do_cancel_ioctl()` can wake up he wait queue regardless of the return value from `do_cancel()`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/staging/comedi/comedi_fops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 8647518259f6..6cdef9d5f8d0 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -1705,6 +1705,7 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg, void *file) { struct comedi_subdevice *s; + int ret; if (arg >= dev->n_subdevices) return -EINVAL; @@ -1721,7 +1722,11 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg, if (s->busy != file) return -EBUSY; - return do_cancel(dev, s); + ret = do_cancel(dev, s); + if (comedi_get_subdevice_runflags(s) & SRF_USER) + wake_up_interruptible(&s->async->wait_head); + + return ret; } /* From 4b18f08be01a7b3c7b6df497137b6e3cb28adaa3 Mon Sep 17 00:00:00 2001 From: Ian Abbott <abbotti@mev.co.uk> Date: Fri, 5 Jul 2013 16:49:34 +0100 Subject: [PATCH 382/913] staging: comedi: fix a race between do_cmd_ioctl() and read/write `do_cmd_ioctl()` is called with the comedi device's mutex locked to process the `COMEDI_CMD` ioctl to set up comedi's asynchronous command handling on a comedi subdevice. `comedi_read()` and `comedi_write()` are the `read` and `write` handlers for the comedi device, but do not lock the mutex (for performance reasons, as some things can hold the mutex for quite a long time). There is a race condition if `comedi_read()` or `comedi_write()` is running at the same time and for the same file object and comedi subdevice as `do_cmd_ioctl()`. `do_cmd_ioctl()` sets the subdevice's `busy` pointer to the file object way before it sets the `SRF_RUNNING` flag in the subdevice's `runflags` member. `comedi_read() and `comedi_write()` check the subdevice's `busy` pointer is pointing to the current file object, then if the `SRF_RUNNING` flag is not set, will call `do_become_nonbusy()` to shut down the asyncronous command. Bad things can happen if the asynchronous command is being shutdown and set up at the same time. To prevent the race, don't set the `busy` pointer until after the `SRF_RUNNING` flag has been set. Also, make sure the mutex is held in `comedi_read()` and `comedi_write()` while calling `do_become_nonbusy()` in order to avoid moving the race condition to a point within that function. Change some error handling `goto cleanup` statements in `do_cmd_ioctl()` to simple `return -ERRFOO` statements as a result of changing when the `busy` pointer is set. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/staging/comedi/comedi_fops.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 6cdef9d5f8d0..f4a197b2d1fd 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -1413,22 +1413,19 @@ static int do_cmd_ioctl(struct comedi_device *dev, DPRINTK("subdevice busy\n"); return -EBUSY; } - s->busy = file; /* make sure channel/gain list isn't too long */ if (cmd.chanlist_len > s->len_chanlist) { DPRINTK("channel/gain list too long %u > %d\n", cmd.chanlist_len, s->len_chanlist); - ret = -EINVAL; - goto cleanup; + return -EINVAL; } /* make sure channel/gain list isn't too short */ if (cmd.chanlist_len < 1) { DPRINTK("channel/gain list too short %u < 1\n", cmd.chanlist_len); - ret = -EINVAL; - goto cleanup; + return -EINVAL; } async->cmd = cmd; @@ -1438,8 +1435,7 @@ static int do_cmd_ioctl(struct comedi_device *dev, kmalloc(async->cmd.chanlist_len * sizeof(int), GFP_KERNEL); if (!async->cmd.chanlist) { DPRINTK("allocation failed\n"); - ret = -ENOMEM; - goto cleanup; + return -ENOMEM; } if (copy_from_user(async->cmd.chanlist, user_chanlist, @@ -1491,6 +1487,9 @@ static int do_cmd_ioctl(struct comedi_device *dev, comedi_set_subdevice_runflags(s, ~0, SRF_USER | SRF_RUNNING); + /* set s->busy _after_ setting SRF_RUNNING flag to avoid race with + * comedi_read() or comedi_write() */ + s->busy = file; ret = s->do_cmd(dev, s); if (ret == 0) return 0; @@ -2058,11 +2057,13 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, if (!comedi_is_subdevice_running(s)) { if (count == 0) { + mutex_lock(&dev->mutex); if (comedi_is_subdevice_in_error(s)) retval = -EPIPE; else retval = 0; do_become_nonbusy(dev, s); + mutex_unlock(&dev->mutex); } break; } @@ -2161,11 +2162,13 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, if (n == 0) { if (!comedi_is_subdevice_running(s)) { + mutex_lock(&dev->mutex); do_become_nonbusy(dev, s); if (comedi_is_subdevice_in_error(s)) retval = -EPIPE; else retval = 0; + mutex_unlock(&dev->mutex); break; } if (file->f_flags & O_NONBLOCK) { @@ -2203,9 +2206,11 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, buf += n; break; /* makes device work like a pipe */ } - if (comedi_is_subdevice_idle(s) && - async->buf_read_count - async->buf_write_count == 0) { - do_become_nonbusy(dev, s); + if (comedi_is_subdevice_idle(s)) { + mutex_lock(&dev->mutex); + if (async->buf_read_count - async->buf_write_count == 0) + do_become_nonbusy(dev, s); + mutex_unlock(&dev->mutex); } set_current_state(TASK_RUNNING); remove_wait_queue(&async->wait_head, &wait); From c8145c56103099565be2e18aeac2a32f79361f3f Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Mon, 22 Jul 2013 09:57:49 +0300 Subject: [PATCH 383/913] staging: frontier: use after free in disconnect() usb_alphatrack_delete() frees "dev" so we can't use it on that path. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/staging/frontier/alphatrack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/frontier/alphatrack.c b/drivers/staging/frontier/alphatrack.c index 5590ebf1da15..817f837b240d 100644 --- a/drivers/staging/frontier/alphatrack.c +++ b/drivers/staging/frontier/alphatrack.c @@ -827,11 +827,11 @@ static void usb_alphatrack_disconnect(struct usb_interface *intf) mutex_unlock(&dev->mtx); usb_alphatrack_delete(dev); } else { + atomic_set(&dev->writes_pending, 0); dev->intf = NULL; mutex_unlock(&dev->mtx); } - atomic_set(&dev->writes_pending, 0); mutex_unlock(&disconnect_mutex); dev_info(&intf->dev, "Alphatrack Surface #%d now disconnected\n", From 3a349cee593a464b25f329a1b76635900187fdb0 Mon Sep 17 00:00:00 2001 From: Paul Bolle <pebolle@tiscali.nl> Date: Sun, 14 Jul 2013 13:29:48 +0200 Subject: [PATCH 384/913] staging: drm/imx: drop "select OF_VIDEOMODE" Commit ac4c1a9b33 ("staging: drm/imx: Add LDB support") added the DRM_IMX_LDB Kconfig entry. That entry selects OF_VIDEOMODE. But there is no Kconfig symbol named OF_VIDEOMODE. The select statement for that symbol is a nop. Drop it. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/staging/imx-drm/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/imx-drm/Kconfig b/drivers/staging/imx-drm/Kconfig index 22339059837f..bd0f2fd01db4 100644 --- a/drivers/staging/imx-drm/Kconfig +++ b/drivers/staging/imx-drm/Kconfig @@ -33,7 +33,6 @@ config DRM_IMX_TVE config DRM_IMX_LDB tristate "Support for LVDS displays" depends on DRM_IMX - select OF_VIDEOMODE help Choose this to enable the internal LVDS Display Bridge (LDB) found on i.MX53 and i.MX6 processors. From f2a6fed1ceaecf6054627f0ddbd4becf43c997fc Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Mon, 22 Jul 2013 11:00:53 +0300 Subject: [PATCH 385/913] staging: gdm72xx: potential use after free in send_qos_list() Sometimes free_qos_entry() sometimes frees its argument. I have moved the dereference of "entry" ahead on line to avoid a use after free. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/staging/gdm72xx/gdm_qos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c index b795353e8348..cc3692439a5c 100644 --- a/drivers/staging/gdm72xx/gdm_qos.c +++ b/drivers/staging/gdm72xx/gdm_qos.c @@ -250,8 +250,8 @@ static void send_qos_list(struct nic *nic, struct list_head *head) list_for_each_entry_safe(entry, n, head, list) { list_del(&entry->list); - free_qos_entry(entry); gdm_wimax_send_tx(entry->skb, entry->dev); + free_qos_entry(entry); } } From 644d478793c6594277f8ae76954da4ace7ac6f96 Mon Sep 17 00:00:00 2001 From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Date: Wed, 26 Jun 2013 15:28:39 +0300 Subject: [PATCH 386/913] staging: zram: protect zram_reset_device() call Commit 9b3bb7abcdf2df0f1b2657e6cbc9d06bc2b3b36f (remove zram_sysfs file (v2)) accidentally made zram_reset_device() racy. Protect zram_reset_device() call with zram->lock. Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Acked-by: Jerome Marchand <jmarchand@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/staging/zram/zram_drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 82c7202fd5cc..e77fb6ea40c9 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c @@ -527,8 +527,11 @@ static void zram_reset_device(struct zram *zram) size_t index; struct zram_meta *meta; - if (!zram->init_done) + down_write(&zram->init_lock); + if (!zram->init_done) { + up_write(&zram->init_lock); return; + } meta = zram->meta; zram->init_done = 0; @@ -549,6 +552,7 @@ static void zram_reset_device(struct zram *zram) zram->disksize = 0; set_capacity(zram->disk, 0); + up_write(&zram->init_lock); } static void zram_init_device(struct zram *zram, struct zram_meta *meta) From 72bb99cfe9c57d2044445fb34bbc95b4c0bae6f2 Mon Sep 17 00:00:00 2001 From: Karlis Ogsts <karlis.ogsts@sonymobile.com> Date: Mon, 22 Jul 2013 13:51:42 -0700 Subject: [PATCH 387/913] staging: android: logger: Correct write offset reset on error In the situation that a writer fails to copy data from userspace it will reset the write offset to the value it had before it went to sleep. This discarding any messages written while aquiring the mutex. Therefore the reset offset needs to be retrieved after acquiring the mutex. Cc: Android Kernel Team <kernel-team@android.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/staging/android/logger.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index 080abf2faf97..a8c344422a77 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c @@ -469,7 +469,7 @@ static ssize_t logger_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t ppos) { struct logger_log *log = file_get_log(iocb->ki_filp); - size_t orig = log->w_off; + size_t orig; struct logger_entry header; struct timespec now; ssize_t ret = 0; @@ -490,6 +490,8 @@ static ssize_t logger_aio_write(struct kiocb *iocb, const struct iovec *iov, mutex_lock(&log->mutex); + orig = log->w_off; + /* * Fix up any readers, pulling them forward to the first readable * entry after (what will be) the new write offset. We do this now From 53a983c4f8b4246f5ff00567411be55967b0350a Mon Sep 17 00:00:00 2001 From: James Bottomley <JBottomley@Parallels.com> Date: Sun, 9 Jun 2013 09:23:16 -0700 Subject: [PATCH 388/913] [SCSI] mvsas: Fix kernel panic on tile due to unaligned data access slot->response is a 64 bit quantity (and accessed as such), but its alignment is only 32 bits. This doesn't cause a problem on x86, but apparently causes a kernel panic on Tile: Stack dump complete Kernel panic - not syncing: Kernel unalign fault running the idle task! Starting stack dump of tid 0, pid 0 (swapper) on cpu 1 at cycle 341586172541 frame 0: 0xfffffff700140ee0 dump_stack+0x0/0x20 (sp 0xfffffe43ffedf420) frame 1: 0xfffffff700283270 panic+0x150/0x3a0 (sp 0xfffffe43ffedf420) frame 2: 0xfffffff70012bff8 jit_bundle_gen+0xfd8/0x27e0 (sp 0xfffffe43ffedf4c8) frame 3: 0xfffffff7003b5b68 do_unaligned+0xc0/0x5a0 (sp 0xfffffe43ffedf710) frame 4: 0xfffffff70044ca78 handle_interrupt+0x270/0x278 (sp 0xfffffe43ffedf840) <interrupt 17 while in kernel mode> frame 5: 0xfffffff7002ac370 mvs_slot_complete+0x5f0/0x12a0 (sp 0xfffffe43ffedfa90) frame 6: 0xfffffff7002abec0 mvs_slot_complete+0x140/0x12a0 (sp 0xfffffe43ffedfa90) frame 7: 0xfffffff7005cc840 mvs_int_rx+0x140/0x2a0 (sp 0xfffffe43ffedfb00) frame 8: 0xfffffff7005bbaf0 mvs_94xx_isr+0xd8/0x2b8 (sp 0xfffffe43ffedfb68) frame 9: 0xfffffff700658ba0 mvs_tasklet+0x128/0x1f8 (sp 0xfffffe43ffedfba8) frame 10: 0xfffffff7003e8230 tasklet_action+0x178/0x2c8 (sp 0xfffffe43ffedfbe0) frame 11: 0xfffffff700103850 __do_softirq+0x210/0x398 (sp 0xfffffe43ffedfc40) frame 12: 0xfffffff700180308 do_softirq+0xc8/0x140 (sp 0xfffffe43ffedfcd8) frame 13: 0xfffffff7000bd7f0 irq_exit+0xb0/0x158 (sp 0xfffffe43ffedfcf0) frame 14: 0xfffffff70013fa58 tile_dev_intr+0x1d8/0x2f0 (sp 0xfffffe43ffedfd00) frame 15: 0xfffffff70044ca78 handle_interrupt+0x270/0x278 (sp 0xfffffe43ffedfd40) <interrupt 30 while in kernel mode> frame 16: 0xfffffff700143e68 _cpu_idle_nap+0x0/0x18 (sp 0xfffffe43ffedffb0) frame 17: 0xfffffff700482480 cpu_idle+0x310/0x428 (sp 0xfffffe43ffedffb0) Since the check is just for non-zero, split it to be two 32 bit accesses (preserving speed in the fast path) and do a get_unaligned() in the slow path. This is a modification of a wholly get_unaligned patch submitted by Paul Guo Reported-by: Paul Guo <ggang@tilera.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com> --- drivers/scsi/mvsas/mv_sas.c | 11 ++++++++--- drivers/scsi/mvsas/mv_sas.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c index f14665a6293d..6b1b4e91e53f 100644 --- a/drivers/scsi/mvsas/mv_sas.c +++ b/drivers/scsi/mvsas/mv_sas.c @@ -1857,11 +1857,16 @@ int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags) goto out; } - /* error info record present */ - if (unlikely((rx_desc & RXQ_ERR) && (*(u64 *) slot->response))) { + /* + * error info record present; slot->response is 32 bit aligned but may + * not be 64 bit aligned, so check for zero in two 32 bit reads + */ + if (unlikely((rx_desc & RXQ_ERR) + && (*((u32 *)slot->response) + || *(((u32 *)slot->response) + 1)))) { mv_dprintk("port %d slot %d rx_desc %X has error info" "%016llX.\n", slot->port->sas_port.id, slot_idx, - rx_desc, (u64)(*(u64 *)slot->response)); + rx_desc, get_unaligned_le64(slot->response)); tstat->stat = mvs_slot_err(mvi, task, slot_idx); tstat->resp = SAS_TASK_COMPLETE; goto out; diff --git a/drivers/scsi/mvsas/mv_sas.h b/drivers/scsi/mvsas/mv_sas.h index 60e2fb7f2dca..d6b19dc80bee 100644 --- a/drivers/scsi/mvsas/mv_sas.h +++ b/drivers/scsi/mvsas/mv_sas.h @@ -39,6 +39,7 @@ #include <linux/irq.h> #include <linux/slab.h> #include <linux/vmalloc.h> +#include <asm/unaligned.h> #include <scsi/libsas.h> #include <scsi/scsi.h> #include <scsi/scsi_tcq.h> From 42577ca8c3616baaafdd8f167b2e1fb959026081 Mon Sep 17 00:00:00 2001 From: David Howells <dhowells@redhat.com> Date: Tue, 23 Jul 2013 16:49:24 +0100 Subject: [PATCH 389/913] Fix __wait_on_atomic_t() to call the action func if the counter != 0 Fix __wait_on_atomic_t() so that it calls the action func if the counter != 0 rather than if the counter is 0 so as to be analogous to __wait_on_bit(). Thanks to Yacine who found this by visual inspection. This will affect FS-Cache in that it will could fail to sleep correctly when trying to clean up after a netfs cookie is withdrawn. Reported-by: Yacine Belkadi <yacine.belkadi.1@gmail.com> Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> cc: Milosz Tanski <milosz@adfin.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- kernel/wait.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/wait.c b/kernel/wait.c index ce0daa320a26..dec68bd4e9d8 100644 --- a/kernel/wait.c +++ b/kernel/wait.c @@ -333,7 +333,8 @@ int __wait_on_atomic_t(wait_queue_head_t *wq, struct wait_bit_queue *q, prepare_to_wait(wq, &q->wait, mode); val = q->key.flags; if (atomic_read(val) == 0) - ret = (*action)(val); + break; + ret = (*action)(val); } while (!ret && atomic_read(val) != 0); finish_wait(wq, &q->wait); return ret; From 88d84ac97378c2f1d5fec9af1e8b7d9a662d6b00 Mon Sep 17 00:00:00 2001 From: Borislav Petkov <bp@suse.de> Date: Fri, 19 Jul 2013 12:28:25 +0200 Subject: [PATCH 390/913] EDAC: Fix lockdep splat Fix the following: BUG: key ffff88043bdd0330 not in .data! ------------[ cut here ]------------ WARNING: at kernel/lockdep.c:2987 lockdep_init_map+0x565/0x5a0() DEBUG_LOCKS_WARN_ON(1) Modules linked in: glue_helper sb_edac(+) edac_core snd acpi_cpufreq lrw gf128mul ablk_helper iTCO_wdt evdev i2c_i801 dcdbas button cryptd pcspkr iTCO_vendor_support usb_common lpc_ich mfd_core soundcore mperf processor microcode CPU: 2 PID: 599 Comm: modprobe Not tainted 3.10.0 #1 Hardware name: Dell Inc. Precision T3600/0PTTT9, BIOS A08 01/24/2013 0000000000000009 ffff880439a1d920 ffffffff8160a9a9 ffff880439a1d958 ffffffff8103d9e0 ffff88043af4a510 ffffffff81a16e11 0000000000000000 ffff88043bdd0330 0000000000000000 ffff880439a1d9b8 ffffffff8103dacc Call Trace: dump_stack warn_slowpath_common warn_slowpath_fmt lockdep_init_map ? trace_hardirqs_on_caller ? trace_hardirqs_on debug_mutex_init __mutex_init bus_register edac_create_sysfs_mci_device edac_mc_add_mc sbridge_probe pci_device_probe driver_probe_device __driver_attach ? driver_probe_device bus_for_each_dev driver_attach bus_add_driver driver_register __pci_register_driver ? 0xffffffffa0010fff sbridge_init ? 0xffffffffa0010fff do_one_initcall load_module ? unset_module_init_ro_nx SyS_init_module tracesys ---[ end trace d24a70b0d3ddf733 ]--- EDAC MC0: Giving out device to 'sbridge_edac.c' 'Sandy Bridge Socket#0': DEV 0000:3f:0e.0 EDAC sbridge: Driver loaded. What happens is that bus_register needs a statically allocated lock_key because the last is handed in to lockdep. However, struct mem_ctl_info embeds struct bus_type (the whole struct, not a pointer to it) and the whole thing gets dynamically allocated. Fix this by using a statically allocated struct bus_type for the MC bus. Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org> Cc: Markus Trippelsdorf <markus@trippelsdorf.de> Cc: stable@kernel.org # v3.10 Signed-off-by: Tony Luck <tony.luck@intel.com> --- drivers/edac/edac_mc.c | 9 +++++++++ drivers/edac/edac_mc_sysfs.c | 28 +++++++++++++++------------- drivers/edac/i5100_edac.c | 2 +- include/linux/edac.h | 7 ++++++- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 27e86d938262..89e109022d78 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -48,6 +48,8 @@ static LIST_HEAD(mc_devices); */ static void const *edac_mc_owner; +static struct bus_type mc_bus[EDAC_MAX_MCS]; + unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf, unsigned len) { @@ -723,6 +725,11 @@ int edac_mc_add_mc(struct mem_ctl_info *mci) int ret = -EINVAL; edac_dbg(0, "\n"); + if (mci->mc_idx >= EDAC_MAX_MCS) { + pr_warn_once("Too many memory controllers: %d\n", mci->mc_idx); + return -ENODEV; + } + #ifdef CONFIG_EDAC_DEBUG if (edac_debug_level >= 3) edac_mc_dump_mci(mci); @@ -762,6 +769,8 @@ int edac_mc_add_mc(struct mem_ctl_info *mci) /* set load time so that error rate can be tracked */ mci->start_time = jiffies; + mci->bus = &mc_bus[mci->mc_idx]; + if (edac_create_sysfs_mci_device(mci)) { edac_mc_printk(mci, KERN_WARNING, "failed to create sysfs device\n"); diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index ef15a7e613bc..e7c32c4f7837 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c @@ -370,7 +370,7 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci, return -ENODEV; csrow->dev.type = &csrow_attr_type; - csrow->dev.bus = &mci->bus; + csrow->dev.bus = mci->bus; device_initialize(&csrow->dev); csrow->dev.parent = &mci->dev; csrow->mci = mci; @@ -605,7 +605,7 @@ static int edac_create_dimm_object(struct mem_ctl_info *mci, dimm->mci = mci; dimm->dev.type = &dimm_attr_type; - dimm->dev.bus = &mci->bus; + dimm->dev.bus = mci->bus; device_initialize(&dimm->dev); dimm->dev.parent = &mci->dev; @@ -975,11 +975,13 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) * The memory controller needs its own bus, in order to avoid * namespace conflicts at /sys/bus/edac. */ - mci->bus.name = kasprintf(GFP_KERNEL, "mc%d", mci->mc_idx); - if (!mci->bus.name) + mci->bus->name = kasprintf(GFP_KERNEL, "mc%d", mci->mc_idx); + if (!mci->bus->name) return -ENOMEM; - edac_dbg(0, "creating bus %s\n", mci->bus.name); - err = bus_register(&mci->bus); + + edac_dbg(0, "creating bus %s\n", mci->bus->name); + + err = bus_register(mci->bus); if (err < 0) return err; @@ -988,7 +990,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) device_initialize(&mci->dev); mci->dev.parent = mci_pdev; - mci->dev.bus = &mci->bus; + mci->dev.bus = mci->bus; dev_set_name(&mci->dev, "mc%d", mci->mc_idx); dev_set_drvdata(&mci->dev, mci); pm_runtime_forbid(&mci->dev); @@ -997,8 +999,8 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) err = device_add(&mci->dev); if (err < 0) { edac_dbg(1, "failure: create device %s\n", dev_name(&mci->dev)); - bus_unregister(&mci->bus); - kfree(mci->bus.name); + bus_unregister(mci->bus); + kfree(mci->bus->name); return err; } @@ -1064,8 +1066,8 @@ fail: } fail2: device_unregister(&mci->dev); - bus_unregister(&mci->bus); - kfree(mci->bus.name); + bus_unregister(mci->bus); + kfree(mci->bus->name); return err; } @@ -1098,8 +1100,8 @@ void edac_unregister_sysfs(struct mem_ctl_info *mci) { edac_dbg(1, "Unregistering device %s\n", dev_name(&mci->dev)); device_unregister(&mci->dev); - bus_unregister(&mci->bus); - kfree(mci->bus.name); + bus_unregister(mci->bus); + kfree(mci->bus->name); } static void mc_attr_release(struct device *dev) diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c index 1b635178cc44..157b934e8ce3 100644 --- a/drivers/edac/i5100_edac.c +++ b/drivers/edac/i5100_edac.c @@ -974,7 +974,7 @@ static int i5100_setup_debugfs(struct mem_ctl_info *mci) if (!i5100_debugfs) return -ENODEV; - priv->debugfs = debugfs_create_dir(mci->bus.name, i5100_debugfs); + priv->debugfs = debugfs_create_dir(mci->bus->name, i5100_debugfs); if (!priv->debugfs) return -ENOMEM; diff --git a/include/linux/edac.h b/include/linux/edac.h index 0b763276f619..5c6d7fbaf89e 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -622,7 +622,7 @@ struct edac_raw_error_desc { */ struct mem_ctl_info { struct device dev; - struct bus_type bus; + struct bus_type *bus; struct list_head link; /* for global list of mem_ctl_info structs */ @@ -742,4 +742,9 @@ struct mem_ctl_info { #endif }; +/* + * Maximum number of memory controllers in the coherent fabric. + */ +#define EDAC_MAX_MCS 16 + #endif From 94190301ffa059c2d127b3a67ec5d161d5c62681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no> Date: Fri, 28 Jun 2013 17:15:25 +0200 Subject: [PATCH 391/913] usb: option: add TP-LINK MA260 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork <bjorn@mork.no> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 9cc40031c23c..bd02f257de13 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -1334,6 +1334,8 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600E) }, { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180), .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, + { USB_DEVICE(TPLINK_VENDOR_ID, 0x9000), /* TP-Link MA260 */ + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE(CHANGHONG_VENDOR_ID, CHANGHONG_PRODUCT_CH690) }, { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d01, 0xff, 0x02, 0x01) }, /* D-Link DWM-156 (variant) */ { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d01, 0xff, 0x00, 0x00) }, /* D-Link DWM-156 (variant) */ From f8c0aca9fda7856a8a8d61d523ba3187affbd714 Mon Sep 17 00:00:00 2001 From: Fabio Estevam <fabio.estevam@freescale.com> Date: Sat, 20 Jul 2013 16:20:36 -0300 Subject: [PATCH 392/913] fec: Add MODULE_ALIAS Add MODULE_ALIAS, so that auto module loading can work. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/freescale/fec_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index d3ad5ea711d3..f0f0e96453a0 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -2279,4 +2279,5 @@ static struct platform_driver fec_driver = { module_platform_driver(fec_driver); +MODULE_ALIAS("platform:"DRIVER_NAME); MODULE_LICENSE("GPL"); From 0665f9f852b4ac05f2f62046a169f0f5b9212317 Mon Sep 17 00:00:00 2001 From: Dave Airlie <airlied@redhat.com> Date: Mon, 22 Jul 2013 14:37:39 +1000 Subject: [PATCH 393/913] drm/qxl: add delayed fb operations Due to the nature of qxl hw we cannot queue operations while in an irq context, so we queue these operations as best we can until atomic allocations fail, and dequeue them later in a work queue. Daniel looked over the locking on the list and agrees it should be sufficent. The atomic allocs use no warn, as the last thing we want if we haven't memory to allocate space for a printk in an irq context is more printks. Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/qxl/qxl_drv.h | 1 + drivers/gpu/drm/qxl/qxl_fb.c | 188 +++++++++++++++++++++++++++++----- 2 files changed, 166 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index aacb791464a3..6a4106fb4c21 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h @@ -314,6 +314,7 @@ struct qxl_device { struct workqueue_struct *gc_queue; struct work_struct gc_work; + struct work_struct fb_work; }; /* forward declaration for QXL_INFO_IO */ diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c index 76f39d88d684..88722f233430 100644 --- a/drivers/gpu/drm/qxl/qxl_fb.c +++ b/drivers/gpu/drm/qxl/qxl_fb.c @@ -37,12 +37,29 @@ #define QXL_DIRTY_DELAY (HZ / 30) +#define QXL_FB_OP_FILLRECT 1 +#define QXL_FB_OP_COPYAREA 2 +#define QXL_FB_OP_IMAGEBLIT 3 + +struct qxl_fb_op { + struct list_head head; + int op_type; + union { + struct fb_fillrect fr; + struct fb_copyarea ca; + struct fb_image ib; + } op; + void *img_data; +}; + struct qxl_fbdev { struct drm_fb_helper helper; struct qxl_framebuffer qfb; struct list_head fbdev_list; struct qxl_device *qdev; + spinlock_t delayed_ops_lock; + struct list_head delayed_ops; void *shadow; int size; @@ -164,8 +181,69 @@ static struct fb_deferred_io qxl_defio = { .deferred_io = qxl_deferred_io, }; -static void qxl_fb_fillrect(struct fb_info *info, - const struct fb_fillrect *fb_rect) +static void qxl_fb_delayed_fillrect(struct qxl_fbdev *qfbdev, + const struct fb_fillrect *fb_rect) +{ + struct qxl_fb_op *op; + unsigned long flags; + + op = kmalloc(sizeof(struct qxl_fb_op), GFP_ATOMIC | __GFP_NOWARN); + if (!op) + return; + + op->op.fr = *fb_rect; + op->img_data = NULL; + op->op_type = QXL_FB_OP_FILLRECT; + + spin_lock_irqsave(&qfbdev->delayed_ops_lock, flags); + list_add_tail(&op->head, &qfbdev->delayed_ops); + spin_unlock_irqrestore(&qfbdev->delayed_ops_lock, flags); +} + +static void qxl_fb_delayed_copyarea(struct qxl_fbdev *qfbdev, + const struct fb_copyarea *fb_copy) +{ + struct qxl_fb_op *op; + unsigned long flags; + + op = kmalloc(sizeof(struct qxl_fb_op), GFP_ATOMIC | __GFP_NOWARN); + if (!op) + return; + + op->op.ca = *fb_copy; + op->img_data = NULL; + op->op_type = QXL_FB_OP_COPYAREA; + + spin_lock_irqsave(&qfbdev->delayed_ops_lock, flags); + list_add_tail(&op->head, &qfbdev->delayed_ops); + spin_unlock_irqrestore(&qfbdev->delayed_ops_lock, flags); +} + +static void qxl_fb_delayed_imageblit(struct qxl_fbdev *qfbdev, + const struct fb_image *fb_image) +{ + struct qxl_fb_op *op; + unsigned long flags; + uint32_t size = fb_image->width * fb_image->height * (fb_image->depth >= 8 ? fb_image->depth / 8 : 1); + + op = kmalloc(sizeof(struct qxl_fb_op) + size, GFP_ATOMIC | __GFP_NOWARN); + if (!op) + return; + + op->op.ib = *fb_image; + op->img_data = (void *)(op + 1); + op->op_type = QXL_FB_OP_IMAGEBLIT; + + memcpy(op->img_data, fb_image->data, size); + + op->op.ib.data = op->img_data; + spin_lock_irqsave(&qfbdev->delayed_ops_lock, flags); + list_add_tail(&op->head, &qfbdev->delayed_ops); + spin_unlock_irqrestore(&qfbdev->delayed_ops_lock, flags); +} + +static void qxl_fb_fillrect_internal(struct fb_info *info, + const struct fb_fillrect *fb_rect) { struct qxl_fbdev *qfbdev = info->par; struct qxl_device *qdev = qfbdev->qdev; @@ -203,17 +281,28 @@ static void qxl_fb_fillrect(struct fb_info *info, qxl_draw_fill_rec.rect = rect; qxl_draw_fill_rec.color = color; qxl_draw_fill_rec.rop = rop; - if (!drm_can_sleep()) { - qxl_io_log(qdev, - "%s: TODO use RCU, mysterious locks with spin_lock\n", - __func__); - return; - } + qxl_draw_fill(&qxl_draw_fill_rec); } -static void qxl_fb_copyarea(struct fb_info *info, - const struct fb_copyarea *region) +static void qxl_fb_fillrect(struct fb_info *info, + const struct fb_fillrect *fb_rect) +{ + struct qxl_fbdev *qfbdev = info->par; + struct qxl_device *qdev = qfbdev->qdev; + + if (!drm_can_sleep()) { + qxl_fb_delayed_fillrect(qfbdev, fb_rect); + schedule_work(&qdev->fb_work); + return; + } + /* make sure any previous work is done */ + flush_work(&qdev->fb_work); + qxl_fb_fillrect_internal(info, fb_rect); +} + +static void qxl_fb_copyarea_internal(struct fb_info *info, + const struct fb_copyarea *region) { struct qxl_fbdev *qfbdev = info->par; @@ -223,37 +312,89 @@ static void qxl_fb_copyarea(struct fb_info *info, region->dx, region->dy); } +static void qxl_fb_copyarea(struct fb_info *info, + const struct fb_copyarea *region) +{ + struct qxl_fbdev *qfbdev = info->par; + struct qxl_device *qdev = qfbdev->qdev; + + if (!drm_can_sleep()) { + qxl_fb_delayed_copyarea(qfbdev, region); + schedule_work(&qdev->fb_work); + return; + } + /* make sure any previous work is done */ + flush_work(&qdev->fb_work); + qxl_fb_copyarea_internal(info, region); +} + static void qxl_fb_imageblit_safe(struct qxl_fb_image *qxl_fb_image) { qxl_draw_opaque_fb(qxl_fb_image, 0); } +static void qxl_fb_imageblit_internal(struct fb_info *info, + const struct fb_image *image) +{ + struct qxl_fbdev *qfbdev = info->par; + struct qxl_fb_image qxl_fb_image; + + /* ensure proper order rendering operations - TODO: must do this + * for everything. */ + qxl_fb_image_init(&qxl_fb_image, qfbdev->qdev, info, image); + qxl_fb_imageblit_safe(&qxl_fb_image); +} + static void qxl_fb_imageblit(struct fb_info *info, const struct fb_image *image) { struct qxl_fbdev *qfbdev = info->par; struct qxl_device *qdev = qfbdev->qdev; - struct qxl_fb_image qxl_fb_image; if (!drm_can_sleep()) { - /* we cannot do any ttm_bo allocation since that will fail on - * ioremap_wc..__get_vm_area_node, so queue the work item - * instead This can happen from printk inside an interrupt - * context, i.e.: smp_apic_timer_interrupt..check_cpu_stall */ - qxl_io_log(qdev, - "%s: TODO use RCU, mysterious locks with spin_lock\n", - __func__); + qxl_fb_delayed_imageblit(qfbdev, image); + schedule_work(&qdev->fb_work); return; } + /* make sure any previous work is done */ + flush_work(&qdev->fb_work); + qxl_fb_imageblit_internal(info, image); +} - /* ensure proper order of rendering operations - TODO: must do this - * for everything. */ - qxl_fb_image_init(&qxl_fb_image, qfbdev->qdev, info, image); - qxl_fb_imageblit_safe(&qxl_fb_image); +static void qxl_fb_work(struct work_struct *work) +{ + struct qxl_device *qdev = container_of(work, struct qxl_device, fb_work); + unsigned long flags; + struct qxl_fb_op *entry, *tmp; + struct qxl_fbdev *qfbdev = qdev->mode_info.qfbdev; + + /* since the irq context just adds entries to the end of the + list dropping the lock should be fine, as entry isn't modified + in the operation code */ + spin_lock_irqsave(&qfbdev->delayed_ops_lock, flags); + list_for_each_entry_safe(entry, tmp, &qfbdev->delayed_ops, head) { + spin_unlock_irqrestore(&qfbdev->delayed_ops_lock, flags); + switch (entry->op_type) { + case QXL_FB_OP_FILLRECT: + qxl_fb_fillrect_internal(qfbdev->helper.fbdev, &entry->op.fr); + break; + case QXL_FB_OP_COPYAREA: + qxl_fb_copyarea_internal(qfbdev->helper.fbdev, &entry->op.ca); + break; + case QXL_FB_OP_IMAGEBLIT: + qxl_fb_imageblit_internal(qfbdev->helper.fbdev, &entry->op.ib); + break; + } + spin_lock_irqsave(&qfbdev->delayed_ops_lock, flags); + list_del(&entry->head); + kfree(entry); + } + spin_unlock_irqrestore(&qfbdev->delayed_ops_lock, flags); } int qxl_fb_init(struct qxl_device *qdev) { + INIT_WORK(&qdev->fb_work, qxl_fb_work); return 0; } @@ -536,7 +677,8 @@ int qxl_fbdev_init(struct qxl_device *qdev) qfbdev->qdev = qdev; qdev->mode_info.qfbdev = qfbdev; qfbdev->helper.funcs = &qxl_fb_helper_funcs; - + spin_lock_init(&qfbdev->delayed_ops_lock); + INIT_LIST_HEAD(&qfbdev->delayed_ops); ret = drm_fb_helper_init(qdev->ddev, &qfbdev->helper, qxl_num_crtc /* num_crtc - QXL supports just 1 */, QXLFB_CONN_LIMIT); From 4f49ec92be64ad1d96cf5d26fc8276f9849202a3 Mon Sep 17 00:00:00 2001 From: Dave Airlie <airlied@redhat.com> Date: Tue, 23 Jul 2013 14:06:07 +1000 Subject: [PATCH 394/913] qxl: allow creation of pre-pinned objects and use for releases. In order to fix an issue with reservations we need to create the releases as pre-pinned objects, this changes the placement interface and bo creation interface to allow creating pinned objects to save nested reservations later. This is just a stepping stone to main fix which follows to actually fix how qxl deals with reservations. Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/qxl/qxl_cmd.c | 2 +- drivers/gpu/drm/qxl/qxl_gem.c | 2 +- drivers/gpu/drm/qxl/qxl_ioctl.c | 2 +- drivers/gpu/drm/qxl/qxl_object.c | 23 +++++++++++------------ drivers/gpu/drm/qxl/qxl_object.h | 4 ++-- drivers/gpu/drm/qxl/qxl_release.c | 9 +++------ drivers/gpu/drm/qxl/qxl_ttm.c | 2 +- 7 files changed, 20 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c index 93c2f2cceb51..4e6a62716618 100644 --- a/drivers/gpu/drm/qxl/qxl_cmd.c +++ b/drivers/gpu/drm/qxl/qxl_cmd.c @@ -266,7 +266,7 @@ int qxl_alloc_bo_reserved(struct qxl_device *qdev, unsigned long size, int ret; ret = qxl_bo_create(qdev, size, false /* not kernel - device */, - QXL_GEM_DOMAIN_VRAM, NULL, &bo); + false, QXL_GEM_DOMAIN_VRAM, NULL, &bo); if (ret) { DRM_ERROR("failed to allocate VRAM BO\n"); return ret; diff --git a/drivers/gpu/drm/qxl/qxl_gem.c b/drivers/gpu/drm/qxl/qxl_gem.c index a235693aabba..25e1777fb0a2 100644 --- a/drivers/gpu/drm/qxl/qxl_gem.c +++ b/drivers/gpu/drm/qxl/qxl_gem.c @@ -55,7 +55,7 @@ int qxl_gem_object_create(struct qxl_device *qdev, int size, /* At least align on page size */ if (alignment < PAGE_SIZE) alignment = PAGE_SIZE; - r = qxl_bo_create(qdev, size, kernel, initial_domain, surf, &qbo); + r = qxl_bo_create(qdev, size, kernel, false, initial_domain, surf, &qbo); if (r) { if (r != -ERESTARTSYS) DRM_ERROR( diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c index 27f45e49250d..7448c5ea92e6 100644 --- a/drivers/gpu/drm/qxl/qxl_ioctl.c +++ b/drivers/gpu/drm/qxl/qxl_ioctl.c @@ -305,7 +305,7 @@ static int qxl_update_area_ioctl(struct drm_device *dev, void *data, goto out; if (!qobj->pin_count) { - qxl_ttm_placement_from_domain(qobj, qobj->type); + qxl_ttm_placement_from_domain(qobj, qobj->type, false); ret = ttm_bo_validate(&qobj->tbo, &qobj->placement, true, false); if (unlikely(ret)) diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c index 1191fe7788c9..50e7a6177167 100644 --- a/drivers/gpu/drm/qxl/qxl_object.c +++ b/drivers/gpu/drm/qxl/qxl_object.c @@ -51,20 +51,21 @@ bool qxl_ttm_bo_is_qxl_bo(struct ttm_buffer_object *bo) return false; } -void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain) +void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain, bool pinned) { u32 c = 0; + u32 pflag = pinned ? TTM_PL_FLAG_NO_EVICT : 0; qbo->placement.fpfn = 0; qbo->placement.lpfn = 0; qbo->placement.placement = qbo->placements; qbo->placement.busy_placement = qbo->placements; if (domain == QXL_GEM_DOMAIN_VRAM) - qbo->placements[c++] = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_VRAM; + qbo->placements[c++] = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_VRAM | pflag; if (domain == QXL_GEM_DOMAIN_SURFACE) - qbo->placements[c++] = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_PRIV0; + qbo->placements[c++] = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_PRIV0 | pflag; if (domain == QXL_GEM_DOMAIN_CPU) - qbo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM; + qbo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM | pflag; if (!c) qbo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM; qbo->placement.num_placement = c; @@ -73,7 +74,7 @@ void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain) int qxl_bo_create(struct qxl_device *qdev, - unsigned long size, bool kernel, u32 domain, + unsigned long size, bool kernel, bool pinned, u32 domain, struct qxl_surface *surf, struct qxl_bo **bo_ptr) { @@ -99,7 +100,7 @@ int qxl_bo_create(struct qxl_device *qdev, } bo->gem_base.driver_private = NULL; bo->type = domain; - bo->pin_count = 0; + bo->pin_count = pinned ? 1 : 0; bo->surface_id = 0; qxl_fence_init(qdev, &bo->fence); INIT_LIST_HEAD(&bo->list); @@ -107,7 +108,7 @@ int qxl_bo_create(struct qxl_device *qdev, if (surf) bo->surf = *surf; - qxl_ttm_placement_from_domain(bo, domain); + qxl_ttm_placement_from_domain(bo, domain, pinned); r = ttm_bo_init(&qdev->mman.bdev, &bo->tbo, size, type, &bo->placement, 0, !kernel, NULL, size, @@ -228,7 +229,7 @@ struct qxl_bo *qxl_bo_ref(struct qxl_bo *bo) int qxl_bo_pin(struct qxl_bo *bo, u32 domain, u64 *gpu_addr) { struct qxl_device *qdev = (struct qxl_device *)bo->gem_base.dev->dev_private; - int r, i; + int r; if (bo->pin_count) { bo->pin_count++; @@ -236,9 +237,7 @@ int qxl_bo_pin(struct qxl_bo *bo, u32 domain, u64 *gpu_addr) *gpu_addr = qxl_bo_gpu_offset(bo); return 0; } - qxl_ttm_placement_from_domain(bo, domain); - for (i = 0; i < bo->placement.num_placement; i++) - bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; + qxl_ttm_placement_from_domain(bo, domain, true); r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false); if (likely(r == 0)) { bo->pin_count = 1; @@ -350,7 +349,7 @@ int qxl_bo_list_add(struct qxl_reloc_list *reloc_list, struct qxl_bo *bo) return ret; if (!bo->pin_count) { - qxl_ttm_placement_from_domain(bo, bo->type); + qxl_ttm_placement_from_domain(bo, bo->type, false); ret = ttm_bo_validate(&bo->tbo, &bo->placement, true, false); if (ret) diff --git a/drivers/gpu/drm/qxl/qxl_object.h b/drivers/gpu/drm/qxl/qxl_object.h index ee7ad79ce781..116637f09347 100644 --- a/drivers/gpu/drm/qxl/qxl_object.h +++ b/drivers/gpu/drm/qxl/qxl_object.h @@ -88,7 +88,7 @@ static inline int qxl_bo_wait(struct qxl_bo *bo, u32 *mem_type, extern int qxl_bo_create(struct qxl_device *qdev, unsigned long size, - bool kernel, u32 domain, + bool kernel, bool pinned, u32 domain, struct qxl_surface *surf, struct qxl_bo **bo_ptr); extern int qxl_bo_kmap(struct qxl_bo *bo, void **ptr); @@ -99,7 +99,7 @@ extern struct qxl_bo *qxl_bo_ref(struct qxl_bo *bo); extern void qxl_bo_unref(struct qxl_bo **bo); extern int qxl_bo_pin(struct qxl_bo *bo, u32 domain, u64 *gpu_addr); extern int qxl_bo_unpin(struct qxl_bo *bo); -extern void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain); +extern void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain, bool pinned); extern bool qxl_ttm_bo_is_qxl_bo(struct ttm_buffer_object *bo); extern int qxl_bo_list_add(struct qxl_reloc_list *reloc_list, struct qxl_bo *bo); diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c index b443d6751d5f..b7f1271c6014 100644 --- a/drivers/gpu/drm/qxl/qxl_release.c +++ b/drivers/gpu/drm/qxl/qxl_release.c @@ -118,7 +118,9 @@ static int qxl_release_bo_alloc(struct qxl_device *qdev, struct qxl_bo **bo) { int ret; - ret = qxl_bo_create(qdev, PAGE_SIZE, false, QXL_GEM_DOMAIN_VRAM, NULL, + /* pin releases bo's they are too messy to evict */ + ret = qxl_bo_create(qdev, PAGE_SIZE, false, true, + QXL_GEM_DOMAIN_VRAM, NULL, bo); return ret; } @@ -216,11 +218,6 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, mutex_unlock(&qdev->release_mutex); return ret; } - - /* pin releases bo's they are too messy to evict */ - ret = qxl_bo_reserve(qdev->current_release_bo[cur_idx], false); - qxl_bo_pin(qdev->current_release_bo[cur_idx], QXL_GEM_DOMAIN_VRAM, NULL); - qxl_bo_unreserve(qdev->current_release_bo[cur_idx]); } bo = qxl_bo_ref(qdev->current_release_bo[cur_idx]); diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c index 489cb8cece4d..1dfd84cda2a1 100644 --- a/drivers/gpu/drm/qxl/qxl_ttm.c +++ b/drivers/gpu/drm/qxl/qxl_ttm.c @@ -206,7 +206,7 @@ static void qxl_evict_flags(struct ttm_buffer_object *bo, return; } qbo = container_of(bo, struct qxl_bo, tbo); - qxl_ttm_placement_from_domain(qbo, QXL_GEM_DOMAIN_CPU); + qxl_ttm_placement_from_domain(qbo, QXL_GEM_DOMAIN_CPU, false); *placement = qbo->placement; } From 8002db6336dd361fc13214e9515fe5d52ff294ee Mon Sep 17 00:00:00 2001 From: Dave Airlie <airlied@redhat.com> Date: Tue, 23 Jul 2013 14:16:42 +1000 Subject: [PATCH 395/913] qxl: convert qxl driver to proper use for reservations The recent addition of lockdep support to reservations and their subsequent use by TTM showed up a number of potential problems with the way qxl was using TTM objects. a) it was allocating objects, and reserving them later without validating underneath the reservation, which meant in extreme conditions the objects could be evicted before the reservation ever used them. b) it was reserving objects straight after allocating them, but with no ability to back off should the reservations fail. It now allocates the necessary objects then does a complete reservation pass on them to avoid deadlocks. c) it had two lists per release tracking objects, unnecessary complicating the reservation process. This patch removes the dual object tracking, adds reservations ticket support to the release and fence object handling. It then ports the internal fb drawing code and the userspace facing ioctl to use the new interfaces properly, along with cleanup up the error path handling in some codepaths. Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/qxl/qxl_cmd.c | 40 ++-- drivers/gpu/drm/qxl/qxl_display.c | 70 ++++--- drivers/gpu/drm/qxl/qxl_draw.c | 269 +++++++++++++++++-------- drivers/gpu/drm/qxl/qxl_drv.h | 75 +++---- drivers/gpu/drm/qxl/qxl_fence.c | 10 +- drivers/gpu/drm/qxl/qxl_image.c | 113 ++++++++--- drivers/gpu/drm/qxl/qxl_ioctl.c | 321 ++++++++++++++++-------------- drivers/gpu/drm/qxl/qxl_object.c | 49 +---- drivers/gpu/drm/qxl/qxl_object.h | 2 - drivers/gpu/drm/qxl/qxl_release.c | 203 ++++++++++++------- 10 files changed, 682 insertions(+), 470 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c index 4e6a62716618..eb89653a7a17 100644 --- a/drivers/gpu/drm/qxl/qxl_cmd.c +++ b/drivers/gpu/drm/qxl/qxl_cmd.c @@ -179,9 +179,10 @@ qxl_push_command_ring_release(struct qxl_device *qdev, struct qxl_release *relea uint32_t type, bool interruptible) { struct qxl_command cmd; + struct qxl_bo_list *entry = list_first_entry(&release->bos, struct qxl_bo_list, tv.head); cmd.type = type; - cmd.data = qxl_bo_physical_address(qdev, release->bos[0], release->release_offset); + cmd.data = qxl_bo_physical_address(qdev, to_qxl_bo(entry->tv.bo), release->release_offset); return qxl_ring_push(qdev->command_ring, &cmd, interruptible); } @@ -191,9 +192,10 @@ qxl_push_cursor_ring_release(struct qxl_device *qdev, struct qxl_release *releas uint32_t type, bool interruptible) { struct qxl_command cmd; + struct qxl_bo_list *entry = list_first_entry(&release->bos, struct qxl_bo_list, tv.head); cmd.type = type; - cmd.data = qxl_bo_physical_address(qdev, release->bos[0], release->release_offset); + cmd.data = qxl_bo_physical_address(qdev, to_qxl_bo(entry->tv.bo), release->release_offset); return qxl_ring_push(qdev->cursor_ring, &cmd, interruptible); } @@ -214,7 +216,6 @@ int qxl_garbage_collect(struct qxl_device *qdev) struct qxl_release *release; uint64_t id, next_id; int i = 0; - int ret; union qxl_release_info *info; while (qxl_ring_pop(qdev->release_ring, &id)) { @@ -224,17 +225,10 @@ int qxl_garbage_collect(struct qxl_device *qdev) if (release == NULL) break; - ret = qxl_release_reserve(qdev, release, false); - if (ret) { - qxl_io_log(qdev, "failed to reserve release on garbage collect %lld\n", id); - DRM_ERROR("failed to reserve release %lld\n", id); - } - info = qxl_release_map(qdev, release); next_id = info->next; qxl_release_unmap(qdev, release, info); - qxl_release_unreserve(qdev, release); QXL_INFO(qdev, "popped %lld, next %lld\n", id, next_id); @@ -259,7 +253,9 @@ int qxl_garbage_collect(struct qxl_device *qdev) return i; } -int qxl_alloc_bo_reserved(struct qxl_device *qdev, unsigned long size, +int qxl_alloc_bo_reserved(struct qxl_device *qdev, + struct qxl_release *release, + unsigned long size, struct qxl_bo **_bo) { struct qxl_bo *bo; @@ -271,15 +267,15 @@ int qxl_alloc_bo_reserved(struct qxl_device *qdev, unsigned long size, DRM_ERROR("failed to allocate VRAM BO\n"); return ret; } - ret = qxl_bo_reserve(bo, false); - if (unlikely(ret != 0)) + ret = qxl_release_list_add(release, bo); + if (ret) goto out_unref; *_bo = bo; return 0; out_unref: qxl_bo_unref(&bo); - return 0; + return ret; } static int wait_for_io_cmd_user(struct qxl_device *qdev, uint8_t val, long port, bool intr) @@ -503,6 +499,10 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, if (ret) return ret; + ret = qxl_release_reserve_list(release, true); + if (ret) + return ret; + cmd = (struct qxl_surface_cmd *)qxl_release_map(qdev, release); cmd->type = QXL_SURFACE_CMD_CREATE; cmd->u.surface_create.format = surf->surf.format; @@ -524,14 +524,11 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, surf->surf_create = release; - /* no need to add a release to the fence for this bo, + /* no need to add a release to the fence for this surface bo, since it is only released when we ask to destroy the surface and it would never signal otherwise */ - qxl_fence_releaseable(qdev, release); - qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false); - - qxl_release_unreserve(qdev, release); + qxl_release_fence_buffer_objects(release); surf->hw_surf_alloc = true; spin_lock(&qdev->surf_id_idr_lock); @@ -573,12 +570,9 @@ int qxl_hw_surface_dealloc(struct qxl_device *qdev, cmd->surface_id = id; qxl_release_unmap(qdev, release, &cmd->release_info); - qxl_fence_releaseable(qdev, release); - qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false); - qxl_release_unreserve(qdev, release); - + qxl_release_fence_buffer_objects(release); return 0; } diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index f76f5dd7bfc4..835caba026d3 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c @@ -179,7 +179,7 @@ static void qxl_crtc_destroy(struct drm_crtc *crtc) kfree(qxl_crtc); } -static void +static int qxl_hide_cursor(struct qxl_device *qdev) { struct qxl_release *release; @@ -188,14 +188,22 @@ qxl_hide_cursor(struct qxl_device *qdev) ret = qxl_alloc_release_reserved(qdev, sizeof(*cmd), QXL_RELEASE_CURSOR_CMD, &release, NULL); + if (ret) + return ret; + + ret = qxl_release_reserve_list(release, true); + if (ret) { + qxl_release_free(qdev, release); + return ret; + } cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release); cmd->type = QXL_CURSOR_HIDE; qxl_release_unmap(qdev, release, &cmd->release_info); - qxl_fence_releaseable(qdev, release); qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); - qxl_release_unreserve(qdev, release); + qxl_release_fence_buffer_objects(release); + return 0; } static int qxl_crtc_cursor_set2(struct drm_crtc *crtc, @@ -216,10 +224,8 @@ static int qxl_crtc_cursor_set2(struct drm_crtc *crtc, int size = 64*64*4; int ret = 0; - if (!handle) { - qxl_hide_cursor(qdev); - return 0; - } + if (!handle) + return qxl_hide_cursor(qdev); obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); if (!obj) { @@ -234,8 +240,9 @@ static int qxl_crtc_cursor_set2(struct drm_crtc *crtc, goto out_unref; ret = qxl_bo_pin(user_bo, QXL_GEM_DOMAIN_CPU, NULL); + qxl_bo_unreserve(user_bo); if (ret) - goto out_unreserve; + goto out_unref; ret = qxl_bo_kmap(user_bo, &user_ptr); if (ret) @@ -246,14 +253,20 @@ static int qxl_crtc_cursor_set2(struct drm_crtc *crtc, &release, NULL); if (ret) goto out_kunmap; - ret = qxl_alloc_bo_reserved(qdev, sizeof(struct qxl_cursor) + size, - &cursor_bo); + + ret = qxl_alloc_bo_reserved(qdev, release, sizeof(struct qxl_cursor) + size, + &cursor_bo); if (ret) goto out_free_release; - ret = qxl_bo_kmap(cursor_bo, (void **)&cursor); + + ret = qxl_release_reserve_list(release, false); if (ret) goto out_free_bo; + ret = qxl_bo_kmap(cursor_bo, (void **)&cursor); + if (ret) + goto out_backoff; + cursor->header.unique = 0; cursor->header.type = SPICE_CURSOR_TYPE_ALPHA; cursor->header.width = 64; @@ -269,11 +282,7 @@ static int qxl_crtc_cursor_set2(struct drm_crtc *crtc, qxl_bo_kunmap(cursor_bo); - /* finish with the userspace bo */ qxl_bo_kunmap(user_bo); - qxl_bo_unpin(user_bo); - qxl_bo_unreserve(user_bo); - drm_gem_object_unreference_unlocked(obj); cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release); cmd->type = QXL_CURSOR_SET; @@ -281,30 +290,35 @@ static int qxl_crtc_cursor_set2(struct drm_crtc *crtc, cmd->u.set.position.y = qcrtc->cur_y; cmd->u.set.shape = qxl_bo_physical_address(qdev, cursor_bo, 0); - qxl_release_add_res(qdev, release, cursor_bo); cmd->u.set.visible = 1; qxl_release_unmap(qdev, release, &cmd->release_info); - qxl_fence_releaseable(qdev, release); qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); - qxl_release_unreserve(qdev, release); + qxl_release_fence_buffer_objects(release); + + /* finish with the userspace bo */ + ret = qxl_bo_reserve(user_bo, false); + if (!ret) { + qxl_bo_unpin(user_bo); + qxl_bo_unreserve(user_bo); + } + drm_gem_object_unreference_unlocked(obj); - qxl_bo_unreserve(cursor_bo); qxl_bo_unref(&cursor_bo); return ret; + +out_backoff: + qxl_release_backoff_reserve_list(release); out_free_bo: qxl_bo_unref(&cursor_bo); out_free_release: - qxl_release_unreserve(qdev, release); qxl_release_free(qdev, release); out_kunmap: qxl_bo_kunmap(user_bo); out_unpin: qxl_bo_unpin(user_bo); -out_unreserve: - qxl_bo_unreserve(user_bo); out_unref: drm_gem_object_unreference_unlocked(obj); return ret; @@ -322,6 +336,14 @@ static int qxl_crtc_cursor_move(struct drm_crtc *crtc, ret = qxl_alloc_release_reserved(qdev, sizeof(*cmd), QXL_RELEASE_CURSOR_CMD, &release, NULL); + if (ret) + return ret; + + ret = qxl_release_reserve_list(release, true); + if (ret) { + qxl_release_free(qdev, release); + return ret; + } qcrtc->cur_x = x; qcrtc->cur_y = y; @@ -332,9 +354,9 @@ static int qxl_crtc_cursor_move(struct drm_crtc *crtc, cmd->u.position.y = qcrtc->cur_y; qxl_release_unmap(qdev, release, &cmd->release_info); - qxl_fence_releaseable(qdev, release); qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); - qxl_release_unreserve(qdev, release); + qxl_release_fence_buffer_objects(release); + return 0; } diff --git a/drivers/gpu/drm/qxl/qxl_draw.c b/drivers/gpu/drm/qxl/qxl_draw.c index 3c8c3dbf9378..56e1d633875e 100644 --- a/drivers/gpu/drm/qxl/qxl_draw.c +++ b/drivers/gpu/drm/qxl/qxl_draw.c @@ -23,25 +23,29 @@ #include "qxl_drv.h" #include "qxl_object.h" +static int alloc_clips(struct qxl_device *qdev, + struct qxl_release *release, + unsigned num_clips, + struct qxl_bo **clips_bo) +{ + int size = sizeof(struct qxl_clip_rects) + sizeof(struct qxl_rect) * num_clips; + + return qxl_alloc_bo_reserved(qdev, release, size, clips_bo); +} + /* returns a pointer to the already allocated qxl_rect array inside * the qxl_clip_rects. This is *not* the same as the memory allocated * on the device, it is offset to qxl_clip_rects.chunk.data */ static struct qxl_rect *drawable_set_clipping(struct qxl_device *qdev, struct qxl_drawable *drawable, unsigned num_clips, - struct qxl_bo **clips_bo, - struct qxl_release *release) + struct qxl_bo *clips_bo) { struct qxl_clip_rects *dev_clips; int ret; - int size = sizeof(*dev_clips) + sizeof(struct qxl_rect) * num_clips; - ret = qxl_alloc_bo_reserved(qdev, size, clips_bo); - if (ret) - return NULL; - ret = qxl_bo_kmap(*clips_bo, (void **)&dev_clips); + ret = qxl_bo_kmap(clips_bo, (void **)&dev_clips); if (ret) { - qxl_bo_unref(clips_bo); return NULL; } dev_clips->num_rects = num_clips; @@ -52,20 +56,34 @@ static struct qxl_rect *drawable_set_clipping(struct qxl_device *qdev, } static int -make_drawable(struct qxl_device *qdev, int surface, uint8_t type, - const struct qxl_rect *rect, - struct qxl_release **release) +alloc_drawable(struct qxl_device *qdev, struct qxl_release **release) { - struct qxl_drawable *drawable; - int i, ret; - - ret = qxl_alloc_release_reserved(qdev, sizeof(*drawable), + int ret; + ret = qxl_alloc_release_reserved(qdev, sizeof(struct qxl_drawable), QXL_RELEASE_DRAWABLE, release, NULL); - if (ret) - return ret; + return ret; +} + +static void +free_drawable(struct qxl_device *qdev, struct qxl_release *release) +{ + qxl_release_free(qdev, release); +} + +/* release needs to be reserved at this point */ +static int +make_drawable(struct qxl_device *qdev, int surface, uint8_t type, + const struct qxl_rect *rect, + struct qxl_release *release) +{ + struct qxl_drawable *drawable; + int i; + + drawable = (struct qxl_drawable *)qxl_release_map(qdev, release); + if (!drawable) + return -ENOMEM; - drawable = (struct qxl_drawable *)qxl_release_map(qdev, *release); drawable->type = type; drawable->surface_id = surface; /* Only primary for now */ @@ -91,14 +109,23 @@ make_drawable(struct qxl_device *qdev, int surface, uint8_t type, drawable->bbox = *rect; drawable->mm_time = qdev->rom->mm_clock; - qxl_release_unmap(qdev, *release, &drawable->release_info); + qxl_release_unmap(qdev, release, &drawable->release_info); return 0; } -static int qxl_palette_create_1bit(struct qxl_bo **palette_bo, +static int alloc_palette_object(struct qxl_device *qdev, + struct qxl_release *release, + struct qxl_bo **palette_bo) +{ + return qxl_alloc_bo_reserved(qdev, release, + sizeof(struct qxl_palette) + sizeof(uint32_t) * 2, + palette_bo); +} + +static int qxl_palette_create_1bit(struct qxl_bo *palette_bo, + struct qxl_release *release, const struct qxl_fb_image *qxl_fb_image) { - struct qxl_device *qdev = qxl_fb_image->qdev; const struct fb_image *fb_image = &qxl_fb_image->fb_image; uint32_t visual = qxl_fb_image->visual; const uint32_t *pseudo_palette = qxl_fb_image->pseudo_palette; @@ -108,12 +135,7 @@ static int qxl_palette_create_1bit(struct qxl_bo **palette_bo, static uint64_t unique; /* we make no attempt to actually set this * correctly globaly, since that would require * tracking all of our palettes. */ - - ret = qxl_alloc_bo_reserved(qdev, - sizeof(struct qxl_palette) + sizeof(uint32_t) * 2, - palette_bo); - - ret = qxl_bo_kmap(*palette_bo, (void **)&pal); + ret = qxl_bo_kmap(palette_bo, (void **)&pal); pal->num_ents = 2; pal->unique = unique++; if (visual == FB_VISUAL_TRUECOLOR || visual == FB_VISUAL_DIRECTCOLOR) { @@ -126,7 +148,7 @@ static int qxl_palette_create_1bit(struct qxl_bo **palette_bo, } pal->ents[0] = bgcolor; pal->ents[1] = fgcolor; - qxl_bo_kunmap(*palette_bo); + qxl_bo_kunmap(palette_bo); return 0; } @@ -144,44 +166,63 @@ void qxl_draw_opaque_fb(const struct qxl_fb_image *qxl_fb_image, const char *src = fb_image->data; int depth = fb_image->depth; struct qxl_release *release; - struct qxl_bo *image_bo; struct qxl_image *image; int ret; - + struct qxl_drm_image *dimage; + struct qxl_bo *palette_bo = NULL; if (stride == 0) stride = depth * width / 8; + ret = alloc_drawable(qdev, &release); + if (ret) + return; + + ret = qxl_image_alloc_objects(qdev, release, + &dimage, + height, stride); + if (ret) + goto out_free_drawable; + + if (depth == 1) { + ret = alloc_palette_object(qdev, release, &palette_bo); + if (ret) + goto out_free_image; + } + + /* do a reservation run over all the objects we just allocated */ + ret = qxl_release_reserve_list(release, true); + if (ret) + goto out_free_palette; + rect.left = x; rect.right = x + width; rect.top = y; rect.bottom = y + height; - ret = make_drawable(qdev, 0, QXL_DRAW_COPY, &rect, &release); - if (ret) - return; - - ret = qxl_image_create(qdev, release, &image_bo, - (const uint8_t *)src, 0, 0, - width, height, depth, stride); + ret = make_drawable(qdev, 0, QXL_DRAW_COPY, &rect, release); if (ret) { - qxl_release_unreserve(qdev, release); + qxl_release_backoff_reserve_list(release); + goto out_free_palette; + } + + ret = qxl_image_init(qdev, release, dimage, + (const uint8_t *)src, 0, 0, + width, height, depth, stride); + if (ret) { + qxl_release_backoff_reserve_list(release); qxl_release_free(qdev, release); return; } if (depth == 1) { - struct qxl_bo *palette_bo; void *ptr; - ret = qxl_palette_create_1bit(&palette_bo, qxl_fb_image); - qxl_release_add_res(qdev, release, palette_bo); + ret = qxl_palette_create_1bit(palette_bo, release, qxl_fb_image); - ptr = qxl_bo_kmap_atomic_page(qdev, image_bo, 0); + ptr = qxl_bo_kmap_atomic_page(qdev, dimage->bo, 0); image = ptr; image->u.bitmap.palette = qxl_bo_physical_address(qdev, palette_bo, 0); - qxl_bo_kunmap_atomic_page(qdev, image_bo, ptr); - qxl_bo_unreserve(palette_bo); - qxl_bo_unref(&palette_bo); + qxl_bo_kunmap_atomic_page(qdev, dimage->bo, ptr); } drawable = (struct qxl_drawable *)qxl_release_map(qdev, release); @@ -199,16 +240,20 @@ void qxl_draw_opaque_fb(const struct qxl_fb_image *qxl_fb_image, drawable->u.copy.mask.bitmap = 0; drawable->u.copy.src_bitmap = - qxl_bo_physical_address(qdev, image_bo, 0); + qxl_bo_physical_address(qdev, dimage->bo, 0); qxl_release_unmap(qdev, release, &drawable->release_info); - qxl_release_add_res(qdev, release, image_bo); - qxl_bo_unreserve(image_bo); - qxl_bo_unref(&image_bo); - - qxl_fence_releaseable(qdev, release); qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false); - qxl_release_unreserve(qdev, release); + qxl_release_fence_buffer_objects(release); + +out_free_palette: + if (palette_bo) + qxl_bo_unref(&palette_bo); +out_free_image: + qxl_image_free_objects(qdev, dimage); +out_free_drawable: + if (ret) + free_drawable(qdev, release); } /* push a draw command using the given clipping rectangles as @@ -243,10 +288,14 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, int depth = qxl_fb->base.bits_per_pixel; uint8_t *surface_base; struct qxl_release *release; - struct qxl_bo *image_bo; struct qxl_bo *clips_bo; + struct qxl_drm_image *dimage; int ret; + ret = alloc_drawable(qdev, &release); + if (ret) + return; + left = clips->x1; right = clips->x2; top = clips->y1; @@ -263,36 +312,52 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, width = right - left; height = bottom - top; + + ret = alloc_clips(qdev, release, num_clips, &clips_bo); + if (ret) + goto out_free_drawable; + + ret = qxl_image_alloc_objects(qdev, release, + &dimage, + height, stride); + if (ret) + goto out_free_clips; + + /* do a reservation run over all the objects we just allocated */ + ret = qxl_release_reserve_list(release, true); + if (ret) + goto out_free_image; + drawable_rect.left = left; drawable_rect.right = right; drawable_rect.top = top; drawable_rect.bottom = bottom; + ret = make_drawable(qdev, 0, QXL_DRAW_COPY, &drawable_rect, - &release); + release); if (ret) - return; + goto out_release_backoff; ret = qxl_bo_kmap(bo, (void **)&surface_base); if (ret) - goto out_unref; + goto out_release_backoff; - ret = qxl_image_create(qdev, release, &image_bo, surface_base, - left, top, width, height, depth, stride); + + ret = qxl_image_init(qdev, release, dimage, surface_base, + left, top, width, height, depth, stride); qxl_bo_kunmap(bo); if (ret) - goto out_unref; + goto out_release_backoff; + + rects = drawable_set_clipping(qdev, drawable, num_clips, clips_bo); + if (!rects) + goto out_release_backoff; - rects = drawable_set_clipping(qdev, drawable, num_clips, &clips_bo, release); - if (!rects) { - qxl_bo_unref(&image_bo); - goto out_unref; - } drawable = (struct qxl_drawable *)qxl_release_map(qdev, release); drawable->clip.type = SPICE_CLIP_TYPE_RECTS; drawable->clip.data = qxl_bo_physical_address(qdev, clips_bo, 0); - qxl_release_add_res(qdev, release, clips_bo); drawable->u.copy.src_area.top = 0; drawable->u.copy.src_area.bottom = height; @@ -306,11 +371,9 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, drawable->u.copy.mask.pos.y = 0; drawable->u.copy.mask.bitmap = 0; - drawable->u.copy.src_bitmap = qxl_bo_physical_address(qdev, image_bo, 0); + drawable->u.copy.src_bitmap = qxl_bo_physical_address(qdev, dimage->bo, 0); qxl_release_unmap(qdev, release, &drawable->release_info); - qxl_release_add_res(qdev, release, image_bo); - qxl_bo_unreserve(image_bo); - qxl_bo_unref(&image_bo); + clips_ptr = clips; for (i = 0; i < num_clips; i++, clips_ptr += inc) { rects[i].left = clips_ptr->x1; @@ -319,17 +382,22 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, rects[i].bottom = clips_ptr->y2; } qxl_bo_kunmap(clips_bo); - qxl_bo_unreserve(clips_bo); - qxl_bo_unref(&clips_bo); - qxl_fence_releaseable(qdev, release); qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false); - qxl_release_unreserve(qdev, release); - return; + qxl_release_fence_buffer_objects(release); + +out_release_backoff: + if (ret) + qxl_release_backoff_reserve_list(release); +out_free_image: + qxl_image_free_objects(qdev, dimage); +out_free_clips: + qxl_bo_unref(&clips_bo); +out_free_drawable: + /* only free drawable on error */ + if (ret) + free_drawable(qdev, release); -out_unref: - qxl_release_unreserve(qdev, release); - qxl_release_free(qdev, release); } void qxl_draw_copyarea(struct qxl_device *qdev, @@ -342,22 +410,36 @@ void qxl_draw_copyarea(struct qxl_device *qdev, struct qxl_release *release; int ret; + ret = alloc_drawable(qdev, &release); + if (ret) + return; + + /* do a reservation run over all the objects we just allocated */ + ret = qxl_release_reserve_list(release, true); + if (ret) + goto out_free_release; + rect.left = dx; rect.top = dy; rect.right = dx + width; rect.bottom = dy + height; - ret = make_drawable(qdev, 0, QXL_COPY_BITS, &rect, &release); - if (ret) - return; + ret = make_drawable(qdev, 0, QXL_COPY_BITS, &rect, release); + if (ret) { + qxl_release_backoff_reserve_list(release); + goto out_free_release; + } drawable = (struct qxl_drawable *)qxl_release_map(qdev, release); drawable->u.copy_bits.src_pos.x = sx; drawable->u.copy_bits.src_pos.y = sy; - qxl_release_unmap(qdev, release, &drawable->release_info); - qxl_fence_releaseable(qdev, release); + qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false); - qxl_release_unreserve(qdev, release); + qxl_release_fence_buffer_objects(release); + +out_free_release: + if (ret) + free_drawable(qdev, release); } void qxl_draw_fill(struct qxl_draw_fill *qxl_draw_fill_rec) @@ -370,10 +452,21 @@ void qxl_draw_fill(struct qxl_draw_fill *qxl_draw_fill_rec) struct qxl_release *release; int ret; - ret = make_drawable(qdev, 0, QXL_DRAW_FILL, &rect, &release); + ret = alloc_drawable(qdev, &release); if (ret) return; + /* do a reservation run over all the objects we just allocated */ + ret = qxl_release_reserve_list(release, true); + if (ret) + goto out_free_release; + + ret = make_drawable(qdev, 0, QXL_DRAW_FILL, &rect, release); + if (ret) { + qxl_release_backoff_reserve_list(release); + goto out_free_release; + } + drawable = (struct qxl_drawable *)qxl_release_map(qdev, release); drawable->u.fill.brush.type = SPICE_BRUSH_TYPE_SOLID; drawable->u.fill.brush.u.color = color; @@ -384,7 +477,11 @@ void qxl_draw_fill(struct qxl_draw_fill *qxl_draw_fill_rec) drawable->u.fill.mask.bitmap = 0; qxl_release_unmap(qdev, release, &drawable->release_info); - qxl_fence_releaseable(qdev, release); + qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false); - qxl_release_unreserve(qdev, release); + qxl_release_fence_buffer_objects(release); + +out_free_release: + if (ret) + free_drawable(qdev, release); } diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 6a4106fb4c21..7e96f4f11738 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h @@ -42,6 +42,9 @@ #include <ttm/ttm_placement.h> #include <ttm/ttm_module.h> +/* just for ttm_validate_buffer */ +#include <ttm/ttm_execbuf_util.h> + #include <drm/qxl_drm.h> #include "qxl_dev.h" @@ -118,9 +121,9 @@ struct qxl_bo { uint32_t surface_id; struct qxl_fence fence; /* per bo fence - list of releases */ struct qxl_release *surf_create; - atomic_t reserve_count; }; #define gem_to_qxl_bo(gobj) container_of((gobj), struct qxl_bo, gem_base) +#define to_qxl_bo(tobj) container_of((tobj), struct qxl_bo, tbo) struct qxl_gem { struct mutex mutex; @@ -128,12 +131,7 @@ struct qxl_gem { }; struct qxl_bo_list { - struct list_head lhead; - struct qxl_bo *bo; -}; - -struct qxl_reloc_list { - struct list_head bos; + struct ttm_validate_buffer tv; }; struct qxl_crtc { @@ -195,10 +193,20 @@ enum { struct qxl_release { int id; int type; - int bo_count; uint32_t release_offset; uint32_t surface_release_id; - struct qxl_bo *bos[QXL_MAX_RES]; + struct ww_acquire_ctx ticket; + struct list_head bos; +}; + +struct qxl_drm_chunk { + struct list_head head; + struct qxl_bo *bo; +}; + +struct qxl_drm_image { + struct qxl_bo *bo; + struct list_head chunk_list; }; struct qxl_fb_image { @@ -434,12 +442,19 @@ int qxl_mmap(struct file *filp, struct vm_area_struct *vma); /* qxl image */ -int qxl_image_create(struct qxl_device *qdev, - struct qxl_release *release, - struct qxl_bo **image_bo, - const uint8_t *data, - int x, int y, int width, int height, - int depth, int stride); +int qxl_image_init(struct qxl_device *qdev, + struct qxl_release *release, + struct qxl_drm_image *dimage, + const uint8_t *data, + int x, int y, int width, int height, + int depth, int stride); +int +qxl_image_alloc_objects(struct qxl_device *qdev, + struct qxl_release *release, + struct qxl_drm_image **image_ptr, + int height, int stride); +void qxl_image_free_objects(struct qxl_device *qdev, struct qxl_drm_image *dimage); + void qxl_update_screen(struct qxl_device *qxl); /* qxl io operations (qxl_cmd.c) */ @@ -460,20 +475,15 @@ int qxl_ring_push(struct qxl_ring *ring, const void *new_elt, bool interruptible void qxl_io_flush_release(struct qxl_device *qdev); void qxl_io_flush_surfaces(struct qxl_device *qdev); -int qxl_release_reserve(struct qxl_device *qdev, - struct qxl_release *release, bool no_wait); -void qxl_release_unreserve(struct qxl_device *qdev, - struct qxl_release *release); union qxl_release_info *qxl_release_map(struct qxl_device *qdev, struct qxl_release *release); void qxl_release_unmap(struct qxl_device *qdev, struct qxl_release *release, union qxl_release_info *info); -/* - * qxl_bo_add_resource. - * - */ -void qxl_bo_add_resource(struct qxl_bo *main_bo, struct qxl_bo *resource); +int qxl_release_list_add(struct qxl_release *release, struct qxl_bo *bo); +int qxl_release_reserve_list(struct qxl_release *release, bool no_intr); +void qxl_release_backoff_reserve_list(struct qxl_release *release); +void qxl_release_fence_buffer_objects(struct qxl_release *release); int qxl_alloc_surface_release_reserved(struct qxl_device *qdev, enum qxl_surface_cmd_type surface_cmd_type, @@ -482,15 +492,16 @@ int qxl_alloc_surface_release_reserved(struct qxl_device *qdev, int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, int type, struct qxl_release **release, struct qxl_bo **rbo); -int qxl_fence_releaseable(struct qxl_device *qdev, - struct qxl_release *release); + int qxl_push_command_ring_release(struct qxl_device *qdev, struct qxl_release *release, uint32_t type, bool interruptible); int qxl_push_cursor_ring_release(struct qxl_device *qdev, struct qxl_release *release, uint32_t type, bool interruptible); -int qxl_alloc_bo_reserved(struct qxl_device *qdev, unsigned long size, +int qxl_alloc_bo_reserved(struct qxl_device *qdev, + struct qxl_release *release, + unsigned long size, struct qxl_bo **_bo); /* qxl drawing commands */ @@ -511,15 +522,9 @@ void qxl_draw_copyarea(struct qxl_device *qdev, u32 sx, u32 sy, u32 dx, u32 dy); -uint64_t -qxl_release_alloc(struct qxl_device *qdev, int type, - struct qxl_release **ret); - void qxl_release_free(struct qxl_device *qdev, struct qxl_release *release); -void qxl_release_add_res(struct qxl_device *qdev, - struct qxl_release *release, - struct qxl_bo *bo); + /* used by qxl_debugfs_release */ struct qxl_release *qxl_release_from_id_locked(struct qxl_device *qdev, uint64_t id); @@ -562,7 +567,7 @@ void qxl_surface_evict(struct qxl_device *qdev, struct qxl_bo *surf, bool freein int qxl_update_surface(struct qxl_device *qdev, struct qxl_bo *surf); /* qxl_fence.c */ -int qxl_fence_add_release(struct qxl_fence *qfence, uint32_t rel_id); +void qxl_fence_add_release_locked(struct qxl_fence *qfence, uint32_t rel_id); int qxl_fence_remove_release(struct qxl_fence *qfence, uint32_t rel_id); int qxl_fence_init(struct qxl_device *qdev, struct qxl_fence *qfence); void qxl_fence_fini(struct qxl_fence *qfence); diff --git a/drivers/gpu/drm/qxl/qxl_fence.c b/drivers/gpu/drm/qxl/qxl_fence.c index 63c6715ad385..ae59e91cfb9a 100644 --- a/drivers/gpu/drm/qxl/qxl_fence.c +++ b/drivers/gpu/drm/qxl/qxl_fence.c @@ -49,17 +49,11 @@ For some reason every so often qxl hw fails to release, things go wrong. */ - - -int qxl_fence_add_release(struct qxl_fence *qfence, uint32_t rel_id) +/* must be called with the fence lock held */ +void qxl_fence_add_release_locked(struct qxl_fence *qfence, uint32_t rel_id) { - struct qxl_bo *bo = container_of(qfence, struct qxl_bo, fence); - - spin_lock(&bo->tbo.bdev->fence_lock); radix_tree_insert(&qfence->tree, rel_id, qfence); qfence->num_active_releases++; - spin_unlock(&bo->tbo.bdev->fence_lock); - return 0; } int qxl_fence_remove_release(struct qxl_fence *qfence, uint32_t rel_id) diff --git a/drivers/gpu/drm/qxl/qxl_image.c b/drivers/gpu/drm/qxl/qxl_image.c index cf856206996b..7fbcc35e8ad3 100644 --- a/drivers/gpu/drm/qxl/qxl_image.c +++ b/drivers/gpu/drm/qxl/qxl_image.c @@ -30,31 +30,100 @@ #include "qxl_object.h" static int -qxl_image_create_helper(struct qxl_device *qdev, - struct qxl_release *release, - struct qxl_bo **image_bo, - const uint8_t *data, - int width, int height, - int depth, unsigned int hash, - int stride) +qxl_allocate_chunk(struct qxl_device *qdev, + struct qxl_release *release, + struct qxl_drm_image *image, + unsigned int chunk_size) { + struct qxl_drm_chunk *chunk; + int ret; + + chunk = kmalloc(sizeof(struct qxl_drm_chunk), GFP_KERNEL); + if (!chunk) + return -ENOMEM; + + ret = qxl_alloc_bo_reserved(qdev, release, chunk_size, &chunk->bo); + if (ret) { + kfree(chunk); + return ret; + } + + list_add_tail(&chunk->head, &image->chunk_list); + return 0; +} + +int +qxl_image_alloc_objects(struct qxl_device *qdev, + struct qxl_release *release, + struct qxl_drm_image **image_ptr, + int height, int stride) +{ + struct qxl_drm_image *image; + int ret; + + image = kmalloc(sizeof(struct qxl_drm_image), GFP_KERNEL); + if (!image) + return -ENOMEM; + + INIT_LIST_HEAD(&image->chunk_list); + + ret = qxl_alloc_bo_reserved(qdev, release, sizeof(struct qxl_image), &image->bo); + if (ret) { + kfree(image); + return ret; + } + + ret = qxl_allocate_chunk(qdev, release, image, sizeof(struct qxl_data_chunk) + stride * height); + if (ret) { + qxl_bo_unref(&image->bo); + kfree(image); + return ret; + } + *image_ptr = image; + return 0; +} + +void qxl_image_free_objects(struct qxl_device *qdev, struct qxl_drm_image *dimage) +{ + struct qxl_drm_chunk *chunk, *tmp; + + list_for_each_entry_safe(chunk, tmp, &dimage->chunk_list, head) { + qxl_bo_unref(&chunk->bo); + kfree(chunk); + } + + qxl_bo_unref(&dimage->bo); + kfree(dimage); +} + +static int +qxl_image_init_helper(struct qxl_device *qdev, + struct qxl_release *release, + struct qxl_drm_image *dimage, + const uint8_t *data, + int width, int height, + int depth, unsigned int hash, + int stride) +{ + struct qxl_drm_chunk *drv_chunk; struct qxl_image *image; struct qxl_data_chunk *chunk; int i; int chunk_stride; int linesize = width * depth / 8; - struct qxl_bo *chunk_bo; - int ret; + struct qxl_bo *chunk_bo, *image_bo; void *ptr; /* Chunk */ /* FIXME: Check integer overflow */ /* TODO: variable number of chunks */ + + drv_chunk = list_first_entry(&dimage->chunk_list, struct qxl_drm_chunk, head); + + chunk_bo = drv_chunk->bo; chunk_stride = stride; /* TODO: should use linesize, but it renders wrong (check the bitmaps are sent correctly first) */ - ret = qxl_alloc_bo_reserved(qdev, sizeof(*chunk) + height * chunk_stride, - &chunk_bo); - + ptr = qxl_bo_kmap_atomic_page(qdev, chunk_bo, 0); chunk = ptr; chunk->data_size = height * chunk_stride; @@ -102,7 +171,6 @@ qxl_image_create_helper(struct qxl_device *qdev, while (remain > 0) { page_base = out_offset & PAGE_MASK; page_offset = offset_in_page(out_offset); - size = min((int)(PAGE_SIZE - page_offset), remain); ptr = qxl_bo_kmap_atomic_page(qdev, chunk_bo, page_base); @@ -116,14 +184,10 @@ qxl_image_create_helper(struct qxl_device *qdev, } } } - - qxl_bo_kunmap(chunk_bo); - /* Image */ - ret = qxl_alloc_bo_reserved(qdev, sizeof(*image), image_bo); - - ptr = qxl_bo_kmap_atomic_page(qdev, *image_bo, 0); + image_bo = dimage->bo; + ptr = qxl_bo_kmap_atomic_page(qdev, image_bo, 0); image = ptr; image->descriptor.id = 0; @@ -154,23 +218,20 @@ qxl_image_create_helper(struct qxl_device *qdev, image->u.bitmap.stride = chunk_stride; image->u.bitmap.palette = 0; image->u.bitmap.data = qxl_bo_physical_address(qdev, chunk_bo, 0); - qxl_release_add_res(qdev, release, chunk_bo); - qxl_bo_unreserve(chunk_bo); - qxl_bo_unref(&chunk_bo); - qxl_bo_kunmap_atomic_page(qdev, *image_bo, ptr); + qxl_bo_kunmap_atomic_page(qdev, image_bo, ptr); return 0; } -int qxl_image_create(struct qxl_device *qdev, +int qxl_image_init(struct qxl_device *qdev, struct qxl_release *release, - struct qxl_bo **image_bo, + struct qxl_drm_image *dimage, const uint8_t *data, int x, int y, int width, int height, int depth, int stride) { data += y * stride + x * (depth / 8); - return qxl_image_create_helper(qdev, release, image_bo, data, + return qxl_image_init_helper(qdev, release, dimage, data, width, height, depth, 0, stride); } diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c index 7448c5ea92e6..6de33563d6f1 100644 --- a/drivers/gpu/drm/qxl/qxl_ioctl.c +++ b/drivers/gpu/drm/qxl/qxl_ioctl.c @@ -68,55 +68,60 @@ static int qxl_map_ioctl(struct drm_device *dev, void *data, &qxl_map->offset); } +struct qxl_reloc_info { + int type; + struct qxl_bo *dst_bo; + uint32_t dst_offset; + struct qxl_bo *src_bo; + int src_offset; +}; + /* * dst must be validated, i.e. whole bo on vram/surfacesram (right now all bo's * are on vram). * *(dst + dst_off) = qxl_bo_physical_address(src, src_off) */ static void -apply_reloc(struct qxl_device *qdev, struct qxl_bo *dst, uint64_t dst_off, - struct qxl_bo *src, uint64_t src_off) +apply_reloc(struct qxl_device *qdev, struct qxl_reloc_info *info) { void *reloc_page; - - reloc_page = qxl_bo_kmap_atomic_page(qdev, dst, dst_off & PAGE_MASK); - *(uint64_t *)(reloc_page + (dst_off & ~PAGE_MASK)) = qxl_bo_physical_address(qdev, - src, src_off); - qxl_bo_kunmap_atomic_page(qdev, dst, reloc_page); + reloc_page = qxl_bo_kmap_atomic_page(qdev, info->dst_bo, info->dst_offset & PAGE_MASK); + *(uint64_t *)(reloc_page + (info->dst_offset & ~PAGE_MASK)) = qxl_bo_physical_address(qdev, + info->src_bo, + info->src_offset); + qxl_bo_kunmap_atomic_page(qdev, info->dst_bo, reloc_page); } static void -apply_surf_reloc(struct qxl_device *qdev, struct qxl_bo *dst, uint64_t dst_off, - struct qxl_bo *src) +apply_surf_reloc(struct qxl_device *qdev, struct qxl_reloc_info *info) { uint32_t id = 0; void *reloc_page; - if (src && !src->is_primary) - id = src->surface_id; + if (info->src_bo && !info->src_bo->is_primary) + id = info->src_bo->surface_id; - reloc_page = qxl_bo_kmap_atomic_page(qdev, dst, dst_off & PAGE_MASK); - *(uint32_t *)(reloc_page + (dst_off & ~PAGE_MASK)) = id; - qxl_bo_kunmap_atomic_page(qdev, dst, reloc_page); + reloc_page = qxl_bo_kmap_atomic_page(qdev, info->dst_bo, info->dst_offset & PAGE_MASK); + *(uint32_t *)(reloc_page + (info->dst_offset & ~PAGE_MASK)) = id; + qxl_bo_kunmap_atomic_page(qdev, info->dst_bo, reloc_page); } /* return holding the reference to this object */ static struct qxl_bo *qxlhw_handle_to_bo(struct qxl_device *qdev, struct drm_file *file_priv, uint64_t handle, - struct qxl_reloc_list *reloc_list) + struct qxl_release *release) { struct drm_gem_object *gobj; struct qxl_bo *qobj; int ret; gobj = drm_gem_object_lookup(qdev->ddev, file_priv, handle); - if (!gobj) { - DRM_ERROR("bad bo handle %lld\n", handle); + if (!gobj) return NULL; - } + qobj = gem_to_qxl_bo(gobj); - ret = qxl_bo_list_add(reloc_list, qobj); + ret = qxl_release_list_add(release, qobj); if (ret) return NULL; @@ -129,6 +134,155 @@ static struct qxl_bo *qxlhw_handle_to_bo(struct qxl_device *qdev, * However, the command as passed from user space must *not* contain the initial * QXLReleaseInfo struct (first XXX bytes) */ +static int qxl_process_single_command(struct qxl_device *qdev, + struct drm_qxl_command *cmd, + struct drm_file *file_priv) +{ + struct qxl_reloc_info *reloc_info; + int release_type; + struct qxl_release *release; + struct qxl_bo *cmd_bo; + void *fb_cmd; + int i, j, ret, num_relocs; + int unwritten; + + switch (cmd->type) { + case QXL_CMD_DRAW: + release_type = QXL_RELEASE_DRAWABLE; + break; + case QXL_CMD_SURFACE: + case QXL_CMD_CURSOR: + default: + DRM_DEBUG("Only draw commands in execbuffers\n"); + return -EINVAL; + break; + } + + if (cmd->command_size > PAGE_SIZE - sizeof(union qxl_release_info)) + return -EINVAL; + + if (!access_ok(VERIFY_READ, + (void *)(unsigned long)cmd->command, + cmd->command_size)) + return -EFAULT; + + reloc_info = kmalloc(sizeof(struct qxl_reloc_info) * cmd->relocs_num, GFP_KERNEL); + if (!reloc_info) + return -ENOMEM; + + ret = qxl_alloc_release_reserved(qdev, + sizeof(union qxl_release_info) + + cmd->command_size, + release_type, + &release, + &cmd_bo); + if (ret) + goto out_free_reloc; + + /* TODO copy slow path code from i915 */ + fb_cmd = qxl_bo_kmap_atomic_page(qdev, cmd_bo, (release->release_offset & PAGE_SIZE)); + unwritten = __copy_from_user_inatomic_nocache(fb_cmd + sizeof(union qxl_release_info) + (release->release_offset & ~PAGE_SIZE), (void *)(unsigned long)cmd->command, cmd->command_size); + + { + struct qxl_drawable *draw = fb_cmd; + draw->mm_time = qdev->rom->mm_clock; + } + + qxl_bo_kunmap_atomic_page(qdev, cmd_bo, fb_cmd); + if (unwritten) { + DRM_ERROR("got unwritten %d\n", unwritten); + ret = -EFAULT; + goto out_free_release; + } + + /* fill out reloc info structs */ + num_relocs = 0; + for (i = 0; i < cmd->relocs_num; ++i) { + struct drm_qxl_reloc reloc; + + if (DRM_COPY_FROM_USER(&reloc, + &((struct drm_qxl_reloc *)(uintptr_t)cmd->relocs)[i], + sizeof(reloc))) { + ret = -EFAULT; + goto out_free_bos; + } + + /* add the bos to the list of bos to validate - + need to validate first then process relocs? */ + if (reloc.reloc_type != QXL_RELOC_TYPE_BO && reloc.reloc_type != QXL_RELOC_TYPE_SURF) { + DRM_DEBUG("unknown reloc type %d\n", reloc_info[i].type); + + ret = -EINVAL; + goto out_free_bos; + } + reloc_info[i].type = reloc.reloc_type; + + if (reloc.dst_handle) { + reloc_info[i].dst_bo = qxlhw_handle_to_bo(qdev, file_priv, + reloc.dst_handle, release); + if (!reloc_info[i].dst_bo) { + ret = -EINVAL; + reloc_info[i].src_bo = NULL; + goto out_free_bos; + } + reloc_info[i].dst_offset = reloc.dst_offset; + } else { + reloc_info[i].dst_bo = cmd_bo; + reloc_info[i].dst_offset = reloc.dst_offset + release->release_offset; + } + num_relocs++; + + /* reserve and validate the reloc dst bo */ + if (reloc.reloc_type == QXL_RELOC_TYPE_BO || reloc.src_handle > 0) { + reloc_info[i].src_bo = + qxlhw_handle_to_bo(qdev, file_priv, + reloc.src_handle, release); + if (!reloc_info[i].src_bo) { + if (reloc_info[i].dst_bo != cmd_bo) + drm_gem_object_unreference_unlocked(&reloc_info[i].dst_bo->gem_base); + ret = -EINVAL; + goto out_free_bos; + } + reloc_info[i].src_offset = reloc.src_offset; + } else { + reloc_info[i].src_bo = NULL; + reloc_info[i].src_offset = 0; + } + } + + /* validate all buffers */ + ret = qxl_release_reserve_list(release, false); + if (ret) + goto out_free_bos; + + for (i = 0; i < cmd->relocs_num; ++i) { + if (reloc_info[i].type == QXL_RELOC_TYPE_BO) + apply_reloc(qdev, &reloc_info[i]); + else if (reloc_info[i].type == QXL_RELOC_TYPE_SURF) + apply_surf_reloc(qdev, &reloc_info[i]); + } + + ret = qxl_push_command_ring_release(qdev, release, cmd->type, true); + if (ret) + qxl_release_backoff_reserve_list(release); + else + qxl_release_fence_buffer_objects(release); + +out_free_bos: + for (j = 0; j < num_relocs; j++) { + if (reloc_info[j].dst_bo != cmd_bo) + drm_gem_object_unreference_unlocked(&reloc_info[j].dst_bo->gem_base); + if (reloc_info[j].src_bo && reloc_info[j].src_bo != cmd_bo) + drm_gem_object_unreference_unlocked(&reloc_info[j].src_bo->gem_base); + } +out_free_release: + if (ret) + qxl_release_free(qdev, release); +out_free_reloc: + kfree(reloc_info); + return ret; +} + static int qxl_execbuffer_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { @@ -136,144 +290,21 @@ static int qxl_execbuffer_ioctl(struct drm_device *dev, void *data, struct drm_qxl_execbuffer *execbuffer = data; struct drm_qxl_command user_cmd; int cmd_num; - struct qxl_bo *reloc_src_bo; - struct qxl_bo *reloc_dst_bo; - struct drm_qxl_reloc reloc; - void *fb_cmd; - int i, ret; - struct qxl_reloc_list reloc_list; - int unwritten; - uint32_t reloc_dst_offset; - INIT_LIST_HEAD(&reloc_list.bos); + int ret; for (cmd_num = 0; cmd_num < execbuffer->commands_num; ++cmd_num) { - struct qxl_release *release; - struct qxl_bo *cmd_bo; - int release_type; + struct drm_qxl_command *commands = (struct drm_qxl_command *)(uintptr_t)execbuffer->commands; if (DRM_COPY_FROM_USER(&user_cmd, &commands[cmd_num], sizeof(user_cmd))) return -EFAULT; - switch (user_cmd.type) { - case QXL_CMD_DRAW: - release_type = QXL_RELEASE_DRAWABLE; - break; - case QXL_CMD_SURFACE: - case QXL_CMD_CURSOR: - default: - DRM_DEBUG("Only draw commands in execbuffers\n"); - return -EINVAL; - break; - } - if (user_cmd.command_size > PAGE_SIZE - sizeof(union qxl_release_info)) - return -EINVAL; - - if (!access_ok(VERIFY_READ, - (void *)(unsigned long)user_cmd.command, - user_cmd.command_size)) - return -EFAULT; - - ret = qxl_alloc_release_reserved(qdev, - sizeof(union qxl_release_info) + - user_cmd.command_size, - release_type, - &release, - &cmd_bo); + ret = qxl_process_single_command(qdev, &user_cmd, file_priv); if (ret) return ret; - - /* TODO copy slow path code from i915 */ - fb_cmd = qxl_bo_kmap_atomic_page(qdev, cmd_bo, (release->release_offset & PAGE_SIZE)); - unwritten = __copy_from_user_inatomic_nocache(fb_cmd + sizeof(union qxl_release_info) + (release->release_offset & ~PAGE_SIZE), (void *)(unsigned long)user_cmd.command, user_cmd.command_size); - - { - struct qxl_drawable *draw = fb_cmd; - - draw->mm_time = qdev->rom->mm_clock; - } - qxl_bo_kunmap_atomic_page(qdev, cmd_bo, fb_cmd); - if (unwritten) { - DRM_ERROR("got unwritten %d\n", unwritten); - qxl_release_unreserve(qdev, release); - qxl_release_free(qdev, release); - return -EFAULT; - } - - for (i = 0 ; i < user_cmd.relocs_num; ++i) { - if (DRM_COPY_FROM_USER(&reloc, - &((struct drm_qxl_reloc *)(uintptr_t)user_cmd.relocs)[i], - sizeof(reloc))) { - qxl_bo_list_unreserve(&reloc_list, true); - qxl_release_unreserve(qdev, release); - qxl_release_free(qdev, release); - return -EFAULT; - } - - /* add the bos to the list of bos to validate - - need to validate first then process relocs? */ - if (reloc.dst_handle) { - reloc_dst_bo = qxlhw_handle_to_bo(qdev, file_priv, - reloc.dst_handle, &reloc_list); - if (!reloc_dst_bo) { - qxl_bo_list_unreserve(&reloc_list, true); - qxl_release_unreserve(qdev, release); - qxl_release_free(qdev, release); - return -EINVAL; - } - reloc_dst_offset = 0; - } else { - reloc_dst_bo = cmd_bo; - reloc_dst_offset = release->release_offset; - } - - /* reserve and validate the reloc dst bo */ - if (reloc.reloc_type == QXL_RELOC_TYPE_BO || reloc.src_handle > 0) { - reloc_src_bo = - qxlhw_handle_to_bo(qdev, file_priv, - reloc.src_handle, &reloc_list); - if (!reloc_src_bo) { - if (reloc_dst_bo != cmd_bo) - drm_gem_object_unreference_unlocked(&reloc_dst_bo->gem_base); - qxl_bo_list_unreserve(&reloc_list, true); - qxl_release_unreserve(qdev, release); - qxl_release_free(qdev, release); - return -EINVAL; - } - } else - reloc_src_bo = NULL; - if (reloc.reloc_type == QXL_RELOC_TYPE_BO) { - apply_reloc(qdev, reloc_dst_bo, reloc_dst_offset + reloc.dst_offset, - reloc_src_bo, reloc.src_offset); - } else if (reloc.reloc_type == QXL_RELOC_TYPE_SURF) { - apply_surf_reloc(qdev, reloc_dst_bo, reloc_dst_offset + reloc.dst_offset, reloc_src_bo); - } else { - DRM_ERROR("unknown reloc type %d\n", reloc.reloc_type); - return -EINVAL; - } - - if (reloc_src_bo && reloc_src_bo != cmd_bo) { - qxl_release_add_res(qdev, release, reloc_src_bo); - drm_gem_object_unreference_unlocked(&reloc_src_bo->gem_base); - } - - if (reloc_dst_bo != cmd_bo) - drm_gem_object_unreference_unlocked(&reloc_dst_bo->gem_base); - } - qxl_fence_releaseable(qdev, release); - - ret = qxl_push_command_ring_release(qdev, release, user_cmd.type, true); - if (ret == -ERESTARTSYS) { - qxl_release_unreserve(qdev, release); - qxl_release_free(qdev, release); - qxl_bo_list_unreserve(&reloc_list, true); - return ret; - } - qxl_release_unreserve(qdev, release); } - qxl_bo_list_unreserve(&reloc_list, 0); return 0; } diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c index 50e7a6177167..aa161cddd87e 100644 --- a/drivers/gpu/drm/qxl/qxl_object.c +++ b/drivers/gpu/drm/qxl/qxl_object.c @@ -104,7 +104,7 @@ int qxl_bo_create(struct qxl_device *qdev, bo->surface_id = 0; qxl_fence_init(qdev, &bo->fence); INIT_LIST_HEAD(&bo->list); - atomic_set(&bo->reserve_count, 0); + if (surf) bo->surf = *surf; @@ -316,53 +316,6 @@ int qxl_bo_check_id(struct qxl_device *qdev, struct qxl_bo *bo) return 0; } -void qxl_bo_list_unreserve(struct qxl_reloc_list *reloc_list, bool failed) -{ - struct qxl_bo_list *entry, *sf; - - list_for_each_entry_safe(entry, sf, &reloc_list->bos, lhead) { - qxl_bo_unreserve(entry->bo); - list_del(&entry->lhead); - kfree(entry); - } -} - -int qxl_bo_list_add(struct qxl_reloc_list *reloc_list, struct qxl_bo *bo) -{ - struct qxl_bo_list *entry; - int ret; - - list_for_each_entry(entry, &reloc_list->bos, lhead) { - if (entry->bo == bo) - return 0; - } - - entry = kmalloc(sizeof(struct qxl_bo_list), GFP_KERNEL); - if (!entry) - return -ENOMEM; - - entry->bo = bo; - list_add(&entry->lhead, &reloc_list->bos); - - ret = qxl_bo_reserve(bo, false); - if (ret) - return ret; - - if (!bo->pin_count) { - qxl_ttm_placement_from_domain(bo, bo->type, false); - ret = ttm_bo_validate(&bo->tbo, &bo->placement, - true, false); - if (ret) - return ret; - } - - /* allocate a surface for reserved + validated buffers */ - ret = qxl_bo_check_id(bo->gem_base.dev->dev_private, bo); - if (ret) - return ret; - return 0; -} - int qxl_surf_evict(struct qxl_device *qdev) { return ttm_bo_evict_mm(&qdev->mman.bdev, TTM_PL_PRIV0); diff --git a/drivers/gpu/drm/qxl/qxl_object.h b/drivers/gpu/drm/qxl/qxl_object.h index 116637f09347..8cb6167038e5 100644 --- a/drivers/gpu/drm/qxl/qxl_object.h +++ b/drivers/gpu/drm/qxl/qxl_object.h @@ -102,6 +102,4 @@ extern int qxl_bo_unpin(struct qxl_bo *bo); extern void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain, bool pinned); extern bool qxl_ttm_bo_is_qxl_bo(struct ttm_buffer_object *bo); -extern int qxl_bo_list_add(struct qxl_reloc_list *reloc_list, struct qxl_bo *bo); -extern void qxl_bo_list_unreserve(struct qxl_reloc_list *reloc_list, bool failed); #endif diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c index b7f1271c6014..b61449e52cd5 100644 --- a/drivers/gpu/drm/qxl/qxl_release.c +++ b/drivers/gpu/drm/qxl/qxl_release.c @@ -38,7 +38,8 @@ static const int release_size_per_bo[] = { RELEASE_SIZE, SURFACE_RELEASE_SIZE, RELEASE_SIZE }; static const int releases_per_bo[] = { RELEASES_PER_BO, SURFACE_RELEASES_PER_BO, RELEASES_PER_BO }; -uint64_t + +static uint64_t qxl_release_alloc(struct qxl_device *qdev, int type, struct qxl_release **ret) { @@ -53,9 +54,9 @@ qxl_release_alloc(struct qxl_device *qdev, int type, return 0; } release->type = type; - release->bo_count = 0; release->release_offset = 0; release->surface_release_id = 0; + INIT_LIST_HEAD(&release->bos); idr_preload(GFP_KERNEL); spin_lock(&qdev->release_idr_lock); @@ -77,20 +78,20 @@ void qxl_release_free(struct qxl_device *qdev, struct qxl_release *release) { - int i; - - QXL_INFO(qdev, "release %d, type %d, %d bos\n", release->id, - release->type, release->bo_count); + struct qxl_bo_list *entry, *tmp; + QXL_INFO(qdev, "release %d, type %d\n", release->id, + release->type); if (release->surface_release_id) qxl_surface_id_dealloc(qdev, release->surface_release_id); - for (i = 0 ; i < release->bo_count; ++i) { + list_for_each_entry_safe(entry, tmp, &release->bos, tv.head) { + struct qxl_bo *bo = to_qxl_bo(entry->tv.bo); QXL_INFO(qdev, "release %llx\n", - release->bos[i]->tbo.addr_space_offset + entry->tv.bo->addr_space_offset - DRM_FILE_OFFSET); - qxl_fence_remove_release(&release->bos[i]->fence, release->id); - qxl_bo_unref(&release->bos[i]); + qxl_fence_remove_release(&bo->fence, release->id); + qxl_bo_unref(&bo); } spin_lock(&qdev->release_idr_lock); idr_remove(&qdev->release_idr, release->id); @@ -98,22 +99,6 @@ qxl_release_free(struct qxl_device *qdev, kfree(release); } -void -qxl_release_add_res(struct qxl_device *qdev, struct qxl_release *release, - struct qxl_bo *bo) -{ - int i; - for (i = 0; i < release->bo_count; i++) - if (release->bos[i] == bo) - return; - - if (release->bo_count >= QXL_MAX_RES) { - DRM_ERROR("exceeded max resource on a qxl_release item\n"); - return; - } - release->bos[release->bo_count++] = qxl_bo_ref(bo); -} - static int qxl_release_bo_alloc(struct qxl_device *qdev, struct qxl_bo **bo) { @@ -125,58 +110,106 @@ static int qxl_release_bo_alloc(struct qxl_device *qdev, return ret; } -int qxl_release_reserve(struct qxl_device *qdev, - struct qxl_release *release, bool no_wait) +int qxl_release_list_add(struct qxl_release *release, struct qxl_bo *bo) +{ + struct qxl_bo_list *entry; + + list_for_each_entry(entry, &release->bos, tv.head) { + if (entry->tv.bo == &bo->tbo) + return 0; + } + + entry = kmalloc(sizeof(struct qxl_bo_list), GFP_KERNEL); + if (!entry) + return -ENOMEM; + + qxl_bo_ref(bo); + entry->tv.bo = &bo->tbo; + list_add_tail(&entry->tv.head, &release->bos); + return 0; +} + +static int qxl_release_validate_bo(struct qxl_bo *bo) { int ret; - if (atomic_inc_return(&release->bos[0]->reserve_count) == 1) { - ret = qxl_bo_reserve(release->bos[0], no_wait); + + if (!bo->pin_count) { + qxl_ttm_placement_from_domain(bo, bo->type, false); + ret = ttm_bo_validate(&bo->tbo, &bo->placement, + true, false); if (ret) return ret; } + + /* allocate a surface for reserved + validated buffers */ + ret = qxl_bo_check_id(bo->gem_base.dev->dev_private, bo); + if (ret) + return ret; + return 0; +} + +int qxl_release_reserve_list(struct qxl_release *release, bool no_intr) +{ + int ret; + struct qxl_bo_list *entry; + + /* if only one object on the release its the release itself + since these objects are pinned no need to reserve */ + if (list_is_singular(&release->bos)) + return 0; + + ret = ttm_eu_reserve_buffers(&release->ticket, &release->bos); + if (ret) + return ret; + + list_for_each_entry(entry, &release->bos, tv.head) { + struct qxl_bo *bo = to_qxl_bo(entry->tv.bo); + + ret = qxl_release_validate_bo(bo); + if (ret) { + ttm_eu_backoff_reservation(&release->ticket, &release->bos); + return ret; + } + } return 0; } -void qxl_release_unreserve(struct qxl_device *qdev, - struct qxl_release *release) +void qxl_release_backoff_reserve_list(struct qxl_release *release) { - if (atomic_dec_and_test(&release->bos[0]->reserve_count)) - qxl_bo_unreserve(release->bos[0]); + /* if only one object on the release its the release itself + since these objects are pinned no need to reserve */ + if (list_is_singular(&release->bos)) + return; + + ttm_eu_backoff_reservation(&release->ticket, &release->bos); } + int qxl_alloc_surface_release_reserved(struct qxl_device *qdev, enum qxl_surface_cmd_type surface_cmd_type, struct qxl_release *create_rel, struct qxl_release **release) { - int ret; - if (surface_cmd_type == QXL_SURFACE_CMD_DESTROY && create_rel) { int idr_ret; + struct qxl_bo_list *entry = list_first_entry(&create_rel->bos, struct qxl_bo_list, tv.head); struct qxl_bo *bo; union qxl_release_info *info; /* stash the release after the create command */ idr_ret = qxl_release_alloc(qdev, QXL_RELEASE_SURFACE_CMD, release); - bo = qxl_bo_ref(create_rel->bos[0]); + bo = qxl_bo_ref(to_qxl_bo(entry->tv.bo)); (*release)->release_offset = create_rel->release_offset + 64; - qxl_release_add_res(qdev, *release, bo); + qxl_release_list_add(*release, bo); - ret = qxl_release_reserve(qdev, *release, false); - if (ret) { - DRM_ERROR("release reserve failed\n"); - goto out_unref; - } info = qxl_release_map(qdev, *release); info->id = idr_ret; qxl_release_unmap(qdev, *release, info); - -out_unref: qxl_bo_unref(&bo); - return ret; + return 0; } return qxl_alloc_release_reserved(qdev, sizeof(struct qxl_surface_cmd), @@ -189,7 +222,7 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, { struct qxl_bo *bo; int idr_ret; - int ret; + int ret = 0; union qxl_release_info *info; int cur_idx; @@ -228,36 +261,18 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, if (rbo) *rbo = bo; - qxl_release_add_res(qdev, *release, bo); - - ret = qxl_release_reserve(qdev, *release, false); mutex_unlock(&qdev->release_mutex); - if (ret) - goto out_unref; + + qxl_release_list_add(*release, bo); info = qxl_release_map(qdev, *release); info->id = idr_ret; qxl_release_unmap(qdev, *release, info); -out_unref: qxl_bo_unref(&bo); return ret; } -int qxl_fence_releaseable(struct qxl_device *qdev, - struct qxl_release *release) -{ - int i, ret; - for (i = 0; i < release->bo_count; i++) { - if (!release->bos[i]->tbo.sync_obj) - release->bos[i]->tbo.sync_obj = &release->bos[i]->fence; - ret = qxl_fence_add_release(&release->bos[i]->fence, release->id); - if (ret) - return ret; - } - return 0; -} - struct qxl_release *qxl_release_from_id_locked(struct qxl_device *qdev, uint64_t id) { @@ -270,10 +285,7 @@ struct qxl_release *qxl_release_from_id_locked(struct qxl_device *qdev, DRM_ERROR("failed to find id in release_idr\n"); return NULL; } - if (release->bo_count < 1) { - DRM_ERROR("read a released resource with 0 bos\n"); - return NULL; - } + return release; } @@ -282,9 +294,12 @@ union qxl_release_info *qxl_release_map(struct qxl_device *qdev, { void *ptr; union qxl_release_info *info; - struct qxl_bo *bo = release->bos[0]; + struct qxl_bo_list *entry = list_first_entry(&release->bos, struct qxl_bo_list, tv.head); + struct qxl_bo *bo = to_qxl_bo(entry->tv.bo); ptr = qxl_bo_kmap_atomic_page(qdev, bo, release->release_offset & PAGE_SIZE); + if (!ptr) + return NULL; info = ptr + (release->release_offset & ~PAGE_SIZE); return info; } @@ -293,9 +308,51 @@ void qxl_release_unmap(struct qxl_device *qdev, struct qxl_release *release, union qxl_release_info *info) { - struct qxl_bo *bo = release->bos[0]; + struct qxl_bo_list *entry = list_first_entry(&release->bos, struct qxl_bo_list, tv.head); + struct qxl_bo *bo = to_qxl_bo(entry->tv.bo); void *ptr; ptr = ((void *)info) - (release->release_offset & ~PAGE_SIZE); qxl_bo_kunmap_atomic_page(qdev, bo, ptr); } + +void qxl_release_fence_buffer_objects(struct qxl_release *release) +{ + struct ttm_validate_buffer *entry; + struct ttm_buffer_object *bo; + struct ttm_bo_global *glob; + struct ttm_bo_device *bdev; + struct ttm_bo_driver *driver; + struct qxl_bo *qbo; + + /* if only one object on the release its the release itself + since these objects are pinned no need to reserve */ + if (list_is_singular(&release->bos)) + return; + + bo = list_first_entry(&release->bos, struct ttm_validate_buffer, head)->bo; + bdev = bo->bdev; + driver = bdev->driver; + glob = bo->glob; + + spin_lock(&glob->lru_lock); + spin_lock(&bdev->fence_lock); + + list_for_each_entry(entry, &release->bos, head) { + bo = entry->bo; + qbo = to_qxl_bo(bo); + + if (!entry->bo->sync_obj) + entry->bo->sync_obj = &qbo->fence; + + qxl_fence_add_release_locked(&qbo->fence, release->id); + + ttm_bo_add_to_lru(bo); + ww_mutex_unlock(&bo->resv->lock); + entry->reserved = false; + } + spin_unlock(&bdev->fence_lock); + spin_unlock(&glob->lru_lock); + ww_acquire_fini(&release->ticket); +} + From 9310f61a94ec779b2919864c7e66241ff80fe96d Mon Sep 17 00:00:00 2001 From: Tomas Winkler <tomas.winkler@intel.com> Date: Wed, 17 Jul 2013 15:13:14 +0300 Subject: [PATCH 396/913] mei: hbm: fix typo in error message writet -> write Tested-by: Shuah Khan <shuah.kh@samsung.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/misc/mei/hbm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c index f9296abcf02a..6127ab64bb39 100644 --- a/drivers/misc/mei/hbm.c +++ b/drivers/misc/mei/hbm.c @@ -167,7 +167,7 @@ int mei_hbm_start_req(struct mei_device *dev) dev->hbm_state = MEI_HBM_IDLE; if (mei_write_message(dev, mei_hdr, dev->wr_msg.data)) { - dev_err(&dev->pdev->dev, "version message writet failed\n"); + dev_err(&dev->pdev->dev, "version message write failed\n"); dev->dev_state = MEI_DEV_RESETTING; mei_reset(dev, 1); return -ENODEV; From 315a383ad7dbd484fafb93ef08038e3dbafbb7a8 Mon Sep 17 00:00:00 2001 From: Tomas Winkler <tomas.winkler@intel.com> Date: Wed, 17 Jul 2013 15:13:15 +0300 Subject: [PATCH 397/913] mei: me: fix reset state machine ME HW ready bit is down after hw reset was asserted or on error. Only on error we need to enter the reset flow, additional reset need to be prevented when reset was triggered during initialization , power up/down or a reset is already in progress Tested-by: Shuah Khan <shuah.kh@samsung.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/misc/mei/hw-me.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index e4f8dec4dc3c..a0e19e61e7df 100644 --- a/drivers/misc/mei/hw-me.c +++ b/drivers/misc/mei/hw-me.c @@ -483,7 +483,9 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) /* check if ME wants a reset */ if (!mei_hw_is_ready(dev) && dev->dev_state != MEI_DEV_RESETTING && - dev->dev_state != MEI_DEV_INITIALIZING) { + dev->dev_state != MEI_DEV_INITIALIZING && + dev->dev_state != MEI_DEV_POWER_DOWN && + dev->dev_state != MEI_DEV_POWER_UP) { dev_dbg(&dev->pdev->dev, "FW not ready.\n"); mei_reset(dev, 1); mutex_unlock(&dev->device_lock); From 99f22c4ef24cf87b0dae6aabe6b5e620b62961d9 Mon Sep 17 00:00:00 2001 From: Tomas Winkler <tomas.winkler@intel.com> Date: Wed, 17 Jul 2013 15:13:16 +0300 Subject: [PATCH 398/913] mei: don't have to clean the state on power up When powering up, we don't have to clean up the device state nothing is connected. Tested-by: Shuah Khan <shuah.kh@samsung.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/misc/mei/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index ed1d75203af6..e6f16f83ecde 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c @@ -148,7 +148,8 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) dev->hbm_state = MEI_HBM_IDLE; - if (dev->dev_state != MEI_DEV_INITIALIZING) { + if (dev->dev_state != MEI_DEV_INITIALIZING && + dev->dev_state != MEI_DEV_POWER_UP) { if (dev->dev_state != MEI_DEV_DISABLED && dev->dev_state != MEI_DEV_POWER_DOWN) dev->dev_state = MEI_DEV_RESETTING; From dab9bf41b23fe700c4a74133e41eb6a21706031e Mon Sep 17 00:00:00 2001 From: Tomas Winkler <tomas.winkler@intel.com> Date: Wed, 17 Jul 2013 15:13:17 +0300 Subject: [PATCH 399/913] mei: me: fix waiting for hw ready 1. MEI_INTEROP_TIMEOUT is in seconds not in jiffies so we use mei_secs_to_jiffies macro While cold boot is fast this is relevant in resume 2. wait_event_interruptible_timeout can return with -ERESTARTSYS so do not override it with -ETIMEDOUT 3.Adjust error message Tested-by: Shuah Khan <shuah.kh@samsung.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/misc/mei/hw-me.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index a0e19e61e7df..b22c7e247225 100644 --- a/drivers/misc/mei/hw-me.c +++ b/drivers/misc/mei/hw-me.c @@ -239,14 +239,18 @@ static int mei_me_hw_ready_wait(struct mei_device *dev) if (mei_me_hw_is_ready(dev)) return 0; + dev->recvd_hw_ready = false; mutex_unlock(&dev->device_lock); err = wait_event_interruptible_timeout(dev->wait_hw_ready, - dev->recvd_hw_ready, MEI_INTEROP_TIMEOUT); + dev->recvd_hw_ready, + mei_secs_to_jiffies(MEI_INTEROP_TIMEOUT)); mutex_lock(&dev->device_lock); if (!err && !dev->recvd_hw_ready) { + if (!err) + err = -ETIMEDOUT; dev_err(&dev->pdev->dev, - "wait hw ready failed. status = 0x%x\n", err); - return -ETIMEDOUT; + "wait hw ready failed. status = %d\n", err); + return err; } dev->recvd_hw_ready = false; From 33959f88fce9b8d3346d8000b3425814cbc6d6c0 Mon Sep 17 00:00:00 2001 From: Michael Neuling <mikey@neuling.org> Date: Thu, 18 Jul 2013 11:31:51 +1000 Subject: [PATCH 400/913] powerpc: Add second POWER8 PVR entry POWER8 comes with two different PVRs. This patch enables the additional PVR in the cputable. The existing entry (PVR=0x4b) is renamed to POWER8E and the new entry (PVR=0x4d) is given POWER8. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/reg.h | 3 ++- arch/powerpc/kernel/cputable.c | 20 +++++++++++++++++++- arch/powerpc/kernel/prom_init.c | 5 +++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 5d7d9c2a5473..a6840e4e24f7 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h @@ -1088,7 +1088,8 @@ #define PVR_970MP 0x0044 #define PVR_970GX 0x0045 #define PVR_POWER7p 0x004A -#define PVR_POWER8 0x004B +#define PVR_POWER8E 0x004B +#define PVR_POWER8 0x004D #define PVR_BE 0x0070 #define PVR_PA6T 0x0090 diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 2a45d0f04385..22973a74df73 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c @@ -494,9 +494,27 @@ static struct cpu_spec __initdata cpu_specs[] = { .cpu_restore = __restore_cpu_power7, .platform = "power7+", }, - { /* Power8 */ + { /* Power8E */ .pvr_mask = 0xffff0000, .pvr_value = 0x004b0000, + .cpu_name = "POWER8E (raw)", + .cpu_features = CPU_FTRS_POWER8, + .cpu_user_features = COMMON_USER_POWER8, + .cpu_user_features2 = COMMON_USER2_POWER8, + .mmu_features = MMU_FTRS_POWER8, + .icache_bsize = 128, + .dcache_bsize = 128, + .num_pmcs = 6, + .pmc_type = PPC_PMC_IBM, + .oprofile_cpu_type = "ppc64/power8", + .oprofile_type = PPC_OPROFILE_INVALID, + .cpu_setup = __setup_cpu_power8, + .cpu_restore = __restore_cpu_power8, + .platform = "power8", + }, + { /* Power8 */ + .pvr_mask = 0xffff0000, + .pvr_value = 0x004d0000, .cpu_name = "POWER8 (raw)", .cpu_features = CPU_FTRS_POWER8, .cpu_user_features = COMMON_USER_POWER8, diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 5eccda9fd33f..607902424e73 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -644,7 +644,8 @@ unsigned char ibm_architecture_vec[] = { W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */ W(0xffff0000), W(0x003e0000), /* POWER6 */ W(0xffff0000), W(0x003f0000), /* POWER7 */ - W(0xffff0000), W(0x004b0000), /* POWER8 */ + W(0xffff0000), W(0x004b0000), /* POWER8E */ + W(0xffff0000), W(0x004d0000), /* POWER8 */ W(0xffffffff), W(0x0f000004), /* all 2.07-compliant */ W(0xffffffff), W(0x0f000003), /* all 2.06-compliant */ W(0xffffffff), W(0x0f000002), /* all 2.05-compliant */ @@ -706,7 +707,7 @@ unsigned char ibm_architecture_vec[] = { * must match by the macro below. Update the definition if * the structure layout changes. */ -#define IBM_ARCH_VEC_NRCORES_OFFSET 117 +#define IBM_ARCH_VEC_NRCORES_OFFSET 125 W(NR_CPUS), /* number of cores supported */ 0, 0, From 0e0ed6406e61434d3f38fb58aa8464ec4722b77e Mon Sep 17 00:00:00 2001 From: Anton Blanchard <anton@samba.org> Date: Mon, 15 Jul 2013 14:04:50 +1000 Subject: [PATCH 401/913] powerpc/modules: Module CRC relocation fix causes perf issues Module CRCs are implemented as absolute symbols that get resolved by a linker script. We build an intermediate .o that contains an unresolved symbol for each CRC. genksysms parses this .o, calculates the CRCs and writes a linker script that "resolves" the symbols to the calculated CRC. Unfortunately the ppc64 relocatable kernel sees these CRCs as symbols that need relocating and relocates them at boot. Commit d4703aef (module: handle ppc64 relocating kcrctabs when CONFIG_RELOCATABLE=y) added a hook to reverse the bogus relocations. Part of this patch created a symbol at 0x0: # head -2 /proc/kallsyms 0000000000000000 T reloc_start c000000000000000 T .__start This reloc_start symbol is causing lots of confusion to perf. It thinks reloc_start is a massive function that stretches from 0x0 to 0xc000000000000000 and we get various cryptic errors out of perf, including: problem incrementing symbol count, skipping event This patch removes the reloc_start linker script label and instead defines it as PHYSICAL_START. We also need to wrap it with CONFIG_PPC64 because the ppc32 kernel can set a non zero PHYSICAL_START at compile time and we wouldn't want to subtract it from the CRCs in that case. Signed-off-by: Anton Blanchard <anton@samba.org> Cc: <stable@kernel.org> Acked-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/module.h | 5 ++--- arch/powerpc/kernel/vmlinux.lds.S | 3 --- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/module.h b/arch/powerpc/include/asm/module.h index c1df590ec444..49fa55bfbac4 100644 --- a/arch/powerpc/include/asm/module.h +++ b/arch/powerpc/include/asm/module.h @@ -82,10 +82,9 @@ struct exception_table_entry; void sort_ex_table(struct exception_table_entry *start, struct exception_table_entry *finish); -#ifdef CONFIG_MODVERSIONS +#if defined(CONFIG_MODVERSIONS) && defined(CONFIG_PPC64) #define ARCH_RELOCATES_KCRCTAB - -extern const unsigned long reloc_start[]; +#define reloc_start PHYSICAL_START #endif #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_MODULE_H */ diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 654e479802f2..f096e72262f4 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -38,9 +38,6 @@ jiffies = jiffies_64 + 4; #endif SECTIONS { - . = 0; - reloc_start = .; - . = KERNELBASE; /* From 0b88f772bdf2847461debf417b1ee96043a7cb1b Mon Sep 17 00:00:00 2001 From: Tiejun Chen <tiejun.chen@windriver.com> Date: Mon, 15 Jul 2013 10:36:04 +0800 Subject: [PATCH 402/913] powerpc: Access local paca after hard irq disabled In hard_irq_disable(), we accessed the PACA before we hard disabled the interrupts, potentially causing a warning as get_paca() will us debug_smp_processor_id(). Move that to after the disabling, and also use local_paca directly rather than get_paca() to avoid several redundant and useless checks. Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/hw_irq.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h index ba713f166fa5..10be1dd01c6b 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h @@ -96,10 +96,11 @@ static inline bool arch_irqs_disabled(void) #endif #define hard_irq_disable() do { \ - u8 _was_enabled = get_paca()->soft_enabled; \ + u8 _was_enabled; \ __hard_irq_disable(); \ - get_paca()->soft_enabled = 0; \ - get_paca()->irq_happened |= PACA_IRQ_HARD_DIS; \ + _was_enabled = local_paca->soft_enabled; \ + local_paca->soft_enabled = 0; \ + local_paca->irq_happened |= PACA_IRQ_HARD_DIS; \ if (_was_enabled) \ trace_hardirqs_off(); \ } while(0) From 97645154a9056106a957905c7836a016e5c89b3b Mon Sep 17 00:00:00 2001 From: Paul Bolle <pebolle@tiscali.nl> Date: Sun, 14 Jul 2013 13:02:15 +0200 Subject: [PATCH 403/913] powerpc/pseries: Drop "select HOTPLUG" The Kconfig symbol HOTPLUG was removed with commit 40b313608a ("Finally eradicate CONFIG_HOTPLUG"). But there's still one select statement for that symbol. It seems that select statement was added after the patch to remove CONFIG_HOTPLUG was submitted. Anyhow, it is useless and can be dropped. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/platforms/pseries/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index 1bd3399146ed..62b4f8025de0 100644 --- a/arch/powerpc/platforms/pseries/Kconfig +++ b/arch/powerpc/platforms/pseries/Kconfig @@ -19,7 +19,6 @@ config PPC_PSERIES select ZLIB_DEFLATE select PPC_DOORBELL select HAVE_CONTEXT_TRACKING - select HOTPLUG if SMP select HOTPLUG_CPU if SMP default y From 5d7ead0039b0c9500825b46997896352810efb0b Mon Sep 17 00:00:00 2001 From: Michael Ellerman <michael@ellerman.id.au> Date: Sat, 13 Jul 2013 12:53:40 +1000 Subject: [PATCH 404/913] powerpc/perf: Set PPC_FEATURE2_EBB when we register the power8 PMU The presence or absence of EBB is advertised to userspace via the presence or absence of PPC_FEATURE2_EBB in cpu_user_features2. Because the kernel can be built without PMU support, we should only add PPC_FEATURE2_EBB to cpu_user_features2 when we successfully register the power8 PMU support. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/perf/power8-pmu.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c index 96a64d6a8bdf..09def196f5c4 100644 --- a/arch/powerpc/perf/power8-pmu.c +++ b/arch/powerpc/perf/power8-pmu.c @@ -621,10 +621,19 @@ static struct power_pmu power8_pmu = { static int __init init_power8_pmu(void) { + int rc; + if (!cur_cpu_spec->oprofile_cpu_type || strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power8")) return -ENODEV; - return register_power_pmu(&power8_pmu); + rc = register_power_pmu(&power8_pmu); + if (rc) + return rc; + + /* Tell userspace that EBB is supported */ + cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_EBB; + + return 0; } early_initcall(init_power8_pmu); From ee1dd1e3dc774cf257012215d996e8e7e370c162 Mon Sep 17 00:00:00 2001 From: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Date: Wed, 10 Jul 2013 18:32:56 +0530 Subject: [PATCH 405/913] powerpc: Fix the corrupt r3 error during MCE handling. During Machine Check interrupt on pseries platform, R3 generally points to memory region inside RTAS (FWNMI) area. We see r3 corruption because when RTAS delivers the machine check exception it passes the address inside FWNMI area with the top most bit set. This patch fixes this issue by masking top two bit in machine check exception handler. Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/platforms/pseries/ras.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c index 7b3cbde8c783..721c0586b284 100644 --- a/arch/powerpc/platforms/pseries/ras.c +++ b/arch/powerpc/platforms/pseries/ras.c @@ -287,6 +287,9 @@ static struct rtas_error_log *fwnmi_get_errinfo(struct pt_regs *regs) unsigned long *savep; struct rtas_error_log *h, *errhdr = NULL; + /* Mask top two bits */ + regs->gpr[3] &= ~(0x3UL << 62); + if (!VALID_FWNMI_BUFFER(regs->gpr[3])) { printk(KERN_ERR "FWNMI: corrupt r3 0x%016lx\n", regs->gpr[3]); return NULL; From 0ba178888b05a4efdaca7da528c170bd09f9687b Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 10:24:51 +0800 Subject: [PATCH 406/913] powerpc/eeh: Remove reference to PCI device We will rely on pcibios_release_device() to remove the EEH cache and unbind EEH device for the specific PCI device. So we shouldn't hold the reference to the PCI device from EEH cache and EEH device. Otherwise, pcibios_release_device() won't be called as we expected. The patch removes the reference to the PCI device in EEH core. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/kernel/eeh.c | 4 ---- arch/powerpc/kernel/eeh_cache.c | 18 +++++------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index 39954fe941b8..b5c425ea2974 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c @@ -499,8 +499,6 @@ unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned lon } eeh_dev_check_failure(edev); - - pci_dev_put(eeh_dev_to_pci_dev(edev)); return val; } @@ -904,7 +902,6 @@ static void eeh_add_device_late(struct pci_dev *dev) } WARN_ON(edev->pdev); - pci_dev_get(dev); edev->pdev = dev; dev->dev.archdata.edev = edev; @@ -992,7 +989,6 @@ static void eeh_remove_device(struct pci_dev *dev, int purge_pe) } edev->pdev = NULL; dev->dev.archdata.edev = NULL; - pci_dev_put(dev); eeh_rmv_from_parent_pe(edev, purge_pe); eeh_addr_cache_rmv_dev(dev); diff --git a/arch/powerpc/kernel/eeh_cache.c b/arch/powerpc/kernel/eeh_cache.c index f9ac1232a746..e8c9fd546a5c 100644 --- a/arch/powerpc/kernel/eeh_cache.c +++ b/arch/powerpc/kernel/eeh_cache.c @@ -68,16 +68,12 @@ static inline struct eeh_dev *__eeh_addr_cache_get_device(unsigned long addr) struct pci_io_addr_range *piar; piar = rb_entry(n, struct pci_io_addr_range, rb_node); - if (addr < piar->addr_lo) { + if (addr < piar->addr_lo) n = n->rb_left; - } else { - if (addr > piar->addr_hi) { - n = n->rb_right; - } else { - pci_dev_get(piar->pcidev); - return piar->edev; - } - } + else if (addr > piar->addr_hi) + n = n->rb_right; + else + return piar->edev; } return NULL; @@ -156,7 +152,6 @@ eeh_addr_cache_insert(struct pci_dev *dev, unsigned long alo, if (!piar) return NULL; - pci_dev_get(dev); piar->addr_lo = alo; piar->addr_hi = ahi; piar->edev = pci_dev_to_eeh_dev(dev); @@ -250,7 +245,6 @@ restart: if (piar->pcidev == dev) { rb_erase(n, &pci_io_addr_cache_root.rb_root); - pci_dev_put(piar->pcidev); kfree(piar); goto restart; } @@ -302,12 +296,10 @@ void eeh_addr_cache_build(void) if (!edev) continue; - pci_dev_get(dev); /* matching put is in eeh_remove_device() */ dev->dev.archdata.edev = edev; edev->pdev = dev; eeh_addr_cache_insert_dev(dev); - eeh_sysfs_add_device(dev); } From f2856491d24044de08da9e53cf7068841a8b4e1c Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 10:24:52 +0800 Subject: [PATCH 407/913] powerpc/eeh: Export functions for hotplug Make some functions public in order to support hotplug on either specific PCI bus or PCI device in future. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/eeh.h | 9 +++++++++ arch/powerpc/kernel/eeh.c | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index 09a8743143f3..d9d35c27de25 100644 --- a/arch/powerpc/include/asm/eeh.h +++ b/arch/powerpc/include/asm/eeh.h @@ -209,9 +209,12 @@ unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val); int eeh_dev_check_failure(struct eeh_dev *edev); void eeh_addr_cache_build(void); +void eeh_add_device_early(struct device_node *); void eeh_add_device_tree_early(struct device_node *); +void eeh_add_device_late(struct pci_dev *); void eeh_add_device_tree_late(struct pci_bus *); void eeh_add_sysfs_files(struct pci_bus *); +void eeh_remove_device(struct pci_dev *, int); void eeh_remove_bus_device(struct pci_dev *, int); /** @@ -252,12 +255,18 @@ static inline unsigned long eeh_check_failure(const volatile void __iomem *token static inline void eeh_addr_cache_build(void) { } +static inline void eeh_add_device_early(struct device_node *dn) { } + static inline void eeh_add_device_tree_early(struct device_node *dn) { } +static inline void eeh_add_device_late(struct pci_dev *dev) { } + static inline void eeh_add_device_tree_late(struct pci_bus *bus) { } static inline void eeh_add_sysfs_files(struct pci_bus *bus) { } +static inline void eeh_remove_device(struct pci_dev *dev, int purge_pe) { } + static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { } #define EEH_POSSIBLE_ERROR(val, type) (0) diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index b5c425ea2974..582ad1ef46a8 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c @@ -836,7 +836,7 @@ core_initcall_sync(eeh_init); * on the CEC architecture, type of the device, on earlier boot * command-line arguments & etc. */ -static void eeh_add_device_early(struct device_node *dn) +void eeh_add_device_early(struct device_node *dn) { struct pci_controller *phb; @@ -884,7 +884,7 @@ EXPORT_SYMBOL_GPL(eeh_add_device_tree_early); * This routine must be used to complete EEH initialization for PCI * devices that were added after system boot (e.g. hotplug, dlpar). */ -static void eeh_add_device_late(struct pci_dev *dev) +void eeh_add_device_late(struct pci_dev *dev) { struct device_node *dn; struct eeh_dev *edev; @@ -972,7 +972,7 @@ EXPORT_SYMBOL_GPL(eeh_add_sysfs_files); * this device will no longer be detected after this call; thus, * i/o errors affecting this slot may leave this device unusable. */ -static void eeh_remove_device(struct pci_dev *dev, int purge_pe) +void eeh_remove_device(struct pci_dev *dev, int purge_pe) { struct eeh_dev *edev; From 008a4938ea07db071f03adffaa3a78c2fbbcde6b Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 10:24:53 +0800 Subject: [PATCH 408/913] powerpc/pci: Override pcibios_release_device() The patch overrides pcibios_release_device() to release EEH resources (EEH cache, unbinding EEH device) for the indicated PCI device. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/kernel/pci-hotplug.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c index 3f608800c06b..3dab2f2801b9 100644 --- a/arch/powerpc/kernel/pci-hotplug.c +++ b/arch/powerpc/kernel/pci-hotplug.c @@ -21,6 +21,17 @@ #include <asm/firmware.h> #include <asm/eeh.h> +/** + * pcibios_release_device - release PCI device + * @dev: PCI device + * + * The function is called before releasing the indicated PCI device. + */ +void pcibios_release_device(struct pci_dev *dev) +{ + eeh_remove_device(dev, 1); +} + /** * __pcibios_remove_pci_devices - remove all devices under this bus * @bus: the indicated PCI bus From c7b51bce636e4990662bb100bc17e1d4d6c02d34 Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 10:24:54 +0800 Subject: [PATCH 409/913] powerpc/pci/hotplug: Don't need to remove from EEH cache twice Since pcibios_release_device() called by pci_stop_and_remove_bus_device() has removed the device from the EEH cache, we needn't do that again. Cc: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- drivers/pci/hotplug/rpadlpar_core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c index b29e20b7862f..bb7af78e4eed 100644 --- a/drivers/pci/hotplug/rpadlpar_core.c +++ b/drivers/pci/hotplug/rpadlpar_core.c @@ -388,7 +388,6 @@ int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn) /* Remove the EADS bridge device itself */ BUG_ON(!bus->self); pr_debug("PCI: Now removing bridge device %s\n", pci_name(bus->self)); - eeh_remove_bus_device(bus->self, true); pci_stop_and_remove_bus_device(bus->self); return 0; From 807a827d4e7455a40e8f56ec2a67c57a91cab9f7 Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 10:24:55 +0800 Subject: [PATCH 410/913] powerpc/eeh: Keep PE during hotplug When we do normal hotplug, the PE (shadow EEH structure) shouldn't be kept around. However, we need to keep it if the hotplug an artifial one caused by EEH errors recovery. Since we remove EEH device through the PCI hook pcibios_release_device(), the flag "purge_pe" passed to various functions is meaningless. So the patch removes the meaningless flag and introduce new flag "EEH_PE_KEEP" to save the PE while doing hotplug during EEH error recovery. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/eeh.h | 11 +++---- arch/powerpc/include/asm/pci-bridge.h | 1 - arch/powerpc/kernel/eeh.c | 28 ++-------------- arch/powerpc/kernel/eeh_driver.c | 7 ++-- arch/powerpc/kernel/eeh_pe.c | 7 ++-- arch/powerpc/kernel/pci-hotplug.c | 46 +++++++++------------------ 6 files changed, 30 insertions(+), 70 deletions(-) diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index d9d35c27de25..2ce22d7b71a0 100644 --- a/arch/powerpc/include/asm/eeh.h +++ b/arch/powerpc/include/asm/eeh.h @@ -55,6 +55,8 @@ struct device_node; #define EEH_PE_RECOVERING (1 << 1) /* Recovering PE */ #define EEH_PE_PHB_DEAD (1 << 2) /* Dead PHB */ +#define EEH_PE_KEEP (1 << 8) /* Keep PE on hotplug */ + struct eeh_pe { int type; /* PE type: PHB/Bus/Device */ int state; /* PE EEH dependent mode */ @@ -193,7 +195,7 @@ int eeh_phb_pe_create(struct pci_controller *phb); struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb); struct eeh_pe *eeh_pe_get(struct eeh_dev *edev); int eeh_add_to_parent_pe(struct eeh_dev *edev); -int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe); +int eeh_rmv_from_parent_pe(struct eeh_dev *edev); void eeh_pe_update_time_stamp(struct eeh_pe *pe); void *eeh_pe_dev_traverse(struct eeh_pe *root, eeh_traverse_func fn, void *flag); @@ -214,8 +216,7 @@ void eeh_add_device_tree_early(struct device_node *); void eeh_add_device_late(struct pci_dev *); void eeh_add_device_tree_late(struct pci_bus *); void eeh_add_sysfs_files(struct pci_bus *); -void eeh_remove_device(struct pci_dev *, int); -void eeh_remove_bus_device(struct pci_dev *, int); +void eeh_remove_device(struct pci_dev *); /** * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. @@ -265,9 +266,7 @@ static inline void eeh_add_device_tree_late(struct pci_bus *bus) { } static inline void eeh_add_sysfs_files(struct pci_bus *bus) { } -static inline void eeh_remove_device(struct pci_dev *dev, int purge_pe) { } - -static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { } +static inline void eeh_remove_device(struct pci_dev *dev) { } #define EEH_POSSIBLE_ERROR(val, type) (0) #define EEH_IO_ERROR_VALUE(size) (-1UL) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 2c1d8cb9b265..32d0d2018faf 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -209,7 +209,6 @@ static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn) extern struct pci_bus *pcibios_find_pci_bus(struct device_node *dn); /** Remove all of the PCI devices under this bus */ -extern void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe); extern void pcibios_remove_pci_devices(struct pci_bus *bus); /** Discover new pci devices under this bus, and add them */ diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index 582ad1ef46a8..ce81477316be 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c @@ -964,7 +964,6 @@ EXPORT_SYMBOL_GPL(eeh_add_sysfs_files); /** * eeh_remove_device - Undo EEH setup for the indicated pci device * @dev: pci device to be removed - * @purge_pe: remove the PE or not * * This routine should be called when a device is removed from * a running system (e.g. by hotplug or dlpar). It unregisters @@ -972,7 +971,7 @@ EXPORT_SYMBOL_GPL(eeh_add_sysfs_files); * this device will no longer be detected after this call; thus, * i/o errors affecting this slot may leave this device unusable. */ -void eeh_remove_device(struct pci_dev *dev, int purge_pe) +void eeh_remove_device(struct pci_dev *dev) { struct eeh_dev *edev; @@ -990,34 +989,11 @@ void eeh_remove_device(struct pci_dev *dev, int purge_pe) edev->pdev = NULL; dev->dev.archdata.edev = NULL; - eeh_rmv_from_parent_pe(edev, purge_pe); + eeh_rmv_from_parent_pe(edev); eeh_addr_cache_rmv_dev(dev); eeh_sysfs_remove_device(dev); } -/** - * eeh_remove_bus_device - Undo EEH setup for the indicated PCI device - * @dev: PCI device - * @purge_pe: remove the corresponding PE or not - * - * This routine must be called when a device is removed from the - * running system through hotplug or dlpar. The corresponding - * PCI address cache will be removed. - */ -void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) -{ - struct pci_bus *bus = dev->subordinate; - struct pci_dev *child, *tmp; - - eeh_remove_device(dev, purge_pe); - - if (bus && dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { - list_for_each_entry_safe(child, tmp, &bus->devices, bus_list) - eeh_remove_bus_device(child, purge_pe); - } -} -EXPORT_SYMBOL_GPL(eeh_remove_bus_device); - static int proc_eeh_show(struct seq_file *m, void *v) { if (0 == eeh_subsystem_enabled) { diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c index 2b1ce17cae50..9ef3bbb8580a 100644 --- a/arch/powerpc/kernel/eeh_driver.c +++ b/arch/powerpc/kernel/eeh_driver.c @@ -362,8 +362,10 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus) * devices are expected to be attached soon when calling * into pcibios_add_pci_devices(). */ - if (bus) - __pcibios_remove_pci_devices(bus, 0); + if (bus) { + eeh_pe_state_mark(pe, EEH_PE_KEEP); + pcibios_remove_pci_devices(bus); + } /* Reset the pci controller. (Asserts RST#; resets config space). * Reconfigure bridges and devices. Don't try to bring the system @@ -386,6 +388,7 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus) if (bus) { ssleep(5); pcibios_add_pci_devices(bus); + eeh_pe_state_clear(pe, EEH_PE_KEEP); } pe->tstamp = tstamp; diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c index 016588a6f5ed..32ef40940bad 100644 --- a/arch/powerpc/kernel/eeh_pe.c +++ b/arch/powerpc/kernel/eeh_pe.c @@ -333,7 +333,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) while (parent) { if (!(parent->type & EEH_PE_INVALID)) break; - parent->type &= ~EEH_PE_INVALID; + parent->type &= ~(EEH_PE_INVALID | EEH_PE_KEEP); parent = parent->parent; } pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n", @@ -397,14 +397,13 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) /** * eeh_rmv_from_parent_pe - Remove one EEH device from the associated PE * @edev: EEH device - * @purge_pe: remove PE or not * * The PE hierarchy tree might be changed when doing PCI hotplug. * Also, the PCI devices or buses could be removed from the system * during EEH recovery. So we have to call the function remove the * corresponding PE accordingly if necessary. */ -int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe) +int eeh_rmv_from_parent_pe(struct eeh_dev *edev) { struct eeh_pe *pe, *parent, *child; int cnt; @@ -431,7 +430,7 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe) if (pe->type & EEH_PE_PHB) break; - if (purge_pe) { + if (!(pe->state & EEH_PE_KEEP)) { if (list_empty(&pe->edevs) && list_empty(&pe->child_list)) { list_del(&pe->child); diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c index 3dab2f2801b9..fc0831d4971f 100644 --- a/arch/powerpc/kernel/pci-hotplug.c +++ b/arch/powerpc/kernel/pci-hotplug.c @@ -29,36 +29,7 @@ */ void pcibios_release_device(struct pci_dev *dev) { - eeh_remove_device(dev, 1); -} - -/** - * __pcibios_remove_pci_devices - remove all devices under this bus - * @bus: the indicated PCI bus - * @purge_pe: destroy the PE on removal of PCI devices - * - * Remove all of the PCI devices under this bus both from the - * linux pci device tree, and from the powerpc EEH address cache. - * By default, the corresponding PE will be destroied during the - * normal PCI hotplug path. For PCI hotplug during EEH recovery, - * the corresponding PE won't be destroied and deallocated. - */ -void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe) -{ - struct pci_dev *dev, *tmp; - struct pci_bus *child_bus; - - /* First go down child busses */ - list_for_each_entry(child_bus, &bus->children, node) - __pcibios_remove_pci_devices(child_bus, purge_pe); - - pr_debug("PCI: Removing devices on bus %04x:%02x\n", - pci_domain_nr(bus), bus->number); - list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { - pr_debug(" * Removing %s...\n", pci_name(dev)); - eeh_remove_bus_device(dev, purge_pe); - pci_stop_and_remove_bus_device(dev); - } + eeh_remove_device(dev); } /** @@ -70,8 +41,21 @@ void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe) */ void pcibios_remove_pci_devices(struct pci_bus *bus) { - __pcibios_remove_pci_devices(bus, 1); + struct pci_dev *dev, *tmp; + struct pci_bus *child_bus; + + /* First go down child busses */ + list_for_each_entry(child_bus, &bus->children, node) + pcibios_remove_pci_devices(child_bus); + + pr_debug("PCI: Removing devices on bus %04x:%02x\n", + pci_domain_nr(bus), bus->number); + list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { + pr_debug(" Removing %s...\n", pci_name(dev)); + pci_stop_and_remove_bus_device(dev); + } } + EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices); /** From 9feed42e93d2625db86423cedf8b4b2bed00779e Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 10:24:56 +0800 Subject: [PATCH 411/913] powerpc/eeh: Use safe list traversal when walking EEH devices Currently, we're trasversing the EEH devices list using list_for_each_entry(). That's not safe enough because the EEH devices might be removed from its parent PE while doing iteration. The patch replaces that with list_for_each_entry_safe(). Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/eeh.h | 4 ++-- arch/powerpc/kernel/eeh.c | 4 ++-- arch/powerpc/kernel/eeh_pe.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index 2ce22d7b71a0..e8c411b63caf 100644 --- a/arch/powerpc/include/asm/eeh.h +++ b/arch/powerpc/include/asm/eeh.h @@ -74,8 +74,8 @@ struct eeh_pe { struct list_head child; /* Child PEs */ }; -#define eeh_pe_for_each_dev(pe, edev) \ - list_for_each_entry(edev, &pe->edevs, list) +#define eeh_pe_for_each_dev(pe, edev, tmp) \ + list_for_each_entry_safe(edev, tmp, &pe->edevs, list) /* * The struct is used to trace EEH state for the associated diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index ce81477316be..56bd4584f61f 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c @@ -231,7 +231,7 @@ static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len) void eeh_slot_error_detail(struct eeh_pe *pe, int severity) { size_t loglen = 0; - struct eeh_dev *edev; + struct eeh_dev *edev, *tmp; bool valid_cfg_log = true; /* @@ -251,7 +251,7 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity) eeh_pe_restore_bars(pe); pci_regs_buf[0] = 0; - eeh_pe_for_each_dev(pe, edev) { + eeh_pe_for_each_dev(pe, edev, tmp) { loglen += eeh_gather_pci_data(edev, pci_regs_buf + loglen, EEH_PCI_REGS_LOG_LEN - loglen); } diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c index 32ef40940bad..c8b815e45c8f 100644 --- a/arch/powerpc/kernel/eeh_pe.c +++ b/arch/powerpc/kernel/eeh_pe.c @@ -176,7 +176,7 @@ void *eeh_pe_dev_traverse(struct eeh_pe *root, eeh_traverse_func fn, void *flag) { struct eeh_pe *pe; - struct eeh_dev *edev; + struct eeh_dev *edev, *tmp; void *ret; if (!root) { @@ -186,7 +186,7 @@ void *eeh_pe_dev_traverse(struct eeh_pe *root, /* Traverse root PE */ for (pe = root; pe; pe = eeh_pe_next(pe, root)) { - eeh_pe_for_each_dev(pe, edev) { + eeh_pe_for_each_dev(pe, edev, tmp) { ret = fn(edev, flag); if (ret) return ret; @@ -501,7 +501,7 @@ static void *__eeh_pe_state_mark(void *data, void *flag) { struct eeh_pe *pe = (struct eeh_pe *)data; int state = *((int *)flag); - struct eeh_dev *tmp; + struct eeh_dev *edev, *tmp; struct pci_dev *pdev; /* @@ -511,8 +511,8 @@ static void *__eeh_pe_state_mark(void *data, void *flag) * the PCI device driver. */ pe->state |= state; - eeh_pe_for_each_dev(pe, tmp) { - pdev = eeh_dev_to_pci_dev(tmp); + eeh_pe_for_each_dev(pe, edev, tmp) { + pdev = eeh_dev_to_pci_dev(edev); if (pdev) pdev->error_state = pci_channel_io_frozen; } From ab444ec97e8bd65fff9d489b9a409fc03979268b Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 10:24:57 +0800 Subject: [PATCH 412/913] powerpc/pci: Partial tree hotplug support When EEH error happens to one specific PE, the device drivers of its attached EEH devices (PCI devices) are checked to see the further action: reset with complete hotplug, or reset without hotplug. However, that's not enough for those PCI devices whose drivers can't support EEH, or those PCI devices without driver. So we need do so-called "partial hotplug" on basis of PCI devices. In the situation, part of PCI devices of the specific PE are unplugged and plugged again after PE reset. The patch changes pcibios_add_pci_devices() so that it can support full hotplug and so-called "partial" hotplug based on device-tree or real hardware. It's notable that pci_of_scan.c has been changed for a bit in order to support the "partial" hotplug based on dev-tree. Most of the generic code already supports that, we just need to plumb it properly on our side. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/kernel/pci-common.c | 2 ++ arch/powerpc/kernel/pci-hotplug.c | 14 +++++--- arch/powerpc/kernel/pci_of_scan.c | 56 ++++++++++++++++++++++--------- 3 files changed, 51 insertions(+), 21 deletions(-) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index f46914a0f33e..7d22a675fe1a 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -1462,6 +1462,8 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus) /* Allocate bus and devices resources */ pcibios_allocate_bus_resources(bus); pcibios_claim_one_bus(bus); + if (!pci_has_flag(PCI_PROBE_ONLY)) + pci_assign_unassigned_bus_resources(bus); /* Fixup EEH */ eeh_add_device_tree_late(bus); diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c index fc0831d4971f..c1e17ae68a08 100644 --- a/arch/powerpc/kernel/pci-hotplug.c +++ b/arch/powerpc/kernel/pci-hotplug.c @@ -71,7 +71,7 @@ EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices); */ void pcibios_add_pci_devices(struct pci_bus * bus) { - int slotno, num, mode, pass, max; + int slotno, mode, pass, max; struct pci_dev *dev; struct device_node *dn = pci_bus_to_OF_node(bus); @@ -85,11 +85,15 @@ void pcibios_add_pci_devices(struct pci_bus * bus) /* use ofdt-based probe */ of_rescan_bus(dn, bus); } else if (mode == PCI_PROBE_NORMAL) { - /* use legacy probe */ + /* + * Use legacy probe. In the partial hotplug case, we + * probably have grandchildren devices unplugged. So + * we don't check the return value from pci_scan_slot() in + * order for fully rescan all the way down to pick them up. + * They can have been removed during partial hotplug. + */ slotno = PCI_SLOT(PCI_DN(dn->child)->devfn); - num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); - if (!num) - return; + pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); pcibios_setup_bus_devices(bus); max = bus->busn_res.start; for (pass = 0; pass < 2; pass++) { diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c index 6b0ba5854d99..15d9105323bf 100644 --- a/arch/powerpc/kernel/pci_of_scan.c +++ b/arch/powerpc/kernel/pci_of_scan.c @@ -230,11 +230,14 @@ void of_scan_pci_bridge(struct pci_dev *dev) return; } - bus = pci_add_new_bus(dev->bus, dev, busrange[0]); + bus = pci_find_bus(pci_domain_nr(dev->bus), busrange[0]); if (!bus) { - printk(KERN_ERR "Failed to create pci bus for %s\n", - node->full_name); - return; + bus = pci_add_new_bus(dev->bus, dev, busrange[0]); + if (!bus) { + printk(KERN_ERR "Failed to create pci bus for %s\n", + node->full_name); + return; + } } bus->primary = dev->bus->number; @@ -292,6 +295,38 @@ void of_scan_pci_bridge(struct pci_dev *dev) } EXPORT_SYMBOL(of_scan_pci_bridge); +static struct pci_dev *of_scan_pci_dev(struct pci_bus *bus, + struct device_node *dn) +{ + struct pci_dev *dev = NULL; + const u32 *reg; + int reglen, devfn; + + pr_debug(" * %s\n", dn->full_name); + if (!of_device_is_available(dn)) + return NULL; + + reg = of_get_property(dn, "reg", ®len); + if (reg == NULL || reglen < 20) + return NULL; + devfn = (reg[0] >> 8) & 0xff; + + /* Check if the PCI device is already there */ + dev = pci_get_slot(bus, devfn); + if (dev) { + pci_dev_put(dev); + return dev; + } + + /* create a new pci_dev for this device */ + dev = of_create_pci_dev(dn, bus, devfn); + if (!dev) + return NULL; + + pr_debug(" dev header type: %x\n", dev->hdr_type); + return dev; +} + /** * __of_scan_bus - given a PCI bus node, setup bus and scan for child devices * @node: device tree node for the PCI bus @@ -302,8 +337,6 @@ static void __of_scan_bus(struct device_node *node, struct pci_bus *bus, int rescan_existing) { struct device_node *child; - const u32 *reg; - int reglen, devfn; struct pci_dev *dev; pr_debug("of_scan_bus(%s) bus no %d...\n", @@ -311,16 +344,7 @@ static void __of_scan_bus(struct device_node *node, struct pci_bus *bus, /* Scan direct children */ for_each_child_of_node(node, child) { - pr_debug(" * %s\n", child->full_name); - if (!of_device_is_available(child)) - continue; - reg = of_get_property(child, "reg", ®len); - if (reg == NULL || reglen < 20) - continue; - devfn = (reg[0] >> 8) & 0xff; - - /* create a new pci_dev for this device */ - dev = of_create_pci_dev(child, bus, devfn); + dev = of_scan_pci_dev(bus, child); if (!dev) continue; pr_debug(" dev header type: %x\n", dev->hdr_type); From f5c57710dd62dd06f176934a8b4b8accbf00f9f8 Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 10:24:58 +0800 Subject: [PATCH 413/913] powerpc/eeh: Use partial hotplug for EEH unaware drivers When EEH error happens to one specific PE, some devices with drivers supporting EEH won't except hotplug on the device. However, there might have other deivces without driver, or with driver without EEH support. For the case, we need do partial hotplug in order to make sure that the PE becomes absolutely quite during reset. Otherise, the PE reset might fail and leads to failure of error recovery. The current code doesn't handle that 'mixed' case properly, it either uses the error callbacks to the drivers, or tries hotplug, but doesn't handle a PE (EEH domain) composed of a combination of the two. The patch intends to support so-called "partial" hotplug for EEH: Before we do reset, we stop and remove those PCI devices without EEH sensitive driver. The corresponding EEH devices are not detached from its PE, but with special flag. After the reset is done, those EEH devices with the special flag will be scanned one by one. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/eeh.h | 6 +- arch/powerpc/kernel/eeh.c | 30 +++++++- arch/powerpc/kernel/eeh_driver.c | 74 ++++++++++++++++++-- arch/powerpc/kernel/eeh_pe.c | 20 ++---- arch/powerpc/kernel/eeh_sysfs.c | 7 ++ arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +- arch/powerpc/platforms/pseries/eeh_pseries.c | 2 +- 7 files changed, 117 insertions(+), 24 deletions(-) diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index e8c411b63caf..f54a60131de5 100644 --- a/arch/powerpc/include/asm/eeh.h +++ b/arch/powerpc/include/asm/eeh.h @@ -84,7 +84,8 @@ struct eeh_pe { * another tree except the currently existing tree of PCI * buses and PCI devices */ -#define EEH_DEV_IRQ_DISABLED (1<<0) /* Interrupt disabled */ +#define EEH_DEV_IRQ_DISABLED (1 << 0) /* Interrupt disabled */ +#define EEH_DEV_DISCONNECTED (1 << 1) /* Removing from PE */ struct eeh_dev { int mode; /* EEH mode */ @@ -97,6 +98,7 @@ struct eeh_dev { struct pci_controller *phb; /* Associated PHB */ struct device_node *dn; /* Associated device node */ struct pci_dev *pdev; /* Associated PCI device */ + struct pci_bus *bus; /* PCI bus for partial hotplug */ }; static inline struct device_node *eeh_dev_to_of_node(struct eeh_dev *edev) @@ -197,6 +199,8 @@ struct eeh_pe *eeh_pe_get(struct eeh_dev *edev); int eeh_add_to_parent_pe(struct eeh_dev *edev); int eeh_rmv_from_parent_pe(struct eeh_dev *edev); void eeh_pe_update_time_stamp(struct eeh_pe *pe); +void *eeh_pe_traverse(struct eeh_pe *root, + eeh_traverse_func fn, void *flag); void *eeh_pe_dev_traverse(struct eeh_pe *root, eeh_traverse_func fn, void *flag); void eeh_pe_restore_bars(struct eeh_pe *pe); diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index 56bd4584f61f..a5783f1a7a96 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c @@ -900,7 +900,21 @@ void eeh_add_device_late(struct pci_dev *dev) pr_debug("EEH: Already referenced !\n"); return; } - WARN_ON(edev->pdev); + + /* + * The EEH cache might not be removed correctly because of + * unbalanced kref to the device during unplug time, which + * relies on pcibios_release_device(). So we have to remove + * that here explicitly. + */ + if (edev->pdev) { + eeh_rmv_from_parent_pe(edev); + eeh_addr_cache_rmv_dev(edev->pdev); + eeh_sysfs_remove_device(edev->pdev); + + edev->pdev = NULL; + dev->dev.archdata.edev = NULL; + } edev->pdev = dev; dev->dev.archdata.edev = edev; @@ -982,14 +996,24 @@ void eeh_remove_device(struct pci_dev *dev) /* Unregister the device with the EEH/PCI address search system */ pr_debug("EEH: Removing device %s\n", pci_name(dev)); - if (!edev || !edev->pdev) { + if (!edev || !edev->pdev || !edev->pe) { pr_debug("EEH: Not referenced !\n"); return; } + + /* + * During the hotplug for EEH error recovery, we need the EEH + * device attached to the parent PE in order for BAR restore + * a bit later. So we keep it for BAR restore and remove it + * from the parent PE during the BAR resotre. + */ edev->pdev = NULL; dev->dev.archdata.edev = NULL; + if (!(edev->pe->state & EEH_PE_KEEP)) + eeh_rmv_from_parent_pe(edev); + else + edev->mode |= EEH_DEV_DISCONNECTED; - eeh_rmv_from_parent_pe(edev); eeh_addr_cache_rmv_dev(dev); eeh_sysfs_remove_device(dev); } diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c index 9ef3bbb8580a..9fda75d1f5aa 100644 --- a/arch/powerpc/kernel/eeh_driver.c +++ b/arch/powerpc/kernel/eeh_driver.c @@ -338,6 +338,54 @@ static void *eeh_report_failure(void *data, void *userdata) return NULL; } +static void *eeh_rmv_device(void *data, void *userdata) +{ + struct pci_driver *driver; + struct eeh_dev *edev = (struct eeh_dev *)data; + struct pci_dev *dev = eeh_dev_to_pci_dev(edev); + int *removed = (int *)userdata; + + /* + * Actually, we should remove the PCI bridges as well. + * However, that's lots of complexity to do that, + * particularly some of devices under the bridge might + * support EEH. So we just care about PCI devices for + * simplicity here. + */ + if (!dev || (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE)) + return NULL; + driver = eeh_pcid_get(dev); + if (driver && driver->err_handler) + return NULL; + + /* Remove it from PCI subsystem */ + pr_debug("EEH: Removing %s without EEH sensitive driver\n", + pci_name(dev)); + edev->bus = dev->bus; + edev->mode |= EEH_DEV_DISCONNECTED; + (*removed)++; + + pci_stop_and_remove_bus_device(dev); + + return NULL; +} + +static void *eeh_pe_detach_dev(void *data, void *userdata) +{ + struct eeh_pe *pe = (struct eeh_pe *)data; + struct eeh_dev *edev, *tmp; + + eeh_pe_for_each_dev(pe, edev, tmp) { + if (!(edev->mode & EEH_DEV_DISCONNECTED)) + continue; + + edev->mode &= ~(EEH_DEV_DISCONNECTED | EEH_DEV_IRQ_DISABLED); + eeh_rmv_from_parent_pe(edev); + } + + return NULL; +} + /** * eeh_reset_device - Perform actual reset of a pci slot * @pe: EEH PE @@ -349,8 +397,9 @@ static void *eeh_report_failure(void *data, void *userdata) */ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus) { + struct pci_bus *frozen_bus = eeh_pe_bus_get(pe); struct timeval tstamp; - int cnt, rc; + int cnt, rc, removed = 0; /* pcibios will clear the counter; save the value */ cnt = pe->freeze_count; @@ -362,10 +411,11 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus) * devices are expected to be attached soon when calling * into pcibios_add_pci_devices(). */ - if (bus) { - eeh_pe_state_mark(pe, EEH_PE_KEEP); + eeh_pe_state_mark(pe, EEH_PE_KEEP); + if (bus) pcibios_remove_pci_devices(bus); - } + else if (frozen_bus) + eeh_pe_dev_traverse(pe, eeh_rmv_device, &removed); /* Reset the pci controller. (Asserts RST#; resets config space). * Reconfigure bridges and devices. Don't try to bring the system @@ -386,10 +436,24 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus) * potentially weird things happen. */ if (bus) { + pr_info("EEH: Sleep 5s ahead of complete hotplug\n"); ssleep(5); + + /* + * The EEH device is still connected with its parent + * PE. We should disconnect it so the binding can be + * rebuilt when adding PCI devices. + */ + eeh_pe_traverse(pe, eeh_pe_detach_dev, NULL); pcibios_add_pci_devices(bus); - eeh_pe_state_clear(pe, EEH_PE_KEEP); + } else if (frozen_bus && removed) { + pr_info("EEH: Sleep 5s ahead of partial hotplug\n"); + ssleep(5); + + eeh_pe_traverse(pe, eeh_pe_detach_dev, NULL); + pcibios_add_pci_devices(frozen_bus); } + eeh_pe_state_clear(pe, EEH_PE_KEEP); pe->tstamp = tstamp; pe->freeze_count = cnt; diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c index c8b815e45c8f..2aa955ae01a1 100644 --- a/arch/powerpc/kernel/eeh_pe.c +++ b/arch/powerpc/kernel/eeh_pe.c @@ -149,8 +149,8 @@ static struct eeh_pe *eeh_pe_next(struct eeh_pe *pe, * callback returns something other than NULL, or no more PEs * to be traversed. */ -static void *eeh_pe_traverse(struct eeh_pe *root, - eeh_traverse_func fn, void *flag) +void *eeh_pe_traverse(struct eeh_pe *root, + eeh_traverse_func fn, void *flag) { struct eeh_pe *pe; void *ret; @@ -409,8 +409,8 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev) int cnt; if (!edev->pe) { - pr_warning("%s: No PE found for EEH device %s\n", - __func__, edev->dn->full_name); + pr_debug("%s: No PE found for EEH device %s\n", + __func__, edev->dn->full_name); return -EEXIST; } @@ -728,18 +728,12 @@ static void eeh_restore_device_bars(struct eeh_dev *edev, */ static void *eeh_restore_one_device_bars(void *data, void *flag) { - struct pci_dev *pdev = NULL; struct eeh_dev *edev = (struct eeh_dev *)data; + struct pci_dev *pdev = eeh_dev_to_pci_dev(edev); struct device_node *dn = eeh_dev_to_of_node(edev); - /* Trace the PCI bridge */ - if (eeh_probe_mode_dev()) { - pdev = eeh_dev_to_pci_dev(edev); - if (pdev->hdr_type != PCI_HEADER_TYPE_BRIDGE) - pdev = NULL; - } - - if (pdev) + /* Do special restore for bridges */ + if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE) eeh_restore_bridge_bars(pdev, edev, dn); else eeh_restore_device_bars(edev, dn); diff --git a/arch/powerpc/kernel/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c index e7ae3484918c..61e2a1452131 100644 --- a/arch/powerpc/kernel/eeh_sysfs.c +++ b/arch/powerpc/kernel/eeh_sysfs.c @@ -68,6 +68,13 @@ void eeh_sysfs_add_device(struct pci_dev *pdev) void eeh_sysfs_remove_device(struct pci_dev *pdev) { + /* + * The parent directory might have been removed. We needn't + * continue for that case. + */ + if (!pdev->dev.kobj.sd) + return; + device_remove_file(&pdev->dev, &dev_attr_eeh_mode); device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr); device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c index 969cce73055a..a380428cf9ce 100644 --- a/arch/powerpc/platforms/powernv/eeh-powernv.c +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c @@ -114,7 +114,7 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag) * the root bridge. So it's not reasonable to continue * the probing. */ - if (!dn || !edev) + if (!dn || !edev || edev->pe) return 0; /* Skip for PCI-ISA bridge */ diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c index b456b157d33d..0f44f9fe49ac 100644 --- a/arch/powerpc/platforms/pseries/eeh_pseries.c +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c @@ -153,7 +153,7 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag) /* Retrieve OF node and eeh device */ edev = of_node_to_eeh_dev(dn); - if (!of_device_is_available(dn)) + if (edev->pe || !of_device_is_available(dn)) return NULL; /* Retrieve class/vendor/device IDs */ From 4b83bd452f17582c8d1c916568fd28a237a2eb46 Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 10:24:59 +0800 Subject: [PATCH 414/913] powerpc/eeh: Don't use pci_dev during BAR restore While restoring BARs for one specific PCI device, the pci_dev instance should have been released. So it's not reliable to use the pci_dev instance on restoring BARs. However, we still need some information (e.g. PCIe capability position, header type) from the pci_dev instance. So we have to store those information to EEH device in advance. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/eeh.h | 8 ++- arch/powerpc/kernel/eeh_pe.c | 25 ++++---- arch/powerpc/platforms/powernv/eeh-powernv.c | 11 ++++ arch/powerpc/platforms/pseries/eeh_pseries.c | 63 +++++++++++++++++++- 4 files changed, 91 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index f54a60131de5..4199d9943277 100644 --- a/arch/powerpc/include/asm/eeh.h +++ b/arch/powerpc/include/asm/eeh.h @@ -84,8 +84,11 @@ struct eeh_pe { * another tree except the currently existing tree of PCI * buses and PCI devices */ -#define EEH_DEV_IRQ_DISABLED (1 << 0) /* Interrupt disabled */ -#define EEH_DEV_DISCONNECTED (1 << 1) /* Removing from PE */ +#define EEH_DEV_BRIDGE (1 << 0) /* PCI bridge */ +#define EEH_DEV_ROOT_PORT (1 << 1) /* PCIe root port */ +#define EEH_DEV_DS_PORT (1 << 2) /* Downstream port */ +#define EEH_DEV_IRQ_DISABLED (1 << 3) /* Interrupt disabled */ +#define EEH_DEV_DISCONNECTED (1 << 4) /* Removing from PE */ struct eeh_dev { int mode; /* EEH mode */ @@ -93,6 +96,7 @@ struct eeh_dev { int config_addr; /* Config address */ int pe_config_addr; /* PE config address */ u32 config_space[16]; /* Saved PCI config space */ + u8 pcie_cap; /* Saved PCIe capability */ struct eeh_pe *pe; /* Associated PE */ struct list_head list; /* Form link list in the PE */ struct pci_controller *phb; /* Associated PHB */ diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c index 2aa955ae01a1..f9450537e335 100644 --- a/arch/powerpc/kernel/eeh_pe.c +++ b/arch/powerpc/kernel/eeh_pe.c @@ -578,7 +578,7 @@ void eeh_pe_state_clear(struct eeh_pe *pe, int state) * blocked on normal path during the stage. So we need utilize * eeh operations, which is always permitted. */ -static void eeh_bridge_check_link(struct pci_dev *pdev, +static void eeh_bridge_check_link(struct eeh_dev *edev, struct device_node *dn) { int cap; @@ -589,16 +589,17 @@ static void eeh_bridge_check_link(struct pci_dev *pdev, * We only check root port and downstream ports of * PCIe switches */ - if (!pci_is_pcie(pdev) || - (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT && - pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM)) + if (!(edev->mode & (EEH_DEV_ROOT_PORT | EEH_DEV_DS_PORT))) return; - pr_debug("%s: Check PCIe link for %s ...\n", - __func__, pci_name(pdev)); + pr_debug("%s: Check PCIe link for %04x:%02x:%02x.%01x ...\n", + __func__, edev->phb->global_number, + edev->config_addr >> 8, + PCI_SLOT(edev->config_addr & 0xFF), + PCI_FUNC(edev->config_addr & 0xFF)); /* Check slot status */ - cap = pdev->pcie_cap; + cap = edev->pcie_cap; eeh_ops->read_config(dn, cap + PCI_EXP_SLTSTA, 2, &val); if (!(val & PCI_EXP_SLTSTA_PDS)) { pr_debug(" No card in the slot (0x%04x) !\n", val); @@ -652,8 +653,7 @@ static void eeh_bridge_check_link(struct pci_dev *pdev, #define BYTE_SWAP(OFF) (8*((OFF)/4)+3-(OFF)) #define SAVED_BYTE(OFF) (((u8 *)(edev->config_space))[BYTE_SWAP(OFF)]) -static void eeh_restore_bridge_bars(struct pci_dev *pdev, - struct eeh_dev *edev, +static void eeh_restore_bridge_bars(struct eeh_dev *edev, struct device_node *dn) { int i; @@ -679,7 +679,7 @@ static void eeh_restore_bridge_bars(struct pci_dev *pdev, eeh_ops->write_config(dn, PCI_COMMAND, 4, edev->config_space[1]); /* Check the PCIe link is ready */ - eeh_bridge_check_link(pdev, dn); + eeh_bridge_check_link(edev, dn); } static void eeh_restore_device_bars(struct eeh_dev *edev, @@ -729,12 +729,11 @@ static void eeh_restore_device_bars(struct eeh_dev *edev, static void *eeh_restore_one_device_bars(void *data, void *flag) { struct eeh_dev *edev = (struct eeh_dev *)data; - struct pci_dev *pdev = eeh_dev_to_pci_dev(edev); struct device_node *dn = eeh_dev_to_of_node(edev); /* Do special restore for bridges */ - if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE) - eeh_restore_bridge_bars(pdev, edev, dn); + if (edev->mode & EEH_DEV_BRIDGE) + eeh_restore_bridge_bars(edev, dn); else eeh_restore_device_bars(edev, dn); diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c index a380428cf9ce..4361a5c7f3ab 100644 --- a/arch/powerpc/platforms/powernv/eeh-powernv.c +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c @@ -124,6 +124,17 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag) /* Initialize eeh device */ edev->class_code = dev->class; edev->mode = 0; + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) + edev->mode |= EEH_DEV_BRIDGE; + if (pci_is_pcie(dev)) { + edev->pcie_cap = pci_pcie_cap(dev); + + if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) + edev->mode |= EEH_DEV_ROOT_PORT; + else if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM) + edev->mode |= EEH_DEV_DS_PORT; + } + edev->config_addr = ((dev->bus->number << 8) | dev->devfn); edev->pe_config_addr = phb->bdfn_to_pe(phb, dev->bus, dev->devfn & 0xff); diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c index 0f44f9fe49ac..9e80f0af311f 100644 --- a/arch/powerpc/platforms/pseries/eeh_pseries.c +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c @@ -133,6 +133,48 @@ static int pseries_eeh_init(void) return 0; } +static int pseries_eeh_cap_start(struct device_node *dn) +{ + struct pci_dn *pdn = PCI_DN(dn); + u32 status; + + if (!pdn) + return 0; + + rtas_read_config(pdn, PCI_STATUS, 2, &status); + if (!(status & PCI_STATUS_CAP_LIST)) + return 0; + + return PCI_CAPABILITY_LIST; +} + + +static int pseries_eeh_find_cap(struct device_node *dn, int cap) +{ + struct pci_dn *pdn = PCI_DN(dn); + int pos = pseries_eeh_cap_start(dn); + int cnt = 48; /* Maximal number of capabilities */ + u32 id; + + if (!pos) + return 0; + + while (cnt--) { + rtas_read_config(pdn, pos, 1, &pos); + if (pos < 0x40) + break; + pos &= ~3; + rtas_read_config(pdn, pos + PCI_CAP_LIST_ID, 1, &id); + if (id == 0xff) + break; + if (id == cap) + return pos; + pos += PCI_CAP_LIST_NEXT; + } + + return 0; +} + /** * pseries_eeh_of_probe - EEH probe on the given device * @dn: OF node @@ -146,8 +188,10 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag) { struct eeh_dev *edev; struct eeh_pe pe; + struct pci_dn *pdn = PCI_DN(dn); const u32 *class_code, *vendor_id, *device_id; const u32 *regs; + u32 pcie_flags; int enable = 0; int ret; @@ -167,9 +211,26 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag) if (dn->type && !strcmp(dn->type, "isa")) return NULL; - /* Update class code and mode of eeh device */ + /* + * Update class code and mode of eeh device. We need + * correctly reflects that current device is root port + * or PCIe switch downstream port. + */ edev->class_code = *class_code; + edev->pcie_cap = pseries_eeh_find_cap(dn, PCI_CAP_ID_EXP); edev->mode = 0; + if ((edev->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) { + edev->mode |= EEH_DEV_BRIDGE; + if (edev->pcie_cap) { + rtas_read_config(pdn, edev->pcie_cap + PCI_EXP_FLAGS, + 2, &pcie_flags); + pcie_flags = (pcie_flags & PCI_EXP_FLAGS_TYPE) >> 4; + if (pcie_flags == PCI_EXP_TYPE_ROOT_PORT) + edev->mode |= EEH_DEV_ROOT_PORT; + else if (pcie_flags == PCI_EXP_TYPE_DOWNSTREAM) + edev->mode |= EEH_DEV_DS_PORT; + } + } /* Retrieve the device address */ regs = of_get_property(dn, "reg", NULL); From 91150af3adf67463c4ca7d72d4fe1a84da37792c Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 10:25:00 +0800 Subject: [PATCH 415/913] powerpc/eeh: Fix unbalanced enable for IRQ The patch fixes following issue: Unbalanced enable for IRQ 23 ------------[ cut here ]------------ WARNING: at kernel/irq/manage.c:437 : NIP [c00000000016de8c] .__enable_irq+0x11c/0x140 LR [c00000000016de88] .__enable_irq+0x118/0x140 Call Trace: [c000003ea1f23880] [c00000000016de88] .__enable_irq+0x118/0x140 (unreliable) [c000003ea1f23910] [c00000000016df08] .enable_irq+0x58/0xa0 [c000003ea1f239a0] [c0000000000388b4] .eeh_enable_irq+0xc4/0xe0 [c000003ea1f23a30] [c000000000038a28] .eeh_report_reset+0x78/0x130 [c000003ea1f23ac0] [c000000000037508] .eeh_pe_dev_traverse+0x98/0x170 [c000003ea1f23b60] [c0000000000391ac] .eeh_handle_normal_event+0x2fc/0x3d0 [c000003ea1f23bf0] [c000000000039538] .eeh_handle_event+0x2b8/0x2c0 [c000003ea1f23c90] [c000000000039600] .eeh_event_handler+0xc0/0x170 [c000003ea1f23d30] [c0000000000da9a0] .kthread+0xf0/0x100 [c000003ea1f23e30] [c00000000000a1dc] .ret_from_kernel_thread+0x5c/0x80 Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/kernel/eeh_driver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c index 9fda75d1f5aa..36bed5a12750 100644 --- a/arch/powerpc/kernel/eeh_driver.c +++ b/arch/powerpc/kernel/eeh_driver.c @@ -143,10 +143,14 @@ static void eeh_disable_irq(struct pci_dev *dev) static void eeh_enable_irq(struct pci_dev *dev) { struct eeh_dev *edev = pci_dev_to_eeh_dev(dev); + struct irq_desc *desc; if ((edev->mode) & EEH_DEV_IRQ_DISABLED) { edev->mode &= ~EEH_DEV_IRQ_DISABLED; - enable_irq(dev->irq); + + desc = irq_to_desc(dev->irq); + if (desc && desc->depth > 0) + enable_irq(dev->irq); } } From ab55d2187da27414f78056810713c92f9a4350c2 Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 10:25:01 +0800 Subject: [PATCH 416/913] powerpc/eeh: Introdce flag to protect sysfs The patch introduces flag EEH_DEV_SYSFS to keep track that the sysfs entries for the corresponding EEH device (then PCI device) has been added or removed, in order to avoid race condition. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/eeh.h | 2 ++ arch/powerpc/kernel/eeh.c | 2 ++ arch/powerpc/kernel/eeh_sysfs.c | 16 +++++++++++++++- arch/powerpc/platforms/powernv/eeh-powernv.c | 4 ++-- arch/powerpc/platforms/pseries/eeh_pseries.c | 2 +- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index 4199d9943277..d3e5e9bc8f94 100644 --- a/arch/powerpc/include/asm/eeh.h +++ b/arch/powerpc/include/asm/eeh.h @@ -90,6 +90,8 @@ struct eeh_pe { #define EEH_DEV_IRQ_DISABLED (1 << 3) /* Interrupt disabled */ #define EEH_DEV_DISCONNECTED (1 << 4) /* Removing from PE */ +#define EEH_DEV_SYSFS (1 << 8) /* Sysfs created */ + struct eeh_dev { int mode; /* EEH mode */ int class_code; /* Class code of the device */ diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index a5783f1a7a96..ea9414c8088d 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c @@ -911,6 +911,7 @@ void eeh_add_device_late(struct pci_dev *dev) eeh_rmv_from_parent_pe(edev); eeh_addr_cache_rmv_dev(edev->pdev); eeh_sysfs_remove_device(edev->pdev); + edev->mode &= ~EEH_DEV_SYSFS; edev->pdev = NULL; dev->dev.archdata.edev = NULL; @@ -1016,6 +1017,7 @@ void eeh_remove_device(struct pci_dev *dev) eeh_addr_cache_rmv_dev(dev); eeh_sysfs_remove_device(dev); + edev->mode &= ~EEH_DEV_SYSFS; } static int proc_eeh_show(struct seq_file *m, void *v) diff --git a/arch/powerpc/kernel/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c index 61e2a1452131..5d753d4f2c75 100644 --- a/arch/powerpc/kernel/eeh_sysfs.c +++ b/arch/powerpc/kernel/eeh_sysfs.c @@ -56,26 +56,40 @@ EEH_SHOW_ATTR(eeh_pe_config_addr, pe_config_addr, "0x%x"); void eeh_sysfs_add_device(struct pci_dev *pdev) { + struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev); int rc=0; + if (edev && (edev->mode & EEH_DEV_SYSFS)) + return; + rc += device_create_file(&pdev->dev, &dev_attr_eeh_mode); rc += device_create_file(&pdev->dev, &dev_attr_eeh_config_addr); rc += device_create_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); if (rc) printk(KERN_WARNING "EEH: Unable to create sysfs entries\n"); + else if (edev) + edev->mode |= EEH_DEV_SYSFS; } void eeh_sysfs_remove_device(struct pci_dev *pdev) { + struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev); + /* * The parent directory might have been removed. We needn't * continue for that case. */ - if (!pdev->dev.kobj.sd) + if (!pdev->dev.kobj.sd) { + if (edev) + edev->mode &= ~EEH_DEV_SYSFS; return; + } device_remove_file(&pdev->dev, &dev_attr_eeh_mode); device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr); device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); + + if (edev) + edev->mode &= ~EEH_DEV_SYSFS; } diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c index 4361a5c7f3ab..79663d26e6ea 100644 --- a/arch/powerpc/platforms/powernv/eeh-powernv.c +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c @@ -122,8 +122,8 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag) return 0; /* Initialize eeh device */ - edev->class_code = dev->class; - edev->mode = 0; + edev->class_code = dev->class; + edev->mode &= 0xFFFFFF00; if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) edev->mode |= EEH_DEV_BRIDGE; if (pci_is_pcie(dev)) { diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c index 9e80f0af311f..7fbc25b1813f 100644 --- a/arch/powerpc/platforms/pseries/eeh_pseries.c +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c @@ -218,7 +218,7 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag) */ edev->class_code = *class_code; edev->pcie_cap = pseries_eeh_find_cap(dn, PCI_CAP_ID_EXP); - edev->mode = 0; + edev->mode &= 0xFFFFFF00; if ((edev->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) { edev->mode |= EEH_DEV_BRIDGE; if (edev->pcie_cap) { From d817468c4b2892b9468e2a0c92116e38a3a61370 Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki <sylvester.nawrocki@gmail.com> Date: Wed, 24 Jul 2013 13:23:51 +0900 Subject: [PATCH 417/913] ARM: S3C24XX: Add missing clkdev entries for s3c2440 UART This patch restores serial port operation which has been broken since commit 60e93575476f ("serial: samsung: enable clock before clearing pending interrupts during init") That commit only uncovered the real issue which was missing clkdev entries for the "uart" clocks on S3C2440. It went unnoticed so far because return value of clk API calls were not being checked at all in the samsung serial port driver. This patch should be backported to at least 3.10 stable kernel, since the serial port has not been working on s3c2440 since 3.10-rc5. Cc: Chander Kashyap <chander.kashyap@linaro.org> Signed-off-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com> [on S3C2440 SoC based Mini2440 board] Tested-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com> Reviewed-by: Tomasz Figa <t.figa@samsung.com> Tested-by: Juergen Beisert <jbe@pengutronix.de> Cc: <stable@vger.kernel.org> [3.10] Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> --- arch/arm/mach-s3c24xx/clock-s3c2410.c | 161 +++++++++++++-------- arch/arm/mach-s3c24xx/clock-s3c2440.c | 3 + arch/arm/plat-samsung/include/plat/clock.h | 5 + 3 files changed, 106 insertions(+), 63 deletions(-) diff --git a/arch/arm/mach-s3c24xx/clock-s3c2410.c b/arch/arm/mach-s3c24xx/clock-s3c2410.c index 34fffdf6fc1d..564553694b54 100644 --- a/arch/arm/mach-s3c24xx/clock-s3c2410.c +++ b/arch/arm/mach-s3c24xx/clock-s3c2410.c @@ -119,66 +119,101 @@ static struct clk init_clocks_off[] = { } }; -static struct clk init_clocks[] = { - { - .name = "lcd", - .parent = &clk_h, - .enable = s3c2410_clkcon_enable, - .ctrlbit = S3C2410_CLKCON_LCDC, - }, { - .name = "gpio", - .parent = &clk_p, - .enable = s3c2410_clkcon_enable, - .ctrlbit = S3C2410_CLKCON_GPIO, - }, { - .name = "usb-host", - .parent = &clk_h, - .enable = s3c2410_clkcon_enable, - .ctrlbit = S3C2410_CLKCON_USBH, - }, { - .name = "usb-device", - .parent = &clk_h, - .enable = s3c2410_clkcon_enable, - .ctrlbit = S3C2410_CLKCON_USBD, - }, { - .name = "timers", - .parent = &clk_p, - .enable = s3c2410_clkcon_enable, - .ctrlbit = S3C2410_CLKCON_PWMT, - }, { - .name = "uart", - .devname = "s3c2410-uart.0", - .parent = &clk_p, - .enable = s3c2410_clkcon_enable, - .ctrlbit = S3C2410_CLKCON_UART0, - }, { - .name = "uart", - .devname = "s3c2410-uart.1", - .parent = &clk_p, - .enable = s3c2410_clkcon_enable, - .ctrlbit = S3C2410_CLKCON_UART1, - }, { - .name = "uart", - .devname = "s3c2410-uart.2", - .parent = &clk_p, - .enable = s3c2410_clkcon_enable, - .ctrlbit = S3C2410_CLKCON_UART2, - }, { - .name = "rtc", - .parent = &clk_p, - .enable = s3c2410_clkcon_enable, - .ctrlbit = S3C2410_CLKCON_RTC, - }, { - .name = "watchdog", - .parent = &clk_p, - .ctrlbit = 0, - }, { - .name = "usb-bus-host", - .parent = &clk_usb_bus, - }, { - .name = "usb-bus-gadget", - .parent = &clk_usb_bus, - }, +static struct clk clk_lcd = { + .name = "lcd", + .parent = &clk_h, + .enable = s3c2410_clkcon_enable, + .ctrlbit = S3C2410_CLKCON_LCDC, +}; + +static struct clk clk_gpio = { + .name = "gpio", + .parent = &clk_p, + .enable = s3c2410_clkcon_enable, + .ctrlbit = S3C2410_CLKCON_GPIO, +}; + +static struct clk clk_usb_host = { + .name = "usb-host", + .parent = &clk_h, + .enable = s3c2410_clkcon_enable, + .ctrlbit = S3C2410_CLKCON_USBH, +}; + +static struct clk clk_usb_device = { + .name = "usb-device", + .parent = &clk_h, + .enable = s3c2410_clkcon_enable, + .ctrlbit = S3C2410_CLKCON_USBD, +}; + +static struct clk clk_timers = { + .name = "timers", + .parent = &clk_p, + .enable = s3c2410_clkcon_enable, + .ctrlbit = S3C2410_CLKCON_PWMT, +}; + +struct clk s3c24xx_clk_uart0 = { + .name = "uart", + .devname = "s3c2410-uart.0", + .parent = &clk_p, + .enable = s3c2410_clkcon_enable, + .ctrlbit = S3C2410_CLKCON_UART0, +}; + +struct clk s3c24xx_clk_uart1 = { + .name = "uart", + .devname = "s3c2410-uart.1", + .parent = &clk_p, + .enable = s3c2410_clkcon_enable, + .ctrlbit = S3C2410_CLKCON_UART1, +}; + +struct clk s3c24xx_clk_uart2 = { + .name = "uart", + .devname = "s3c2410-uart.2", + .parent = &clk_p, + .enable = s3c2410_clkcon_enable, + .ctrlbit = S3C2410_CLKCON_UART2, +}; + +static struct clk clk_rtc = { + .name = "rtc", + .parent = &clk_p, + .enable = s3c2410_clkcon_enable, + .ctrlbit = S3C2410_CLKCON_RTC, +}; + +static struct clk clk_watchdog = { + .name = "watchdog", + .parent = &clk_p, + .ctrlbit = 0, +}; + +static struct clk clk_usb_bus_host = { + .name = "usb-bus-host", + .parent = &clk_usb_bus, +}; + +static struct clk clk_usb_bus_gadget = { + .name = "usb-bus-gadget", + .parent = &clk_usb_bus, +}; + +static struct clk *init_clocks[] = { + &clk_lcd, + &clk_gpio, + &clk_usb_host, + &clk_usb_device, + &clk_timers, + &s3c24xx_clk_uart0, + &s3c24xx_clk_uart1, + &s3c24xx_clk_uart2, + &clk_rtc, + &clk_watchdog, + &clk_usb_bus_host, + &clk_usb_bus_gadget, }; /* s3c2410_baseclk_add() @@ -195,7 +230,6 @@ int __init s3c2410_baseclk_add(void) { unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW); unsigned long clkcon = __raw_readl(S3C2410_CLKCON); - struct clk *clkp; struct clk *xtal; int ret; int ptr; @@ -207,8 +241,9 @@ int __init s3c2410_baseclk_add(void) /* register clocks from clock array */ - clkp = init_clocks; - for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) { + for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++) { + struct clk *clkp = init_clocks[ptr]; + /* ensure that we note the clock state */ clkp->usage = clkcon & clkp->ctrlbit ? 1 : 0; diff --git a/arch/arm/mach-s3c24xx/clock-s3c2440.c b/arch/arm/mach-s3c24xx/clock-s3c2440.c index 1069b5680826..aaf006d1d6dc 100644 --- a/arch/arm/mach-s3c24xx/clock-s3c2440.c +++ b/arch/arm/mach-s3c24xx/clock-s3c2440.c @@ -166,6 +166,9 @@ static struct clk_lookup s3c2440_clk_lookup[] = { CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk), CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p), CLKDEV_INIT(NULL, "clk_uart_baud3", &s3c2440_clk_fclk_n), + CLKDEV_INIT("s3c2440-uart.0", "uart", &s3c24xx_clk_uart0), + CLKDEV_INIT("s3c2440-uart.1", "uart", &s3c24xx_clk_uart1), + CLKDEV_INIT("s3c2440-uart.2", "uart", &s3c24xx_clk_uart2), CLKDEV_INIT("s3c2440-camif", "camera", &s3c2440_clk_cam_upll), }; diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h index a62753dc15ba..df45d6edc98d 100644 --- a/arch/arm/plat-samsung/include/plat/clock.h +++ b/arch/arm/plat-samsung/include/plat/clock.h @@ -83,6 +83,11 @@ extern struct clk clk_ext; extern struct clksrc_clk clk_epllref; extern struct clksrc_clk clk_esysclk; +/* S3C24XX UART clocks */ +extern struct clk s3c24xx_clk_uart0; +extern struct clk s3c24xx_clk_uart1; +extern struct clk s3c24xx_clk_uart2; + /* S3C64XX specific clocks */ extern struct clk clk_h2; extern struct clk clk_27m; From ad92c615975a57c4b206c5c99f77a0bf22b373c4 Mon Sep 17 00:00:00 2001 From: Denis Kirjanov <kda@linux-powerpc.org> Date: Tue, 23 Jul 2013 15:28:03 +0400 Subject: [PATCH 418/913] powerpc/pseries: Fix a typo in pSeries_lpar_hpte_insert() Commit 801eb73f45371accc78ca9d6d22d647eeb722c11 introduced a bug while checking PTE flags. We have to drop the _PAGE_COHERENT flag when __PAGE_NO_CACHE is set and the cache update policy is not write-through (i.e. _PAGE_WRITETHRU is not set) Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> CC: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/platforms/pseries/lpar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 02d6e21619bb..8bad880bd177 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -146,7 +146,7 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group, flags = 0; /* Make pHyp happy */ - if ((rflags & _PAGE_NO_CACHE) & !(rflags & _PAGE_WRITETHRU)) + if ((rflags & _PAGE_NO_CACHE) && !(rflags & _PAGE_WRITETHRU)) hpte_r &= ~_PAGE_COHERENT; if (firmware_has_feature(FW_FEATURE_XCMO) && !(hpte_r & HPTE_R_N)) flags |= H_COALESCE_CAND; From 83383b73ad5fbf52ea4b77aed900a927875f2529 Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> Date: Wed, 3 Jul 2013 13:50:03 +0530 Subject: [PATCH 419/913] powerpc/mm: Fix fallthrough bug in hpte_decode We should not fallthrough different case statements in hpte_decode. Add break statement to break out of the switch. The regression is introduced by dcda287a9b26309ae43a091d0ecde16f8f61b4c0 "powerpc/mm: Simplify hpte_decode" Reported-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/mm/hash_native_64.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c index 3f0c30ae4791..0530ff78c023 100644 --- a/arch/powerpc/mm/hash_native_64.c +++ b/arch/powerpc/mm/hash_native_64.c @@ -554,6 +554,7 @@ static void hpte_decode(struct hash_pte *hpte, unsigned long slot, seg_off |= vpi << shift; } *vpn = vsid << (SID_SHIFT - VPN_SHIFT) | seg_off >> VPN_SHIFT; + break; case MMU_SEGSIZE_1T: /* We only have 40 - 23 bits of seg_off in avpn */ seg_off = (avpn & 0x1ffff) << 23; @@ -563,6 +564,7 @@ static void hpte_decode(struct hash_pte *hpte, unsigned long slot, seg_off |= vpi << shift; } *vpn = vsid << (SID_SHIFT_1T - VPN_SHIFT) | seg_off >> VPN_SHIFT; + break; default: *vpn = size = 0; } From de640959b63ad437c21f2a217f25332c4ea863cb Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> Date: Thu, 4 Jul 2013 10:34:45 +0530 Subject: [PATCH 420/913] powerpc/mm: Use the correct SLB(LLP) encoding in tlbie instruction The sllp value is stored in mmu_psize_defs in such a way that we can easily OR the value to get the operand for slbmte instruction. ie, the L and LP bits are not contiguous. Decode the bits and use them correctly in tlbie. regression is introduced by 1f6aaaccb1b3af8613fe45781c1aefee2ae8c6b3 "powerpc: Update tlbie/tlbiel as per ISA doc" Reported-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/mm/hash_native_64.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c index 0530ff78c023..c33d939120c9 100644 --- a/arch/powerpc/mm/hash_native_64.c +++ b/arch/powerpc/mm/hash_native_64.c @@ -43,6 +43,7 @@ static inline void __tlbie(unsigned long vpn, int psize, int apsize, int ssize) { unsigned long va; unsigned int penc; + unsigned long sllp; /* * We need 14 to 65 bits of va for a tlibe of 4K page @@ -64,7 +65,9 @@ static inline void __tlbie(unsigned long vpn, int psize, int apsize, int ssize) /* clear out bits after (52) [0....52.....63] */ va &= ~((1ul << (64 - 52)) - 1); va |= ssize << 8; - va |= mmu_psize_defs[apsize].sllp << 6; + sllp = ((mmu_psize_defs[apsize].sllp & SLB_VSID_L) >> 6) | + ((mmu_psize_defs[apsize].sllp & SLB_VSID_LP) >> 4); + va |= sllp << 5; asm volatile(ASM_FTR_IFCLR("tlbie %0,0", PPC_TLBIE(%1,%0), %2) : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) : "memory"); @@ -98,6 +101,7 @@ static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize) { unsigned long va; unsigned int penc; + unsigned long sllp; /* VPN_SHIFT can be atmost 12 */ va = vpn << VPN_SHIFT; @@ -113,7 +117,9 @@ static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize) /* clear out bits after(52) [0....52.....63] */ va &= ~((1ul << (64 - 52)) - 1); va |= ssize << 8; - va |= mmu_psize_defs[apsize].sllp << 6; + sllp = ((mmu_psize_defs[apsize].sllp & SLB_VSID_L) >> 6) | + ((mmu_psize_defs[apsize].sllp & SLB_VSID_LP) >> 4); + va |= sllp << 5; asm volatile(".long 0x7c000224 | (%0 << 11) | (0 << 21)" : : "r"(va) : "memory"); break; From 679750054ae8129a536734bccf526ff6da35376a Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas <bhelgaas@google.com> Date: Tue, 2 Jul 2013 12:20:03 -0600 Subject: [PATCH 421/913] powerpc/powernv: Mark pnv_pci_init_ioda2_phb() as __init Mark pnv_pci_init_ioda2_phb() as __init. It is called only from an init function (pnv_pci_init()), and it calls an init function (pnv_pci_init_ioda_phb()): pnv_pci_init # init pnv_pci_init_ioda2_phb # non-init pnv_pci_init_ioda_phb # init This should fix a section mismatch warning. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/platforms/powernv/pci-ioda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 49b57b9f835d..d8140b125e62 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -1266,7 +1266,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, opal_pci_set_pe(phb_id, 0, 0, 7, 1, 1 , OPAL_MAP_PE); } -void pnv_pci_init_ioda2_phb(struct device_node *np) +void __init pnv_pci_init_ioda2_phb(struct device_node *np) { pnv_pci_init_ioda_phb(np, 0, PNV_PHB_IODA2); } From 7689bdcab1dca061c4c91f0e1703cef1b7b67e71 Mon Sep 17 00:00:00 2001 From: Anshuman Khandual <khandual@linux.vnet.ibm.com> Date: Mon, 10 Jun 2013 11:23:28 +0530 Subject: [PATCH 422/913] powerpc/perf: Ignore separate BHRB privilege state filter request Completely ignore BHRB privilege state filter request as we are already configuring that with privilege state filtering attribute for the accompanying PMU event. This would help achieve cleaner user space interaction for BHRB. This patch fixes a situation like this Before patch:- ------------ ./perf record -j any -e branch-misses:k ls Error: The sys_perf_event_open() syscall returned with 95 (Operation not supported) for event (branch-misses:k). /bin/dmesg may provide additional information. No CONFIG_PERF_EVENTS=y kernel support configured? Here 'perf record' actually copies over ':k' filter request into BHRB privilege state filter config and our previous check in kernel would fail that. After patch:- ------------- ./perf record -j any -e branch-misses:k ls perf perf.data perf.data.old test-mmap-ring [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.002 MB perf.data (~102 samples)] Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Acked-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/perf/power8-pmu.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c index 09def196f5c4..7466374d2787 100644 --- a/arch/powerpc/perf/power8-pmu.c +++ b/arch/powerpc/perf/power8-pmu.c @@ -561,18 +561,13 @@ static int power8_generic_events[] = { static u64 power8_bhrb_filter_map(u64 branch_sample_type) { u64 pmu_bhrb_filter = 0; - u64 br_privilege = branch_sample_type & ONLY_PLM; - /* BHRB and regular PMU events share the same prvillege state + /* BHRB and regular PMU events share the same privilege state * filter configuration. BHRB is always recorded along with a - * regular PMU event. So privilege state filter criteria for BHRB - * and the companion PMU events has to be the same. As a default - * "perf record" tool sets all privillege bits ON when no filter - * criteria is provided in the command line. So as along as all - * privillege bits are ON or they are OFF, we are good to go. + * regular PMU event. As the privilege state filter is handled + * in the basic PMC configuration of the accompanying regular + * PMU event, we ignore any separate BHRB specific request. */ - if ((br_privilege != 7) && (br_privilege != 0)) - return -1; /* No branch filter requested */ if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY) From ff3d79dc12c2ed38483f6c1e0f26fde430f27c9d Mon Sep 17 00:00:00 2001 From: Anshuman Khandual <khandual@linux.vnet.ibm.com> Date: Mon, 10 Jun 2013 11:23:29 +0530 Subject: [PATCH 423/913] powerpc/perf: BHRB filter configuration should follow the task When the task moves around the system, the corresponding cpuhw per cpu strcuture should be popullated with the BHRB filter request value so that PMU could be configured appropriately with that during the next call into power_pmu_enable(). Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Acked-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/perf/core-book3s.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index a3985aee77fe..24a45f91c65f 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -1252,8 +1252,11 @@ nocheck: ret = 0; out: - if (has_branch_stack(event)) + if (has_branch_stack(event)) { power_pmu_bhrb_enable(event); + cpuhw->bhrb_filter = ppmu->bhrb_filter_map( + event->attr.branch_sample_type); + } perf_pmu_enable(event->pmu); local_irq_restore(flags); From 89693016e372983d720c186c0d00b29414b58804 Mon Sep 17 00:00:00 2001 From: Amit Daniel Kachhap <amit.daniel@samsung.com> Date: Wed, 24 Jul 2013 14:06:13 +0900 Subject: [PATCH 424/913] ARM: SAMSUNG: Add SAMSUNG_PM config option to select pm This patch enables the selection of samsung pm related stuffs when SAMSUNG_PM config is enabled and not just when generic PM config is enabled. Power management for s3c64XX and s3c24XX is enabled by default and for other platform depends on S5P_PM. This patch also fixes the following compilation error's when compiling a platform like exynos5440 which does not select pm stuffs. arch/arm/mach-exynos/built-in.o: In function '__virt_to_phys': linux/arch/arm/include/asm/memory.h:175: undefined reference to 's3c_cpu_resume' linux/arch/arm/include/asm/memory.h:175: undefined reference to 's3c_cpu_resume' linux/arch/arm/include/asm/memory.h:175: undefined reference to 's3c_cpu_resume' linux/arch/arm/include/asm/memory.h:175: undefined reference to 's3c_cpu_resume' arch/arm/mach-exynos/built-in.o: In function 'exynos5_init_irq': linux/arch/arm/mach-exynos/common.c:492: undefined reference to 's3c_irq_wake' linux/arch/arm/mach-exynos/common.c:492: undefined reference to 's3c_irq_wake' arch/arm/mach-exynos/built-in.o: In function 'exynos4_init_irq': linux/arch/arm/mach-exynos/common.c:476: undefined reference to 's3c_irq_wake' linux/arch/arm/mach-exynos/common.c:476: undefined reference to 's3c_irq_wake' arch/arm/plat-samsung/built-in.o: In function 's3c_irqext_wake': linux/arch/arm/plat-samsung/pm.c:144: undefined reference to 's3c_irqwake_eintallow' linux/arch/arm/plat-samsung/pm.c:144: undefined reference to 's3c_irqwake_eintallow' arch/arm/plat-samsung/built-in.o: In function 's3c_pm_enter': linux/arch/arm/plat-samsung/pm.c:263: undefined reference to 's3c_irqwake_intallow' linux/arch/arm/plat-samsung/pm.c:263: undefined reference to 's3c_irqwake_intallow' linux/arch/arm/plat-samsung/pm.c:264: undefined reference to 's3c_irqwake_eintallow' linux/arch/arm/plat-samsung/pm.c:264: undefined reference to 's3c_irqwake_eintallow' linux/arch/arm/plat-samsung/pm.c:275: undefined reference to 's3c_pm_save_core' linux/arch/arm/plat-samsung/pm.c:279: undefined reference to 's3c_pm_configure_extint' linux/arch/arm/plat-samsung/pm.c:310: undefined reference to 's3c_pm_restore_core' make: *** [vmlinux] Error 1 Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> --- arch/arm/mach-exynos/Makefile | 2 +- arch/arm/mach-exynos/common.h | 1 - arch/arm/mach-exynos/cpuidle.c | 1 + arch/arm/plat-samsung/Kconfig | 7 +++++++ arch/arm/plat-samsung/Makefile | 2 +- arch/arm/plat-samsung/include/plat/pm.h | 8 ++++---- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile index e970a7a4e278..53696154aead 100644 --- a/arch/arm/mach-exynos/Makefile +++ b/arch/arm/mach-exynos/Makefile @@ -14,7 +14,7 @@ obj- := obj-$(CONFIG_ARCH_EXYNOS) += common.o -obj-$(CONFIG_PM) += pm.o +obj-$(CONFIG_S5P_PM) += pm.o obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 3e156bcddcb4..972490fc09d6 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -97,6 +97,5 @@ struct exynos_pmu_conf { }; extern void exynos_sys_powerdown_conf(enum sys_powerdown mode); -extern void s3c_cpu_resume(void); #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */ diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index 17a18ff3d71e..225ee8431c72 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c @@ -25,6 +25,7 @@ #include <mach/regs-pmu.h> #include <plat/cpu.h> +#include <plat/pm.h> #include "common.h" diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 3dc5cbea86cc..a5b5ff6e68d2 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig @@ -29,6 +29,13 @@ config PLAT_S5P help Base platform code for Samsung's S5P series SoC. +config SAMSUNG_PM + bool + depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5P64X0 || S5P_PM) + default y + help + Base platform power management code for samsung code + if PLAT_SAMSUNG # boot configurations diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile index 98d07d8fc7a7..199bbe304d02 100644 --- a/arch/arm/plat-samsung/Makefile +++ b/arch/arm/plat-samsung/Makefile @@ -51,7 +51,7 @@ obj-$(CONFIG_SAMSUNG_DMADEV) += dma-ops.o # PM support -obj-$(CONFIG_PM) += pm.o +obj-$(CONFIG_SAMSUNG_PM) += pm.o obj-$(CONFIG_SAMSUNG_PM_GPIO) += pm-gpio.o obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h index 5d47ca35cabd..6bc1a8f471e3 100644 --- a/arch/arm/plat-samsung/include/plat/pm.h +++ b/arch/arm/plat-samsung/include/plat/pm.h @@ -19,7 +19,7 @@ struct device; -#ifdef CONFIG_PM +#ifdef CONFIG_SAMSUNG_PM extern __init int s3c_pm_init(void); extern __init int s3c64xx_pm_init(void); @@ -58,8 +58,6 @@ extern unsigned char pm_uart_udivslot; /* true to save UART UDIVSLOT */ /* from sleep.S */ -extern void s3c_cpu_resume(void); - extern int s3c2410_cpu_suspend(unsigned long); /* sleep save info */ @@ -106,12 +104,14 @@ extern void s3c_pm_do_save(struct sleep_save *ptr, int count); extern void s3c_pm_do_restore(struct sleep_save *ptr, int count); extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count); -#ifdef CONFIG_PM +#ifdef CONFIG_SAMSUNG_PM extern int s3c_irq_wake(struct irq_data *data, unsigned int state); extern int s3c_irqext_wake(struct irq_data *data, unsigned int state); +extern void s3c_cpu_resume(void); #else #define s3c_irq_wake NULL #define s3c_irqext_wake NULL +#define s3c_cpu_resume NULL #endif /* PM debug functions */ From e70308ec0e4bff344fcfdf160de40e1150552c5f Mon Sep 17 00:00:00 2001 From: Herbert Xu <herbert@gondor.apana.org.au> Date: Wed, 24 Jul 2013 17:04:16 +1000 Subject: [PATCH 425/913] Revert "crypto: crct10dif - Wrap crc_t10dif function all to use crypto transform framework" This reverts commits 67822649d7305caf3dd50ed46c27b99c94eff996 39761214eefc6b070f29402aa1165f24d789b3f7 0b95a7f85718adcbba36407ef88bba0a7379ed03 31d939625a9a20b1badd2d4e6bf6fd39fa523405 2d31e518a42828df7877bca23a958627d60408bc Unfortunately this change broke boot on some systems that used an initrd which does not include the newly created crct10dif modules. As these modules are required by sd_mod under certain configurations this is a serious problem. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> --- arch/x86/crypto/Makefile | 2 - arch/x86/crypto/crct10dif-pcl-asm_64.S | 643 ------------------------ arch/x86/crypto/crct10dif-pclmul_glue.c | 151 ------ crypto/Kconfig | 19 - crypto/Makefile | 1 - crypto/crct10dif.c | 178 ------- crypto/tcrypt.c | 8 - crypto/testmgr.c | 10 - crypto/testmgr.h | 33 -- include/linux/crc-t10dif.h | 4 - lib/Kconfig | 2 - lib/crc-t10dif.c | 73 +-- 12 files changed, 43 insertions(+), 1081 deletions(-) delete mode 100644 arch/x86/crypto/crct10dif-pcl-asm_64.S delete mode 100644 arch/x86/crypto/crct10dif-pclmul_glue.c delete mode 100644 crypto/crct10dif.c diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile index 7d6ba9db1be9..6c63c358a7e6 100644 --- a/arch/x86/crypto/Makefile +++ b/arch/x86/crypto/Makefile @@ -27,7 +27,6 @@ obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o -obj-$(CONFIG_CRYPTO_CRCT10DIF_PCLMUL) += crct10dif-pclmul.o # These modules require assembler to support AVX. ifeq ($(avx_supported),yes) @@ -82,4 +81,3 @@ crc32c-intel-$(CONFIG_64BIT) += crc32c-pcl-intel-asm_64.o crc32-pclmul-y := crc32-pclmul_asm.o crc32-pclmul_glue.o sha256-ssse3-y := sha256-ssse3-asm.o sha256-avx-asm.o sha256-avx2-asm.o sha256_ssse3_glue.o sha512-ssse3-y := sha512-ssse3-asm.o sha512-avx-asm.o sha512-avx2-asm.o sha512_ssse3_glue.o -crct10dif-pclmul-y := crct10dif-pcl-asm_64.o crct10dif-pclmul_glue.o diff --git a/arch/x86/crypto/crct10dif-pcl-asm_64.S b/arch/x86/crypto/crct10dif-pcl-asm_64.S deleted file mode 100644 index 35e97569d05f..000000000000 --- a/arch/x86/crypto/crct10dif-pcl-asm_64.S +++ /dev/null @@ -1,643 +0,0 @@ -######################################################################## -# Implement fast CRC-T10DIF computation with SSE and PCLMULQDQ instructions -# -# Copyright (c) 2013, Intel Corporation -# -# Authors: -# Erdinc Ozturk <erdinc.ozturk@intel.com> -# Vinodh Gopal <vinodh.gopal@intel.com> -# James Guilford <james.guilford@intel.com> -# Tim Chen <tim.c.chen@linux.intel.com> -# -# This software is available to you under a choice of one of two -# licenses. You may choose to be licensed under the terms of the GNU -# General Public License (GPL) Version 2, available from the file -# COPYING in the main directory of this source tree, or the -# OpenIB.org BSD license below: -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the -# distribution. -# -# * Neither the name of the Intel Corporation nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# -# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""AS IS"" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -######################################################################## -# Function API: -# UINT16 crc_t10dif_pcl( -# UINT16 init_crc, //initial CRC value, 16 bits -# const unsigned char *buf, //buffer pointer to calculate CRC on -# UINT64 len //buffer length in bytes (64-bit data) -# ); -# -# Reference paper titled "Fast CRC Computation for Generic -# Polynomials Using PCLMULQDQ Instruction" -# URL: http://www.intel.com/content/dam/www/public/us/en/documents -# /white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf -# -# - -#include <linux/linkage.h> - -.text - -#define arg1 %rdi -#define arg2 %rsi -#define arg3 %rdx - -#define arg1_low32 %edi - -ENTRY(crc_t10dif_pcl) -.align 16 - - # adjust the 16-bit initial_crc value, scale it to 32 bits - shl $16, arg1_low32 - - # Allocate Stack Space - mov %rsp, %rcx - sub $16*2, %rsp - # align stack to 16 byte boundary - and $~(0x10 - 1), %rsp - - # check if smaller than 256 - cmp $256, arg3 - - # for sizes less than 128, we can't fold 64B at a time... - jl _less_than_128 - - - # load the initial crc value - movd arg1_low32, %xmm10 # initial crc - - # crc value does not need to be byte-reflected, but it needs - # to be moved to the high part of the register. - # because data will be byte-reflected and will align with - # initial crc at correct place. - pslldq $12, %xmm10 - - movdqa SHUF_MASK(%rip), %xmm11 - # receive the initial 64B data, xor the initial crc value - movdqu 16*0(arg2), %xmm0 - movdqu 16*1(arg2), %xmm1 - movdqu 16*2(arg2), %xmm2 - movdqu 16*3(arg2), %xmm3 - movdqu 16*4(arg2), %xmm4 - movdqu 16*5(arg2), %xmm5 - movdqu 16*6(arg2), %xmm6 - movdqu 16*7(arg2), %xmm7 - - pshufb %xmm11, %xmm0 - # XOR the initial_crc value - pxor %xmm10, %xmm0 - pshufb %xmm11, %xmm1 - pshufb %xmm11, %xmm2 - pshufb %xmm11, %xmm3 - pshufb %xmm11, %xmm4 - pshufb %xmm11, %xmm5 - pshufb %xmm11, %xmm6 - pshufb %xmm11, %xmm7 - - movdqa rk3(%rip), %xmm10 #xmm10 has rk3 and rk4 - #imm value of pclmulqdq instruction - #will determine which constant to use - - ################################################################# - # we subtract 256 instead of 128 to save one instruction from the loop - sub $256, arg3 - - # at this section of the code, there is 64*x+y (0<=y<64) bytes of - # buffer. The _fold_64_B_loop will fold 64B at a time - # until we have 64+y Bytes of buffer - - - # fold 64B at a time. This section of the code folds 4 xmm - # registers in parallel -_fold_64_B_loop: - - # update the buffer pointer - add $128, arg2 # buf += 64# - - movdqu 16*0(arg2), %xmm9 - movdqu 16*1(arg2), %xmm12 - pshufb %xmm11, %xmm9 - pshufb %xmm11, %xmm12 - movdqa %xmm0, %xmm8 - movdqa %xmm1, %xmm13 - pclmulqdq $0x0 , %xmm10, %xmm0 - pclmulqdq $0x11, %xmm10, %xmm8 - pclmulqdq $0x0 , %xmm10, %xmm1 - pclmulqdq $0x11, %xmm10, %xmm13 - pxor %xmm9 , %xmm0 - xorps %xmm8 , %xmm0 - pxor %xmm12, %xmm1 - xorps %xmm13, %xmm1 - - movdqu 16*2(arg2), %xmm9 - movdqu 16*3(arg2), %xmm12 - pshufb %xmm11, %xmm9 - pshufb %xmm11, %xmm12 - movdqa %xmm2, %xmm8 - movdqa %xmm3, %xmm13 - pclmulqdq $0x0, %xmm10, %xmm2 - pclmulqdq $0x11, %xmm10, %xmm8 - pclmulqdq $0x0, %xmm10, %xmm3 - pclmulqdq $0x11, %xmm10, %xmm13 - pxor %xmm9 , %xmm2 - xorps %xmm8 , %xmm2 - pxor %xmm12, %xmm3 - xorps %xmm13, %xmm3 - - movdqu 16*4(arg2), %xmm9 - movdqu 16*5(arg2), %xmm12 - pshufb %xmm11, %xmm9 - pshufb %xmm11, %xmm12 - movdqa %xmm4, %xmm8 - movdqa %xmm5, %xmm13 - pclmulqdq $0x0, %xmm10, %xmm4 - pclmulqdq $0x11, %xmm10, %xmm8 - pclmulqdq $0x0, %xmm10, %xmm5 - pclmulqdq $0x11, %xmm10, %xmm13 - pxor %xmm9 , %xmm4 - xorps %xmm8 , %xmm4 - pxor %xmm12, %xmm5 - xorps %xmm13, %xmm5 - - movdqu 16*6(arg2), %xmm9 - movdqu 16*7(arg2), %xmm12 - pshufb %xmm11, %xmm9 - pshufb %xmm11, %xmm12 - movdqa %xmm6 , %xmm8 - movdqa %xmm7 , %xmm13 - pclmulqdq $0x0 , %xmm10, %xmm6 - pclmulqdq $0x11, %xmm10, %xmm8 - pclmulqdq $0x0 , %xmm10, %xmm7 - pclmulqdq $0x11, %xmm10, %xmm13 - pxor %xmm9 , %xmm6 - xorps %xmm8 , %xmm6 - pxor %xmm12, %xmm7 - xorps %xmm13, %xmm7 - - sub $128, arg3 - - # check if there is another 64B in the buffer to be able to fold - jge _fold_64_B_loop - ################################################################## - - - add $128, arg2 - # at this point, the buffer pointer is pointing at the last y Bytes - # of the buffer the 64B of folded data is in 4 of the xmm - # registers: xmm0, xmm1, xmm2, xmm3 - - - # fold the 8 xmm registers to 1 xmm register with different constants - - movdqa rk9(%rip), %xmm10 - movdqa %xmm0, %xmm8 - pclmulqdq $0x11, %xmm10, %xmm0 - pclmulqdq $0x0 , %xmm10, %xmm8 - pxor %xmm8, %xmm7 - xorps %xmm0, %xmm7 - - movdqa rk11(%rip), %xmm10 - movdqa %xmm1, %xmm8 - pclmulqdq $0x11, %xmm10, %xmm1 - pclmulqdq $0x0 , %xmm10, %xmm8 - pxor %xmm8, %xmm7 - xorps %xmm1, %xmm7 - - movdqa rk13(%rip), %xmm10 - movdqa %xmm2, %xmm8 - pclmulqdq $0x11, %xmm10, %xmm2 - pclmulqdq $0x0 , %xmm10, %xmm8 - pxor %xmm8, %xmm7 - pxor %xmm2, %xmm7 - - movdqa rk15(%rip), %xmm10 - movdqa %xmm3, %xmm8 - pclmulqdq $0x11, %xmm10, %xmm3 - pclmulqdq $0x0 , %xmm10, %xmm8 - pxor %xmm8, %xmm7 - xorps %xmm3, %xmm7 - - movdqa rk17(%rip), %xmm10 - movdqa %xmm4, %xmm8 - pclmulqdq $0x11, %xmm10, %xmm4 - pclmulqdq $0x0 , %xmm10, %xmm8 - pxor %xmm8, %xmm7 - pxor %xmm4, %xmm7 - - movdqa rk19(%rip), %xmm10 - movdqa %xmm5, %xmm8 - pclmulqdq $0x11, %xmm10, %xmm5 - pclmulqdq $0x0 , %xmm10, %xmm8 - pxor %xmm8, %xmm7 - xorps %xmm5, %xmm7 - - movdqa rk1(%rip), %xmm10 #xmm10 has rk1 and rk2 - #imm value of pclmulqdq instruction - #will determine which constant to use - movdqa %xmm6, %xmm8 - pclmulqdq $0x11, %xmm10, %xmm6 - pclmulqdq $0x0 , %xmm10, %xmm8 - pxor %xmm8, %xmm7 - pxor %xmm6, %xmm7 - - - # instead of 64, we add 48 to the loop counter to save 1 instruction - # from the loop instead of a cmp instruction, we use the negative - # flag with the jl instruction - add $128-16, arg3 - jl _final_reduction_for_128 - - # now we have 16+y bytes left to reduce. 16 Bytes is in register xmm7 - # and the rest is in memory. We can fold 16 bytes at a time if y>=16 - # continue folding 16B at a time - -_16B_reduction_loop: - movdqa %xmm7, %xmm8 - pclmulqdq $0x11, %xmm10, %xmm7 - pclmulqdq $0x0 , %xmm10, %xmm8 - pxor %xmm8, %xmm7 - movdqu (arg2), %xmm0 - pshufb %xmm11, %xmm0 - pxor %xmm0 , %xmm7 - add $16, arg2 - sub $16, arg3 - # instead of a cmp instruction, we utilize the flags with the - # jge instruction equivalent of: cmp arg3, 16-16 - # check if there is any more 16B in the buffer to be able to fold - jge _16B_reduction_loop - - #now we have 16+z bytes left to reduce, where 0<= z < 16. - #first, we reduce the data in the xmm7 register - - -_final_reduction_for_128: - # check if any more data to fold. If not, compute the CRC of - # the final 128 bits - add $16, arg3 - je _128_done - - # here we are getting data that is less than 16 bytes. - # since we know that there was data before the pointer, we can - # offset the input pointer before the actual point, to receive - # exactly 16 bytes. after that the registers need to be adjusted. -_get_last_two_xmms: - movdqa %xmm7, %xmm2 - - movdqu -16(arg2, arg3), %xmm1 - pshufb %xmm11, %xmm1 - - # get rid of the extra data that was loaded before - # load the shift constant - lea pshufb_shf_table+16(%rip), %rax - sub arg3, %rax - movdqu (%rax), %xmm0 - - # shift xmm2 to the left by arg3 bytes - pshufb %xmm0, %xmm2 - - # shift xmm7 to the right by 16-arg3 bytes - pxor mask1(%rip), %xmm0 - pshufb %xmm0, %xmm7 - pblendvb %xmm2, %xmm1 #xmm0 is implicit - - # fold 16 Bytes - movdqa %xmm1, %xmm2 - movdqa %xmm7, %xmm8 - pclmulqdq $0x11, %xmm10, %xmm7 - pclmulqdq $0x0 , %xmm10, %xmm8 - pxor %xmm8, %xmm7 - pxor %xmm2, %xmm7 - -_128_done: - # compute crc of a 128-bit value - movdqa rk5(%rip), %xmm10 # rk5 and rk6 in xmm10 - movdqa %xmm7, %xmm0 - - #64b fold - pclmulqdq $0x1, %xmm10, %xmm7 - pslldq $8 , %xmm0 - pxor %xmm0, %xmm7 - - #32b fold - movdqa %xmm7, %xmm0 - - pand mask2(%rip), %xmm0 - - psrldq $12, %xmm7 - pclmulqdq $0x10, %xmm10, %xmm7 - pxor %xmm0, %xmm7 - - #barrett reduction -_barrett: - movdqa rk7(%rip), %xmm10 # rk7 and rk8 in xmm10 - movdqa %xmm7, %xmm0 - pclmulqdq $0x01, %xmm10, %xmm7 - pslldq $4, %xmm7 - pclmulqdq $0x11, %xmm10, %xmm7 - - pslldq $4, %xmm7 - pxor %xmm0, %xmm7 - pextrd $1, %xmm7, %eax - -_cleanup: - # scale the result back to 16 bits - shr $16, %eax - mov %rcx, %rsp - ret - -######################################################################## - -.align 16 -_less_than_128: - - # check if there is enough buffer to be able to fold 16B at a time - cmp $32, arg3 - jl _less_than_32 - movdqa SHUF_MASK(%rip), %xmm11 - - # now if there is, load the constants - movdqa rk1(%rip), %xmm10 # rk1 and rk2 in xmm10 - - movd arg1_low32, %xmm0 # get the initial crc value - pslldq $12, %xmm0 # align it to its correct place - movdqu (arg2), %xmm7 # load the plaintext - pshufb %xmm11, %xmm7 # byte-reflect the plaintext - pxor %xmm0, %xmm7 - - - # update the buffer pointer - add $16, arg2 - - # update the counter. subtract 32 instead of 16 to save one - # instruction from the loop - sub $32, arg3 - - jmp _16B_reduction_loop - - -.align 16 -_less_than_32: - # mov initial crc to the return value. this is necessary for - # zero-length buffers. - mov arg1_low32, %eax - test arg3, arg3 - je _cleanup - - movdqa SHUF_MASK(%rip), %xmm11 - - movd arg1_low32, %xmm0 # get the initial crc value - pslldq $12, %xmm0 # align it to its correct place - - cmp $16, arg3 - je _exact_16_left - jl _less_than_16_left - - movdqu (arg2), %xmm7 # load the plaintext - pshufb %xmm11, %xmm7 # byte-reflect the plaintext - pxor %xmm0 , %xmm7 # xor the initial crc value - add $16, arg2 - sub $16, arg3 - movdqa rk1(%rip), %xmm10 # rk1 and rk2 in xmm10 - jmp _get_last_two_xmms - - -.align 16 -_less_than_16_left: - # use stack space to load data less than 16 bytes, zero-out - # the 16B in memory first. - - pxor %xmm1, %xmm1 - mov %rsp, %r11 - movdqa %xmm1, (%r11) - - cmp $4, arg3 - jl _only_less_than_4 - - # backup the counter value - mov arg3, %r9 - cmp $8, arg3 - jl _less_than_8_left - - # load 8 Bytes - mov (arg2), %rax - mov %rax, (%r11) - add $8, %r11 - sub $8, arg3 - add $8, arg2 -_less_than_8_left: - - cmp $4, arg3 - jl _less_than_4_left - - # load 4 Bytes - mov (arg2), %eax - mov %eax, (%r11) - add $4, %r11 - sub $4, arg3 - add $4, arg2 -_less_than_4_left: - - cmp $2, arg3 - jl _less_than_2_left - - # load 2 Bytes - mov (arg2), %ax - mov %ax, (%r11) - add $2, %r11 - sub $2, arg3 - add $2, arg2 -_less_than_2_left: - cmp $1, arg3 - jl _zero_left - - # load 1 Byte - mov (arg2), %al - mov %al, (%r11) -_zero_left: - movdqa (%rsp), %xmm7 - pshufb %xmm11, %xmm7 - pxor %xmm0 , %xmm7 # xor the initial crc value - - # shl r9, 4 - lea pshufb_shf_table+16(%rip), %rax - sub %r9, %rax - movdqu (%rax), %xmm0 - pxor mask1(%rip), %xmm0 - - pshufb %xmm0, %xmm7 - jmp _128_done - -.align 16 -_exact_16_left: - movdqu (arg2), %xmm7 - pshufb %xmm11, %xmm7 - pxor %xmm0 , %xmm7 # xor the initial crc value - - jmp _128_done - -_only_less_than_4: - cmp $3, arg3 - jl _only_less_than_3 - - # load 3 Bytes - mov (arg2), %al - mov %al, (%r11) - - mov 1(arg2), %al - mov %al, 1(%r11) - - mov 2(arg2), %al - mov %al, 2(%r11) - - movdqa (%rsp), %xmm7 - pshufb %xmm11, %xmm7 - pxor %xmm0 , %xmm7 # xor the initial crc value - - psrldq $5, %xmm7 - - jmp _barrett -_only_less_than_3: - cmp $2, arg3 - jl _only_less_than_2 - - # load 2 Bytes - mov (arg2), %al - mov %al, (%r11) - - mov 1(arg2), %al - mov %al, 1(%r11) - - movdqa (%rsp), %xmm7 - pshufb %xmm11, %xmm7 - pxor %xmm0 , %xmm7 # xor the initial crc value - - psrldq $6, %xmm7 - - jmp _barrett -_only_less_than_2: - - # load 1 Byte - mov (arg2), %al - mov %al, (%r11) - - movdqa (%rsp), %xmm7 - pshufb %xmm11, %xmm7 - pxor %xmm0 , %xmm7 # xor the initial crc value - - psrldq $7, %xmm7 - - jmp _barrett - -ENDPROC(crc_t10dif_pcl) - -.data - -# precomputed constants -# these constants are precomputed from the poly: -# 0x8bb70000 (0x8bb7 scaled to 32 bits) -.align 16 -# Q = 0x18BB70000 -# rk1 = 2^(32*3) mod Q << 32 -# rk2 = 2^(32*5) mod Q << 32 -# rk3 = 2^(32*15) mod Q << 32 -# rk4 = 2^(32*17) mod Q << 32 -# rk5 = 2^(32*3) mod Q << 32 -# rk6 = 2^(32*2) mod Q << 32 -# rk7 = floor(2^64/Q) -# rk8 = Q -rk1: -.quad 0x2d56000000000000 -rk2: -.quad 0x06df000000000000 -rk3: -.quad 0x9d9d000000000000 -rk4: -.quad 0x7cf5000000000000 -rk5: -.quad 0x2d56000000000000 -rk6: -.quad 0x1368000000000000 -rk7: -.quad 0x00000001f65a57f8 -rk8: -.quad 0x000000018bb70000 - -rk9: -.quad 0xceae000000000000 -rk10: -.quad 0xbfd6000000000000 -rk11: -.quad 0x1e16000000000000 -rk12: -.quad 0x713c000000000000 -rk13: -.quad 0xf7f9000000000000 -rk14: -.quad 0x80a6000000000000 -rk15: -.quad 0x044c000000000000 -rk16: -.quad 0xe658000000000000 -rk17: -.quad 0xad18000000000000 -rk18: -.quad 0xa497000000000000 -rk19: -.quad 0x6ee3000000000000 -rk20: -.quad 0xe7b5000000000000 - - - -mask1: -.octa 0x80808080808080808080808080808080 -mask2: -.octa 0x00000000FFFFFFFFFFFFFFFFFFFFFFFF - -SHUF_MASK: -.octa 0x000102030405060708090A0B0C0D0E0F - -pshufb_shf_table: -# use these values for shift constants for the pshufb instruction -# different alignments result in values as shown: -# DDQ 0x008f8e8d8c8b8a898887868584838281 # shl 15 (16-1) / shr1 -# DDQ 0x01008f8e8d8c8b8a8988878685848382 # shl 14 (16-3) / shr2 -# DDQ 0x0201008f8e8d8c8b8a89888786858483 # shl 13 (16-4) / shr3 -# DDQ 0x030201008f8e8d8c8b8a898887868584 # shl 12 (16-4) / shr4 -# DDQ 0x04030201008f8e8d8c8b8a8988878685 # shl 11 (16-5) / shr5 -# DDQ 0x0504030201008f8e8d8c8b8a89888786 # shl 10 (16-6) / shr6 -# DDQ 0x060504030201008f8e8d8c8b8a898887 # shl 9 (16-7) / shr7 -# DDQ 0x07060504030201008f8e8d8c8b8a8988 # shl 8 (16-8) / shr8 -# DDQ 0x0807060504030201008f8e8d8c8b8a89 # shl 7 (16-9) / shr9 -# DDQ 0x090807060504030201008f8e8d8c8b8a # shl 6 (16-10) / shr10 -# DDQ 0x0a090807060504030201008f8e8d8c8b # shl 5 (16-11) / shr11 -# DDQ 0x0b0a090807060504030201008f8e8d8c # shl 4 (16-12) / shr12 -# DDQ 0x0c0b0a090807060504030201008f8e8d # shl 3 (16-13) / shr13 -# DDQ 0x0d0c0b0a090807060504030201008f8e # shl 2 (16-14) / shr14 -# DDQ 0x0e0d0c0b0a090807060504030201008f # shl 1 (16-15) / shr15 -.octa 0x8f8e8d8c8b8a89888786858483828100 -.octa 0x000e0d0c0b0a09080706050403020100 diff --git a/arch/x86/crypto/crct10dif-pclmul_glue.c b/arch/x86/crypto/crct10dif-pclmul_glue.c deleted file mode 100644 index 7845d7fd54c0..000000000000 --- a/arch/x86/crypto/crct10dif-pclmul_glue.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Cryptographic API. - * - * T10 Data Integrity Field CRC16 Crypto Transform using PCLMULQDQ Instructions - * - * Copyright (C) 2013 Intel Corporation - * Author: Tim Chen <tim.c.chen@linux.intel.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -#include <linux/types.h> -#include <linux/module.h> -#include <linux/crc-t10dif.h> -#include <crypto/internal/hash.h> -#include <linux/init.h> -#include <linux/string.h> -#include <linux/kernel.h> -#include <asm/i387.h> -#include <asm/cpufeature.h> -#include <asm/cpu_device_id.h> - -asmlinkage __u16 crc_t10dif_pcl(__u16 crc, const unsigned char *buf, - size_t len); - -struct chksum_desc_ctx { - __u16 crc; -}; - -/* - * Steps through buffer one byte at at time, calculates reflected - * crc using table. - */ - -static int chksum_init(struct shash_desc *desc) -{ - struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); - - ctx->crc = 0; - - return 0; -} - -static int chksum_update(struct shash_desc *desc, const u8 *data, - unsigned int length) -{ - struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); - - if (irq_fpu_usable()) { - kernel_fpu_begin(); - ctx->crc = crc_t10dif_pcl(ctx->crc, data, length); - kernel_fpu_end(); - } else - ctx->crc = crc_t10dif_generic(ctx->crc, data, length); - return 0; -} - -static int chksum_final(struct shash_desc *desc, u8 *out) -{ - struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); - - *(__u16 *)out = ctx->crc; - return 0; -} - -static int __chksum_finup(__u16 *crcp, const u8 *data, unsigned int len, - u8 *out) -{ - if (irq_fpu_usable()) { - kernel_fpu_begin(); - *(__u16 *)out = crc_t10dif_pcl(*crcp, data, len); - kernel_fpu_end(); - } else - *(__u16 *)out = crc_t10dif_generic(*crcp, data, len); - return 0; -} - -static int chksum_finup(struct shash_desc *desc, const u8 *data, - unsigned int len, u8 *out) -{ - struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); - - return __chksum_finup(&ctx->crc, data, len, out); -} - -static int chksum_digest(struct shash_desc *desc, const u8 *data, - unsigned int length, u8 *out) -{ - struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); - - return __chksum_finup(&ctx->crc, data, length, out); -} - -static struct shash_alg alg = { - .digestsize = CRC_T10DIF_DIGEST_SIZE, - .init = chksum_init, - .update = chksum_update, - .final = chksum_final, - .finup = chksum_finup, - .digest = chksum_digest, - .descsize = sizeof(struct chksum_desc_ctx), - .base = { - .cra_name = "crct10dif", - .cra_driver_name = "crct10dif-pclmul", - .cra_priority = 200, - .cra_blocksize = CRC_T10DIF_BLOCK_SIZE, - .cra_module = THIS_MODULE, - } -}; - -static const struct x86_cpu_id crct10dif_cpu_id[] = { - X86_FEATURE_MATCH(X86_FEATURE_PCLMULQDQ), - {} -}; -MODULE_DEVICE_TABLE(x86cpu, crct10dif_cpu_id); - -static int __init crct10dif_intel_mod_init(void) -{ - if (!x86_match_cpu(crct10dif_cpu_id)) - return -ENODEV; - - return crypto_register_shash(&alg); -} - -static void __exit crct10dif_intel_mod_fini(void) -{ - crypto_unregister_shash(&alg); -} - -module_init(crct10dif_intel_mod_init); -module_exit(crct10dif_intel_mod_fini); - -MODULE_AUTHOR("Tim Chen <tim.c.chen@linux.intel.com>"); -MODULE_DESCRIPTION("T10 DIF CRC calculation accelerated with PCLMULQDQ."); -MODULE_LICENSE("GPL"); - -MODULE_ALIAS("crct10dif"); -MODULE_ALIAS("crct10dif-pclmul"); diff --git a/crypto/Kconfig b/crypto/Kconfig index 904ffe838567..2754f2bf5d91 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -376,25 +376,6 @@ config CRYPTO_CRC32_PCLMUL which will enable any routine to use the CRC-32-IEEE 802.3 checksum and gain better performance as compared with the table implementation. -config CRYPTO_CRCT10DIF - tristate "CRCT10DIF algorithm" - select CRYPTO_HASH - help - CRC T10 Data Integrity Field computation is being cast as - a crypto transform. This allows for faster crc t10 diff - transforms to be used if they are available. - -config CRYPTO_CRCT10DIF_PCLMUL - tristate "CRCT10DIF PCLMULQDQ hardware acceleration" - depends on X86 && 64BIT && CRC_T10DIF - select CRYPTO_HASH - help - For x86_64 processors with SSE4.2 and PCLMULQDQ supported, - CRC T10 DIF PCLMULQDQ computation can be hardware - accelerated PCLMULQDQ instruction. This option will create - 'crct10dif-plcmul' module, which is faster when computing the - crct10dif checksum as compared with the generic table implementation. - config CRYPTO_GHASH tristate "GHASH digest algorithm" select CRYPTO_GF128MUL diff --git a/crypto/Makefile b/crypto/Makefile index 62af87df8729..a8e9b0fefbe9 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -83,7 +83,6 @@ obj-$(CONFIG_CRYPTO_ZLIB) += zlib.o obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o obj-$(CONFIG_CRYPTO_CRC32) += crc32.o -obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif.o obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o obj-$(CONFIG_CRYPTO_LZO) += lzo.o obj-$(CONFIG_CRYPTO_842) += 842.o diff --git a/crypto/crct10dif.c b/crypto/crct10dif.c deleted file mode 100644 index 92aca96d6b98..000000000000 --- a/crypto/crct10dif.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Cryptographic API. - * - * T10 Data Integrity Field CRC16 Crypto Transform - * - * Copyright (c) 2007 Oracle Corporation. All rights reserved. - * Written by Martin K. Petersen <martin.petersen@oracle.com> - * Copyright (C) 2013 Intel Corporation - * Author: Tim Chen <tim.c.chen@linux.intel.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -#include <linux/types.h> -#include <linux/module.h> -#include <linux/crc-t10dif.h> -#include <crypto/internal/hash.h> -#include <linux/init.h> -#include <linux/string.h> -#include <linux/kernel.h> - -struct chksum_desc_ctx { - __u16 crc; -}; - -/* Table generated using the following polynomium: - * x^16 + x^15 + x^11 + x^9 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 - * gt: 0x8bb7 - */ -static const __u16 t10_dif_crc_table[256] = { - 0x0000, 0x8BB7, 0x9CD9, 0x176E, 0xB205, 0x39B2, 0x2EDC, 0xA56B, - 0xEFBD, 0x640A, 0x7364, 0xF8D3, 0x5DB8, 0xD60F, 0xC161, 0x4AD6, - 0x54CD, 0xDF7A, 0xC814, 0x43A3, 0xE6C8, 0x6D7F, 0x7A11, 0xF1A6, - 0xBB70, 0x30C7, 0x27A9, 0xAC1E, 0x0975, 0x82C2, 0x95AC, 0x1E1B, - 0xA99A, 0x222D, 0x3543, 0xBEF4, 0x1B9F, 0x9028, 0x8746, 0x0CF1, - 0x4627, 0xCD90, 0xDAFE, 0x5149, 0xF422, 0x7F95, 0x68FB, 0xE34C, - 0xFD57, 0x76E0, 0x618E, 0xEA39, 0x4F52, 0xC4E5, 0xD38B, 0x583C, - 0x12EA, 0x995D, 0x8E33, 0x0584, 0xA0EF, 0x2B58, 0x3C36, 0xB781, - 0xD883, 0x5334, 0x445A, 0xCFED, 0x6A86, 0xE131, 0xF65F, 0x7DE8, - 0x373E, 0xBC89, 0xABE7, 0x2050, 0x853B, 0x0E8C, 0x19E2, 0x9255, - 0x8C4E, 0x07F9, 0x1097, 0x9B20, 0x3E4B, 0xB5FC, 0xA292, 0x2925, - 0x63F3, 0xE844, 0xFF2A, 0x749D, 0xD1F6, 0x5A41, 0x4D2F, 0xC698, - 0x7119, 0xFAAE, 0xEDC0, 0x6677, 0xC31C, 0x48AB, 0x5FC5, 0xD472, - 0x9EA4, 0x1513, 0x027D, 0x89CA, 0x2CA1, 0xA716, 0xB078, 0x3BCF, - 0x25D4, 0xAE63, 0xB90D, 0x32BA, 0x97D1, 0x1C66, 0x0B08, 0x80BF, - 0xCA69, 0x41DE, 0x56B0, 0xDD07, 0x786C, 0xF3DB, 0xE4B5, 0x6F02, - 0x3AB1, 0xB106, 0xA668, 0x2DDF, 0x88B4, 0x0303, 0x146D, 0x9FDA, - 0xD50C, 0x5EBB, 0x49D5, 0xC262, 0x6709, 0xECBE, 0xFBD0, 0x7067, - 0x6E7C, 0xE5CB, 0xF2A5, 0x7912, 0xDC79, 0x57CE, 0x40A0, 0xCB17, - 0x81C1, 0x0A76, 0x1D18, 0x96AF, 0x33C4, 0xB873, 0xAF1D, 0x24AA, - 0x932B, 0x189C, 0x0FF2, 0x8445, 0x212E, 0xAA99, 0xBDF7, 0x3640, - 0x7C96, 0xF721, 0xE04F, 0x6BF8, 0xCE93, 0x4524, 0x524A, 0xD9FD, - 0xC7E6, 0x4C51, 0x5B3F, 0xD088, 0x75E3, 0xFE54, 0xE93A, 0x628D, - 0x285B, 0xA3EC, 0xB482, 0x3F35, 0x9A5E, 0x11E9, 0x0687, 0x8D30, - 0xE232, 0x6985, 0x7EEB, 0xF55C, 0x5037, 0xDB80, 0xCCEE, 0x4759, - 0x0D8F, 0x8638, 0x9156, 0x1AE1, 0xBF8A, 0x343D, 0x2353, 0xA8E4, - 0xB6FF, 0x3D48, 0x2A26, 0xA191, 0x04FA, 0x8F4D, 0x9823, 0x1394, - 0x5942, 0xD2F5, 0xC59B, 0x4E2C, 0xEB47, 0x60F0, 0x779E, 0xFC29, - 0x4BA8, 0xC01F, 0xD771, 0x5CC6, 0xF9AD, 0x721A, 0x6574, 0xEEC3, - 0xA415, 0x2FA2, 0x38CC, 0xB37B, 0x1610, 0x9DA7, 0x8AC9, 0x017E, - 0x1F65, 0x94D2, 0x83BC, 0x080B, 0xAD60, 0x26D7, 0x31B9, 0xBA0E, - 0xF0D8, 0x7B6F, 0x6C01, 0xE7B6, 0x42DD, 0xC96A, 0xDE04, 0x55B3 -}; - -__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len) -{ - unsigned int i; - - for (i = 0 ; i < len ; i++) - crc = (crc << 8) ^ t10_dif_crc_table[((crc >> 8) ^ buffer[i]) & 0xff]; - - return crc; -} -EXPORT_SYMBOL(crc_t10dif_generic); - -/* - * Steps through buffer one byte at at time, calculates reflected - * crc using table. - */ - -static int chksum_init(struct shash_desc *desc) -{ - struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); - - ctx->crc = 0; - - return 0; -} - -static int chksum_update(struct shash_desc *desc, const u8 *data, - unsigned int length) -{ - struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); - - ctx->crc = crc_t10dif_generic(ctx->crc, data, length); - return 0; -} - -static int chksum_final(struct shash_desc *desc, u8 *out) -{ - struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); - - *(__u16 *)out = ctx->crc; - return 0; -} - -static int __chksum_finup(__u16 *crcp, const u8 *data, unsigned int len, - u8 *out) -{ - *(__u16 *)out = crc_t10dif_generic(*crcp, data, len); - return 0; -} - -static int chksum_finup(struct shash_desc *desc, const u8 *data, - unsigned int len, u8 *out) -{ - struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); - - return __chksum_finup(&ctx->crc, data, len, out); -} - -static int chksum_digest(struct shash_desc *desc, const u8 *data, - unsigned int length, u8 *out) -{ - struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); - - return __chksum_finup(&ctx->crc, data, length, out); -} - -static struct shash_alg alg = { - .digestsize = CRC_T10DIF_DIGEST_SIZE, - .init = chksum_init, - .update = chksum_update, - .final = chksum_final, - .finup = chksum_finup, - .digest = chksum_digest, - .descsize = sizeof(struct chksum_desc_ctx), - .base = { - .cra_name = "crct10dif", - .cra_driver_name = "crct10dif-generic", - .cra_priority = 100, - .cra_blocksize = CRC_T10DIF_BLOCK_SIZE, - .cra_module = THIS_MODULE, - } -}; - -static int __init crct10dif_mod_init(void) -{ - int ret; - - ret = crypto_register_shash(&alg); - return ret; -} - -static void __exit crct10dif_mod_fini(void) -{ - crypto_unregister_shash(&alg); -} - -module_init(crct10dif_mod_init); -module_exit(crct10dif_mod_fini); - -MODULE_AUTHOR("Tim Chen <tim.c.chen@linux.intel.com>"); -MODULE_DESCRIPTION("T10 DIF CRC calculation."); -MODULE_LICENSE("GPL"); diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 25a5934f0e50..66d254ce0d11 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -1174,10 +1174,6 @@ static int do_test(int m) ret += tcrypt_test("ghash"); break; - case 47: - ret += tcrypt_test("crct10dif"); - break; - case 100: ret += tcrypt_test("hmac(md5)"); break; @@ -1502,10 +1498,6 @@ static int do_test(int m) test_hash_speed("crc32c", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; - case 320: - test_hash_speed("crct10dif", sec, generic_hash_speed_template); - if (mode > 300 && mode < 400) break; - case 399: break; diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 2f00607039e2..ecddf921a9db 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -2045,16 +2045,6 @@ static const struct alg_test_desc alg_test_descs[] = { .count = CRC32C_TEST_VECTORS } } - }, { - .alg = "crct10dif", - .test = alg_test_hash, - .fips_allowed = 1, - .suite = { - .hash = { - .vecs = crct10dif_tv_template, - .count = CRCT10DIF_TEST_VECTORS - } - } }, { .alg = "cryptd(__driver-cbc-aes-aesni)", .test = alg_test_null, diff --git a/crypto/testmgr.h b/crypto/testmgr.h index 7d44aa3d6b44..1e701bc075b9 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h @@ -450,39 +450,6 @@ static struct hash_testvec rmd320_tv_template[] = { } }; -#define CRCT10DIF_TEST_VECTORS 3 -static struct hash_testvec crct10dif_tv_template[] = { - { - .plaintext = "abc", - .psize = 3, -#ifdef __LITTLE_ENDIAN - .digest = "\x3b\x44", -#else - .digest = "\x44\x3b", -#endif - }, { - .plaintext = "1234567890123456789012345678901234567890" - "123456789012345678901234567890123456789", - .psize = 79, -#ifdef __LITTLE_ENDIAN - .digest = "\x70\x4b", -#else - .digest = "\x4b\x70", -#endif - }, { - .plaintext = - "abcddddddddddddddddddddddddddddddddddddddddddddddddddddd", - .psize = 56, -#ifdef __LITTLE_ENDIAN - .digest = "\xe3\x9c", -#else - .digest = "\x9c\xe3", -#endif - .np = 2, - .tap = { 28, 28 } - } -}; - /* * SHA1 test vectors from from FIPS PUB 180-1 * Long vector from CAVS 5.0 diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h index b3cb71f0d3b0..a9c96d865ee7 100644 --- a/include/linux/crc-t10dif.h +++ b/include/linux/crc-t10dif.h @@ -3,10 +3,6 @@ #include <linux/types.h> -#define CRC_T10DIF_DIGEST_SIZE 2 -#define CRC_T10DIF_BLOCK_SIZE 1 - -__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len); __u16 crc_t10dif(unsigned char const *, size_t); #endif diff --git a/lib/Kconfig b/lib/Kconfig index 339d5a4292f8..fe01d418b09a 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -63,8 +63,6 @@ config CRC16 config CRC_T10DIF tristate "CRC calculation for the T10 Data Integrity Field" - select CRYPTO - select CRYPTO_CRCT10DIF help This option is only needed if a module that's not in the kernel tree needs to calculate CRC checks for use with the diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c index fe3428c07b47..fbbd66ed86cd 100644 --- a/lib/crc-t10dif.c +++ b/lib/crc-t10dif.c @@ -11,44 +11,57 @@ #include <linux/types.h> #include <linux/module.h> #include <linux/crc-t10dif.h> -#include <linux/err.h> -#include <linux/init.h> -#include <crypto/hash.h> -static struct crypto_shash *crct10dif_tfm; +/* Table generated using the following polynomium: + * x^16 + x^15 + x^11 + x^9 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 + * gt: 0x8bb7 + */ +static const __u16 t10_dif_crc_table[256] = { + 0x0000, 0x8BB7, 0x9CD9, 0x176E, 0xB205, 0x39B2, 0x2EDC, 0xA56B, + 0xEFBD, 0x640A, 0x7364, 0xF8D3, 0x5DB8, 0xD60F, 0xC161, 0x4AD6, + 0x54CD, 0xDF7A, 0xC814, 0x43A3, 0xE6C8, 0x6D7F, 0x7A11, 0xF1A6, + 0xBB70, 0x30C7, 0x27A9, 0xAC1E, 0x0975, 0x82C2, 0x95AC, 0x1E1B, + 0xA99A, 0x222D, 0x3543, 0xBEF4, 0x1B9F, 0x9028, 0x8746, 0x0CF1, + 0x4627, 0xCD90, 0xDAFE, 0x5149, 0xF422, 0x7F95, 0x68FB, 0xE34C, + 0xFD57, 0x76E0, 0x618E, 0xEA39, 0x4F52, 0xC4E5, 0xD38B, 0x583C, + 0x12EA, 0x995D, 0x8E33, 0x0584, 0xA0EF, 0x2B58, 0x3C36, 0xB781, + 0xD883, 0x5334, 0x445A, 0xCFED, 0x6A86, 0xE131, 0xF65F, 0x7DE8, + 0x373E, 0xBC89, 0xABE7, 0x2050, 0x853B, 0x0E8C, 0x19E2, 0x9255, + 0x8C4E, 0x07F9, 0x1097, 0x9B20, 0x3E4B, 0xB5FC, 0xA292, 0x2925, + 0x63F3, 0xE844, 0xFF2A, 0x749D, 0xD1F6, 0x5A41, 0x4D2F, 0xC698, + 0x7119, 0xFAAE, 0xEDC0, 0x6677, 0xC31C, 0x48AB, 0x5FC5, 0xD472, + 0x9EA4, 0x1513, 0x027D, 0x89CA, 0x2CA1, 0xA716, 0xB078, 0x3BCF, + 0x25D4, 0xAE63, 0xB90D, 0x32BA, 0x97D1, 0x1C66, 0x0B08, 0x80BF, + 0xCA69, 0x41DE, 0x56B0, 0xDD07, 0x786C, 0xF3DB, 0xE4B5, 0x6F02, + 0x3AB1, 0xB106, 0xA668, 0x2DDF, 0x88B4, 0x0303, 0x146D, 0x9FDA, + 0xD50C, 0x5EBB, 0x49D5, 0xC262, 0x6709, 0xECBE, 0xFBD0, 0x7067, + 0x6E7C, 0xE5CB, 0xF2A5, 0x7912, 0xDC79, 0x57CE, 0x40A0, 0xCB17, + 0x81C1, 0x0A76, 0x1D18, 0x96AF, 0x33C4, 0xB873, 0xAF1D, 0x24AA, + 0x932B, 0x189C, 0x0FF2, 0x8445, 0x212E, 0xAA99, 0xBDF7, 0x3640, + 0x7C96, 0xF721, 0xE04F, 0x6BF8, 0xCE93, 0x4524, 0x524A, 0xD9FD, + 0xC7E6, 0x4C51, 0x5B3F, 0xD088, 0x75E3, 0xFE54, 0xE93A, 0x628D, + 0x285B, 0xA3EC, 0xB482, 0x3F35, 0x9A5E, 0x11E9, 0x0687, 0x8D30, + 0xE232, 0x6985, 0x7EEB, 0xF55C, 0x5037, 0xDB80, 0xCCEE, 0x4759, + 0x0D8F, 0x8638, 0x9156, 0x1AE1, 0xBF8A, 0x343D, 0x2353, 0xA8E4, + 0xB6FF, 0x3D48, 0x2A26, 0xA191, 0x04FA, 0x8F4D, 0x9823, 0x1394, + 0x5942, 0xD2F5, 0xC59B, 0x4E2C, 0xEB47, 0x60F0, 0x779E, 0xFC29, + 0x4BA8, 0xC01F, 0xD771, 0x5CC6, 0xF9AD, 0x721A, 0x6574, 0xEEC3, + 0xA415, 0x2FA2, 0x38CC, 0xB37B, 0x1610, 0x9DA7, 0x8AC9, 0x017E, + 0x1F65, 0x94D2, 0x83BC, 0x080B, 0xAD60, 0x26D7, 0x31B9, 0xBA0E, + 0xF0D8, 0x7B6F, 0x6C01, 0xE7B6, 0x42DD, 0xC96A, 0xDE04, 0x55B3 +}; __u16 crc_t10dif(const unsigned char *buffer, size_t len) { - struct { - struct shash_desc shash; - char ctx[2]; - } desc; - int err; + __u16 crc = 0; + unsigned int i; - desc.shash.tfm = crct10dif_tfm; - desc.shash.flags = 0; - *(__u16 *)desc.ctx = 0; + for (i = 0 ; i < len ; i++) + crc = (crc << 8) ^ t10_dif_crc_table[((crc >> 8) ^ buffer[i]) & 0xff]; - err = crypto_shash_update(&desc.shash, buffer, len); - BUG_ON(err); - - return *(__u16 *)desc.ctx; + return crc; } EXPORT_SYMBOL(crc_t10dif); -static int __init crc_t10dif_mod_init(void) -{ - crct10dif_tfm = crypto_alloc_shash("crct10dif", 0, 0); - return PTR_RET(crct10dif_tfm); -} - -static void __exit crc_t10dif_mod_fini(void) -{ - crypto_free_shash(crct10dif_tfm); -} - -module_init(crc_t10dif_mod_init); -module_exit(crc_t10dif_mod_fini); - MODULE_DESCRIPTION("T10 DIF CRC calculation"); MODULE_LICENSE("GPL"); From 5312e54d7e8bfe9716a1ffbc50e0093aadde46b8 Mon Sep 17 00:00:00 2001 From: Johannes Berg <johannes.berg@intel.com> Date: Mon, 22 Jul 2013 18:26:56 +0200 Subject: [PATCH 426/913] iwlwifi: mvm: use only a single GTK in D3 Unfortunately, the firmware only supports replay counters for a single GTK in D3, so that we should only upload the last key and use its replay counters. Since mac80211 key iteration will walk through the keys in order of their addition, simply use the same HW key index (1) for all GTKs, thus overwriting previous ones with newer ones. The replay counters for it are already used. Reviewed-by: Yaron Vaknin <Yaron.Vaknin@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- drivers/net/wireless/iwlwifi/mvm/d3.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c index 7e5e5c2f9f87..83da884cf303 100644 --- a/drivers/net/wireless/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/iwlwifi/mvm/d3.c @@ -134,7 +134,7 @@ struct wowlan_key_data { struct iwl_wowlan_rsc_tsc_params_cmd *rsc_tsc; struct iwl_wowlan_tkip_params_cmd *tkip; bool error, use_rsc_tsc, use_tkip; - int gtk_key_idx; + int wep_key_idx; }; static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, @@ -188,8 +188,8 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, wkc.wep_key.key_offset = 0; } else { /* others start at 1 */ - data->gtk_key_idx++; - wkc.wep_key.key_offset = data->gtk_key_idx; + data->wep_key_idx++; + wkc.wep_key.key_offset = data->wep_key_idx; } ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, CMD_SYNC, @@ -316,8 +316,13 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, mvm->ptk_ivlen = key->iv_len; mvm->ptk_icvlen = key->icv_len; } else { - data->gtk_key_idx++; - key->hw_key_idx = data->gtk_key_idx; + /* + * firmware only supports TSC/RSC for a single key, + * so if there are multiple keep overwriting them + * with new ones -- this relies on mac80211 doing + * list_add_tail(). + */ + key->hw_key_idx = 1; mvm->gtk_ivlen = key->iv_len; mvm->gtk_icvlen = key->icv_len; } From bb963c4a43eb5127eb0bbfa16c7a6a209b0af5db Mon Sep 17 00:00:00 2001 From: David Spinadel <david.spinadel@intel.com> Date: Tue, 23 Jul 2013 14:13:32 +0300 Subject: [PATCH 427/913] iwlwifi: mvm: set SSID bits for passive channels Set SSID bitmap for direct scan even on passive channels, for the passive-to-active feature. Without this patch only the SSID from probe request template is sent on passive channels, after passive-to-active switching, causing us to not find all desired networks. Remove the unused passive scan mask constant. Cc: stable@vger.kernel.org Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: David Spinadel <david.spinadel@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h | 1 - drivers/net/wireless/iwlwifi/mvm/scan.c | 11 ++--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h index b60d14151721..365095a0c3b3 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h @@ -69,7 +69,6 @@ /* Scan Commands, Responses, Notifications */ /* Masks for iwl_scan_channel.type flags */ -#define SCAN_CHANNEL_TYPE_PASSIVE 0 #define SCAN_CHANNEL_TYPE_ACTIVE BIT(0) #define SCAN_CHANNEL_NARROW_BAND BIT(22) diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 268f027b45b0..acdff6b67e04 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c @@ -178,19 +178,12 @@ static void iwl_mvm_scan_fill_channels(struct iwl_scan_cmd *cmd, struct iwl_scan_channel *chan = (struct iwl_scan_channel *) (cmd->data + le16_to_cpu(cmd->tx_cmd.len)); int i; - __le32 chan_type_value; - - if (req->n_ssids > 0) - chan_type_value = cpu_to_le32(BIT(req->n_ssids) - 1); - else - chan_type_value = SCAN_CHANNEL_TYPE_PASSIVE; for (i = 0; i < cmd->channel_count; i++) { chan->channel = cpu_to_le16(req->channels[i]->hw_value); + chan->type = cpu_to_le32(BIT(req->n_ssids) - 1); if (req->channels[i]->flags & IEEE80211_CHAN_PASSIVE_SCAN) - chan->type = SCAN_CHANNEL_TYPE_PASSIVE; - else - chan->type = chan_type_value; + chan->type &= cpu_to_le32(~SCAN_CHANNEL_TYPE_ACTIVE); chan->active_dwell = cpu_to_le16(active_dwell); chan->passive_dwell = cpu_to_le16(passive_dwell); chan->iteration_count = cpu_to_le16(1); From 7bdc84fb82627f34d9e13c37926f70fcde38e4c4 Mon Sep 17 00:00:00 2001 From: Yadwinder Singh Brar <yadi.brar@samsung.com> Date: Wed, 24 Jul 2013 17:05:07 +0900 Subject: [PATCH 428/913] ARM: SAMSUNG: Save/restore only selected uart's registers Basically this code gets executed only during debugging i.e when DEBUG_LL & SAMSUNG_PM_DEBUG is on, so required only for UART used for debugging. Since we are removing static iodesc entries for UARTs, so now only the selected (CONFIG_DEBUG_S3C_UART) UART will be ioremapped by the debug_ll_io_init() for DEBUG_LL, so save/restore uart registers only for selected uart. Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> --- arch/arm/plat-samsung/pm.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c index ea3613642451..d0c23010b693 100644 --- a/arch/arm/plat-samsung/pm.c +++ b/arch/arm/plat-samsung/pm.c @@ -80,7 +80,7 @@ unsigned char pm_uart_udivslot; #ifdef CONFIG_SAMSUNG_PM_DEBUG -static struct pm_uart_save uart_save[CONFIG_SERIAL_SAMSUNG_UARTS]; +static struct pm_uart_save uart_save; static void s3c_pm_save_uart(unsigned int uart, struct pm_uart_save *save) { @@ -101,11 +101,7 @@ static void s3c_pm_save_uart(unsigned int uart, struct pm_uart_save *save) static void s3c_pm_save_uarts(void) { - struct pm_uart_save *save = uart_save; - unsigned int uart; - - for (uart = 0; uart < CONFIG_SERIAL_SAMSUNG_UARTS; uart++, save++) - s3c_pm_save_uart(uart, save); + s3c_pm_save_uart(CONFIG_DEBUG_S3C_UART, &uart_save); } static void s3c_pm_restore_uart(unsigned int uart, struct pm_uart_save *save) @@ -126,11 +122,7 @@ static void s3c_pm_restore_uart(unsigned int uart, struct pm_uart_save *save) static void s3c_pm_restore_uarts(void) { - struct pm_uart_save *save = uart_save; - unsigned int uart; - - for (uart = 0; uart < CONFIG_SERIAL_SAMSUNG_UARTS; uart++, save++) - s3c_pm_restore_uart(uart, save); + s3c_pm_restore_uart(CONFIG_DEBUG_S3C_UART, &uart_save); } #else static void s3c_pm_save_uarts(void) { } From 7ed76e089a645a12c53bc35936574f710aa11549 Mon Sep 17 00:00:00 2001 From: Yadwinder Singh Brar <yadi.brar@samsung.com> Date: Wed, 24 Jul 2013 17:05:32 +0900 Subject: [PATCH 429/913] ARM: EXYNOS: Fix low level debug support Presently, using exynos_defconfig with CONFIG_DEBUG_LL and CONFIG_EARLY_PRIN on, kernel is not booting, we are getting following: [ 0.000000] ------------[ cut here ]------------ [ 0.000000] kernel BUG at mm/vmalloc.c:1134! [ 0.000000] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.11.0-rc1 #633 [ 0.000000] task: c052ec48 ti: c0524000 task.ti: c0524000 [ 0.000000] PC is at vm_area_add_early+0x54/0x94 [ 0.000000] LR is at add_static_vm_early+0xc/0x60 Its because exynos[4/5]_map_io() function ioremaps a single 512KB memory size for all the four uart ports which envelopes the mapping created by debug_ll_io_init(), called earlier in exynos_init_io(). This patch removes iodesc entries for UART controller for all Samsung SoC's, since now the Samsung uart driver does a ioremap during probe and any needed iomapping for earlyprintk will be handled by debug_ll_io_init(). Tested on smdk4412 and smdk5250. Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> --- arch/arm/mach-exynos/common.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 164685bd25c8..ba95e5db2501 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c @@ -58,7 +58,6 @@ static const char name_exynos5440[] = "EXYNOS5440"; static void exynos4_map_io(void); static void exynos5_map_io(void); -static void exynos5440_map_io(void); static int exynos_init(void); static struct cpu_table cpu_ids[] __initdata = { @@ -95,7 +94,6 @@ static struct cpu_table cpu_ids[] __initdata = { }, { .idcode = EXYNOS5440_SOC_ID, .idmask = EXYNOS5_SOC_MASK, - .map_io = exynos5440_map_io, .init = exynos_init, .name = name_exynos5440, }, @@ -149,11 +147,6 @@ static struct map_desc exynos4_iodesc[] __initdata = { .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_DIST), .length = SZ_64K, .type = MT_DEVICE, - }, { - .virtual = (unsigned long)S3C_VA_UART, - .pfn = __phys_to_pfn(EXYNOS4_PA_UART), - .length = SZ_512K, - .type = MT_DEVICE, }, { .virtual = (unsigned long)S5P_VA_CMU, .pfn = __phys_to_pfn(EXYNOS4_PA_CMU), @@ -268,20 +261,6 @@ static struct map_desc exynos5_iodesc[] __initdata = { .pfn = __phys_to_pfn(EXYNOS5_PA_PMU), .length = SZ_64K, .type = MT_DEVICE, - }, { - .virtual = (unsigned long)S3C_VA_UART, - .pfn = __phys_to_pfn(EXYNOS5_PA_UART), - .length = SZ_512K, - .type = MT_DEVICE, - }, -}; - -static struct map_desc exynos5440_iodesc0[] __initdata = { - { - .virtual = (unsigned long)S3C_VA_UART, - .pfn = __phys_to_pfn(EXYNOS5440_PA_UART0), - .length = SZ_512K, - .type = MT_DEVICE, }, }; @@ -388,11 +367,6 @@ static void __init exynos5_map_io(void) iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc)); } -static void __init exynos5440_map_io(void) -{ - iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0)); -} - void __init exynos_init_time(void) { of_clk_init(NULL); From fee4b700a4e9e446151eb5a03874ca8666323113 Mon Sep 17 00:00:00 2001 From: Eldad Zack <eldad@fogrefinery.com> Date: Tue, 23 Jul 2013 11:15:06 +0200 Subject: [PATCH 430/913] ALSA: hiface: return correct XRUN indication Return SNDRV_PCM_POS_XRUN (snd_pcm_uframes_t) instead of SNDRV_PCM_STATE_XRUN (snd_pcm_state_t) from the pointer function of hiface, as expected by snd_pcm_update_hw_ptr0(). Caught by sparse. Cc: Antonio Ospite <ospite@studenti.unina.it> Signed-off-by: Eldad Zack <eldad@fogrefinery.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> --- sound/usb/hiface/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/usb/hiface/pcm.c b/sound/usb/hiface/pcm.c index 6430ed2a9f65..c21a3df9a0df 100644 --- a/sound/usb/hiface/pcm.c +++ b/sound/usb/hiface/pcm.c @@ -503,7 +503,7 @@ static snd_pcm_uframes_t hiface_pcm_pointer(struct snd_pcm_substream *alsa_sub) snd_pcm_uframes_t dma_offset; if (rt->panic || !sub) - return SNDRV_PCM_STATE_XRUN; + return SNDRV_PCM_POS_XRUN; spin_lock_irqsave(&sub->lock, flags); dma_offset = sub->dma_off; From 53302bf60d2c95ee42118008499a5f5de544fcc1 Mon Sep 17 00:00:00 2001 From: Sachin Kamat <sachin.kamat@linaro.org> Date: Wed, 24 Jul 2013 18:55:27 +0900 Subject: [PATCH 431/913] ARM: EXYNOS: Update CONFIG_ARCH_NR_GPIO for Exynos With the recent cleanup in Exynos platform code notably commits 17859bec ("ARM: EXYNOS: Do not select legacy Kconfig symbols any more") and b9222210 ("ARM: EXYNOS: Remove mach/gpio.h"), the definition of ARCH_NR_GPIOS got removed. This started causing problems on SoCs like Exynos4412 which have more than the default number of GPIOs. Thus define this number in KConfig file which takes care of current SoC requirements and provides scope for GPIO expanders. Without this patch we get the following errors during boot: gpiochip_add: gpios 251..258 (gpv0) failed to register samsung-pinctrl 106e0000.pinctrl: failed to register gpio_chip gpv0, error code: -22 samsung-pinctrl: probe of 106e0000.pinctrl failed with error -22 Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> --- arch/arm/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ba412e02ec0c..37c0f4e978d4 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1600,8 +1600,7 @@ config LOCAL_TIMERS config ARCH_NR_GPIO int default 1024 if ARCH_SHMOBILE || ARCH_TEGRA - default 512 if SOC_OMAP5 - default 512 if ARCH_KEYSTONE + default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 default 392 if ARCH_U8500 default 352 if ARCH_VT8500 default 288 if ARCH_SUNXI From 56a678344273fd63f8ade26876283a2586a9bf3a Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen <lars@metafoo.de> Date: Wed, 24 Jul 2013 15:27:35 +0200 Subject: [PATCH 432/913] ASoC: dapm: Fix return value of snd_soc_dapm_put_{volsw,enum_virt}() The ALSA core expect the put callback of a control to return 1 if the value of the control changed and 0 if it did not. Both snd_soc_dapm_put_volsw() and snd_soc_dapm_put_enum_virt() currently always returns 0. For both functions we already have a 'change' variable which either contains 1 or 0 depending on whether the value has changed or not, so just return that. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org> --- sound/soc/soc-dapm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index b94190820e8c..bd16010441cc 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2733,7 +2733,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, } mutex_unlock(&card->dapm_mutex); - return 0; + return change; } EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw); @@ -2861,7 +2861,6 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; int change; - int ret = 0; int wi; if (ucontrol->value.enumerated.item[0] >= e->max) @@ -2881,7 +2880,7 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, } mutex_unlock(&card->dapm_mutex); - return ret; + return change; } EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_virt); From 6f498018279d118cf38945f73da7c9345f7e2e5d Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires <benjamin.tissoires@redhat.com> Date: Wed, 24 Jul 2013 16:53:07 +0200 Subject: [PATCH 433/913] HID: sony: fix HID mapping for PS3 sixaxis controller Commit f04d51404f51 (HID: driver for PS2/3 Buzz controllers) introduced an input_mapping() callback, but set the return value to -1 to all devices except the Buzz controllers. The result of this is that the Sixaxis input device is not populated, making it useless. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> --- drivers/hid/hid-sony.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index ecbc74923d06..87fbe2924cfa 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -369,7 +369,8 @@ static int sony_mapping(struct hid_device *hdev, struct hid_input *hi, if (sc->quirks & PS3REMOTE) return ps3remote_mapping(hdev, hi, field, usage, bit, max); - return -1; + /* Let hid-core decide for the others */ + return 0; } /* From 649e9c70da6bfbeb563193a35d3424a5aa7c0d38 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Tue, 23 Jul 2013 17:25:54 +0200 Subject: [PATCH 434/913] tracing: Introduce trace_create_cpu_file() and tracing_get_cpu() Every "file_operations" used by tracing_init_debugfs_percpu is buggy. f_op->open/etc does: 1. struct trace_cpu *tc = inode->i_private; struct trace_array *tr = tc->tr; 2. trace_array_get(tr) or fail; 3. do_something(tc); But tc (and tr) can be already freed before trace_array_get() is called. And it doesn't matter whether this file is per-cpu or it was created by init_tracer_debugfs(), free_percpu() or kfree() are equally bad. Note that even 1. is not safe, the freed memory can be unmapped. But even if it was safe trace_array_get() can wrongly succeed if we also race with the next new_instance_create() which can re-allocate the same tr, or tc was overwritten and ->tr points to the valid tr. In this case 3. uses the freed/reused memory. Add the new trivial helper, trace_create_cpu_file() which simply calls trace_create_file() and encodes "cpu" in "struct inode". Another helper, tracing_get_cpu() will be used to read cpu_nr-or-RING_BUFFER_ALL_CPUS. The patch abuses ->i_cdev to encode the number, it is never used unless the file is S_ISCHR(). But we could use something else, say, i_bytes or even ->d_fsdata. In any case this hack is hidden inside these 2 helpers, it would be trivial to change them if needed. This patch only changes tracing_init_debugfs_percpu() to use the new trace_create_cpu_file(), the next patches will change file_operations. Note: tracing_get_cpu(inode) is always safe but you can't trust the result unless trace_array_get() was called, without trace_types_lock which acts as a barrier it can wrongly return RING_BUFFER_ALL_CPUS. Link: http://lkml.kernel.org/r/20130723152554.GA23710@redhat.com Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 50 +++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 3f2477713aca..cfff63c2148a 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2843,6 +2843,17 @@ static int s_show(struct seq_file *m, void *v) return 0; } +/* + * Should be used after trace_array_get(), trace_types_lock + * ensures that i_cdev was already initialized. + */ +static inline int tracing_get_cpu(struct inode *inode) +{ + if (inode->i_cdev) /* See trace_create_cpu_file() */ + return (long)inode->i_cdev - 1; + return RING_BUFFER_ALL_CPUS; +} + static const struct seq_operations tracer_seq_ops = { .start = s_start, .next = s_next, @@ -5529,6 +5540,17 @@ static struct dentry *tracing_dentry_percpu(struct trace_array *tr, int cpu) return tr->percpu_dir; } +static struct dentry * +trace_create_cpu_file(const char *name, umode_t mode, struct dentry *parent, + void *data, long cpu, const struct file_operations *fops) +{ + struct dentry *ret = trace_create_file(name, mode, parent, data, fops); + + if (ret) /* See tracing_get_cpu() */ + ret->d_inode->i_cdev = (void *)(cpu + 1); + return ret; +} + static void tracing_init_debugfs_percpu(struct trace_array *tr, long cpu) { @@ -5548,28 +5570,28 @@ tracing_init_debugfs_percpu(struct trace_array *tr, long cpu) } /* per cpu trace_pipe */ - trace_create_file("trace_pipe", 0444, d_cpu, - (void *)&data->trace_cpu, &tracing_pipe_fops); + trace_create_cpu_file("trace_pipe", 0444, d_cpu, + &data->trace_cpu, cpu, &tracing_pipe_fops); /* per cpu trace */ - trace_create_file("trace", 0644, d_cpu, - (void *)&data->trace_cpu, &tracing_fops); + trace_create_cpu_file("trace", 0644, d_cpu, + &data->trace_cpu, cpu, &tracing_fops); - trace_create_file("trace_pipe_raw", 0444, d_cpu, - (void *)&data->trace_cpu, &tracing_buffers_fops); + trace_create_cpu_file("trace_pipe_raw", 0444, d_cpu, + &data->trace_cpu, cpu, &tracing_buffers_fops); - trace_create_file("stats", 0444, d_cpu, - (void *)&data->trace_cpu, &tracing_stats_fops); + trace_create_cpu_file("stats", 0444, d_cpu, + &data->trace_cpu, cpu, &tracing_stats_fops); - trace_create_file("buffer_size_kb", 0444, d_cpu, - (void *)&data->trace_cpu, &tracing_entries_fops); + trace_create_cpu_file("buffer_size_kb", 0444, d_cpu, + &data->trace_cpu, cpu, &tracing_entries_fops); #ifdef CONFIG_TRACER_SNAPSHOT - trace_create_file("snapshot", 0644, d_cpu, - (void *)&data->trace_cpu, &snapshot_fops); + trace_create_cpu_file("snapshot", 0644, d_cpu, + &data->trace_cpu, cpu, &snapshot_fops); - trace_create_file("snapshot_raw", 0444, d_cpu, - (void *)&data->trace_cpu, &snapshot_raw_fops); + trace_create_cpu_file("snapshot_raw", 0444, d_cpu, + &data->trace_cpu, cpu, &snapshot_raw_fops); #endif } From 15544209cb0b5312e5220a9337a1fe61d1a1f2d9 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Tue, 23 Jul 2013 17:25:57 +0200 Subject: [PATCH 435/913] tracing: Change tracing_pipe_fops() to rely on tracing_get_cpu() tracing_open_pipe() is racy, the memory inode->i_private points to can be already freed. Change debugfs_create_file("trace_pipe", data) callers to to pass "data = tr", tracing_open_pipe() can use tracing_get_cpu(). Link: http://lkml.kernel.org/r/20130723152557.GA23717@redhat.com Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index cfff63c2148a..51a99ef2a6e5 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -3959,8 +3959,7 @@ tracing_max_lat_write(struct file *filp, const char __user *ubuf, static int tracing_open_pipe(struct inode *inode, struct file *filp) { - struct trace_cpu *tc = inode->i_private; - struct trace_array *tr = tc->tr; + struct trace_array *tr = inode->i_private; struct trace_iterator *iter; int ret = 0; @@ -4006,9 +4005,9 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp) if (trace_clocks[tr->clock_id].in_ns) iter->iter_flags |= TRACE_FILE_TIME_IN_NS; - iter->cpu_file = tc->cpu; - iter->tr = tc->tr; - iter->trace_buffer = &tc->tr->trace_buffer; + iter->tr = tr; + iter->trace_buffer = &tr->trace_buffer; + iter->cpu_file = tracing_get_cpu(inode); mutex_init(&iter->mutex); filp->private_data = iter; @@ -4031,8 +4030,7 @@ fail: static int tracing_release_pipe(struct inode *inode, struct file *file) { struct trace_iterator *iter = file->private_data; - struct trace_cpu *tc = inode->i_private; - struct trace_array *tr = tc->tr; + struct trace_array *tr = inode->i_private; mutex_lock(&trace_types_lock); @@ -5571,7 +5569,7 @@ tracing_init_debugfs_percpu(struct trace_array *tr, long cpu) /* per cpu trace_pipe */ trace_create_cpu_file("trace_pipe", 0444, d_cpu, - &data->trace_cpu, cpu, &tracing_pipe_fops); + tr, cpu, &tracing_pipe_fops); /* per cpu trace */ trace_create_cpu_file("trace", 0644, d_cpu, @@ -6157,7 +6155,7 @@ init_tracer_debugfs(struct trace_array *tr, struct dentry *d_tracer) (void *)&tr->trace_cpu, &tracing_fops); trace_create_file("trace_pipe", 0444, d_tracer, - (void *)&tr->trace_cpu, &tracing_pipe_fops); + tr, &tracing_pipe_fops); trace_create_file("buffer_size_kb", 0644, d_tracer, (void *)&tr->trace_cpu, &tracing_entries_fops); From 46ef2be0d1d5ccea0c41bb606143586daadd537c Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Tue, 23 Jul 2013 17:26:00 +0200 Subject: [PATCH 436/913] tracing: Change tracing_buffers_fops to rely on tracing_get_cpu() tracing_buffers_open() is racy, the memory inode->i_private points to can be already freed. Change debugfs_create_file("trace_pipe_raw", data) caller to pass "data = tr", tracing_buffers_open() can use tracing_get_cpu(). Change debugfs_create_file("snapshot_raw_fops", data) caller too, this file uses tracing_buffers_open/release. Link: http://lkml.kernel.org/r/20130723152600.GA23720@redhat.com Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 51a99ef2a6e5..30c058a56ffb 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -4949,8 +4949,7 @@ static const struct file_operations snapshot_raw_fops = { static int tracing_buffers_open(struct inode *inode, struct file *filp) { - struct trace_cpu *tc = inode->i_private; - struct trace_array *tr = tc->tr; + struct trace_array *tr = inode->i_private; struct ftrace_buffer_info *info; int ret; @@ -4969,7 +4968,7 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp) mutex_lock(&trace_types_lock); info->iter.tr = tr; - info->iter.cpu_file = tc->cpu; + info->iter.cpu_file = tracing_get_cpu(inode); info->iter.trace = tr->current_trace; info->iter.trace_buffer = &tr->trace_buffer; info->spare = NULL; @@ -5576,7 +5575,7 @@ tracing_init_debugfs_percpu(struct trace_array *tr, long cpu) &data->trace_cpu, cpu, &tracing_fops); trace_create_cpu_file("trace_pipe_raw", 0444, d_cpu, - &data->trace_cpu, cpu, &tracing_buffers_fops); + tr, cpu, &tracing_buffers_fops); trace_create_cpu_file("stats", 0444, d_cpu, &data->trace_cpu, cpu, &tracing_stats_fops); @@ -5589,7 +5588,7 @@ tracing_init_debugfs_percpu(struct trace_array *tr, long cpu) &data->trace_cpu, cpu, &snapshot_fops); trace_create_cpu_file("snapshot_raw", 0444, d_cpu, - &data->trace_cpu, cpu, &snapshot_raw_fops); + tr, cpu, &snapshot_raw_fops); #endif } From 4d3435b8a4c3357695e09c5e7a3bf73a19fca5b0 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Tue, 23 Jul 2013 17:26:03 +0200 Subject: [PATCH 437/913] tracing: Change tracing_stats_fops to rely on tracing_get_cpu() tracing_open_generic_tc() is racy, the memory inode->i_private points to can be already freed. 1. Change one of its users, tracing_stats_fops, to use tracing_*_generic_tr() instead. 2. Change trace_create_cpu_file("stats", data) to pass "data = tr". 3. Change tracing_stats_read() to use tracing_get_cpu(). Link: http://lkml.kernel.org/r/20130723152603.GA23727@redhat.com Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 30c058a56ffb..e29dc8f69aac 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2982,7 +2982,6 @@ static int tracing_open_generic_tr(struct inode *inode, struct file *filp) filp->private_data = inode->i_private; return 0; - } static int tracing_open_generic_tc(struct inode *inode, struct file *filp) @@ -5285,14 +5284,14 @@ static ssize_t tracing_stats_read(struct file *filp, char __user *ubuf, size_t count, loff_t *ppos) { - struct trace_cpu *tc = filp->private_data; - struct trace_array *tr = tc->tr; + struct inode *inode = file_inode(filp); + struct trace_array *tr = inode->i_private; struct trace_buffer *trace_buf = &tr->trace_buffer; + int cpu = tracing_get_cpu(inode); struct trace_seq *s; unsigned long cnt; unsigned long long t; unsigned long usec_rem; - int cpu = tc->cpu; s = kmalloc(sizeof(*s), GFP_KERNEL); if (!s) @@ -5345,10 +5344,10 @@ tracing_stats_read(struct file *filp, char __user *ubuf, } static const struct file_operations tracing_stats_fops = { - .open = tracing_open_generic_tc, + .open = tracing_open_generic_tr, .read = tracing_stats_read, .llseek = generic_file_llseek, - .release = tracing_release_generic_tc, + .release = tracing_release_generic_tr, }; #ifdef CONFIG_DYNAMIC_FTRACE @@ -5578,7 +5577,7 @@ tracing_init_debugfs_percpu(struct trace_array *tr, long cpu) tr, cpu, &tracing_buffers_fops); trace_create_cpu_file("stats", 0444, d_cpu, - &data->trace_cpu, cpu, &tracing_stats_fops); + tr, cpu, &tracing_stats_fops); trace_create_cpu_file("buffer_size_kb", 0444, d_cpu, &data->trace_cpu, cpu, &tracing_entries_fops); From 0bc392ee46d0fd8e6b678457ef71f074f19a03c5 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Tue, 23 Jul 2013 17:26:06 +0200 Subject: [PATCH 438/913] tracing: Change tracing_entries_fops to rely on tracing_get_cpu() tracing_open_generic_tc() is racy, the memory inode->i_private points to can be already freed. 1. Change its last user, tracing_entries_fops, to use tracing_*_generic_tr() instead. 2. Change debugfs_create_file("buffer_size_kb", data) callers to pass "data = tr". 3. Change tracing_entries_read() and tracing_entries_write() to use tracing_get_cpu(). 4. Kill the no longer used tracing_open_generic_tc() and tracing_release_generic_tc(). Link: http://lkml.kernel.org/r/20130723152606.GA23730@redhat.com Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 49 +++++++++++--------------------------------- 1 file changed, 12 insertions(+), 37 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index e29dc8f69aac..68b46851666f 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2984,23 +2984,6 @@ static int tracing_open_generic_tr(struct inode *inode, struct file *filp) return 0; } -static int tracing_open_generic_tc(struct inode *inode, struct file *filp) -{ - struct trace_cpu *tc = inode->i_private; - struct trace_array *tr = tc->tr; - - if (tracing_disabled) - return -ENODEV; - - if (trace_array_get(tr) < 0) - return -ENODEV; - - filp->private_data = inode->i_private; - - return 0; - -} - static int tracing_release(struct inode *inode, struct file *file) { struct seq_file *m = file->private_data; @@ -3054,15 +3037,6 @@ static int tracing_release_generic_tr(struct inode *inode, struct file *file) return 0; } -static int tracing_release_generic_tc(struct inode *inode, struct file *file) -{ - struct trace_cpu *tc = inode->i_private; - struct trace_array *tr = tc->tr; - - trace_array_put(tr); - return 0; -} - static int tracing_single_release_tr(struct inode *inode, struct file *file) { struct trace_array *tr = inode->i_private; @@ -4382,15 +4356,16 @@ static ssize_t tracing_entries_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { - struct trace_cpu *tc = filp->private_data; - struct trace_array *tr = tc->tr; + struct inode *inode = file_inode(filp); + struct trace_array *tr = inode->i_private; + int cpu = tracing_get_cpu(inode); char buf[64]; int r = 0; ssize_t ret; mutex_lock(&trace_types_lock); - if (tc->cpu == RING_BUFFER_ALL_CPUS) { + if (cpu == RING_BUFFER_ALL_CPUS) { int cpu, buf_size_same; unsigned long size; @@ -4417,7 +4392,7 @@ tracing_entries_read(struct file *filp, char __user *ubuf, } else r = sprintf(buf, "X\n"); } else - r = sprintf(buf, "%lu\n", per_cpu_ptr(tr->trace_buffer.data, tc->cpu)->entries >> 10); + r = sprintf(buf, "%lu\n", per_cpu_ptr(tr->trace_buffer.data, cpu)->entries >> 10); mutex_unlock(&trace_types_lock); @@ -4429,7 +4404,8 @@ static ssize_t tracing_entries_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { - struct trace_cpu *tc = filp->private_data; + struct inode *inode = file_inode(filp); + struct trace_array *tr = inode->i_private; unsigned long val; int ret; @@ -4443,8 +4419,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, /* value is in KB */ val <<= 10; - - ret = tracing_resize_ring_buffer(tc->tr, val, tc->cpu); + ret = tracing_resize_ring_buffer(tr, val, tracing_get_cpu(inode)); if (ret < 0) return ret; @@ -4892,11 +4867,11 @@ static const struct file_operations tracing_pipe_fops = { }; static const struct file_operations tracing_entries_fops = { - .open = tracing_open_generic_tc, + .open = tracing_open_generic_tr, .read = tracing_entries_read, .write = tracing_entries_write, .llseek = generic_file_llseek, - .release = tracing_release_generic_tc, + .release = tracing_release_generic_tr, }; static const struct file_operations tracing_total_entries_fops = { @@ -5580,7 +5555,7 @@ tracing_init_debugfs_percpu(struct trace_array *tr, long cpu) tr, cpu, &tracing_stats_fops); trace_create_cpu_file("buffer_size_kb", 0444, d_cpu, - &data->trace_cpu, cpu, &tracing_entries_fops); + tr, cpu, &tracing_entries_fops); #ifdef CONFIG_TRACER_SNAPSHOT trace_create_cpu_file("snapshot", 0644, d_cpu, @@ -6156,7 +6131,7 @@ init_tracer_debugfs(struct trace_array *tr, struct dentry *d_tracer) tr, &tracing_pipe_fops); trace_create_file("buffer_size_kb", 0644, d_tracer, - (void *)&tr->trace_cpu, &tracing_entries_fops); + tr, &tracing_entries_fops); trace_create_file("buffer_total_size_kb", 0444, d_tracer, tr, &tracing_total_entries_fops); From 6484c71cbc170634fa131b6d022d86d61686b88b Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Tue, 23 Jul 2013 17:26:10 +0200 Subject: [PATCH 439/913] tracing: Change tracing_fops/snapshot_fops to rely on tracing_get_cpu() tracing_open() and tracing_snapshot_open() are racy, the memory inode->i_private points to can be already freed. Convert these last users of "inode->i_private == trace_cpu" to use "i_private = trace_array" and rely on tracing_get_cpu(). v2: incorporate the fix from Steven, tracing_release() must not blindly dereference file->private_data unless we know that the file was opened for reading. Link: http://lkml.kernel.org/r/20130723152610.GA23737@redhat.com Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 50 +++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 68b46851666f..dd7780ddde08 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2862,9 +2862,9 @@ static const struct seq_operations tracer_seq_ops = { }; static struct trace_iterator * -__tracing_open(struct trace_array *tr, struct trace_cpu *tc, - struct inode *inode, struct file *file, bool snapshot) +__tracing_open(struct inode *inode, struct file *file, bool snapshot) { + struct trace_array *tr = inode->i_private; struct trace_iterator *iter; int cpu; @@ -2905,8 +2905,8 @@ __tracing_open(struct trace_array *tr, struct trace_cpu *tc, iter->trace_buffer = &tr->trace_buffer; iter->snapshot = snapshot; iter->pos = -1; + iter->cpu_file = tracing_get_cpu(inode); mutex_init(&iter->mutex); - iter->cpu_file = tc->cpu; /* Notify the tracer early; before we stop tracing. */ if (iter->trace && iter->trace->open) @@ -2986,22 +2986,18 @@ static int tracing_open_generic_tr(struct inode *inode, struct file *filp) static int tracing_release(struct inode *inode, struct file *file) { + struct trace_array *tr = inode->i_private; struct seq_file *m = file->private_data; struct trace_iterator *iter; - struct trace_array *tr; int cpu; - /* Writes do not use seq_file, need to grab tr from inode */ if (!(file->f_mode & FMODE_READ)) { - struct trace_cpu *tc = inode->i_private; - - trace_array_put(tc->tr); + trace_array_put(tr); return 0; } + /* Writes do not use seq_file */ iter = m->private; - tr = iter->tr; - mutex_lock(&trace_types_lock); for_each_tracing_cpu(cpu) { @@ -3048,8 +3044,7 @@ static int tracing_single_release_tr(struct inode *inode, struct file *file) static int tracing_open(struct inode *inode, struct file *file) { - struct trace_cpu *tc = inode->i_private; - struct trace_array *tr = tc->tr; + struct trace_array *tr = inode->i_private; struct trace_iterator *iter; int ret = 0; @@ -3057,16 +3052,17 @@ static int tracing_open(struct inode *inode, struct file *file) return -ENODEV; /* If this file was open for write, then erase contents */ - if ((file->f_mode & FMODE_WRITE) && - (file->f_flags & O_TRUNC)) { - if (tc->cpu == RING_BUFFER_ALL_CPUS) + if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) { + int cpu = tracing_get_cpu(inode); + + if (cpu == RING_BUFFER_ALL_CPUS) tracing_reset_online_cpus(&tr->trace_buffer); else - tracing_reset(&tr->trace_buffer, tc->cpu); + tracing_reset(&tr->trace_buffer, cpu); } if (file->f_mode & FMODE_READ) { - iter = __tracing_open(tr, tc, inode, file, false); + iter = __tracing_open(inode, file, false); if (IS_ERR(iter)) ret = PTR_ERR(iter); else if (trace_flags & TRACE_ITER_LATENCY_FMT) @@ -4680,8 +4676,7 @@ struct ftrace_buffer_info { #ifdef CONFIG_TRACER_SNAPSHOT static int tracing_snapshot_open(struct inode *inode, struct file *file) { - struct trace_cpu *tc = inode->i_private; - struct trace_array *tr = tc->tr; + struct trace_array *tr = inode->i_private; struct trace_iterator *iter; struct seq_file *m; int ret = 0; @@ -4690,7 +4685,7 @@ static int tracing_snapshot_open(struct inode *inode, struct file *file) return -ENODEV; if (file->f_mode & FMODE_READ) { - iter = __tracing_open(tr, tc, inode, file, true); + iter = __tracing_open(inode, file, true); if (IS_ERR(iter)) ret = PTR_ERR(iter); } else { @@ -4707,8 +4702,8 @@ static int tracing_snapshot_open(struct inode *inode, struct file *file) ret = 0; iter->tr = tr; - iter->trace_buffer = &tc->tr->max_buffer; - iter->cpu_file = tc->cpu; + iter->trace_buffer = &tr->max_buffer; + iter->cpu_file = tracing_get_cpu(inode); m->private = iter; file->private_data = m; } @@ -5525,7 +5520,6 @@ trace_create_cpu_file(const char *name, umode_t mode, struct dentry *parent, static void tracing_init_debugfs_percpu(struct trace_array *tr, long cpu) { - struct trace_array_cpu *data = per_cpu_ptr(tr->trace_buffer.data, cpu); struct dentry *d_percpu = tracing_dentry_percpu(tr, cpu); struct dentry *d_cpu; char cpu_dir[30]; /* 30 characters should be more than enough */ @@ -5546,7 +5540,7 @@ tracing_init_debugfs_percpu(struct trace_array *tr, long cpu) /* per cpu trace */ trace_create_cpu_file("trace", 0644, d_cpu, - &data->trace_cpu, cpu, &tracing_fops); + tr, cpu, &tracing_fops); trace_create_cpu_file("trace_pipe_raw", 0444, d_cpu, tr, cpu, &tracing_buffers_fops); @@ -5559,7 +5553,7 @@ tracing_init_debugfs_percpu(struct trace_array *tr, long cpu) #ifdef CONFIG_TRACER_SNAPSHOT trace_create_cpu_file("snapshot", 0644, d_cpu, - &data->trace_cpu, cpu, &snapshot_fops); + tr, cpu, &snapshot_fops); trace_create_cpu_file("snapshot_raw", 0444, d_cpu, tr, cpu, &snapshot_raw_fops); @@ -6125,7 +6119,7 @@ init_tracer_debugfs(struct trace_array *tr, struct dentry *d_tracer) tr, &tracing_iter_fops); trace_create_file("trace", 0644, d_tracer, - (void *)&tr->trace_cpu, &tracing_fops); + tr, &tracing_fops); trace_create_file("trace_pipe", 0444, d_tracer, tr, &tracing_pipe_fops); @@ -6146,11 +6140,11 @@ init_tracer_debugfs(struct trace_array *tr, struct dentry *d_tracer) &trace_clock_fops); trace_create_file("tracing_on", 0644, d_tracer, - tr, &rb_simple_fops); + tr, &rb_simple_fops); #ifdef CONFIG_TRACER_SNAPSHOT trace_create_file("snapshot", 0644, d_tracer, - (void *)&tr->trace_cpu, &snapshot_fops); + tr, &snapshot_fops); #endif for_each_tracing_cpu(cpu) From 9c01fe4593db123c5a72dc36f0400f776e92c954 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Tue, 23 Jul 2013 17:26:13 +0200 Subject: [PATCH 440/913] tracing: Kill trace_cpu struct/members After the previous changes trace_array_cpu->trace_cpu and trace_array->trace_cpu becomes write-only. Remove these members and kill "struct trace_cpu" as well. As a side effect this also removes memset(per_cpu_memory, 0). It was not needed, alloc_percpu() returns zero-filled memory. Link: http://lkml.kernel.org/r/20130723152613.GA23741@redhat.com Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 21 --------------------- kernel/trace/trace.h | 8 -------- 2 files changed, 29 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index dd7780ddde08..69cba470ea96 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -5865,17 +5865,6 @@ struct dentry *trace_instance_dir; static void init_tracer_debugfs(struct trace_array *tr, struct dentry *d_tracer); -static void init_trace_buffers(struct trace_array *tr, struct trace_buffer *buf) -{ - int cpu; - - for_each_tracing_cpu(cpu) { - memset(per_cpu_ptr(buf->data, cpu), 0, sizeof(struct trace_array_cpu)); - per_cpu_ptr(buf->data, cpu)->trace_cpu.cpu = cpu; - per_cpu_ptr(buf->data, cpu)->trace_cpu.tr = tr; - } -} - static int allocate_trace_buffer(struct trace_array *tr, struct trace_buffer *buf, int size) { @@ -5893,8 +5882,6 @@ allocate_trace_buffer(struct trace_array *tr, struct trace_buffer *buf, int size return -ENOMEM; } - init_trace_buffers(tr, buf); - /* Allocate the first page for all buffers */ set_buffer_entries(&tr->trace_buffer, ring_buffer_size(tr->trace_buffer.buffer, 0)); @@ -5961,10 +5948,6 @@ static int new_instance_create(const char *name) if (allocate_trace_buffers(tr, trace_buf_size) < 0) goto out_free_tr; - /* Holder for file callbacks */ - tr->trace_cpu.cpu = RING_BUFFER_ALL_CPUS; - tr->trace_cpu.tr = tr; - tr->dir = debugfs_create_dir(name, trace_instance_dir); if (!tr->dir) goto out_free_tr; @@ -6438,10 +6421,6 @@ __init static int tracer_alloc_buffers(void) global_trace.flags = TRACE_ARRAY_FL_GLOBAL; - /* Holder for file callbacks */ - global_trace.trace_cpu.cpu = RING_BUFFER_ALL_CPUS; - global_trace.trace_cpu.tr = &global_trace; - INIT_LIST_HEAD(&global_trace.systems); INIT_LIST_HEAD(&global_trace.events); list_add(&global_trace.list, &ftrace_trace_arrays); diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index e7d643b8a907..afaae41b0a02 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -130,19 +130,12 @@ enum trace_flag_type { struct trace_array; -struct trace_cpu { - struct trace_array *tr; - struct dentry *dir; - int cpu; -}; - /* * The CPU trace array - it consists of thousands of trace entries * plus some other descriptor data: (for example which task started * the trace, etc.) */ struct trace_array_cpu { - struct trace_cpu trace_cpu; atomic_t disabled; void *buffer_page; /* ring buffer spare */ @@ -196,7 +189,6 @@ struct trace_array { bool allocated_snapshot; #endif int buffer_disabled; - struct trace_cpu trace_cpu; /* place holder */ #ifdef CONFIG_FTRACE_SYSCALLS int sys_refcount_enter; int sys_refcount_exit; From 195a8afc7ac962f8da795549fe38e825f1372b0d Mon Sep 17 00:00:00 2001 From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org> Date: Tue, 23 Jul 2013 22:06:15 -0400 Subject: [PATCH 441/913] ftrace: Add check for NULL regs if ops has SAVE_REGS set If a ftrace ops is registered with the SAVE_REGS flag set, and there's already a ops registered to one of its functions but without the SAVE_REGS flag, there's a small race window where the SAVE_REGS ops gets added to the list of callbacks to call for that function before the callback trampoline gets set to save the regs. The problem is, the function is not currently saving regs, which opens a small race window where the ops that is expecting regs to be passed to it, wont. This can cause a crash if the callback were to reference the regs, as the SAVE_REGS guarantees that regs will be set. To fix this, we add a check in the loop case where it checks if the ops has the SAVE_REGS flag set, and if so, it will ignore it if regs is not set. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/ftrace.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 67708f46baae..8ce9eefc5bb4 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1441,12 +1441,22 @@ ftrace_hash_move(struct ftrace_ops *ops, int enable, * the hashes are freed with call_rcu_sched(). */ static int -ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip) +ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs) { struct ftrace_hash *filter_hash; struct ftrace_hash *notrace_hash; int ret; +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS + /* + * There's a small race when adding ops that the ftrace handler + * that wants regs, may be called without them. We can not + * allow that handler to be called if regs is NULL. + */ + if (regs == NULL && (ops->flags & FTRACE_OPS_FL_SAVE_REGS)) + return 0; +#endif + filter_hash = rcu_dereference_raw_notrace(ops->filter_hash); notrace_hash = rcu_dereference_raw_notrace(ops->notrace_hash); @@ -4218,7 +4228,7 @@ static inline void ftrace_startup_enable(int command) { } # define ftrace_shutdown_sysctl() do { } while (0) static inline int -ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip) +ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs) { return 1; } @@ -4241,7 +4251,7 @@ ftrace_ops_control_func(unsigned long ip, unsigned long parent_ip, do_for_each_ftrace_op(op, ftrace_control_list) { if (!(op->flags & FTRACE_OPS_FL_STUB) && !ftrace_function_local_disabled(op) && - ftrace_ops_test(op, ip)) + ftrace_ops_test(op, ip, regs)) op->func(ip, parent_ip, op, regs); } while_for_each_ftrace_op(op); trace_recursion_clear(TRACE_CONTROL_BIT); @@ -4274,7 +4284,7 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, */ preempt_disable_notrace(); do_for_each_ftrace_op(op, ftrace_ops_list) { - if (ftrace_ops_test(op, ip)) + if (ftrace_ops_test(op, ip, regs)) op->func(ip, parent_ip, op, regs); } while_for_each_ftrace_op(op); preempt_enable_notrace(); From c2fda509667b0fda4372a237f5a59ea4570b1627 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan <laijs@cn.fujitsu.com> Date: Wed, 24 Jul 2013 18:31:42 +0800 Subject: [PATCH 442/913] workqueue: allow work_on_cpu() to be called recursively If the @fn call work_on_cpu() again, the lockdep will complain: > [ INFO: possible recursive locking detected ] > 3.11.0-rc1-lockdep-fix-a #6 Not tainted > --------------------------------------------- > kworker/0:1/142 is trying to acquire lock: > ((&wfc.work)){+.+.+.}, at: [<ffffffff81077100>] flush_work+0x0/0xb0 > > but task is already holding lock: > ((&wfc.work)){+.+.+.}, at: [<ffffffff81075dd9>] process_one_work+0x169/0x610 > > other info that might help us debug this: > Possible unsafe locking scenario: > > CPU0 > ---- > lock((&wfc.work)); > lock((&wfc.work)); > > *** DEADLOCK *** It is false-positive lockdep report. In this sutiation, the two "wfc"s of the two work_on_cpu() are different, they are both on stack. flush_work() can't be deadlock. To fix this, we need to avoid the lockdep checking in this case, thus we instroduce a internal __flush_work() which skip the lockdep. tj: Minor comment adjustment. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Reported-by: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com> Reported-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Tejun Heo <tj@kernel.org> --- kernel/workqueue.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index f02c4a4a0c3c..55f5f0afcd0d 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -2817,6 +2817,19 @@ already_gone: return false; } +static bool __flush_work(struct work_struct *work) +{ + struct wq_barrier barr; + + if (start_flush_work(work, &barr)) { + wait_for_completion(&barr.done); + destroy_work_on_stack(&barr.work); + return true; + } else { + return false; + } +} + /** * flush_work - wait for a work to finish executing the last queueing instance * @work: the work to flush @@ -2830,18 +2843,10 @@ already_gone: */ bool flush_work(struct work_struct *work) { - struct wq_barrier barr; - lock_map_acquire(&work->lockdep_map); lock_map_release(&work->lockdep_map); - if (start_flush_work(work, &barr)) { - wait_for_completion(&barr.done); - destroy_work_on_stack(&barr.work); - return true; - } else { - return false; - } + return __flush_work(work); } EXPORT_SYMBOL_GPL(flush_work); @@ -4756,7 +4761,14 @@ long work_on_cpu(int cpu, long (*fn)(void *), void *arg) INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); schedule_work_on(cpu, &wfc.work); - flush_work(&wfc.work); + + /* + * The work item is on-stack and can't lead to deadlock through + * flushing. Use __flush_work() to avoid spurious lockdep warnings + * when work_on_cpu()s are nested. + */ + __flush_work(&wfc.work); + return wfc.ret; } EXPORT_SYMBOL_GPL(work_on_cpu); From 6a6c21ef487be47b300a0b24cd6afeb69d8b9a1a Mon Sep 17 00:00:00 2001 From: Richard Zhu <r65037@freescale.com> Date: Wed, 24 Jul 2013 14:15:28 +0800 Subject: [PATCH 443/913] ARM: imx6q: update the sata bits definitions of gpr13 Replace the SATA_PHY_# by the more readable definitons. tj: Being routed through libata branch to enable implementation of ahci_imx. Signed-off-by: Richard Zhu <r65037@freescale.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Tejun Heo <tj@kernel.org> --- include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 121 ++++++++++++++------ 1 file changed, 84 insertions(+), 37 deletions(-) diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h index dab34a1deb2c..e235251f1ba9 100644 --- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h +++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h @@ -279,41 +279,88 @@ #define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29) #define IMX6Q_GPR13_CAN1_STOP_REQ BIT(28) #define IMX6Q_GPR13_ENET_STOP_REQ BIT(27) -#define IMX6Q_GPR13_SATA_PHY_8_MASK (0x7 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_0_5_DB (0x0 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_1_0_DB (0x1 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_1_5_DB (0x2 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_2_0_DB (0x3 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_2_5_DB (0x4 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_3_0_DB (0x5 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_3_5_DB (0x6 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_4_0_DB (0x7 << 24) -#define IMX6Q_GPR13_SATA_PHY_7_MASK (0x1f << 19) -#define IMX6Q_GPR13_SATA_PHY_7_SATA1I (0x10 << 19) -#define IMX6Q_GPR13_SATA_PHY_7_SATA1M (0x10 << 19) -#define IMX6Q_GPR13_SATA_PHY_7_SATA1X (0x1a << 19) -#define IMX6Q_GPR13_SATA_PHY_7_SATA2I (0x12 << 19) -#define IMX6Q_GPR13_SATA_PHY_7_SATA2M (0x12 << 19) -#define IMX6Q_GPR13_SATA_PHY_7_SATA2X (0x1a << 19) -#define IMX6Q_GPR13_SATA_PHY_6_MASK (0x7 << 16) -#define IMX6Q_GPR13_SATA_SPEED_MASK BIT(15) -#define IMX6Q_GPR13_SATA_SPEED_1P5G 0x0 -#define IMX6Q_GPR13_SATA_SPEED_3P0G BIT(15) -#define IMX6Q_GPR13_SATA_PHY_5 BIT(14) -#define IMX6Q_GPR13_SATA_PHY_4_MASK (0x7 << 11) -#define IMX6Q_GPR13_SATA_PHY_4_16_16 (0x0 << 11) -#define IMX6Q_GPR13_SATA_PHY_4_14_16 (0x1 << 11) -#define IMX6Q_GPR13_SATA_PHY_4_12_16 (0x2 << 11) -#define IMX6Q_GPR13_SATA_PHY_4_10_16 (0x3 << 11) -#define IMX6Q_GPR13_SATA_PHY_4_9_16 (0x4 << 11) -#define IMX6Q_GPR13_SATA_PHY_4_8_16 (0x5 << 11) -#define IMX6Q_GPR13_SATA_PHY_3_MASK (0xf << 7) -#define IMX6Q_GPR13_SATA_PHY_3_OFF 0x7 -#define IMX6Q_GPR13_SATA_PHY_2_MASK (0x1f << 2) -#define IMX6Q_GPR13_SATA_PHY_2_OFF 0x2 -#define IMX6Q_GPR13_SATA_PHY_1_MASK (0x3 << 0) -#define IMX6Q_GPR13_SATA_PHY_1_FAST (0x0 << 0) -#define IMX6Q_GPR13_SATA_PHY_1_MED (0x1 << 0) -#define IMX6Q_GPR13_SATA_PHY_1_SLOW (0x2 << 0) - +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_MASK (0x7 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_0_5_DB (0x0 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_1_0_DB (0x1 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_1_5_DB (0x2 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_2_0_DB (0x3 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_2_5_DB (0x4 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_3_0_DB (0x5 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_3_5_DB (0x6 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_4_0_DB (0x7 << 24) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_MASK (0x1f << 19) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1I (0x10 << 19) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1M (0x10 << 19) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1X (0x1a << 19) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2I (0x12 << 19) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2M (0x12 << 19) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2X (0x1a << 19) +#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_MASK (0x7 << 16) +#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_1P_1F (0x0 << 16) +#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_2F (0x1 << 16) +#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_1P_4F (0x2 << 16) +#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_4F (0x3 << 16) +#define IMX6Q_GPR13_SATA_SPD_MODE_MASK BIT(15) +#define IMX6Q_GPR13_SATA_SPD_MODE_1P5G 0x0 +#define IMX6Q_GPR13_SATA_SPD_MODE_3P0G BIT(15) +#define IMX6Q_GPR13_SATA_MPLL_SS_EN BIT(14) +#define IMX6Q_GPR13_SATA_TX_ATTEN_MASK (0x7 << 11) +#define IMX6Q_GPR13_SATA_TX_ATTEN_16_16 (0x0 << 11) +#define IMX6Q_GPR13_SATA_TX_ATTEN_14_16 (0x1 << 11) +#define IMX6Q_GPR13_SATA_TX_ATTEN_12_16 (0x2 << 11) +#define IMX6Q_GPR13_SATA_TX_ATTEN_10_16 (0x3 << 11) +#define IMX6Q_GPR13_SATA_TX_ATTEN_9_16 (0x4 << 11) +#define IMX6Q_GPR13_SATA_TX_ATTEN_8_16 (0x5 << 11) +#define IMX6Q_GPR13_SATA_TX_BOOST_MASK (0xf << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_0_00_DB (0x0 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_0_37_DB (0x1 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_0_74_DB (0x2 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_1_11_DB (0x3 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_1_48_DB (0x4 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_1_85_DB (0x5 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_2_22_DB (0x6 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_2_59_DB (0x7 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_2_96_DB (0x8 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_3_33_DB (0x9 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_3_70_DB (0xa << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_4_07_DB (0xb << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_4_44_DB (0xc << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_4_81_DB (0xd << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_5_28_DB (0xe << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_5_75_DB (0xf << 7) +#define IMX6Q_GPR13_SATA_TX_LVL_MASK (0x1f << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_937_V (0x00 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_947_V (0x01 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_957_V (0x02 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_966_V (0x03 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_976_V (0x04 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_986_V (0x05 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_996_V (0x06 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_005_V (0x07 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_015_V (0x08 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_025_V (0x09 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_035_V (0x0a << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_045_V (0x0b << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_054_V (0x0c << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_064_V (0x0d << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_074_V (0x0e << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_084_V (0x0f << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_094_V (0x10 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_104_V (0x11 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_113_V (0x12 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_123_V (0x13 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_133_V (0x14 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_143_V (0x15 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_152_V (0x16 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_162_V (0x17 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_172_V (0x18 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_182_V (0x19 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_191_V (0x1a << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_201_V (0x1b << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_211_V (0x1c << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_221_V (0x1d << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_230_V (0x1e << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_240_V (0x1f << 2) +#define IMX6Q_GPR13_SATA_MPLL_CLK_EN BIT(1) +#define IMX6Q_GPR13_SATA_TX_EDGE_RATE BIT(0) #endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */ From 9e54eae23bc9cca0d8a955018c35b1250e09a73a Mon Sep 17 00:00:00 2001 From: Richard Zhu <r65037@freescale.com> Date: Wed, 24 Jul 2013 14:15:29 +0800 Subject: [PATCH 444/913] ahci_imx: add ahci sata support on imx platforms imx6q contains one Synopsys AHCI SATA controller, But it can't share ahci_platform driver with other controllers because there are some misalignments of the generic AHCI controller - the bits definitions of the HBA registers, the Vendor Specific registers, the AHCI PHY clock and the AHCI signals adjustment window(GPR13 register). - CAP_SSS(bit20) of the HOST_CAP is writable, default value is '0', should be configured to be '1' - bit0 (only one AHCI SATA port on imx6q) of the HOST_PORTS_IMPL should be set to be '1'.(default 0) - One Vendor Specific register HOST_TIMER1MS(offset:0xe0) should be configured regarding to the frequency of AHB bus clock. - Configurations of the AHCI PHY clock, and the signal parameters of the GPR13 Setup its own ahci sata driver, contained the imx6q specific initialized codes, re-use the generic ahci_platform driver, and keep the generic ahci_platform driver clean as much as possible. tj: patch description reformatted Signed-off-by: Richard Zhu <r65037@freescale.com> Reviewed-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Tejun Heo <tj@kernel.org> --- drivers/ata/Kconfig | 9 ++ drivers/ata/Makefile | 1 + drivers/ata/ahci_imx.c | 236 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 246 insertions(+) create mode 100644 drivers/ata/ahci_imx.c diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 5cddaf86cd0a..a4af0a2a089c 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -97,6 +97,15 @@ config SATA_AHCI_PLATFORM If unsure, say N. +config AHCI_IMX + tristate "Freescale i.MX AHCI SATA support" + depends on SATA_AHCI_PLATFORM + help + This option enables support for the Freescale i.MX SoC's + onboard AHCI SATA. + + If unsure, say N. + config SATA_FSL tristate "Freescale 3.0Gbps SATA support" depends on FSL_SOC diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index c04d0fd038a3..46518c622460 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o obj-$(CONFIG_SATA_SIL24) += sata_sil24.o obj-$(CONFIG_SATA_DWC) += sata_dwc_460ex.o obj-$(CONFIG_SATA_HIGHBANK) += sata_highbank.o libahci.o +obj-$(CONFIG_AHCI_IMX) += ahci_imx.o # SFF w/ custom DMA obj-$(CONFIG_PDC_ADMA) += pdc_adma.o diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c new file mode 100644 index 000000000000..58debb0acc3a --- /dev/null +++ b/drivers/ata/ahci_imx.c @@ -0,0 +1,236 @@ +/* + * Freescale IMX AHCI SATA platform driver + * Copyright 2013 Freescale Semiconductor, Inc. + * + * based on the AHCI SATA platform driver by Jeff Garzik and Anton Vorontsov + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> +#include <linux/ahci_platform.h> +#include <linux/of_device.h> +#include <linux/mfd/syscon.h> +#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> +#include "ahci.h" + +enum { + HOST_TIMER1MS = 0xe0, /* Timer 1-ms */ +}; + +struct imx_ahci_priv { + struct platform_device *ahci_pdev; + struct clk *sata_ref_clk; + struct clk *ahb_clk; + struct regmap *gpr; +}; + +static int imx6q_sata_init(struct device *dev, void __iomem *mmio) +{ + int ret = 0; + unsigned int reg_val; + struct imx_ahci_priv *imxpriv = dev_get_drvdata(dev->parent); + + imxpriv->gpr = + syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr"); + if (IS_ERR(imxpriv->gpr)) { + dev_err(dev, "failed to find fsl,imx6q-iomux-gpr regmap\n"); + return PTR_ERR(imxpriv->gpr); + } + + ret = clk_prepare_enable(imxpriv->sata_ref_clk); + if (ret < 0) { + dev_err(dev, "prepare-enable sata_ref clock err:%d\n", ret); + return ret; + } + + /* + * set PHY Paremeters, two steps to configure the GPR13, + * one write for rest of parameters, mask of first write + * is 0x07fffffd, and the other one write for setting + * the mpll_clk_en. + */ + regmap_update_bits(imxpriv->gpr, 0x34, IMX6Q_GPR13_SATA_RX_EQ_VAL_MASK + | IMX6Q_GPR13_SATA_RX_LOS_LVL_MASK + | IMX6Q_GPR13_SATA_RX_DPLL_MODE_MASK + | IMX6Q_GPR13_SATA_SPD_MODE_MASK + | IMX6Q_GPR13_SATA_MPLL_SS_EN + | IMX6Q_GPR13_SATA_TX_ATTEN_MASK + | IMX6Q_GPR13_SATA_TX_BOOST_MASK + | IMX6Q_GPR13_SATA_TX_LVL_MASK + | IMX6Q_GPR13_SATA_TX_EDGE_RATE + , IMX6Q_GPR13_SATA_RX_EQ_VAL_3_0_DB + | IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2M + | IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_4F + | IMX6Q_GPR13_SATA_SPD_MODE_3P0G + | IMX6Q_GPR13_SATA_MPLL_SS_EN + | IMX6Q_GPR13_SATA_TX_ATTEN_9_16 + | IMX6Q_GPR13_SATA_TX_BOOST_3_33_DB + | IMX6Q_GPR13_SATA_TX_LVL_1_025_V); + regmap_update_bits(imxpriv->gpr, 0x34, IMX6Q_GPR13_SATA_MPLL_CLK_EN, + IMX6Q_GPR13_SATA_MPLL_CLK_EN); + usleep_range(100, 200); + + /* + * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL, + * and IP vendor specific register HOST_TIMER1MS. + * Configure CAP_SSS (support stagered spin up). + * Implement the port0. + * Get the ahb clock rate, and configure the TIMER1MS register. + */ + reg_val = readl(mmio + HOST_CAP); + if (!(reg_val & HOST_CAP_SSS)) { + reg_val |= HOST_CAP_SSS; + writel(reg_val, mmio + HOST_CAP); + } + reg_val = readl(mmio + HOST_PORTS_IMPL); + if (!(reg_val & 0x1)) { + reg_val |= 0x1; + writel(reg_val, mmio + HOST_PORTS_IMPL); + } + + reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000; + writel(reg_val, mmio + HOST_TIMER1MS); + + return 0; +} + +static void imx6q_sata_exit(struct device *dev) +{ + struct imx_ahci_priv *imxpriv = dev_get_drvdata(dev->parent); + + regmap_update_bits(imxpriv->gpr, 0x34, IMX6Q_GPR13_SATA_MPLL_CLK_EN, + !IMX6Q_GPR13_SATA_MPLL_CLK_EN); + clk_disable_unprepare(imxpriv->sata_ref_clk); +} + +static struct ahci_platform_data imx6q_sata_pdata = { + .init = imx6q_sata_init, + .exit = imx6q_sata_exit, +}; + +static const struct of_device_id imx_ahci_of_match[] = { + { .compatible = "fsl,imx6q-ahci", .data = &imx6q_sata_pdata}, + {}, +}; +MODULE_DEVICE_TABLE(of, imx_ahci_of_match); + +static int imx_ahci_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct resource *mem, *irq, res[2]; + const struct of_device_id *of_id; + const struct ahci_platform_data *pdata = NULL; + struct imx_ahci_priv *imxpriv; + struct device *ahci_dev; + struct platform_device *ahci_pdev; + int ret; + + imxpriv = devm_kzalloc(dev, sizeof(*imxpriv), GFP_KERNEL); + if (!imxpriv) { + dev_err(dev, "can't alloc ahci_host_priv\n"); + return -ENOMEM; + } + + ahci_pdev = platform_device_alloc("ahci", -1); + if (!ahci_pdev) + return -ENODEV; + + ahci_dev = &ahci_pdev->dev; + ahci_dev->parent = dev; + + imxpriv->ahb_clk = devm_clk_get(dev, "ahb"); + if (IS_ERR(imxpriv->ahb_clk)) { + dev_err(dev, "can't get ahb clock.\n"); + ret = PTR_ERR(imxpriv->ahb_clk); + goto err_out; + } + + imxpriv->sata_ref_clk = devm_clk_get(dev, "sata_ref"); + if (IS_ERR(imxpriv->sata_ref_clk)) { + dev_err(dev, "can't get sata_ref clock.\n"); + ret = PTR_ERR(imxpriv->sata_ref_clk); + goto err_out; + } + + imxpriv->ahci_pdev = ahci_pdev; + platform_set_drvdata(pdev, imxpriv); + + of_id = of_match_device(imx_ahci_of_match, dev); + if (of_id) { + pdata = of_id->data; + } else { + ret = -EINVAL; + goto err_out; + } + + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!mem || !irq) { + dev_err(dev, "no mmio/irq resource\n"); + ret = -ENOMEM; + goto err_out; + } + + res[0] = *mem; + res[1] = *irq; + + ahci_dev->coherent_dma_mask = DMA_BIT_MASK(32); + ahci_dev->dma_mask = &ahci_dev->coherent_dma_mask; + ahci_dev->of_node = dev->of_node; + + ret = platform_device_add_resources(ahci_pdev, res, 2); + if (ret) + goto err_out; + + ret = platform_device_add_data(ahci_pdev, pdata, sizeof(*pdata)); + if (ret) + goto err_out; + + ret = platform_device_add(ahci_pdev); + if (ret) { +err_out: + platform_device_put(ahci_pdev); + return ret; + } + + return 0; +} + +static int imx_ahci_remove(struct platform_device *pdev) +{ + struct imx_ahci_priv *imxpriv = platform_get_drvdata(pdev); + struct platform_device *ahci_pdev = imxpriv->ahci_pdev; + + platform_device_unregister(ahci_pdev); + return 0; +} + +static struct platform_driver imx_ahci_driver = { + .probe = imx_ahci_probe, + .remove = imx_ahci_remove, + .driver = { + .name = "ahci-imx", + .owner = THIS_MODULE, + .of_match_table = imx_ahci_of_match, + }, +}; +module_platform_driver(imx_ahci_driver); + +MODULE_DESCRIPTION("Freescale i.MX AHCI SATA platform driver"); +MODULE_AUTHOR("Richard Zhu <Hong-Xing.Zhu@freescale.com>"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("ahci:imx"); From 932ef3685f287799fa844862d607a6b596ba5b9e Mon Sep 17 00:00:00 2001 From: Jingoo Han <jg1.han@samsung.com> Date: Wed, 24 Jul 2013 14:34:08 +0900 Subject: [PATCH 445/913] staging: tidspbridge: replace strict_strtol() with kstrtos32() The usage of strict_strtol() is not preferred, because strict_strtol() is obsolete. Thus, kstrtos32() should be used in order to convert a string to s32. Also, error handling is added to get rid of a __must_check warning. This fixes a memory corruption bug as well. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/staging/tidspbridge/pmgr/dbll.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c index c191ae203565..41e88abe47af 100644 --- a/drivers/staging/tidspbridge/pmgr/dbll.c +++ b/drivers/staging/tidspbridge/pmgr/dbll.c @@ -1120,8 +1120,11 @@ static int dbll_rmm_alloc(struct dynamic_loader_allocate *this, or DYN_EXTERNAL, then mem granularity information is present within the section name - only process if there are at least three tokens within the section name (just a minor optimization) */ - if (count >= 3) - strict_strtol(sz_last_token, 10, (long *)&req); + if (count >= 3) { + status = kstrtos32(sz_last_token, 10, &req); + if (status) + goto func_cont; + } if ((req == 0) || (req == 1)) { if (strcmp(sz_sec_last_token, "DYN_DARAM") == 0) { From 81b884c9dfe6753a78df0cbf4e96f095d718bd95 Mon Sep 17 00:00:00 2001 From: Lidza Louina <lidza.louina@gmail.com> Date: Wed, 24 Jul 2013 11:29:33 -0400 Subject: [PATCH 446/913] MAINTAINERS: Update the list of maintainers for staging/comedi driver. This patch updates the list of maintainers for the staging/comedi driver. Signed-off-by: Lidza Louina <lidza.louina@gmail.com> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- MAINTAINERS | 2 +- drivers/staging/comedi/TODO | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index bf61e04291ab..6ddb33d5c653 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7812,7 +7812,7 @@ F: drivers/staging/asus_oled/ STAGING - COMEDI M: Ian Abbott <abbotti@mev.co.uk> -M: Mori Hess <fmhess@users.sourceforge.net> +M: H Hartley Sweeten <hsweeten@visionengravers.com> S: Odd Fixes F: drivers/staging/comedi/ diff --git a/drivers/staging/comedi/TODO b/drivers/staging/comedi/TODO index b10f739b7e3e..fa8da9aada30 100644 --- a/drivers/staging/comedi/TODO +++ b/drivers/staging/comedi/TODO @@ -9,4 +9,4 @@ TODO: Please send patches to Greg Kroah-Hartman <greg@kroah.com> and copy: Ian Abbott <abbotti@mev.co.uk> - Frank Mori Hess <fmhess@users.sourceforge.net> + H Hartley Sweeten <hsweeten@visionengravers.com> From e1be09808e030d57bb743618eb41e2bc31dd464c Mon Sep 17 00:00:00 2001 From: James Bottomley <JBottomley@Parallels.com> Date: Wed, 24 Jul 2013 12:43:18 -0700 Subject: [PATCH 447/913] [SCSI] isci: fix breakage caused by >16byte CDB patch Oops, apparently no-one I cc'd at intel actually bothered to check this patch for the isci driver: commit e73823f7a2c921dcf068d34ea03bd682498d9e42 Author: James Bottomley <JBottomley@Parallels.com> Date: Tue May 7 15:38:18 2013 -0700 [SCSI] libsas: implement > 16 byte CDB support sci_swab32_cpy needs multiples of four, so for commands that aren't that, it's rounding the wrong way. fix by doing (len+3)/4 instead of len/4. Reported-by: Tony Luck <tony.luck@intel.com> Tested-by: Tony Luck <tony.luck@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com> --- drivers/scsi/isci/request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index 7b082157eb79..99d2930b18c8 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c @@ -185,7 +185,7 @@ static void sci_io_request_build_ssp_command_iu(struct isci_request *ireq) cmd_iu->_r_c = 0; sci_swab32_cpy(&cmd_iu->cdb, task->ssp_task.cmd->cmnd, - task->ssp_task.cmd->cmd_len / sizeof(u32)); + (task->ssp_task.cmd->cmd_len+3) / sizeof(u32)); } static void sci_task_request_build_ssp_task_iu(struct isci_request *ireq) From 2652c2163d781676284b2af494a97e64d65a5ee6 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Fri, 19 Jul 2013 08:53:13 +0300 Subject: [PATCH 448/913] TTY: snyclinkmp: calculating wrong addresses This is a static checker fix and I don't have a way to test it. But from the context it looks like this is a typo where SCABUFSIZE was intended instead of sizeof(SCABUFSIZE). SCABUFSIZE is 1024 and sizeof(int) is 4. I would suspect this is a bad bug. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/tty/synclinkmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c index ff171384ea52..dc6e96996ead 100644 --- a/drivers/tty/synclinkmp.c +++ b/drivers/tty/synclinkmp.c @@ -3478,7 +3478,7 @@ static int alloc_buf_list(SLMP_INFO *info) for ( i = 0; i < info->rx_buf_count; i++ ) { /* calculate and store physical address of this buffer entry */ info->rx_buf_list_ex[i].phys_entry = - info->buffer_list_phys + (i * sizeof(SCABUFSIZE)); + info->buffer_list_phys + (i * SCABUFSIZE); /* calculate and store physical address of */ /* next entry in cirular list of entries */ From 258a9fd17b92552637bc74776c11737e0472dc86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Nordstr=C3=B6m?= <henrik@henriknordstrom.net> Date: Tue, 23 Jul 2013 21:06:07 +0200 Subject: [PATCH 449/913] tty/8250_early: Don't truncate last character of options The earlier change to use strlcpy uncovered a bug in the options argument length calculation causing last character to be truncated. This makes the actual console to be configured with incorrect baudrate when specifying the console using console=uart,... syntax. Bug symptom seen in kernel log output: Kernel command line: console=uart,mmio,0x90000000,115200 Early serial console at MMIO 0x90000000 (options '11520') which then results in a invalid baud rate 11520 instead of the expected 115200 when the console is switched to ttyS0 later in the boot process. Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/tty/serial/8250/8250_early.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c index 721904f8efa9..946ddd2b3a54 100644 --- a/drivers/tty/serial/8250/8250_early.c +++ b/drivers/tty/serial/8250/8250_early.c @@ -193,7 +193,8 @@ static int __init parse_options(struct early_serial8250_device *device, if (options) { options++; device->baud = simple_strtoul(options, NULL, 0); - length = min(strcspn(options, " "), sizeof(device->options)); + length = min(strcspn(options, " ") + 1, + sizeof(device->options)); strlcpy(device->options, options, length); } else { device->baud = probe_baud(port); From 3bf5d350586d98eb28ab7f86ffbd66518ffd95d8 Mon Sep 17 00:00:00 2001 From: Richard Zhao <rizhao@nvidia.com> Date: Sun, 21 Jul 2013 10:43:26 +0800 Subject: [PATCH 450/913] serial: tegra: correct help message in Kconfig from 'ttyHS' to 'ttyTHS' ttyTHS is consistent with the name used in driver. Signed-off-by: Richard Zhao <rizhao@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/tty/serial/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 5e3d68917ffe..1456673bcca0 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -277,7 +277,7 @@ config SERIAL_TEGRA select SERIAL_CORE help Support for the on-chip UARTs on the NVIDIA Tegra series SOCs - providing /dev/ttyHS0, 1, 2, 3 and 4 (note, some machines may not + providing /dev/ttyTHS0, 1, 2, 3 and 4 (note, some machines may not provide all of these ports, depending on how the serial port are enabled). This driver uses the APB DMA to achieve higher baudrate and better performance. From de9c7602ca25f52bbfeb52e7d85765fe70b92dce Mon Sep 17 00:00:00 2001 From: Alex Williamson <alex.williamson@redhat.com> Date: Mon, 10 Jun 2013 16:40:56 -0600 Subject: [PATCH 451/913] vfio: Don't overreact to DEL_DEVICE BUS_NOTIFY_DEL_DEVICE triggers IOMMU drivers to remove devices from their iommu group, but there's really nothing we can do about it at this point. If the device is in use, then the vfio sub-driver will block the device_del from completing until it's released. If the device is not in use or not owned by a vfio sub-driver, then we really don't care that it's being removed. The current code can be triggered just by unloading an sr-iov driver (ex. igb) while the VFs are attached to vfio-pci because it makes an incorrect assumption about the ordering of driver remove callbacks vs the DEL_DEVICE notification. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> --- drivers/vfio/vfio.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index c488da5db7c7..6d18c3cafdd4 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c @@ -494,27 +494,6 @@ static int vfio_group_nb_add_dev(struct vfio_group *group, struct device *dev) return 0; } -static int vfio_group_nb_del_dev(struct vfio_group *group, struct device *dev) -{ - struct vfio_device *device; - - /* - * Expect to fall out here. If a device was in use, it would - * have been bound to a vfio sub-driver, which would have blocked - * in .remove at vfio_del_group_dev. Sanity check that we no - * longer track the device, so it's safe to remove. - */ - device = vfio_group_get_device(group, dev); - if (likely(!device)) - return 0; - - WARN("Device %s removed from live group %d!\n", dev_name(dev), - iommu_group_id(group->iommu_group)); - - vfio_device_put(device); - return 0; -} - static int vfio_group_nb_verify(struct vfio_group *group, struct device *dev) { /* We don't care what happens when the group isn't in use */ @@ -545,7 +524,13 @@ static int vfio_iommu_group_notifier(struct notifier_block *nb, vfio_group_nb_add_dev(group, dev); break; case IOMMU_GROUP_NOTIFY_DEL_DEVICE: - vfio_group_nb_del_dev(group, dev); + /* + * Nothing to do here. If the device is in use, then the + * vfio sub-driver should block the remove callback until + * it is unused. If the device is unused or attached to a + * stub driver, then it should be released and we don't + * care that it will be going away. + */ break; case IOMMU_GROUP_NOTIFY_BIND_DRIVER: pr_debug("%s: Device %s, group %d binding to driver\n", From c64019302bbb0b445484d870e674ab34a19a18a1 Mon Sep 17 00:00:00 2001 From: Alex Williamson <alex.williamson@redhat.com> Date: Mon, 10 Jun 2013 16:40:56 -0600 Subject: [PATCH 452/913] vfio: Ignore sprurious notifies Remove debugging WARN_ON if we get a spurious notify for a group that no longer exists. No reports of anyone hitting this, but it would likely be a race and not a bug if they did. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> --- drivers/vfio/vfio.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 6d18c3cafdd4..842f4507883e 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c @@ -510,13 +510,11 @@ static int vfio_iommu_group_notifier(struct notifier_block *nb, struct device *dev = data; /* - * Need to go through a group_lock lookup to get a reference or - * we risk racing a group being removed. Leave a WARN_ON for - * debuging, but if the group no longer exists, a spurious notify - * is harmless. + * Need to go through a group_lock lookup to get a reference or we + * risk racing a group being removed. Ignore spurious notifies. */ group = vfio_group_try_get(group); - if (WARN_ON(!group)) + if (!group) return NOTIFY_OK; switch (action) { From d24cdbfd28b7e0ffecb1e281d73e73c03a57f734 Mon Sep 17 00:00:00 2001 From: Alex Williamson <alex.williamson@redhat.com> Date: Mon, 10 Jun 2013 16:40:57 -0600 Subject: [PATCH 453/913] vfio-pci: Avoid deadlock on remove If an attempt is made to unbind a device from vfio-pci while that device is in use, the request is blocked until the device becomes unused. Unfortunately, that unbind path still grabs the device_lock, which certain things like __pci_reset_function() also want to take. This means we need to try to acquire the locks ourselves and use the pre-locked version, __pci_reset_function_locked(). Signed-off-by: Alex Williamson <alex.williamson@redhat.com> --- drivers/vfio/pci/vfio_pci.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index c5179e269df6..cef6002acbd4 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -137,8 +137,27 @@ static void vfio_pci_disable(struct vfio_pci_device *vdev) */ pci_write_config_word(pdev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE); - if (vdev->reset_works) - __pci_reset_function(pdev); + /* + * Careful, device_lock may already be held. This is the case if + * a driver unbind is blocked. Try to get the locks ourselves to + * prevent a deadlock. + */ + if (vdev->reset_works) { + bool reset_done = false; + + if (pci_cfg_access_trylock(pdev)) { + if (device_trylock(&pdev->dev)) { + __pci_reset_function_locked(pdev); + reset_done = true; + device_unlock(&pdev->dev); + } + pci_cfg_access_unlock(pdev); + } + + if (!reset_done) + pr_warn("%s: Unable to acquire locks for reset of %s\n", + __func__, dev_name(&pdev->dev)); + } pci_restore_state(pdev); } From 4ea72445bddd2ca09fc719065fc3c5a8bfc8ca10 Mon Sep 17 00:00:00 2001 From: Lekensteyn <lekensteyn@gmail.com> Date: Mon, 22 Jul 2013 09:53:30 +0200 Subject: [PATCH 454/913] r8169: fix lockdep warning when removing interface The work queue is initialised in rtl_open (when the interface goes up), but canceled in rtl_remove_one (when the PCI device gets removed). If the network interface is not brought up, then the work queue struct is not initialised. When the device is removed, the attempt to cancel the uninitialised work queue causes a lockdep warning. This patch fixes the issue by moving cancel_work_sync to rtl_close (to match rtl_open). (Note that rtl_close is also called via unregister_netdev in rtl_remove_one.) Signed-off-by: Peter Wu <lekensteyn@gmail.com> Acked-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/realtek/r8169.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 4106a743ca74..880015cae6a3 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -6468,6 +6468,8 @@ static int rtl8169_close(struct net_device *dev) rtl8169_down(dev); rtl_unlock_work(tp); + cancel_work_sync(&tp->wk.work); + free_irq(pdev->irq, dev); dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, @@ -6793,8 +6795,6 @@ static void rtl_remove_one(struct pci_dev *pdev) rtl8168_driver_stop(tp); } - cancel_work_sync(&tp->wk.work); - netif_napi_del(&tp->napi); unregister_netdev(dev); From 64d2c22a4cdd3ce752ca700964a6120049d78aed Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Mon, 22 Jul 2013 11:02:01 +0300 Subject: [PATCH 455/913] mlx5: use after free in mlx5_cmd_comp_handler() We can't dereference "ent" after passing it to free_cmd(). Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index 205753a04cfc..40374063c01e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -1113,7 +1113,13 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector) for (i = 0; i < (1 << cmd->log_sz); i++) { if (test_bit(i, &vector)) { + struct semaphore *sem; + ent = cmd->ent_arr[i]; + if (ent->page_queue) + sem = &cmd->pages_sem; + else + sem = &cmd->sem; ktime_get_ts(&ent->ts2); memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); dump_command(dev, ent, 0); @@ -1136,10 +1142,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector) } else { complete(&ent->done); } - if (ent->page_queue) - up(&cmd->pages_sem); - else - up(&cmd->sem); + up(sem); } } } From 1fad56424f5ad3ce4973505a357212b2e2282b3f Mon Sep 17 00:00:00 2001 From: Johan Hovold <jhovold@gmail.com> Date: Fri, 28 Jun 2013 12:24:26 +0200 Subject: [PATCH 456/913] USB: ti_usb_3410_5052: fix dynamic-id matching The driver failed to take the dynamic ids into account when determining the device type and therefore all devices were detected as 2-port devices when using the dynamic-id interface. Match on the usb-serial-driver field instead of doing redundant id-table searches. Reported-by: Anders Hammarquist <iko@iko.pp.se> Cc: stable <stable@vger.kernel.org> Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/ti_usb_3410_5052.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 7182bb774b79..375b5a400b6f 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -371,7 +371,7 @@ static int ti_startup(struct usb_serial *serial) usb_set_serial_data(serial, tdev); /* determine device type */ - if (usb_match_id(serial->interface, ti_id_table_3410)) + if (serial->type == &ti_1port_device) tdev->td_is_3410 = 1; dev_dbg(&dev->dev, "%s - device type is %s\n", __func__, tdev->td_is_3410 ? "3410" : "5052"); From f585a991e1d1612265f0d4e812f77e40dd54975b Mon Sep 17 00:00:00 2001 From: Jerry Snitselaar <jerry.snitselaar@oracle.com> Date: Mon, 22 Jul 2013 12:01:58 -0700 Subject: [PATCH 457/913] fib_trie: potential out of bounds access in trie_show_stats() With the <= max condition in the for loop, it will be always go 1 element further than needed. If the condition for the while loop is never met, then max is MAX_STAT_DEPTH, and for loop will walk off the end of nodesizes[]. Signed-off-by: Jerry Snitselaar <jerry.snitselaar@oracle.com> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/ipv4/fib_trie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 49616fed9340..108a1e9c9eac 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -2133,7 +2133,7 @@ static void trie_show_stats(struct seq_file *seq, struct trie_stat *stat) max--; pointers = 0; - for (i = 1; i <= max; i++) + for (i = 1; i < max; i++) if (stat->nodesizes[i] != 0) { seq_printf(seq, " %u: %u", i, stat->nodesizes[i]); pointers += (1<<i) * stat->nodesizes[i]; From 905a6f96a1b18e490a75f810d733ced93c39b0e5 Mon Sep 17 00:00:00 2001 From: Hannes Frederic Sowa <hannes@stressinduktion.org> Date: Mon, 22 Jul 2013 23:45:53 +0200 Subject: [PATCH 458/913] ipv6: take rtnl_lock and mark mrt6 table as freed on namespace cleanup Otherwise we end up dereferencing the already freed net->ipv6.mrt pointer which leads to a panic (from Srivatsa S. Bhat): BUG: unable to handle kernel paging request at ffff882018552020 IP: [<ffffffffa0366b02>] ip6mr_sk_done+0x32/0xb0 [ipv6] PGD 290a067 PUD 207ffe0067 PMD 207ff1d067 PTE 8000002018552060 Oops: 0000 [#1] SMP DEBUG_PAGEALLOC Modules linked in: ebtable_nat ebtables nfs fscache nf_conntrack_ipv4 nf_defrag_ipv4 ipt_REJECT xt_CHECKSUM iptable_mangle iptable_filter ip_tables nfsd lockd nfs_acl exportfs auth_rpcgss autofs4 sunrpc 8021q garp bridge stp llc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter +ip6_tables ipv6 vfat fat vhost_net macvtap macvlan vhost tun kvm_intel kvm uinput iTCO_wdt iTCO_vendor_support cdc_ether usbnet mii microcode i2c_i801 i2c_core lpc_ich mfd_core shpchp ioatdma dca mlx4_core be2net wmi acpi_cpufreq mperf ext4 jbd2 mbcache dm_mirror dm_region_hash dm_log dm_mod CPU: 0 PID: 7 Comm: kworker/u33:0 Not tainted 3.11.0-rc1-ea45e-a #4 Hardware name: IBM -[8737R2A]-/00Y2738, BIOS -[B2E120RUS-1.20]- 11/30/2012 Workqueue: netns cleanup_net task: ffff8810393641c0 ti: ffff881039366000 task.ti: ffff881039366000 RIP: 0010:[<ffffffffa0366b02>] [<ffffffffa0366b02>] ip6mr_sk_done+0x32/0xb0 [ipv6] RSP: 0018:ffff881039367bd8 EFLAGS: 00010286 RAX: ffff881039367fd8 RBX: ffff882018552000 RCX: dead000000200200 RDX: 0000000000000000 RSI: ffff881039367b68 RDI: ffff881039367b68 RBP: ffff881039367bf8 R08: ffff881039367b68 R09: 2222222222222222 R10: 2222222222222222 R11: 2222222222222222 R12: ffff882015a7a040 R13: ffff882014eb89c0 R14: ffff8820289e2800 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff88103fc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff882018552020 CR3: 0000000001c0b000 CR4: 00000000000407f0 Stack: ffff881039367c18 ffff882014eb89c0 ffff882015e28c00 0000000000000000 ffff881039367c18 ffffffffa034d9d1 ffff8820289e2800 ffff882014eb89c0 ffff881039367c58 ffffffff815bdecb ffffffff815bddf2 ffff882014eb89c0 Call Trace: [<ffffffffa034d9d1>] rawv6_close+0x21/0x40 [ipv6] [<ffffffff815bdecb>] inet_release+0xfb/0x220 [<ffffffff815bddf2>] ? inet_release+0x22/0x220 [<ffffffffa032686f>] inet6_release+0x3f/0x50 [ipv6] [<ffffffff8151c1d9>] sock_release+0x29/0xa0 [<ffffffff81525520>] sk_release_kernel+0x30/0x70 [<ffffffffa034f14b>] icmpv6_sk_exit+0x3b/0x80 [ipv6] [<ffffffff8152fff9>] ops_exit_list+0x39/0x60 [<ffffffff815306fb>] cleanup_net+0xfb/0x1a0 [<ffffffff81075e3a>] process_one_work+0x1da/0x610 [<ffffffff81075dc9>] ? process_one_work+0x169/0x610 [<ffffffff81076390>] worker_thread+0x120/0x3a0 [<ffffffff81076270>] ? process_one_work+0x610/0x610 [<ffffffff8107da2e>] kthread+0xee/0x100 [<ffffffff8107d940>] ? __init_kthread_worker+0x70/0x70 [<ffffffff8162a99c>] ret_from_fork+0x7c/0xb0 [<ffffffff8107d940>] ? __init_kthread_worker+0x70/0x70 Code: 20 48 89 5d e8 4c 89 65 f0 4c 89 6d f8 66 66 66 66 90 4c 8b 67 30 49 89 fd e8 db 3c 1e e1 49 8b 9c 24 90 08 00 00 48 85 db 74 06 <4c> 39 6b 20 74 20 bb f3 ff ff ff e8 8e 3c 1e e1 89 d8 4c 8b 65 RIP [<ffffffffa0366b02>] ip6mr_sk_done+0x32/0xb0 [ipv6] RSP <ffff881039367bd8> CR2: ffff882018552020 Reported-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Tested-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/ipv6/ip6mr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 583e8d435f9a..03986d31fa41 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -259,10 +259,12 @@ static void __net_exit ip6mr_rules_exit(struct net *net) { struct mr6_table *mrt, *next; + rtnl_lock(); list_for_each_entry_safe(mrt, next, &net->ipv6.mr6_tables, list) { list_del(&mrt->list); ip6mr_free_table(mrt); } + rtnl_unlock(); fib_rules_unregister(net->ipv6.mr6_rules_ops); } #else @@ -289,7 +291,10 @@ static int __net_init ip6mr_rules_init(struct net *net) static void __net_exit ip6mr_rules_exit(struct net *net) { + rtnl_lock(); ip6mr_free_table(net->ipv6.mrt6); + net->ipv6.mrt6 = NULL; + rtnl_unlock(); } #endif From 2bf420a7686e0fdd2fbf16d75e729b306744db0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= <emilio@elopez.com.ar> Date: Mon, 22 Jul 2013 22:09:18 -0300 Subject: [PATCH 459/913] net: sun4i: fix timeout check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current timeout check is comparing two constant values, so it won't ever detect a timeout. This patch reworks the affected code a bit so it has a chance at detecting timeouts correctly. Signed-off-by: Emilio López <emilio@elopez.com.ar> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/phy/mdio-sun4i.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/mdio-sun4i.c b/drivers/net/phy/mdio-sun4i.c index 61d3f4ebf52e..7f25e49ae37f 100644 --- a/drivers/net/phy/mdio-sun4i.c +++ b/drivers/net/phy/mdio-sun4i.c @@ -40,7 +40,7 @@ struct sun4i_mdio_data { static int sun4i_mdio_read(struct mii_bus *bus, int mii_id, int regnum) { struct sun4i_mdio_data *data = bus->priv; - unsigned long start_jiffies; + unsigned long timeout_jiffies; int value; /* issue the phy address and reg */ @@ -49,10 +49,9 @@ static int sun4i_mdio_read(struct mii_bus *bus, int mii_id, int regnum) writel(0x1, data->membase + EMAC_MAC_MCMD_REG); /* Wait read complete */ - start_jiffies = jiffies; + timeout_jiffies = jiffies + MDIO_TIMEOUT; while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) { - if (time_after(start_jiffies, - start_jiffies + MDIO_TIMEOUT)) + if (time_is_before_jiffies(timeout_jiffies)) return -ETIMEDOUT; msleep(1); } @@ -69,7 +68,7 @@ static int sun4i_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) { struct sun4i_mdio_data *data = bus->priv; - unsigned long start_jiffies; + unsigned long timeout_jiffies; /* issue the phy address and reg */ writel((mii_id << 8) | regnum, data->membase + EMAC_MAC_MADR_REG); @@ -77,10 +76,9 @@ static int sun4i_mdio_write(struct mii_bus *bus, int mii_id, int regnum, writel(0x1, data->membase + EMAC_MAC_MCMD_REG); /* Wait read complete */ - start_jiffies = jiffies; + timeout_jiffies = jiffies + MDIO_TIMEOUT; while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) { - if (time_after(start_jiffies, - start_jiffies + MDIO_TIMEOUT)) + if (time_is_before_jiffies(timeout_jiffies)) return -ETIMEDOUT; msleep(1); } From f82a3133c0c5625d54f3dd1621815b1cf77c8463 Mon Sep 17 00:00:00 2001 From: Olof Johansson <olof@lixom.net> Date: Wed, 24 Jul 2013 16:55:23 -0700 Subject: [PATCH 460/913] ARM: omap5: Only select errata 798181 if SMP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoids the following warning when SMP is off: warning: (ARCH_KEYSTONE && SOC_OMAP5) selects ARM_ERRATA_798181 which has unmet direct dependencies (CPU_V7 && SMP) Reported-by: Emilio López <emilio@elopez.com.ar> Cc: Tony Lindgren <tony@atomide.com> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com> Signed-off-by: Olof Johansson <olof@lixom.net> --- arch/arm/mach-omap2/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 627fa7e41fba..3eed0006d189 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -62,7 +62,7 @@ config SOC_OMAP5 select HAVE_SMP select COMMON_CLK select HAVE_ARM_ARCH_TIMER - select ARM_ERRATA_798181 + select ARM_ERRATA_798181 if SMP config SOC_AM33XX bool "AM33XX support" From deceb4c062a8dd63fe554c3be2b4bf9151a5cedf Mon Sep 17 00:00:00 2001 From: Florian Fainelli <f.fainelli@gmail.com> Date: Tue, 23 Jul 2013 20:22:39 +0100 Subject: [PATCH 461/913] net: fix comment above build_skb() build_skb() specifies that the data parameter must come from a kmalloc'd area, this is only true if frag_size equals 0, because then build_skb() will use kzsize(data) to figure out the actual data size. Update the comment to reflect that special condition. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/core/skbuff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 20e02d2605ec..3df4d4ccf440 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -309,7 +309,8 @@ EXPORT_SYMBOL(__alloc_skb); * @frag_size: size of fragment, or 0 if head was kmalloced * * Allocate a new &sk_buff. Caller provides space holding head and - * skb_shared_info. @data must have been allocated by kmalloc() + * skb_shared_info. @data must have been allocated by kmalloc() only if + * @frag_size is 0, otherwise data should come from the page allocator. * The return is the new skb buffer. * On a failure the return is %NULL, and @data is not freed. * Notes : From 63b5df963f52ccbab6fabedf05b7ac6b465789a4 Mon Sep 17 00:00:00 2001 From: Enrico Mioso <mrkiko.rs@gmail.com> Date: Thu, 25 Jul 2013 02:01:39 +0200 Subject: [PATCH 462/913] usb: serial: option: Add ONYX 3G device support This patch adds support for the ONYX 3G device (version 1) from ALFA NETWORK. Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/option.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index bd02f257de13..43093850045b 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -783,6 +783,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) }, From 9b0ee8cf70457520c144e944bcf8df2324bad880 Mon Sep 17 00:00:00 2001 From: Tsugikazu Shibata <tshibata@ab.jp.nec.com> Date: Thu, 25 Jul 2013 09:17:23 +0900 Subject: [PATCH 463/913] HOWTO ja_JP sync Attached is Documentation/ja_JP/HOWTO sync patch for 3.10. This patch was reviewed by Japanese translation community called JF. Signed-off-by: Tsugikazu Shibata <tshibata@ab.jp.nec.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- Documentation/ja_JP/HOWTO | 44 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO index 050d37fe6d40..8148a47fc70e 100644 --- a/Documentation/ja_JP/HOWTO +++ b/Documentation/ja_JP/HOWTO @@ -11,14 +11,14 @@ for non English (read: Japanese) speakers and is not intended as a fork. So if you have any comments or updates for this file, please try to update the original English file first. -Last Updated: 2011/03/31 +Last Updated: 2013/07/19 ================================== これは、 -linux-2.6.38/Documentation/HOWTO +linux-3.10/Documentation/HOWTO の和訳です。 -翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > -翻訳日: 2011/3/28 +翻訳団体: JF プロジェクト < http://linuxjf.sourceforge.jp/ > +翻訳日: 2013/7/19 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> 校正者: 松倉さん <nbh--mats at nifty dot com> 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> @@ -245,7 +245,7 @@ Linux カーネルソースツリーの中に含まれる、きれいにし、 自己参照方式で、索引がついた web 形式で、ソースコードを参照することが できます。この最新の素晴しいカーネルコードのリポジトリは以下で見つかり ます- - http://sosdg.org/~qiyong/lxr/ + http://lxr.linux.no/+trees 開発プロセス ----------------------- @@ -253,24 +253,24 @@ Linux カーネルソースツリーの中に含まれる、きれいにし、 Linux カーネルの開発プロセスは現在幾つかの異なるメインカーネル「ブラン チ」と多数のサブシステム毎のカーネルブランチから構成されます。 これらのブランチとは- - - メインの 2.6.x カーネルツリー - - 2.6.x.y -stable カーネルツリー - - 2.6.x -git カーネルパッチ + - メインの 3.x カーネルツリー + - 3.x.y -stable カーネルツリー + - 3.x -git カーネルパッチ - サブシステム毎のカーネルツリーとパッチ - - 統合テストのための 2.6.x -next カーネルツリー + - 統合テストのための 3.x -next カーネルツリー -2.6.x カーネルツリー +3.x カーネルツリー ----------------- -2.6.x カーネルは Linus Torvalds によってメンテナンスされ、kernel.org -の pub/linux/kernel/v2.6/ ディレクトリに存在します。この開発プロセスは +3.x カーネルは Linus Torvalds によってメンテナンスされ、kernel.org +の pub/linux/kernel/v3.x/ ディレクトリに存在します。この開発プロセスは 以下のとおり- - 新しいカーネルがリリースされた直後に、2週間の特別期間が設けられ、 この期間中に、メンテナ達は Linus に大きな差分を送ることができます。 このような差分は通常 -next カーネルに数週間含まれてきたパッチです。 大きな変更は git(カーネルのソース管理ツール、詳細は - http://git-scm.com/ 参照) を使って送るのが好ましいやり方ですが、パッ + http://git-scm.com/ 参照) を使って送るのが好ましいやり方ですが、パッ チファイルの形式のまま送るのでも十分です。 - 2週間後、-rc1 カーネルがリリースされ、この後にはカーネル全体の安定 @@ -302,20 +302,20 @@ Andrew Morton が Linux-kernel メーリングリストにカーネルリリー 実に認識されたバグの状況によりリリースされるのであり、前もって決めら れた計画によってリリースされるものではないからです。」 -2.6.x.y -stable カーネルツリー +3.x.y -stable カーネルツリー --------------------------- -バージョン番号が4つの数字に分かれているカーネルは -stable カーネルです。 -これには、2.6.x カーネルで見つかったセキュリティ問題や重大な後戻りに対 +バージョン番号が3つの数字に分かれているカーネルは -stable カーネルです。 +これには、3.x カーネルで見つかったセキュリティ問題や重大な後戻りに対 する比較的小さい重要な修正が含まれます。 これは、開発/実験的バージョンのテストに協力することに興味が無く、 最新の安定したカーネルを使いたいユーザに推奨するブランチです。 -もし、2.6.x.y カーネルが存在しない場合には、番号が一番大きい 2.6.x が +もし、3.x.y カーネルが存在しない場合には、番号が一番大きい 3.x が 最新の安定版カーネルです。 -2.6.x.y は "stable" チーム <stable@kernel.org> でメンテされており、必 +3.x.y は "stable" チーム <stable@kernel.org> でメンテされており、必 要に応じてリリースされます。通常のリリース期間は 2週間毎ですが、差し迫っ た問題がなければもう少し長くなることもあります。セキュリティ関連の問題 の場合はこれに対してだいたいの場合、すぐにリリースがされます。 @@ -324,7 +324,7 @@ Andrew Morton が Linux-kernel メーリングリストにカーネルリリー イルにはどのような種類の変更が -stable ツリーに受け入れ可能か、またリ リースプロセスがどう動くかが記述されています。 -2.6.x -git パッチ +3.x -git パッチ ------------------ git リポジトリで管理されているLinus のカーネルツリーの毎日のスナップ @@ -358,14 +358,14 @@ quilt シリーズとして公開されているパッチキューも使われ をつけることができます。大部分のこれらの patchwork のサイトは http://patchwork.kernel.org/ でリストされています。 -統合テストのための 2.6.x -next カーネルツリー +統合テストのための 3.x -next カーネルツリー --------------------------------------------- -サブシステムツリーの更新内容がメインラインの 2.6.x ツリーにマージされ +サブシステムツリーの更新内容がメインラインの 3.x ツリーにマージされ る前に、それらは統合テストされる必要があります。この目的のため、実質的 に全サブシステムツリーからほぼ毎日プルされてできる特別なテスト用のリ ポジトリが存在します- - http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git + http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git http://linux.f-seidel.de/linux-next/pmwiki/ このやり方によって、-next カーネルは次のマージ機会でどんなものがメイン From 16b551dd22cc7edacb952f7a2e175f36c3aa4bdb Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Date: Wed, 24 Jul 2013 17:50:50 -0700 Subject: [PATCH 464/913] ARM: shmobile: armadillo800eva: Don't request GPIO 166 in board code 89ae7b5bbd3e65bc6ab7a577ca5ec18569589c8c (ARM: shmobile: armadillo800eva: Register pinctrl mapping for INTC) mistakenly requests GPIO 166 in board code, most probably due to a wrong merge conflict resolution. As the GPIO is passed to the st1232 driver through platform data and requested by the driver, there's no need to request it in board code. Fix it. Tested by: Cao Minh Hiep <cm-hiep@jinso.co.jp> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au> --- arch/arm/mach-shmobile/board-armadillo800eva.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index e115f6742107..c5be60d85e4b 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c @@ -1162,9 +1162,6 @@ static void __init eva_init(void) gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */ - /* Touchscreen */ - gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */ - /* GETHER */ gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */ From 0eb25bb027a100f5a9df8991f2f628e7d851bc1e Mon Sep 17 00:00:00 2001 From: NeilBrown <neilb@suse.de> Date: Wed, 24 Jul 2013 15:37:42 +1000 Subject: [PATCH 465/913] md/raid10: remove use-after-free bug. We always need to be careful when calling generic_make_request, as it can start a chain of events which might free something that we are using. Here is one place I wasn't careful enough. If the wbio2 is not in use, then it might get freed at the first generic_make_request call. So perform all necessary tests first. This bug was introduced in 3.3-rc3 (24afd80d99) and can cause an oops, so fix is suitable for any -stable since then. Cc: stable@vger.kernel.org (3.3+) Signed-off-by: NeilBrown <neilb@suse.de> --- drivers/md/raid10.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 957a719e8c2f..df7b0a06b0ea 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -2290,12 +2290,18 @@ static void recovery_request_write(struct mddev *mddev, struct r10bio *r10_bio) d = r10_bio->devs[1].devnum; wbio = r10_bio->devs[1].bio; wbio2 = r10_bio->devs[1].repl_bio; + /* Need to test wbio2->bi_end_io before we call + * generic_make_request as if the former is NULL, + * the latter is free to free wbio2. + */ + if (wbio2 && !wbio2->bi_end_io) + wbio2 = NULL; if (wbio->bi_end_io) { atomic_inc(&conf->mirrors[d].rdev->nr_pending); md_sync_acct(conf->mirrors[d].rdev->bdev, bio_sectors(wbio)); generic_make_request(wbio); } - if (wbio2 && wbio2->bi_end_io) { + if (wbio2) { atomic_inc(&conf->mirrors[d].replacement->nr_pending); md_sync_acct(conf->mirrors[d].replacement->bdev, bio_sectors(wbio2)); From f94c0b6658c7edea8bc19d13be321e3860a3fa54 Mon Sep 17 00:00:00 2001 From: NeilBrown <neilb@suse.de> Date: Mon, 22 Jul 2013 12:57:21 +1000 Subject: [PATCH 466/913] md/raid5: fix interaction of 'replace' and 'recovery'. If a device in a RAID4/5/6 is being replaced while another is being recovered, then the writes to the replacement device currently don't happen, resulting in corruption when the replacement completes and the new drive takes over. This is because the replacement writes are only triggered when 's.replacing' is set and not when the similar 's.sync' is set (which is the case during resync and recovery - it means all devices need to be read). So schedule those writes when s.replacing is set as well. In this case we cannot use "STRIPE_INSYNC" to record that the replacement has happened as that is needed for recording that any parity calculation is complete. So introduce STRIPE_REPLACED to record if the replacement has happened. For safety we should also check that STRIPE_COMPUTE_RUN is not set. This has a similar effect to the "s.locked == 0" test. The latter ensure that now IO has been flagged but not started. The former checks if any parity calculation has been flagged by not started. We must wait for both of these to complete before triggering the 'replace'. Add a similar test to the subsequent check for "are we finished yet". This possibly isn't needed (is subsumed in the STRIPE_INSYNC test), but it makes it more obvious that the REPLACE will happen before we think we are finished. Finally if a NeedReplace device is not UPTODATE then that is an error. We really must trigger a warning. This bug was introduced in commit 9a3e1101b827a59ac9036a672f5fa8d5279d0fe2 (md/raid5: detect and handle replacements during recovery.) which introduced replacement for raid5. That was in 3.3-rc3, so any stable kernel since then would benefit from this fix. Cc: stable@vger.kernel.org (3.3+) Reported-by: qindehua <13691222965@163.com> Tested-by: qindehua <qindehua@163.com> Signed-off-by: NeilBrown <neilb@suse.de> --- drivers/md/raid5.c | 15 ++++++++++----- drivers/md/raid5.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 2bf094a587cb..78ea44336e75 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3462,6 +3462,7 @@ static void handle_stripe(struct stripe_head *sh) test_and_clear_bit(STRIPE_SYNC_REQUESTED, &sh->state)) { set_bit(STRIPE_SYNCING, &sh->state); clear_bit(STRIPE_INSYNC, &sh->state); + clear_bit(STRIPE_REPLACED, &sh->state); } spin_unlock(&sh->stripe_lock); } @@ -3607,19 +3608,23 @@ static void handle_stripe(struct stripe_head *sh) handle_parity_checks5(conf, sh, &s, disks); } - if (s.replacing && s.locked == 0 - && !test_bit(STRIPE_INSYNC, &sh->state)) { + if ((s.replacing || s.syncing) && s.locked == 0 + && !test_bit(STRIPE_COMPUTE_RUN, &sh->state) + && !test_bit(STRIPE_REPLACED, &sh->state)) { /* Write out to replacement devices where possible */ for (i = 0; i < conf->raid_disks; i++) - if (test_bit(R5_UPTODATE, &sh->dev[i].flags) && - test_bit(R5_NeedReplace, &sh->dev[i].flags)) { + if (test_bit(R5_NeedReplace, &sh->dev[i].flags)) { + WARN_ON(!test_bit(R5_UPTODATE, &sh->dev[i].flags)); set_bit(R5_WantReplace, &sh->dev[i].flags); set_bit(R5_LOCKED, &sh->dev[i].flags); s.locked++; } - set_bit(STRIPE_INSYNC, &sh->state); + if (s.replacing) + set_bit(STRIPE_INSYNC, &sh->state); + set_bit(STRIPE_REPLACED, &sh->state); } if ((s.syncing || s.replacing) && s.locked == 0 && + !test_bit(STRIPE_COMPUTE_RUN, &sh->state) && test_bit(STRIPE_INSYNC, &sh->state)) { md_done_sync(conf->mddev, STRIPE_SECTORS, 1); clear_bit(STRIPE_SYNCING, &sh->state); diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index b0b663b119a8..70c49329ca9a 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h @@ -306,6 +306,7 @@ enum { STRIPE_SYNC_REQUESTED, STRIPE_SYNCING, STRIPE_INSYNC, + STRIPE_REPLACED, STRIPE_PREREAD_ACTIVE, STRIPE_DELAYED, STRIPE_DEGRADED, From 23df0b731954502a9391e739b92927cee4360343 Mon Sep 17 00:00:00 2001 From: Arik Nemtsov <arik@wizery.com> Date: Sun, 21 Jul 2013 16:36:48 +0300 Subject: [PATCH 467/913] regulatory: use correct regulatory initiator on wiphy register The current regdomain was not always set by the core. This causes cards with a custom regulatory domain to ignore user initiated changes if done before the card was registered. Signed-off-by: Arik Nemtsov <arik@wizery.com> Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- net/wireless/reg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 5a950f36bae4..de06d5d1287f 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2247,10 +2247,13 @@ int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env) void wiphy_regulatory_register(struct wiphy *wiphy) { + struct regulatory_request *lr; + if (!reg_dev_ignore_cell_hint(wiphy)) reg_num_devs_support_basehint++; - wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE); + lr = get_last_request(); + wiphy_update_regulatory(wiphy, lr->initiator); } void wiphy_regulatory_deregister(struct wiphy *wiphy) From 14c5cec5d0cd73e7e9d4fbea2bbfeea8f3ade871 Mon Sep 17 00:00:00 2001 From: Jani Nikula <jani.nikula@linux.intel.com> Date: Thu, 25 Jul 2013 12:44:34 +0300 Subject: [PATCH 468/913] drm/i915: initialize gt_lock early with other spin locks commit 181d1b9e31c668259d3798c521672afb8edd355c Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Sun Jul 21 13:16:24 2013 +0200 drm/i915: fix up gt init sequence fallout moved dev_priv->gt_lock initialization after use. Do the initialization much earlier with other spin lock initializations. Reported-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> Cc: stable@vger.kernel.org (since the regressing patch is also cc: stable) Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/i915_dma.c | 1 + drivers/gpu/drm/i915/intel_pm.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 67ec54f67afe..b1520682cb23 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1498,6 +1498,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) spin_lock_init(&dev_priv->irq_lock); spin_lock_init(&dev_priv->gpu_error.lock); spin_lock_init(&dev_priv->rps.lock); + spin_lock_init(&dev_priv->gt_lock); spin_lock_init(&dev_priv->backlight.lock); mutex_init(&dev_priv->dpio_lock); mutex_init(&dev_priv->rps.hw_lock); diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 6a347f54d39f..51a2a60f5bfc 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5497,8 +5497,6 @@ void intel_gt_init(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; - spin_lock_init(&dev_priv->gt_lock); - if (IS_VALLEYVIEW(dev)) { dev_priv->gt.force_wake_get = vlv_force_wake_get; dev_priv->gt.force_wake_put = vlv_force_wake_put; From 203a86613fb3bf2767335659513fa98563a3eb71 Mon Sep 17 00:00:00 2001 From: Sarah Sharp <sarah.a.sharp@linux.intel.com> Date: Wed, 24 Jul 2013 10:27:13 -0700 Subject: [PATCH 469/913] xhci: Avoid NULL pointer deref when host dies. When the host controller fails to respond to an Enable Slot command, and the host fails to respond to the register write to abort the command ring, the xHCI driver will assume the host is dead, and call usb_hc_died(). The USB device's slot_id is still set to zero, and the pointer stored at xhci->devs[0] will always be NULL. The call to xhci_check_args in xhci_free_dev should have caught the NULL virt_dev pointer. However, xhci_free_dev is designed to free the xhci_virt_device structures, even if the host is dead, so that we don't leak kernel memory. xhci_free_dev checks the return value from the generic xhci_check_args function. If the return value is -ENODEV, it carries on trying to free the virtual device. The issue is that xhci_check_args looks at the host controller state before it looks at the xhci_virt_device pointer. It will return -ENIVAL because the host is dead, and xhci_free_dev will ignore the return value, and happily dereference the NULL xhci_virt_device pointer. The fix is to make sure that xhci_check_args checks the xhci_virt_device pointer before it checks the host state. See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1203453 for further details. This patch doesn't solve the underlying issue, but will ensure we don't see any more NULL pointer dereferences because of the issue. This patch should be backported to kernels as old as 3.1, that contain the commit 7bd89b4017f46a9b92853940fd9771319acb578a "xhci: Don't submit commands or URBs to halted hosts." Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Reported-by: Vincent Thiele <vincentthiele@gmail.com> Cc: stable@vger.kernel.org --- drivers/usb/host/xhci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 2c49f00260ca..98aac742a2c1 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1181,9 +1181,6 @@ static int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev, } xhci = hcd_to_xhci(hcd); - if (xhci->xhc_state & XHCI_STATE_HALTED) - return -ENODEV; - if (check_virt_dev) { if (!udev->slot_id || !xhci->devs[udev->slot_id]) { printk(KERN_DEBUG "xHCI %s called with unaddressed " @@ -1199,6 +1196,9 @@ static int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev, } } + if (xhci->xhc_state & XHCI_STATE_HALTED) + return -ENODEV; + return 1; } From d5c82feb5cf8026cd4af048330fdcd46e861c686 Mon Sep 17 00:00:00 2001 From: Olof Johansson <olof@lixom.net> Date: Tue, 23 Jul 2013 11:58:20 -0700 Subject: [PATCH 470/913] usb: xhci: Mark two functions __maybe_unused Resolves the following build warnings: drivers/usb/host/xhci.c:332:13: warning: 'xhci_msix_sync_irqs' defined but not used [-Wunused-function] drivers/usb/host/xhci.c:3901:12: warning: 'xhci_change_max_exit_latency' defined but not used [-Wunused-function] These functions are not always used, and since they're marked static they will produce build warnings: - xhci_msix_sync_irqs is only used with CONFIG_PCI. - xhci_change_max_exit_latency is a little more complicated with dependencies on CONFIG_PM and CONFIG_PM_RUNTIME. Instead of building a bigger maze of ifdefs in this code, I've just marked both with __maybe_unused. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> --- drivers/usb/host/xhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 98aac742a2c1..6bbf511645eb 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -329,7 +329,7 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci) return; } -static void xhci_msix_sync_irqs(struct xhci_hcd *xhci) +static void __maybe_unused xhci_msix_sync_irqs(struct xhci_hcd *xhci) { int i; @@ -3898,7 +3898,7 @@ int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1) * Issue an Evaluate Context command to change the Maximum Exit Latency in the * slot context. If that succeeds, store the new MEL in the xhci_virt_device. */ -static int xhci_change_max_exit_latency(struct xhci_hcd *xhci, +static int __maybe_unused xhci_change_max_exit_latency(struct xhci_hcd *xhci, struct usb_device *udev, u16 max_exit_latency) { struct xhci_virt_device *virt_dev; From c4d949b76f2c714e0da20c53252e586e8127ac79 Mon Sep 17 00:00:00 2001 From: Randy Dunlap <rdunlap@infradead.org> Date: Tue, 23 Jul 2013 15:22:59 -0700 Subject: [PATCH 471/913] usb: fix build warning in pci-quirks.h when CONFIG_PCI is not enabled Fix warning when CONFIG_PCI is not enabled (from commit 296365781903226a3fb8758901eaeec09d2798e4). drivers/usb/host/pci-quirks.h: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Moiz Sonasath <m-sonasath@ti.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> --- drivers/usb/host/pci-quirks.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h index 4b8a2092432f..978c849f9c9a 100644 --- a/drivers/usb/host/pci-quirks.h +++ b/drivers/usb/host/pci-quirks.h @@ -13,6 +13,7 @@ void usb_enable_xhci_ports(struct pci_dev *xhci_pdev); void usb_disable_xhci_ports(struct pci_dev *xhci_pdev); void sb800_prefetch(struct device *dev, int on); #else +struct pci_dev; static inline void usb_amd_quirk_pll_disable(void) {} static inline void usb_amd_quirk_pll_enable(void) {} static inline void usb_amd_dev_put(void) {} From 07f3cb7c28bf3f4dd80bfb136cf45810c46ac474 Mon Sep 17 00:00:00 2001 From: George Cherian <george.cherian@ti.com> Date: Mon, 1 Jul 2013 10:59:12 +0530 Subject: [PATCH 472/913] usb: host: xhci: Enable XHCI_SPURIOUS_SUCCESS for all controllers with xhci 1.0 Xhci controllers with hci_version > 0.96 gives spurious success events on short packet completion. During webcam capture the "ERROR Transfer event TRB DMA ptr not part of current TD" was observed. The same application works fine with synopsis controllers hci_version 0.96. The same issue is seen with Intel Pantherpoint xhci controller. So enabling this quirk in xhci_gen_setup if controller verion is greater than 0.96. For xhci-pci move the quirk to much generic place xhci_gen_setup. Note from Sarah: The xHCI 1.0 spec changed how hardware handles short packets. The HW will notify SW of the TRB where the short packet occurred, and it will also give a successful status for the last TRB in a TD (the one with the IOC flag set). On the second successful status, that warning will be triggered in the driver. Software is now supposed to not assume the TD is not completed until it gets that last successful status. That means we have a slight race condition, although it should have little practical impact. This patch papers over that issue. It's on my long-term to-do list to fix this race condition, but it is a much more involved patch that will probably be too big for stable. This patch is needed for stable to avoid serious log spam. This patch should be backported to kernels as old as 3.0, that contain the commit ad808333d8201d53075a11bc8dd83b81f3d68f0b "Intel xhci: Ignore spurious successful event." The patch will have to be modified for kernels older than 3.2, since that kernel added the xhci_gen_setup function for xhci platform devices. The correct conflict resolution for kernels older than 3.2 is to set XHCI_SPURIOUS_SUCCESS in xhci_pci_quirks for all xHCI 1.0 hosts. Signed-off-by: George Cherian <george.cherian@ti.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: stable@vger.kernel.org --- drivers/usb/host/xhci-pci.c | 1 - drivers/usb/host/xhci.c | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index cc24e39b97d5..f00cb203faea 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -93,7 +93,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) } if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) { - xhci->quirks |= XHCI_SPURIOUS_SUCCESS; xhci->quirks |= XHCI_EP_LIMIT_QUIRK; xhci->limit_active_eps = 64; xhci->quirks |= XHCI_SW_BW_CHECKING; diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 6bbf511645eb..41eb4fc33453 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4892,6 +4892,13 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) get_quirks(dev, xhci); + /* In xhci controllers which follow xhci 1.0 spec gives a spurious + * success event after a short transfer. This quirk will ignore such + * spurious event. + */ + if (xhci->hci_version > 0x96) + xhci->quirks |= XHCI_SPURIOUS_SUCCESS; + /* Make sure the HC is halted. */ retval = xhci_halt(xhci); if (retval) From d66eaf9f89502971fddcb0de550b01fa6f409d83 Mon Sep 17 00:00:00 2001 From: Oleksij Rempel <linux@rempel-privat.de> Date: Sun, 21 Jul 2013 15:36:19 +0200 Subject: [PATCH 473/913] xhci: fix null pointer dereference on ring_doorbell_for_active_rings in some cases where device is attched to xhci port and do not responding, for example ath9k_htc with stalled firmware, kernel will crash on ring_doorbell_for_active_rings. This patch check if pointer exist before it is used. This patch should be backported to kernels as old as 2.6.35, that contain the commit e9df17eb1408cfafa3d1844bfc7f22c7237b31b8 "USB: xhci: Correct assumptions about number of rings per endpoint" Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: stable@vger.kernel.org --- drivers/usb/host/xhci-ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 1e57eafa6910..5b08cd85f8e7 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -434,7 +434,7 @@ static void ring_doorbell_for_active_rings(struct xhci_hcd *xhci, /* A ring has pending URBs if its TD list is not empty */ if (!(ep->ep_state & EP_HAS_STREAMS)) { - if (!(list_empty(&ep->ring->td_list))) + if (ep->ring && !(list_empty(&ep->ring->td_list))) xhci_ring_ep_doorbell(xhci, slot_id, ep_index, 0); return; } From db6c2c69c27f2c4fd1e2a1c6b0b1119b1e885f8a Mon Sep 17 00:00:00 2001 From: Linus Walleij <linus.walleij@linaro.org> Date: Tue, 23 Jul 2013 01:43:20 +0200 Subject: [PATCH 474/913] pinctrl: fix a memleak when freeing maps We forgot to free the node itself when free:ing a map. Reported-by: xulinuxkernel <xulinuxkernel@gmail.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/pinctrl/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 5b272bfd261d..2a00239661b3 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -1193,6 +1193,7 @@ void pinctrl_unregister_map(struct pinctrl_map const *map) list_for_each_entry(maps_node, &pinctrl_maps, node) { if (maps_node->maps == map) { list_del(&maps_node->node); + kfree(maps_node); mutex_unlock(&pinctrl_maps_mutex); return; } From e1b4271ac261b290fdab51446996fb13e68a57be Mon Sep 17 00:00:00 2001 From: Dave Chinner <dchinner@redhat.com> Date: Wed, 24 Jul 2013 15:47:30 +1000 Subject: [PATCH 475/913] xfs: di_flushiter considered harmful When we made all inode updates transactional, we no longer needed the log recovery detection for inodes being newer on disk than the transaction being replayed - it was redundant as replay of the log would always result in the latest version of the inode would be on disk. It was redundant, but left in place because it wasn't considered to be a problem. However, with the new "don't read inodes on create" optimisation, flushiter has come back to bite us. Essentially, the optimisation made always initialises flushiter to zero in the create transaction, and so if we then crash and run recovery and the inode already on disk has a non-zero flushiter it will skip recovery of that inode. As a result, log recovery does the wrong thing and we end up with a corrupt filesystem. Because we have to support old kernel to new kernel upgrades, we can't just get rid of the flushiter support in log recovery as we might be upgrading from a kernel that doesn't have fully transactional inode updates. Unfortunately, for v4 superblocks there is no way to guarantee that log recovery knows about this fact. We cannot add a new inode format flag to say it's a "special inode create" because it won't be understood by older kernels and so recovery could do the wrong thing on downgrade. We cannot specially detect the combination of zero mode/non-zero flushiter on disk to non-zero mode, zero flushiter in the log item during recovery because wrapping of the flushiter can result in false detection. Hence that makes this "don't use flushiter" optimisation limited to a disk format that guarantees that we don't need it. And that means the only fix here is to limit the "no read IO on create" optimisation to version 5 superblocks.... Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de> Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com> (cherry picked from commit e60896d8f2b81412421953e14d3feb14177edb56) --- fs/xfs/xfs_dinode.h | 3 +++ fs/xfs/xfs_inode.c | 31 ++++++++++++++++++++++--------- fs/xfs/xfs_log_recover.c | 13 +++++++++++-- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h index 07d735a80a0f..e5869b50dc41 100644 --- a/fs/xfs/xfs_dinode.h +++ b/fs/xfs/xfs_dinode.h @@ -39,6 +39,9 @@ typedef struct xfs_timestamp { * There is a very similar struct icdinode in xfs_inode which matches the * layout of the first 96 bytes of this structure, but is kept in native * format instead of big endian. + * + * Note: di_flushiter is only used by v1/2 inodes - it's effectively a zeroed + * padding field for v3 inodes. */ typedef struct xfs_dinode { __be16 di_magic; /* inode magic # = XFS_DINODE_MAGIC */ diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index b78481f99d9d..bb262c25c8de 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -896,7 +896,6 @@ xfs_dinode_to_disk( to->di_projid_lo = cpu_to_be16(from->di_projid_lo); to->di_projid_hi = cpu_to_be16(from->di_projid_hi); memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad)); - to->di_flushiter = cpu_to_be16(from->di_flushiter); to->di_atime.t_sec = cpu_to_be32(from->di_atime.t_sec); to->di_atime.t_nsec = cpu_to_be32(from->di_atime.t_nsec); to->di_mtime.t_sec = cpu_to_be32(from->di_mtime.t_sec); @@ -924,6 +923,9 @@ xfs_dinode_to_disk( to->di_lsn = cpu_to_be64(from->di_lsn); memcpy(to->di_pad2, from->di_pad2, sizeof(to->di_pad2)); uuid_copy(&to->di_uuid, &from->di_uuid); + to->di_flushiter = 0; + } else { + to->di_flushiter = cpu_to_be16(from->di_flushiter); } } @@ -1029,10 +1031,14 @@ xfs_dinode_calc_crc( /* * Read the disk inode attributes into the in-core inode structure. * - * If we are initialising a new inode and we are not utilising the - * XFS_MOUNT_IKEEP inode cluster mode, we can simple build the new inode core - * with a random generation number. If we are keeping inodes around, we need to - * read the inode cluster to get the existing generation number off disk. + * For version 5 superblocks, if we are initialising a new inode and we are not + * utilising the XFS_MOUNT_IKEEP inode cluster mode, we can simple build the new + * inode core with a random generation number. If we are keeping inodes around, + * we need to read the inode cluster to get the existing generation number off + * disk. Further, if we are using version 4 superblocks (i.e. v1/v2 inode + * format) then log recovery is dependent on the di_flushiter field being + * initialised from the current on-disk value and hence we must also read the + * inode off disk. */ int xfs_iread( @@ -1054,6 +1060,7 @@ xfs_iread( /* shortcut IO on inode allocation if possible */ if ((iget_flags & XFS_IGET_CREATE) && + xfs_sb_version_hascrc(&mp->m_sb) && !(mp->m_flags & XFS_MOUNT_IKEEP)) { /* initialise the on-disk inode core */ memset(&ip->i_d, 0, sizeof(ip->i_d)); @@ -2882,12 +2889,18 @@ xfs_iflush_int( __func__, ip->i_ino, ip->i_d.di_forkoff, ip); goto corrupt_out; } + /* - * bump the flush iteration count, used to detect flushes which - * postdate a log record during recovery. This is redundant as we now - * log every change and hence this can't happen. Still, it doesn't hurt. + * Inode item log recovery for v1/v2 inodes are dependent on the + * di_flushiter count for correct sequencing. We bump the flush + * iteration count so we can detect flushes which postdate a log record + * during recovery. This is redundant as we now log every change and + * hence this can't happen but we need to still do it to ensure + * backwards compatibility with old kernels that predate logging all + * inode changes. */ - ip->i_d.di_flushiter++; + if (ip->i_d.di_version < 3) + ip->i_d.di_flushiter++; /* * Copy the dirty parts of the inode into the on-disk diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 6fcc910a50b9..7681b19aa5dc 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -2592,8 +2592,16 @@ xlog_recover_inode_pass2( goto error; } - /* Skip replay when the on disk inode is newer than the log one */ - if (dicp->di_flushiter < be16_to_cpu(dip->di_flushiter)) { + /* + * di_flushiter is only valid for v1/2 inodes. All changes for v3 inodes + * are transactional and if ordering is necessary we can determine that + * more accurately by the LSN field in the V3 inode core. Don't trust + * the inode versions we might be changing them here - use the + * superblock flag to determine whether we need to look at di_flushiter + * to skip replay when the on disk inode is newer than the log one + */ + if (!xfs_sb_version_hascrc(&mp->m_sb) && + dicp->di_flushiter < be16_to_cpu(dip->di_flushiter)) { /* * Deal with the wrap case, DI_MAX_FLUSH is less * than smaller numbers @@ -2608,6 +2616,7 @@ xlog_recover_inode_pass2( goto error; } } + /* Take the opportunity to reset the flush iteration count */ dicp->di_flushiter = 0; From 23a113a0f3b323738e5819365ab95e1eca7f0d58 Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Date: Wed, 24 Jul 2013 12:47:46 +0200 Subject: [PATCH 476/913] usb: gadget: ether: put_usb_function on unbind Fix bugs introduced in 9c62ce83e4258bacc459faf57bf2ed83cce6be08 usb: gadget: ether: convert to new interface of f_ecm 94b5573e97729f0e1496d23b69cbe2c6b24ec0c3 usb: gadget: ether: convert to new interface of f_eem 8af5232d6f48896b151898ccb2e9e155481bb785 usb: gadget: ether: convert to new interface of f_subset 9bd4a10e1bf881af0b0a7c117c7092b558447047 usb: gadget: ether: convert to new interface of f_rndis Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/ether.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index f48712ffe261..c1c113ef950c 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -449,14 +449,20 @@ fail: static int __exit eth_unbind(struct usb_composite_dev *cdev) { - if (has_rndis()) + if (has_rndis()) { + usb_put_function(f_rndis); usb_put_function_instance(fi_rndis); - if (use_eem) + } + if (use_eem) { + usb_put_function(f_eem); usb_put_function_instance(fi_eem); - else if (can_support_ecm(cdev->gadget)) + } else if (can_support_ecm(cdev->gadget)) { + usb_put_function(f_ecm); usb_put_function_instance(fi_ecm); - else + } else { + usb_put_function(f_geth); usb_put_function_instance(fi_geth); + } return 0; } From 3b45b2a2ad3546591cb4407b1c66921b2ee158a8 Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Date: Thu, 25 Jul 2013 09:13:18 +0200 Subject: [PATCH 477/913] usb: gadget: free opts struct on error recovery Fix memory leaks introduced in commits: 40d133d7f542616cf9538508a372306e626a16e9 usb: gadget: f_ncm: convert to new function interface with backward compatibility fee562a6450b7806f1fbbe1469a67b5395b5c10a usb: gadget: f_ecm: convert to new function interface with backward compatibility fcbdf12ebef73a6069e2a1aada1e546fb578a4aa usb: gadget: f_phonet: convert to new function interface with backward compatibility b29002a157940752dfed2c488b2011f63f007d71 usb: gadget: f_eem: convert to new function interface with backward compatibility 8cedba7c73af1369599b1111639cfeb66fe13aaa usb: gadget: f_subset: convert to new function interface with backward compatibility f466c6353819326873fa48a02c6f2d7c903240d6 usb: gadget: f_rndis: convert to new function interface with backward compatibility Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/f_ecm.c | 7 +++++-- drivers/usb/gadget/f_eem.c | 7 +++++-- drivers/usb/gadget/f_ncm.c | 7 +++++-- drivers/usb/gadget/f_phonet.c | 7 +++++-- drivers/usb/gadget/f_rndis.c | 7 +++++-- drivers/usb/gadget/f_subset.c | 7 +++++-- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c index 5d3561ea1c15..edab45da3741 100644 --- a/drivers/usb/gadget/f_ecm.c +++ b/drivers/usb/gadget/f_ecm.c @@ -959,8 +959,11 @@ static struct usb_function_instance *ecm_alloc_inst(void) mutex_init(&opts->lock); opts->func_inst.free_func_inst = ecm_free_inst; opts->net = gether_setup_default(); - if (IS_ERR(opts->net)) - return ERR_PTR(PTR_ERR(opts->net)); + if (IS_ERR(opts->net)) { + struct net_device *net = opts->net; + kfree(opts); + return ERR_CAST(net); + } config_group_init_type_name(&opts->func_inst.group, "", &ecm_func_type); diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c index 90ee8022e8d8..d00392d879db 100644 --- a/drivers/usb/gadget/f_eem.c +++ b/drivers/usb/gadget/f_eem.c @@ -593,8 +593,11 @@ static struct usb_function_instance *eem_alloc_inst(void) mutex_init(&opts->lock); opts->func_inst.free_func_inst = eem_free_inst; opts->net = gether_setup_default(); - if (IS_ERR(opts->net)) - return ERR_CAST(opts->net); + if (IS_ERR(opts->net)) { + struct net_device *net = opts->net; + kfree(opts); + return ERR_CAST(net); + } config_group_init_type_name(&opts->func_inst.group, "", &eem_func_type); diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c index 952177f7eb9b..1c28fe13328a 100644 --- a/drivers/usb/gadget/f_ncm.c +++ b/drivers/usb/gadget/f_ncm.c @@ -1350,8 +1350,11 @@ static struct usb_function_instance *ncm_alloc_inst(void) mutex_init(&opts->lock); opts->func_inst.free_func_inst = ncm_free_inst; opts->net = gether_setup_default(); - if (IS_ERR(opts->net)) - return ERR_PTR(PTR_ERR(opts->net)); + if (IS_ERR(opts->net)) { + struct net_device *net = opts->net; + kfree(opts); + return ERR_CAST(net); + } config_group_init_type_name(&opts->func_inst.group, "", &ncm_func_type); diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index 7944fb0efe3b..1bf26e9f38cd 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c @@ -656,8 +656,11 @@ static struct usb_function_instance *phonet_alloc_inst(void) opts->func_inst.free_func_inst = phonet_free_inst; opts->net = gphonet_setup_default(); - if (IS_ERR(opts->net)) - return ERR_PTR(PTR_ERR(opts->net)); + if (IS_ERR(opts->net)) { + struct net_device *net = opts->net; + kfree(opts); + return ERR_CAST(net); + } config_group_init_type_name(&opts->func_inst.group, "", &phonet_func_type); diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index 191df35ae69d..717ed7f95639 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c @@ -963,8 +963,11 @@ static struct usb_function_instance *rndis_alloc_inst(void) mutex_init(&opts->lock); opts->func_inst.free_func_inst = rndis_free_inst; opts->net = gether_setup_default(); - if (IS_ERR(opts->net)) - return ERR_CAST(opts->net); + if (IS_ERR(opts->net)) { + struct net_device *net = opts->net; + kfree(opts); + return ERR_CAST(net); + } config_group_init_type_name(&opts->func_inst.group, "", &rndis_func_type); diff --git a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c index 5601e1d96c4f..7c8674fa7e80 100644 --- a/drivers/usb/gadget/f_subset.c +++ b/drivers/usb/gadget/f_subset.c @@ -505,8 +505,11 @@ static struct usb_function_instance *geth_alloc_inst(void) mutex_init(&opts->lock); opts->func_inst.free_func_inst = geth_free_inst; opts->net = gether_setup_default(); - if (IS_ERR(opts->net)) - return ERR_CAST(opts->net); + if (IS_ERR(opts->net)) { + struct net_device *net = opts->net; + kfree(opts); + return ERR_CAST(net); + } config_group_init_type_name(&opts->func_inst.group, "", &gether_func_type); From 3d1a69e726406ab662ab88fa30a3a05ed404334d Mon Sep 17 00:00:00 2001 From: Enrico Mioso <mrkiko.rs@gmail.com> Date: Sat, 29 Jun 2013 15:33:35 +0200 Subject: [PATCH 478/913] usb: serial: option: blacklist ONDA MT689DC QMI interface Prevent the option driver from binding itself to the QMI/WWAN interface, making it unusable by the proper driver. Signed-off-by: enrico Mioso <mrkiko.rs@gmail.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 43093850045b..085da5f210ec 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -819,7 +819,8 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0018, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0019, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0019, 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0020, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0021, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, From 4cf76df06ecc852633ed927d91e01c83c33bc331 Mon Sep 17 00:00:00 2001 From: Dan Williams <dcbw@redhat.com> Date: Wed, 10 Jul 2013 12:25:02 -0500 Subject: [PATCH 479/913] usb: serial: option: add Olivetti Olicard 200 Speaks AT on interfaces 5 (command & PPP) and 3 (secondary), other interface protocols are unknown. Signed-off-by: Dan Williams <dcbw@redhat.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 085da5f210ec..083b3e902894 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -341,6 +341,7 @@ static void option_instat_callback(struct urb *urb); #define OLIVETTI_VENDOR_ID 0x0b3c #define OLIVETTI_PRODUCT_OLICARD100 0xc000 #define OLIVETTI_PRODUCT_OLICARD145 0xc003 +#define OLIVETTI_PRODUCT_OLICARD200 0xc005 /* Celot products */ #define CELOT_VENDOR_ID 0x211f @@ -1259,6 +1260,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) }, + { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200) }, { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ From 878c69aae986ae97084458c0183a8c0a059865b1 Mon Sep 17 00:00:00 2001 From: Enrico Mioso <mrkiko.rs@gmail.com> Date: Sat, 13 Jul 2013 18:54:14 +0200 Subject: [PATCH 480/913] usb: serial: option.c: remove ONDA MT825UP product ID fromdriver Some (very few) early devices like mine, where not exposting a proper CDC descriptor. This was fixed with an immediate firmware update from the vendor, and pre-installed on newer devices. So actual devices can be driven by cdc_acm.c + cdc_ether.c. Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/option.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 083b3e902894..1cf6f125f5f0 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -347,12 +347,6 @@ static void option_instat_callback(struct urb *urb); #define CELOT_VENDOR_ID 0x211f #define CELOT_PRODUCT_CT680M 0x6801 -/* ONDA Communication vendor id */ -#define ONDA_VENDOR_ID 0x1ee8 - -/* ONDA MT825UP HSDPA 14.2 modem */ -#define ONDA_MT825UP 0x000b - /* Samsung products */ #define SAMSUNG_VENDOR_ID 0x04e8 #define SAMSUNG_PRODUCT_GT_B3730 0x6889 @@ -1262,7 +1256,6 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) }, { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200) }, { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ - { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM610) }, From 5f8a2e68b679b41cc8e9b642f2f5aa45dd678641 Mon Sep 17 00:00:00 2001 From: Johan Hovold <jhovold@gmail.com> Date: Mon, 1 Jul 2013 14:03:33 +0200 Subject: [PATCH 481/913] USB: mos7840: fix memory leak in open Allocated urbs and buffers were never freed on errors in open. Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/mos7840.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 0a818b238508..603fb70dde80 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -905,20 +905,20 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, &Data); if (status < 0) { dev_dbg(&port->dev, "Reading Spreg failed\n"); - return -1; + goto err; } Data |= 0x80; status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); if (status < 0) { dev_dbg(&port->dev, "writing Spreg failed\n"); - return -1; + goto err; } Data &= ~0x80; status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); if (status < 0) { dev_dbg(&port->dev, "writing Spreg failed\n"); - return -1; + goto err; } /* End of block to be checked */ @@ -927,7 +927,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) &Data); if (status < 0) { dev_dbg(&port->dev, "Reading Controlreg failed\n"); - return -1; + goto err; } Data |= 0x08; /* Driver done bit */ Data |= 0x20; /* rx_disable */ @@ -935,7 +935,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) mos7840_port->ControlRegOffset, Data); if (status < 0) { dev_dbg(&port->dev, "writing Controlreg failed\n"); - return -1; + goto err; } /* do register settings here */ /* Set all regs to the device default values. */ @@ -946,21 +946,21 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) status = mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); if (status < 0) { dev_dbg(&port->dev, "disabling interrupts failed\n"); - return -1; + goto err; } /* Set FIFO_CONTROL_REGISTER to the default value */ Data = 0x00; status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data); if (status < 0) { dev_dbg(&port->dev, "Writing FIFO_CONTROL_REGISTER failed\n"); - return -1; + goto err; } Data = 0xcf; status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data); if (status < 0) { dev_dbg(&port->dev, "Writing FIFO_CONTROL_REGISTER failed\n"); - return -1; + goto err; } Data = 0x03; @@ -1103,6 +1103,15 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) /* mos7840_change_port_settings(mos7840_port,old_termios); */ return 0; +err: + for (j = 0; j < NUM_URBS; ++j) { + urb = mos7840_port->write_urb_pool[j]; + if (!urb) + continue; + kfree(urb->transfer_buffer); + usb_free_urb(urb); + } + return status; } /***************************************************************************** From 172d934c92089e9183165f7024eba9508cb9ebce Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Date: Thu, 25 Jul 2013 09:13:18 +0200 Subject: [PATCH 482/913] usb/gadget: free opts struct on error recovery Fix memory leaks introduced in commits: 40d133d7f542616cf9538508a372306e626a16e9 usb: gadget: f_ncm: convert to new function interface with backward compatibility fee562a6450b7806f1fbbe1469a67b5395b5c10a usb: gadget: f_ecm: convert to new function interface with backward compatibility fcbdf12ebef73a6069e2a1aada1e546fb578a4aa usb: gadget: f_phonet: convert to new function interface with backward compatibility b29002a157940752dfed2c488b2011f63f007d71 usb: gadget: f_eem: convert to new function interface with backward compatibility 8cedba7c73af1369599b1111639cfeb66fe13aaa usb: gadget: f_subset: convert to new function interface with backward compatibility f466c6353819326873fa48a02c6f2d7c903240d6 usb: gadget: f_rndis: convert to new function interface with backward compatibility Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/gadget/f_ecm.c | 7 +++++-- drivers/usb/gadget/f_eem.c | 7 +++++-- drivers/usb/gadget/f_ncm.c | 7 +++++-- drivers/usb/gadget/f_phonet.c | 7 +++++-- drivers/usb/gadget/f_rndis.c | 7 +++++-- drivers/usb/gadget/f_subset.c | 7 +++++-- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c index 5d3561ea1c15..edab45da3741 100644 --- a/drivers/usb/gadget/f_ecm.c +++ b/drivers/usb/gadget/f_ecm.c @@ -959,8 +959,11 @@ static struct usb_function_instance *ecm_alloc_inst(void) mutex_init(&opts->lock); opts->func_inst.free_func_inst = ecm_free_inst; opts->net = gether_setup_default(); - if (IS_ERR(opts->net)) - return ERR_PTR(PTR_ERR(opts->net)); + if (IS_ERR(opts->net)) { + struct net_device *net = opts->net; + kfree(opts); + return ERR_CAST(net); + } config_group_init_type_name(&opts->func_inst.group, "", &ecm_func_type); diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c index 90ee8022e8d8..d00392d879db 100644 --- a/drivers/usb/gadget/f_eem.c +++ b/drivers/usb/gadget/f_eem.c @@ -593,8 +593,11 @@ static struct usb_function_instance *eem_alloc_inst(void) mutex_init(&opts->lock); opts->func_inst.free_func_inst = eem_free_inst; opts->net = gether_setup_default(); - if (IS_ERR(opts->net)) - return ERR_CAST(opts->net); + if (IS_ERR(opts->net)) { + struct net_device *net = opts->net; + kfree(opts); + return ERR_CAST(net); + } config_group_init_type_name(&opts->func_inst.group, "", &eem_func_type); diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c index 952177f7eb9b..1c28fe13328a 100644 --- a/drivers/usb/gadget/f_ncm.c +++ b/drivers/usb/gadget/f_ncm.c @@ -1350,8 +1350,11 @@ static struct usb_function_instance *ncm_alloc_inst(void) mutex_init(&opts->lock); opts->func_inst.free_func_inst = ncm_free_inst; opts->net = gether_setup_default(); - if (IS_ERR(opts->net)) - return ERR_PTR(PTR_ERR(opts->net)); + if (IS_ERR(opts->net)) { + struct net_device *net = opts->net; + kfree(opts); + return ERR_CAST(net); + } config_group_init_type_name(&opts->func_inst.group, "", &ncm_func_type); diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index 7944fb0efe3b..1bf26e9f38cd 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c @@ -656,8 +656,11 @@ static struct usb_function_instance *phonet_alloc_inst(void) opts->func_inst.free_func_inst = phonet_free_inst; opts->net = gphonet_setup_default(); - if (IS_ERR(opts->net)) - return ERR_PTR(PTR_ERR(opts->net)); + if (IS_ERR(opts->net)) { + struct net_device *net = opts->net; + kfree(opts); + return ERR_CAST(net); + } config_group_init_type_name(&opts->func_inst.group, "", &phonet_func_type); diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index 191df35ae69d..717ed7f95639 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c @@ -963,8 +963,11 @@ static struct usb_function_instance *rndis_alloc_inst(void) mutex_init(&opts->lock); opts->func_inst.free_func_inst = rndis_free_inst; opts->net = gether_setup_default(); - if (IS_ERR(opts->net)) - return ERR_CAST(opts->net); + if (IS_ERR(opts->net)) { + struct net_device *net = opts->net; + kfree(opts); + return ERR_CAST(net); + } config_group_init_type_name(&opts->func_inst.group, "", &rndis_func_type); diff --git a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c index 5601e1d96c4f..7c8674fa7e80 100644 --- a/drivers/usb/gadget/f_subset.c +++ b/drivers/usb/gadget/f_subset.c @@ -505,8 +505,11 @@ static struct usb_function_instance *geth_alloc_inst(void) mutex_init(&opts->lock); opts->func_inst.free_func_inst = geth_free_inst; opts->net = gether_setup_default(); - if (IS_ERR(opts->net)) - return ERR_CAST(opts->net); + if (IS_ERR(opts->net)) { + struct net_device *net = opts->net; + kfree(opts); + return ERR_CAST(net); + } config_group_init_type_name(&opts->func_inst.group, "", &gether_func_type); From 2c7b871b9102c497ba8f972aa5d38532f05b654d Mon Sep 17 00:00:00 2001 From: William Gulland <wgulland@google.com> Date: Thu, 27 Jun 2013 16:10:20 -0700 Subject: [PATCH 483/913] usb: Clear both buffers when clearing a control transfer TT buffer. Control transfers have both IN and OUT (or SETUP) packets, so when clearing TT buffers for a control transfer it's necessary to send two HUB_CLEAR_TT_BUFFER requests to the hub. Signed-off-by: William Gulland <wgulland@google.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/core/hub.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index c857471519e3..4a8a1d68002c 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -668,6 +668,15 @@ resubmit: static inline int hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt) { + /* Need to clear both directions for control ep */ + if (((devinfo >> 11) & USB_ENDPOINT_XFERTYPE_MASK) == + USB_ENDPOINT_XFER_CONTROL) { + int status = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), + HUB_CLEAR_TT_BUFFER, USB_RT_PORT, + devinfo ^ 0x8000, tt, NULL, 0, 1000); + if (status) + return status; + } return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo, tt, NULL, 0, 1000); From da9910ac4a816b4340944c78d94c02a35527db46 Mon Sep 17 00:00:00 2001 From: Jaganath Kanakkassery <jaganath.k@samsung.com> Date: Fri, 21 Jun 2013 19:55:11 +0530 Subject: [PATCH 484/913] Bluetooth: Fix invalid length check in l2cap_information_rsp() The length check is invalid since the length varies with type of info response. This was introduced by the commit cb3b3152b2f5939d67005cff841a1ca748b19888 Because of this, l2cap info rsp is not handled and command reject is sent. > ACL data: handle 11 flags 0x02 dlen 16 L2CAP(s): Info rsp: type 2 result 0 Extended feature mask 0x00b8 Enhanced Retransmission mode Streaming mode FCS Option Fixed Channels < ACL data: handle 11 flags 0x00 dlen 10 L2CAP(s): Command rej: reason 0 Command not understood Cc: stable@vger.kernel.org Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com> Signed-off-by: Chan-Yeol Park <chanyeol.park@samsung.com> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> --- net/bluetooth/l2cap_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 4be6a264b475..68843a28a7af 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -4333,7 +4333,7 @@ static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) data; u16 type, result; - if (cmd_len != sizeof(*rsp)) + if (cmd_len < sizeof(*rsp)) return -EPROTO; type = __le16_to_cpu(rsp->type); From 84eb2ae1807dd1467bf6f500fc69ae61f1907b75 Mon Sep 17 00:00:00 2001 From: Thomas Loo <tloo@saltstorm.net> Date: Wed, 3 Jul 2013 02:53:54 +0200 Subject: [PATCH 485/913] Bluetooth: ath3k: Add support for Fujitsu Lifebook UH5x2 [04c5:1330] The Fujitsu Lifebook UH552/UH572 ships with a Qualcomm AR9462/AR3012 WLAN/BT-Combo card. Add device ID to the ath3k driver to enable the bluetooth side of things. Patch against v3.10. T: Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 3 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=04c5 ProdID=1330 Rev=00.02 C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb Signed-off-by: Thomas Loo <tloo@saltstorm.net> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> --- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 11f467c00d0a..b22376dee2c0 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c @@ -91,6 +91,7 @@ static struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x0489, 0xe04e) }, { USB_DEVICE(0x0489, 0xe056) }, { USB_DEVICE(0x0489, 0xe04d) }, + { USB_DEVICE(0x04c5, 0x1330) }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) }, @@ -128,6 +129,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 7a7e5f8ecadc..8b8b85dced76 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -151,6 +151,7 @@ static struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, From 517828a87994f41af6ae5a0f96f0f069f05baa81 Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka <sgruszka@redhat.com> Date: Mon, 8 Jul 2013 10:27:23 +0200 Subject: [PATCH 486/913] Bluetooth: ath3k: don't use stack memory for DMA Memory allocated by vmalloc (including stack) can not be used for DMA, i.e. data pointer on usb_control_msg() should not point to stack memory. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=977558 Reported-and-tested-by: Andy Lawrence <dr.diesel@gmail.com> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> --- drivers/bluetooth/ath3k.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index b22376dee2c0..6f17e4dec441 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c @@ -195,24 +195,44 @@ error: static int ath3k_get_state(struct usb_device *udev, unsigned char *state) { - int pipe = 0; + int ret, pipe = 0; + char *buf; + + buf = kmalloc(sizeof(*buf), GFP_KERNEL); + if (!buf) + return -ENOMEM; pipe = usb_rcvctrlpipe(udev, 0); - return usb_control_msg(udev, pipe, ATH3K_GETSTATE, - USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, - state, 0x01, USB_CTRL_SET_TIMEOUT); + ret = usb_control_msg(udev, pipe, ATH3K_GETSTATE, + USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, + buf, sizeof(*buf), USB_CTRL_SET_TIMEOUT); + + *state = *buf; + kfree(buf); + + return ret; } static int ath3k_get_version(struct usb_device *udev, struct ath3k_version *version) { - int pipe = 0; + int ret, pipe = 0; + struct ath3k_version *buf; + const int size = sizeof(*buf); + + buf = kmalloc(size, GFP_KERNEL); + if (!buf) + return -ENOMEM; pipe = usb_rcvctrlpipe(udev, 0); - return usb_control_msg(udev, pipe, ATH3K_GETVERSION, - USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, version, - sizeof(struct ath3k_version), - USB_CTRL_SET_TIMEOUT); + ret = usb_control_msg(udev, pipe, ATH3K_GETVERSION, + USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, + buf, size, USB_CTRL_SET_TIMEOUT); + + memcpy(version, buf, size); + kfree(buf); + + return ret; } static int ath3k_load_fwfile(struct usb_device *udev, From d9c78e9738ccd0017b10b8f44462aafb61904a4a Mon Sep 17 00:00:00 2001 From: Adam Lee <adam8157@gmail.com> Date: Wed, 10 Jul 2013 10:02:12 +0800 Subject: [PATCH 487/913] Bluetooth: fix wrong use of PTR_ERR() in btusb PTR_ERR() returns a signed long type value which is limited by IS_ERR(), it must be a negative number whose range is [-MAX_ERRNO, 0). The bug here returns negative numbers as error codes, then check it by "if (ret < 0)", but -PTR_ERR() is actually positive. The wrong use here leads to failure as below, even panic. [ 12.958920] Bluetooth: hci0 command 0xfc8e tx timeout [ 14.961765] Bluetooth: hci0 command 0xfc8e tx timeout [ 16.964688] Bluetooth: hci0 command 0xfc8e tx timeout [ 20.954501] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed (-110) [ 22.957358] Bluetooth: hci0 command 0xfc8e tx timeout [ 30.948922] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed (-110) [ 32.951780] Bluetooth: hci0 command 0xfc8e tx timeout [ 40.943359] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed (-110) [ 42.946219] Bluetooth: hci0 command 0xfc8e tx timeout [ 50.937812] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed (-110) [ 52.940670] Bluetooth: hci0 command 0xfc8e tx timeout [ 60.932236] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed (-110) [ 62.935092] Bluetooth: hci0 command 0xfc8e tx timeout [ 70.926688] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed (-110) [ 72.929545] Bluetooth: hci0 command 0xfc8e tx timeout [ 80.921111] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed (-110) [ 82.923969] Bluetooth: hci0 command 0xfc2f tx timeout [ 90.915542] Bluetooth: hci0 sending Intel patch command (0xfc2f) failed (-110) [ 92.918406] Bluetooth: hci0 command 0xfc11 tx timeout [ 100.909955] Bluetooth: hci0 sending Intel patch command (0xfc11) failed (-110) [ 102.912858] Bluetooth: hci0 command 0xfc60 tx timeout [ 110.904394] Bluetooth: hci0 sending Intel patch command (0xfc60) failed (-110) [ 112.907293] Bluetooth: hci0 command 0xfc11 tx timeout [ 120.898831] Bluetooth: hci0 exiting Intel manufacturer mode failed (-110) [ 120.904757] bluetoothd[1030]: segfault at 4 ip 00007f8b2eb55236 sp 00007fff53ff6920 error 4 in bluetoothd[7f8b2eaff000+cb000] Signed-off-by: Adam Lee <adam.lee@canonical.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> --- drivers/bluetooth/btusb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 8b8b85dced76..ad03394dfcdb 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1093,7 +1093,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, if (IS_ERR(skb)) { BT_ERR("%s sending Intel patch command (0x%4.4x) failed (%ld)", hdev->name, cmd->opcode, PTR_ERR(skb)); - return -PTR_ERR(skb); + return PTR_ERR(skb); } /* It ensures that the returned event matches the event data read from @@ -1145,7 +1145,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) if (IS_ERR(skb)) { BT_ERR("%s sending initial HCI reset command failed (%ld)", hdev->name, PTR_ERR(skb)); - return -PTR_ERR(skb); + return PTR_ERR(skb); } kfree_skb(skb); @@ -1159,7 +1159,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) if (IS_ERR(skb)) { BT_ERR("%s reading Intel fw version command failed (%ld)", hdev->name, PTR_ERR(skb)); - return -PTR_ERR(skb); + return PTR_ERR(skb); } if (skb->len != sizeof(*ver)) { @@ -1217,7 +1217,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) BT_ERR("%s entering Intel manufacturer mode failed (%ld)", hdev->name, PTR_ERR(skb)); release_firmware(fw); - return -PTR_ERR(skb); + return PTR_ERR(skb); } if (skb->data[0]) { @@ -1274,7 +1274,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) if (IS_ERR(skb)) { BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", hdev->name, PTR_ERR(skb)); - return -PTR_ERR(skb); + return PTR_ERR(skb); } kfree_skb(skb); @@ -1290,7 +1290,7 @@ exit_mfg_disable: if (IS_ERR(skb)) { BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", hdev->name, PTR_ERR(skb)); - return -PTR_ERR(skb); + return PTR_ERR(skb); } kfree_skb(skb); @@ -1308,7 +1308,7 @@ exit_mfg_deactivate: if (IS_ERR(skb)) { BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", hdev->name, PTR_ERR(skb)); - return -PTR_ERR(skb); + return PTR_ERR(skb); } kfree_skb(skb); From 5b77a1f3d7b7360dc2b7c6d2188d39b9f8432907 Mon Sep 17 00:00:00 2001 From: Sujith Manoharan <sujith@msujith.org> Date: Mon, 15 Jul 2013 09:29:03 +0530 Subject: [PATCH 488/913] Bluetooth: ath3k: Add support for ID 0x13d3/0x3402 T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 5 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=13d3 ProdID=3402 Rev= 0.02 S: Manufacturer=Atheros Communications S: Product=Bluetooth USB Host Controller S: SerialNumber=Alaska Day 2006 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb Bug: https://bugzilla.kernel.org/show_bug.cgi?id=59701 Signed-off-by: Sujith Manoharan <sujith@msujith.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> --- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 6f17e4dec441..81973eccce52 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c @@ -92,6 +92,7 @@ static struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x0489, 0xe056) }, { USB_DEVICE(0x0489, 0xe04d) }, { USB_DEVICE(0x04c5, 0x1330) }, + { USB_DEVICE(0x13d3, 0x3402) }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) }, @@ -130,6 +131,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index ad03394dfcdb..c4145c786df6 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -152,6 +152,7 @@ static struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, From 1ebd0b21ab14efb75950079840eac29afea2a26e Mon Sep 17 00:00:00 2001 From: AceLan Kao <acelan.kao@canonical.com> Date: Wed, 17 Jul 2013 11:27:40 +0800 Subject: [PATCH 489/913] Bluetooth: Add support for Atheros [0cf3:3121] Add support for the AR3012 chip. T: Bus=03 Lev=01 Prnt=01 Port=06 Cnt=01 Dev#= 6 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0cf3 ProdID=3121 Rev=00.02 C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb Signed-off-by: AceLan Kao <acelan.kao@canonical.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> --- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 81973eccce52..d3a2d6fafffb 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c @@ -93,6 +93,7 @@ static struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x0489, 0xe04d) }, { USB_DEVICE(0x04c5, 0x1330) }, { USB_DEVICE(0x13d3, 0x3402) }, + { USB_DEVICE(0x0cf3, 0x3121) }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) }, @@ -132,6 +133,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index c4145c786df6..fd5eaa30b52b 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -153,6 +153,7 @@ static struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, From fcee337704d76446e0d4714cc5eff53e896f7c6f Mon Sep 17 00:00:00 2001 From: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Date: Thu, 11 Jul 2013 11:34:28 +0100 Subject: [PATCH 490/913] Bluetooth: Fix race between hci_register_dev() and hci_dev_open() If hci_dev_open() is called after hci_register_dev() added the device to the hci_dev_list but before the workqueue are created we could run into a NULL pointer dereference (see below). This bug is very unlikely to happen, systems using bluetoothd to manage their bluetooth devices will never see this happen. BUG: unable to handle kernel NULL pointer dereference 0100 IP: [<ffffffff81077502>] __queue_work+0x32/0x3d0 (...) Call Trace: [<ffffffff81077be5>] queue_work_on+0x45/0x50 [<ffffffffa016e8ff>] hci_req_run+0xbf/0xf0 [bluetooth] [<ffffffffa01709b0>] ? hci_init2_req+0x720/0x720 [bluetooth] [<ffffffffa016ea06>] __hci_req_sync+0xd6/0x1c0 [bluetooth] [<ffffffff8108ee10>] ? try_to_wake_up+0x2b0/0x2b0 [<ffffffff8150e3f0>] ? usb_autopm_put_interface+0x30/0x40 [<ffffffffa016fad5>] hci_dev_open+0x275/0x2e0 [bluetooth] [<ffffffffa0182752>] hci_sock_ioctl+0x1f2/0x3f0 [bluetooth] [<ffffffff815c6050>] sock_do_ioctl+0x30/0x70 [<ffffffff815c75f9>] sock_ioctl+0x79/0x2f0 [<ffffffff811a8046>] do_vfs_ioctl+0x96/0x560 [<ffffffff811a85a1>] SyS_ioctl+0x91/0xb0 [<ffffffff816d989d>] system_call_fastpath+0x1a/0x1f Reported-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> --- net/bluetooth/hci_core.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index ace5e55fe5a3..64d33d1e14c8 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -2207,10 +2207,6 @@ int hci_register_dev(struct hci_dev *hdev) BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); - write_lock(&hci_dev_list_lock); - list_add(&hdev->list, &hci_dev_list); - write_unlock(&hci_dev_list_lock); - hdev->workqueue = alloc_workqueue(hdev->name, WQ_HIGHPRI | WQ_UNBOUND | WQ_MEM_RECLAIM, 1); if (!hdev->workqueue) { @@ -2246,6 +2242,10 @@ int hci_register_dev(struct hci_dev *hdev) if (hdev->dev_type != HCI_AMP) set_bit(HCI_AUTO_OFF, &hdev->dev_flags); + write_lock(&hci_dev_list_lock); + list_add(&hdev->list, &hci_dev_list); + write_unlock(&hci_dev_list_lock); + hci_notify(hdev, HCI_DEV_REG); hci_dev_hold(hdev); @@ -2258,9 +2258,6 @@ err_wqueue: destroy_workqueue(hdev->req_workqueue); err: ida_simple_remove(&hci_index_ida, hdev->id); - write_lock(&hci_dev_list_lock); - list_del(&hdev->list); - write_unlock(&hci_dev_list_lock); return error; } From 1d5b569ef85d013a775560a90050dc630614c045 Mon Sep 17 00:00:00 2001 From: AceLan Kao <acelan.kao@canonical.com> Date: Thu, 20 Jun 2013 13:38:45 +0800 Subject: [PATCH 491/913] Bluetooth: Add support for Atheros [0cf3:e003] Add support for the AR9462 chip T: Bus=02 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#= 4 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0cf3 ProdID=e003 Rev=00.02 C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb Cc: Stable <stable@vger.kernel.org> Signed-off-by: AceLan Kao <acelan.kao@canonical.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> --- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index d3a2d6fafffb..a12b923bbaca 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c @@ -94,6 +94,7 @@ static struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x04c5, 0x1330) }, { USB_DEVICE(0x13d3, 0x3402) }, { USB_DEVICE(0x0cf3, 0x3121) }, + { USB_DEVICE(0x0cf3, 0xe003) }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) }, @@ -134,6 +135,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index fd5eaa30b52b..5fb06eca8d1f 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -154,6 +154,7 @@ static struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, From 29ed1f29b68a8395d5679b3c4e38352b617b3236 Mon Sep 17 00:00:00 2001 From: Yinghai Lu <yinghai@kernel.org> Date: Fri, 19 Jul 2013 12:14:16 -0700 Subject: [PATCH 492/913] PCI: pciehp: Fix null pointer deref when hot-removing SR-IOV device Hot-removing a device with SR-IOV enabled causes a null pointer dereference in v3.9 and v3.10. This is a regression caused by ba518e3c17 ("PCI: pciehp: Iterate over all devices in slot, not functions 0-7"). When we iterate over the bus->devices list, we first remove the PF, which also removes all the VFs from the list. Then the list iterator blows up because more than just the current entry was removed from the list. ac205b7bb7 ("PCI: make sriov work with hotplug remove") works around a similar problem in pci_stop_bus_devices() by iterating over the list in reverse, so the VFs are stopped and removed from the list first, before the PF. This patch changes pciehp_unconfigure_device() to iterate over the list in reverse, too. [bhelgaas: bugzilla, changelog] Reference: https://bugzilla.kernel.org/show_bug.cgi?id=60604 Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Yijing Wang <wangyijing@huawei.com> CC: stable@vger.kernel.org # v3.9+ --- drivers/pci/hotplug/pciehp_pci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index aac7a40e4a4a..0e0d0f7f63fd 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c @@ -92,7 +92,14 @@ int pciehp_unconfigure_device(struct slot *p_slot) if (ret) presence = 0; - list_for_each_entry_safe(dev, temp, &parent->devices, bus_list) { + /* + * Stopping an SR-IOV PF device removes all the associated VFs, + * which will update the bus->devices list and confuse the + * iterator. Therefore, iterate in reverse so we remove the VFs + * first, then the PF. We do the same in pci_stop_bus_device(). + */ + list_for_each_entry_safe_reverse(dev, temp, &parent->devices, + bus_list) { pci_dev_get(dev); if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) { pci_read_config_byte(dev, PCI_BRIDGE_CONTROL, &bctl); From 7cd29f4b22be3c3468871f5240621a32d9bc903a Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas <bhelgaas@google.com> Date: Wed, 24 Jul 2013 11:36:31 -0600 Subject: [PATCH 493/913] PCI: hotplug: Convert to be builtin only, not modular Convert CONFIG_HOTPLUG_PCI from tristate to bool. This only affects the hotplug core; several of the hotplug drivers can still be modules. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Yinghai Lu <yinghai@kernel.org> --- arch/ia64/configs/generic_defconfig | 2 +- arch/ia64/configs/gensparse_defconfig | 2 +- arch/ia64/configs/tiger_defconfig | 2 +- arch/ia64/configs/xen_domu_defconfig | 2 +- arch/powerpc/configs/ppc64_defconfig | 2 +- arch/powerpc/configs/ppc64e_defconfig | 2 +- arch/powerpc/configs/pseries_defconfig | 2 +- arch/sh/configs/sh03_defconfig | 2 +- drivers/pci/hotplug/Kconfig | 5 +---- 9 files changed, 9 insertions(+), 12 deletions(-) diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig index 7913695b2fcb..efbd2929aeb7 100644 --- a/arch/ia64/configs/generic_defconfig +++ b/arch/ia64/configs/generic_defconfig @@ -31,7 +31,7 @@ CONFIG_ACPI_FAN=m CONFIG_ACPI_DOCK=y CONFIG_ACPI_PROCESSOR=m CONFIG_ACPI_CONTAINER=m -CONFIG_HOTPLUG_PCI=m +CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI_ACPI=m CONFIG_PACKET=y CONFIG_UNIX=y diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig index f8e913365423..f64980dd20c3 100644 --- a/arch/ia64/configs/gensparse_defconfig +++ b/arch/ia64/configs/gensparse_defconfig @@ -25,7 +25,7 @@ CONFIG_ACPI_BUTTON=m CONFIG_ACPI_FAN=m CONFIG_ACPI_PROCESSOR=m CONFIG_ACPI_CONTAINER=m -CONFIG_HOTPLUG_PCI=m +CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI_ACPI=m CONFIG_PACKET=y CONFIG_UNIX=y diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig index a5a9e02e60a0..0f4e9e41f130 100644 --- a/arch/ia64/configs/tiger_defconfig +++ b/arch/ia64/configs/tiger_defconfig @@ -31,7 +31,7 @@ CONFIG_ACPI_BUTTON=m CONFIG_ACPI_FAN=m CONFIG_ACPI_PROCESSOR=m CONFIG_ACPI_CONTAINER=m -CONFIG_HOTPLUG_PCI=m +CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI_ACPI=m CONFIG_PACKET=y CONFIG_UNIX=y diff --git a/arch/ia64/configs/xen_domu_defconfig b/arch/ia64/configs/xen_domu_defconfig index 37b9b422caad..b025acfde5c1 100644 --- a/arch/ia64/configs/xen_domu_defconfig +++ b/arch/ia64/configs/xen_domu_defconfig @@ -32,7 +32,7 @@ CONFIG_ACPI_BUTTON=m CONFIG_ACPI_FAN=m CONFIG_ACPI_PROCESSOR=m CONFIG_ACPI_CONTAINER=m -CONFIG_HOTPLUG_PCI=m +CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI_ACPI=m CONFIG_PACKET=y CONFIG_UNIX=y diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig index c86fcb92358e..0e8cfd09da2f 100644 --- a/arch/powerpc/configs/ppc64_defconfig +++ b/arch/powerpc/configs/ppc64_defconfig @@ -58,7 +58,7 @@ CONFIG_SCHED_SMT=y CONFIG_PPC_DENORMALISATION=y CONFIG_PCCARD=y CONFIG_ELECTRA_CF=y -CONFIG_HOTPLUG_PCI=m +CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI_RPA=m CONFIG_HOTPLUG_PCI_RPA_DLPAR=m CONFIG_PACKET=y diff --git a/arch/powerpc/configs/ppc64e_defconfig b/arch/powerpc/configs/ppc64e_defconfig index 4b20f76172e2..0085dc4642c5 100644 --- a/arch/powerpc/configs/ppc64e_defconfig +++ b/arch/powerpc/configs/ppc64e_defconfig @@ -32,7 +32,7 @@ CONFIG_IRQ_ALL_CPUS=y CONFIG_SPARSEMEM_MANUAL=y CONFIG_PCI_MSI=y CONFIG_PCCARD=y -CONFIG_HOTPLUG_PCI=m +CONFIG_HOTPLUG_PCI=y CONFIG_PACKET=y CONFIG_UNIX=y CONFIG_XFRM_USER=m diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index bea8587c3af5..1d4b9763895d 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig @@ -53,7 +53,7 @@ CONFIG_PPC_64K_PAGES=y CONFIG_PPC_SUBPAGE_PROT=y CONFIG_SCHED_SMT=y CONFIG_PPC_DENORMALISATION=y -CONFIG_HOTPLUG_PCI=m +CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI_RPA=m CONFIG_HOTPLUG_PCI_RPA_DLPAR=m CONFIG_PACKET=y diff --git a/arch/sh/configs/sh03_defconfig b/arch/sh/configs/sh03_defconfig index 2051821724c6..0cf4097b71e8 100644 --- a/arch/sh/configs/sh03_defconfig +++ b/arch/sh/configs/sh03_defconfig @@ -22,7 +22,7 @@ CONFIG_PREEMPT=y CONFIG_CMDLINE_OVERWRITE=y CONFIG_CMDLINE="console=ttySC1,115200 mem=64M root=/dev/nfs" CONFIG_PCI=y -CONFIG_HOTPLUG_PCI=m +CONFIG_HOTPLUG_PCI=y CONFIG_BINFMT_MISC=y CONFIG_NET=y CONFIG_PACKET=y diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig index bb7ebb22db01..d85009de713d 100644 --- a/drivers/pci/hotplug/Kconfig +++ b/drivers/pci/hotplug/Kconfig @@ -3,16 +3,13 @@ # menuconfig HOTPLUG_PCI - tristate "Support for PCI Hotplug" + bool "Support for PCI Hotplug" depends on PCI && SYSFS ---help--- Say Y here if you have a motherboard with a PCI Hotplug controller. This allows you to add and remove PCI cards while the machine is powered up and running. - To compile this driver as a module, choose M here: the - module will be called pci_hotplug. - When in doubt, say N. if HOTPLUG_PCI From e3c736fe47289dc6f577c8b20cc146bd7e69aff0 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Thu, 25 Jul 2013 18:27:45 -0400 Subject: [PATCH 494/913] drm/radeon/dpm: fix a typo in the rv6xx mclk setup Need to set high for the last two entries. Looks like a copy and paste typo. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/rv6xx_dpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c index 65e33f387341..b1c2a62df950 100644 --- a/drivers/gpu/drm/radeon/rv6xx_dpm.c +++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c @@ -819,7 +819,7 @@ static void rv6xx_program_memory_timing_parameters(struct radeon_device *rdev) POWERMODE1(calculate_memory_refresh_rate(rdev, pi->hw.sclks[R600_POWER_LEVEL_MEDIUM])) | POWERMODE2(calculate_memory_refresh_rate(rdev, - pi->hw.sclks[R600_POWER_LEVEL_MEDIUM])) | + pi->hw.sclks[R600_POWER_LEVEL_HIGH])) | POWERMODE3(calculate_memory_refresh_rate(rdev, pi->hw.sclks[R600_POWER_LEVEL_HIGH]))); WREG32(ARB_RFSH_RATE, arb_refresh_rate); From 2333a003a83ae8b257ac4bc1bb297c897c1ebb90 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Thu, 25 Jul 2013 18:29:14 -0400 Subject: [PATCH 495/913] drm/radeon/dpm: fix displaygap programming on rv6xx Need to use the driver state rather than the register state since the displays may not be enabled when the power state is programmed. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/rv6xx_dpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c index b1c2a62df950..dde402340f22 100644 --- a/drivers/gpu/drm/radeon/rv6xx_dpm.c +++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c @@ -1182,10 +1182,10 @@ static void rv6xx_program_display_gap(struct radeon_device *rdev) u32 tmp = RREG32(CG_DISPLAY_GAP_CNTL); tmp &= ~(DISP1_GAP_MCHG_MASK | DISP2_GAP_MCHG_MASK); - if (RREG32(AVIVO_D1CRTC_CONTROL) & AVIVO_CRTC_EN) { + if (rdev->pm.dpm.new_active_crtcs & 1) { tmp |= DISP1_GAP_MCHG(R600_PM_DISPLAY_GAP_VBLANK); tmp |= DISP2_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE); - } else if (RREG32(AVIVO_D2CRTC_CONTROL) & AVIVO_CRTC_EN) { + } else if (rdev->pm.dpm.new_active_crtcs & 2) { tmp |= DISP1_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE); tmp |= DISP2_GAP_MCHG(R600_PM_DISPLAY_GAP_VBLANK); } else { From 515c0967205f2e6d0ca1602ce0de65f9aec1d215 Mon Sep 17 00:00:00 2001 From: Olof Johansson <olof@lixom.net> Date: Wed, 24 Jul 2013 08:42:27 -0700 Subject: [PATCH 496/913] mfd: max8925: fix dt code for backlight The device-tree enablement for max8925 has several problems, but besides the bindings being wrong (and not having seen review) there's also some bad coding practices on how to fill in the platform_data from device tree. I came across this since it causes a warning when compiling mmp2_defconfig, and instead of doing the minimal fix to silence the warning, I restructured the code a bit. This silences the warning: drivers/video/backlight/max8925_bl.c: In function 'max8925_backlight_probe': drivers/video/backlight/max8925_bl.c:177:3: warning: statement with no effect [-Wunused-value] Note that the bindings themselves need to be revisited too, but that will affect more than just the backlight driver and is best done separately; this just fixes the bad code for the backlight driver. Acked-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Olof Johansson <olof@lixom.net> --- drivers/video/backlight/max8925_bl.c | 41 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index 5ca11b066b7e..886e797f75f9 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -101,33 +101,37 @@ static const struct backlight_ops max8925_backlight_ops = { .get_brightness = max8925_backlight_get_brightness, }; -#ifdef CONFIG_OF -static int max8925_backlight_dt_init(struct platform_device *pdev, - struct max8925_backlight_pdata *pdata) +static void max8925_backlight_dt_init(struct platform_device *pdev) { struct device_node *nproot = pdev->dev.parent->of_node, *np; - int dual_string; + struct max8925_backlight_pdata *pdata; + u32 val; + + if (!nproot || !IS_ENABLED(CONFIG_OF)) + return; + + pdata = devm_kzalloc(&pdev->dev, + sizeof(struct max8925_backlight_pdata), + GFP_KERNEL); + if (!pdata) + return; - if (!nproot) - return -ENODEV; np = of_find_node_by_name(nproot, "backlight"); if (!np) { dev_err(&pdev->dev, "failed to find backlight node\n"); - return -ENODEV; + return; } - of_property_read_u32(np, "maxim,max8925-dual-string", &dual_string); - pdata->dual_string = dual_string; - return 0; + if (!of_property_read_u32(np, "maxim,max8925-dual-string", &val)) + pdata->dual_string = val; + + pdev->dev.platform_data = pdata; } -#else -#define max8925_backlight_dt_init(x, y) (-1) -#endif static int max8925_backlight_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); - struct max8925_backlight_pdata *pdata = pdev->dev.platform_data; + struct max8925_backlight_pdata *pdata; struct max8925_backlight_data *data; struct backlight_device *bl; struct backlight_properties props; @@ -170,13 +174,10 @@ static int max8925_backlight_probe(struct platform_device *pdev) platform_set_drvdata(pdev, bl); value = 0; - if (pdev->dev.parent->of_node && !pdata) { - pdata = devm_kzalloc(&pdev->dev, - sizeof(struct max8925_backlight_pdata), - GFP_KERNEL); - max8925_backlight_dt_init(pdev, pdata); - } + if (!pdev->dev.platform_data) + max8925_backlight_dt_init(pdev); + pdata = pdev->dev.platform_data; if (pdata) { if (pdata->lxw_scl) value |= (1 << 7); From f4f85a8c94752300ad2c4f7a3475a3d3b8ef72ca Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Thu, 25 Jul 2013 20:07:25 -0400 Subject: [PATCH 497/913] drm/radeon/dpm: implement force performance levels for rv6xx Allows you to limit the selected power levels via sysfs. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/radeon_asic.c | 1 + drivers/gpu/drm/radeon/radeon_asic.h | 2 ++ drivers/gpu/drm/radeon/rv6xx_dpm.c | 35 ++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index 78bec1a58ed1..f8f8b3113ddd 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c @@ -1161,6 +1161,7 @@ static struct radeon_asic rv6xx_asic = { .get_mclk = &rv6xx_dpm_get_mclk, .print_power_state = &rv6xx_dpm_print_power_state, .debugfs_print_current_performance_level = &rv6xx_dpm_debugfs_print_current_performance_level, + .force_performance_level = &rv6xx_dpm_force_performance_level, }, .pflip = { .pre_page_flip = &rs600_pre_page_flip, diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index ca1895709908..902479fa737f 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h @@ -421,6 +421,8 @@ void rv6xx_dpm_print_power_state(struct radeon_device *rdev, struct radeon_ps *ps); void rv6xx_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev, struct seq_file *m); +int rv6xx_dpm_force_performance_level(struct radeon_device *rdev, + enum radeon_dpm_forced_level level); /* rs780 dpm */ int rs780_dpm_init(struct radeon_device *rdev); int rs780_dpm_enable(struct radeon_device *rdev); diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c index dde402340f22..363018c60412 100644 --- a/drivers/gpu/drm/radeon/rv6xx_dpm.c +++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c @@ -1670,6 +1670,8 @@ int rv6xx_dpm_set_power_state(struct radeon_device *rdev) struct radeon_ps *old_ps = rdev->pm.dpm.current_ps; int ret; + pi->restricted_levels = 0; + rv6xx_set_uvd_clock_before_set_eng_clock(rdev, new_ps, old_ps); rv6xx_clear_vc(rdev); @@ -1756,6 +1758,8 @@ int rv6xx_dpm_set_power_state(struct radeon_device *rdev) rv6xx_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); + rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO; + return 0; } @@ -2085,3 +2089,34 @@ u32 rv6xx_dpm_get_mclk(struct radeon_device *rdev, bool low) else return requested_state->high.mclk; } + +int rv6xx_dpm_force_performance_level(struct radeon_device *rdev, + enum radeon_dpm_forced_level level) +{ + struct rv6xx_power_info *pi = rv6xx_get_pi(rdev); + + if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { + pi->restricted_levels = 3; + } else if (level == RADEON_DPM_FORCED_LEVEL_LOW) { + pi->restricted_levels = 2; + } else { + pi->restricted_levels = 0; + } + + rv6xx_clear_vc(rdev); + r600_power_level_enable(rdev, R600_POWER_LEVEL_LOW, true); + r600_set_at(rdev, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF); + r600_wait_for_power_level(rdev, R600_POWER_LEVEL_LOW); + r600_power_level_enable(rdev, R600_POWER_LEVEL_HIGH, false); + r600_power_level_enable(rdev, R600_POWER_LEVEL_MEDIUM, false); + rv6xx_enable_medium(rdev); + rv6xx_enable_high(rdev); + if (pi->restricted_levels == 3) + r600_power_level_enable(rdev, R600_POWER_LEVEL_LOW, false); + rv6xx_program_vc(rdev); + rv6xx_program_at(rdev); + + rdev->pm.dpm.forced_level = level; + + return 0; +} From f5d9b7f0f93c6a7d40750b8b5528a1e0f0c678fb Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Thu, 25 Jul 2013 21:46:21 -0400 Subject: [PATCH 498/913] drm/radeon/dpm: fix r600_enable_sclk_control() Actually program the correct register to enable engine clock scaling control. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/r600_dpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c index b88f54b134ab..e5c860f4ccbe 100644 --- a/drivers/gpu/drm/radeon/r600_dpm.c +++ b/drivers/gpu/drm/radeon/r600_dpm.c @@ -278,9 +278,9 @@ bool r600_dynamicpm_enabled(struct radeon_device *rdev) void r600_enable_sclk_control(struct radeon_device *rdev, bool enable) { if (enable) - WREG32_P(GENERAL_PWRMGT, 0, ~SCLK_PWRMGT_OFF); + WREG32_P(SCLK_PWRMGT_CNTL, 0, ~SCLK_PWRMGT_OFF); else - WREG32_P(GENERAL_PWRMGT, SCLK_PWRMGT_OFF, ~SCLK_PWRMGT_OFF); + WREG32_P(SCLK_PWRMGT_CNTL, SCLK_PWRMGT_OFF, ~SCLK_PWRMGT_OFF); } void r600_enable_mclk_control(struct radeon_device *rdev, bool enable) From b2634562ad90be16441cff1127136457ea619466 Mon Sep 17 00:00:00 2001 From: John Sheu <sheu@chromium.org> Date: Thu, 30 May 2013 16:42:08 -0300 Subject: [PATCH 499/913] [media] s5p-mfc: Fix input/output format reporting The video encode/decode paths have duplicated logic between VIDIOC_TRY_FMT and VIDIOC_S_FMT that should be de-duped. Also, video decode reports V4L2_PIX_FMT_NV12MT_16X16 output format, regardless of what the actual output has been set at. Fix this. Signed-off-by: John Sheu <sheu@google.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> --- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 83 ++++++++------------ drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 46 ++++------- 2 files changed, 50 insertions(+), 79 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 00b07032f4f0..06091c01176a 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -344,7 +344,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f) pix_mp->num_planes = 2; /* Set pixelformat to the format in which MFC outputs the decoded frame */ - pix_mp->pixelformat = V4L2_PIX_FMT_NV12MT; + pix_mp->pixelformat = ctx->dst_fmt->fourcc; pix_mp->plane_fmt[0].bytesperline = ctx->buf_width; pix_mp->plane_fmt[0].sizeimage = ctx->luma_size; pix_mp->plane_fmt[1].bytesperline = ctx->buf_width; @@ -382,10 +382,16 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) mfc_err("Unsupported format for source.\n"); return -EINVAL; } - if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { - mfc_err("Not supported format.\n"); + if (fmt->codec_mode == S5P_FIMV_CODEC_NONE) { + mfc_err("Unknown codec\n"); return -EINVAL; } + if (!IS_MFCV6(dev)) { + if (fmt->fourcc == V4L2_PIX_FMT_VP8) { + mfc_err("Not supported format.\n"); + return -EINVAL; + } + } } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { fmt = find_format(f, MFC_FMT_RAW); if (!fmt) { @@ -411,7 +417,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) struct s5p_mfc_dev *dev = video_drvdata(file); struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); int ret = 0; - struct s5p_mfc_fmt *fmt; struct v4l2_pix_format_mplane *pix_mp; mfc_debug_enter(); @@ -425,54 +430,32 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) goto out; } if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { - fmt = find_format(f, MFC_FMT_RAW); - if (!fmt) { - mfc_err("Unsupported format for source.\n"); - return -EINVAL; - } - if (!IS_MFCV6(dev) && (fmt->fourcc != V4L2_PIX_FMT_NV12MT)) { - mfc_err("Not supported format.\n"); - return -EINVAL; - } else if (IS_MFCV6(dev) && - (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { - mfc_err("Not supported format.\n"); - return -EINVAL; - } - ctx->dst_fmt = fmt; - mfc_debug_leave(); - return ret; - } else if (f->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { - mfc_err("Wrong type error for S_FMT : %d", f->type); - return -EINVAL; - } - fmt = find_format(f, MFC_FMT_DEC); - if (!fmt || fmt->codec_mode == S5P_MFC_CODEC_NONE) { - mfc_err("Unknown codec\n"); - ret = -EINVAL; + /* dst_fmt is validated by call to vidioc_try_fmt */ + ctx->dst_fmt = find_format(f, MFC_FMT_RAW); + ret = 0; goto out; - } - if (fmt->type != MFC_FMT_DEC) { - mfc_err("Wrong format selected, you should choose " - "format for decoding\n"); - ret = -EINVAL; - goto out; - } - if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { - mfc_err("Not supported format.\n"); - return -EINVAL; - } - ctx->src_fmt = fmt; - ctx->codec_mode = fmt->codec_mode; - mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); - pix_mp->height = 0; - pix_mp->width = 0; - if (pix_mp->plane_fmt[0].sizeimage) - ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; - else - pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = + } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { + /* src_fmt is validated by call to vidioc_try_fmt */ + ctx->src_fmt = find_format(f, MFC_FMT_DEC); + ctx->codec_mode = ctx->src_fmt->codec_mode; + mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); + pix_mp->height = 0; + pix_mp->width = 0; + if (pix_mp->plane_fmt[0].sizeimage) + ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; + else + pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = DEF_CPB_SIZE; - pix_mp->plane_fmt[0].bytesperline = 0; - ctx->state = MFCINST_INIT; + pix_mp->plane_fmt[0].bytesperline = 0; + ctx->state = MFCINST_INIT; + ret = 0; + goto out; + } else { + mfc_err("Wrong type error for S_FMT : %d", f->type); + ret = -EINVAL; + goto out; + } + out: mfc_debug_leave(); return ret; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 2549967b2f85..59e56f4c8ce3 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -906,6 +906,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f) static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) { + struct s5p_mfc_dev *dev = video_drvdata(file); struct s5p_mfc_fmt *fmt; struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; @@ -930,6 +931,18 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) return -EINVAL; } + if (!IS_MFCV6(dev)) { + if (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16) { + mfc_err("Not supported format.\n"); + return -EINVAL; + } + } else if (IS_MFCV6(dev)) { + if (fmt->fourcc == V4L2_PIX_FMT_NV12MT) { + mfc_err("Not supported format.\n"); + return -EINVAL; + } + } + if (fmt->num_planes != pix_fmt_mp->num_planes) { mfc_err("failed to try output format\n"); return -EINVAL; @@ -947,7 +960,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) { struct s5p_mfc_dev *dev = video_drvdata(file); struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); - struct s5p_mfc_fmt *fmt; struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; int ret = 0; @@ -960,13 +972,9 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) goto out; } if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { - fmt = find_format(f, MFC_FMT_ENC); - if (!fmt) { - mfc_err("failed to set capture format\n"); - return -EINVAL; - } + /* dst_fmt is validated by call to vidioc_try_fmt */ + ctx->dst_fmt = find_format(f, MFC_FMT_ENC); ctx->state = MFCINST_INIT; - ctx->dst_fmt = fmt; ctx->codec_mode = ctx->dst_fmt->codec_mode; ctx->enc_dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage; pix_fmt_mp->plane_fmt[0].bytesperline = 0; @@ -987,28 +995,8 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) } mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { - fmt = find_format(f, MFC_FMT_RAW); - if (!fmt) { - mfc_err("failed to set output format\n"); - return -EINVAL; - } - - if (!IS_MFCV6(dev) && - (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16)) { - mfc_err("Not supported format.\n"); - return -EINVAL; - } else if (IS_MFCV6(dev) && - (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { - mfc_err("Not supported format.\n"); - return -EINVAL; - } - - if (fmt->num_planes != pix_fmt_mp->num_planes) { - mfc_err("failed to set output format\n"); - ret = -EINVAL; - goto out; - } - ctx->src_fmt = fmt; + /* src_fmt is validated by call to vidioc_try_fmt */ + ctx->src_fmt = find_format(f, MFC_FMT_RAW); ctx->img_width = pix_fmt_mp->width; ctx->img_height = pix_fmt_mp->height; mfc_debug(2, "codec number: %d\n", ctx->src_fmt->codec_mode); From bf265c848f162c3189f6e3f0ba619de1a82bcbdc Mon Sep 17 00:00:00 2001 From: Michal Simek <michal.simek@xilinx.com> Date: Thu, 25 Jul 2013 15:45:26 +0200 Subject: [PATCH 500/913] video: xilinxfb: Fix compilation warning regs_phys is phys_addr_t (u32 or u64). Lets use %pa printk format specifier. Fixes compilation warning introduced by: video: xilinxfb: Use drvdata->regs_phys instead of physaddr (sha1: c88fafef0135e1e1c3e23c3e32ccbeeabc587f81) Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- drivers/video/xilinxfb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index f3d4a69e1e4e..6629b29a8202 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c @@ -341,8 +341,8 @@ static int xilinxfb_assign(struct platform_device *pdev, if (drvdata->flags & BUS_ACCESS_FLAG) { /* Put a banner in the log (for DEBUG) */ - dev_dbg(dev, "regs: phys=%x, virt=%p\n", drvdata->regs_phys, - drvdata->regs); + dev_dbg(dev, "regs: phys=%pa, virt=%p\n", + &drvdata->regs_phys, drvdata->regs); } /* Put a banner in the log (for DEBUG) */ dev_dbg(dev, "fb: phys=%llx, virt=%p, size=%x\n", From f64279c8a3597137f6e39a8f3ade9db9d66684e8 Mon Sep 17 00:00:00 2001 From: Luis Henriques <luis.henriques@canonical.com> Date: Wed, 10 Jul 2013 23:57:00 +0100 Subject: [PATCH 501/913] vga16fb: Remove unused variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix build warning of unused variable: drivers/video/vga16fb.c:1268:26: warning: unused variable ‘dev’ [-Wunused-variable] Signed-off-by: Luis Henriques<luis.henriques@canonical.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- drivers/video/vga16fb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 830ded45fd47..2827333703d9 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c @@ -1265,7 +1265,6 @@ static void vga16fb_imageblit(struct fb_info *info, const struct fb_image *image static void vga16fb_destroy(struct fb_info *info) { - struct platform_device *dev = container_of(info->device, struct platform_device, dev); iounmap(info->screen_base); fb_dealloc_cmap(&info->cmap); /* XXX unshare VGA regions */ From 8a896baafc951dd97d40a07a1cd1789c1c02c4bf Mon Sep 17 00:00:00 2001 From: Wei Yongjun <weiyj.lk@gmail.com> Date: Tue, 16 Jul 2013 08:07:14 +0800 Subject: [PATCH 502/913] video: nuc900fb: fix to pass correct device identity to request_irq() The IRQ handler nuc900fb_irqhandler() use dev_id as a type of struct nuc900fb_info *, so we should pass fbi as the device identity to request_irq(). Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Acked-by: Wan Zongshun <mcuos.com@gmail.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- drivers/video/nuc900fb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c index 8c527e5b293c..796e5112ceee 100644 --- a/drivers/video/nuc900fb.c +++ b/drivers/video/nuc900fb.c @@ -587,8 +587,7 @@ static int nuc900fb_probe(struct platform_device *pdev) fbinfo->flags = FBINFO_FLAG_DEFAULT; fbinfo->pseudo_palette = &fbi->pseudo_pal; - ret = request_irq(irq, nuc900fb_irqhandler, 0, - pdev->name, fbinfo); + ret = request_irq(irq, nuc900fb_irqhandler, 0, pdev->name, fbi); if (ret) { dev_err(&pdev->dev, "cannot register irq handler %d -err %d\n", irq, ret); From 2997494fa66a1c94717d69c3cfae0a94462093c6 Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Date: Wed, 24 Jul 2013 10:19:06 +0300 Subject: [PATCH 503/913] iwlwifi: pcie: reset the NIC before the bring up This allows to clean all kinds of bad state it might be in. This solves situation where HW RFkill was switched while the NIC was offline. Until now, we relied on the firmware to do clean the interrupt, but new firmwares don't do that any more. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- drivers/net/wireless/iwlwifi/pcie/trans.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 826c15602c46..96cfcdd39079 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c @@ -670,6 +670,11 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) return err; } + /* Reset the entire device */ + iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); + + usleep_range(10, 15); + iwl_pcie_apm_init(trans); /* From now on, the op_mode will be kept updated about RF kill state */ From ea183d02e1ddfda1996d7df1e55f3a639830e335 Mon Sep 17 00:00:00 2001 From: Ilan Peer <ilan.peer@intel.com> Date: Tue, 23 Jul 2013 14:41:53 +0300 Subject: [PATCH 504/913] iwlwifi: mvm: Disable managed PS when GO is added The managed interface PS was not disabled when a GO interface was added. As a consequence, when the station VMAC was in PS, the GO also was not on the medium. Fix this. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 42 ++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 1eedc424051c..f19baf0dea6b 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c @@ -511,6 +511,27 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, if (ret) goto out_unlock; + /* + * TODO: remove this temporary code. + * Currently MVM FW supports power management only on single MAC. + * If new interface added, disable PM on existing interface. + * P2P device is a special case, since it is handled by FW similary to + * scan. If P2P deviced is added, PM remains enabled on existing + * interface. + * Note: the method below does not count the new interface being added + * at this moment. + */ + if (vif->type != NL80211_IFTYPE_P2P_DEVICE) + mvm->vif_count++; + if (mvm->vif_count > 1) { + IWL_DEBUG_MAC80211(mvm, + "Disable power on existing interfaces\n"); + ieee80211_iterate_active_interfaces_atomic( + mvm->hw, + IEEE80211_IFACE_ITER_NORMAL, + iwl_mvm_pm_disable_iterator, mvm); + } + /* * The AP binding flow can be done only after the beacon * template is configured (which happens only in the mac80211 @@ -534,27 +555,6 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, goto out_unlock; } - /* - * TODO: remove this temporary code. - * Currently MVM FW supports power management only on single MAC. - * If new interface added, disable PM on existing interface. - * P2P device is a special case, since it is handled by FW similary to - * scan. If P2P deviced is added, PM remains enabled on existing - * interface. - * Note: the method below does not count the new interface being added - * at this moment. - */ - if (vif->type != NL80211_IFTYPE_P2P_DEVICE) - mvm->vif_count++; - if (mvm->vif_count > 1) { - IWL_DEBUG_MAC80211(mvm, - "Disable power on existing interfaces\n"); - ieee80211_iterate_active_interfaces_atomic( - mvm->hw, - IEEE80211_IFACE_ITER_NORMAL, - iwl_mvm_pm_disable_iterator, mvm); - } - ret = iwl_mvm_mac_ctxt_add(mvm, vif); if (ret) goto out_release; From b6658ff80c43bcf84be0bbe371c88af1452e7776 Mon Sep 17 00:00:00 2001 From: Johannes Berg <johannes.berg@intel.com> Date: Wed, 24 Jul 2013 13:55:51 +0200 Subject: [PATCH 505/913] iwlwifi: mvm: fix flushing not started aggregation sessions When a not fully started aggregation session is destroyed and flushed, we get a warning, e.g. WARNING: at drivers/net/wireless/iwlwifi/pcie/tx.c:1142 iwl_trans_pcie_txq_disable+0x11c/0x160 queue 16 not used Modules linked in: [...] Pid: 5135, comm: hostapd Tainted: G W O 3.5.0 #10 Call Trace: wlan0: driver sets block=0 for sta 00:03:7f:10:44:d3 [<ffffffff81036492>] warn_slowpath_common+0x72/0xa0 [<ffffffff81036577>] warn_slowpath_fmt+0x47/0x50 [<ffffffffa0368d6c>] iwl_trans_pcie_txq_disable+0x11c/0x160 [iwlwifi] [<ffffffffa03a2099>] iwl_mvm_sta_tx_agg_flush+0xe9/0x150 [iwlmvm] [<ffffffffa0396c43>] iwl_mvm_mac_ampdu_action+0xf3/0x1e0 [iwlmvm] [<ffffffffa0293ad3>] ___ieee80211_stop_tx_ba_session+0x193/0x920 [mac80211] [<ffffffffa0294ed8>] __ieee80211_stop_tx_ba_session+0x48/0x70 [mac80211] [<ffffffffa029159f>] ieee80211_sta_tear_down_BA_sessions+0x4f/0x80 [mac80211] [<ffffffffa028a686>] __sta_info_destroy+0x66/0x370 [mac80211] [<ffffffffa028abb4>] sta_info_destroy_addr_bss+0x44/0x70 [mac80211] [<ffffffffa02a3e26>] ieee80211_del_station+0x26/0x50 [mac80211] [<ffffffffa01e6395>] nl80211_del_station+0x85/0x200 [cfg80211] when a station deauthenticated from us without fully setting up the aggregation session. Fix this by checking the aggregation state before removing the hardware queue. Cc: stable@vger.kernel.org Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- drivers/net/wireless/iwlwifi/mvm/sta.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c index 85d4bbe52157..563f559b902d 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/iwlwifi/mvm/sta.c @@ -915,6 +915,7 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; u16 txq_id; + enum iwl_mvm_agg_state old_state; /* * First set the agg state to OFF to avoid calling @@ -924,13 +925,17 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, txq_id = tid_data->txq_id; IWL_DEBUG_TX_QUEUES(mvm, "Flush AGG: sta %d tid %d q %d state %d\n", mvmsta->sta_id, tid, txq_id, tid_data->state); + old_state = tid_data->state; tid_data->state = IWL_AGG_OFF; spin_unlock_bh(&mvmsta->lock); - if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id), true)) - IWL_ERR(mvm, "Couldn't flush the AGG queue\n"); + if (old_state >= IWL_AGG_ON) { + if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id), true)) + IWL_ERR(mvm, "Couldn't flush the AGG queue\n"); + + iwl_trans_txq_disable(mvm->trans, tid_data->txq_id); + } - iwl_trans_txq_disable(mvm->trans, tid_data->txq_id); mvm->queue_to_mac80211[tid_data->txq_id] = IWL_INVALID_MAC80211_QUEUE; From a53ee0a308b16e392e0219c585b10f329345766b Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Date: Thu, 25 Jul 2013 13:14:34 +0300 Subject: [PATCH 506/913] iwlwifi: pcie: clear RFKILL interrupt in AMPG If we forget to do so, we can't send HCMD to firmware while the NIC is in RFKILL state. Cc: stable@vger.kernel.org Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- drivers/net/wireless/iwlwifi/iwl-prph.h | 2 ++ drivers/net/wireless/iwlwifi/pcie/rx.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index ff8cc75c189d..a70c7b9d9bad 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h @@ -97,6 +97,8 @@ #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800) +#define APMG_RTC_INT_STT_RFKILL (0x10000000) + /* Device system time */ #define DEVICE_SYSTEM_TIME_REG 0xA0206C diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c index fd848cd1583e..f600e68a410a 100644 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c @@ -888,6 +888,14 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); if (hw_rfkill) { + /* + * Clear the interrupt in APMG if the NIC is going down. + * Note that when the NIC exits RFkill (else branch), we + * can't access prph and the NIC will be reset in + * start_hw anyway. + */ + iwl_write_prph(trans, APMG_RTC_INT_STT_REG, + APMG_RTC_INT_STT_RFKILL); set_bit(STATUS_RFKILL, &trans_pcie->status); if (test_and_clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status)) From 6d3488a5acc64b79773ada12060babe90c0fb130 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen <tomi.valkeinen@ti.com> Date: Fri, 26 Jul 2013 11:27:53 +0300 Subject: [PATCH 507/913] fbdev/sgivwfb: fix compilation error in sgivwfb_mmap() Commit c84deb9d615c02993ce0972a0b34585c7624822f ("fbdev/sgivwfb: use vm_iomap_memory()") changed sgivwfb_mmap() to use the new vm_iomap_memory() function. The commit introduced the following compilation error: drivers/video/sgivwfb.c:716:9: note: each undeclared identifier is reported only once for each function it appears in This patch fixes the error. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- drivers/video/sgivwfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c index b2a8912f6435..a9ac3ce2d0e9 100644 --- a/drivers/video/sgivwfb.c +++ b/drivers/video/sgivwfb.c @@ -713,7 +713,7 @@ static int sgivwfb_mmap(struct fb_info *info, r = vm_iomap_memory(vma, sgivwfb_mem_phys, sgivwfb_mem_size); printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n", - offset, vma->vm_start); + sgivwfb_mem_phys + (vma->vm_pgoff << PAGE_SHIFT), vma->vm_start); return r; } From 66da64f06755134aee54d127bca54159fbbdcfb8 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan <shc_work@mail.ru> Date: Sat, 15 Jun 2013 08:09:57 -0300 Subject: [PATCH 508/913] [media] media: coda: Fix DT driver data pointer for i.MX27 The data pointer should point to DT data, and not to the ID array. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> --- drivers/media/platform/coda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index df4ada880e42..bd9405df1bd6 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c @@ -1987,7 +1987,7 @@ MODULE_DEVICE_TABLE(platform, coda_platform_ids); #ifdef CONFIG_OF static const struct of_device_id coda_dt_ids[] = { - { .compatible = "fsl,imx27-vpu", .data = &coda_platform_ids[CODA_IMX27] }, + { .compatible = "fsl,imx27-vpu", .data = &coda_devdata[CODA_IMX27] }, { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] }, { /* sentinel */ } }; From 8b64f75588ad87c9d6daa385817a4d43af6877be Mon Sep 17 00:00:00 2001 From: Sachin Kamat <sachin.kamat@linaro.org> Date: Mon, 15 Jul 2013 02:36:23 -0300 Subject: [PATCH 509/913] [media] s5p-g2d: Fix registration failure Commit 1c1d86a1ea ("[media] v4l2: always require v4l2_dev, rename parent to dev_parent") expects v4l2_dev to be always set. It converted most of the drivers using the parent field of video_device to v4l2_dev field. G2D driver did not set the parent field. Hence it got left out. Without this patch we get the following boot warning and G2D driver fails to register the video device. WARNING: CPU: 0 PID: 1 at drivers/media/v4l2-core/v4l2-dev.c:775 __video_register_device+0xfc0/0x1028() Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.11.0-rc1-00001-g1c3e372-dirty #9 [<c0014b7c>] (unwind_backtrace+0x0/0xf4) from [<c0011524>] (show_stack+0x10/0x14) [<c0011524>] (show_stack+0x10/0x14) from [<c041d7a8>] (dump_stack+0x7c/0xb0) [<c041d7a8>] (dump_stack+0x7c/0xb0) from [<c001dc94>] (warn_slowpath_common+0x6c/0x88) [<c001dc94>] (warn_slowpath_common+0x6c/0x88) from [<c001dd4c>] (warn_slowpath_null+0x1c/0x24) [<c001dd4c>] (warn_slowpath_null+0x1c/0x24) from [<c02cf8d4>] (__video_register_device+0xfc0/0x1028) [<c02cf8d4>] (__video_register_device+0xfc0/0x1028) from [<c0311a94>] (g2d_probe+0x1f8/0x398) [<c0311a94>] (g2d_probe+0x1f8/0x398) from [<c0247d54>] (platform_drv_probe+0x14/0x18) [<c0247d54>] (platform_drv_probe+0x14/0x18) from [<c0246b10>] (driver_probe_device+0x108/0x220) [<c0246b10>] (driver_probe_device+0x108/0x220) from [<c0246cf8>] (__driver_attach+0x8c/0x90) [<c0246cf8>] (__driver_attach+0x8c/0x90) from [<c0245050>] (bus_for_each_dev+0x60/0x94) [<c0245050>] (bus_for_each_dev+0x60/0x94) from [<c02462c8>] (bus_add_driver+0x1c0/0x24c) [<c02462c8>] (bus_add_driver+0x1c0/0x24c) from [<c02472d0>] (driver_register+0x78/0x140) [<c02472d0>] (driver_register+0x78/0x140) from [<c00087c8>] (do_one_initcall+0xf8/0x144) [<c00087c8>] (do_one_initcall+0xf8/0x144) from [<c05b29e8>] (kernel_init_freeable+0x13c/0x1d8) [<c05b29e8>] (kernel_init_freeable+0x13c/0x1d8) from [<c041a108>] (kernel_init+0xc/0x160) [<c041a108>] (kernel_init+0xc/0x160) from [<c000e2f8>] (ret_from_fork+0x14/0x3c) ---[ end trace 4e0ec028b0028e02 ]--- s5p-g2d 12800000.g2d: Failed to register video device s5p-g2d: probe of 12800000.g2d failed with error -22 Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> --- drivers/media/platform/s5p-g2d/g2d.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c index 553d87e5ceab..fd6289d60cde 100644 --- a/drivers/media/platform/s5p-g2d/g2d.c +++ b/drivers/media/platform/s5p-g2d/g2d.c @@ -784,6 +784,7 @@ static int g2d_probe(struct platform_device *pdev) } *vfd = g2d_videodev; vfd->lock = &dev->mutex; + vfd->v4l2_dev = &dev->v4l2_dev; ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); if (ret) { v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); From 8fbac214e5c594a0c2fe78c14adf2cdbb1febc92 Mon Sep 17 00:00:00 2001 From: Mark Rutland <mark.rutland@arm.com> Date: Thu, 18 Jul 2013 17:20:33 +0100 Subject: [PATCH 510/913] ARM: 7787/1: virt: ensure visibility of __boot_cpu_mode Secondary CPUs write to __boot_cpu_mode with caches disabled, and thus a cached value of __boot_cpu_mode may be incoherent with that in memory. This could lead to a failure to detect mismatched boot modes. This patch adds flushing to ensure that writes by secondaries to __boot_cpu_mode are made visible before we test against it. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Dave Martin <Dave.Martin@arm.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Cc: Christoffer Dall <cdall@cs.columbia.edu> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/include/asm/virt.h | 12 ++++++++++++ arch/arm/kernel/setup.c | 2 ++ 2 files changed, 14 insertions(+) diff --git a/arch/arm/include/asm/virt.h b/arch/arm/include/asm/virt.h index 50af92bac737..4371f45c5784 100644 --- a/arch/arm/include/asm/virt.h +++ b/arch/arm/include/asm/virt.h @@ -29,6 +29,7 @@ #define BOOT_CPU_MODE_MISMATCH PSR_N_BIT #ifndef __ASSEMBLY__ +#include <asm/cacheflush.h> #ifdef CONFIG_ARM_VIRT_EXT /* @@ -41,10 +42,21 @@ */ extern int __boot_cpu_mode; +static inline void sync_boot_mode(void) +{ + /* + * As secondaries write to __boot_cpu_mode with caches disabled, we + * must flush the corresponding cache entries to ensure the visibility + * of their writes. + */ + sync_cache_r(&__boot_cpu_mode); +} + void __hyp_set_vectors(unsigned long phys_vector_base); unsigned long __hyp_get_vectors(void); #else #define __boot_cpu_mode (SVC_MODE) +#define sync_boot_mode() #endif #ifndef ZIMAGE diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 96286cb383bd..afc2489ee13b 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -836,6 +836,8 @@ static int __init meminfo_cmp(const void *_a, const void *_b) void __init hyp_mode_check(void) { #ifdef CONFIG_ARM_VIRT_EXT + sync_boot_mode(); + if (is_hyp_mode_available()) { pr_info("CPU: All CPU(s) started in HYP mode.\n"); pr_info("CPU: Virtualization extensions available.\n"); From 1f49856bb029779d8f1b63517a3a3b34ffe672c7 Mon Sep 17 00:00:00 2001 From: Fabio Estevam <festevam@gmail.com> Date: Tue, 23 Jul 2013 15:13:06 +0100 Subject: [PATCH 511/913] ARM: 7789/1: Do not run dummy_flush_tlb_a15_erratum() on non-Cortex-A15 Commit 93dc688 (ARM: 7684/1: errata: Workaround for Cortex-A15 erratum 798181 (TLBI/DSB operations)) causes the following undefined instruction error on a mx53 (Cortex-A8): Internal error: Oops - undefined instruction: 0 [#1] SMP ARM CPU: 0 PID: 275 Comm: modprobe Not tainted 3.11.0-rc2-next-20130722-00009-g9b0f371 #881 task: df46cc00 ti: df48e000 task.ti: df48e000 PC is at check_and_switch_context+0x17c/0x4d0 LR is at check_and_switch_context+0xdc/0x4d0 This problem happens because check_and_switch_context() calls dummy_flush_tlb_a15_erratum() without checking if we are really running on a Cortex-A15 or not. To avoid this issue, only call dummy_flush_tlb_a15_erratum() inside check_and_switch_context() if erratum_a15_798181() returns true, which means that we are really running on a Cortex-A15. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Reviewed-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/include/asm/tlbflush.h | 16 ++++++++++++++++ arch/arm/kernel/smp_tlb.c | 17 ----------------- arch/arm/mm/context.c | 3 ++- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h index fdbb9e369745..f467e9b3f8d5 100644 --- a/arch/arm/include/asm/tlbflush.h +++ b/arch/arm/include/asm/tlbflush.h @@ -443,7 +443,18 @@ static inline void local_flush_bp_all(void) isb(); } +#include <asm/cputype.h> #ifdef CONFIG_ARM_ERRATA_798181 +static inline int erratum_a15_798181(void) +{ + unsigned int midr = read_cpuid_id(); + + /* Cortex-A15 r0p0..r3p2 affected */ + if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2) + return 0; + return 1; +} + static inline void dummy_flush_tlb_a15_erratum(void) { /* @@ -453,6 +464,11 @@ static inline void dummy_flush_tlb_a15_erratum(void) dsb(); } #else +static inline int erratum_a15_798181(void) +{ + return 0; +} + static inline void dummy_flush_tlb_a15_erratum(void) { } diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c index a98b62dca2fa..c2edfff573c2 100644 --- a/arch/arm/kernel/smp_tlb.c +++ b/arch/arm/kernel/smp_tlb.c @@ -70,23 +70,6 @@ static inline void ipi_flush_bp_all(void *ignored) local_flush_bp_all(); } -#ifdef CONFIG_ARM_ERRATA_798181 -static int erratum_a15_798181(void) -{ - unsigned int midr = read_cpuid_id(); - - /* Cortex-A15 r0p0..r3p2 affected */ - if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2) - return 0; - return 1; -} -#else -static int erratum_a15_798181(void) -{ - return 0; -} -#endif - static void ipi_flush_tlb_a15_erratum(void *arg) { dmb(); diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c index b55b1015724b..4a0544492f10 100644 --- a/arch/arm/mm/context.c +++ b/arch/arm/mm/context.c @@ -245,7 +245,8 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) { local_flush_bp_all(); local_flush_tlb_all(); - dummy_flush_tlb_a15_erratum(); + if (erratum_a15_798181()) + dummy_flush_tlb_a15_erratum(); } atomic64_set(&per_cpu(active_asids, cpu), asid); From bdae73cd374e28db544fdd9b77de689a36e3c129 Mon Sep 17 00:00:00 2001 From: Catalin Marinas <catalin.marinas@arm.com> Date: Tue, 23 Jul 2013 16:15:36 +0100 Subject: [PATCH 512/913] ARM: 7790/1: Fix deferred mm switch on VIVT processors As of commit b9d4d42ad9 (ARM: Remove __ARCH_WANT_INTERRUPTS_ON_CTXSW on pre-ARMv6 CPUs), the mm switching on VIVT processors is done in the finish_arch_post_lock_switch() function to avoid whole cache flushing with interrupts disabled. The need for deferred mm switch is stored as a thread flag (TIF_SWITCH_MM). However, with preemption enabled, we can have another thread switch before finish_arch_post_lock_switch(). If the new thread has the same mm as the previous 'next' thread, the scheduler will not call switch_mm() and the TIF_SWITCH_MM flag won't be set for the new thread. This patch moves the switch pending flag to the mm_context_t structure since this is specific to the mm rather than thread. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Reported-by: Marc Kleine-Budde <mkl@pengutronix.de> Tested-by: Marc Kleine-Budde <mkl@pengutronix.de> Cc: <stable@vger.kernel.org> # 3.5+ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/include/asm/mmu.h | 2 ++ arch/arm/include/asm/mmu_context.h | 20 ++++++++++++++++---- arch/arm/include/asm/thread_info.h | 1 - 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h index e3d55547e755..d1b4998e4f43 100644 --- a/arch/arm/include/asm/mmu.h +++ b/arch/arm/include/asm/mmu.h @@ -6,6 +6,8 @@ typedef struct { #ifdef CONFIG_CPU_HAS_ASID atomic64_t id; +#else + int switch_pending; #endif unsigned int vmalloc_seq; } mm_context_t; diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h index b5792b7fd8d3..9b32f76bb0dd 100644 --- a/arch/arm/include/asm/mmu_context.h +++ b/arch/arm/include/asm/mmu_context.h @@ -56,7 +56,7 @@ static inline void check_and_switch_context(struct mm_struct *mm, * on non-ASID CPUs, the old mm will remain valid until the * finish_arch_post_lock_switch() call. */ - set_ti_thread_flag(task_thread_info(tsk), TIF_SWITCH_MM); + mm->context.switch_pending = 1; else cpu_switch_mm(mm->pgd, mm); } @@ -65,9 +65,21 @@ static inline void check_and_switch_context(struct mm_struct *mm, finish_arch_post_lock_switch static inline void finish_arch_post_lock_switch(void) { - if (test_and_clear_thread_flag(TIF_SWITCH_MM)) { - struct mm_struct *mm = current->mm; - cpu_switch_mm(mm->pgd, mm); + struct mm_struct *mm = current->mm; + + if (mm && mm->context.switch_pending) { + /* + * Preemption must be disabled during cpu_switch_mm() as we + * have some stateful cache flush implementations. Check + * switch_pending again in case we were preempted and the + * switch to this mm was already done. + */ + preempt_disable(); + if (mm->context.switch_pending) { + mm->context.switch_pending = 0; + cpu_switch_mm(mm->pgd, mm); + } + preempt_enable_no_resched(); } } diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index 214d4158089a..2b8114fcba09 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h @@ -156,7 +156,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *, #define TIF_USING_IWMMXT 17 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ #define TIF_RESTORE_SIGMASK 20 -#define TIF_SWITCH_MM 22 /* deferred switch_mm */ #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) From acfdd4b1f7590d02e9bae3b73bdbbc4a31b05d38 Mon Sep 17 00:00:00 2001 From: Will Deacon <will.deacon@arm.com> Date: Thu, 25 Jul 2013 11:44:48 +0100 Subject: [PATCH 513/913] ARM: 7791/1: a.out: remove partial a.out support a.out support on ARM requires that argc, argv and envp are passed in r0-r2 respectively, which requires hacking load_aout_binary to prevent argc being clobbered by the return code. Whilst mainline kernels do set the registers up in start_thread, the aout loader has never carried the hack in mainline. Initialising the registers in this way actually goes against the libc expectations for ELF binaries, where argc, argv and envp are passed on the stack, with r0 being used to hold a pointer to an exit function for cleaning up after the dynamic linker if required. If the pointer is NULL, then it is ignored. When execing an ELF binary, Linux currently zeroes r0, then sets it to argc and then finally clobbers it with the return value of the execve syscall, so we actually end up with: r0 = 0 stack[0] = argc r1 = stack[1] = argv r2 = stack[2] = envp libc treats r1 and r2 as undefined. The clobbering of r0 by sys_execve works for user-spawned threads, but when executing an ELF binary from a kernel thread (via call_usermodehelper), the execve is performed on the ret_from_fork path, which restores r0 from the saved pt_regs, resulting in argc being presented to the C library. This has horrible consequences when the application exits, since we have an exit function registered using argc, resulting in a jump to hyperspace. This patch solves the problem by removing the partial a.out support from arch/arm/ altogether. Cc: <stable@vger.kernel.org> Cc: Ashish Sangwan <ashishsangwan2@gmail.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/Kconfig | 1 - arch/arm/include/asm/a.out-core.h | 45 ------------------------------- arch/arm/include/asm/processor.h | 4 --- arch/arm/include/uapi/asm/Kbuild | 1 - arch/arm/include/uapi/asm/a.out.h | 34 ----------------------- 5 files changed, 85 deletions(-) delete mode 100644 arch/arm/include/asm/a.out-core.h delete mode 100644 arch/arm/include/uapi/asm/a.out.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ba412e02ec0c..82f069829ac0 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -20,7 +20,6 @@ config ARM select GENERIC_STRNCPY_FROM_USER select GENERIC_STRNLEN_USER select HARDIRQS_SW_RESEND - select HAVE_AOUT select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL select HAVE_ARCH_KGDB select HAVE_ARCH_SECCOMP_FILTER diff --git a/arch/arm/include/asm/a.out-core.h b/arch/arm/include/asm/a.out-core.h deleted file mode 100644 index 92f10cb5c70c..000000000000 --- a/arch/arm/include/asm/a.out-core.h +++ /dev/null @@ -1,45 +0,0 @@ -/* a.out coredump register dumper - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_A_OUT_CORE_H -#define _ASM_A_OUT_CORE_H - -#ifdef __KERNEL__ - -#include <linux/user.h> -#include <linux/elfcore.h> - -/* - * fill in the user structure for an a.out core dump - */ -static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump) -{ - struct task_struct *tsk = current; - - dump->magic = CMAGIC; - dump->start_code = tsk->mm->start_code; - dump->start_stack = regs->ARM_sp & ~(PAGE_SIZE - 1); - - dump->u_tsize = (tsk->mm->end_code - tsk->mm->start_code) >> PAGE_SHIFT; - dump->u_dsize = (tsk->mm->brk - tsk->mm->start_data + PAGE_SIZE - 1) >> PAGE_SHIFT; - dump->u_ssize = 0; - - memset(dump->u_debugreg, 0, sizeof(dump->u_debugreg)); - - if (dump->start_stack < 0x04000000) - dump->u_ssize = (0x04000000 - dump->start_stack) >> PAGE_SHIFT; - - dump->regs = *regs; - dump->u_fpvalid = dump_fpu (regs, &dump->u_fp); -} - -#endif /* __KERNEL__ */ -#endif /* _ASM_A_OUT_CORE_H */ diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h index 06e7d509eaac..413f3876341c 100644 --- a/arch/arm/include/asm/processor.h +++ b/arch/arm/include/asm/processor.h @@ -54,7 +54,6 @@ struct thread_struct { #define start_thread(regs,pc,sp) \ ({ \ - unsigned long *stack = (unsigned long *)sp; \ memset(regs->uregs, 0, sizeof(regs->uregs)); \ if (current->personality & ADDR_LIMIT_32BIT) \ regs->ARM_cpsr = USR_MODE; \ @@ -65,9 +64,6 @@ struct thread_struct { regs->ARM_cpsr |= PSR_ENDSTATE; \ regs->ARM_pc = pc & ~1; /* pc */ \ regs->ARM_sp = sp; /* sp */ \ - regs->ARM_r2 = stack[2]; /* r2 (envp) */ \ - regs->ARM_r1 = stack[1]; /* r1 (argv) */ \ - regs->ARM_r0 = stack[0]; /* r0 (argc) */ \ nommu_start_thread(regs); \ }) diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild index 47bcb2d254af..18d76fd5a2af 100644 --- a/arch/arm/include/uapi/asm/Kbuild +++ b/arch/arm/include/uapi/asm/Kbuild @@ -1,7 +1,6 @@ # UAPI Header export list include include/uapi/asm-generic/Kbuild.asm -header-y += a.out.h header-y += byteorder.h header-y += fcntl.h header-y += hwcap.h diff --git a/arch/arm/include/uapi/asm/a.out.h b/arch/arm/include/uapi/asm/a.out.h deleted file mode 100644 index 083894b2e3bc..000000000000 --- a/arch/arm/include/uapi/asm/a.out.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __ARM_A_OUT_H__ -#define __ARM_A_OUT_H__ - -#include <linux/personality.h> -#include <linux/types.h> - -struct exec -{ - __u32 a_info; /* Use macros N_MAGIC, etc for access */ - __u32 a_text; /* length of text, in bytes */ - __u32 a_data; /* length of data, in bytes */ - __u32 a_bss; /* length of uninitialized data area for file, in bytes */ - __u32 a_syms; /* length of symbol table data in file, in bytes */ - __u32 a_entry; /* start address */ - __u32 a_trsize; /* length of relocation info for text, in bytes */ - __u32 a_drsize; /* length of relocation info for data, in bytes */ -}; - -/* - * This is always the same - */ -#define N_TXTADDR(a) (0x00008000) - -#define N_TRSIZE(a) ((a).a_trsize) -#define N_DRSIZE(a) ((a).a_drsize) -#define N_SYMSIZE(a) ((a).a_syms) - -#define M_ARM 103 - -#ifndef LIBRARY_START_TEXT -#define LIBRARY_START_TEXT (0x00c00000) -#endif - -#endif /* __A_OUT_GNU_H__ */ From 8e2872ce7b9a06b951680d196e893f5c0d6a3229 Mon Sep 17 00:00:00 2001 From: Heiko Carstens <heiko.carstens@de.ibm.com> Date: Thu, 18 Jul 2013 15:18:24 +0200 Subject: [PATCH 514/913] s390: add support for LZ4-compressed kernel Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- arch/s390/Kconfig | 1 + arch/s390/boot/compressed/Makefile | 9 ++++++--- arch/s390/boot/compressed/misc.c | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 22f75b504f7f..5a4c668676b5 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -118,6 +118,7 @@ config S390 select HAVE_FUNCTION_TRACE_MCOUNT_TEST select HAVE_KERNEL_BZIP2 select HAVE_KERNEL_GZIP + select HAVE_KERNEL_LZ4 select HAVE_KERNEL_LZMA select HAVE_KERNEL_LZO select HAVE_KERNEL_XZ diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile index 3ad8f61c9985..866ecbe670e4 100644 --- a/arch/s390/boot/compressed/Makefile +++ b/arch/s390/boot/compressed/Makefile @@ -6,9 +6,9 @@ BITS := $(if $(CONFIG_64BIT),64,31) -targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \ - vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo misc.o piggy.o \ - sizes.h head$(BITS).o +targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 +targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4 +targets += misc.o piggy.o sizes.h head$(BITS).o KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING @@ -48,6 +48,7 @@ vmlinux.bin.all-y := $(obj)/vmlinux.bin suffix-$(CONFIG_KERNEL_GZIP) := gz suffix-$(CONFIG_KERNEL_BZIP2) := bz2 +suffix-$(CONFIG_KERNEL_LZ4) := lz4 suffix-$(CONFIG_KERNEL_LZMA) := lzma suffix-$(CONFIG_KERNEL_LZO) := lzo suffix-$(CONFIG_KERNEL_XZ) := xz @@ -56,6 +57,8 @@ $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) $(call if_changed,gzip) $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) $(call if_changed,bzip2) +$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) + $(call if_changed,lz4) $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) $(call if_changed,lzma) $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) diff --git a/arch/s390/boot/compressed/misc.c b/arch/s390/boot/compressed/misc.c index c4c6a1cf221b..57cbaff1f397 100644 --- a/arch/s390/boot/compressed/misc.c +++ b/arch/s390/boot/compressed/misc.c @@ -47,6 +47,10 @@ static unsigned long free_mem_end_ptr; #include "../../../../lib/decompress_bunzip2.c" #endif +#ifdef CONFIG_KERNEL_LZ4 +#include "../../../../lib/decompress_unlz4.c" +#endif + #ifdef CONFIG_KERNEL_LZMA #include "../../../../lib/decompress_unlzma.c" #endif From 79b6f7fbd1c18154a93313712ab91e413778afa6 Mon Sep 17 00:00:00 2001 From: Chen Gang <gang.chen@asianux.com> Date: Tue, 23 Jul 2013 16:26:08 +0800 Subject: [PATCH 515/913] s390/Kconfig: select 'TTY' when 'S390_GUEST' is enabled 'VIRTIO_CONSOLE' depends on 'TTY', so need to select 'TTY' explicitly before selecting 'VIRTIO_CONSOLE'. Otherwise randconfig can generate a config file which enables 'VIRTIO_CONSOLE' but has 'TTY' disabled. Signed-off-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- arch/s390/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 5a4c668676b5..a281bd6e94db 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -710,6 +710,7 @@ config S390_GUEST def_bool y prompt "s390 support for virtio devices" depends on 64BIT + select TTY select VIRTUALIZATION select VIRTIO select VIRTIO_CONSOLE From 594712276e737961d30e11eae80d403b2b3815df Mon Sep 17 00:00:00 2001 From: Heiko Carstens <heiko.carstens@de.ibm.com> Date: Wed, 24 Jul 2013 10:35:33 +0200 Subject: [PATCH 516/913] s390: add support for IBM zBC12 machine Just add the new model number where appropiate. Cc: stable@vger.kernel.org # v3.10 Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- arch/s390/Kconfig | 7 ++++--- arch/s390/kernel/setup.c | 1 + arch/s390/mm/init.c | 1 + arch/s390/oprofile/init.c | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index a281bd6e94db..8a4cae78f03c 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -228,11 +228,12 @@ config MARCH_Z196 not work on older machines. config MARCH_ZEC12 - bool "IBM zEC12" + bool "IBM zBC12 and zEC12" select HAVE_MARCH_ZEC12_FEATURES if 64BIT help - Select this to enable optimizations for IBM zEC12 (2827 series). The - kernel will be slightly faster but will not work on older machines. + Select this to enable optimizations for IBM zBC12 and zEC12 (2828 and + 2827 series). The kernel will be slightly faster but will not work on + older machines. endchoice diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 497451ec5e26..aeed8a61fa0d 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -994,6 +994,7 @@ static void __init setup_hwcaps(void) strcpy(elf_platform, "z196"); break; case 0x2827: + case 0x2828: strcpy(elf_platform, "zEC12"); break; } diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index ce36ea80e4f9..ad446b0c55b6 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c @@ -69,6 +69,7 @@ static void __init setup_zero_pages(void) order = 2; break; case 0x2827: /* zEC12 */ + case 0x2828: /* zEC12 */ default: order = 5; break; diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c index ffeb17ce7f31..930783d2c99b 100644 --- a/arch/s390/oprofile/init.c +++ b/arch/s390/oprofile/init.c @@ -440,7 +440,7 @@ static int oprofile_hwsampler_init(struct oprofile_operations *ops) switch (id.machine) { case 0x2097: case 0x2098: ops->cpu_type = "s390/z10"; break; case 0x2817: case 0x2818: ops->cpu_type = "s390/z196"; break; - case 0x2827: ops->cpu_type = "s390/zEC12"; break; + case 0x2827: case 0x2828: ops->cpu_type = "s390/zEC12"; break; default: return -ENODEV; } } From 3b0040a47ad63f7147e9e7d2febb61a3b564bb90 Mon Sep 17 00:00:00 2001 From: Martin Schwidefsky <schwidefsky@de.ibm.com> Date: Thu, 25 Jul 2013 10:18:17 +0200 Subject: [PATCH 517/913] s390/bitops: fix find_next_bit_left The find_next_bit_left function is broken if used with an offset which is not a multiple of 64. The shift to mask the bits of a 64-bit word not to search is in the wrong direction, the result can be either a bit found smaller than the offset or failure to find a set bit. Cc: <stable@vger.kernel.org> # v3.8+ Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- arch/s390/include/asm/bitops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h index 4d8604e311f3..7d4676758733 100644 --- a/arch/s390/include/asm/bitops.h +++ b/arch/s390/include/asm/bitops.h @@ -693,7 +693,7 @@ static inline int find_next_bit_left(const unsigned long *addr, size -= offset; p = addr + offset / BITS_PER_LONG; if (bit) { - set = __flo_word(0, *p & (~0UL << bit)); + set = __flo_word(0, *p & (~0UL >> bit)); if (set >= size) return size + offset; if (set < BITS_PER_LONG) From 198b1bf8c3a06de42a88ad7f9d664f18d740a418 Mon Sep 17 00:00:00 2001 From: Heiko Carstens <heiko.carstens@de.ibm.com> Date: Thu, 25 Jul 2013 11:16:48 +0200 Subject: [PATCH 518/913] s390/perf: fix compile error (undefined reference sie_exit) The perf_event code references sie_exit even if KVM is not available. So add proper ifdefs to fix this one: arch/s390/built-in.o: In function `sys_call_table_emu': (.rodata+0x2b98): undefined reference to `sie_exit' arch/s390/built-in.o: In function `sys_call_table_emu': (.rodata+0x2ba0): undefined reference to `sie_exit' make: *** [vmlinux] Error 1 Reported-by: Zhouping Liu <zliu@redhat.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- arch/s390/kernel/perf_event.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/s390/kernel/perf_event.c b/arch/s390/kernel/perf_event.c index a6fc037671b1..500aa1029bcb 100644 --- a/arch/s390/kernel/perf_event.c +++ b/arch/s390/kernel/perf_event.c @@ -52,12 +52,13 @@ static struct kvm_s390_sie_block *sie_block(struct pt_regs *regs) static bool is_in_guest(struct pt_regs *regs) { - unsigned long ip = instruction_pointer(regs); - if (user_mode(regs)) return false; - - return ip == (unsigned long) &sie_exit; +#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) + return instruction_pointer(regs) == (unsigned long) &sie_exit; +#else + return false; +#endif } static unsigned long guest_is_user_mode(struct pt_regs *regs) From 845ad05ec31e0f3872a321e10dbeaf872022632c Mon Sep 17 00:00:00 2001 From: Feng Kan <fkan@apm.com> Date: Tue, 23 Jul 2013 18:52:31 +0100 Subject: [PATCH 519/913] arm64: Change kernel stack size to 16K Written by Catalin Marinas, tested by APM on storm platform. This is needed because of the failures encountered when running SpecWeb benchmark test. Signed-off-by: Feng Kan <fkan@apm.com> Acked-by: Kumar Sankaran <ksankaran@apm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- arch/arm64/include/asm/thread_info.h | 4 ++-- arch/arm64/kernel/entry.S | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 3659e460071d..23a3c4791d86 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -24,10 +24,10 @@ #include <linux/compiler.h> #ifndef CONFIG_ARM64_64K_PAGES -#define THREAD_SIZE_ORDER 1 +#define THREAD_SIZE_ORDER 2 #endif -#define THREAD_SIZE 8192 +#define THREAD_SIZE 16384 #define THREAD_START_SP (THREAD_SIZE - 16) #ifndef __ASSEMBLY__ diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 1d1314280a03..6ad781b21c08 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -121,7 +121,7 @@ .macro get_thread_info, rd mov \rd, sp - and \rd, \rd, #~((1 << 13) - 1) // top of 8K stack + and \rd, \rd, #~(THREAD_SIZE - 1) // top of stack .endm /* From 09d8091c024ec88d1541d93eb8ddb2bd5cf10c39 Mon Sep 17 00:00:00 2001 From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org> Date: Tue, 23 Jul 2013 22:21:59 -0400 Subject: [PATCH 520/913] tracing: Remove locking trace_types_lock from tracing_reset_all_online_cpus() Commit a82274151af "tracing: Protect ftrace_trace_arrays list in trace_events.c" added taking the trace_types_lock mutex in trace_events.c as there were several locations that needed it for protection. Unfortunately, it also encapsulated a call to tracing_reset_all_online_cpus() which also takes the trace_types_lock, causing a deadlock. This happens when a module has tracepoints and has been traced. When the module is removed, the trace events module notifier will grab the trace_types_lock, do a bunch of clean ups, and also clears the buffer by calling tracing_reset_all_online_cpus. This doesn't happen often which explains why it wasn't caught right away. Commit a82274151af was marked for stable, which means this must be sent to stable too. Link: http://lkml.kernel.org/r/51EEC646.7070306@broadcom.com Reported-by: Arend van Spril <arend@broadcom.com> Tested-by: Arend van Spriel <arend@broadcom.com> Cc: Alexander Z Lam <azl@google.com> Cc: Vaibhav Nagarnaik <vnagarnaik@google.com> Cc: David Sharp <dhsharp@google.com> Cc: stable@vger.kernel.org # 3.10 Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 69cba470ea96..882ec1dd1515 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1224,18 +1224,17 @@ void tracing_reset_current(int cpu) tracing_reset(&global_trace.trace_buffer, cpu); } +/* Must have trace_types_lock held */ void tracing_reset_all_online_cpus(void) { struct trace_array *tr; - mutex_lock(&trace_types_lock); list_for_each_entry(tr, &ftrace_trace_arrays, list) { tracing_reset_online_cpus(&tr->trace_buffer); #ifdef CONFIG_TRACER_MAX_TRACE tracing_reset_online_cpus(&tr->max_buffer); #endif } - mutex_unlock(&trace_types_lock); } #define SAVED_CMDLINES 128 From 867974fc09f93bdd7f98d46ac3733934486bbf4a Mon Sep 17 00:00:00 2001 From: Tejun Heo <tj@kernel.org> Date: Fri, 26 Jul 2013 08:57:56 -0400 Subject: [PATCH 521/913] ahci_imx: depend on CONFIG_MFD_SYSCON ahci_imx makes use of regmap but the dependency wasn't specified in Kconfig leading build failures if CONFIG_AHCI_IMX is enabled but CONFIG_MFD_SYSCON is not. Add the Kconfig dependency. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> --- drivers/ata/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index a4af0a2a089c..4e737728aee2 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -99,7 +99,7 @@ config SATA_AHCI_PLATFORM config AHCI_IMX tristate "Freescale i.MX AHCI SATA support" - depends on SATA_AHCI_PLATFORM + depends on SATA_AHCI_PLATFORM && MFD_SYSCON help This option enables support for the Freescale i.MX SoC's onboard AHCI SATA. From 8e5c2b776ae4c35f54547c017e0a943429f5748a Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Date: Thu, 25 Jul 2013 21:43:39 +0200 Subject: [PATCH 522/913] Revert "ACPI / video / i915: No ACPI backlight if firmware expects Windows 8" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We attempted to address a regression introduced by commit a57f7f9 (ACPICA: Add Windows8/Server2012 string for _OSI method.) after which ACPI video backlight support doesn't work on a number of systems, because the relevant AML methods in the ACPI tables in their BIOSes become useless after the BIOS has been told that the OS is compatible with Windows 8. That problem is tracked by the bug entry at: https://bugzilla.kernel.org/show_bug.cgi?id=51231 Commit 8c5bd7a (ACPI / video / i915: No ACPI backlight if firmware expects Windows 8) introduced for this purpose essentially prevented the ACPI backlight support from being used if the BIOS had been told that the OS was compatible with Windows 8 and the i915 driver was loaded, in which case the backlight would always be handled by i915. Unfortunately, however, that turned out to cause problems with backlight to appear on multiple systems with symptoms indicating that i915 was unable to control the backlight on those systems as expected. For this reason, revert commit 8c5bd7a, but leave the function acpi_video_backlight_quirks() introduced by it, because another commit on top of it uses that function. References: https://lkml.org/lkml/2013/7/21/119 References: https://lkml.org/lkml/2013/7/22/261 References: https://lkml.org/lkml/2013/7/23/429 References: https://lkml.org/lkml/2013/7/23/459 References: https://lkml.org/lkml/2013/7/23/81 References: https://lkml.org/lkml/2013/7/24/27 Reported-and-tested-by: James Hogan <james@albanarts.com> Reported-and-tested-by: Kamal Mostafa <kamal@canonical.com> Reported-and-tested-by: Jörg Otte <jrg.otte@gmail.com> Reported-and-tested-by: Steven Newbury <steve@snewbury.org.uk> Reported-by: Martin Steigerwald <Martin@lichtvoll.de> Reported-by: Kalle Valo <kvalo@adurom.com> Tested-by: Joerg Platte <jplatte@naasa.net> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/internal.h | 2 - drivers/acpi/video.c | 67 ++++----------------------------- drivers/acpi/video_detect.c | 15 +------- drivers/gpu/drm/i915/i915_dma.c | 2 +- include/acpi/video.h | 11 +----- include/linux/acpi.h | 1 - 6 files changed, 11 insertions(+), 87 deletions(-) diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 227aca77ee1e..5da44e81dd4d 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -169,10 +169,8 @@ int acpi_create_platform_device(struct acpi_device *adev, -------------------------------------------------------------------------- */ #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) bool acpi_video_backlight_quirks(void); -bool acpi_video_verify_backlight_support(void); #else static inline bool acpi_video_backlight_quirks(void) { return false; } -static inline bool acpi_video_verify_backlight_support(void) { return false; } #endif #endif /* _ACPI_INTERNAL_H_ */ diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 6dd237e79b4f..0ec434d2586d 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -911,7 +911,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) if (acpi_video_init_brightness(device)) return; - if (acpi_video_verify_backlight_support()) { + if (acpi_video_backlight_support()) { struct backlight_properties props; struct pci_dev *pdev; acpi_handle acpi_parent; @@ -1366,8 +1366,8 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) unsigned long long level_current, level_next; int result = -EINVAL; - /* no warning message if acpi_backlight=vendor or a quirk is used */ - if (!acpi_video_verify_backlight_support()) + /* no warning message if acpi_backlight=vendor is used */ + if (!acpi_video_backlight_support()) return 0; if (!device->brightness) @@ -1875,46 +1875,6 @@ static int acpi_video_bus_remove(struct acpi_device *device) return 0; } -static acpi_status video_unregister_backlight(acpi_handle handle, u32 lvl, - void *context, void **rv) -{ - struct acpi_device *acpi_dev; - struct acpi_video_bus *video; - struct acpi_video_device *dev, *next; - - if (acpi_bus_get_device(handle, &acpi_dev)) - return AE_OK; - - if (acpi_match_device_ids(acpi_dev, video_device_ids)) - return AE_OK; - - video = acpi_driver_data(acpi_dev); - if (!video) - return AE_OK; - - acpi_video_bus_stop_devices(video); - mutex_lock(&video->device_list_lock); - list_for_each_entry_safe(dev, next, &video->video_device_list, entry) { - if (dev->backlight) { - backlight_device_unregister(dev->backlight); - dev->backlight = NULL; - kfree(dev->brightness->levels); - kfree(dev->brightness); - } - if (dev->cooling_dev) { - sysfs_remove_link(&dev->dev->dev.kobj, - "thermal_cooling"); - sysfs_remove_link(&dev->cooling_dev->device.kobj, - "device"); - thermal_cooling_device_unregister(dev->cooling_dev); - dev->cooling_dev = NULL; - } - } - mutex_unlock(&video->device_list_lock); - acpi_video_bus_start_devices(video); - return AE_OK; -} - static int __init is_i740(struct pci_dev *dev) { if (dev->device == 0x00D1) @@ -1946,25 +1906,14 @@ static int __init intel_opregion_present(void) return opregion; } -int __acpi_video_register(bool backlight_quirks) +int acpi_video_register(void) { - bool no_backlight; - int result; - - no_backlight = backlight_quirks ? acpi_video_backlight_quirks() : false; - + int result = 0; if (register_count) { /* - * If acpi_video_register() has been called already, don't try - * to register acpi_video_bus, but unregister backlight devices - * if no backlight support is requested. + * if the function of acpi_video_register is already called, + * don't register the acpi_vide_bus again and return no error. */ - if (no_backlight) - acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, - video_unregister_backlight, - NULL, NULL, NULL); - return 0; } @@ -1980,7 +1929,7 @@ int __acpi_video_register(bool backlight_quirks) return 0; } -EXPORT_SYMBOL(__acpi_video_register); +EXPORT_SYMBOL(acpi_video_register); void acpi_video_unregister(void) { diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 826e52def080..c3397748ba46 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -238,12 +238,7 @@ static void acpi_video_caps_check(void) bool acpi_video_backlight_quirks(void) { - if (acpi_gbl_osi_data >= ACPI_OSI_WIN_8) { - acpi_video_caps_check(); - acpi_video_support |= ACPI_VIDEO_SKIP_BACKLIGHT; - return true; - } - return false; + return acpi_gbl_osi_data >= ACPI_OSI_WIN_8; } EXPORT_SYMBOL(acpi_video_backlight_quirks); @@ -291,14 +286,6 @@ int acpi_video_backlight_support(void) } EXPORT_SYMBOL(acpi_video_backlight_support); -/* For the ACPI video driver use only. */ -bool acpi_video_verify_backlight_support(void) -{ - return (acpi_video_support & ACPI_VIDEO_SKIP_BACKLIGHT) ? - false : acpi_video_backlight_support(); -} -EXPORT_SYMBOL(acpi_video_verify_backlight_support); - /* * Use acpi_backlight=vendor/video to force that backlight switching * is processed by vendor specific acpi drivers or video.ko driver. diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index cf188ab7051a..adb319b53ecd 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1648,7 +1648,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) if (INTEL_INFO(dev)->num_pipes) { /* Must be done after probing outputs */ intel_opregion_init(dev); - acpi_video_register_with_quirks(); + acpi_video_register(); } if (IS_GEN5(dev)) diff --git a/include/acpi/video.h b/include/acpi/video.h index b26dc4fb7ba8..61109f2609fc 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -17,21 +17,12 @@ struct acpi_device; #define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200 #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) -extern int __acpi_video_register(bool backlight_quirks); -static inline int acpi_video_register(void) -{ - return __acpi_video_register(false); -} -static inline int acpi_video_register_with_quirks(void) -{ - return __acpi_video_register(true); -} +extern int acpi_video_register(void); extern void acpi_video_unregister(void); extern int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid); #else static inline int acpi_video_register(void) { return 0; } -static inline int acpi_video_register_with_quirks(void) { return 0; } static inline void acpi_video_unregister(void) { return; } static inline int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid) diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 6ad72f92469c..353ba256f368 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -191,7 +191,6 @@ extern bool wmi_has_guid(const char *guid); #define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800 -#define ACPI_VIDEO_SKIP_BACKLIGHT 0x1000 #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) From 3f1a94ba9fce90dbe0d26806a027964bea7adc14 Mon Sep 17 00:00:00 2001 From: Hans Verkuil <hans.verkuil@cisco.com> Date: Sun, 30 Jun 2013 04:40:32 -0300 Subject: [PATCH 523/913] [media] ml86v7667: fix compile warning: 'ret' set but not used media_build/v4l/ml86v7667.c: In function 'ml86v7667_s_ctrl': media_build/v4l/ml86v7667.c:120:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] int ret; ^ And indeed, ret is set but not used. Let's actually return the error code. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> --- drivers/media/i2c/ml86v7667.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ml86v7667.c b/drivers/media/i2c/ml86v7667.c index efdc873e58d1..a9857022f71d 100644 --- a/drivers/media/i2c/ml86v7667.c +++ b/drivers/media/i2c/ml86v7667.c @@ -117,7 +117,7 @@ static int ml86v7667_s_ctrl(struct v4l2_ctrl *ctrl) { struct v4l2_subdev *sd = to_sd(ctrl); struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; + int ret = -EINVAL; switch (ctrl->id) { case V4L2_CID_BRIGHTNESS: @@ -157,7 +157,7 @@ static int ml86v7667_s_ctrl(struct v4l2_ctrl *ctrl) break; } - return 0; + return ret; } static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) From 41337042c92835e7460c5bb718fb27c50c096fa9 Mon Sep 17 00:00:00 2001 From: Andrzej Hajda <a.hajda@samsung.com> Date: Fri, 28 Jun 2013 05:34:20 -0300 Subject: [PATCH 524/913] [media] DocBook: upgrade media_api DocBook version to 4.2 Fixes the last three errors of media_api DocBook validatation: (...) media_api.xml:414: element imagedata: validity error : Value "SVG" for attribute format of imagedata is not among the enumerated set media_api.xml:432: element imagedata: validity error : Value "SVG" for attribute format of imagedata is not among the enumerated set media_api.xml:452: element imagedata: validity error : Value "SVG" for attribute format of imagedata is not among the enumerated set (...) Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> --- Documentation/DocBook/media_api.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/DocBook/media_api.tmpl b/Documentation/DocBook/media_api.tmpl index 6a8b7158697f..9c92bb879b6d 100644 --- a/Documentation/DocBook/media_api.tmpl +++ b/Documentation/DocBook/media_api.tmpl @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" - "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ <!ENTITY % media-entities SYSTEM "./media-entities.tmpl"> %media-entities; <!ENTITY media-indices SYSTEM "./media-indices.tmpl"> From 81913283c80be8c0b7e038c26e2a611ab38394f1 Mon Sep 17 00:00:00 2001 From: Andrzej Hajda <a.hajda@samsung.com> Date: Fri, 28 Jun 2013 05:44:22 -0300 Subject: [PATCH 525/913] [media] v4l2: added missing mutex.h include to v4l2-ctrls.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes following error: include/media/v4l2-ctrls.h:193:15: error: field ‘_lock’ has incomplete type include/media/v4l2-ctrls.h: In function ‘v4l2_ctrl_lock’: include/media/v4l2-ctrls.h:570:2: error: implicit declaration of function ‘mutex_lock’ [-Werror=implicit-function-declaration] include/media/v4l2-ctrls.h: In function ‘v4l2_ctrl_unlock’: include/media/v4l2-ctrls.h:579:2: error: implicit declaration of function ‘mutex_unlock’ [-Werror=implicit-function-declaration] Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> --- include/media/v4l2-ctrls.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 7343a27fe819..47ada23345a1 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -22,6 +22,7 @@ #define _V4L2_CTRLS_H #include <linux/list.h> +#include <linux/mutex.h> #include <linux/videodev2.h> /* forward references */ From a34cacab1565fdee77544b12407274ffb4d9daa0 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel <lkundrak@v3.sk> Date: Tue, 2 Jul 2013 07:56:38 -0300 Subject: [PATCH 526/913] [media] usbtv: Fix deinterlacing The image data is laid out a bit more weirdly and thus needs more work to properly interlace. What we get from hardware is V4L2_FIELD_ALTERNATE, but since userspace support for it is practically nonexistent, thus we make V4L2_FIELD_INTERLACED from it so that it's more easily interpreted. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> --- drivers/media/usb/usbtv/usbtv.c | 36 +++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/drivers/media/usb/usbtv/usbtv.c b/drivers/media/usb/usbtv/usbtv.c index bf43f874685e..9dcc677f3015 100644 --- a/drivers/media/usb/usbtv/usbtv.c +++ b/drivers/media/usb/usbtv/usbtv.c @@ -57,7 +57,7 @@ #define USBTV_CHUNK_SIZE 256 #define USBTV_CHUNK 240 #define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \ - / 2 / USBTV_CHUNK) + / 4 / USBTV_CHUNK) /* Chunk header. */ #define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ @@ -202,6 +202,26 @@ static int usbtv_setup_capture(struct usbtv *usbtv) return 0; } +/* Copy data from chunk into a frame buffer, deinterlacing the data + * into every second line. Unfortunately, they don't align nicely into + * 720 pixel lines, as the chunk is 240 words long, which is 480 pixels. + * Therefore, we break down the chunk into two halves before copyting, + * so that we can interleave a line if needed. */ +static void usbtv_chunk_to_vbuf(u32 *frame, u32 *src, int chunk_no, int odd) +{ + int half; + + for (half = 0; half < 2; half++) { + int part_no = chunk_no * 2 + half; + int line = part_no / 3; + int part_index = (line * 2 + !odd) * 3 + (part_no % 3); + + u32 *dst = &frame[part_index * USBTV_CHUNK/2]; + memcpy(dst, src, USBTV_CHUNK/2 * sizeof(*src)); + src += USBTV_CHUNK/2; + } +} + /* Called for each 256-byte image chunk. * First word identifies the chunk, followed by 240 words of image * data and padding. */ @@ -218,11 +238,6 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk) frame_id = USBTV_FRAME_ID(chunk); odd = USBTV_ODD(chunk); chunk_no = USBTV_CHUNK_NO(chunk); - - /* Deinterlace. TODO: Use interlaced frame format. */ - chunk_no = (chunk_no - chunk_no % 3) * 2 + chunk_no % 3; - chunk_no += !odd * 3; - if (chunk_no >= USBTV_CHUNKS) return; @@ -241,12 +256,11 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk) buf = list_first_entry(&usbtv->bufs, struct usbtv_buf, list); frame = vb2_plane_vaddr(&buf->vb, 0); - /* Copy the chunk. */ - memcpy(&frame[chunk_no * USBTV_CHUNK], &chunk[1], - USBTV_CHUNK * sizeof(chunk[1])); + /* Copy the chunk data. */ + usbtv_chunk_to_vbuf(frame, &chunk[1], chunk_no, odd); /* Last chunk in a frame, signalling an end */ - if (usbtv->frame_id && chunk_no == USBTV_CHUNKS-1) { + if (odd && chunk_no == USBTV_CHUNKS-1) { int size = vb2_plane_size(&buf->vb, 0); buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; @@ -518,7 +532,7 @@ static int usbtv_queue_setup(struct vb2_queue *vq, if (*nbuffers < 2) *nbuffers = 2; *nplanes = 1; - sizes[0] = USBTV_CHUNK * USBTV_CHUNKS * sizeof(u32); + sizes[0] = USBTV_WIDTH * USBTV_HEIGHT / 2 * sizeof(u32); return 0; } From f52dc448a344ddb90c8516c06656d62710baa869 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel <lkundrak@v3.sk> Date: Tue, 2 Jul 2013 07:56:39 -0300 Subject: [PATCH 527/913] [media] usbtv: Throw corrupted frames away Ignore out of order data and mark incomplete buffers as errored. This gets rid of annoying flicker due to occassional garbage from hardware. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Cc: Hans Verkuil <hans.verkuil@cisco.com> Cc: Mauro Carvalho Chehab <mchehab@redhat.com> Cc: linux-kernel@vger.kernel.org Cc: linux-media@vger.kernel.org Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> --- drivers/media/usb/usbtv/usbtv.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/usbtv/usbtv.c b/drivers/media/usb/usbtv/usbtv.c index 9dcc677f3015..91650173941a 100644 --- a/drivers/media/usb/usbtv/usbtv.c +++ b/drivers/media/usb/usbtv/usbtv.c @@ -89,6 +89,7 @@ struct usbtv { /* Number of currently processed frame, useful find * out when a new one begins. */ u32 frame_id; + int chunks_done; int iso_size; unsigned int sequence; @@ -242,8 +243,13 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk) return; /* Beginning of a frame. */ - if (chunk_no == 0) + if (chunk_no == 0) { usbtv->frame_id = frame_id; + usbtv->chunks_done = 0; + } + + if (usbtv->frame_id != frame_id) + return; spin_lock_irqsave(&usbtv->buflock, flags); if (list_empty(&usbtv->bufs)) { @@ -258,16 +264,21 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk) /* Copy the chunk data. */ usbtv_chunk_to_vbuf(frame, &chunk[1], chunk_no, odd); + usbtv->chunks_done++; /* Last chunk in a frame, signalling an end */ if (odd && chunk_no == USBTV_CHUNKS-1) { int size = vb2_plane_size(&buf->vb, 0); + enum vb2_buffer_state state = usbtv->chunks_done == + USBTV_CHUNKS ? + VB2_BUF_STATE_DONE : + VB2_BUF_STATE_ERROR; buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; buf->vb.v4l2_buf.sequence = usbtv->sequence++; v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); vb2_set_plane_payload(&buf->vb, 0, size); - vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE); + vb2_buffer_done(&buf->vb, state); list_del(&buf->list); } From c10cc483bf3f1d0e8f9f077ca36ecc053de9bbbc Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas <bhelgaas@google.com> Date: Tue, 23 Jul 2013 10:55:56 -0600 Subject: [PATCH 528/913] PCI: pciehp: Convert pciehp to be builtin only, not modular Convert pciehp to be builtin only, with no module option. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Yinghai Lu <yinghai@kernel.org> --- drivers/pci/pcie/Kconfig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig index 569f82fc9e22..3b94cfcfa03b 100644 --- a/drivers/pci/pcie/Kconfig +++ b/drivers/pci/pcie/Kconfig @@ -14,15 +14,12 @@ config PCIEPORTBUS # Include service Kconfig here # config HOTPLUG_PCI_PCIE - tristate "PCI Express Hotplug driver" + bool "PCI Express Hotplug driver" depends on HOTPLUG_PCI && PCIEPORTBUS help Say Y here if you have a motherboard that supports PCI Express Native Hotplug - To compile this driver as a module, choose M here: the - module will be called pciehp. - When in doubt, say N. source "drivers/pci/pcie/aer/Kconfig" From 4f24abb51ffe24d1a1442fdd3648a2e521487c1b Mon Sep 17 00:00:00 2001 From: Hans Verkuil <hverkuil@xs4all.nl> Date: Fri, 28 Jun 2013 04:24:15 -0300 Subject: [PATCH 529/913] [media] usbtv: fix dependency This fixes a dependency problem as found by Randy Dunlap: https://lkml.org/lkml/2013/6/27/501 Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> --- drivers/media/usb/usbtv/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig index 8864436464bf..7c5b86006ee6 100644 --- a/drivers/media/usb/usbtv/Kconfig +++ b/drivers/media/usb/usbtv/Kconfig @@ -1,6 +1,6 @@ config VIDEO_USBTV tristate "USBTV007 video capture support" - depends on VIDEO_DEV + depends on VIDEO_V4L2 select VIDEOBUF2_VMALLOC ---help--- From aa914f5ec25e4371ba18b312971314be1b9b1076 Mon Sep 17 00:00:00 2001 From: Yinghai Lu <yinghai@kernel.org> Date: Thu, 25 Jul 2013 06:31:38 -0700 Subject: [PATCH 530/913] PCI: Retry allocation of only the resource type that failed Ben Herrenschmidt reported the following problem: - The bus has space for all desired MMIO resources, including optional space for SR-IOV devices - We attempt to allocate I/O port space, but it fails because the bus has no I/O space - Because of the I/O allocation failure, we retry MMIO allocation, requesting only the required space, without the optional SR-IOV space This means we don't allocate the optional SR-IOV space, even though we could. This is related to 0c5be0cb0e ("PCI: Retry on IORESOURCE_IO type allocations"). This patch changes how we handle allocation failures. We will now retry allocation of only the resource type that failed. If MMIO allocation fails, we'll retry only MMIO allocation. If I/O port allocation fails, we'll retry only I/O port allocation. [bhelgaas: changelog] Reference: https://lkml.kernel.org/r/1367712653.11982.19.camel@pasglop Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Tested-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> CC: stable@vger.kernel.org # v3.10+ --- drivers/pci/setup-bus.c | 69 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index d254e2379533..64a7de22d9af 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -300,6 +300,47 @@ static void assign_requested_resources_sorted(struct list_head *head, } } +static unsigned long pci_fail_res_type_mask(struct list_head *fail_head) +{ + struct pci_dev_resource *fail_res; + unsigned long mask = 0; + + /* check failed type */ + list_for_each_entry(fail_res, fail_head, list) + mask |= fail_res->flags; + + /* + * one pref failed resource will set IORESOURCE_MEM, + * as we can allocate pref in non-pref range. + * Will release all assigned non-pref sibling resources + * according to that bit. + */ + return mask & (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH); +} + +static bool pci_need_to_release(unsigned long mask, struct resource *res) +{ + if (res->flags & IORESOURCE_IO) + return !!(mask & IORESOURCE_IO); + + /* check pref at first */ + if (res->flags & IORESOURCE_PREFETCH) { + if (mask & IORESOURCE_PREFETCH) + return true; + /* count pref if its parent is non-pref */ + else if ((mask & IORESOURCE_MEM) && + !(res->parent->flags & IORESOURCE_PREFETCH)) + return true; + else + return false; + } + + if (res->flags & IORESOURCE_MEM) + return !!(mask & IORESOURCE_MEM); + + return false; /* should not get here */ +} + static void __assign_resources_sorted(struct list_head *head, struct list_head *realloc_head, struct list_head *fail_head) @@ -312,11 +353,24 @@ static void __assign_resources_sorted(struct list_head *head, * if could do that, could get out early. * if could not do that, we still try to assign requested at first, * then try to reassign add_size for some resources. + * + * Separate three resource type checking if we need to release + * assigned resource after requested + add_size try. + * 1. if there is io port assign fail, will release assigned + * io port. + * 2. if there is pref mmio assign fail, release assigned + * pref mmio. + * if assigned pref mmio's parent is non-pref mmio and there + * is non-pref mmio assign fail, will release that assigned + * pref mmio. + * 3. if there is non-pref mmio assign fail or pref mmio + * assigned fail, will release assigned non-pref mmio. */ LIST_HEAD(save_head); LIST_HEAD(local_fail_head); struct pci_dev_resource *save_res; - struct pci_dev_resource *dev_res; + struct pci_dev_resource *dev_res, *tmp_res; + unsigned long fail_type; /* Check if optional add_size is there */ if (!realloc_head || list_empty(realloc_head)) @@ -348,6 +402,19 @@ static void __assign_resources_sorted(struct list_head *head, return; } + /* check failed type */ + fail_type = pci_fail_res_type_mask(&local_fail_head); + /* remove not need to be released assigned res from head list etc */ + list_for_each_entry_safe(dev_res, tmp_res, head, list) + if (dev_res->res->parent && + !pci_need_to_release(fail_type, dev_res->res)) { + /* remove it from realloc_head list */ + remove_from_list(realloc_head, dev_res->res); + remove_from_list(&save_head, dev_res->res); + list_del(&dev_res->list); + kfree(dev_res); + } + free_list(&local_fail_head); /* Release assigned resource */ list_for_each_entry(dev_res, head, list) From e2f11c58ae49d57b0e634685dd944c1771ba38c0 Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov <khoroshilov@ispras.ru> Date: Wed, 3 Jul 2013 16:17:34 -0300 Subject: [PATCH 531/913] [media] hdpvr: fix iteration over uninitialized lists in hdpvr_probe() free_buff_list and rec_buff_list are initialized in the middle of hdpvr_probe(), but if something bad happens before that, error handling code calls hdpvr_delete(), which contains iteration over the lists (via hdpvr_free_buffers()). The patch moves the lists initialization to the beginning and by the way fixes goto label in error handling of registering videodev. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> --- drivers/media/usb/hdpvr/hdpvr-core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c index cb694055ba7d..6e5070774dc2 100644 --- a/drivers/media/usb/hdpvr/hdpvr-core.c +++ b/drivers/media/usb/hdpvr/hdpvr-core.c @@ -303,6 +303,11 @@ static int hdpvr_probe(struct usb_interface *interface, dev->workqueue = 0; + /* init video transfer queues first of all */ + /* to prevent oops in hdpvr_delete() on error paths */ + INIT_LIST_HEAD(&dev->free_buff_list); + INIT_LIST_HEAD(&dev->rec_buff_list); + /* register v4l2_device early so it can be used for printks */ if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) { dev_err(&interface->dev, "v4l2_device_register failed\n"); @@ -325,10 +330,6 @@ static int hdpvr_probe(struct usb_interface *interface, if (!dev->workqueue) goto error; - /* init video transfer queues */ - INIT_LIST_HEAD(&dev->free_buff_list); - INIT_LIST_HEAD(&dev->rec_buff_list); - dev->options = hdpvr_default_options; if (default_video_input < HDPVR_VIDEO_INPUTS) @@ -405,7 +406,7 @@ static int hdpvr_probe(struct usb_interface *interface, video_nr[atomic_inc_return(&dev_nr)]); if (retval < 0) { v4l2_err(&dev->v4l2_dev, "registering videodev failed\n"); - goto error; + goto reg_fail; } /* let the user know what node this device is now attached to */ From df981edcb9bce00b9c5e4f3cc33f3f98bc9a2394 Mon Sep 17 00:00:00 2001 From: Roy Franz <roy.franz@linaro.org> Date: Wed, 24 Jul 2013 17:48:44 -0700 Subject: [PATCH 532/913] x86, efi: correct call to free_pages Specify memory size in pages, not bytes. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com> --- arch/x86/boot/compressed/eboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index d606463aa6d6..b7388a425f09 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -225,7 +225,7 @@ static void low_free(unsigned long size, unsigned long addr) unsigned long nr_pages; nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; - efi_call_phys2(sys_table->boottime->free_pages, addr, size); + efi_call_phys2(sys_table->boottime->free_pages, addr, nr_pages); } static void find_bits(unsigned long mask, u8 *pos, u8 *size) From f813b5775b471b656382ae8f087bb34dc894261f Mon Sep 17 00:00:00 2001 From: Alban Browaeys <alban.browaeys@gmail.com> Date: Tue, 16 Jul 2013 18:57:53 -0300 Subject: [PATCH 533/913] [media] em28xx: fix assignment of the eeprom data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set the config structure pointer to the eeprom data pointer (data, here eedata dereferenced) not the pointer to the pointer to the eeprom data (eedata itself). Signed-off-by: Alban Browaeys <prahal@yahoo.com> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Cc: stable@vger.kernel.org # for v3.10 Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> --- drivers/media/usb/em28xx/em28xx-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c index 4851cc2e4a4d..c4ff9739a7ae 100644 --- a/drivers/media/usb/em28xx/em28xx-i2c.c +++ b/drivers/media/usb/em28xx/em28xx-i2c.c @@ -726,7 +726,7 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, *eedata = data; *eedata_len = len; - dev_config = (void *)eedata; + dev_config = (void *)*eedata; switch (le16_to_cpu(dev_config->chip_conf) >> 4 & 0x3) { case 0: From eaa5a990191d204ba0f9d35dbe5505ec2cdd1460 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" <hjl.tools@gmail.com> Date: Fri, 26 Jul 2013 09:11:56 -0700 Subject: [PATCH 534/913] x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC will optimize mxcsr_feature_mask_init in arch/x86/kernel/i387.c: memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct)); asm volatile("fxsave %0" : : "m" (fx_scratch)); mask = fx_scratch.mxcsr_mask; if (mask == 0) mask = 0x0000ffbf; to memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct)); asm volatile("fxsave %0" : : "m" (fx_scratch)); mask = 0x0000ffbf; since asm statement doesn’t say it will update fx_scratch. As the result, the DAZ bit will be cleared. This patch fixes it. This bug dates back to at least kernel 2.6.12. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Cc: <stable@vger.kernel.org> --- arch/x86/kernel/i387.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index 202d24f0f7e7..5d576ab34403 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c @@ -116,7 +116,7 @@ static void mxcsr_feature_mask_init(void) if (cpu_has_fxsr) { memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct)); - asm volatile("fxsave %0" : : "m" (fx_scratch)); + asm volatile("fxsave %0" : "+m" (fx_scratch)); mask = fx_scratch.mxcsr_mask; if (mask == 0) mask = 0x0000ffbf; From 3606b99971b66b57a68c952619b43c12f90d2c70 Mon Sep 17 00:00:00 2001 From: Roland Dreier <roland@purestorage.com> Date: Fri, 26 Jul 2013 10:00:45 -0700 Subject: [PATCH 535/913] RDMA/ocrdma: Remove unused include I'd like to remove rdma/ib_cache.h some day, so let's avoid proliferating uses of it unnecessarily. Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/hw/ocrdma/ocrdma_ah.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c index a877a8ed7907..f4c587c68f64 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c @@ -29,7 +29,6 @@ #include <net/netevent.h> #include <rdma/ib_addr.h> -#include <rdma/ib_cache.h> #include "ocrdma.h" #include "ocrdma_verbs.h" From a34eb503742fd25155fd6cff6163daacead9fbc3 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o <tytso@mit.edu> Date: Fri, 26 Jul 2013 15:15:46 -0400 Subject: [PATCH 536/913] ext4: make sure group number is bumped after a inode allocation race When we try to allocate an inode, and there is a race between two CPU's trying to grab the same inode, _and_ this inode is the last free inode in the block group, make sure the group number is bumped before we continue searching the rest of the block groups. Otherwise, we end up searching the current block group twice, and we end up skipping searching the last block group. So in the unlikely situation where almost all of the inodes are allocated, it's possible that we will return ENOSPC even though there might be free inodes in that last block group. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: stable@vger.kernel.org --- fs/ext4/ialloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index f03598c6ffd3..8bf5999875ee 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c @@ -734,11 +734,8 @@ repeat_in_this_group: ino = ext4_find_next_zero_bit((unsigned long *) inode_bitmap_bh->b_data, EXT4_INODES_PER_GROUP(sb), ino); - if (ino >= EXT4_INODES_PER_GROUP(sb)) { - if (++group == ngroups) - group = 0; - continue; - } + if (ino >= EXT4_INODES_PER_GROUP(sb)) + goto next_group; if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) { ext4_error(sb, "reserved inode found cleared - " "inode=%lu", ino + 1); @@ -769,6 +766,9 @@ repeat_in_this_group: goto got; /* we grabbed the inode! */ if (ino < EXT4_INODES_PER_GROUP(sb)) goto repeat_in_this_group; +next_group: + if (++group == ngroups) + group = 0; } err = -ENOSPC; goto out; From dd12ed144e9797094c04736f97aa27d5fe401476 Mon Sep 17 00:00:00 2001 From: Eric Sandeen <sandeen@redhat.com> Date: Fri, 26 Jul 2013 15:21:11 -0400 Subject: [PATCH 537/913] ext4: destroy ext4_es_cachep on module unload Without this, module can't be reloaded. [ 500.521980] kmem_cache_sanity_check (ext4_extent_status): Cache name already exists. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: stable@vger.kernel.org # v3.8+ --- fs/ext4/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index bca26f34edf4..36b141e420b7 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -5481,6 +5481,7 @@ static void __exit ext4_exit_fs(void) kset_unregister(ext4_kset); ext4_exit_system_zone(); ext4_exit_pageio(); + ext4_exit_es(); } MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others"); From 20f0170377264e8449b6987041f0bcc4d746d3ed Mon Sep 17 00:00:00 2001 From: Eric Dumazet <edumazet@google.com> Date: Tue, 23 Jul 2013 17:15:54 -0700 Subject: [PATCH 538/913] usbnet: do not pretend to support SG/TSO usbnet doesn't support yet SG, so drivers should not advertise SG or TSO capabilities, as they allow TCP stack to build large TSO packets that need to be linearized and might use order-5 pages. This adds an extra copy overhead and possible allocation failures. Current code ignore skb_linearize() return code so crashes are even possible. Best is to not pretend SG/TSO is supported, and add this again when/if usbnet really supports SG for devices who could get a performance gain. Based on a prior patch from Freddy Xin <freddy@asix.com.tw> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/usb/ax88179_178a.c | 9 ++++----- drivers/net/usb/smsc75xx.c | 12 +++--------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 1e3c302d94fe..2bc87e3a8141 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -1029,10 +1029,10 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf) dev->mii.supports_gmii = 1; dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO; + NETIF_F_RXCSUM; dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO; + NETIF_F_RXCSUM; /* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | @@ -1173,7 +1173,6 @@ ax88179_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) if (((skb->len + 8) % frame_size) == 0) tx_hdr2 |= 0x80008000; /* Enable padding */ - skb_linearize(skb); headroom = skb_headroom(skb); tailroom = skb_tailroom(skb); @@ -1317,10 +1316,10 @@ static int ax88179_reset(struct usbnet *dev) 1, 1, tmp); dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO; + NETIF_F_RXCSUM; dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO; + NETIF_F_RXCSUM; /* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 75409748c774..66ebbacf066f 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c @@ -45,7 +45,6 @@ #define EEPROM_MAC_OFFSET (0x01) #define DEFAULT_TX_CSUM_ENABLE (true) #define DEFAULT_RX_CSUM_ENABLE (true) -#define DEFAULT_TSO_ENABLE (true) #define SMSC75XX_INTERNAL_PHY_ID (1) #define SMSC75XX_TX_OVERHEAD (8) #define MAX_RX_FIFO_SIZE (20 * 1024) @@ -1410,17 +1409,14 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) INIT_WORK(&pdata->set_multicast, smsc75xx_deferred_multicast_write); - if (DEFAULT_TX_CSUM_ENABLE) { + if (DEFAULT_TX_CSUM_ENABLE) dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; - if (DEFAULT_TSO_ENABLE) - dev->net->features |= NETIF_F_SG | - NETIF_F_TSO | NETIF_F_TSO6; - } + if (DEFAULT_RX_CSUM_ENABLE) dev->net->features |= NETIF_F_RXCSUM; dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM; + NETIF_F_RXCSUM; ret = smsc75xx_wait_ready(dev, 0); if (ret < 0) { @@ -2200,8 +2196,6 @@ static struct sk_buff *smsc75xx_tx_fixup(struct usbnet *dev, { u32 tx_cmd_a, tx_cmd_b; - skb_linearize(skb); - if (skb_headroom(skb) < SMSC75XX_TX_OVERHEAD) { struct sk_buff *skb2 = skb_copy_expand(skb, SMSC75XX_TX_OVERHEAD, 0, flags); From 05bc250fe623e61e132dc1f771fca0a842ea60b6 Mon Sep 17 00:00:00 2001 From: Maxime Ripard <maxime.ripard@free-electrons.com> Date: Wed, 24 Jul 2013 09:11:37 +0200 Subject: [PATCH 539/913] drivers: net: allwinner: Fix Kconfig indentation Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/allwinner/Kconfig | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/allwinner/Kconfig b/drivers/net/ethernet/allwinner/Kconfig index 53ad213e865b..cf7aa24d559c 100644 --- a/drivers/net/ethernet/allwinner/Kconfig +++ b/drivers/net/ethernet/allwinner/Kconfig @@ -3,19 +3,20 @@ # config NET_VENDOR_ALLWINNER - bool "Allwinner devices" - default y - depends on ARCH_SUNXI - ---help--- - If you have a network (Ethernet) card belonging to this - class, say Y and read the Ethernet-HOWTO, available from - <http://www.tldp.org/docs.html#howto>. + bool "Allwinner devices" + default y - Note that the answer to this question doesn't directly - affect the kernel: saying N will just cause the configurator - to skip all the questions about Allwinner cards. If you say Y, - you will be asked for your specific card in the following - questions. + depends on ARCH_SUNXI + ---help--- + If you have a network (Ethernet) card belonging to this + class, say Y and read the Ethernet-HOWTO, available from + <http://www.tldp.org/docs.html#howto>. + + Note that the answer to this question doesn't directly + affect the kernel: saying N will just cause the configurator + to skip all the questions about Allwinner cards. If you say Y, + you will be asked for your specific card in the following + questions. if NET_VENDOR_ALLWINNER From 111cc5da2a95568ca20a5f86f43ae328c069e455 Mon Sep 17 00:00:00 2001 From: Maxime Ripard <maxime.ripard@free-electrons.com> Date: Wed, 24 Jul 2013 09:12:08 +0200 Subject: [PATCH 540/913] drivers: net: sun4i-emac: select MDIO_SUN4I The EMAC driver can't work without its associated PHY driver. Reflect this in the Kconfig options by selecting it. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/allwinner/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/allwinner/Kconfig b/drivers/net/ethernet/allwinner/Kconfig index cf7aa24d559c..d8d95d4cd45a 100644 --- a/drivers/net/ethernet/allwinner/Kconfig +++ b/drivers/net/ethernet/allwinner/Kconfig @@ -27,6 +27,7 @@ config SUN4I_EMAC select CRC32 select MII select PHYLIB + select MDIO_SUN4I ---help--- Support for Allwinner A10 EMAC ethernet driver. From 83e612f632c3897be29ef02e0472f6d63e258378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= <desowin@gmail.com> Date: Tue, 23 Jul 2013 07:42:49 +0200 Subject: [PATCH 541/913] mwifiex: Add missing endian conversion. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both type and pkt_len variables are in host endian and these should be in Little Endian in the payload. Signed-off-by: Tomasz Moń <desowin@gmail.com> Acked-by: Bing Zhao <bzhao@marvell.com> Cc: <stable@vger.kernel.org> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/mwifiex/sdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c index 5ef49f2e375a..09185c963248 100644 --- a/drivers/net/wireless/mwifiex/sdio.c +++ b/drivers/net/wireless/mwifiex/sdio.c @@ -1639,8 +1639,8 @@ static int mwifiex_sdio_host_to_card(struct mwifiex_adapter *adapter, /* Allocate buffer and copy payload */ blk_size = MWIFIEX_SDIO_BLOCK_SIZE; buf_block_len = (pkt_len + blk_size - 1) / blk_size; - *(u16 *) &payload[0] = (u16) pkt_len; - *(u16 *) &payload[2] = type; + *(__le16 *)&payload[0] = cpu_to_le16((u16)pkt_len); + *(__le16 *)&payload[2] = cpu_to_le16(type); /* * This is SDIO specific header From a538ae3189a9fa4095ca58c14bc6593622c89ab9 Mon Sep 17 00:00:00 2001 From: Arend van Spriel <arend@broadcom.com> Date: Thu, 25 Jul 2013 23:01:34 +0200 Subject: [PATCH 542/913] brcmfmac: inform cfg80211 about disconnect when device is unplugged When the brcmfmac device is physically removed cfg80211 gives a warning upon unregistering the net device (see below). [23052.390197] WARNING: CPU: 0 PID: 30 at net/wireless/core.c:937 cfg80211_netdev_notifier_call+0x164/0x600 [cfg80211]() [23052.400843] Modules linked in: brcmfmac(O) brcmutil(O) cfg80211(O) pl2303 usbserial binfmt_misc snd_hda_codec_hdmi snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq_midi snd_rawmidi snd_seq_midi_event lpc_ich snd_seq snd_timer snd_seq_device snd psmouse mfd_core serio_raw soundcore snd_page_alloc intel_ips dell_laptop dell_wmi sparse_keymap dcdbas nouveau ttm drm_kms_helper drm i2c_algo_bit mxm_wmi ahci libahci sdhci_pci firewire_ohci firewire_core sdhci crc_itu_t mmc_core intel_agp intel_gtt e1000e ptp pps_core agpgart video [last unloaded: brcmfmac] [23052.452987] CPU: 0 PID: 30 Comm: khubd Tainted: G O 3.11.0-rc1-wl-testing-lockdep-00002-g41cc093-dirty #1 [23052.463480] Hardware name: Dell Inc. Latitude E6410/07XJP9, BIOS A07 02/15/2011 [23052.470852] 00000000 00000000 f4efdc18 c1522e3d f845bed2 f4efdc48 c103fbe4 c16a9254 [23052.478762] 00000000 0000001e f845bed2 000003a9 f841da44 f841da44 f3790004 f25539c0 [23052.486741] e2700200 f4efdc58 c103fc22 00000009 00000000 f4efdcc0 f841da44 00000002 [23052.494712] Call Trace: [23052.497165] [<c1522e3d>] dump_stack+0x4b/0x66 [23052.501685] [<c103fbe4>] warn_slowpath_common+0x84/0xa0 [23052.507085] [<f841da44>] ? cfg80211_netdev_notifier_call+0x164/0x600 [cfg80211] [23052.514542] [<f841da44>] ? cfg80211_netdev_notifier_call+0x164/0x600 [cfg80211] [23052.521981] [<c103fc22>] warn_slowpath_null+0x22/0x30 [23052.527191] [<f841da44>] cfg80211_netdev_notifier_call+0x164/0x600 [cfg80211] [23052.534494] [<c150abe8>] ? packet_notifier+0xc8/0x1d0 [23052.539703] [<c150abfc>] ? packet_notifier+0xdc/0x1d0 [23052.544880] [<c150ab20>] ? packet_seq_stop+0x30/0x30 [23052.550002] [<c152d655>] notifier_call_chain+0x45/0x60 [23052.555298] [<c106839f>] raw_notifier_call_chain+0x1f/0x30 [23052.560963] [<c143c693>] call_netdevice_notifiers_info+0x33/0x70 [23052.567153] [<c1459869>] ? qdisc_destroy+0x99/0xb0 [23052.572116] [<c143c6e3>] call_netdevice_notifiers+0x13/0x20 [23052.577861] [<c143df93>] rollback_registered_many+0xf3/0x1d0 [23052.583687] [<c1524cfc>] ? mutex_lock_nested+0x25c/0x350 [23052.589150] [<c143e0f4>] rollback_registered+0x24/0x40 [23052.594445] [<c143e15f>] unregister_netdevice_queue+0x4f/0xb0 [23052.600344] [<c143e299>] unregister_netdev+0x19/0x30 [23052.605484] [<f865b38f>] brcmf_del_if+0xbf/0x160 [brcmfmac] [23052.611223] [<f865b7ae>] brcmf_detach+0x5e/0xd0 [brcmfmac] [23052.616881] [<f8667413>] brcmf_usb_disconnect+0x63/0xa0 [brcmfmac] [23052.623217] [<c13e09aa>] usb_unbind_interface+0x4a/0x180 When the device is physically connected the driver sends a disassoc command to the device and response triggers the driver to inform cfg80211 about it. However, with the device removed the disassoc command fails. This patch adds a call to cfg80211_disconnected() when that command fails. The warning was added by commit below and also cleans up, but better doing it in the driver if only to get rid of the warning. commit f9bef3df52fe61067e4c1c6cfb2037cb6b259a6a Author: Ben Greear <greearb@candelatech.com> Date: Wed Jun 19 14:06:26 2013 -0700 wireless: check for dangling wdev->current_bss pointer Cc: Ben Greear <greearb@candelatech.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 277b37ae7126..7fa71f73cfe8 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c @@ -1093,8 +1093,11 @@ static void brcmf_link_down(struct brcmf_cfg80211_vif *vif) brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n "); err = brcmf_fil_cmd_data_set(vif->ifp, BRCMF_C_DISASSOC, NULL, 0); - if (err) + if (err) { brcmf_err("WLC_DISASSOC failed (%d)\n", err); + cfg80211_disconnected(vif->wdev.netdev, 0, + NULL, 0, GFP_KERNEL); + } clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state); } clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state); From a8825734e9169ddd0a2a343ceb8ce7d3ecfa08a7 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Date: Thu, 25 Jul 2013 21:52:29 -0700 Subject: [PATCH 543/913] USB: serial: add driver for Suunto ANT+ USB device This adds a driver for the Suunto ANT+ USB device, exposing it as a usb serial device. This lets the userspace "gant" program to talk to the device to communicate over the ANT+ protocol to any devices it finds. Reported-by: Steinar Gunderson <sgunderson@bigfoot.com> Tested-by: Steinar Gunderson <sgunderson@bigfoot.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/Kconfig | 7 +++++++ drivers/usb/serial/Makefile | 1 + drivers/usb/serial/suunto.c | 41 +++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 drivers/usb/serial/suunto.c diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 8c3a42ea910c..7eef9b33fde6 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -719,6 +719,13 @@ config USB_SERIAL_FLASHLOADER To compile this driver as a module, choose M here: the module will be called flashloader. +config USB_SERIAL_SUUNTO + tristate "USB Suunto ANT+ driver" + help + Say Y here if you want to use the Suunto ANT+ USB device. + + To compile this driver as a module, choose M here: the + module will be called suunto. config USB_SERIAL_DEBUG tristate "USB Debugging Device" diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index f7130114488f..a14a870d993f 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile @@ -54,6 +54,7 @@ obj-$(CONFIG_USB_SERIAL_SIEMENS_MPI) += siemens_mpi.o obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS) += sierra.o obj-$(CONFIG_USB_SERIAL_SPCP8X5) += spcp8x5.o obj-$(CONFIG_USB_SERIAL_SSU100) += ssu100.o +obj-$(CONFIG_USB_SERIAL_SUUNTO) += suunto.o obj-$(CONFIG_USB_SERIAL_SYMBOL) += symbolserial.o obj-$(CONFIG_USB_SERIAL_WWAN) += usb_wwan.o obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o diff --git a/drivers/usb/serial/suunto.c b/drivers/usb/serial/suunto.c new file mode 100644 index 000000000000..2248e7a7d5ad --- /dev/null +++ b/drivers/usb/serial/suunto.c @@ -0,0 +1,41 @@ +/* + * Suunto ANT+ USB Driver + * + * Copyright (C) 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> + * Copyright (C) 2013 Linux Foundation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation only. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/tty.h> +#include <linux/module.h> +#include <linux/usb.h> +#include <linux/usb/serial.h> +#include <linux/uaccess.h> + +static const struct usb_device_id id_table[] = { + { USB_DEVICE(0x0fcf, 0x1008) }, + { }, +}; +MODULE_DEVICE_TABLE(usb, id_table); + +static struct usb_serial_driver suunto_device = { + .driver = { + .owner = THIS_MODULE, + .name = KBUILD_MODNAME, + }, + .id_table = id_table, + .num_ports = 1, +}; + +static struct usb_serial_driver * const serial_drivers[] = { + &suunto_device, + NULL, +}; + +module_usb_serial_driver(serial_drivers, id_table); +MODULE_LICENSE("GPL"); From d8a083cc746664916d9d36ed9e4d08a29525f245 Mon Sep 17 00:00:00 2001 From: Johan Hovold <jhovold@gmail.com> Date: Fri, 26 Jul 2013 11:55:17 +0200 Subject: [PATCH 544/913] USB: mos7840: fix race in register handling Fix race in mos7840_get_reg which unconditionally manipulated the control urb (which may already be in use) by adding a control-urb busy flag. Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/mos7840.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 603fb70dde80..73dda1cc8028 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -183,6 +183,10 @@ #define LED_ON_MS 500 #define LED_OFF_MS 500 +enum mos7840_flag { + MOS7840_FLAG_CTRL_BUSY, +}; + static int device_type; static const struct usb_device_id id_table[] = { @@ -241,6 +245,8 @@ struct moschip_port { bool led_flag; struct timer_list led_timer1; /* Timer for LED on */ struct timer_list led_timer2; /* Timer for LED off */ + + unsigned long flags; }; /* @@ -460,10 +466,10 @@ static void mos7840_control_callback(struct urb *urb) case -ESHUTDOWN: /* this urb is terminated, clean up */ dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status); - return; + goto out; default: dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); - return; + goto out; } dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); @@ -476,6 +482,8 @@ static void mos7840_control_callback(struct urb *urb) mos7840_handle_new_msr(mos7840_port, regval); else if (mos7840_port->MsrLsr == 1) mos7840_handle_new_lsr(mos7840_port, regval); +out: + clear_bit_unlock(MOS7840_FLAG_CTRL_BUSY, &mos7840_port->flags); } static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, @@ -486,6 +494,9 @@ static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, unsigned char *buffer = mcs->ctrl_buf; int ret; + if (test_and_set_bit_lock(MOS7840_FLAG_CTRL_BUSY, &mcs->flags)) + return -EBUSY; + dr->bRequestType = MCS_RD_RTYPE; dr->bRequest = MCS_RDREQ; dr->wValue = cpu_to_le16(Wval); /* 0 */ @@ -497,6 +508,9 @@ static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, mos7840_control_callback, mcs); mcs->control_urb->transfer_buffer_length = 2; ret = usb_submit_urb(mcs->control_urb, GFP_ATOMIC); + if (ret) + clear_bit_unlock(MOS7840_FLAG_CTRL_BUSY, &mcs->flags); + return ret; } From 40c24f2893ba0ba7df485871f6aac0c197ceef5b Mon Sep 17 00:00:00 2001 From: Johan Hovold <jhovold@gmail.com> Date: Fri, 26 Jul 2013 11:55:18 +0200 Subject: [PATCH 545/913] USB: mos7840: fix device-type detection Fix race in device-type detection introduced by commit 0eafe4de ("USB: serial: mos7840: add support for MCS7810 devices") which used a static variable to hold the device type. Move type detection to probe and use serial data to store the device type. Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/mos7840.c | 75 +++++++++++++++++------------------- 1 file changed, 35 insertions(+), 40 deletions(-) diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 73dda1cc8028..e95d91434785 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -187,8 +187,6 @@ enum mos7840_flag { MOS7840_FLAG_CTRL_BUSY, }; -static int device_type; - static const struct usb_device_id id_table[] = { {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, @@ -830,18 +828,6 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) /************************************************************************/ /* D R I V E R T T Y I N T E R F A C E F U N C T I O N S */ /************************************************************************/ -#ifdef MCSSerialProbe -static int mos7840_serial_probe(struct usb_serial *serial, - const struct usb_device_id *id) -{ - - /*need to implement the mode_reg reading and updating\ - structures usb_serial_ device_type\ - (i.e num_ports, num_bulkin,bulkout etc) */ - /* Also we can update the changes attach */ - return 1; -} -#endif /***************************************************************************** * mos7840_open @@ -2201,38 +2187,48 @@ static int mos7810_check(struct usb_serial *serial) return 0; } -static int mos7840_calc_num_ports(struct usb_serial *serial) +static int mos7840_probe(struct usb_serial *serial, + const struct usb_device_id *id) { - __u16 data = 0x00; + u16 product = serial->dev->descriptor.idProduct; u8 *buf; - int mos7840_num_ports; + int device_type; + + if (product == MOSCHIP_DEVICE_ID_7810 || + product == MOSCHIP_DEVICE_ID_7820) { + device_type = product; + goto out; + } buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL); - if (buf) { - usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), + if (!buf) + return -ENOMEM; + + usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); - data = *buf; - kfree(buf); - } - if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 || - serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) { - device_type = serial->dev->descriptor.idProduct; - } else { - /* For a MCS7840 device GPIO0 must be set to 1 */ - if ((data & 0x01) == 1) - device_type = MOSCHIP_DEVICE_ID_7840; - else if (mos7810_check(serial)) - device_type = MOSCHIP_DEVICE_ID_7810; - else - device_type = MOSCHIP_DEVICE_ID_7820; - } + /* For a MCS7840 device GPIO0 must be set to 1 */ + if (buf[0] & 0x01) + device_type = MOSCHIP_DEVICE_ID_7840; + else if (mos7810_check(serial)) + device_type = MOSCHIP_DEVICE_ID_7810; + else + device_type = MOSCHIP_DEVICE_ID_7820; + + kfree(buf); +out: + usb_set_serial_data(serial, (void *)device_type); + + return 0; +} + +static int mos7840_calc_num_ports(struct usb_serial *serial) +{ + int device_type = (int)usb_get_serial_data(serial); + int mos7840_num_ports; mos7840_num_ports = (device_type >> 4) & 0x000F; - serial->num_bulk_in = mos7840_num_ports; - serial->num_bulk_out = mos7840_num_ports; - serial->num_ports = mos7840_num_ports; return mos7840_num_ports; } @@ -2240,6 +2236,7 @@ static int mos7840_calc_num_ports(struct usb_serial *serial) static int mos7840_port_probe(struct usb_serial_port *port) { struct usb_serial *serial = port->serial; + int device_type = (int)usb_get_serial_data(serial); struct moschip_port *mos7840_port; int status; int pnum; @@ -2496,9 +2493,7 @@ static struct usb_serial_driver moschip7840_4port_device = { .throttle = mos7840_throttle, .unthrottle = mos7840_unthrottle, .calc_num_ports = mos7840_calc_num_ports, -#ifdef MCSSerialProbe - .probe = mos7840_serial_probe, -#endif + .probe = mos7840_probe, .ioctl = mos7840_ioctl, .set_termios = mos7840_set_termios, .break_ctl = mos7840_break, From 05cf0dec5ccc696a7636c84b265b477173498156 Mon Sep 17 00:00:00 2001 From: Johan Hovold <jhovold@gmail.com> Date: Fri, 26 Jul 2013 11:55:19 +0200 Subject: [PATCH 546/913] USB: mos7840: fix race in led handling Fix race in LED handling introduced by commit 0eafe4de ("USB: serial: mos7840: add support for MCS7810 devices") which reused the port control urb for manipulating the LED without making sure that the urb is not already in use. This could lead to the control urb being manipulated while in flight. Fix by adding a dedicated LED urb and ctrlrequest along with a LED-busy flag to handle concurrency. Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/mos7840.c | 59 ++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index e95d91434785..c10fc15bf851 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -185,6 +185,7 @@ enum mos7840_flag { MOS7840_FLAG_CTRL_BUSY, + MOS7840_FLAG_LED_BUSY, }; static const struct usb_device_id id_table[] = { @@ -240,9 +241,10 @@ struct moschip_port { /* For device(s) with LED indicator */ bool has_led; - bool led_flag; struct timer_list led_timer1; /* Timer for LED on */ struct timer_list led_timer2; /* Timer for LED off */ + struct urb *led_urb; + struct usb_ctrlrequest *led_dr; unsigned long flags; }; @@ -535,7 +537,7 @@ static void mos7840_set_led_async(struct moschip_port *mcs, __u16 wval, __u16 reg) { struct usb_device *dev = mcs->port->serial->dev; - struct usb_ctrlrequest *dr = mcs->dr; + struct usb_ctrlrequest *dr = mcs->led_dr; dr->bRequestType = MCS_WR_RTYPE; dr->bRequest = MCS_WRREQ; @@ -543,10 +545,10 @@ static void mos7840_set_led_async(struct moschip_port *mcs, __u16 wval, dr->wIndex = cpu_to_le16(reg); dr->wLength = cpu_to_le16(0); - usb_fill_control_urb(mcs->control_urb, dev, usb_sndctrlpipe(dev, 0), + usb_fill_control_urb(mcs->led_urb, dev, usb_sndctrlpipe(dev, 0), (unsigned char *)dr, NULL, 0, mos7840_set_led_callback, NULL); - usb_submit_urb(mcs->control_urb, GFP_ATOMIC); + usb_submit_urb(mcs->led_urb, GFP_ATOMIC); } static void mos7840_set_led_sync(struct usb_serial_port *port, __u16 reg, @@ -572,7 +574,19 @@ static void mos7840_led_flag_off(unsigned long arg) { struct moschip_port *mcs = (struct moschip_port *) arg; - mcs->led_flag = false; + clear_bit_unlock(MOS7840_FLAG_LED_BUSY, &mcs->flags); +} + +static void mos7840_led_activity(struct usb_serial_port *port) +{ + struct moschip_port *mos7840_port = usb_get_serial_port_data(port); + + if (test_and_set_bit_lock(MOS7840_FLAG_LED_BUSY, &mos7840_port->flags)) + return; + + mos7840_set_led_async(mos7840_port, 0x0301, MODEM_CONTROL_REGISTER); + mod_timer(&mos7840_port->led_timer1, + jiffies + msecs_to_jiffies(LED_ON_MS)); } /***************************************************************************** @@ -770,14 +784,8 @@ static void mos7840_bulk_in_callback(struct urb *urb) return; } - /* Turn on LED */ - if (mos7840_port->has_led && !mos7840_port->led_flag) { - mos7840_port->led_flag = true; - mos7840_set_led_async(mos7840_port, 0x0301, - MODEM_CONTROL_REGISTER); - mod_timer(&mos7840_port->led_timer1, - jiffies + msecs_to_jiffies(LED_ON_MS)); - } + if (mos7840_port->has_led) + mos7840_led_activity(port); mos7840_port->read_urb_busy = true; retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); @@ -1454,13 +1462,8 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, data1 = urb->transfer_buffer; dev_dbg(&port->dev, "bulkout endpoint is %d\n", port->bulk_out_endpointAddress); - /* Turn on LED */ - if (mos7840_port->has_led && !mos7840_port->led_flag) { - mos7840_port->led_flag = true; - mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0301); - mod_timer(&mos7840_port->led_timer1, - jiffies + msecs_to_jiffies(LED_ON_MS)); - } + if (mos7840_port->has_led) + mos7840_led_activity(port); /* send it down the pipe */ status = usb_submit_urb(urb, GFP_ATOMIC); @@ -2412,6 +2415,14 @@ static int mos7840_port_probe(struct usb_serial_port *port) if (device_type == MOSCHIP_DEVICE_ID_7810) { mos7840_port->has_led = true; + mos7840_port->led_urb = usb_alloc_urb(0, GFP_KERNEL); + mos7840_port->led_dr = kmalloc(sizeof(*mos7840_port->led_dr), + GFP_KERNEL); + if (!mos7840_port->led_urb || !mos7840_port->led_dr) { + status = -ENOMEM; + goto error; + } + init_timer(&mos7840_port->led_timer1); mos7840_port->led_timer1.function = mos7840_led_off; mos7840_port->led_timer1.expires = @@ -2424,8 +2435,6 @@ static int mos7840_port_probe(struct usb_serial_port *port) jiffies + msecs_to_jiffies(LED_OFF_MS); mos7840_port->led_timer2.data = (unsigned long)mos7840_port; - mos7840_port->led_flag = false; - /* Turn off LED */ mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0300); } @@ -2447,6 +2456,8 @@ out: } return 0; error: + kfree(mos7840_port->led_dr); + usb_free_urb(mos7840_port->led_urb); kfree(mos7840_port->dr); kfree(mos7840_port->ctrl_buf); usb_free_urb(mos7840_port->control_urb); @@ -2467,6 +2478,10 @@ static int mos7840_port_remove(struct usb_serial_port *port) del_timer_sync(&mos7840_port->led_timer1); del_timer_sync(&mos7840_port->led_timer2); + + usb_kill_urb(mos7840_port->led_urb); + usb_free_urb(mos7840_port->led_urb); + kfree(mos7840_port->led_dr); } usb_kill_urb(mos7840_port->control_urb); usb_free_urb(mos7840_port->control_urb); From 555445cd11803c6bc93b2be31968f3949ef7708b Mon Sep 17 00:00:00 2001 From: Francesco Fusco <ffusco@redhat.com> Date: Wed, 24 Jul 2013 10:39:06 +0200 Subject: [PATCH 547/913] neigh: prevent overflowing params in /proc/sys/net/ipv4/neigh/ Without this patch, the fields app_solicit, gc_thresh1, gc_thresh2, gc_thresh3, proxy_qlen, ucast_solicit, mcast_solicit could have assumed negative values when setting large numbers. Signed-off-by: Francesco Fusco <ffusco@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/core/neighbour.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/net/core/neighbour.c b/net/core/neighbour.c index b7de821f98df..9232c68941ab 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -2767,6 +2767,7 @@ EXPORT_SYMBOL(neigh_app_ns); #ifdef CONFIG_SYSCTL static int zero; +static int int_max = INT_MAX; static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN); static int proc_unres_qlen(struct ctl_table *ctl, int write, @@ -2819,19 +2820,25 @@ static struct neigh_sysctl_table { .procname = "mcast_solicit", .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .extra1 = &zero, + .extra2 = &int_max, + .proc_handler = proc_dointvec_minmax, }, [NEIGH_VAR_UCAST_PROBE] = { .procname = "ucast_solicit", .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .extra1 = &zero, + .extra2 = &int_max, + .proc_handler = proc_dointvec_minmax, }, [NEIGH_VAR_APP_PROBE] = { .procname = "app_solicit", .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .extra1 = &zero, + .extra2 = &int_max, + .proc_handler = proc_dointvec_minmax, }, [NEIGH_VAR_RETRANS_TIME] = { .procname = "retrans_time", @@ -2874,7 +2881,9 @@ static struct neigh_sysctl_table { .procname = "proxy_qlen", .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .extra1 = &zero, + .extra2 = &int_max, + .proc_handler = proc_dointvec_minmax, }, [NEIGH_VAR_ANYCAST_DELAY] = { .procname = "anycast_delay", @@ -2916,19 +2925,25 @@ static struct neigh_sysctl_table { .procname = "gc_thresh1", .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .extra1 = &zero, + .extra2 = &int_max, + .proc_handler = proc_dointvec_minmax, }, [NEIGH_VAR_GC_THRESH2] = { .procname = "gc_thresh2", .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .extra1 = &zero, + .extra2 = &int_max, + .proc_handler = proc_dointvec_minmax, }, [NEIGH_VAR_GC_THRESH3] = { .procname = "gc_thresh3", .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .extra1 = &zero, + .extra2 = &int_max, + .proc_handler = proc_dointvec_minmax, }, {}, }, From d738ce8fdc05ebf5b1475f8ae26d908c8c50970b Mon Sep 17 00:00:00 2001 From: Francesco Fusco <ffusco@redhat.com> Date: Wed, 24 Jul 2013 10:39:07 +0200 Subject: [PATCH 548/913] sysctl: range checking in do_proc_dointvec_ms_jiffies_conv When (integer) sysctl values are expressed in ms and have to be represented internally as jiffies. The msecs_to_jiffies function returns an unsigned long, which gets assigned to the integer. This patch prevents the value to be assigned if bigger than INT_MAX, done in a similar way as in cba9f3 ("Range checking in do_proc_dointvec_(userhz_)jiffies_conv"). Signed-off-by: Francesco Fusco <ffusco@redhat.com> CC: Andrew Morton <akpm@linux-foundation.org> CC: linux-kernel@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net> --- kernel/sysctl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ac09d98490aa..07f6fc468e17 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2346,7 +2346,11 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp, int write, void *data) { if (write) { - *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp); + unsigned long jif = msecs_to_jiffies(*negp ? -*lvalp : *lvalp); + + if (jif > INT_MAX) + return 1; + *valp = (int)jif; } else { int val = *valp; unsigned long lval; From d8af4dfd84329015e18ea3d83a84c46e92f21020 Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 17:25:08 +0800 Subject: [PATCH 549/913] net/tg3: Fix kernel crash While EEH error happens, we might not have network device instance (struct net_device) yet. So we can't access the instance safely and check its link state, which causes kernel crash. The patch fixes it. EEH: Frozen PE#2 on PHB#3 detected EEH: This PCI device has failed 1 times in the last hour EEH: Notify device drivers to shutdown (NULL net_device): PCI I/O error detected Unable to handle kernel paging request for data at address 0x00000048 Faulting instruction address: 0xd00000001c9387a8 Oops: Kernel access of bad area, sig: 11 [#1] SMP NR_CPUS=1024 NUMA PowerNV : NIP [d00000001c9387a8] .tg3_io_error_detected+0x78/0x2a0 [tg3] LR [d00000001c9387a4] .tg3_io_error_detected+0x74/0x2a0 [tg3] Call Trace: [c000003f93a0f960] [d00000001c9387a4] .tg3_io_error_detected+0x74/0x2a0 [tg3] [c000003f93a0fa30] [c00000000003844c] .eeh_report_error+0xac/0x120 [c000003f93a0fac0] [c0000000000371bc] .eeh_pe_dev_traverse+0x8c/0x150 [c000003f93a0fb60] [c000000000038858] .eeh_handle_normal_event+0x128/0x3d0 [c000003f93a0fbf0] [c000000000038db8] .eeh_handle_event+0x2b8/0x2c0 [c000003f93a0fc90] [c000000000038e80] .eeh_event_handler+0xc0/0x170 [c000003f93a0fd30] [c0000000000cc000] .kthread+0xf0/0x100 [c000003f93a0fe30] [c00000000000a0dc] .ret_from_kernel_thread+0x5c/0x80 Reported-by: Wei Yang <weiyang@linux.vnet.ibm.com> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Acked-by: Nithin Nayak Sujir <nsujir@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/broadcom/tg3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index d964f302ac94..aee1b9a79b30 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -17773,7 +17773,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, rtnl_lock(); - if (!netif_running(netdev)) + /* We probably don't have netdev yet */ + if (!netdev || !netif_running(netdev)) goto done; tg3_phy_stop(tp); From c80dc13dda73db67e156b161d06c78f266b36ea6 Mon Sep 17 00:00:00 2001 From: Gavin Shan <shangw@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 17:25:09 +0800 Subject: [PATCH 550/913] net/tg3: Fix warning from pci_disable_device() The patch fixes following warning. The PCI device might have been disabled somewhere else when we have EEH errors during early stage. Device tg3 disabling already-disabled device WARNING: at drivers/pci/pci.c:1403 : NIP [c00000000044fd5c] .pci_disable_device+0xcc/0xe0 LR [c00000000044fd58] .pci_disable_device+0xc8/0xe0 Call Trace: [c000003f80bc7370] [c00000000044fd58] .pci_disable_device+0xc8/0xe0 [c000003f80bc73f0] [d00000001cfe8fc0] .tg3_init_one+0x2f0/0x19f0 [tg3] [c000003f80bc74d0] [c0000000004534e8] .local_pci_probe+0x68/0xb0 [c000003f80bc7560] [c0000000004537c8] .pci_device_probe+0x198/0x1a0 [c000003f80bc7610] [c0000000004f9e98] .driver_probe_device+0xd8/0x450 [c000003f80bc76a0] [c0000000004fa3bc] .__driver_attach+0x10c/0x110 [c000003f80bc7730] [c0000000004f6e94] .bus_for_each_dev+0x94/0x100 [c000003f80bc77d0] [c0000000004f9634] .driver_attach+0x34/0x50 [c000003f80bc7850] [c0000000004f8f98] .bus_add_driver+0x288/0x380 [c000003f80bc78f0] [c0000000004fae2c] .driver_register+0x9c/0x200 [c000003f80bc7980] [c000000000453214] .__pci_register_driver+0x64/0x90 [c000003f80bc7a10] [d00000001cff7a60] .tg3_driver_init+0x2c/0x40 [tg3] [c000003f80bc7a80] [c00000000000b424] .do_one_initcall+0x144/0x1f0 [c000003f80bc7b70] [c0000000001244a0] .load_module+0x1f30/0x2700 [c000003f80bc7d40] [c000000000124e80] .SyS_finit_module+0xc0/0x110 [c000003f80bc7e30] [c000000000009dd4] syscall_exit+0x0/0x98 Reported-by: Wei Yang <weiyang@linux.vnet.ibm.com> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Acked-by: Nithin Nayak Sujir <nsujir@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/broadcom/tg3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index aee1b9a79b30..ddebc7a5dda0 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -17625,7 +17625,8 @@ err_out_free_res: pci_release_regions(pdev); err_out_disable_pdev: - pci_disable_device(pdev); + if (pci_is_enabled(pdev)) + pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); return err; } From 8fd62389a778c902c7e8532594ea924bbaf465e8 Mon Sep 17 00:00:00 2001 From: Rohit Vaswani <rvaswani@codeaurora.org> Date: Tue, 18 Jun 2013 18:53:33 -0700 Subject: [PATCH 551/913] ARM: msm: Consolidate gpiomux for older architectures Msm gpiomux can be used only for 7x30 and 8x50. Prevent compilation and fix build issues on 7X00, 8X60 and 8960. Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org> Signed-off-by: David Brown <davidb@codeaurora.org> --- arch/arm/mach-msm/Kconfig | 3 +-- arch/arm/mach-msm/gpiomux-v1.c | 33 --------------------------------- arch/arm/mach-msm/gpiomux.h | 10 ---------- 3 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 arch/arm/mach-msm/gpiomux-v1.c diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig index 614e41e7881b..905efc8cac79 100644 --- a/arch/arm/mach-msm/Kconfig +++ b/arch/arm/mach-msm/Kconfig @@ -121,8 +121,7 @@ config MSM_SMD bool config MSM_GPIOMUX - depends on !(ARCH_MSM8X60 || ARCH_MSM8960) - bool "MSM V1 TLMM GPIOMUX architecture" + bool help Support for MSM V1 TLMM GPIOMUX architecture. diff --git a/arch/arm/mach-msm/gpiomux-v1.c b/arch/arm/mach-msm/gpiomux-v1.c deleted file mode 100644 index 27de2abd7144..000000000000 --- a/arch/arm/mach-msm/gpiomux-v1.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ -#include <linux/kernel.h> -#include "gpiomux.h" -#include "proc_comm.h" - -void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val) -{ - unsigned tlmm_config = (val & ~GPIOMUX_CTL_MASK) | - ((gpio & 0x3ff) << 4); - unsigned tlmm_disable = 0; - int rc; - - rc = msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, - &tlmm_config, &tlmm_disable); - if (rc) - pr_err("%s: unexpected proc_comm failure %d: %08x %08x\n", - __func__, rc, tlmm_config, tlmm_disable); -} diff --git a/arch/arm/mach-msm/gpiomux.h b/arch/arm/mach-msm/gpiomux.h index 8e82f41a8923..4410d7766f93 100644 --- a/arch/arm/mach-msm/gpiomux.h +++ b/arch/arm/mach-msm/gpiomux.h @@ -73,16 +73,6 @@ extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS]; int msm_gpiomux_write(unsigned gpio, gpiomux_config_t active, gpiomux_config_t suspended); - -/* Architecture-internal function for use by the framework only. - * This function can assume the following: - * - the gpio value has passed a bounds-check - * - the gpiomux spinlock has been obtained - * - * This function is not for public consumption. External users - * should use msm_gpiomux_write. - */ -void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val); #else static inline int msm_gpiomux_write(unsigned gpio, gpiomux_config_t active, From 4ffd9e2c4deda2ad90ce261174b2bc90e0660703 Mon Sep 17 00:00:00 2001 From: Vineet Gupta <vgupta@synopsys.com> Date: Fri, 26 Jul 2013 15:29:40 -0700 Subject: [PATCH 552/913] ARC: SMP build breakage Signed-off-by: Vineet Gupta <vgupta@synopsys.com> --- arch/arc/include/asm/entry.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arc/include/asm/entry.h b/arch/arc/include/asm/entry.h index 8943c028d4bb..df57611652e5 100644 --- a/arch/arc/include/asm/entry.h +++ b/arch/arc/include/asm/entry.h @@ -38,6 +38,7 @@ #include <asm/ptrace.h> #include <asm/processor.h> /* For VMALLOC_START */ #include <asm/thread_info.h> /* For THREAD_SIZE */ +#include <asm/mmu.h> /* Note on the LD/ST addr modes with addr reg wback * From ebe7fdbaf3e90ea22feade6c9f5e50f42b23b6d8 Mon Sep 17 00:00:00 2001 From: Neil Horman <nhorman@tuxdriver.com> Date: Fri, 26 Jul 2013 12:47:14 -0400 Subject: [PATCH 553/913] atl1c: Fix misuse of netdev_alloc_skb in refilling rx ring atl1c uses netdev_alloc_skb to refill its rx dma ring, but that call makes no guarantees about the suitability of the memory for use in DMA. As a result we've gotten reports of atl1c drivers occasionally hanging and needing to be reset: https://bugzilla.kernel.org/show_bug.cgi?id=54021 Fix this by modifying the call to use the internal version __netdev_alloc_skb, where you can set the gfp_mask explicitly to include GFP_DMA. Tested by two reporters in the above bug, who have the hardware to validate it. Both report immediate cessation of the problem with this patch Signed-off-by: Neil Horman <nhorman@tuxdriver.com> CC: Jay Cliburn <jcliburn@gmail.com> CC: "David S. Miller" <davem@davemloft.net> CC: stable@vger.kernel.org Tested-by: Luis Henriques <luis.henriques@canonical.com> Tested-by: Vincent Alquier <vincent.alquier@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 786a87483298..d5e38d1ea3a2 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -1660,7 +1660,7 @@ static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter) while (next_info->flags & ATL1C_BUFFER_FREE) { rfd_desc = ATL1C_RFD_DESC(rfd_ring, rfd_next_to_use); - skb = netdev_alloc_skb(adapter->netdev, adapter->rx_buffer_len); + skb = __netdev_alloc_skb(adapter->netdev, adapter->rx_buffer_len, GFP_ATOMIC|GFP_DMA); if (unlikely(!skb)) { if (netif_msg_rx_err(adapter)) dev_warn(&pdev->dev, "alloc rx buffer failed\n"); From d970d7fe65adff5efe75b4a73c4ffc9be57089f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de> Date: Thu, 4 Jul 2013 11:28:51 +0200 Subject: [PATCH 554/913] serial/mxs-auart: fix race condition in interrupt handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The handler needs to ack the pending events before actually handling them. Otherwise a new event might come in after it it considered non-pending or handled and is acked then without being handled. So this event is only noticed when the next interrupt happens. Without this patch an i.MX28 based machine running an rt-patched kernel regularly hangs during boot. Cc: stable@vger.kernel.org # v2.6.39+ Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/tty/serial/mxs-auart.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 4f5f161896a1..3de0fb2712f5 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -678,11 +678,18 @@ static void mxs_auart_settermios(struct uart_port *u, static irqreturn_t mxs_auart_irq_handle(int irq, void *context) { - u32 istatus, istat; + u32 istat; struct mxs_auart_port *s = context; u32 stat = readl(s->port.membase + AUART_STAT); - istatus = istat = readl(s->port.membase + AUART_INTR); + istat = readl(s->port.membase + AUART_INTR); + + /* ack irq */ + writel(istat & (AUART_INTR_RTIS + | AUART_INTR_TXIS + | AUART_INTR_RXIS + | AUART_INTR_CTSMIS), + s->port.membase + AUART_INTR_CLR); if (istat & AUART_INTR_CTSMIS) { uart_handle_cts_change(&s->port, stat & AUART_STAT_CTS); @@ -702,12 +709,6 @@ static irqreturn_t mxs_auart_irq_handle(int irq, void *context) istat &= ~AUART_INTR_TXIS; } - writel(istatus & (AUART_INTR_RTIS - | AUART_INTR_TXIS - | AUART_INTR_RXIS - | AUART_INTR_CTSMIS), - s->port.membase + AUART_INTR_CLR); - return IRQ_HANDLED; } From 079a036f4283e2b0e5c26080b8c5112bc0cc1831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de> Date: Fri, 28 Jun 2013 11:49:41 +0200 Subject: [PATCH 555/913] serial/mxs-auart: increase time to wait for transmitter to become idle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this patch the driver waits ~1 ms for the UART to become idle. At 115200n8 this time is (theoretically) enough to transfer 11.5 characters (= 115200 bits/s / (10 Bits/char) * 1ms). As the mxs-auart has a fifo size of 16 characters the clock is gated too early. The problem is worse for lower baud rates. This only happens to really shut down the transmitter in the middle of a transfer if /dev/ttyAPPx isn't opened in userspace (e.g. by a getty) but was at least once (because the bootloader doesn't disable the transmitter). So increase the timeout to 20 ms which should be enough for 9600n8, too. Moreover skip gating the clock if the timeout is elapsed. Cc: stable@vger.kernel.org # v2.6.39+ Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/tty/serial/mxs-auart.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 3de0fb2712f5..f85b8e6d0346 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -851,7 +851,7 @@ auart_console_write(struct console *co, const char *str, unsigned int count) struct mxs_auart_port *s; struct uart_port *port; unsigned int old_ctrl0, old_ctrl2; - unsigned int to = 1000; + unsigned int to = 20000; if (co->index >= MXS_AUART_PORTS || co->index < 0) return; @@ -872,18 +872,23 @@ auart_console_write(struct console *co, const char *str, unsigned int count) uart_console_write(port, str, count, mxs_auart_console_putchar); - /* - * Finally, wait for transmitter to become empty - * and restore the TCR - */ + /* Finally, wait for transmitter to become empty ... */ while (readl(port->membase + AUART_STAT) & AUART_STAT_BUSY) { + udelay(1); if (!to--) break; - udelay(1); } - writel(old_ctrl0, port->membase + AUART_CTRL0); - writel(old_ctrl2, port->membase + AUART_CTRL2); + /* + * ... and restore the TCR if we waited long enough for the transmitter + * to be idle. This might keep the transmitter enabled although it is + * unused, but that is better than to disable it while it is still + * transmitting. + */ + if (!(readl(port->membase + AUART_STAT) & AUART_STAT_BUSY)) { + writel(old_ctrl0, port->membase + AUART_CTRL0); + writel(old_ctrl2, port->membase + AUART_CTRL2); + } clk_disable(s->clk); } From 1d9e689c934bd5ecb0f273c6c65e0655c5cfee5f Mon Sep 17 00:00:00 2001 From: Gianluca Anzolin <gianluca@sottospazio.it> Date: Thu, 25 Jul 2013 07:26:16 +0200 Subject: [PATCH 556/913] tty_port: Fix refcounting leak in tty_port_tty_hangup() The function tty_port_tty_hangup() could leak a reference to the tty_struct: struct tty_struct *tty = tty_port_tty_get(port); if (tty && (!check_clocal || !C_CLOCAL(tty))) { tty_hangup(tty); tty_kref_put(tty); } If tty != NULL and the second condition is false we never call tty_kref_put and the reference is leaked. Fix by always calling tty_kref_put() which accepts a NULL argument. The patch fixes a regression introduced by commit aa27a094. Acked-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Gianluca Anzolin <gianluca@sottospazio.it> Acked-by: Jiri Slaby <jslaby@suse.cz> Cc: stable <stable@vger.kernel.org> # 3.10 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/tty/tty_port.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 121aeb9393e1..f597e88a705d 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -256,10 +256,9 @@ void tty_port_tty_hangup(struct tty_port *port, bool check_clocal) { struct tty_struct *tty = tty_port_tty_get(port); - if (tty && (!check_clocal || !C_CLOCAL(tty))) { + if (tty && (!check_clocal || !C_CLOCAL(tty))) tty_hangup(tty); - tty_kref_put(tty); - } + tty_kref_put(tty); } EXPORT_SYMBOL_GPL(tty_port_tty_hangup); From d5a12ea7a9e58d9e5c19d25cb668aadb396423ec Mon Sep 17 00:00:00 2001 From: Axel Lin <axel.lin@ingics.com> Date: Sun, 21 Jul 2013 10:14:15 +0800 Subject: [PATCH 557/913] serial: arc_uart: Fix module alias Platform drivers use "platform:" prefix in module alias. Also use DRIVER_NAME in MODULE_ALIAS to make module autoloading work. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Vineet Gupta <vgupta@synopsys.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/tty/serial/arc_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c index cbf1d155b7b2..22f280aa4f2c 100644 --- a/drivers/tty/serial/arc_uart.c +++ b/drivers/tty/serial/arc_uart.c @@ -773,6 +773,6 @@ module_init(arc_serial_init); module_exit(arc_serial_exit); MODULE_LICENSE("GPL"); -MODULE_ALIAS("plat-arcfpga/uart"); +MODULE_ALIAS("platform:" DRIVER_NAME); MODULE_AUTHOR("Vineet Gupta"); MODULE_DESCRIPTION("ARC(Synopsys) On-Chip(fpga) serial driver"); From 6eddacae385052c7a1f4f60ffdf0eeec88088ad0 Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Sat, 27 Jul 2013 00:45:45 +0100 Subject: [PATCH 558/913] ARM: Fix sorting of machine- initializers So, there's a comment I put at the top of this, which people seem to fail to read. So let's fix it for them instead. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index c0ac0f5e5e5c..6fd2ceae305a 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -153,6 +153,7 @@ machine-$(CONFIG_ARCH_DAVINCI) += davinci machine-$(CONFIG_ARCH_DOVE) += dove machine-$(CONFIG_ARCH_EBSA110) += ebsa110 machine-$(CONFIG_ARCH_EP93XX) += ep93xx +machine-$(CONFIG_ARCH_EXYNOS) += exynos machine-$(CONFIG_ARCH_GEMINI) += gemini machine-$(CONFIG_ARCH_HIGHBANK) += highbank machine-$(CONFIG_ARCH_INTEGRATOR) += integrator @@ -160,15 +161,16 @@ machine-$(CONFIG_ARCH_IOP13XX) += iop13xx machine-$(CONFIG_ARCH_IOP32X) += iop32x machine-$(CONFIG_ARCH_IOP33X) += iop33x machine-$(CONFIG_ARCH_IXP4XX) += ixp4xx +machine-$(CONFIG_ARCH_KEYSTONE) += keystone machine-$(CONFIG_ARCH_KIRKWOOD) += kirkwood machine-$(CONFIG_ARCH_KS8695) += ks8695 machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx machine-$(CONFIG_ARCH_MMP) += mmp machine-$(CONFIG_ARCH_MSM) += msm machine-$(CONFIG_ARCH_MV78XX0) += mv78xx0 +machine-$(CONFIG_ARCH_MVEBU) += mvebu machine-$(CONFIG_ARCH_MXC) += imx machine-$(CONFIG_ARCH_MXS) += mxs -machine-$(CONFIG_ARCH_MVEBU) += mvebu machine-$(CONFIG_ARCH_NETX) += netx machine-$(CONFIG_ARCH_NOMADIK) += nomadik machine-$(CONFIG_ARCH_NSPIRE) += nspire @@ -176,7 +178,6 @@ machine-$(CONFIG_ARCH_OMAP1) += omap1 machine-$(CONFIG_ARCH_OMAP2PLUS) += omap2 machine-$(CONFIG_ARCH_ORION5X) += orion5x machine-$(CONFIG_ARCH_PICOXCELL) += picoxcell -machine-$(CONFIG_ARCH_SIRF) += prima2 machine-$(CONFIG_ARCH_PXA) += pxa machine-$(CONFIG_ARCH_REALVIEW) += realview machine-$(CONFIG_ARCH_ROCKCHIP) += rockchip @@ -186,25 +187,24 @@ machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx machine-$(CONFIG_ARCH_S5P64X0) += s5p64x0 machine-$(CONFIG_ARCH_S5PC100) += s5pc100 machine-$(CONFIG_ARCH_S5PV210) += s5pv210 -machine-$(CONFIG_ARCH_EXYNOS) += exynos machine-$(CONFIG_ARCH_SA1100) += sa1100 machine-$(CONFIG_ARCH_SHARK) += shark machine-$(CONFIG_ARCH_SHMOBILE) += shmobile +machine-$(CONFIG_ARCH_SIRF) += prima2 +machine-$(CONFIG_ARCH_SOCFPGA) += socfpga +machine-$(CONFIG_ARCH_STI) += sti +machine-$(CONFIG_ARCH_SUNXI) += sunxi machine-$(CONFIG_ARCH_TEGRA) += tegra machine-$(CONFIG_ARCH_U300) += u300 machine-$(CONFIG_ARCH_U8500) += ux500 machine-$(CONFIG_ARCH_VERSATILE) += versatile machine-$(CONFIG_ARCH_VEXPRESS) += vexpress +machine-$(CONFIG_ARCH_VIRT) += virt machine-$(CONFIG_ARCH_VT8500) += vt8500 machine-$(CONFIG_ARCH_W90X900) += w90x900 -machine-$(CONFIG_FOOTBRIDGE) += footbridge -machine-$(CONFIG_ARCH_SOCFPGA) += socfpga -machine-$(CONFIG_PLAT_SPEAR) += spear -machine-$(CONFIG_ARCH_STI) += sti -machine-$(CONFIG_ARCH_VIRT) += virt machine-$(CONFIG_ARCH_ZYNQ) += zynq -machine-$(CONFIG_ARCH_SUNXI) += sunxi -machine-$(CONFIG_ARCH_KEYSTONE) += keystone +machine-$(CONFIG_FOOTBRIDGE) += footbridge +machine-$(CONFIG_PLAT_SPEAR) += spear # Platform directory name. This list is sorted alphanumerically # by CONFIG_* macro name. From 0699a73af3811b66b1ab5650575acee5eea841ab Mon Sep 17 00:00:00 2001 From: Clemens Ladisch <clemens@ladisch.de> Date: Mon, 22 Jul 2013 21:32:09 +0200 Subject: [PATCH 559/913] firewire: fix libdc1394/FlyCap2 iso event regression Commit 18d627113b83 (firewire: prevent dropping of completed iso packet header data) was intended to be an obvious bug fix, but libdc1394 and FlyCap2 depend on the old behaviour by ignoring all returned information and thus not noticing that not all packets have been received yet. The result was that the video frame buffers would be saved before they contained the correct data. Reintroduce the old behaviour for old clients. Tested-by: Stepan Salenikovich <stepan.salenikovich@gmail.com> Tested-by: Josep Bosch <jep250@gmail.com> Cc: <stable@vger.kernel.org> # 3.4+ Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> --- drivers/firewire/core-cdev.c | 3 +++ drivers/firewire/ohci.c | 10 ++++++++-- include/linux/firewire.h | 1 + include/uapi/linux/firewire-cdev.h | 4 ++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 7ef316fdc4d9..ac1b43a04285 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -54,6 +54,7 @@ #define FW_CDEV_KERNEL_VERSION 5 #define FW_CDEV_VERSION_EVENT_REQUEST2 4 #define FW_CDEV_VERSION_ALLOCATE_REGION_END 4 +#define FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW 5 struct client { u32 version; @@ -1005,6 +1006,8 @@ static int ioctl_create_iso_context(struct client *client, union ioctl_arg *arg) a->channel, a->speed, a->header_size, cb, client); if (IS_ERR(context)) return PTR_ERR(context); + if (client->version < FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW) + context->drop_overflow_headers = true; /* We only support one context at this time. */ spin_lock_irq(&client->lock); diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 9e1db6490b9a..afb701ec90ca 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -2749,8 +2749,11 @@ static void copy_iso_headers(struct iso_context *ctx, const u32 *dma_hdr) { u32 *ctx_hdr; - if (ctx->header_length + ctx->base.header_size > PAGE_SIZE) + if (ctx->header_length + ctx->base.header_size > PAGE_SIZE) { + if (ctx->base.drop_overflow_headers) + return; flush_iso_completions(ctx); + } ctx_hdr = ctx->header + ctx->header_length; ctx->last_timestamp = (u16)le32_to_cpu((__force __le32)dma_hdr[0]); @@ -2910,8 +2913,11 @@ static int handle_it_packet(struct context *context, sync_it_packet_for_cpu(context, d); - if (ctx->header_length + 4 > PAGE_SIZE) + if (ctx->header_length + 4 > PAGE_SIZE) { + if (ctx->base.drop_overflow_headers) + return 1; flush_iso_completions(ctx); + } ctx_hdr = ctx->header + ctx->header_length; ctx->last_timestamp = le16_to_cpu(last->res_count); diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 3b0e820375ab..5d7782e42b8f 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h @@ -436,6 +436,7 @@ struct fw_iso_context { int type; int channel; int speed; + bool drop_overflow_headers; size_t header_size; union { fw_iso_callback_t sc; diff --git a/include/uapi/linux/firewire-cdev.h b/include/uapi/linux/firewire-cdev.h index d50036953497..1db453e4b550 100644 --- a/include/uapi/linux/firewire-cdev.h +++ b/include/uapi/linux/firewire-cdev.h @@ -215,8 +215,8 @@ struct fw_cdev_event_request2 { * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets * without the interrupt bit set that the kernel's internal buffer for @header - * is about to overflow. (In the last case, kernels with ABI version < 5 drop - * header data up to the next interrupt packet.) + * is about to overflow. (In the last case, ABI versions < 5 drop header data + * up to the next interrupt packet.) * * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): * From fafb6ebe384e62e68519ae8f5ae9b2cb578d7dde Mon Sep 17 00:00:00 2001 From: "David S. Miller" <davem@davemloft.net> Date: Sat, 27 Jul 2013 20:00:44 -0700 Subject: [PATCH 560/913] Revert "atl1c: Fix misuse of netdev_alloc_skb in refilling rx ring" This reverts commit ebe7fdbaf3e90ea22feade6c9f5e50f42b23b6d8. This change is not correct. GFP_DMA is not necessary for this device. There is some other problem causing this bug. Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index d5e38d1ea3a2..786a87483298 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -1660,7 +1660,7 @@ static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter) while (next_info->flags & ATL1C_BUFFER_FREE) { rfd_desc = ATL1C_RFD_DESC(rfd_ring, rfd_next_to_use); - skb = __netdev_alloc_skb(adapter->netdev, adapter->rx_buffer_len, GFP_ATOMIC|GFP_DMA); + skb = netdev_alloc_skb(adapter->netdev, adapter->rx_buffer_len); if (unlikely(!skb)) { if (netif_msg_rx_err(adapter)) dev_warn(&pdev->dev, "alloc rx buffer failed\n"); From c70a31750679ca10a46dd0cc2d57ed7b54dbe7c2 Mon Sep 17 00:00:00 2001 From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> Date: Fri, 26 Jul 2013 16:24:00 -0400 Subject: [PATCH 561/913] qlcnic: Fix initialization of work function. Work function needs to be initialized before we participate in inter device communication (IDC). Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index f41dfab1e9a3..51ab4b56fc91 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c @@ -2123,6 +2123,8 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) set_bit(QLC_83XX_MBX_READY, &adapter->ahw->idc.status); qlcnic_83xx_clear_function_resources(adapter); + INIT_DELAYED_WORK(&adapter->idc_aen_work, qlcnic_83xx_idc_aen_work); + /* register for NIC IDC AEN Events */ qlcnic_83xx_register_nic_idc_func(adapter, 1); @@ -2140,8 +2142,6 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) if (adapter->nic_ops->init_driver(adapter)) return -EIO; - INIT_DELAYED_WORK(&adapter->idc_aen_work, qlcnic_83xx_idc_aen_work); - /* Periodically monitor device status */ qlcnic_83xx_idc_poll_dev_state(&adapter->fw_work.work); From 6226204bcf20d2bb8e47e996c1688186355c1db4 Mon Sep 17 00:00:00 2001 From: Pratik Pujar <pratik.pujar@qlogic.com> Date: Fri, 26 Jul 2013 16:24:01 -0400 Subject: [PATCH 562/913] qlcnic: Fix operation type and command type. Operation type and command type is not set correct in back channel response. Signed-off-by: Pratik Pujar <pratik.pujar@qlogic.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 2 ++ drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index 62380ce89905..56e85f98117f 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c @@ -762,6 +762,7 @@ static int qlcnic_sriov_alloc_bc_mbx_args(struct qlcnic_cmd_args *mbx, u32 type) memset(mbx->rsp.arg, 0, sizeof(u32) * mbx->rsp.num); mbx->req.arg[0] = (type | (mbx->req.num << 16) | (3 << 29)); + mbx->rsp.arg[0] = (type & 0xffff) | mbx->rsp.num << 16; return 0; } } @@ -813,6 +814,7 @@ static int qlcnic_sriov_prepare_bc_hdr(struct qlcnic_bc_trans *trans, cmd->req.num = trans->req_pay_size / 4; cmd->rsp.num = trans->rsp_pay_size / 4; hdr = trans->rsp_hdr; + cmd->op_type = trans->req_hdr->op_type; } trans->trans_id = seq; diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index 46aeb593fd52..9bdd51e6b44c 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c @@ -641,8 +641,6 @@ static int qlcnic_sriov_pf_channel_cfg_cmd(struct qlcnic_bc_trans *trans, int err; adapter = vf->adapter; - cmd->rsp.arg[0] = trans->req_hdr->cmd_op; - cmd->rsp.arg[0] |= (1 << 16); if (trans->req_hdr->cmd_op == QLCNIC_BC_CMD_CHANNEL_INIT) { err = qlcnic_sriov_pf_config_vport(adapter, 1, func); @@ -1187,7 +1185,7 @@ static int qlcnic_sriov_pf_get_acl_cmd(struct qlcnic_bc_trans *trans, u8 cmd_op, mode = vp->vlan_mode; cmd_op = trans->req_hdr->cmd_op; - cmd->rsp.arg[0] = (cmd_op & 0xffff) | 14 << 16 | 1 << 25; + cmd->rsp.arg[0] |= 1 << 25; switch (mode) { case QLC_GUEST_VLAN_MODE: From 7cfc1cebdaee367c30e8944dd5adf2f6bbae8123 Mon Sep 17 00:00:00 2001 From: Manish Chopra <manish.chopra@qlogic.com> Date: Fri, 26 Jul 2013 16:24:02 -0400 Subject: [PATCH 563/913] qlcnic: Fix setting Guest VLAN o When configuring guest VLAN after PVID configuration, VF was loading with previously configured PVID. Clear the PVID which was previously configured before configuring guest VLAN. o Display guest VLAN when it is configured Signed-off-by: Manish Chopra <manish.chopra@qlogic.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- .../ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index 9bdd51e6b44c..eb49cd65378c 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c @@ -1749,6 +1749,7 @@ int qlcnic_sriov_set_vf_vlan(struct net_device *netdev, int vf, switch (vlan) { case 4095: + vp->vlan = 0; vp->vlan_mode = QLC_GUEST_VLAN_MODE; break; case 0: @@ -1767,6 +1768,29 @@ int qlcnic_sriov_set_vf_vlan(struct net_device *netdev, int vf, return 0; } +static inline __u32 qlcnic_sriov_get_vf_vlan(struct qlcnic_adapter *adapter, + struct qlcnic_vport *vp, int vf) +{ + __u32 vlan = 0; + + switch (vp->vlan_mode) { + case QLC_PVID_MODE: + vlan = vp->vlan; + break; + case QLC_GUEST_VLAN_MODE: + vlan = MAX_VLAN_ID; + break; + case QLC_NO_VLAN_MODE: + vlan = 0; + break; + default: + netdev_info(adapter->netdev, "Invalid VLAN mode = %d for VF %d\n", + vp->vlan_mode, vf); + } + + return vlan; +} + int qlcnic_sriov_get_vf_config(struct net_device *netdev, int vf, struct ifla_vf_info *ivi) { @@ -1782,7 +1806,7 @@ int qlcnic_sriov_get_vf_config(struct net_device *netdev, vp = sriov->vf_info[vf].vp; memcpy(&ivi->mac, vp->mac, ETH_ALEN); - ivi->vlan = vp->vlan; + ivi->vlan = qlcnic_sriov_get_vf_vlan(adapter, vp, vf); ivi->qos = vp->qos; ivi->spoofchk = vp->spoofchk; if (vp->max_tx_bw == MAX_BW) From c2534384233647a8702eca291199b94ffedc12d3 Mon Sep 17 00:00:00 2001 From: Manish Chopra <manish.chopra@qlogic.com> Date: Fri, 26 Jul 2013 16:24:03 -0400 Subject: [PATCH 564/913] qlcnic: Fix diagnostic interrupt test for 83xx adapters. o Initialize proper interrupt handler for 83xx. Signed-off-by: Manish Chopra <manish.chopra@qlogic.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 41635f2b9399..cc78d3924c6a 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -1383,6 +1383,8 @@ qlcnic_request_irq(struct qlcnic_adapter *adapter) if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { if (qlcnic_82xx_check(adapter)) handler = qlcnic_tmp_intr; + else + handler = qlcnic_83xx_tmp_intr; if (!QLCNIC_IS_MSI_FAMILY(adapter)) flags |= IRQF_SHARED; From 031916568a1aa2ef1809f86d26f0bcfa215ff5c0 Mon Sep 17 00:00:00 2001 From: Frank Li <Frank.Li@freescale.com> Date: Thu, 25 Jul 2013 14:05:53 +0800 Subject: [PATCH 565/913] net: fec: workaround stop tx during errata ERR006358 If the ready bit in the transmit buffer descriptor (TxBD[R]) is previously detected as not set during a prior frame transmission, then the ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in frames not being transmitted until there is a 0-to-1 transition on ENET_TDAR[TDAR]. Workarounds: code can use the transmit frame interrupt flag (ENET_EIR[TXF]) as a method to detect whether the ENET has completed transmission and the ENET_TDAR[TDAR] has been cleared. If ENET_TDAR[TDAR] is detected as cleared when packets are queued and waiting for transmit, then a write to the TDAR bit will restart TxBD processing. This case main happen when loading is light. A ethernet package may not send out utile next package put into tx queue. How to test: while [ true ] do ping <IP> -s 10000 -w 4 ping <IP> -s 6000 -w 2 ping <IP> -s 4000 -w 2 ping <IP> -s 10000 -w 2 done You will see below result in overnight test. 6008 bytes from 10.192.242.116: seq=1 ttl=128 time=0.722 ms 4008 bytes from 10.192.242.116: seq=0 ttl=128 time=1001.008 ms 4008 bytes from 10.192.242.116: seq=1 ttl=128 time=1.010 ms 10008 bytes from 10.192.242.116: seq=0 ttl=128 time=0.896 ms After apply this patch, >1000ms delay disappear. Signed-off-by: Frank Li <Frank.Li@freescale.com> Acked-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/freescale/fec.h | 1 + drivers/net/ethernet/freescale/fec_main.c | 32 +++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index 2b0a0ea4f8e7..ae236009f1a8 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h @@ -259,6 +259,7 @@ struct bufdesc_ex { struct fec_enet_delayed_work { struct delayed_work delay_work; bool timeout; + bool trig_tx; }; /* The FEC buffer descriptors track the ring buffers. The rx_bd_base and diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index f0f0e96453a0..0dda45481d16 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -93,6 +93,20 @@ static void set_multicast_list(struct net_device *ndev); #define FEC_QUIRK_HAS_CSUM (1 << 5) /* Controller has hardware vlan support */ #define FEC_QUIRK_HAS_VLAN (1 << 6) +/* ENET IP errata ERR006358 + * + * If the ready bit in the transmit buffer descriptor (TxBD[R]) is previously + * detected as not set during a prior frame transmission, then the + * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs + * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in + * If the ready bit in the transmit buffer descriptor (TxBD[R]) is previously + * detected as not set during a prior frame transmission, then the + * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs + * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in + * frames not being transmitted until there is a 0-to-1 transition on + * ENET_TDAR[TDAR]. + */ +#define FEC_QUIRK_ERR006358 (1 << 7) static struct platform_device_id fec_devtype[] = { { @@ -112,7 +126,7 @@ static struct platform_device_id fec_devtype[] = { .name = "imx6q-fec", .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | - FEC_QUIRK_HAS_VLAN, + FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358, }, { .name = "mvf600-fec", .driver_data = FEC_QUIRK_ENET_MAC, @@ -275,7 +289,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) struct fec_enet_private *fep = netdev_priv(ndev); const struct platform_device_id *id_entry = platform_get_device_id(fep->pdev); - struct bufdesc *bdp; + struct bufdesc *bdp, *bdp_pre; void *bufaddr; unsigned short status; unsigned int index; @@ -370,6 +384,15 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) ebdp->cbd_esc |= BD_ENET_TX_PINS; } } + + bdp_pre = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); + if ((id_entry->driver_data & FEC_QUIRK_ERR006358) && + !(bdp_pre->cbd_sc & BD_ENET_TX_READY)) { + fep->delay_work.trig_tx = true; + schedule_delayed_work(&(fep->delay_work.delay_work), + msecs_to_jiffies(1)); + } + /* If this was the last BD in the ring, start at the beginning again. */ if (status & BD_ENET_TX_WRAP) bdp = fep->tx_bd_base; @@ -689,6 +712,11 @@ static void fec_enet_work(struct work_struct *work) fec_restart(fep->netdev, fep->full_duplex); netif_wake_queue(fep->netdev); } + + if (fep->delay_work.trig_tx) { + fep->delay_work.trig_tx = false; + writel(0, fep->hwp + FEC_X_DES_ACTIVE); + } } static void From c74f2b2678f40b80265dd53556f1f778c8e1823f Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka <sgruszka@redhat.com> Date: Fri, 26 Jul 2013 11:00:10 +0200 Subject: [PATCH 566/913] genetlink: release cb_lock before requesting additional module Requesting external module with cb_lock taken can result in the deadlock like showed below: [ 2458.111347] Showing all locks held in the system: [ 2458.111347] 1 lock held by NetworkManager/582: [ 2458.111347] #0: (cb_lock){++++++}, at: [<ffffffff8162bc79>] genl_rcv+0x19/0x40 [ 2458.111347] 1 lock held by modprobe/603: [ 2458.111347] #0: (cb_lock){++++++}, at: [<ffffffff8162baa5>] genl_lock_all+0x15/0x30 [ 2461.579457] SysRq : Show Blocked State [ 2461.580103] task PC stack pid father [ 2461.580103] NetworkManager D ffff880034b84500 4040 582 1 0x00000080 [ 2461.580103] ffff8800197ff720 0000000000000046 00000000001d5340 ffff8800197fffd8 [ 2461.580103] ffff8800197fffd8 00000000001d5340 ffff880019631700 7fffffffffffffff [ 2461.580103] ffff8800197ff880 ffff8800197ff878 ffff880019631700 ffff880019631700 [ 2461.580103] Call Trace: [ 2461.580103] [<ffffffff817355f9>] schedule+0x29/0x70 [ 2461.580103] [<ffffffff81731ad1>] schedule_timeout+0x1c1/0x360 [ 2461.580103] [<ffffffff810e69eb>] ? mark_held_locks+0xbb/0x140 [ 2461.580103] [<ffffffff817377ac>] ? _raw_spin_unlock_irq+0x2c/0x50 [ 2461.580103] [<ffffffff810e6b6d>] ? trace_hardirqs_on_caller+0xfd/0x1c0 [ 2461.580103] [<ffffffff81736398>] wait_for_completion_killable+0xe8/0x170 [ 2461.580103] [<ffffffff810b7fa0>] ? wake_up_state+0x20/0x20 [ 2461.580103] [<ffffffff81095825>] call_usermodehelper_exec+0x1a5/0x210 [ 2461.580103] [<ffffffff817362ed>] ? wait_for_completion_killable+0x3d/0x170 [ 2461.580103] [<ffffffff81095cc3>] __request_module+0x1b3/0x370 [ 2461.580103] [<ffffffff810e6b6d>] ? trace_hardirqs_on_caller+0xfd/0x1c0 [ 2461.580103] [<ffffffff8162c5c9>] ctrl_getfamily+0x159/0x190 [ 2461.580103] [<ffffffff8162d8a4>] genl_family_rcv_msg+0x1f4/0x2e0 [ 2461.580103] [<ffffffff8162d990>] ? genl_family_rcv_msg+0x2e0/0x2e0 [ 2461.580103] [<ffffffff8162da1e>] genl_rcv_msg+0x8e/0xd0 [ 2461.580103] [<ffffffff8162b729>] netlink_rcv_skb+0xa9/0xc0 [ 2461.580103] [<ffffffff8162bc88>] genl_rcv+0x28/0x40 [ 2461.580103] [<ffffffff8162ad6d>] netlink_unicast+0xdd/0x190 [ 2461.580103] [<ffffffff8162b149>] netlink_sendmsg+0x329/0x750 [ 2461.580103] [<ffffffff815db849>] sock_sendmsg+0x99/0xd0 [ 2461.580103] [<ffffffff810bb58f>] ? local_clock+0x5f/0x70 [ 2461.580103] [<ffffffff810e96e8>] ? lock_release_non_nested+0x308/0x350 [ 2461.580103] [<ffffffff815dbc6e>] ___sys_sendmsg+0x39e/0x3b0 [ 2461.580103] [<ffffffff810565af>] ? kvm_clock_read+0x2f/0x50 [ 2461.580103] [<ffffffff810218b9>] ? sched_clock+0x9/0x10 [ 2461.580103] [<ffffffff810bb2bd>] ? sched_clock_local+0x1d/0x80 [ 2461.580103] [<ffffffff810bb448>] ? sched_clock_cpu+0xa8/0x100 [ 2461.580103] [<ffffffff810e33ad>] ? trace_hardirqs_off+0xd/0x10 [ 2461.580103] [<ffffffff810bb58f>] ? local_clock+0x5f/0x70 [ 2461.580103] [<ffffffff810e3f7f>] ? lock_release_holdtime.part.28+0xf/0x1a0 [ 2461.580103] [<ffffffff8120fec9>] ? fget_light+0xf9/0x510 [ 2461.580103] [<ffffffff8120fe0c>] ? fget_light+0x3c/0x510 [ 2461.580103] [<ffffffff815dd1d2>] __sys_sendmsg+0x42/0x80 [ 2461.580103] [<ffffffff815dd222>] SyS_sendmsg+0x12/0x20 [ 2461.580103] [<ffffffff81741ad9>] system_call_fastpath+0x16/0x1b [ 2461.580103] modprobe D ffff88000f2c8000 4632 603 602 0x00000080 [ 2461.580103] ffff88000f04fba8 0000000000000046 00000000001d5340 ffff88000f04ffd8 [ 2461.580103] ffff88000f04ffd8 00000000001d5340 ffff8800377d4500 ffff8800377d4500 [ 2461.580103] ffffffff81d0b260 ffffffff81d0b268 ffffffff00000000 ffffffff81d0b2b0 [ 2461.580103] Call Trace: [ 2461.580103] [<ffffffff817355f9>] schedule+0x29/0x70 [ 2461.580103] [<ffffffff81736d4d>] rwsem_down_write_failed+0xed/0x1a0 [ 2461.580103] [<ffffffff810bb200>] ? update_cpu_load_active+0x10/0xb0 [ 2461.580103] [<ffffffff8137b473>] call_rwsem_down_write_failed+0x13/0x20 [ 2461.580103] [<ffffffff8173492d>] ? down_write+0x9d/0xb2 [ 2461.580103] [<ffffffff8162baa5>] ? genl_lock_all+0x15/0x30 [ 2461.580103] [<ffffffff8162baa5>] genl_lock_all+0x15/0x30 [ 2461.580103] [<ffffffff8162cbb3>] genl_register_family+0x53/0x1f0 [ 2461.580103] [<ffffffffa01dc000>] ? 0xffffffffa01dbfff [ 2461.580103] [<ffffffff8162d650>] genl_register_family_with_ops+0x20/0x80 [ 2461.580103] [<ffffffffa01dc000>] ? 0xffffffffa01dbfff [ 2461.580103] [<ffffffffa017fe84>] nl80211_init+0x24/0xf0 [cfg80211] [ 2461.580103] [<ffffffffa01dc000>] ? 0xffffffffa01dbfff [ 2461.580103] [<ffffffffa01dc043>] cfg80211_init+0x43/0xdb [cfg80211] [ 2461.580103] [<ffffffff810020fa>] do_one_initcall+0xfa/0x1b0 [ 2461.580103] [<ffffffff8105cb93>] ? set_memory_nx+0x43/0x50 [ 2461.580103] [<ffffffff810f75af>] load_module+0x1c6f/0x27f0 [ 2461.580103] [<ffffffff810f2c90>] ? store_uevent+0x40/0x40 [ 2461.580103] [<ffffffff810f82c6>] SyS_finit_module+0x86/0xb0 [ 2461.580103] [<ffffffff81741ad9>] system_call_fastpath+0x16/0x1b [ 2461.580103] Sched Debug Version: v0.10, 3.11.0-0.rc1.git4.1.fc20.x86_64 #1 Problem start to happen after adding net-pf-16-proto-16-family-nl80211 alias name to cfg80211 module by below commit (though that commit itself is perfectly fine): commit fb4e156886ce6e8309e912d8b370d192330d19d3 Author: Marcel Holtmann <marcel@holtmann.org> Date: Sun Apr 28 16:22:06 2013 -0700 nl80211: Add generic netlink module alias for cfg80211/nl80211 Reported-and-tested-by: Jeff Layton <jlayton@redhat.com> Reported-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Reviewed-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/netlink/genetlink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 2fd6dbea327a..1076fe16b122 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -877,8 +877,10 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info) #ifdef CONFIG_MODULES if (res == NULL) { genl_unlock(); + up_read(&cb_lock); request_module("net-pf-%d-proto-%d-family-%s", PF_NETLINK, NETLINK_GENERIC, name); + down_read(&cb_lock); genl_lock(); res = genl_family_find_byname(name); } From fc51446021f42aca8906e701fc2292965aafcb15 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen <lars@metafoo.de> Date: Tue, 23 Jul 2013 10:24:50 +0200 Subject: [PATCH 567/913] dma: pl330: Fix cyclic transfers Allocate a descriptor for each period of a cyclic transfer, not just the first. Also since the callback needs to be called for each finished period make sure to initialize the callback and callback_param fields of each descriptor in a cyclic transfer. Cc: stable@vger.kernel.org Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com> --- drivers/dma/pl330.c | 93 ++++++++++++++++++++++++++++++++------------- 1 file changed, 67 insertions(+), 26 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 593827b3fdd4..fa645d825009 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2505,6 +2505,10 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx) /* Assign cookies to all nodes */ while (!list_empty(&last->node)) { desc = list_entry(last->node.next, struct dma_pl330_desc, node); + if (pch->cyclic) { + desc->txd.callback = last->txd.callback; + desc->txd.callback_param = last->txd.callback_param; + } dma_cookie_assign(&desc->txd); @@ -2688,45 +2692,82 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( size_t period_len, enum dma_transfer_direction direction, unsigned long flags, void *context) { - struct dma_pl330_desc *desc; + struct dma_pl330_desc *desc = NULL, *first = NULL; struct dma_pl330_chan *pch = to_pchan(chan); + struct dma_pl330_dmac *pdmac = pch->dmac; + unsigned int i; dma_addr_t dst; dma_addr_t src; - desc = pl330_get_desc(pch); - if (!desc) { - dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n", - __func__, __LINE__); + if (len % period_len != 0) return NULL; - } - switch (direction) { - case DMA_MEM_TO_DEV: - desc->rqcfg.src_inc = 1; - desc->rqcfg.dst_inc = 0; - desc->req.rqtype = MEMTODEV; - src = dma_addr; - dst = pch->fifo_addr; - break; - case DMA_DEV_TO_MEM: - desc->rqcfg.src_inc = 0; - desc->rqcfg.dst_inc = 1; - desc->req.rqtype = DEVTOMEM; - src = pch->fifo_addr; - dst = dma_addr; - break; - default: + if (!is_slave_direction(direction)) { dev_err(pch->dmac->pif.dev, "%s:%d Invalid dma direction\n", __func__, __LINE__); return NULL; } - desc->rqcfg.brst_size = pch->burst_sz; - desc->rqcfg.brst_len = 1; + for (i = 0; i < len / period_len; i++) { + desc = pl330_get_desc(pch); + if (!desc) { + dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n", + __func__, __LINE__); + + if (!first) + return NULL; + + spin_lock_irqsave(&pdmac->pool_lock, flags); + + while (!list_empty(&first->node)) { + desc = list_entry(first->node.next, + struct dma_pl330_desc, node); + list_move_tail(&desc->node, &pdmac->desc_pool); + } + + list_move_tail(&first->node, &pdmac->desc_pool); + + spin_unlock_irqrestore(&pdmac->pool_lock, flags); + + return NULL; + } + + switch (direction) { + case DMA_MEM_TO_DEV: + desc->rqcfg.src_inc = 1; + desc->rqcfg.dst_inc = 0; + desc->req.rqtype = MEMTODEV; + src = dma_addr; + dst = pch->fifo_addr; + break; + case DMA_DEV_TO_MEM: + desc->rqcfg.src_inc = 0; + desc->rqcfg.dst_inc = 1; + desc->req.rqtype = DEVTOMEM; + src = pch->fifo_addr; + dst = dma_addr; + break; + default: + break; + } + + desc->rqcfg.brst_size = pch->burst_sz; + desc->rqcfg.brst_len = 1; + fill_px(&desc->px, dst, src, period_len); + + if (!first) + first = desc; + else + list_add_tail(&desc->node, &first->node); + + dma_addr += period_len; + } + + if (!desc) + return NULL; pch->cyclic = true; - - fill_px(&desc->px, dst, src, period_len); + desc->txd.flags = flags; return &desc->txd; } From 683a0e4d7971c3186dc4d429027debfe309129aa Mon Sep 17 00:00:00 2001 From: Johan Hovold <jhovold@gmail.com> Date: Sat, 27 Jul 2013 13:34:42 +0200 Subject: [PATCH 568/913] USB: mos7840: fix pointer casts Silence compiler warnings on 64-bit systems introduced by commit 05cf0dec ("USB: mos7840: fix race in led handling") which uses the usb-serial data pointer to temporarily store the device type during probe but failed to add the required casts. [gregkh - change uintptr_t to unsigned long] Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/mos7840.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index c10fc15bf851..d953d674f222 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -2221,14 +2221,14 @@ static int mos7840_probe(struct usb_serial *serial, kfree(buf); out: - usb_set_serial_data(serial, (void *)device_type); + usb_set_serial_data(serial, (void *)(unsigned long)device_type); return 0; } static int mos7840_calc_num_ports(struct usb_serial *serial) { - int device_type = (int)usb_get_serial_data(serial); + int device_type = (unsigned long)usb_get_serial_data(serial); int mos7840_num_ports; mos7840_num_ports = (device_type >> 4) & 0x000F; @@ -2239,7 +2239,7 @@ static int mos7840_calc_num_ports(struct usb_serial *serial) static int mos7840_port_probe(struct usb_serial_port *port) { struct usb_serial *serial = port->serial; - int device_type = (int)usb_get_serial_data(serial); + int device_type = (unsigned long)usb_get_serial_data(serial); struct moschip_port *mos7840_port; int status; int pnum; From 1eb9ac14c34a948bf1538bfb9034e8ab29099a64 Mon Sep 17 00:00:00 2001 From: Jacob Keller <jacob.e.keller@intel.com> Date: Fri, 26 Jul 2013 05:46:35 -0700 Subject: [PATCH 569/913] ixgbe: Fix Tx Hang issue with lldpad on 82598EB This patch fixes an issue with the 82598EB device, where lldpad is causing Tx Hangs on the card as soon as it attempts to configure DCB for the device. The adapter will continually Tx hang and reset in a loop. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Cc: Stable <stable@vger.kernel.org> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Tested-by: Jack Morgan <jack.morgan@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c index ac780770863d..7a77f37a7cbc 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c @@ -108,9 +108,8 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82598(struct ixgbe_hw *hw, /* Enable arbiter */ reg &= ~IXGBE_DPMCS_ARBDIS; - /* Enable DFP and Recycle mode */ - reg |= (IXGBE_DPMCS_TDPAC | IXGBE_DPMCS_TRM); reg |= IXGBE_DPMCS_TSOEF; + /* Configure Max TSO packet size 34KB including payload and headers */ reg |= (0x4 << IXGBE_DPMCS_MTSOS_SHIFT); From 7e44892c1b6bb499cb2f6d5c0f4afcc077a26074 Mon Sep 17 00:00:00 2001 From: Emil Tantilov <emil.s.tantilov@intel.com> Date: Fri, 26 Jul 2013 05:46:36 -0700 Subject: [PATCH 570/913] igb: fix vlan filtering in promisc mode when not in VT mode This patch fixes a VT mode check to make sure VLAN filters are disabled when in promisc mode and VT is not enabled. The problem with the previous check was that: E1000_MRQC_ENABLE_VMDQ is defined as 0x00000003 but when not in VT mode: mrqc |= E1000_MRQC_ENABLE_RSS_4Q (0x00000002) So the above check will trigger regardless if VT mode is being used or not. Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/intel/igb/igb_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 6a0c1b66ce54..c1d72c03cb59 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -3739,9 +3739,8 @@ static void igb_set_rx_mode(struct net_device *netdev) rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE | E1000_RCTL_VFE); if (netdev->flags & IFF_PROMISC) { - u32 mrqc = rd32(E1000_MRQC); /* retain VLAN HW filtering if in VT mode */ - if (mrqc & E1000_MRQC_ENABLE_VMDQ) + if (adapter->vfs_allocated_count) rctl |= E1000_RCTL_VFE; rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); vmolr |= (E1000_VMOLR_ROPE | E1000_VMOLR_MPME); From 5ae90d8e467e625e447000cb4335c4db973b1095 Mon Sep 17 00:00:00 2001 From: Linus Torvalds <torvalds@linux-foundation.org> Date: Sun, 28 Jul 2013 20:53:33 -0700 Subject: [PATCH 571/913] Linux 3.11-rc3 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a35f72a420c0..95a8e55feceb 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 11 SUBLEVEL = 0 -EXTRAVERSION = -rc2 +EXTRAVERSION = -rc3 NAME = Linux for Workgroups # *DOCUMENTATION* From 057b82be3ca3d066478e43b162fc082930a746c9 Mon Sep 17 00:00:00 2001 From: Amit Shah <amit.shah@redhat.com> Date: Mon, 29 Jul 2013 14:16:13 +0930 Subject: [PATCH 572/913] virtio: console: fix race with port unplug and open/close There's a window between find_port_by_devt() returning a port and us taking a kref on the port, where the port could get unplugged. Fix it by taking the reference in find_port_by_devt() itself. Problem reported and analyzed by Mateusz Guzik. CC: <stable@vger.kernel.org> Reported-by: Mateusz Guzik <mguzik@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/char/virtio_console.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 8a15af3e1a9d..3beea9d478bc 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -272,9 +272,12 @@ static struct port *find_port_by_devt_in_portdev(struct ports_device *portdev, unsigned long flags; spin_lock_irqsave(&portdev->ports_lock, flags); - list_for_each_entry(port, &portdev->ports, list) - if (port->cdev->dev == dev) + list_for_each_entry(port, &portdev->ports, list) { + if (port->cdev->dev == dev) { + kref_get(&port->kref); goto out; + } + } port = NULL; out: spin_unlock_irqrestore(&portdev->ports_lock, flags); @@ -1036,14 +1039,10 @@ static int port_fops_open(struct inode *inode, struct file *filp) struct port *port; int ret; + /* We get the port with a kref here */ port = find_port_by_devt(cdev->dev); filp->private_data = port; - /* Prevent against a port getting hot-unplugged at the same time */ - spin_lock_irq(&port->portdev->ports_lock); - kref_get(&port->kref); - spin_unlock_irq(&port->portdev->ports_lock); - /* * Don't allow opening of console port devices -- that's done * via /dev/hvc From 671bdea2b9f210566610603ecbb6584c8a201c8c Mon Sep 17 00:00:00 2001 From: Amit Shah <amit.shah@redhat.com> Date: Mon, 29 Jul 2013 14:17:13 +0930 Subject: [PATCH 573/913] virtio: console: fix race in port_fops_open() and port unplug Between open() being called and processed, the port can be unplugged. Check if this happened, and bail out. A simple test script to reproduce this is: while true; do for i in $(seq 1 100); do echo $i > /dev/vport0p3; done; done; This opens and closes the port a lot of times; unplugging the port while this is happening triggers the bug. CC: <stable@vger.kernel.org> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/char/virtio_console.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 3beea9d478bc..ffa7e46faff9 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1041,6 +1041,10 @@ static int port_fops_open(struct inode *inode, struct file *filp) /* We get the port with a kref here */ port = find_port_by_devt(cdev->dev); + if (!port) { + /* Port was unplugged before we could proceed */ + return -ENXIO; + } filp->private_data = port; /* From ea3768b4386a8d1790f4cc9a35de4f55b92d6442 Mon Sep 17 00:00:00 2001 From: Amit Shah <amit.shah@redhat.com> Date: Mon, 29 Jul 2013 14:20:29 +0930 Subject: [PATCH 574/913] virtio: console: clean up port data immediately at time of unplug We used to keep the port's char device structs and the /sys entries around till the last reference to the port was dropped. This is actually unnecessary, and resulted in buggy behaviour: 1. Open port in guest 2. Hot-unplug port 3. Hot-plug a port with the same 'name' property as the unplugged one This resulted in hot-plug being unsuccessful, as a port with the same name already exists (even though it was unplugged). This behaviour resulted in a warning message like this one: -------------------8<--------------------------------------- WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xc9/0x130() (Not tainted) Hardware name: KVM sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:04.0/virtio0/virtio-ports/vport0p1' Call Trace: [<ffffffff8106b607>] ? warn_slowpath_common+0x87/0xc0 [<ffffffff8106b6f6>] ? warn_slowpath_fmt+0x46/0x50 [<ffffffff811f2319>] ? sysfs_add_one+0xc9/0x130 [<ffffffff811f23e8>] ? create_dir+0x68/0xb0 [<ffffffff811f2469>] ? sysfs_create_dir+0x39/0x50 [<ffffffff81273129>] ? kobject_add_internal+0xb9/0x260 [<ffffffff812733d8>] ? kobject_add_varg+0x38/0x60 [<ffffffff812734b4>] ? kobject_add+0x44/0x70 [<ffffffff81349de4>] ? get_device_parent+0xf4/0x1d0 [<ffffffff8134b389>] ? device_add+0xc9/0x650 -------------------8<--------------------------------------- Instead of relying on guest applications to release all references to the ports, we should go ahead and unregister the port from all the core layers. Any open/read calls on the port will then just return errors, and an unplug/plug operation on the host will succeed as expected. This also caused buggy behaviour in case of the device removal (not just a port): when the device was removed (which means all ports on that device are removed automatically as well), the ports with active users would clean up only when the last references were dropped -- and it would be too late then to be referencing char device pointers, resulting in oopses: -------------------8<--------------------------------------- PID: 6162 TASK: ffff8801147ad500 CPU: 0 COMMAND: "cat" #0 [ffff88011b9d5a90] machine_kexec at ffffffff8103232b #1 [ffff88011b9d5af0] crash_kexec at ffffffff810b9322 #2 [ffff88011b9d5bc0] oops_end at ffffffff814f4a50 #3 [ffff88011b9d5bf0] die at ffffffff8100f26b #4 [ffff88011b9d5c20] do_general_protection at ffffffff814f45e2 #5 [ffff88011b9d5c50] general_protection at ffffffff814f3db5 [exception RIP: strlen+2] RIP: ffffffff81272ae2 RSP: ffff88011b9d5d00 RFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff880118901c18 RCX: 0000000000000000 RDX: ffff88011799982c RSI: 00000000000000d0 RDI: 3a303030302f3030 RBP: ffff88011b9d5d38 R8: 0000000000000006 R9: ffffffffa0134500 R10: 0000000000001000 R11: 0000000000001000 R12: ffff880117a1cc10 R13: 00000000000000d0 R14: 0000000000000017 R15: ffffffff81aff700 ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 #6 [ffff88011b9d5d00] kobject_get_path at ffffffff8126dc5d #7 [ffff88011b9d5d40] kobject_uevent_env at ffffffff8126e551 #8 [ffff88011b9d5dd0] kobject_uevent at ffffffff8126e9eb #9 [ffff88011b9d5de0] device_del at ffffffff813440c7 -------------------8<--------------------------------------- So clean up when we have all the context, and all that's left to do when the references to the port have dropped is to free up the port struct itself. CC: <stable@vger.kernel.org> Reported-by: chayang <chayang@redhat.com> Reported-by: YOGANANTH SUBRAMANIAN <anantyog@in.ibm.com> Reported-by: FuXiangChun <xfu@redhat.com> Reported-by: Qunfang Zhang <qzhang@redhat.com> Reported-by: Sibiao Luo <sluo@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/char/virtio_console.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index ffa7e46faff9..4e684faee10b 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1518,14 +1518,6 @@ static void remove_port(struct kref *kref) port = container_of(kref, struct port, kref); - sysfs_remove_group(&port->dev->kobj, &port_attribute_group); - device_destroy(pdrvdata.class, port->dev->devt); - cdev_del(port->cdev); - - kfree(port->name); - - debugfs_remove(port->debugfs_file); - kfree(port); } @@ -1583,6 +1575,14 @@ static void unplug_port(struct port *port) */ port->portdev = NULL; + sysfs_remove_group(&port->dev->kobj, &port_attribute_group); + device_destroy(pdrvdata.class, port->dev->devt); + cdev_del(port->cdev); + + kfree(port->name); + + debugfs_remove(port->debugfs_file); + /* * Locks around here are not necessary - a port can't be * opened after we removed the port struct from ports_list From 92d3453815fbe74d539c86b60dab39ecdf01bb99 Mon Sep 17 00:00:00 2001 From: Amit Shah <amit.shah@redhat.com> Date: Mon, 29 Jul 2013 14:21:32 +0930 Subject: [PATCH 575/913] virtio: console: fix raising SIGIO after port unplug SIGIO should be sent when a port gets unplugged. It should only be sent to prcesses that have the port opened, and have asked for SIGIO to be delivered. We were clearing out guest_connected before calling send_sigio_to_port(), resulting in a sigio not getting sent to processes. Fix by setting guest_connected to false after invoking the sigio function. CC: <stable@vger.kernel.org> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/char/virtio_console.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 4e684faee10b..e4845f1c9a0b 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1551,12 +1551,14 @@ static void unplug_port(struct port *port) spin_unlock_irq(&port->portdev->ports_lock); if (port->guest_connected) { - port->guest_connected = false; - port->host_connected = false; - wake_up_interruptible(&port->waitqueue); - /* Let the app know the port is going down. */ send_sigio_to_port(port); + + /* Do this after sigio is actually sent */ + port->guest_connected = false; + port->host_connected = false; + + wake_up_interruptible(&port->waitqueue); } if (is_console_port(port)) { From 96f97a83910cdb9d89d127c5ee523f8fc040a804 Mon Sep 17 00:00:00 2001 From: Amit Shah <amit.shah@redhat.com> Date: Mon, 29 Jul 2013 14:23:21 +0930 Subject: [PATCH 576/913] virtio: console: return -ENODEV on all read operations after unplug If a port gets unplugged while a user is blocked on read(), -ENODEV is returned. However, subsequent read()s returned 0, indicating there's no host-side connection (but not indicating the device went away). This also happened when a port was unplugged and the user didn't have any blocking operation pending. If the user didn't monitor the SIGIO signal, they won't have a chance to find out if the port went away. Fix by returning -ENODEV on all read()s after the port gets unplugged. write() already behaves this way. CC: <stable@vger.kernel.org> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/char/virtio_console.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index e4845f1c9a0b..fc45567ad3ac 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -749,6 +749,10 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf, port = filp->private_data; + /* Port is hot-unplugged. */ + if (!port->guest_connected) + return -ENODEV; + if (!port_has_data(port)) { /* * If nothing's connected on the host just return 0 in @@ -765,7 +769,7 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf, if (ret < 0) return ret; } - /* Port got hot-unplugged. */ + /* Port got hot-unplugged while we were waiting above. */ if (!port->guest_connected) return -ENODEV; /* From 2b29a9fdcb92bfc6b6f4c412d71505869de61a56 Mon Sep 17 00:00:00 2001 From: Dominik Dingel <dingel@linux.vnet.ibm.com> Date: Fri, 26 Jul 2013 15:04:00 +0200 Subject: [PATCH 577/913] KVM: s390: move kvm_guest_enter,exit closer to sie Any uaccess between guest_enter and guest_exit could trigger a page fault, the page fault handler would handle it as a guest fault and translate a user address as guest address. Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> CC: stable@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- arch/s390/kvm/kvm-s390.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index ba694d2ba51e..34c1c9a90be2 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -702,14 +702,25 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) return rc; vcpu->arch.sie_block->icptcode = 0; - preempt_disable(); - kvm_guest_enter(); - preempt_enable(); VCPU_EVENT(vcpu, 6, "entering sie flags %x", atomic_read(&vcpu->arch.sie_block->cpuflags)); trace_kvm_s390_sie_enter(vcpu, atomic_read(&vcpu->arch.sie_block->cpuflags)); + + /* + * As PF_VCPU will be used in fault handler, between guest_enter + * and guest_exit should be no uaccess. + */ + preempt_disable(); + kvm_guest_enter(); + preempt_enable(); rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs); + kvm_guest_exit(); + + VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", + vcpu->arch.sie_block->icptcode); + trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode); + if (rc > 0) rc = 0; if (rc < 0) { @@ -721,10 +732,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); } } - VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", - vcpu->arch.sie_block->icptcode); - trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode); - kvm_guest_exit(); memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16); return rc; From e769ece3b129698d2b09811a6f6d304e4eaa8c29 Mon Sep 17 00:00:00 2001 From: Heiko Carstens <heiko.carstens@de.ibm.com> Date: Fri, 26 Jul 2013 15:04:01 +0200 Subject: [PATCH 578/913] KVM: s390: fix pfmf non-quiescing control handling Fix the test within handle_pfmf() if the host has the NQ key-setting facility installed. Right now the code would incorrectly generate a program check in the guest if the NQ control bit for a pfmf request was set and if the host has the NQ key-setting facility installed. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- arch/s390/kvm/priv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c index 0da3e6eb6be6..4cdc54e63ebc 100644 --- a/arch/s390/kvm/priv.c +++ b/arch/s390/kvm/priv.c @@ -16,6 +16,7 @@ #include <linux/errno.h> #include <linux/compat.h> #include <asm/asm-offsets.h> +#include <asm/facility.h> #include <asm/current.h> #include <asm/debug.h> #include <asm/ebcdic.h> @@ -532,8 +533,7 @@ static int handle_pfmf(struct kvm_vcpu *vcpu) return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); /* Only provide non-quiescing support if the host supports it */ - if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ && - S390_lowcore.stfl_fac_list & 0x00020000) + if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ && !test_facility(14)) return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); /* No support for conditional-SSKE */ From 8b00e1831cea899cd4dfe04e574c26e376c27368 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Tue, 2 Jul 2013 09:28:21 +0300 Subject: [PATCH 579/913] fbdev/atyfb: fix recent breakage in correct_chipset() The 6e36308a6f "fb: fix atyfb build warning" isn't right. It makes all the indexes off by one. This patch reverts it and casts the ARRAY_SIZE() to int to silence the build warning. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- drivers/video/aty/atyfb_base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index a89c15de9f45..9b0f12c5c284 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c @@ -435,8 +435,8 @@ static int correct_chipset(struct atyfb_par *par) const char *name; int i; - for (i = ARRAY_SIZE(aty_chips); i > 0; i--) - if (par->pci_id == aty_chips[i - 1].pci_id) + for (i = (int)ARRAY_SIZE(aty_chips) - 1; i >= 0; i--) + if (par->pci_id == aty_chips[i].pci_id) break; if (i < 0) From 7808e3291e1e101e9ad6e8263119c4a2abae05ef Mon Sep 17 00:00:00 2001 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Fri, 12 Jul 2013 21:20:03 +0800 Subject: [PATCH 580/913] video: sh7760fb: fix to pass correct device identity to free_irq() free_irq() expects the same device identity that was passed to corresponding request_irq(), otherwise the IRQ is not freed. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- drivers/video/sh7760fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/sh7760fb.c b/drivers/video/sh7760fb.c index a8c6c43a4658..1265b25f9f99 100644 --- a/drivers/video/sh7760fb.c +++ b/drivers/video/sh7760fb.c @@ -567,7 +567,7 @@ static int sh7760fb_remove(struct platform_device *dev) fb_dealloc_cmap(&info->cmap); sh7760fb_free_mem(info); if (par->irq >= 0) - free_irq(par->irq, par); + free_irq(par->irq, &par->vsync); iounmap(par->base); release_mem_region(par->ioarea->start, resource_size(par->ioarea)); framebuffer_release(info); From 3f8e2d75c14660abc8b69206f30190ab93304379 Mon Sep 17 00:00:00 2001 From: Johan Hedberg <johan.hedberg@intel.com> Date: Wed, 24 Jul 2013 02:32:46 +0300 Subject: [PATCH 581/913] Bluetooth: Fix HCI init for BlueFRITZ! devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit None of the BlueFRITZ! devices with manufacurer ID 31 (AVM Berlin) support HCI_Read_Local_Supported_Commands. It is safe to use the manufacturer ID (instead of e.g. a USB ID specific quirk) because the company never created any newer controllers. < HCI Command: Read Local Supported Comm.. (0x04|0x0002) plen 0 [hci0] 0.210014 > HCI Event: Command Status (0x0f) plen 4 [hci0] 0.217361 Read Local Supported Commands (0x04|0x0002) ncmd 1 Status: Unknown HCI Command (0x01) Reported-by: Jörg Esser <jackfritt@boh.de> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Tested-by: Jörg Esser <jackfritt@boh.de> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> --- net/bluetooth/hci_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 64d33d1e14c8..0176f200ccb0 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -513,7 +513,10 @@ static void hci_init2_req(struct hci_request *req, unsigned long opt) hci_setup_event_mask(req); - if (hdev->hci_ver > BLUETOOTH_VER_1_1) + /* AVM Berlin (31), aka "BlueFRITZ!", doesn't support the read + * local supported commands HCI command. + */ + if (hdev->manufacturer != 31 && hdev->hci_ver > BLUETOOTH_VER_1_1) hci_req_add(req, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL); if (lmp_ssp_capable(hdev)) { From 8abc6fa163d40bccc80c7b1f821f2579ab26864d Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Date: Fri, 26 Jul 2013 14:37:13 +0200 Subject: [PATCH 582/913] usb: gadget: multi: fix error return code in cdc_do_config() Fix to return a negative error code from the error handling case instead of 0, as returned elsewhere in this function. Introduced by commit 59835a (usb: gadget: multi: use function framework for ACM.) Make rndis_do_config() consistent with cdc_do_config() in the way it handles returning the PTR_ERR(f_acm_*). Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/multi.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c index 032b96a51ce4..2a1ebefd8f9e 100644 --- a/drivers/usb/gadget/multi.c +++ b/drivers/usb/gadget/multi.c @@ -160,10 +160,8 @@ static __init int rndis_do_config(struct usb_configuration *c) return ret; f_acm_rndis = usb_get_function(fi_acm); - if (IS_ERR(f_acm_rndis)) { - ret = PTR_ERR(f_acm_rndis); - goto err_func_acm; - } + if (IS_ERR(f_acm_rndis)) + return PTR_ERR(f_acm_rndis); ret = usb_add_function(c, f_acm_rndis); if (ret) @@ -178,7 +176,6 @@ err_fsg: usb_remove_function(c, f_acm_rndis); err_conf: usb_put_function(f_acm_rndis); -err_func_acm: return ret; } @@ -226,7 +223,7 @@ static __init int cdc_do_config(struct usb_configuration *c) /* implicit port_num is zero */ f_acm_multi = usb_get_function(fi_acm); if (IS_ERR(f_acm_multi)) - goto err_func_acm; + return PTR_ERR(f_acm_multi); ret = usb_add_function(c, f_acm_multi); if (ret) @@ -241,7 +238,6 @@ err_fsg: usb_remove_function(c, f_acm_multi); err_conf: usb_put_function(f_acm_multi); -err_func_acm: return ret; } From 96edc98e7894a7ac5a1cb3c6059455304a6cde6a Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Date: Fri, 26 Jul 2013 14:37:14 +0200 Subject: [PATCH 583/913] usb: gadget: f_phonet: remove unused preprocessor conditional The compatibility layer which the USBF_PHONET_INCLUDED was a part of is no longer present - the USBF_PHONET_INCLUDED is not #defined by anyone anymore, so the ifndef is always true. Removing it. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/f_phonet.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index 1bf26e9f38cd..eb3aa817a662 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c @@ -488,7 +488,6 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f) struct usb_ep *ep; int status, i; -#ifndef USBF_PHONET_INCLUDED struct f_phonet_opts *phonet_opts; phonet_opts = container_of(f->fi, struct f_phonet_opts, func_inst); @@ -507,7 +506,6 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f) return status; phonet_opts->bound = true; } -#endif /* Reserve interface IDs */ status = usb_interface_id(c, f); From 1894870eb4240399fabc6f0cb8c6fff4e6edbe83 Mon Sep 17 00:00:00 2001 From: Rong Wang <Rong.Wang@csr.com> Date: Sun, 28 Jul 2013 23:01:35 +0800 Subject: [PATCH 584/913] usb: gadget: udc-core: fix the typo of udc state attribute The name of udc state attribute file under sysfs is registered as "state", while usb_gadget_set_state take it as "status" when it's going to update. This patch fixes the typo. Signed-off-by: Rong Wang <Rong.Wang@csr.com> Signed-off-by: Barry Song <Baohua.Song@csr.com> Cc: <stable@kernel.org> Signed-off-by: Felipe Balbi <balbi@ti.com> --- drivers/usb/gadget/udc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index c28ac9872030..13e25f80fc20 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c @@ -109,7 +109,7 @@ void usb_gadget_set_state(struct usb_gadget *gadget, enum usb_device_state state) { gadget->state = state; - sysfs_notify(&gadget->dev.kobj, NULL, "status"); + sysfs_notify(&gadget->dev.kobj, NULL, "state"); } EXPORT_SYMBOL_GPL(usb_gadget_set_state); From 53e21fbc288218a423959f878c86471a0e323a9a Mon Sep 17 00:00:00 2001 From: Johan Hedberg <johan.hedberg@intel.com> Date: Sat, 27 Jul 2013 14:11:14 -0500 Subject: [PATCH 585/913] Bluetooth: Fix calling request callback more than once In certain circumstances, such as an HCI driver using __hci_cmd_sync_ev with HCI_EV_CMD_COMPLETE as the expected completion event there is the chance that hci_event_packet will call hci_req_cmd_complete twice (once for the explicitly looked after event and another time in the actual handler of cmd_complete). In the case of __hci_cmd_sync_ev this introduces a race where the first call wakes up the blocking __hci_cmd_sync_ev and lets it complete. However, by the time that a second __hci_cmd_sync_ev call is already in progress the second hci_req_cmd_complete call (from the previous operation) will wake up the blocking function prematurely and cause it to fail, as witnessed by the following log: [ 639.232195] hci_rx_work: hci0 Event packet [ 639.232201] hci_req_cmd_complete: opcode 0xfc8e status 0x00 [ 639.232205] hci_sent_cmd_data: hci0 opcode 0xfc8e [ 639.232210] hci_req_sync_complete: hci0 result 0x00 [ 639.232220] hci_cmd_complete_evt: hci0 opcode 0xfc8e [ 639.232225] hci_req_cmd_complete: opcode 0xfc8e status 0x00 [ 639.232228] __hci_cmd_sync_ev: hci0 end: err 0 [ 639.232234] __hci_cmd_sync_ev: hci0 [ 639.232238] hci_req_add_ev: hci0 opcode 0xfc8e plen 250 [ 639.232242] hci_prepare_cmd: skb len 253 [ 639.232246] hci_req_run: length 1 [ 639.232250] hci_sent_cmd_data: hci0 opcode 0xfc8e [ 639.232255] hci_req_sync_complete: hci0 result 0x00 [ 639.232266] hci_cmd_work: hci0 cmd_cnt 1 cmd queued 1 [ 639.232271] __hci_cmd_sync_ev: hci0 end: err 0 [ 639.232276] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed (-61) Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> --- net/bluetooth/hci_core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 0176f200ccb0..48e1e0438f3a 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3442,8 +3442,16 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status) */ if (hdev->sent_cmd) { req_complete = bt_cb(hdev->sent_cmd)->req.complete; - if (req_complete) + + if (req_complete) { + /* We must set the complete callback to NULL to + * avoid calling the callback more than once if + * this function gets called again. + */ + bt_cb(hdev->sent_cmd)->req.complete = NULL; + goto call_complete; + } } /* Remove all pending commands belonging to this request */ From 228b30234f258a193317874854eee1ca7807186e Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Date: Sat, 27 Jul 2013 01:13:26 +0200 Subject: [PATCH 586/913] Revert "cpuidle: Quickly notice prediction failure in general case" Revert commit e11538d1 (cpuidle: Quickly notice prediction failure in general case), since it depends on commit 69a37be (cpuidle: Quickly notice prediction failure for repeat mode) that has been identified as the source of a significant performance regression in v3.8 and later. Requested-by: Jeremy Eder <jeder@redhat.com> Tested-by: Len Brown <len.brown@intel.com> Cc: 3.8+ <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/cpuidle/governors/menu.c | 35 +------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index fe343a06b7da..b69a87e22155 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -34,7 +34,7 @@ static DEFINE_PER_CPU(struct hrtimer, menu_hrtimer); static DEFINE_PER_CPU(int, hrtimer_status); /* menu hrtimer mode */ -enum {MENU_HRTIMER_STOP, MENU_HRTIMER_REPEAT, MENU_HRTIMER_GENERAL}; +enum {MENU_HRTIMER_STOP, MENU_HRTIMER_REPEAT}; /* * Concepts and ideas behind the menu governor @@ -116,13 +116,6 @@ enum {MENU_HRTIMER_STOP, MENU_HRTIMER_REPEAT, MENU_HRTIMER_GENERAL}; * */ -/* - * The C-state residency is so long that is is worthwhile to exit - * from the shallow C-state and re-enter into a deeper C-state. - */ -static unsigned int perfect_cstate_ms __read_mostly = 30; -module_param(perfect_cstate_ms, uint, 0000); - struct menu_device { int last_state_idx; int needs_update; @@ -223,16 +216,6 @@ EXPORT_SYMBOL_GPL(menu_hrtimer_cancel); static enum hrtimer_restart menu_hrtimer_notify(struct hrtimer *hrtimer) { int cpu = smp_processor_id(); - struct menu_device *data = &per_cpu(menu_devices, cpu); - - /* In general case, the expected residency is much larger than - * deepest C-state target residency, but prediction logic still - * predicts a small predicted residency, so the prediction - * history is totally broken if the timer is triggered. - * So reset the correction factor. - */ - if (per_cpu(hrtimer_status, cpu) == MENU_HRTIMER_GENERAL) - data->correction_factor[data->bucket] = RESOLUTION * DECAY; per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_STOP; @@ -389,7 +372,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) /* not deepest C-state chosen for low predicted residency */ if (low_predicted) { unsigned int timer_us = 0; - unsigned int perfect_us = 0; /* * Set a timer to detect whether this sleep is much @@ -400,28 +382,13 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) */ timer_us = 2 * (data->predicted_us + MAX_DEVIATION); - perfect_us = perfect_cstate_ms * 1000; - if (repeat && (4 * timer_us < data->expected_us)) { RCU_NONIDLE(hrtimer_start(hrtmr, ns_to_ktime(1000 * timer_us), HRTIMER_MODE_REL_PINNED)); /* In repeat case, menu hrtimer is started */ per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_REPEAT; - } else if (perfect_us < data->expected_us) { - /* - * The next timer is long. This could be because - * we did not make a useful prediction. - * In that case, it makes sense to re-enter - * into a deeper C-state after some time. - */ - RCU_NONIDLE(hrtimer_start(hrtmr, - ns_to_ktime(1000 * timer_us), - HRTIMER_MODE_REL_PINNED)); - /* In general case, menu hrtimer is started */ - per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_GENERAL; } - } return data->last_state_idx; From 148519120c6d1f19ad53349683aeae9f228b0b8d Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Date: Sat, 27 Jul 2013 01:41:34 +0200 Subject: [PATCH 587/913] Revert "cpuidle: Quickly notice prediction failure for repeat mode" Revert commit 69a37bea (cpuidle: Quickly notice prediction failure for repeat mode), because it has been identified as the source of a significant performance regression in v3.8 and later as explained by Jeremy Eder: We believe we've identified a particular commit to the cpuidle code that seems to be impacting performance of variety of workloads. The simplest way to reproduce is using netperf TCP_RR test, so we're using that, on a pair of Sandy Bridge based servers. We also have data from a large database setup where performance is also measurably/positively impacted, though that test data isn't easily share-able. Included below are test results from 3 test kernels: kernel reverts ----------------------------------------------------------- 1) vanilla upstream (no reverts) 2) perfteam2 reverts e11538d1f03914eb92af5a1a378375c05ae8520c 3) test reverts 69a37beabf1f0a6705c08e879bdd5d82ff6486c4 e11538d1f03914eb92af5a1a378375c05ae8520c In summary, netperf TCP_RR numbers improve by approximately 4% after reverting 69a37beabf1f0a6705c08e879bdd5d82ff6486c4. When 69a37beabf1f0a6705c08e879bdd5d82ff6486c4 is included, C0 residency never seems to get above 40%. Taking that patch out gets C0 near 100% quite often, and performance increases. The below data are histograms representing the %c0 residency @ 1-second sample rates (using turbostat), while under netperf test. - If you look at the first 4 histograms, you can see %c0 residency almost entirely in the 30,40% bin. - The last pair, which reverts 69a37beabf1f0a6705c08e879bdd5d82ff6486c4, shows %c0 in the 80,90,100% bins. Below each kernel name are netperf TCP_RR trans/s numbers for the particular kernel that can be disclosed publicly, comparing the 3 test kernels. We ran a 4th test with the vanilla kernel where we've also set /dev/cpu_dma_latency=0 to show overall impact boosting single-threaded TCP_RR performance over 11% above baseline. 3.10-rc2 vanilla RX + c0 lock (/dev/cpu_dma_latency=0): TCP_RR trans/s 54323.78 ----------------------------------------------------------- 3.10-rc2 vanilla RX (no reverts) TCP_RR trans/s 48192.47 Receiver %c0 0.0000 - 10.0000 [ 1]: * 10.0000 - 20.0000 [ 0]: 20.0000 - 30.0000 [ 0]: 30.0000 - 40.0000 [ 59]: *********************************************************** 40.0000 - 50.0000 [ 1]: * 50.0000 - 60.0000 [ 0]: 60.0000 - 70.0000 [ 0]: 70.0000 - 80.0000 [ 0]: 80.0000 - 90.0000 [ 0]: 90.0000 - 100.0000 [ 0]: Sender %c0 0.0000 - 10.0000 [ 1]: * 10.0000 - 20.0000 [ 0]: 20.0000 - 30.0000 [ 0]: 30.0000 - 40.0000 [ 11]: *********** 40.0000 - 50.0000 [ 49]: ************************************************* 50.0000 - 60.0000 [ 0]: 60.0000 - 70.0000 [ 0]: 70.0000 - 80.0000 [ 0]: 80.0000 - 90.0000 [ 0]: 90.0000 - 100.0000 [ 0]: ----------------------------------------------------------- 3.10-rc2 perfteam2 RX (reverts commit e11538d1f03914eb92af5a1a378375c05ae8520c) TCP_RR trans/s 49698.69 Receiver %c0 0.0000 - 10.0000 [ 1]: * 10.0000 - 20.0000 [ 1]: * 20.0000 - 30.0000 [ 0]: 30.0000 - 40.0000 [ 59]: *********************************************************** 40.0000 - 50.0000 [ 0]: 50.0000 - 60.0000 [ 0]: 60.0000 - 70.0000 [ 0]: 70.0000 - 80.0000 [ 0]: 80.0000 - 90.0000 [ 0]: 90.0000 - 100.0000 [ 0]: Sender %c0 0.0000 - 10.0000 [ 1]: * 10.0000 - 20.0000 [ 0]: 20.0000 - 30.0000 [ 0]: 30.0000 - 40.0000 [ 2]: ** 40.0000 - 50.0000 [ 58]: ********************************************************** 50.0000 - 60.0000 [ 0]: 60.0000 - 70.0000 [ 0]: 70.0000 - 80.0000 [ 0]: 80.0000 - 90.0000 [ 0]: 90.0000 - 100.0000 [ 0]: ----------------------------------------------------------- 3.10-rc2 test RX (reverts 69a37beabf1f0a6705c08e879bdd5d82ff6486c4 and e11538d1f03914eb92af5a1a378375c05ae8520c) TCP_RR trans/s 47766.95 Receiver %c0 0.0000 - 10.0000 [ 1]: * 10.0000 - 20.0000 [ 1]: * 20.0000 - 30.0000 [ 0]: 30.0000 - 40.0000 [ 27]: *************************** 40.0000 - 50.0000 [ 2]: ** 50.0000 - 60.0000 [ 0]: 60.0000 - 70.0000 [ 2]: ** 70.0000 - 80.0000 [ 0]: 80.0000 - 90.0000 [ 0]: 90.0000 - 100.0000 [ 28]: **************************** Sender: 0.0000 - 10.0000 [ 1]: * 10.0000 - 20.0000 [ 0]: 20.0000 - 30.0000 [ 0]: 30.0000 - 40.0000 [ 11]: *********** 40.0000 - 50.0000 [ 0]: 50.0000 - 60.0000 [ 1]: * 60.0000 - 70.0000 [ 0]: 70.0000 - 80.0000 [ 3]: *** 80.0000 - 90.0000 [ 7]: ******* 90.0000 - 100.0000 [ 38]: ************************************** These results demonstrate gaining back the tendency of the CPU to stay in more responsive, performant C-states (and thus yield measurably better performance), by reverting commit 69a37beabf1f0a6705c08e879bdd5d82ff6486c4. Requested-by: Jeremy Eder <jeder@redhat.com> Tested-by: Len Brown <len.brown@intel.com> Cc: 3.8+ <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/cpuidle/governors/menu.c | 73 ++------------------------------ include/linux/tick.h | 6 --- kernel/time/tick-sched.c | 9 +--- 3 files changed, 6 insertions(+), 82 deletions(-) diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index b69a87e22155..bc580b67a652 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -28,13 +28,6 @@ #define MAX_INTERESTING 50000 #define STDDEV_THRESH 400 -/* 60 * 60 > STDDEV_THRESH * INTERVALS = 400 * 8 */ -#define MAX_DEVIATION 60 - -static DEFINE_PER_CPU(struct hrtimer, menu_hrtimer); -static DEFINE_PER_CPU(int, hrtimer_status); -/* menu hrtimer mode */ -enum {MENU_HRTIMER_STOP, MENU_HRTIMER_REPEAT}; /* * Concepts and ideas behind the menu governor @@ -198,42 +191,17 @@ static u64 div_round64(u64 dividend, u32 divisor) return div_u64(dividend + (divisor / 2), divisor); } -/* Cancel the hrtimer if it is not triggered yet */ -void menu_hrtimer_cancel(void) -{ - int cpu = smp_processor_id(); - struct hrtimer *hrtmr = &per_cpu(menu_hrtimer, cpu); - - /* The timer is still not time out*/ - if (per_cpu(hrtimer_status, cpu)) { - hrtimer_cancel(hrtmr); - per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_STOP; - } -} -EXPORT_SYMBOL_GPL(menu_hrtimer_cancel); - -/* Call back for hrtimer is triggered */ -static enum hrtimer_restart menu_hrtimer_notify(struct hrtimer *hrtimer) -{ - int cpu = smp_processor_id(); - - per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_STOP; - - return HRTIMER_NORESTART; -} - /* * Try detecting repeating patterns by keeping track of the last 8 * intervals, and checking if the standard deviation of that set * of points is below a threshold. If it is... then use the * average of these 8 points as the estimated value. */ -static u32 get_typical_interval(struct menu_device *data) +static void get_typical_interval(struct menu_device *data) { int i = 0, divisor = 0; uint64_t max = 0, avg = 0, stddev = 0; int64_t thresh = LLONG_MAX; /* Discard outliers above this value. */ - unsigned int ret = 0; again: @@ -274,16 +242,13 @@ again: if (((avg > stddev * 6) && (divisor * 4 >= INTERVALS * 3)) || stddev <= 20) { data->predicted_us = avg; - ret = 1; - return ret; + return; } else if ((divisor * 4) > INTERVALS * 3) { /* Exclude the max interval */ thresh = max - 1; goto again; } - - return ret; } /** @@ -298,9 +263,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) int i; int multiplier; struct timespec t; - int repeat = 0, low_predicted = 0; - int cpu = smp_processor_id(); - struct hrtimer *hrtmr = &per_cpu(menu_hrtimer, cpu); if (data->needs_update) { menu_update(drv, dev); @@ -335,7 +297,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) data->predicted_us = div_round64(data->expected_us * data->correction_factor[data->bucket], RESOLUTION * DECAY); - repeat = get_typical_interval(data); + get_typical_interval(data); /* * We want to default to C1 (hlt), not to busy polling @@ -356,10 +318,8 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) if (s->disabled || su->disable) continue; - if (s->target_residency > data->predicted_us) { - low_predicted = 1; + if (s->target_residency > data->predicted_us) continue; - } if (s->exit_latency > latency_req) continue; if (s->exit_latency * multiplier > data->predicted_us) @@ -369,28 +329,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) data->exit_us = s->exit_latency; } - /* not deepest C-state chosen for low predicted residency */ - if (low_predicted) { - unsigned int timer_us = 0; - - /* - * Set a timer to detect whether this sleep is much - * longer than repeat mode predicted. If the timer - * triggers, the code will evaluate whether to put - * the CPU into a deeper C-state. - * The timer is cancelled on CPU wakeup. - */ - timer_us = 2 * (data->predicted_us + MAX_DEVIATION); - - if (repeat && (4 * timer_us < data->expected_us)) { - RCU_NONIDLE(hrtimer_start(hrtmr, - ns_to_ktime(1000 * timer_us), - HRTIMER_MODE_REL_PINNED)); - /* In repeat case, menu hrtimer is started */ - per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_REPEAT; - } - } - return data->last_state_idx; } @@ -481,9 +419,6 @@ static int menu_enable_device(struct cpuidle_driver *drv, struct cpuidle_device *dev) { struct menu_device *data = &per_cpu(menu_devices, dev->cpu); - struct hrtimer *t = &per_cpu(menu_hrtimer, dev->cpu); - hrtimer_init(t, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - t->function = menu_hrtimer_notify; memset(data, 0, sizeof(struct menu_device)); diff --git a/include/linux/tick.h b/include/linux/tick.h index 9180f4b85e6d..62bd8b72873c 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -174,10 +174,4 @@ static inline void tick_nohz_task_switch(struct task_struct *tsk) { } #endif -# ifdef CONFIG_CPU_IDLE_GOV_MENU -extern void menu_hrtimer_cancel(void); -# else -static inline void menu_hrtimer_cancel(void) {} -# endif /* CONFIG_CPU_IDLE_GOV_MENU */ - #endif diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index e80183f4a6c4..e77edc97e036 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -827,13 +827,10 @@ void tick_nohz_irq_exit(void) { struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); - if (ts->inidle) { - /* Cancel the timer because CPU already waken up from the C-states*/ - menu_hrtimer_cancel(); + if (ts->inidle) __tick_nohz_idle_enter(ts); - } else { + else tick_nohz_full_stop_tick(ts); - } } /** @@ -931,8 +928,6 @@ void tick_nohz_idle_exit(void) ts->inidle = 0; - /* Cancel the timer because CPU already waken up from the C-states*/ - menu_hrtimer_cancel(); if (ts->idle_active || ts->tick_stopped) now = ktime_get(); From a8d30608eaed6cc759b8e2e8a8bbbb42591f797f Mon Sep 17 00:00:00 2001 From: Vinod Koul <vinod.koul@intel.com> Date: Mon, 29 Jul 2013 15:10:22 +0530 Subject: [PATCH 588/913] ALSA: compress: fix the return value for SNDRV_COMPRESS_VERSION the return value of SNDRV_COMPRESS_VERSION always return default -ENOTTY as the return value was never updated for this call assign return value from put_user() Reported-by: Haynes <hgeorge@codeaurora.org> CC: stable@vger.kernel.org Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> --- sound/core/compress_offload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 99db892d7299..98969541cbcc 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -743,7 +743,7 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg) mutex_lock(&stream->device->lock); switch (_IOC_NR(cmd)) { case _IOC_NR(SNDRV_COMPRESS_IOCTL_VERSION): - put_user(SNDRV_COMPRESS_VERSION, + retval = put_user(SNDRV_COMPRESS_VERSION, (int __user *)arg) ? -EFAULT : 0; break; case _IOC_NR(SNDRV_COMPRESS_GET_CAPS): From d7ead0c3c27ef601964d1428066fac932070af7f Mon Sep 17 00:00:00 2001 From: Aurelien Chartier <aurelien.chartier@citrix.com> Date: Tue, 9 Jul 2013 14:29:35 +0100 Subject: [PATCH 589/913] xenbus: frontend resume cleanup Only create the delayed resume workqueue if we are running in the same domain as xenstored and issue a warning if the workqueue creation fails. Move the work initialization to the device probe so it is done only once. Signed-off-by: Aurelien Chartier <aurelien.chartier@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: David Vrabel <david.vrabel@citrix.com> --- drivers/xen/xenbus/xenbus_probe_frontend.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index 6ed8a9df4472..34b20bfa4e8c 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c @@ -115,7 +115,6 @@ static int xenbus_frontend_dev_resume(struct device *dev) return -EFAULT; } - INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume); queue_work(xenbus_frontend_wq, &xdev->work); return 0; @@ -124,6 +123,16 @@ static int xenbus_frontend_dev_resume(struct device *dev) return xenbus_dev_resume(dev); } +static int xenbus_frontend_dev_probe(struct device *dev) +{ + if (xen_store_domain_type == XS_LOCAL) { + struct xenbus_device *xdev = to_xenbus_device(dev); + INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume); + } + + return xenbus_dev_probe(dev); +} + static const struct dev_pm_ops xenbus_pm_ops = { .suspend = xenbus_dev_suspend, .resume = xenbus_frontend_dev_resume, @@ -142,7 +151,7 @@ static struct xen_bus_type xenbus_frontend = { .name = "xen", .match = xenbus_match, .uevent = xenbus_uevent_frontend, - .probe = xenbus_dev_probe, + .probe = xenbus_frontend_dev_probe, .remove = xenbus_dev_remove, .shutdown = xenbus_dev_shutdown, .dev_attrs = xenbus_dev_attrs, @@ -474,7 +483,11 @@ static int __init xenbus_probe_frontend_init(void) register_xenstore_notifier(&xenstore_notifier); - xenbus_frontend_wq = create_workqueue("xenbus_frontend"); + if (xen_store_domain_type == XS_LOCAL) { + xenbus_frontend_wq = create_workqueue("xenbus_frontend"); + if (!xenbus_frontend_wq) + pr_warn("create xenbus frontend workqueue failed, S3 resume is likely to fail\n"); + } return 0; } From f21407179ccd0dec35f4580052c26ea923c28ac9 Mon Sep 17 00:00:00 2001 From: Julien Grall <julien.grall@linaro.org> Date: Mon, 22 Jul 2013 22:40:58 +0100 Subject: [PATCH 590/913] xen/arm64: Don't compile cpu hotplug On ARM64, when CONFIG_XEN=y, the compilation will fail because CPU hotplug is not yet supported with XEN. For now, disable it. Signed-off-by: Julien Grall <julien.grall@linaro.org> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Acked-by: Mark Rutland <mark.rutland@arm.com> --- drivers/xen/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index eabd0ee1c2bc..fc37c49a8ffe 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile @@ -1,4 +1,4 @@ -ifneq ($(CONFIG_ARM),y) +ifeq ($(filter y, $(CONFIG_ARM) $(CONFIG_ARM64)),) obj-y += manage.o obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o endif From 9e7fd145b691127cfd48ab8c05cc1aa6d35b57ad Mon Sep 17 00:00:00 2001 From: Julien Grall <julien.grall@linaro.org> Date: Tue, 23 Jul 2013 16:21:28 +0100 Subject: [PATCH 591/913] xen/arm: enable PV control for ARM Enable lifecyle management (reboot, shutdown...) from the toolstack for ARM guests. Signed-off-by: Julien Grall <julien.grall@linaro.org> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- drivers/xen/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index fc37c49a8ffe..14fe79d8634a 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile @@ -1,9 +1,8 @@ ifeq ($(filter y, $(CONFIG_ARM) $(CONFIG_ARM64)),) -obj-y += manage.o obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o endif obj-$(CONFIG_X86) += fallback.o -obj-y += grant-table.o features.o events.o balloon.o +obj-y += grant-table.o features.o events.o balloon.o manage.o obj-y += xenbus/ nostackp := $(call cc-option, -fno-stack-protector) From 94eec0fc3520c759831763d866421b4d60b599b4 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o <tytso@mit.edu> Date: Mon, 29 Jul 2013 12:12:56 -0400 Subject: [PATCH 592/913] ext4: fix retry handling in ext4_ext_truncate() We tested for ENOMEM instead of -ENOMEM. Oops. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: stable@vger.kernel.org --- fs/ext4/extents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index a61873808f76..72ba4705d4fa 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4412,7 +4412,7 @@ void ext4_ext_truncate(handle_t *handle, struct inode *inode) retry: err = ext4_es_remove_extent(inode, last_block, EXT_MAX_BLOCKS - last_block); - if (err == ENOMEM) { + if (err == -ENOMEM) { cond_resched(); congestion_wait(BLK_RW_ASYNC, HZ/50); goto retry; From 71ab1d58c26eb7c30711caa95c173d5c39ab8855 Mon Sep 17 00:00:00 2001 From: Niels de Vos <ndevos@redhat.com> Date: Mon, 29 Jul 2013 09:38:38 +0200 Subject: [PATCH 593/913] pata_imx: expose module alias for loading from device-tree Enable auto loading by udev when pata_imx is compiled as a module. Signed-off-by: Niels de Vos <ndevos@redhat.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Tejun Heo <tj@kernel.org> --- drivers/ata/pata_imx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c index 4ec7c04b3f82..26386f0b89a8 100644 --- a/drivers/ata/pata_imx.c +++ b/drivers/ata/pata_imx.c @@ -237,6 +237,7 @@ static const struct of_device_id imx_pata_dt_ids[] = { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, imx_pata_dt_ids); static struct platform_driver pata_imx_driver = { .probe = pata_imx_probe, From 44fb851dfb2f8e3462617e19a7b3b9025db9d919 Mon Sep 17 00:00:00 2001 From: Zheng Liu <wenqing.lz@taobao.com> Date: Mon, 29 Jul 2013 12:51:42 -0400 Subject: [PATCH 594/913] ext4: add WARN_ON to check the length of allocated blocks In commit 921f266b: ext4: add self-testing infrastructure to do a sanity check, some sanity checks were added in map_blocks to make sure 'retval == map->m_len'. Enable these checks by default and report any assertion failures using ext4_warning() and WARN_ON() since they can help us to figure out some bugs that are otherwise hard to hit. Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> --- fs/ext4/inode.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index ba33c67d6e48..dd32a2eacd0d 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -555,14 +555,13 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, int ret; unsigned long long status; -#ifdef ES_AGGRESSIVE_TEST - if (retval != map->m_len) { - printk("ES len assertion failed for inode: %lu " - "retval %d != map->m_len %d " - "in %s (lookup)\n", inode->i_ino, retval, - map->m_len, __func__); + if (unlikely(retval != map->m_len)) { + ext4_warning(inode->i_sb, + "ES len assertion failed for inode " + "%lu: retval %d != map->m_len %d", + inode->i_ino, retval, map->m_len); + WARN_ON(1); } -#endif status = map->m_flags & EXT4_MAP_UNWRITTEN ? EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; @@ -656,14 +655,13 @@ found: int ret; unsigned long long status; -#ifdef ES_AGGRESSIVE_TEST - if (retval != map->m_len) { - printk("ES len assertion failed for inode: %lu " - "retval %d != map->m_len %d " - "in %s (allocation)\n", inode->i_ino, retval, - map->m_len, __func__); + if (unlikely(retval != map->m_len)) { + ext4_warning(inode->i_sb, + "ES len assertion failed for inode " + "%lu: retval %d != map->m_len %d", + inode->i_ino, retval, map->m_len); + WARN_ON(1); } -#endif /* * If the extent has been zeroed out, we don't need to update @@ -1637,14 +1635,13 @@ add_delayed: int ret; unsigned long long status; -#ifdef ES_AGGRESSIVE_TEST - if (retval != map->m_len) { - printk("ES len assertion failed for inode: %lu " - "retval %d != map->m_len %d " - "in %s (lookup)\n", inode->i_ino, retval, - map->m_len, __func__); + if (unlikely(retval != map->m_len)) { + ext4_warning(inode->i_sb, + "ES len assertion failed for inode " + "%lu: retval %d != map->m_len %d", + inode->i_ino, retval, map->m_len); + WARN_ON(1); } -#endif status = map->m_flags & EXT4_MAP_UNWRITTEN ? EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; From 1deb57042fe2bd14cd7d4687f3c9418d26862053 Mon Sep 17 00:00:00 2001 From: Mark Brown <broonie@linaro.org> Date: Mon, 29 Jul 2013 08:50:28 +0100 Subject: [PATCH 595/913] ASoC: bfin-ac97: Fix prototype error following AC'97 refactoring As part of the multiplatform refactoring for AC'97 the AC'97 bus ops were staticised meaning that the prototype (which was never needed) conflicts with the declaration causing build failures. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de> --- sound/soc/blackfin/bf5xx-ac97.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/blackfin/bf5xx-ac97.h b/sound/soc/blackfin/bf5xx-ac97.h index 15c635e33f4d..0c3e22d90a8d 100644 --- a/sound/soc/blackfin/bf5xx-ac97.h +++ b/sound/soc/blackfin/bf5xx-ac97.h @@ -9,7 +9,6 @@ #ifndef _BF5XX_AC97_H #define _BF5XX_AC97_H -extern struct snd_ac97_bus_ops bf5xx_ac97_ops; extern struct snd_ac97 *ac97; /* Frame format in memory, only support stereo currently */ struct ac97_frame { From be348790e46cf3783f265b0ecf9fa9dc68bd6f15 Mon Sep 17 00:00:00 2001 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Thu, 4 Jul 2013 21:35:00 +0800 Subject: [PATCH 596/913] drm/exynos: exynos_drm_ipp: fix return value check In case of error, the function ipp_find_obj() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Reviewed-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> --- drivers/gpu/drm/exynos/exynos_drm_ipp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index b1ef8e7ff9c9..0eb8538823e4 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c @@ -342,10 +342,10 @@ int exynos_drm_ipp_get_property(struct drm_device *drm_dev, void *data, */ ippdrv = ipp_find_obj(&ctx->ipp_idr, &ctx->ipp_lock, prop_list->ipp_id); - if (!ippdrv) { + if (IS_ERR(ippdrv)) { DRM_ERROR("not found ipp%d driver.\n", prop_list->ipp_id); - return -EINVAL; + return PTR_ERR(ippdrv); } prop_list = ippdrv->prop_list; @@ -970,9 +970,9 @@ int exynos_drm_ipp_queue_buf(struct drm_device *drm_dev, void *data, /* find command node */ c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, qbuf->prop_id); - if (!c_node) { + if (IS_ERR(c_node)) { DRM_ERROR("failed to get command node.\n"); - return -EFAULT; + return PTR_ERR(c_node); } /* buffer control */ @@ -1106,9 +1106,9 @@ int exynos_drm_ipp_cmd_ctrl(struct drm_device *drm_dev, void *data, c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, cmd_ctrl->prop_id); - if (!c_node) { + if (IS_ERR(c_node)) { DRM_ERROR("invalid command node list.\n"); - return -EINVAL; + return PTR_ERR(c_node); } if (!exynos_drm_ipp_check_valid(ippdrv->dev, cmd_ctrl->ctrl, From de1d3677017a1d58419722b60564cb56bd9462c3 Mon Sep 17 00:00:00 2001 From: Inki Dae <inki.dae@samsung.com> Date: Mon, 22 Jul 2013 20:51:42 +0900 Subject: [PATCH 597/913] drm/exynos: fix module build error This patch removes all MODULE_DEVICE_TABLE declarations. Exynos drm drivers don't need to create MODULE_DEVICE_TABLE yet because all devices of Exynos drm include in one SoC so they cannot be plugged in as of now. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 -- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 1 - 2 files changed, 3 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 3e106beca5b6..5dba79ef5f31 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -130,7 +130,6 @@ static const struct of_device_id fimd_driver_dt_match[] = { .data = &exynos5_fimd_driver_data }, {}, }; -MODULE_DEVICE_TABLE(of, fimd_driver_dt_match); #endif static inline struct fimd_driver_data *drm_fimd_get_driver_data( @@ -1082,7 +1081,6 @@ static struct platform_device_id fimd_driver_ids[] = { }, {}, }; -MODULE_DEVICE_TABLE(platform, fimd_driver_ids); static const struct dev_pm_ops fimd_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume) diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 42a5a5466075..4722662e22c7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -1521,7 +1521,6 @@ static const struct of_device_id exynos_g2d_match[] = { { .compatible = "samsung,exynos5250-g2d" }, {}, }; -MODULE_DEVICE_TABLE(of, exynos_g2d_match); #endif struct platform_driver g2d_driver = { From 89f8b85ecd31a678a17d419327000a60b74b2ed7 Mon Sep 17 00:00:00 2001 From: Inki Dae <inki.dae@samsung.com> Date: Wed, 24 Jul 2013 13:40:12 +0900 Subject: [PATCH 598/913] drm/exynos: consider common clock framework to g2d driver. This patch just changes clk_enable/disable to clk_prepare_enable/clk_disable_unprepare, and adds related exception codes. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> --- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 4722662e22c7..f81cfd434bb9 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -806,9 +806,20 @@ static void g2d_dma_start(struct g2d_data *g2d, struct g2d_cmdlist_node *node = list_first_entry(&runqueue_node->run_cmdlist, struct g2d_cmdlist_node, list); + int ret; - pm_runtime_get_sync(g2d->dev); - clk_enable(g2d->gate_clk); + ret = pm_runtime_get_sync(g2d->dev); + if (ret < 0) { + dev_warn(g2d->dev, "failed pm power on.\n"); + return; + } + + ret = clk_prepare_enable(g2d->gate_clk); + if (ret < 0) { + dev_warn(g2d->dev, "failed to enable clock.\n"); + pm_runtime_put_sync(g2d->dev); + return; + } writel_relaxed(node->dma_addr, g2d->regs + G2D_DMA_SFR_BASE_ADDR); writel_relaxed(G2D_DMA_START, g2d->regs + G2D_DMA_COMMAND); @@ -861,7 +872,7 @@ static void g2d_runqueue_worker(struct work_struct *work) runqueue_work); mutex_lock(&g2d->runqueue_mutex); - clk_disable(g2d->gate_clk); + clk_disable_unprepare(g2d->gate_clk); pm_runtime_put_sync(g2d->dev); complete(&g2d->runqueue_node->complete); From db70d16ef63dbd412a974c893c52ee5ad0777d21 Mon Sep 17 00:00:00 2001 From: Sachin Kamat <sachin.kamat@linaro.org> Date: Fri, 26 Jul 2013 13:29:19 +0530 Subject: [PATCH 599/913] drm/exynos: Remove module.h header inclusion Remove module.h header file inclusion from files since they do not use/refer to any code from that file. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Inki Dae <inki.dae@samsung.com> --- drivers/gpu/drm/exynos/exynos_ddc.c | 1 - drivers/gpu/drm/exynos/exynos_drm_fimc.c | 1 - drivers/gpu/drm/exynos/exynos_drm_fimd.c | 1 - drivers/gpu/drm/exynos/exynos_drm_g2d.c | 1 - drivers/gpu/drm/exynos/exynos_drm_gsc.c | 1 - drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 1 - drivers/gpu/drm/exynos/exynos_drm_ipp.c | 1 - drivers/gpu/drm/exynos/exynos_drm_rotator.c | 1 - drivers/gpu/drm/exynos/exynos_drm_vidi.c | 1 - drivers/gpu/drm/exynos/exynos_hdmi.c | 1 - drivers/gpu/drm/exynos/exynos_hdmiphy.c | 1 - drivers/gpu/drm/exynos/exynos_mixer.c | 1 - 12 files changed, 12 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_ddc.c b/drivers/gpu/drm/exynos/exynos_ddc.c index 95c75edef01a..30ef41bcd7b8 100644 --- a/drivers/gpu/drm/exynos/exynos_ddc.c +++ b/drivers/gpu/drm/exynos/exynos_ddc.c @@ -15,7 +15,6 @@ #include <linux/kernel.h> #include <linux/i2c.h> -#include <linux/module.h> #include "exynos_drm_drv.h" diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 61b094f689a7..6e047bd53e2f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c @@ -12,7 +12,6 @@ * */ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/platform_device.h> #include <linux/mfd/syscon.h> #include <linux/regmap.h> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 5dba79ef5f31..1c263dac3c1c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -14,7 +14,6 @@ #include <drm/drmP.h> #include <linux/kernel.h> -#include <linux/module.h> #include <linux/platform_device.h> #include <linux/clk.h> #include <linux/of_device.h> diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index f81cfd434bb9..eddea4941483 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -8,7 +8,6 @@ */ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/clk.h> #include <linux/err.h> #include <linux/interrupt.h> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 472e3b25e7f2..90b8a1a5344c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c @@ -12,7 +12,6 @@ * */ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/platform_device.h> #include <linux/clk.h> #include <linux/pm_runtime.h> diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index aaa550d622f0..8d3bc01d6834 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -15,7 +15,6 @@ #include <linux/kernel.h> #include <linux/wait.h> -#include <linux/module.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index 0eb8538823e4..d2b6ab4def93 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c @@ -12,7 +12,6 @@ * */ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/platform_device.h> #include <linux/types.h> #include <linux/clk.h> diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index 427640aa5148..49669aa24c45 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c @@ -10,7 +10,6 @@ */ #include <linux/kernel.h> -#include <linux/module.h> #include <linux/err.h> #include <linux/interrupt.h> #include <linux/io.h> diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 41cc74d83e4e..c57c56519add 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -13,7 +13,6 @@ #include <drm/drmP.h> #include <linux/kernel.h> -#include <linux/module.h> #include <linux/platform_device.h> #include <drm/exynos_drm.h> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 62ef5971ac3c..2f5c6942c968 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -24,7 +24,6 @@ #include <linux/spinlock.h> #include <linux/wait.h> #include <linux/i2c.h> -#include <linux/module.h> #include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/irq.h> diff --git a/drivers/gpu/drm/exynos/exynos_hdmiphy.c b/drivers/gpu/drm/exynos/exynos_hdmiphy.c index ef04255076c7..6e320ae9afed 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmiphy.c +++ b/drivers/gpu/drm/exynos/exynos_hdmiphy.c @@ -15,7 +15,6 @@ #include <linux/kernel.h> #include <linux/i2c.h> -#include <linux/module.h> #include "exynos_drm_drv.h" #include "exynos_hdmi.h" diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 42ffb71c63bc..c9a137caea41 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -23,7 +23,6 @@ #include <linux/spinlock.h> #include <linux/wait.h> #include <linux/i2c.h> -#include <linux/module.h> #include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/irq.h> From dec23dca5a9ca4b9eb2fb66926f567889028b904 Mon Sep 17 00:00:00 2001 From: Fabio Estevam <fabio.estevam@freescale.com> Date: Mon, 29 Jul 2013 13:09:56 +0300 Subject: [PATCH 600/913] usb: chipidea: cast PORTSC_PTS and DEVLC_PTS macros Fix the following build warnings on x86: drivers/usb/chipidea/core.c: In function 'hw_phymode_configure': drivers/usb/chipidea/core.c:226:3: warning: large integer implicitly truncated to unsigned type [-Woverflow] drivers/usb/chipidea/core.c:230:3: warning: large integer implicitly truncated to unsigned type [-Woverflow] drivers/usb/chipidea/core.c:243:3: warning: large integer implicitly truncated to unsigned type [-Woverflow] drivers/usb/chipidea/core.c:246:3: warning: large integer implicitly truncated to unsigned type [-Woverflow] Reported-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/chipidea/bits.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index aefa0261220c..1b23e354f9fb 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h @@ -50,7 +50,7 @@ #define PORTSC_PTC (0x0FUL << 16) /* PTS and PTW for non lpm version only */ #define PORTSC_PTS(d) \ - ((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0)) + (u32)((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0)) #define PORTSC_PTW BIT(28) #define PORTSC_STS BIT(29) @@ -59,7 +59,7 @@ #define DEVLC_PSPD_HS (0x02UL << 25) #define DEVLC_PTW BIT(27) #define DEVLC_STS BIT(28) -#define DEVLC_PTS(d) (((d) & 0x7) << 29) +#define DEVLC_PTS(d) (u32)(((d) & 0x7) << 29) /* Encoding for DEVLC_PTS and PORTSC_PTS */ #define PTS_UTMI 0 From 972a6c5d56b42d6dd326867d5974ffa58383ec53 Mon Sep 17 00:00:00 2001 From: Peter Chen <peter.chen@freescale.com> Date: Mon, 29 Jul 2013 13:09:57 +0300 Subject: [PATCH 601/913] usb: chipidea: fix the build error with randconfig Using below configs, the compile will have error: ERROR: "ehci_init_driver" undefined! .config: CONFIG_USB_CHIPIDEA=m CONFIG_USB_CHIPIDEA_HOST=y CONFIG_USB_CHIPIDEA_DEBUG=y The reason is chipidea host uses symbol from ehci, but ehci is not compiled. Let the chipidea host depend on ehci even it is built as module. Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/chipidea/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig index eb2aa2e5a842..d1bd8ef1f9c1 100644 --- a/drivers/usb/chipidea/Kconfig +++ b/drivers/usb/chipidea/Kconfig @@ -12,7 +12,7 @@ if USB_CHIPIDEA config USB_CHIPIDEA_UDC bool "ChipIdea device controller" - depends on USB_GADGET=y || USB_CHIPIDEA=m + depends on USB_GADGET=y || (USB_CHIPIDEA=m && USB_GADGET=m) help Say Y here to enable device controller functionality of the ChipIdea driver. @@ -20,7 +20,7 @@ config USB_CHIPIDEA_UDC config USB_CHIPIDEA_HOST bool "ChipIdea host controller" depends on USB=y - depends on USB_EHCI_HCD=y || USB_CHIPIDEA=m + depends on USB_EHCI_HCD=y || (USB_CHIPIDEA=m && USB_EHCI_HCD=m) select USB_EHCI_ROOT_HUB_TT help Say Y here to enable host controller functionality of the From 1a7f0e3c4fff449f6dd08787beb98a8e57d8cdc7 Mon Sep 17 00:00:00 2001 From: Tony Luck <tony.luck@intel.com> Date: Wed, 24 Jul 2013 10:09:43 -0700 Subject: [PATCH 602/913] x86/mce: Fix mce regression from recent cleanup In commit 33d7885b594e169256daef652e8d3527b2298e75 x86/mce: Update MCE severity condition check We simplified the rules to recognise each classification of recoverable machine check combining the instruction and data fetch rules into a single entry based on clarifications in the June 2013 SDM that all recoverable events would be reported on the unaffected processor with MCG_STATUS.EIPV=0 and MCG_STATUS.RIPV=1. Unfortunately the simplified rule has a couple of bugs. Fix them here. Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Signed-off-by: Tony Luck <tony.luck@intel.com> --- arch/x86/kernel/cpu/mcheck/mce-severity.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c index e2703520d120..c370e1c4468b 100644 --- a/arch/x86/kernel/cpu/mcheck/mce-severity.c +++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c @@ -111,8 +111,8 @@ static struct severity { #ifdef CONFIG_MEMORY_FAILURE MCESEV( KEEP, "Action required but unaffected thread is continuable", - SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR), - MCGMASK(MCG_STATUS_RIPV, MCG_STATUS_RIPV) + SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR, MCI_UC_SAR|MCI_ADDR), + MCGMASK(MCG_STATUS_RIPV|MCG_STATUS_EIPV, MCG_STATUS_RIPV) ), MCESEV( AR, "Action required: data load error in a user process", From e2288b66fe7ff0288382b2af671b4da558b44472 Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka <stf_xl@wp.pl> Date: Sun, 28 Jul 2013 13:17:22 +0200 Subject: [PATCH 603/913] rt2x00: fix stop queue Since we clear QUEUE_STARTED in rt2x00queue_stop_queue(), following call to rt2x00queue_pause_queue() reduce to noop, i.e we do not stop queue in mac80211. To fix that introduce rt2x00queue_pause_queue_nocheck() function, which will stop queue in mac80211 directly. Note that rt2x00_start_queue() explicitly set QUEUE_PAUSED bit. Note also that reordering operations i.e. first call to rt2x00queue_pause_queue() and then clear QUEUE_STARTED bit, will race with rt2x00queue_unpause_queue(), so calling ieee80211_stop_queue() directly is the only available solution to fix the problem without major rework. Cc: stable@vger.kernel.org Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/rt2x00/rt2x00queue.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 6c0a91ff963c..aa95c6cf3545 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c @@ -936,13 +936,8 @@ void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index) spin_unlock_irqrestore(&queue->index_lock, irqflags); } -void rt2x00queue_pause_queue(struct data_queue *queue) +void rt2x00queue_pause_queue_nocheck(struct data_queue *queue) { - if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) || - !test_bit(QUEUE_STARTED, &queue->flags) || - test_and_set_bit(QUEUE_PAUSED, &queue->flags)) - return; - switch (queue->qid) { case QID_AC_VO: case QID_AC_VI: @@ -958,6 +953,15 @@ void rt2x00queue_pause_queue(struct data_queue *queue) break; } } +void rt2x00queue_pause_queue(struct data_queue *queue) +{ + if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) || + !test_bit(QUEUE_STARTED, &queue->flags) || + test_and_set_bit(QUEUE_PAUSED, &queue->flags)) + return; + + rt2x00queue_pause_queue_nocheck(queue); +} EXPORT_SYMBOL_GPL(rt2x00queue_pause_queue); void rt2x00queue_unpause_queue(struct data_queue *queue) @@ -1019,7 +1023,7 @@ void rt2x00queue_stop_queue(struct data_queue *queue) return; } - rt2x00queue_pause_queue(queue); + rt2x00queue_pause_queue_nocheck(queue); queue->rt2x00dev->ops->lib->stop_queue(queue); From 02073798a6b081bf74e6c10d6f7e7a693c067ecd Mon Sep 17 00:00:00 2001 From: Piotr Sarna <p.sarna@partner.samsung.com> Date: Mon, 29 Jul 2013 12:25:20 +0200 Subject: [PATCH 604/913] staging: zcache: fix "zcache=" kernel parameter Commit 835f2f5 ("staging: zcache: enable zcache to be built/loaded as a module") introduced an incorrect handling of "zcache=" parameter. Inside zcache_comp_init() function, zcache_comp_name variable is checked for being empty. If not empty, the above variable is tested for being compatible with Crypto API. Unfortunately, after that function ends unconditionally (by the "goto out" directive) and returns: - non-zero value if verification succeeded, wrongly indicating an error - zero value if verification failed, falsely informing that function zcache_comp_init() ended properly. A solution to this problem is as following: 1. Move the "goto out" directive inside the "if (!ret)" statement 2. In case that crypto_has_comp() returned 0, change the value of ret to non-zero before "goto out" to indicate an error. This patch replaces an earlier one from Michal Hocko (based on report from Cristian Rodriguez): http://permalink.gmane.org/gmane.linux.kernel.mm/102484 It also addressed the same issue but didn't fix the zcache_comp_init() for case when the compressor data passed to "zcache=" option was invalid or unsupported. Signed-off-by: Piotr Sarna <p.sarna@partner.samsung.com> [bzolnier: updated patch description] Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Acked-by: Michal Hocko <mhocko@suse.cz> Cc: stable <stable@vger.kernel.org> # 3.10 Cc: Cristian Rodriguez <crrodriguez@opensuse.org> Cc: Bob Liu <bob.liu@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/staging/zcache/zcache-main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index dcceed29d31a..81972fa47beb 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -1811,10 +1811,12 @@ static int zcache_comp_init(void) #else if (*zcache_comp_name != '\0') { ret = crypto_has_comp(zcache_comp_name, 0, 0); - if (!ret) + if (!ret) { pr_info("zcache: %s not supported\n", zcache_comp_name); - goto out; + ret = 1; + goto out; + } } if (!ret) strcpy(zcache_comp_name, "lzo"); From 89c66ee890af18500fa4598db300cc07c267f900 Mon Sep 17 00:00:00 2001 From: Christian Eggers <ceggers@gmx.de> Date: Mon, 29 Jul 2013 20:54:09 +0200 Subject: [PATCH 605/913] spi: spi-davinci: Fix direction in dma_map_single() Commit 048177ce3b3962852fd34a7e04938959271c7e70 (spi: spi-davinci: convert to DMA engine API) introduced a regression: dma_map_single() is called with direction DMA_FROM_DEVICE for rx and for tx. Signed-off-by: Christian Eggers <ceggers@gmx.de> Acked-by: Matt Porter <mporter@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org # v3.7.x+ --- drivers/spi/spi-davinci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 222d3e37fc28..707966bd5610 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -609,7 +609,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) else buf = (void *)t->tx_buf; t->tx_dma = dma_map_single(&spi->dev, buf, - t->len, DMA_FROM_DEVICE); + t->len, DMA_TO_DEVICE); if (!t->tx_dma) { ret = -EFAULT; goto err_tx_map; From fed1f1ed90bce42ea010e2904cbc04e7b8304940 Mon Sep 17 00:00:00 2001 From: "Rick Farina (Zero_Chaos)" <zerochaos@gentoo.org> Date: Mon, 29 Jul 2013 15:17:59 -0400 Subject: [PATCH 606/913] USB: serial: ftdi_sio: add more RT Systems ftdi devices RT Systems makes many usb serial cables based on the ftdi_sio driver for programming various amateur radios. This patch is a full listing of their current product offerings and should allow these cables to all be recognized. Signed-off-by: Rick Farina (Zero_Chaos) <zerochaos@gentoo.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/ftdi_sio.c | 31 +++++++++++++++++++++++++--- drivers/usb/serial/ftdi_sio_ids.h | 34 ++++++++++++++++++++++++++----- 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 7260ec660347..b65e657c641d 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -735,9 +735,34 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, - { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, - { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) }, - { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_RTS01_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57B_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29A_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29B_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29F_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62B_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S01_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29C_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_81B_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_82B_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5D_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K4Y_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5G_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S05_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_60_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_61_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63B_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_64_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_65_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92D_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_W5R_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_A5R_PID) }, + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_PW1_PID) }, { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 6dd79253205d..1b8af461b522 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h @@ -815,11 +815,35 @@ /* * RT Systems programming cables for various ham radios */ -#define RTSYSTEMS_VID 0x2100 /* Vendor ID */ -#define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ -#define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */ -#define RTSYSTEMS_RTS01_PID 0x9e57 /* USB-RTS01 Radio Cable */ - +#define RTSYSTEMS_VID 0x2100 /* Vendor ID */ +#define RTSYSTEMS_USB_S03_PID 0x9001 /* RTS-03 USB to Serial Adapter */ +#define RTSYSTEMS_USB_59_PID 0x9e50 /* USB-59 USB to 8 pin plug */ +#define RTSYSTEMS_USB_57A_PID 0x9e51 /* USB-57A USB to 4pin 3.5mm plug */ +#define RTSYSTEMS_USB_57B_PID 0x9e52 /* USB-57B USB to extended 4pin 3.5mm plug */ +#define RTSYSTEMS_USB_29A_PID 0x9e53 /* USB-29A USB to 3.5mm stereo plug */ +#define RTSYSTEMS_USB_29B_PID 0x9e54 /* USB-29B USB to 6 pin mini din */ +#define RTSYSTEMS_USB_29F_PID 0x9e55 /* USB-29F USB to 6 pin modular plug */ +#define RTSYSTEMS_USB_62B_PID 0x9e56 /* USB-62B USB to 8 pin mini din plug*/ +#define RTSYSTEMS_USB_S01_PID 0x9e57 /* USB-RTS01 USB to 3.5 mm stereo plug*/ +#define RTSYSTEMS_USB_63_PID 0x9e58 /* USB-63 USB to 9 pin female*/ +#define RTSYSTEMS_USB_29C_PID 0x9e59 /* USB-29C USB to 4 pin modular plug*/ +#define RTSYSTEMS_USB_81B_PID 0x9e5A /* USB-81 USB to 8 pin mini din plug*/ +#define RTSYSTEMS_USB_82B_PID 0x9e5B /* USB-82 USB to 2.5 mm stereo plug*/ +#define RTSYSTEMS_USB_K5D_PID 0x9e5C /* USB-K5D USB to 8 pin modular plug*/ +#define RTSYSTEMS_USB_K4Y_PID 0x9e5D /* USB-K4Y USB to 2.5/3.5 mm plugs*/ +#define RTSYSTEMS_USB_K5G_PID 0x9e5E /* USB-K5G USB to 8 pin modular plug*/ +#define RTSYSTEMS_USB_S05_PID 0x9e5F /* USB-RTS05 USB to 2.5 mm stereo plug*/ +#define RTSYSTEMS_USB_60_PID 0x9e60 /* USB-60 USB to 6 pin din*/ +#define RTSYSTEMS_USB_61_PID 0x9e61 /* USB-61 USB to 6 pin mini din*/ +#define RTSYSTEMS_USB_62_PID 0x9e62 /* USB-62 USB to 8 pin mini din*/ +#define RTSYSTEMS_USB_63B_PID 0x9e63 /* USB-63 USB to 9 pin female*/ +#define RTSYSTEMS_USB_64_PID 0x9e64 /* USB-64 USB to 9 pin male*/ +#define RTSYSTEMS_USB_65_PID 0x9e65 /* USB-65 USB to 9 pin female null modem*/ +#define RTSYSTEMS_USB_92_PID 0x9e66 /* USB-92 USB to 12 pin plug*/ +#define RTSYSTEMS_USB_92D_PID 0x9e67 /* USB-92D USB to 12 pin plug data*/ +#define RTSYSTEMS_USB_W5R_PID 0x9e68 /* USB-W5R USB to 8 pin modular plug*/ +#define RTSYSTEMS_USB_A5R_PID 0x9e69 /* USB-A5R USB to 8 pin modular plug*/ +#define RTSYSTEMS_USB_PW1_PID 0x9e6A /* USB-PW1 USB to 8 pin modular plug*/ /* * Physik Instrumente From 7d61d835824f73dc4097b51f800382467c8049c5 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Fri, 26 Jul 2013 13:26:05 -0400 Subject: [PATCH 607/913] drm/radeon: fix audio dto programming on DCE4+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need to set the dto source before setting the dividers otherwise we may get stability problems with the dto leading to audio playback problems. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Cc: stable@vger.kernel.org --- drivers/gpu/drm/radeon/evergreen_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index b0d3fb341417..bb9ea3641312 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c @@ -157,9 +157,9 @@ static void evergreen_audio_set_dto(struct drm_encoder *encoder, u32 clock) * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator */ + WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); - WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); } From 489bc476b4c2b3097fe9e980379bbbab260a6156 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Fri, 26 Jul 2013 18:05:07 -0400 Subject: [PATCH 608/913] drm/radeon/dpm: fix display gap programming on SI Need to set the DISP*_GAP fields as well as the DISP*_GAP_MCHG fields. Same as on previous asics. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/si_dpm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 73aaa2e4c312..6ecbb875d211 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -3620,8 +3620,12 @@ static void si_enable_display_gap(struct radeon_device *rdev) { u32 tmp = RREG32(CG_DISPLAY_GAP_CNTL); + tmp &= ~(DISP1_GAP_MASK | DISP2_GAP_MASK); + tmp |= (DISP1_GAP(R600_PM_DISPLAY_GAP_IGNORE) | + DISP2_GAP(R600_PM_DISPLAY_GAP_IGNORE)); + tmp &= ~(DISP1_GAP_MCHG_MASK | DISP2_GAP_MCHG_MASK); - tmp |= (DISP1_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE) | + tmp |= (DISP1_GAP_MCHG(R600_PM_DISPLAY_GAP_VBLANK) | DISP2_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE)); WREG32(CG_DISPLAY_GAP_CNTL, tmp); } From f44a0120ef07cc9a1f36ab86751ec2b0598d7a2b Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Fri, 26 Jul 2013 18:18:32 -0400 Subject: [PATCH 609/913] drm/radeon/dpm: fix si_calculate_memory_refresh_rate() Update alogorithm as per internal advice. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/si_dpm.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 6ecbb875d211..80c1f506cc0f 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -37,8 +37,6 @@ #define SMC_RAM_END 0x20000 -#define DDR3_DRAM_ROWS 0x2000 - #define SCLK_MIN_DEEPSLEEP_FREQ 1350 static const struct si_cac_config_reg cac_weights_tahiti[] = @@ -4040,16 +4038,15 @@ static int si_force_switch_to_arb_f0(struct radeon_device *rdev) static u32 si_calculate_memory_refresh_rate(struct radeon_device *rdev, u32 engine_clock) { - struct rv7xx_power_info *pi = rv770_get_pi(rdev); u32 dram_rows; u32 dram_refresh_rate; u32 mc_arb_rfsh_rate; u32 tmp = (RREG32(MC_ARB_RAMCFG) & NOOFROWS_MASK) >> NOOFROWS_SHIFT; - if (pi->mem_gddr5) - dram_rows = 1 << (tmp + 10); + if (tmp >= 4) + dram_rows = 16384; else - dram_rows = DDR3_DRAM_ROWS; + dram_rows = 1 << (tmp + 10); dram_refresh_rate = 1 << ((RREG32(MC_SEQ_MISC0) & 0x3) + 3); mc_arb_rfsh_rate = ((engine_clock * 10) * dram_refresh_rate / dram_rows - 32) / 64; From 46348dc29bc936360057e9b41003274284ec0a47 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Fri, 26 Jul 2013 18:21:02 -0400 Subject: [PATCH 610/913] drm/radeon/dpm: fix powertune handling for pci id 0x6835 0x6835 should be treated as a cape verde pro. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/si_dpm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 80c1f506cc0f..994f9e5b6bee 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -1939,6 +1939,7 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev) case 0x683B: case 0x683F: case 0x6829: + case 0x6835: si_pi->cac_weights = cac_weights_cape_verde_pro; si_pi->dte_data = dte_data_cape_verde; break; From b2d70917e4b9fc5bddfbd025bfb1f15185e74971 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Sat, 27 Jul 2013 17:53:25 -0400 Subject: [PATCH 611/913] drm/radeon: properly handle cg on asics without UVD Don't try and enable clockgating if the asic doesn't have UVD. Use rdev->has_uvd rather than using local checks. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/si.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index d325280e2f9f..1d656f7b13f2 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -5215,14 +5215,12 @@ static void si_enable_mc_ls(struct radeon_device *rdev, static void si_init_cg(struct radeon_device *rdev) { - bool has_uvd = true; - si_enable_mgcg(rdev, true); si_enable_cgcg(rdev, true); /* disable MC LS on Tahiti */ if (rdev->family == CHIP_TAHITI) si_enable_mc_ls(rdev, false); - if (has_uvd) { + if (rdev->has_uvd) { si_enable_uvd_mgcg(rdev, true); si_init_uvd_internal_cg(rdev); } @@ -5230,9 +5228,7 @@ static void si_init_cg(struct radeon_device *rdev) static void si_fini_cg(struct radeon_device *rdev) { - bool has_uvd = true; - - if (has_uvd) + if (rdev->has_uvd) si_enable_uvd_mgcg(rdev, false); si_enable_cgcg(rdev, false); si_enable_mgcg(rdev, false); From 20fab6415cfe33172dfaea1595a2739bdea5f57e Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Sun, 28 Jul 2013 12:33:56 -0400 Subject: [PATCH 612/913] drm/radeon/atom: fix fb when fetching engine params For correctness. The fb divider isn't actually used in any of the relevant dpm code. It's calculated from the other parameters. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/radeon_atombios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index e3f3e8841789..4ccd61f60eb6 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c @@ -2782,7 +2782,7 @@ int radeon_atom_get_clock_dividers(struct radeon_device *rdev, ATOM_PLL_CNTL_FLAG_PLL_POST_DIV_EN) ? true : false; dividers->enable_dithen = (args.v3.ucCntlFlag & ATOM_PLL_CNTL_FLAG_FRACTION_DISABLE) ? false : true; - dividers->fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDiv); + dividers->whole_fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDiv); dividers->frac_fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDivFrac); dividers->ref_div = args.v3.ucRefDiv; dividers->vco_mode = (args.v3.ucCntlFlag & From f86d0269b471d88c9c06da4972f9145f978a0e5a Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Mon, 29 Jul 2013 10:45:27 -0400 Subject: [PATCH 613/913] drm/radeon/dpm: fix forcing performance state to low on cayman Need to program EnabledLevels to 1 to force the low state. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/ni_dpm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index 559cf24d51af..4f9b9bc20daa 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c @@ -1054,10 +1054,6 @@ static int ni_restrict_performance_levels_before_switch(struct radeon_device *rd int ni_dpm_force_performance_level(struct radeon_device *rdev, enum radeon_dpm_forced_level level) { - struct radeon_ps *rps = rdev->pm.dpm.current_ps; - struct ni_ps *ps = ni_get_ps(rps); - u32 levels; - if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) return -EINVAL; @@ -1068,8 +1064,7 @@ int ni_dpm_force_performance_level(struct radeon_device *rdev, if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) return -EINVAL; - levels = ps->performance_level_count - 1; - if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) + if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 1) != PPSMC_Result_OK) return -EINVAL; } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) From 3652f00591982b15f0702dd90e4e5f0ddcfe7f8b Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Mon, 29 Jul 2013 11:51:25 -0400 Subject: [PATCH 614/913] drm/radeon/si: disable cgcg and pg for now Coarse grain clockgating causes problems with reclocking on some cards and powergating (verde only) causes problems with ring initialization. The proper fix (restructuring the init sequences) is too invasive for 3.11 so just disable them for now. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/si.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 1d656f7b13f2..6ca904673a4f 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -5216,7 +5216,7 @@ static void si_enable_mc_ls(struct radeon_device *rdev, static void si_init_cg(struct radeon_device *rdev) { si_enable_mgcg(rdev, true); - si_enable_cgcg(rdev, true); + si_enable_cgcg(rdev, false); /* disable MC LS on Tahiti */ if (rdev->family == CHIP_TAHITI) si_enable_mc_ls(rdev, false); @@ -5237,11 +5237,11 @@ static void si_fini_cg(struct radeon_device *rdev) static void si_init_pg(struct radeon_device *rdev) { bool has_pg = false; - +#if 0 /* only cape verde supports PG */ if (rdev->family == CHIP_VERDE) has_pg = true; - +#endif if (has_pg) { si_init_ao_cu_mask(rdev); si_init_dma_pg(rdev); From d05f7e700a3a47eeb7dbe236d2680381f5b5edcb Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Sun, 28 Jul 2013 18:26:38 -0400 Subject: [PATCH 615/913] drm/radeon/dpm: disable cac setup on SI Disable cac setup on SI for now since it causes strange performance level restrictions on certain cards. I suspect there may be issues with some of the 64 bit fixed point double emulation that is used to set up those parameters. I need to double check the math before this can be re-enabled. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/si_dpm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 994f9e5b6bee..e8ee6858ce27 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -1929,6 +1929,7 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev) si_pi->cac_override = cac_override_pitcairn; si_pi->powertune_data = &powertune_data_pitcairn; si_pi->dte_data = dte_data_pitcairn; + break; } } else if (rdev->family == CHIP_VERDE) { si_pi->lcac_config = lcac_cape_verde; @@ -2041,7 +2042,8 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev) ni_pi->enable_sq_ramping = false; si_pi->enable_dte = false; - if (si_pi->powertune_data->enable_powertune_by_default) { + /* XXX: fix me */ + if (0/*si_pi->powertune_data->enable_powertune_by_default*/) { ni_pi->enable_power_containment= true; ni_pi->enable_cac = true; if (si_pi->dte_data.enable_dte_by_default) { From 63f22d0e98cf74adf4ecfb25099607239b00c751 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Sat, 27 Jul 2013 17:50:26 -0400 Subject: [PATCH 616/913] drm/radeon/dpm: fix and enable reclocking on SI The SMC interface changed compared to Cayman and previous asics. Set the enabled levels properly and enable reclocking by default when dpm is enabled. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/si_dpm.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index e8ee6858ce27..1604a87cf2fe 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -3238,10 +3238,10 @@ int si_dpm_force_performance_level(struct radeon_device *rdev, { struct radeon_ps *rps = rdev->pm.dpm.current_ps; struct ni_ps *ps = ni_get_ps(rps); - u32 levels; + u32 levels = ps->performance_level_count; if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { - if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) + if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) return -EINVAL; if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 1) != PPSMC_Result_OK) @@ -3250,14 +3250,13 @@ int si_dpm_force_performance_level(struct radeon_device *rdev, if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) return -EINVAL; - levels = ps->performance_level_count - 1; - if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) + if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 1) != PPSMC_Result_OK) return -EINVAL; } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) return -EINVAL; - if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) + if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) return -EINVAL; } @@ -6017,16 +6016,11 @@ int si_dpm_set_power_state(struct radeon_device *rdev) return ret; } -#if 0 - /* XXX */ ret = si_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); if (ret) { DRM_ERROR("si_dpm_force_performance_level failed\n"); return ret; } -#else - rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO; -#endif return 0; } From 2a99859932281ed6c2ecdd988855f8f6838f6743 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Date: Tue, 30 Jul 2013 00:32:00 +0200 Subject: [PATCH 617/913] cpufreq: Fix cpufreq driver module refcount balance after suspend/resume MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since cpufreq_cpu_put() called by __cpufreq_remove_dev() drops the driver module refcount, __cpufreq_remove_dev() causes that refcount to become negative for the cpufreq driver after a suspend/resume cycle. This is not the only bad thing that happens there, however, because kobject_put() should only be called for the policy kobject at this point if the CPU is not the last one for that policy. Namely, if the given CPU is the last one for that policy, the policy kobject's refcount should be 1 at this point, as set by cpufreq_add_dev_interface(), and only needs to be dropped once for the kobject to go away. This actually happens under the cpu == 1 check, so it need not be done before by cpufreq_cpu_put(). On the other hand, if the given CPU is not the last one for that policy, this means that cpufreq_add_policy_cpu() has been called at least once for that policy and cpufreq_cpu_get() has been called for it too. To balance that cpufreq_cpu_get(), we need to call cpufreq_cpu_put() in that case. Thus, to fix the described problem and keep the reference counters balanced in both cases, move the cpufreq_cpu_get() call in __cpufreq_remove_dev() to the code path executed only for CPUs that share the policy with other CPUs. Reported-and-tested-by: Toralf Förster <toralf.foerster@gmx.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Cc: 3.10+ <stable@vger.kernel.org> --- drivers/cpufreq/cpufreq.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index a4ad7339588d..f0a5e2b0eb8a 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1177,14 +1177,11 @@ static int __cpufreq_remove_dev(struct device *dev, __func__, cpu_dev->id, cpu); } - if ((cpus == 1) && (cpufreq_driver->target)) - __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); - - pr_debug("%s: removing link, cpu: %d\n", __func__, cpu); - cpufreq_cpu_put(data); - /* If cpu is last user of policy, free policy */ if (cpus == 1) { + if (cpufreq_driver->target) + __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); + lock_policy_rwsem_read(cpu); kobj = &data->kobj; cmp = &data->kobj_unregister; @@ -1205,9 +1202,13 @@ static int __cpufreq_remove_dev(struct device *dev, free_cpumask_var(data->related_cpus); free_cpumask_var(data->cpus); kfree(data); - } else if (cpufreq_driver->target) { - __cpufreq_governor(data, CPUFREQ_GOV_START); - __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); + } else { + pr_debug("%s: removing link, cpu: %d\n", __func__, cpu); + cpufreq_cpu_put(data); + if (cpufreq_driver->target) { + __cpufreq_governor(data, CPUFREQ_GOV_START); + __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); + } } per_cpu(cpufreq_policy_cpu, cpu) = -1; From 030f19f0e24c020e3577d9a0da878e417efc2b39 Mon Sep 17 00:00:00 2001 From: Egbert Eich <eich@suse.com> Date: Tue, 23 Jul 2013 08:44:34 +0200 Subject: [PATCH 618/913] drm/mgag200: Fix logic in mgag200_bo_pin() (v2) Add missing 'return 0;'. v2: Simplified patch as suggested by Dave Airlie <airlied@redhat.com> Signed-off-by: Egbert Eich <eich@suse.com> Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/mgag200/mgag200_ttm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c index 3acb2b044c7b..13878d5de063 100644 --- a/drivers/gpu/drm/mgag200/mgag200_ttm.c +++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c @@ -353,6 +353,7 @@ int mgag200_bo_pin(struct mgag200_bo *bo, u32 pl_flag, u64 *gpu_addr) bo->pin_count++; if (gpu_addr) *gpu_addr = mgag200_bo_gpu_offset(bo); + return 0; } mgag200_ttm_placement(bo, pl_flag); From 64c29076646aa0fc094c4b3ea118ea5cb912bfc0 Mon Sep 17 00:00:00 2001 From: Egbert Eich <eich@suse.com> Date: Wed, 17 Jul 2013 15:07:22 +0200 Subject: [PATCH 619/913] drm/mgag200: Add an crtc_disable callback to the crtc helper funcs Signed-off-by: Egbert Eich <eich@suse.com> Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/mgag200/mgag200_mode.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 251784aa2225..2fe1f6469eb3 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -1251,6 +1251,24 @@ static void mga_crtc_destroy(struct drm_crtc *crtc) kfree(mga_crtc); } +static void mga_crtc_disable(struct drm_crtc *crtc) +{ + int ret; + DRM_DEBUG_KMS("\n"); + mga_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); + if (crtc->fb) { + struct mga_framebuffer *mga_fb = to_mga_framebuffer(crtc->fb); + struct drm_gem_object *obj = mga_fb->obj; + struct mgag200_bo *bo = gem_to_mga_bo(obj); + ret = mgag200_bo_reserve(bo, false); + if (ret) + return; + mgag200_bo_push_sysram(bo); + mgag200_bo_unreserve(bo); + } + crtc->fb = NULL; +} + /* These provide the minimum set of functions required to handle a CRTC */ static const struct drm_crtc_funcs mga_crtc_funcs = { .cursor_set = mga_crtc_cursor_set, @@ -1261,6 +1279,7 @@ static const struct drm_crtc_funcs mga_crtc_funcs = { }; static const struct drm_crtc_helper_funcs mga_helper_funcs = { + .disable = mga_crtc_disable, .dpms = mga_crtc_dpms, .mode_fixup = mga_crtc_mode_fixup, .mode_set = mga_crtc_mode_set, From 3d5a1c5e300483df005c81c55792268d4a7bff9f Mon Sep 17 00:00:00 2001 From: Egbert Eich <eich@suse.com> Date: Wed, 17 Jul 2013 15:07:25 +0200 Subject: [PATCH 620/913] drm/mgag200: Add sysfs support for connectors Signed-off-by: Egbert Eich <eich@suse.com> Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/mgag200/mgag200_mode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 2fe1f6469eb3..020a62377ff0 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -1600,6 +1600,8 @@ static struct drm_connector *mga_vga_init(struct drm_device *dev) drm_connector_helper_add(connector, &mga_vga_connector_helper_funcs); + drm_sysfs_connector_add(connector); + mga_connector->i2c = mgag200_i2c_create(dev); if (!mga_connector->i2c) DRM_ERROR("failed to add ddc bus\n"); From da55839870263563cc70e700a7f58090a860576d Mon Sep 17 00:00:00 2001 From: Takashi Iwai <tiwai@suse.com> Date: Wed, 17 Jul 2013 15:07:26 +0200 Subject: [PATCH 621/913] drm/mgag200: Fix framebuffer pitch calculation The framebuffer pitch calculation needs to be done differently for bpp == 24 - check xf86-video-mga for reference. Signed-off-by: Egbert Eich <eich@suse.de> Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/mgag200/mgag200_mode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 020a62377ff0..c8983f92bc67 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -877,7 +877,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, pitch = crtc->fb->pitches[0] / (crtc->fb->bits_per_pixel / 8); if (crtc->fb->bits_per_pixel == 24) - pitch = pitch >> (4 - bppshift); + pitch = (pitch * 3) >> (4 - bppshift); else pitch = pitch >> (4 - bppshift); From de7500eafc96274654201bd585fb85e2814ef9b2 Mon Sep 17 00:00:00 2001 From: Egbert Eich <eich@suse.com> Date: Wed, 17 Jul 2013 15:07:27 +0200 Subject: [PATCH 622/913] drm/mgag200: Fix LUT programming for 16bpp Since there are only 32 (64) distinct color values for each color in 16bpp Matrox hardware expects those in a 'dense' manner, ie in the first 32 (64) entries of the respective color. Signed-off-by: Egbert Eich <eich@suse.de> Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/mgag200/mgag200_mode.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index c8983f92bc67..503a414cbdad 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -29,6 +29,7 @@ static void mga_crtc_load_lut(struct drm_crtc *crtc) struct mga_crtc *mga_crtc = to_mga_crtc(crtc); struct drm_device *dev = crtc->dev; struct mga_device *mdev = dev->dev_private; + struct drm_framebuffer *fb = crtc->fb; int i; if (!crtc->enabled) @@ -36,6 +37,28 @@ static void mga_crtc_load_lut(struct drm_crtc *crtc) WREG8(DAC_INDEX + MGA1064_INDEX, 0); + if (fb && fb->bits_per_pixel == 16) { + int inc = (fb->depth == 15) ? 8 : 4; + u8 r, b; + for (i = 0; i < MGAG200_LUT_SIZE; i += inc) { + if (fb->depth == 16) { + if (i > (MGAG200_LUT_SIZE >> 1)) { + r = b = 0; + } else { + r = mga_crtc->lut_r[i << 1]; + b = mga_crtc->lut_b[i << 1]; + } + } else { + r = mga_crtc->lut_r[i]; + b = mga_crtc->lut_b[i]; + } + /* VGA registers */ + WREG8(DAC_INDEX + MGA1064_COL_PAL, r); + WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_g[i]); + WREG8(DAC_INDEX + MGA1064_COL_PAL, b); + } + return; + } for (i = 0; i < MGAG200_LUT_SIZE; i++) { /* VGA registers */ WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_r[i]); From 1a11126bcb7c93c289bf3218fa546fd3b0c0df8b Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Fri, 26 Jul 2013 19:25:32 +0200 Subject: [PATCH 623/913] tracing: Turn event/id->i_private into call->event.type event_id_read() is racy, ftrace_event_call can be already freed by trace_remove_event_call() callers. Change event_create_dir() to pass "data = call->event.type", this is all event_id_read() needs. ftrace_event_id_fops no longer needs tracing_open_generic(). We add the new helper, event_file_data(), to read ->i_private, it will have more users. Note: currently ACCESS_ONCE() and "id != 0" check are not needed, but we are going to change event_remove/rmdir to clear ->i_private. Link: http://lkml.kernel.org/r/20130726172532.GA3605@redhat.com Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_events.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 898f868833f2..c2d13c528c3c 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -409,6 +409,11 @@ static void put_system(struct ftrace_subsystem_dir *dir) mutex_unlock(&event_mutex); } +static void *event_file_data(struct file *filp) +{ + return ACCESS_ONCE(file_inode(filp)->i_private); +} + /* * Open and update trace_array ref count. * Must have the current trace_array passed to it. @@ -946,14 +951,18 @@ static int trace_format_open(struct inode *inode, struct file *file) static ssize_t event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { - struct ftrace_event_call *call = filp->private_data; + int id = (long)event_file_data(filp); char buf[32]; int len; if (*ppos) return 0; - len = sprintf(buf, "%d\n", call->event.type); + if (unlikely(!id)) + return -ENODEV; + + len = sprintf(buf, "%d\n", id); + return simple_read_from_buffer(ubuf, cnt, ppos, buf, len); } @@ -1240,7 +1249,6 @@ static const struct file_operations ftrace_event_format_fops = { }; static const struct file_operations ftrace_event_id_fops = { - .open = tracing_open_generic, .read = event_id_read, .llseek = default_llseek, }; @@ -1488,8 +1496,8 @@ event_create_dir(struct dentry *parent, #ifdef CONFIG_PERF_EVENTS if (call->event.type && call->class->reg) - trace_create_file("id", 0444, file->dir, call, - id); + trace_create_file("id", 0444, file->dir, + (void *)(long)call->event.type, id); #endif /* From bc6f6b08dee5645770efb4b76186ded313f23752 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Fri, 26 Jul 2013 19:25:36 +0200 Subject: [PATCH 624/913] tracing: Change event_enable/disable_read() to verify i_private != NULL tracing_open_generic_file() is racy, ftrace_event_file can be already freed by rmdir or trace_remove_event_call(). Change event_enable_read() and event_disable_read() to read and verify "file = i_private" under event_mutex. This fixes nothing, but now we can change debugfs_remove("enable") callers to nullify ->i_private and fix the the problem. Link: http://lkml.kernel.org/r/20130726172536.GA3612@redhat.com Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_events.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index c2d13c528c3c..3dfa8419d0dc 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -684,15 +684,25 @@ static ssize_t event_enable_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { - struct ftrace_event_file *file = filp->private_data; + struct ftrace_event_file *file; + unsigned long flags; char buf[4] = "0"; - if (file->flags & FTRACE_EVENT_FL_ENABLED && - !(file->flags & FTRACE_EVENT_FL_SOFT_DISABLED)) + mutex_lock(&event_mutex); + file = event_file_data(filp); + if (likely(file)) + flags = file->flags; + mutex_unlock(&event_mutex); + + if (!file) + return -ENODEV; + + if (flags & FTRACE_EVENT_FL_ENABLED && + !(flags & FTRACE_EVENT_FL_SOFT_DISABLED)) strcpy(buf, "1"); - if (file->flags & FTRACE_EVENT_FL_SOFT_DISABLED || - file->flags & FTRACE_EVENT_FL_SOFT_MODE) + if (flags & FTRACE_EVENT_FL_SOFT_DISABLED || + flags & FTRACE_EVENT_FL_SOFT_MODE) strcat(buf, "*"); strcat(buf, "\n"); @@ -704,13 +714,10 @@ static ssize_t event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { - struct ftrace_event_file *file = filp->private_data; + struct ftrace_event_file *file; unsigned long val; int ret; - if (!file) - return -EINVAL; - ret = kstrtoul_from_user(ubuf, cnt, 10, &val); if (ret) return ret; @@ -722,8 +729,11 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, switch (val) { case 0: case 1: + ret = -ENODEV; mutex_lock(&event_mutex); - ret = ftrace_event_enable_disable(file, val); + file = event_file_data(filp); + if (likely(file)) + ret = ftrace_event_enable_disable(file, val); mutex_unlock(&event_mutex); break; From e2912b091c26b8ea95e5e00a43a7ac620f6c94a6 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Fri, 26 Jul 2013 19:25:40 +0200 Subject: [PATCH 625/913] tracing: Change event_filter_read/write to verify i_private != NULL event_filter_read/write() are racy, ftrace_event_call can be already freed by trace_remove_event_call() callers. 1. Shift mutex_lock(event_mutex) from print/apply_event_filter to the callers. 2. Change the callers, event_filter_read() and event_filter_write() to read i_private under this mutex and abort if it is NULL. This fixes nothing, but now we can change debugfs_remove("filter") callers to nullify ->i_private and fix the the problem. Link: http://lkml.kernel.org/r/20130726172540.GA3619@redhat.com Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_events.c | 26 +++++++++++++++++++------- kernel/trace/trace_events_filter.c | 17 ++++++----------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 3dfa8419d0dc..1d7b6d03cd51 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -980,21 +980,28 @@ static ssize_t event_filter_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { - struct ftrace_event_call *call = filp->private_data; + struct ftrace_event_call *call; struct trace_seq *s; - int r; + int r = -ENODEV; if (*ppos) return 0; s = kmalloc(sizeof(*s), GFP_KERNEL); + if (!s) return -ENOMEM; trace_seq_init(s); - print_event_filter(call, s); - r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len); + mutex_lock(&event_mutex); + call = event_file_data(filp); + if (call) + print_event_filter(call, s); + mutex_unlock(&event_mutex); + + if (call) + r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len); kfree(s); @@ -1005,9 +1012,9 @@ static ssize_t event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { - struct ftrace_event_call *call = filp->private_data; + struct ftrace_event_call *call; char *buf; - int err; + int err = -ENODEV; if (cnt >= PAGE_SIZE) return -EINVAL; @@ -1022,7 +1029,12 @@ event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, } buf[cnt] = '\0'; - err = apply_event_filter(call, buf); + mutex_lock(&event_mutex); + call = event_file_data(filp); + if (call) + err = apply_event_filter(call, buf); + mutex_unlock(&event_mutex); + free_page((unsigned long) buf); if (err < 0) return err; diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 0c7b75a8acc8..97daa8cf958d 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -637,17 +637,15 @@ static void append_filter_err(struct filter_parse_state *ps, free_page((unsigned long) buf); } +/* caller must hold event_mutex */ void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s) { - struct event_filter *filter; + struct event_filter *filter = call->filter; - mutex_lock(&event_mutex); - filter = call->filter; if (filter && filter->filter_string) trace_seq_printf(s, "%s\n", filter->filter_string); else trace_seq_puts(s, "none\n"); - mutex_unlock(&event_mutex); } void print_subsystem_event_filter(struct event_subsystem *system, @@ -1841,23 +1839,22 @@ static int create_system_filter(struct event_subsystem *system, return err; } +/* caller must hold event_mutex */ int apply_event_filter(struct ftrace_event_call *call, char *filter_string) { struct event_filter *filter; - int err = 0; - - mutex_lock(&event_mutex); + int err; if (!strcmp(strstrip(filter_string), "0")) { filter_disable(call); filter = call->filter; if (!filter) - goto out_unlock; + return 0; RCU_INIT_POINTER(call->filter, NULL); /* Make sure the filter is not being used */ synchronize_sched(); __free_filter(filter); - goto out_unlock; + return 0; } err = create_filter(call, filter_string, true, &filter); @@ -1884,8 +1881,6 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string) __free_filter(tmp); } } -out_unlock: - mutex_unlock(&event_mutex); return err; } From c5a44a1200c6eda2202434f25325e8ad19533fca Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Fri, 26 Jul 2013 19:25:43 +0200 Subject: [PATCH 626/913] tracing: Change f_start() to take event_mutex and verify i_private != NULL trace_format_open() and trace_format_seq_ops are racy, nothing protects ftrace_event_call from trace_remove_event_call(). Change f_start() to take event_mutex and verify i_private != NULL, change f_stop() to drop this lock. This fixes nothing, but now we can change debugfs_remove("format") callers to nullify ->i_private and fix the the problem. Note: the usage of event_mutex is sub-optimal but simple, we can change this later. Link: http://lkml.kernel.org/r/20130726172543.GA3622@redhat.com Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_events.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 1d7b6d03cd51..50dc8b2e5435 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -840,7 +840,7 @@ enum { static void *f_next(struct seq_file *m, void *v, loff_t *pos) { - struct ftrace_event_call *call = m->private; + struct ftrace_event_call *call = event_file_data(m->private); struct list_head *common_head = &ftrace_common_fields; struct list_head *head = trace_get_fields(call); struct list_head *node = v; @@ -872,7 +872,7 @@ static void *f_next(struct seq_file *m, void *v, loff_t *pos) static int f_show(struct seq_file *m, void *v) { - struct ftrace_event_call *call = m->private; + struct ftrace_event_call *call = event_file_data(m->private); struct ftrace_event_field *field; const char *array_descriptor; @@ -925,6 +925,11 @@ static void *f_start(struct seq_file *m, loff_t *pos) void *p = (void *)FORMAT_HEADER; loff_t l = 0; + /* ->stop() is called even if ->start() fails */ + mutex_lock(&event_mutex); + if (!event_file_data(m->private)) + return ERR_PTR(-ENODEV); + while (l < *pos && p) p = f_next(m, p, &l); @@ -933,6 +938,7 @@ static void *f_start(struct seq_file *m, loff_t *pos) static void f_stop(struct seq_file *m, void *p) { + mutex_unlock(&event_mutex); } static const struct seq_operations trace_format_seq_ops = { @@ -944,7 +950,6 @@ static const struct seq_operations trace_format_seq_ops = { static int trace_format_open(struct inode *inode, struct file *file) { - struct ftrace_event_call *call = inode->i_private; struct seq_file *m; int ret; @@ -953,7 +958,7 @@ static int trace_format_open(struct inode *inode, struct file *file) return ret; m = file->private_data; - m->private = call; + m->private = file; return 0; } From f6a84bdc75b5c11621dec58db73fe102cbaf40cc Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Fri, 26 Jul 2013 19:25:47 +0200 Subject: [PATCH 627/913] tracing: Introduce remove_event_file_dir() Preparation for the next patch. Extract the common code from remove_event_from_tracers() and __trace_remove_event_dirs() into the new helper, remove_event_file_dir(). The patch looks more complicated than it actually is, it also moves remove_subsystem() up to avoid the forward declaration. Link: http://lkml.kernel.org/r/20130726172547.GA3629@redhat.com Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_events.c | 47 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 50dc8b2e5435..05d647ecd01a 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -409,11 +409,31 @@ static void put_system(struct ftrace_subsystem_dir *dir) mutex_unlock(&event_mutex); } +static void remove_subsystem(struct ftrace_subsystem_dir *dir) +{ + if (!dir) + return; + + if (!--dir->nr_events) { + debugfs_remove_recursive(dir->entry); + list_del(&dir->list); + __put_system_dir(dir); + } +} + static void *event_file_data(struct file *filp) { return ACCESS_ONCE(file_inode(filp)->i_private); } +static void remove_event_file_dir(struct ftrace_event_file *file) +{ + list_del(&file->list); + debugfs_remove_recursive(file->dir); + remove_subsystem(file->system); + kmem_cache_free(file_cachep, file); +} + /* * Open and update trace_array ref count. * Must have the current trace_array passed to it. @@ -1549,33 +1569,16 @@ event_create_dir(struct dentry *parent, return 0; } -static void remove_subsystem(struct ftrace_subsystem_dir *dir) -{ - if (!dir) - return; - - if (!--dir->nr_events) { - debugfs_remove_recursive(dir->entry); - list_del(&dir->list); - __put_system_dir(dir); - } -} - static void remove_event_from_tracers(struct ftrace_event_call *call) { struct ftrace_event_file *file; struct trace_array *tr; do_for_each_event_file_safe(tr, file) { - if (file->event_call != call) continue; - list_del(&file->list); - debugfs_remove_recursive(file->dir); - remove_subsystem(file->system); - kmem_cache_free(file_cachep, file); - + remove_event_file_dir(file); /* * The do_for_each_event_file_safe() is * a double loop. After finding the call for this @@ -2305,12 +2308,8 @@ __trace_remove_event_dirs(struct trace_array *tr) { struct ftrace_event_file *file, *next; - list_for_each_entry_safe(file, next, &tr->events, list) { - list_del(&file->list); - debugfs_remove_recursive(file->dir); - remove_subsystem(file->system); - kmem_cache_free(file_cachep, file); - } + list_for_each_entry_safe(file, next, &tr->events, list) + remove_event_file_dir(file); } static void From bf682c3159c4d298d1126a56793ed3f5e80395f7 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Sun, 28 Jul 2013 20:35:27 +0200 Subject: [PATCH 628/913] tracing: Change remove_event_file_dir() to clear "d_subdirs"->i_private Change remove_event_file_dir() to clear ->i_private for every file we are going to remove. We need to check file->dir != NULL because event_create_dir() can fail. debugfs_remove_recursive(NULL) is fine but the patch moves it under the same check anyway for readability. spin_lock(d_lock) and "d_inode != NULL" check are not needed afaics, but I do not understand this code enough. tracing_open_generic_file() and tracing_release_generic_file() can go away, ftrace_enable_fops and ftrace_event_filter_fops() use tracing_open_generic() but only to check tracing_disabled. This fixes all races with event_remove() or instance_delete(). f_op->read/write/whatever can never use the freed file/call, all event/* files were changed to check and use ->i_private under event_mutex. Note: this doesn't not fix other problems, event_remove() can destroy the active ftrace_event_call, we need more changes but those changes are completely orthogonal. Link: http://lkml.kernel.org/r/20130728183527.GB16723@redhat.com Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_events.c | 47 ++++++++++++------------------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 05d647ecd01a..a67c913e2f9f 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -428,41 +428,25 @@ static void *event_file_data(struct file *filp) static void remove_event_file_dir(struct ftrace_event_file *file) { + struct dentry *dir = file->dir; + struct dentry *child; + + if (dir) { + spin_lock(&dir->d_lock); /* probably unneeded */ + list_for_each_entry(child, &dir->d_subdirs, d_u.d_child) { + if (child->d_inode) /* probably unneeded */ + child->d_inode->i_private = NULL; + } + spin_unlock(&dir->d_lock); + + debugfs_remove_recursive(dir); + } + list_del(&file->list); - debugfs_remove_recursive(file->dir); remove_subsystem(file->system); kmem_cache_free(file_cachep, file); } -/* - * Open and update trace_array ref count. - * Must have the current trace_array passed to it. - */ -static int tracing_open_generic_file(struct inode *inode, struct file *filp) -{ - struct ftrace_event_file *file = inode->i_private; - struct trace_array *tr = file->tr; - int ret; - - if (trace_array_get(tr) < 0) - return -ENODEV; - - ret = tracing_open_generic(inode, filp); - if (ret < 0) - trace_array_put(tr); - return ret; -} - -static int tracing_release_generic_file(struct inode *inode, struct file *filp) -{ - struct ftrace_event_file *file = inode->i_private; - struct trace_array *tr = file->tr; - - trace_array_put(tr); - - return 0; -} - /* * __ftrace_set_clr_event(NULL, NULL, NULL, set) will set/unset all events. */ @@ -1281,10 +1265,9 @@ static const struct file_operations ftrace_set_event_fops = { }; static const struct file_operations ftrace_enable_fops = { - .open = tracing_open_generic_file, + .open = tracing_open_generic, .read = event_enable_read, .write = event_enable_write, - .release = tracing_release_generic_file, .llseek = default_llseek, }; From bfcd92a0ae2996a34b1fd020b3e0951946ae6903 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin <imirkin@alum.mit.edu> Date: Fri, 19 Jul 2013 06:27:45 -0400 Subject: [PATCH 629/913] drm/nouveau/core: xtensa firmware size needs to be 0x40000 no matter what The current logic is wrong since we send fw->size >> 8 to the card. Rounding the size up by 0x100 and 0x1000 didn't seem to help, the card still hung, so go back to what the blob does -- 0x40000. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/core/engine/xtensa.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/core/engine/xtensa.c b/drivers/gpu/drm/nouveau/core/engine/xtensa.c index 0639bc59d0a5..5f6ede7c4892 100644 --- a/drivers/gpu/drm/nouveau/core/engine/xtensa.c +++ b/drivers/gpu/drm/nouveau/core/engine/xtensa.c @@ -118,7 +118,13 @@ _nouveau_xtensa_init(struct nouveau_object *object) return ret; } - ret = nouveau_gpuobj_new(object, NULL, fw->size, 0x1000, 0, + if (fw->size > 0x40000) { + nv_warn(xtensa, "firmware %s too large\n", name); + release_firmware(fw); + return -EINVAL; + } + + ret = nouveau_gpuobj_new(object, NULL, 0x40000, 0x1000, 0, &xtensa->gpu_fw); if (ret) { release_firmware(fw); From dedaa8f0e6967edb9127a6643d0259e794196ed2 Mon Sep 17 00:00:00 2001 From: Roy Spliet <r.spliet@student.tudelft.nl> Date: Fri, 19 Jul 2013 23:59:12 +0200 Subject: [PATCH 630/913] drm/nvc0/fb: take lock in nvc0_ram_put() Kernel panic caused by list corruption in ltcg seems to indicate a concurrency issue. Take mutex of pfb like nv50_ram_put() to eliminate concurrency. V2: Separate critical section into separate function, avoid taking the lock twice on NVC0 Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/core/subdev/fb/priv.h | 2 +- .../gpu/drm/nouveau/core/subdev/fb/ramnv50.c | 22 ++++++++++++------- .../gpu/drm/nouveau/core/subdev/fb/ramnvc0.c | 14 +++++++++--- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h b/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h index 6c974dd83e8b..db9d6ddde52c 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h @@ -81,7 +81,7 @@ void nv44_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *); void nv46_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size, u32 pitch, u32 flags, struct nouveau_fb_tile *); -void nv50_ram_put(struct nouveau_fb *, struct nouveau_mem **); +void __nv50_ram_put(struct nouveau_fb *, struct nouveau_mem *); extern int nv50_fb_memtype[0x80]; #endif diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c index af5aa7ee8ad9..903baff77fdd 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c @@ -27,17 +27,10 @@ #include "priv.h" void -nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) +__nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem *mem) { struct nouveau_mm_node *this; - struct nouveau_mem *mem; - mem = *pmem; - *pmem = NULL; - if (unlikely(mem == NULL)) - return; - - mutex_lock(&pfb->base.mutex); while (!list_empty(&mem->regions)) { this = list_first_entry(&mem->regions, typeof(*this), rl_entry); @@ -46,6 +39,19 @@ nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) } nouveau_mm_free(&pfb->tags, &mem->tag); +} + +void +nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) +{ + struct nouveau_mem *mem = *pmem; + + *pmem = NULL; + if (unlikely(mem == NULL)) + return; + + mutex_lock(&pfb->base.mutex); + __nv50_ram_put(pfb, mem); mutex_unlock(&pfb->base.mutex); kfree(mem); diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c index 9c3634acbb9d..cf97c4de4a6b 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c @@ -33,11 +33,19 @@ void nvc0_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) { struct nouveau_ltcg *ltcg = nouveau_ltcg(pfb); + struct nouveau_mem *mem = *pmem; - if ((*pmem)->tag) - ltcg->tags_free(ltcg, &(*pmem)->tag); + *pmem = NULL; + if (unlikely(mem == NULL)) + return; - nv50_ram_put(pfb, pmem); + mutex_lock(&pfb->base.mutex); + if (mem->tag) + ltcg->tags_free(ltcg, &mem->tag); + __nv50_ram_put(pfb, mem); + mutex_unlock(&pfb->base.mutex); + + kfree(mem); } int From 8ff860564076f99aeb4f6d35dcb6ea008624e64e Mon Sep 17 00:00:00 2001 From: Emil Velikov <emil.l.velikov@gmail.com> Date: Thu, 11 Jul 2013 17:28:03 +0100 Subject: [PATCH 631/913] drm/nv50/gpio: post-nv92 cards have 32 interrupt lines Since the original merge of nouveau to upstream kernel, we were assuming that nv90 (and later) cards have 32 lines. Based on mmio traces of the binary driver, as well as PBUS error messages during read/write of the e070/e074 registers, we can conclude that nv92 has only 16 lines whereas nv94 (and later) cards have 32. Reported-and-tested-by: David M. Lloyd <david.lloyd@redhat.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Cc: dri-devel@lists.freedesktop.org Cc: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c index bf489dcf46e2..c4c1d415e7fe 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c @@ -103,7 +103,7 @@ nv50_gpio_intr(struct nouveau_subdev *subdev) int i; intr0 = nv_rd32(priv, 0xe054) & nv_rd32(priv, 0xe050); - if (nv_device(priv)->chipset >= 0x90) + if (nv_device(priv)->chipset > 0x92) intr1 = nv_rd32(priv, 0xe074) & nv_rd32(priv, 0xe070); hi = (intr0 & 0x0000ffff) | (intr1 << 16); @@ -115,7 +115,7 @@ nv50_gpio_intr(struct nouveau_subdev *subdev) } nv_wr32(priv, 0xe054, intr0); - if (nv_device(priv)->chipset >= 0x90) + if (nv_device(priv)->chipset > 0x92) nv_wr32(priv, 0xe074, intr1); } @@ -146,7 +146,7 @@ nv50_gpio_ctor(struct nouveau_object *parent, struct nouveau_object *engine, int ret; ret = nouveau_gpio_create(parent, engine, oclass, - nv_device(parent)->chipset >= 0x90 ? 32 : 16, + nv_device(parent)->chipset > 0x92 ? 32 : 16, &priv); *pobject = nv_object(priv); if (ret) @@ -182,7 +182,7 @@ nv50_gpio_init(struct nouveau_object *object) /* disable, and ack any pending gpio interrupts */ nv_wr32(priv, 0xe050, 0x00000000); nv_wr32(priv, 0xe054, 0xffffffff); - if (nv_device(priv)->chipset >= 0x90) { + if (nv_device(priv)->chipset > 0x92) { nv_wr32(priv, 0xe070, 0x00000000); nv_wr32(priv, 0xe074, 0xffffffff); } @@ -195,7 +195,7 @@ nv50_gpio_fini(struct nouveau_object *object, bool suspend) { struct nv50_gpio_priv *priv = (void *)object; nv_wr32(priv, 0xe050, 0x00000000); - if (nv_device(priv)->chipset >= 0x90) + if (nv_device(priv)->chipset > 0x92) nv_wr32(priv, 0xe070, 0x00000000); return nouveau_gpio_fini(&priv->base, suspend); } From 8a258353ed46fa9886bff42e869067336eeb1db6 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst <maarten.lankhorst@canonical.com> Date: Tue, 23 Jul 2013 15:45:11 +0200 Subject: [PATCH 632/913] drm/nouveau: fix null pointer dereference in poll_changed Fixes vgaswitcheroo on a card without display. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 4c1bc061fae2..8f6d63d7edd3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c @@ -398,7 +398,8 @@ void nouveau_fbcon_output_poll_changed(struct drm_device *dev) { struct nouveau_drm *drm = nouveau_drm(dev); - drm_fb_helper_hotplug_event(&drm->fbcon->helper); + if (drm->fbcon) + drm_fb_helper_hotplug_event(&drm->fbcon->helper); } static int From 921837634de046acd32a7e02157349be4e97885a Mon Sep 17 00:00:00 2001 From: Ilia Mirkin <imirkin@alum.mit.edu> Date: Sat, 27 Jul 2013 00:26:59 -0400 Subject: [PATCH 633/913] drm/nv50/mc: include vp in the fb error reporting mask Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c index 0cb322a5e72c..f25fc5fc7dd1 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c @@ -41,7 +41,7 @@ nv50_mc_intr[] = { { 0x04000000, NVDEV_ENGINE_DISP }, { 0x10000000, NVDEV_SUBDEV_BUS }, { 0x80000000, NVDEV_ENGINE_SW }, - { 0x0000d101, NVDEV_SUBDEV_FB }, + { 0x0002d101, NVDEV_SUBDEV_FB }, {}, }; From 18f35fa6584fb28c674014674de20ed82bb84618 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin <imirkin@alum.mit.edu> Date: Sat, 27 Jul 2013 00:27:01 -0400 Subject: [PATCH 634/913] drm/nv31/mpeg: fix mpeg engine initialization object->engine is null, which leads to a null deref down the line Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c index 49ecbb859b25..9f7c7d53e61e 100644 --- a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c +++ b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c @@ -265,8 +265,8 @@ nv31_mpeg_ctor(struct nouveau_object *parent, struct nouveau_object *engine, int nv31_mpeg_init(struct nouveau_object *object) { - struct nouveau_engine *engine = nv_engine(object->engine); - struct nv31_mpeg_priv *priv = (void *)engine; + struct nouveau_engine *engine = nv_engine(object); + struct nv31_mpeg_priv *priv = (void *)object; struct nouveau_fb *pfb = nouveau_fb(object); int ret, i; From 02d69294a174d7cb6a76080b6d16971ca08728d4 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin <imirkin@alum.mit.edu> Date: Sun, 28 Jul 2013 22:30:57 -0400 Subject: [PATCH 635/913] drm/nva3-/disp: fix hda eld writing, needs to be padded Commits 0a9e2b959 (drm/nvd0/disp: move HDA codec setup to core) and a4feaf4ea (drm/nva3/disp: move hda codec handling to core) moved code around but neglected to fill data up to 0x60 as before. This caused /proc/asound/cardN/eld#3.0 to show eld_valid as 0. With this patch, that file is again populated with the correct data. See https://bugs.freedesktop.org/show_bug.cgi?id=67051 Reported-and-tested-by: Alex <alupu01@gmail.com> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c | 2 ++ drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c index 373dbcc523b2..a19e7d79b847 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c @@ -36,6 +36,8 @@ nva3_hda_eld(struct nv50_disp_priv *priv, int or, u8 *data, u32 size) if (data && data[0]) { for (i = 0; i < size; i++) nv_wr32(priv, 0x61c440 + soff, (i << 8) | data[i]); + for (; i < 0x60; i++) + nv_wr32(priv, 0x61c440 + soff, (i << 8)); nv_mask(priv, 0x61c448 + soff, 0x80000003, 0x80000003); } else if (data) { diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c index dc57e24fc1df..717639386ced 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c @@ -41,6 +41,8 @@ nvd0_hda_eld(struct nv50_disp_priv *priv, int or, u8 *data, u32 size) if (data && data[0]) { for (i = 0; i < size; i++) nv_wr32(priv, 0x10ec00 + soff, (i << 8) | data[i]); + for (; i < 0x60; i++) + nv_wr32(priv, 0x10ec00 + soff, (i << 8)); nv_mask(priv, 0x10ec10 + soff, 0x80000003, 0x80000003); } else if (data) { From 9a7046d55f319b2dde5d2536cc2adb01ebdbe09e Mon Sep 17 00:00:00 2001 From: Emil Velikov <emil.l.velikov@gmail.com> Date: Sun, 28 Jul 2013 21:00:23 +0100 Subject: [PATCH 636/913] drm/nv50-/disp: remove dcb_outp_match call, and related variables Unused and irrelavant since the code move of DP training/linkcontrol interrupt Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c index ab1e918469a8..526b75242899 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c @@ -47,14 +47,8 @@ int nv50_sor_mthd(struct nouveau_object *object, u32 mthd, void *args, u32 size) { struct nv50_disp_priv *priv = (void *)object->engine; - struct nouveau_bios *bios = nouveau_bios(priv); - const u16 type = (mthd & NV50_DISP_SOR_MTHD_TYPE) >> 12; const u8 head = (mthd & NV50_DISP_SOR_MTHD_HEAD) >> 3; - const u8 link = (mthd & NV50_DISP_SOR_MTHD_LINK) >> 2; const u8 or = (mthd & NV50_DISP_SOR_MTHD_OR); - const u16 mask = (0x0100 << head) | (0x0040 << link) | (0x0001 << or); - struct dcb_output outp; - u8 ver, hdr; u32 data; int ret = -EINVAL; @@ -62,8 +56,6 @@ nv50_sor_mthd(struct nouveau_object *object, u32 mthd, void *args, u32 size) return -EINVAL; data = *(u32 *)args; - if (type && !dcb_outp_match(bios, type, mask, &ver, &hdr, &outp)) - return -ENODEV; switch (mthd & ~0x3f) { case NV50_DISP_SOR_PWR: From 35095f7529bb6abdfc956e7a41ca6957520b70a7 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst <maarten.lankhorst@canonical.com> Date: Sat, 27 Jul 2013 10:17:12 +0200 Subject: [PATCH 637/913] drm/nouveau: fix size check for cards without vm Op 24-07-13 17:55, Dan Carpenter schreef: > Hello Maarten Lankhorst, > > This is a semi-automatic email about new static checker warnings. > > The patch 0108bc808107: "drm/nouveau: do not allow negative sizes for > now" from Jul 7, 2013, leads to the following Smatch complaint: > > drivers/gpu/drm/nouveau/nouveau_bo.c:222 nouveau_bo_new() > warn: variable dereferenced before check 'drm->client.base.vm' (see line 201) > > drivers/gpu/drm/nouveau/nouveau_bo.c > 200 int type = ttm_bo_type_device; > 201 int max_size = INT_MAX & ~((1 << drm->client.base.vm->vmm->lpg_shift) - 1); > ^^^^^^^^^^^^^^^^^^^ > New dereference. > > 202 > 203 if (size <= 0 || size > max_size) { > 204 nv_warn(drm, "skipped size %x\n", (u32)size); > 205 return -EINVAL; > 206 } > 207 > 208 if (sg) > 209 type = ttm_bo_type_sg; > 210 > 211 nvbo = kzalloc(sizeof(struct nouveau_bo), GFP_KERNEL); > 212 if (!nvbo) > 213 return -ENOMEM; > 214 INIT_LIST_HEAD(&nvbo->head); > 215 INIT_LIST_HEAD(&nvbo->entry); > 216 INIT_LIST_HEAD(&nvbo->vma_list); > 217 nvbo->tile_mode = tile_mode; > 218 nvbo->tile_flags = tile_flags; > 219 nvbo->bo.bdev = &drm->ttm.bdev; > 220 > 221 nvbo->page_shift = 12; > 222 if (drm->client.base.vm) { > ^^^^^^^^^^^^^^^^^^^ > Old check. > > 223 if (!(flags & TTM_PL_FLAG_TT) && size > 256 * 1024) > 224 nvbo->page_shift = drm->client.base.vm->vmm->lpg_shift; > > regards, > dan carpenter 8<----- Commit 0108bc808107: "drm/nouveau: do not allow negative sizes for now" broke older nvidia gpu's that lack a vm. Add an explicit check to handle this. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reported-by: konrad wilk <konrad.wilk@oracle.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/nouveau_bo.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 4e7ee5f4155c..af20fba3a1a4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -198,7 +198,12 @@ nouveau_bo_new(struct drm_device *dev, int size, int align, size_t acc_size; int ret; int type = ttm_bo_type_device; - int max_size = INT_MAX & ~((1 << drm->client.base.vm->vmm->lpg_shift) - 1); + int lpg_shift = 12; + int max_size; + + if (drm->client.base.vm) + lpg_shift = drm->client.base.vm->vmm->lpg_shift; + max_size = INT_MAX & ~((1 << lpg_shift) - 1); if (size <= 0 || size > max_size) { nv_warn(drm, "skipped size %x\n", (u32)size); From 3d8b2b489e490ae63b7eddb3dcdfcee9bc32d473 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin <imirkin@alum.mit.edu> Date: Mon, 29 Jul 2013 19:05:17 -0400 Subject: [PATCH 638/913] drm/nv40/mpeg: write magic value to channel object to make it work Looks like the rewrite in commit ebb945a94b ("drm/nouveau: port all engines to new engine module format") missed that one little detail. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c index f7c581ad1991..dd6196072e9c 100644 --- a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c +++ b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c @@ -61,6 +61,7 @@ nv40_mpeg_context_ctor(struct nouveau_object *parent, if (ret) return ret; + nv_wo32(&chan->base.base, 0x78, 0x02001ec1); return 0; } From dc409df9447a4e3884d150e2b0dbd89242403fa6 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin <imirkin@alum.mit.edu> Date: Mon, 29 Jul 2013 19:05:18 -0400 Subject: [PATCH 639/913] drm/nv31/mpeg: don't recognize nv3x cards as having nv44 graph class Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c index 9f7c7d53e61e..c19004301309 100644 --- a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c +++ b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c @@ -284,7 +284,10 @@ nv31_mpeg_init(struct nouveau_object *object) /* PMPEG init */ nv_wr32(priv, 0x00b32c, 0x00000000); nv_wr32(priv, 0x00b314, 0x00000100); - nv_wr32(priv, 0x00b220, nv44_graph_class(priv) ? 0x00000044 : 0x00000031); + if (nv_device(priv)->chipset >= 0x40 && nv44_graph_class(priv)) + nv_wr32(priv, 0x00b220, 0x00000044); + else + nv_wr32(priv, 0x00b220, 0x00000031); nv_wr32(priv, 0x00b300, 0x02001ec1); nv_mask(priv, 0x00b32c, 0x00000001, 0x00000001); From 1c80c43290ee576afe8d39ecc905fa3958a5858c Mon Sep 17 00:00:00 2001 From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org> Date: Thu, 25 Jul 2013 20:22:00 -0400 Subject: [PATCH 640/913] ftrace: Consolidate some duplicate code for updating ftrace ops When ftrace ops modifies the functions that it will trace, the update to the function mcount callers may need to be modified. Consolidate the two places that do the checks to see if an update is required with a wrapper function for those checks. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/ftrace.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 8ce9eefc5bb4..92d3334de0c3 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -3384,6 +3384,12 @@ ftrace_match_addr(struct ftrace_hash *hash, unsigned long ip, int remove) return add_hash_entry(hash, ip); } +static void ftrace_ops_update_code(struct ftrace_ops *ops) +{ + if (ops->flags & FTRACE_OPS_FL_ENABLED && ftrace_enabled) + ftrace_run_update_code(FTRACE_UPDATE_CALLS); +} + static int ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, unsigned long ip, int remove, int reset, int enable) @@ -3426,9 +3432,8 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, mutex_lock(&ftrace_lock); ret = ftrace_hash_move(ops, enable, orig_hash, hash); - if (!ret && ops->flags & FTRACE_OPS_FL_ENABLED - && ftrace_enabled) - ftrace_run_update_code(FTRACE_UPDATE_CALLS); + if (!ret) + ftrace_ops_update_code(ops); mutex_unlock(&ftrace_lock); @@ -3655,9 +3660,8 @@ int ftrace_regex_release(struct inode *inode, struct file *file) mutex_lock(&ftrace_lock); ret = ftrace_hash_move(iter->ops, filter_hash, orig_hash, iter->hash); - if (!ret && (iter->ops->flags & FTRACE_OPS_FL_ENABLED) - && ftrace_enabled) - ftrace_run_update_code(FTRACE_UPDATE_CALLS); + if (!ret) + ftrace_ops_update_code(iter->ops); mutex_unlock(&ftrace_lock); } From 3709d323085853dc537711154004ba8704cefb9c Mon Sep 17 00:00:00 2001 From: Nishanth Menon <nm@ti.com> Date: Mon, 29 Jul 2013 12:03:01 -0500 Subject: [PATCH 641/913] ARM: dts: omap5-uevm: document regulator signals used on the actual board MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit e00c27ef3b4c23e39d0a77b7c8e5be44c28001c7 (ARM: dts: OMAP5: Add Palmas MFD node and regulator nodes) introduced regulator entries for OMAP5uEVM. However, currently we use the Palmas regulator names which is used for different purposes on uEVM. Document the same based on 750-2628-XXX boards - which is meant to be supported by this dts. Reported-by: Marc Jüttner <m-juettner@ti.com> Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: J Keerthy <j-keerthy@ti.com> Acked-by: Benoit Cousson <benoit.cousson@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com> --- arch/arm/boot/dts/omap5-uevm.dts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts index 08b72678abff..b430b8f884b8 100644 --- a/arch/arm/boot/dts/omap5-uevm.dts +++ b/arch/arm/boot/dts/omap5-uevm.dts @@ -282,6 +282,7 @@ regulators { smps123_reg: smps123 { + /* VDD_OPP_MPU */ regulator-name = "smps123"; regulator-min-microvolt = < 600000>; regulator-max-microvolt = <1500000>; @@ -290,6 +291,7 @@ }; smps45_reg: smps45 { + /* VDD_OPP_MM */ regulator-name = "smps45"; regulator-min-microvolt = < 600000>; regulator-max-microvolt = <1310000>; @@ -298,6 +300,7 @@ }; smps6_reg: smps6 { + /* VDD_DDR3 - over VDD_SMPS6 */ regulator-name = "smps6"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; @@ -306,6 +309,7 @@ }; smps7_reg: smps7 { + /* VDDS_1v8_OMAP over VDDS_1v8_MAIN */ regulator-name = "smps7"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; @@ -314,6 +318,7 @@ }; smps8_reg: smps8 { + /* VDD_OPP_CORE */ regulator-name = "smps8"; regulator-min-microvolt = < 600000>; regulator-max-microvolt = <1310000>; @@ -322,6 +327,7 @@ }; smps9_reg: smps9 { + /* VDDA_2v1_AUD over VDD_2v1 */ regulator-name = "smps9"; regulator-min-microvolt = <2100000>; regulator-max-microvolt = <2100000>; @@ -331,6 +337,7 @@ }; smps10_reg: smps10 { + /* VBUS_5V_OTG */ regulator-name = "smps10"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; @@ -339,6 +346,7 @@ }; ldo1_reg: ldo1 { + /* VDDAPHY_CAM: vdda_csiport */ regulator-name = "ldo1"; regulator-min-microvolt = <2800000>; regulator-max-microvolt = <2800000>; @@ -347,6 +355,7 @@ }; ldo2_reg: ldo2 { + /* VCC_2V8_DISP: Does not go anywhere */ regulator-name = "ldo2"; regulator-min-microvolt = <2900000>; regulator-max-microvolt = <2900000>; @@ -355,6 +364,7 @@ }; ldo3_reg: ldo3 { + /* VDDAPHY_MDM: vdda_lli */ regulator-name = "ldo3"; regulator-min-microvolt = <3000000>; regulator-max-microvolt = <3000000>; @@ -363,6 +373,7 @@ }; ldo4_reg: ldo4 { + /* VDDAPHY_DISP: vdda_dsiport/hdmi */ regulator-name = "ldo4"; regulator-min-microvolt = <2200000>; regulator-max-microvolt = <2200000>; @@ -371,6 +382,7 @@ }; ldo5_reg: ldo5 { + /* VDDA_1V8_PHY: usb/sata/hdmi.. */ regulator-name = "ldo5"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; @@ -379,6 +391,7 @@ }; ldo6_reg: ldo6 { + /* VDDS_1V2_WKUP: hsic/ldo_emu_wkup */ regulator-name = "ldo6"; regulator-min-microvolt = <1500000>; regulator-max-microvolt = <1500000>; @@ -387,6 +400,7 @@ }; ldo7_reg: ldo7 { + /* VDD_VPP: vpp1 */ regulator-name = "ldo7"; regulator-min-microvolt = <1500000>; regulator-max-microvolt = <1500000>; @@ -395,6 +409,7 @@ }; ldo8_reg: ldo8 { + /* VDD_3v0: Does not go anywhere */ regulator-name = "ldo8"; regulator-min-microvolt = <1500000>; regulator-max-microvolt = <1500000>; @@ -403,6 +418,7 @@ }; ldo9_reg: ldo9 { + /* VCC_DV_SDIO: vdds_sdcard */ regulator-name = "ldo9"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <3300000>; @@ -411,6 +427,7 @@ }; ldoln_reg: ldoln { + /* VDDA_1v8_REF: vdds_osc/mm_l4per.. */ regulator-name = "ldoln"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; @@ -419,6 +436,7 @@ }; ldousb_reg: ldousb { + /* VDDA_3V_USB: VDDA_USBHS33 */ regulator-name = "ldousb"; regulator-min-microvolt = <3250000>; regulator-max-microvolt = <3250000>; From e0bacd2f7e0abf7fd26ab7d12e1cfb96a5350fad Mon Sep 17 00:00:00 2001 From: Ben Skeggs <bskeggs@redhat.com> Date: Tue, 30 Jul 2013 11:47:47 +1000 Subject: [PATCH 642/913] drm/nouveau/vm: make vm refcount into a kref Never used to be required, but a recent change made it necessary. Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- .../gpu/drm/nouveau/core/include/subdev/vm.h | 2 +- drivers/gpu/drm/nouveau/core/subdev/vm/base.c | 29 +++++++------------ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/vm.h b/drivers/gpu/drm/nouveau/core/include/subdev/vm.h index f2e87b105666..fcf57fa309bf 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/vm.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/vm.h @@ -55,7 +55,7 @@ struct nouveau_vma { struct nouveau_vm { struct nouveau_vmmgr *vmm; struct nouveau_mm mm; - int refcount; + struct kref refcount; struct list_head pgd_list; atomic_t engref[NVDEV_SUBDEV_NR]; diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c index 67fcb6c852ac..ef3133e7575c 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c @@ -361,7 +361,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length, INIT_LIST_HEAD(&vm->pgd_list); vm->vmm = vmm; - vm->refcount = 1; + kref_init(&vm->refcount); vm->fpde = offset >> (vmm->pgt_bits + 12); vm->lpde = (offset + length - 1) >> (vmm->pgt_bits + 12); @@ -441,8 +441,9 @@ nouveau_vm_unlink(struct nouveau_vm *vm, struct nouveau_gpuobj *mpgd) } static void -nouveau_vm_del(struct nouveau_vm *vm) +nouveau_vm_del(struct kref *kref) { + struct nouveau_vm *vm = container_of(kref, typeof(*vm), refcount); struct nouveau_vm_pgd *vpgd, *tmp; list_for_each_entry_safe(vpgd, tmp, &vm->pgd_list, head) { @@ -458,27 +459,19 @@ int nouveau_vm_ref(struct nouveau_vm *ref, struct nouveau_vm **ptr, struct nouveau_gpuobj *pgd) { - struct nouveau_vm *vm; - int ret; - - vm = ref; - if (vm) { - ret = nouveau_vm_link(vm, pgd); + if (ref) { + int ret = nouveau_vm_link(ref, pgd); if (ret) return ret; - vm->refcount++; + kref_get(&ref->refcount); + } + + if (*ptr) { + nouveau_vm_unlink(*ptr, pgd); + kref_put(&(*ptr)->refcount, nouveau_vm_del); } - vm = *ptr; *ptr = ref; - - if (vm) { - nouveau_vm_unlink(vm, pgd); - - if (--vm->refcount == 0) - nouveau_vm_del(vm); - } - return 0; } From e18235a62a7ea737d0a3f73c76eacaaec6df3dfe Mon Sep 17 00:00:00 2001 From: Nishanth Menon <nm@ti.com> Date: Mon, 29 Jul 2013 12:03:02 -0500 Subject: [PATCH 643/913] ARM: dts: omap5-uevm: fix regulator configurations mandatory for SoC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit e00c27ef3b4c23e39d0a77b7c8e5be44c28001c7 (ARM: dts: OMAP5: Add Palmas MFD node and regulator nodes) introduced regulator entries for OMAP5uEVM. However, The regulator information is based on an older temporary pre-production board variant and does not reflect production board 750-2628-XXX boards. The following fixes are hence mandatory to ensure right voltage is supplied to key OMAP5 SoC voltage rails: - LDO1 supplies VDDAPHY_CAM which is OMAP5's vdda_csiporta/b/c. This can only be supplied at 1.5V or 1.8V and we currently supply 2.8V. To prevent any potential device damage risk, use the specified 1.5V-1.8V supply. Remove 'always-on' and 'boot-on' settings here as it is a 'on need' supply to SoC IP and is not enabled by PMIC by default at boot. - LDO3 supplies Low Latency Interface(LLI) hardware module which is a special hardware to communicate with Modem. However since uEVM is not setup by default for this communication, this should be disabled by default. Further, vdda_lli is supposed to be 1.5V and not 3V. - LDO4 supplies VDDAPHY_DISP which is vdda_dsiporta/c/vdda_hdmi This can only be supplied at 1.5V or 1.8V and we currently supply 2.2V. To prevent any potential device damage risk, use the specified 1.5V-1.8V supply. Remove 'always-on' and 'boot-on' settings here as it is a 'on need' supply to SoC IP and is not enabled by PMIC by default at boot. - LDO6 supplies the board specified VDDS_1V2_WKUP supply going to ldo_emu_wkup/vdds_hsic. To stay within the SoC specification supply 1.2V instead of 1.5V. - LDO7 supplies VDD_VPP which is vpp1. This is currently configured for 1.5V which as per data manual "A pulse width of 1000 ns and an amplitude of 2V is required to program each eFuse bit. Otherwise, VPP1 must not be supplied". So, fix the voltage to 2V. and disable the supply since we have no plans of programming efuse bits - it can only be done once - in factory. Further it is not enabled by default by PMIC so, 'boot-on' must be removed, and the 'always-on' needs to be removed to achieve pulsing if efuse needs to be programmed. - LDO9 supplies the board specified vdds_sdcard supply going within SoC specification of 1.8V or 3.0V. Further the supply is controlled by switch enabled by REGEN3. So, introduce REGEN3 and map sdcard slot to be powered by LDO9. Remove 'always-on' allowing the LDO to be disabled on need basis. Reported-by: Marc Jüttner <m-juettner@ti.com> Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: J Keerthy <j-keerthy@ti.com> Acked-by: Benoit Cousson <benoit.cousson@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com> --- arch/arm/boot/dts/omap5-uevm.dts | 43 +++++++++++++++++--------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts index b430b8f884b8..247c03c0d734 100644 --- a/arch/arm/boot/dts/omap5-uevm.dts +++ b/arch/arm/boot/dts/omap5-uevm.dts @@ -235,7 +235,7 @@ }; &mmc1 { - vmmc-supply = <&vmmcsd_fixed>; + vmmc-supply = <&ldo9_reg>; bus-width = <4>; }; @@ -348,10 +348,8 @@ ldo1_reg: ldo1 { /* VDDAPHY_CAM: vdda_csiport */ regulator-name = "ldo1"; - regulator-min-microvolt = <2800000>; - regulator-max-microvolt = <2800000>; - regulator-always-on; - regulator-boot-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1800000>; }; ldo2_reg: ldo2 { @@ -366,19 +364,18 @@ ldo3_reg: ldo3 { /* VDDAPHY_MDM: vdda_lli */ regulator-name = "ldo3"; - regulator-min-microvolt = <3000000>; - regulator-max-microvolt = <3000000>; - regulator-always-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; regulator-boot-on; + /* Only if Modem is used */ + status = "disabled"; }; ldo4_reg: ldo4 { /* VDDAPHY_DISP: vdda_dsiport/hdmi */ regulator-name = "ldo4"; - regulator-min-microvolt = <2200000>; - regulator-max-microvolt = <2200000>; - regulator-always-on; - regulator-boot-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1800000>; }; ldo5_reg: ldo5 { @@ -393,8 +390,8 @@ ldo6_reg: ldo6 { /* VDDS_1V2_WKUP: hsic/ldo_emu_wkup */ regulator-name = "ldo6"; - regulator-min-microvolt = <1500000>; - regulator-max-microvolt = <1500000>; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; regulator-always-on; regulator-boot-on; }; @@ -402,10 +399,10 @@ ldo7_reg: ldo7 { /* VDD_VPP: vpp1 */ regulator-name = "ldo7"; - regulator-min-microvolt = <1500000>; - regulator-max-microvolt = <1500000>; - regulator-always-on; - regulator-boot-on; + regulator-min-microvolt = <2000000>; + regulator-max-microvolt = <2000000>; + /* Only for efuse reprograming! */ + status = "disabled"; }; ldo8_reg: ldo8 { @@ -421,8 +418,7 @@ /* VCC_DV_SDIO: vdds_sdcard */ regulator-name = "ldo9"; regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; + regulator-max-microvolt = <3000000>; regulator-boot-on; }; @@ -443,6 +439,13 @@ regulator-always-on; regulator-boot-on; }; + + regen3_reg: regen3 { + /* REGEN3 controls LDO9 supply to card */ + regulator-name = "regen3"; + regulator-always-on; + regulator-boot-on; + }; }; }; }; From bd3c5544a1e98a25d2d24c98779092e0f84373f7 Mon Sep 17 00:00:00 2001 From: Nishanth Menon <nm@ti.com> Date: Mon, 29 Jul 2013 12:03:03 -0500 Subject: [PATCH 644/913] ARM: dts: omap5-uevm: update optional/unused regulator configurations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit e00c27ef3b4c23e39d0a77b7c8e5be44c28001c7 (ARM: dts: OMAP5: Add Palmas MFD node and regulator nodes) introduced regulator entries for OMAP5uEVM. However, The regulator information is based on an older temporary pre-production board variant and does not reflect production board 750-2628-XXX boards. The following optional/unused regulators can be updated: - SMPS9 supplies TWL6040 over VDDA_2v1_AUD. This regulator needs to be enabled only when audio is active. Since it does not come active by default, it does not require "always-on" or "boot-on". - LDO2 and LDO8 do not go to any peripheral or connector on the board. Further, these unused regulators should have been 2.8V for LDO2 and 3.0V for LDO8. Mark these LDOs as disabled in the dts until needed. Reported-by: Marc Jüttner <m-juettner@ti.com> Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: J Keerthy <j-keerthy@ti.com> Acked-by: Benoit Cousson <benoit.cousson@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com> --- arch/arm/boot/dts/omap5-uevm.dts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts index 247c03c0d734..65d7b601651c 100644 --- a/arch/arm/boot/dts/omap5-uevm.dts +++ b/arch/arm/boot/dts/omap5-uevm.dts @@ -331,8 +331,6 @@ regulator-name = "smps9"; regulator-min-microvolt = <2100000>; regulator-max-microvolt = <2100000>; - regulator-always-on; - regulator-boot-on; ti,smps-range = <0x80>; }; @@ -355,10 +353,10 @@ ldo2_reg: ldo2 { /* VCC_2V8_DISP: Does not go anywhere */ regulator-name = "ldo2"; - regulator-min-microvolt = <2900000>; - regulator-max-microvolt = <2900000>; - regulator-always-on; - regulator-boot-on; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + /* Unused */ + status = "disabled"; }; ldo3_reg: ldo3 { @@ -408,10 +406,11 @@ ldo8_reg: ldo8 { /* VDD_3v0: Does not go anywhere */ regulator-name = "ldo8"; - regulator-min-microvolt = <1500000>; - regulator-max-microvolt = <1500000>; - regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; regulator-boot-on; + /* Unused */ + status = "disabled"; }; ldo9_reg: ldo9 { From 7a7da592cbb22a1d360638dbecc393470c5effe3 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst <maarten.lankhorst@canonical.com> Date: Tue, 23 Jul 2013 15:49:39 +0200 Subject: [PATCH 645/913] drm/nouveau: fix semaphore dmabuf obj Fixes some dmabuf object errors on nv50 chipset and below. Cc: stable@vger.kernel.org [3.7+] Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> --- drivers/gpu/drm/nouveau/nv17_fence.c | 2 +- drivers/gpu/drm/nouveau/nv50_fence.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nv17_fence.c b/drivers/gpu/drm/nouveau/nv17_fence.c index 8e47a9bae8c3..22aa9963ea6f 100644 --- a/drivers/gpu/drm/nouveau/nv17_fence.c +++ b/drivers/gpu/drm/nouveau/nv17_fence.c @@ -76,7 +76,7 @@ nv17_fence_context_new(struct nouveau_channel *chan) struct ttm_mem_reg *mem = &priv->bo->bo.mem; struct nouveau_object *object; u32 start = mem->start * PAGE_SIZE; - u32 limit = mem->start + mem->size - 1; + u32 limit = start + mem->size - 1; int ret = 0; fctx = chan->fence = kzalloc(sizeof(*fctx), GFP_KERNEL); diff --git a/drivers/gpu/drm/nouveau/nv50_fence.c b/drivers/gpu/drm/nouveau/nv50_fence.c index f9701e567db8..0ee363840035 100644 --- a/drivers/gpu/drm/nouveau/nv50_fence.c +++ b/drivers/gpu/drm/nouveau/nv50_fence.c @@ -39,6 +39,8 @@ nv50_fence_context_new(struct nouveau_channel *chan) struct nv10_fence_chan *fctx; struct ttm_mem_reg *mem = &priv->bo->bo.mem; struct nouveau_object *object; + u32 start = mem->start * PAGE_SIZE; + u32 limit = start + mem->size - 1; int ret, i; fctx = chan->fence = kzalloc(sizeof(*fctx), GFP_KERNEL); @@ -51,26 +53,28 @@ nv50_fence_context_new(struct nouveau_channel *chan) fctx->base.sync = nv17_fence_sync; ret = nouveau_object_new(nv_object(chan->cli), chan->handle, - NvSema, 0x0002, + NvSema, 0x003d, &(struct nv_dma_class) { .flags = NV_DMA_TARGET_VRAM | NV_DMA_ACCESS_RDWR, - .start = mem->start * PAGE_SIZE, - .limit = mem->size - 1, + .start = start, + .limit = limit, }, sizeof(struct nv_dma_class), &object); /* dma objects for display sync channel semaphore blocks */ for (i = 0; !ret && i < dev->mode_config.num_crtc; i++) { struct nouveau_bo *bo = nv50_display_crtc_sema(dev, i); + u32 start = bo->bo.mem.start * PAGE_SIZE; + u32 limit = start + bo->bo.mem.size - 1; ret = nouveau_object_new(nv_object(chan->cli), chan->handle, NvEvoSema0 + i, 0x003d, &(struct nv_dma_class) { .flags = NV_DMA_TARGET_VRAM | NV_DMA_ACCESS_RDWR, - .start = bo->bo.offset, - .limit = bo->bo.offset + 0xfff, + .start = start, + .limit = limit, }, sizeof(struct nv_dma_class), &object); } From a0db856a95a29efb1c23db55c02d9f0ff4f0db48 Mon Sep 17 00:00:00 2001 From: "David S. Miller" <davem@davemloft.net> Date: Tue, 30 Jul 2013 00:16:21 -0700 Subject: [PATCH 646/913] net_sched: Fix stack info leak in cbq_dump_wrr(). Make sure the reserved fields, and padding (if any), are fully initialized. Based upon a patch by Dan Carpenter and feedback from Joe Perches. Signed-off-by: David S. Miller <davem@davemloft.net> --- net/sched/sch_cbq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 71a568862557..7a42c81a19eb 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c @@ -1465,6 +1465,7 @@ static int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl) unsigned char *b = skb_tail_pointer(skb); struct tc_cbq_wrropt opt; + memset(&opt, 0, sizeof(opt)); opt.flags = 0; opt.allot = cl->allot; opt.priority = cl->priority + 1; From 7dedd346941d317b6b313de4746ad0354006e68b Mon Sep 17 00:00:00 2001 From: Rajendra Nayak <rnayak@ti.com> Date: Sun, 28 Jul 2013 23:01:48 -0600 Subject: [PATCH 647/913] ARM: OMAP2+: hwmod: Fix a crash in _setup_reset() with DEBUG_LL With commit '82702ea11ddfe0e43382e1fa5b66d807d8114916' "ARM: OMAP2+: Fix serial init for device tree based booting" stubbing out omap_serial_early_init() for Device tree based booting, there was a crash observed on AM335x based devices when hwmod does a _setup_reset() early at boot. This was rootcaused to hwmod trying to reset console uart while earlycon was using it. The way to tell hwmod not to do this is to specify the HWMOD_INIT_NO_RESET flag, which were infact set by the omap_serial_early_init() function by parsing the cmdline to identify the console device. Parsing the cmdline to identify the uart used by earlycon itself seems broken as there is nothing preventing earlycon to use a different one. This patch, instead, attempts to populate the requiste flags for hwmod based on the CONFIG_DEBUG_OMAPxUARTy FLAGS. This gets rid of the need for cmdline parsing in the DT as well as non-DT cases to identify the uart used by earlycon. Signed-off-by: Rajendra Nayak <rnayak@ti.com> Reported-by: Mark Jackson <mpfj-list@newflow.co.uk> Reported-by: Vaibhav Bedia <vaibhav.bedia@ti.com> Tested-by: Mark Jackson <mpfj-list@newflow.co.uk> Signed-off-by: Paul Walmsley <paul@pwsan.com> --- arch/arm/mach-omap2/omap_hwmod.h | 48 +++++++++++++++++++ .../mach-omap2/omap_hwmod_2xxx_ipblock_data.c | 6 +-- arch/arm/mach-omap2/omap_hwmod_33xx_data.c | 2 +- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 9 ++-- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 5 +- arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 3 +- arch/arm/mach-omap2/serial.c | 11 ----- 7 files changed, 61 insertions(+), 23 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h index aab33fd814c0..8440a21fc60a 100644 --- a/arch/arm/mach-omap2/omap_hwmod.h +++ b/arch/arm/mach-omap2/omap_hwmod.h @@ -95,6 +95,54 @@ extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type3; #define MODULEMODE_HWCTRL 1 #define MODULEMODE_SWCTRL 2 +#define DEBUG_OMAP2UART1_FLAGS 0 +#define DEBUG_OMAP2UART2_FLAGS 0 +#define DEBUG_OMAP2UART3_FLAGS 0 +#define DEBUG_OMAP3UART3_FLAGS 0 +#define DEBUG_OMAP3UART4_FLAGS 0 +#define DEBUG_OMAP4UART3_FLAGS 0 +#define DEBUG_OMAP4UART4_FLAGS 0 +#define DEBUG_TI81XXUART1_FLAGS 0 +#define DEBUG_TI81XXUART2_FLAGS 0 +#define DEBUG_TI81XXUART3_FLAGS 0 +#define DEBUG_AM33XXUART1_FLAGS 0 + +#define DEBUG_OMAPUART_FLAGS (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET) + +#if defined(CONFIG_DEBUG_OMAP2UART1) +#undef DEBUG_OMAP2UART1_FLAGS +#define DEBUG_OMAP2UART1_FLAGS DEBUG_OMAPUART_FLAGS +#elif defined(CONFIG_DEBUG_OMAP2UART2) +#undef DEBUG_OMAP2UART2_FLAGS +#define DEBUG_OMAP2UART2_FLAGS DEBUG_OMAPUART_FLAGS +#elif defined(CONFIG_DEBUG_OMAP2UART3) +#undef DEBUG_OMAP2UART3_FLAGS +#define DEBUG_OMAP2UART3_FLAGS DEBUG_OMAPUART_FLAGS +#elif defined(CONFIG_DEBUG_OMAP3UART3) +#undef DEBUG_OMAP3UART3_FLAGS +#define DEBUG_OMAP3UART3_FLAGS DEBUG_OMAPUART_FLAGS +#elif defined(CONFIG_DEBUG_OMAP3UART4) +#undef DEBUG_OMAP3UART4_FLAGS +#define DEBUG_OMAP3UART4_FLAGS DEBUG_OMAPUART_FLAGS +#elif defined(CONFIG_DEBUG_OMAP4UART3) +#undef DEBUG_OMAP4UART3_FLAGS +#define DEBUG_OMAP4UART3_FLAGS DEBUG_OMAPUART_FLAGS +#elif defined(CONFIG_DEBUG_OMAP4UART4) +#undef DEBUG_OMAP4UART4_FLAGS +#define DEBUG_OMAP4UART4_FLAGS DEBUG_OMAPUART_FLAGS +#elif defined(CONFIG_DEBUG_TI81XXUART1) +#undef DEBUG_TI81XXUART1_FLAGS +#define DEBUG_TI81XXUART1_FLAGS DEBUG_OMAPUART_FLAGS +#elif defined(CONFIG_DEBUG_TI81XXUART2) +#undef DEBUG_TI81XXUART2_FLAGS +#define DEBUG_TI81XXUART2_FLAGS DEBUG_OMAPUART_FLAGS +#elif defined(CONFIG_DEBUG_TI81XXUART3) +#undef DEBUG_TI81XXUART3_FLAGS +#define DEBUG_TI81XXUART3_FLAGS DEBUG_OMAPUART_FLAGS +#elif defined(CONFIG_DEBUG_AM33XXUART1) +#undef DEBUG_AM33XXUART1_FLAGS +#define DEBUG_AM33XXUART1_FLAGS DEBUG_OMAPUART_FLAGS +#endif /** * struct omap_hwmod_mux_info - hwmod specific mux configuration diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c index d05fc7b54567..56cebb05509e 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c @@ -512,7 +512,7 @@ struct omap_hwmod omap2xxx_uart1_hwmod = { .mpu_irqs = omap2_uart1_mpu_irqs, .sdma_reqs = omap2_uart1_sdma_reqs, .main_clk = "uart1_fck", - .flags = HWMOD_SWSUP_SIDLE_ACT, + .flags = DEBUG_OMAP2UART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT, .prcm = { .omap2 = { .module_offs = CORE_MOD, @@ -532,7 +532,7 @@ struct omap_hwmod omap2xxx_uart2_hwmod = { .mpu_irqs = omap2_uart2_mpu_irqs, .sdma_reqs = omap2_uart2_sdma_reqs, .main_clk = "uart2_fck", - .flags = HWMOD_SWSUP_SIDLE_ACT, + .flags = DEBUG_OMAP2UART2_FLAGS | HWMOD_SWSUP_SIDLE_ACT, .prcm = { .omap2 = { .module_offs = CORE_MOD, @@ -552,7 +552,7 @@ struct omap_hwmod omap2xxx_uart3_hwmod = { .mpu_irqs = omap2_uart3_mpu_irqs, .sdma_reqs = omap2_uart3_sdma_reqs, .main_clk = "uart3_fck", - .flags = HWMOD_SWSUP_SIDLE_ACT, + .flags = DEBUG_OMAP2UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT, .prcm = { .omap2 = { .module_offs = CORE_MOD, diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c index 28bbd56346a9..d4114a919df7 100644 --- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c @@ -1512,7 +1512,7 @@ static struct omap_hwmod am33xx_uart1_hwmod = { .name = "uart1", .class = &uart_class, .clkdm_name = "l4_wkup_clkdm", - .flags = HWMOD_SWSUP_SIDLE_ACT, + .flags = DEBUG_AM33XXUART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT, .main_clk = "dpll_per_m2_div4_wkupdm_ck", .prcm = { .omap4 = { diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index f7a3df2fb579..0c3a427da544 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -490,7 +490,7 @@ static struct omap_hwmod omap3xxx_uart1_hwmod = { .mpu_irqs = omap2_uart1_mpu_irqs, .sdma_reqs = omap2_uart1_sdma_reqs, .main_clk = "uart1_fck", - .flags = HWMOD_SWSUP_SIDLE_ACT, + .flags = DEBUG_TI81XXUART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT, .prcm = { .omap2 = { .module_offs = CORE_MOD, @@ -509,7 +509,7 @@ static struct omap_hwmod omap3xxx_uart2_hwmod = { .mpu_irqs = omap2_uart2_mpu_irqs, .sdma_reqs = omap2_uart2_sdma_reqs, .main_clk = "uart2_fck", - .flags = HWMOD_SWSUP_SIDLE_ACT, + .flags = DEBUG_TI81XXUART2_FLAGS | HWMOD_SWSUP_SIDLE_ACT, .prcm = { .omap2 = { .module_offs = CORE_MOD, @@ -528,7 +528,8 @@ static struct omap_hwmod omap3xxx_uart3_hwmod = { .mpu_irqs = omap2_uart3_mpu_irqs, .sdma_reqs = omap2_uart3_sdma_reqs, .main_clk = "uart3_fck", - .flags = HWMOD_SWSUP_SIDLE_ACT, + .flags = DEBUG_OMAP3UART3_FLAGS | DEBUG_TI81XXUART3_FLAGS | + HWMOD_SWSUP_SIDLE_ACT, .prcm = { .omap2 = { .module_offs = OMAP3430_PER_MOD, @@ -558,7 +559,7 @@ static struct omap_hwmod omap36xx_uart4_hwmod = { .mpu_irqs = uart4_mpu_irqs, .sdma_reqs = uart4_sdma_reqs, .main_clk = "uart4_fck", - .flags = HWMOD_SWSUP_SIDLE_ACT, + .flags = DEBUG_OMAP3UART4_FLAGS | HWMOD_SWSUP_SIDLE_ACT, .prcm = { .omap2 = { .module_offs = OMAP3430_PER_MOD, diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index d04b5e60fdbe..9c3b504477d7 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -2858,8 +2858,7 @@ static struct omap_hwmod omap44xx_uart3_hwmod = { .name = "uart3", .class = &omap44xx_uart_hwmod_class, .clkdm_name = "l4_per_clkdm", - .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET | - HWMOD_SWSUP_SIDLE_ACT, + .flags = DEBUG_OMAP4UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT, .main_clk = "func_48m_fclk", .prcm = { .omap4 = { @@ -2875,7 +2874,7 @@ static struct omap_hwmod omap44xx_uart4_hwmod = { .name = "uart4", .class = &omap44xx_uart_hwmod_class, .clkdm_name = "l4_per_clkdm", - .flags = HWMOD_SWSUP_SIDLE_ACT, + .flags = DEBUG_OMAP4UART4_FLAGS | HWMOD_SWSUP_SIDLE_ACT, .main_clk = "func_48m_fclk", .prcm = { .omap4 = { diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c index f37ae96b70a1..3c70f5c1860f 100644 --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c @@ -1375,7 +1375,7 @@ static struct omap_hwmod omap54xx_uart3_hwmod = { .name = "uart3", .class = &omap54xx_uart_hwmod_class, .clkdm_name = "l4per_clkdm", - .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, + .flags = DEBUG_OMAP4UART3_FLAGS, .main_clk = "func_48m_fclk", .prcm = { .omap4 = { @@ -1391,6 +1391,7 @@ static struct omap_hwmod omap54xx_uart4_hwmod = { .name = "uart4", .class = &omap54xx_uart_hwmod_class, .clkdm_name = "l4per_clkdm", + .flags = DEBUG_OMAP4UART4_FLAGS, .main_clk = "func_48m_fclk", .prcm = { .omap4 = { diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 3a674de6cb63..a388f8c1bcb3 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -208,17 +208,6 @@ static int __init omap_serial_early_init(void) pr_info("%s used as console in debug mode: uart%d clocks will not be gated", uart_name, uart->num); } - - /* - * omap-uart can be used for earlyprintk logs - * So if omap-uart is used as console then prevent - * uart reset and idle to get logs from omap-uart - * until uart console driver is available to take - * care for console messages. - * Idling or resetting omap-uart while printing logs - * early boot logs can stall the boot-up. - */ - oh->flags |= HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET; } } while (1); From f66e329d889fce165074f677509d449fc92ff7b9 Mon Sep 17 00:00:00 2001 From: Rajendra Nayak <rnayak@ti.com> Date: Sun, 28 Jul 2013 23:01:50 -0600 Subject: [PATCH 648/913] ARM: OMAP2+: Avoid idling memory controllers with no drivers Memory controllers in OMAP (like GPMC and EMIF) have the hwmods marked with HWMOD_INIT_NO_IDLE and are left in enabled state post initial setup. Even if they have drivers missing, avoid idling them as part of omap_device_late_idle() Signed-off-by: Rajendra Nayak <rnayak@ti.com> Tested-by: Mark Jackson <mpfj-list@newflow.co.uk> Signed-off-by: Paul Walmsley <paul@pwsan.com> --- arch/arm/mach-omap2/omap_device.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index 5cc92874be7e..1c82cdedd358 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c @@ -842,6 +842,7 @@ static int __init omap_device_late_idle(struct device *dev, void *data) { struct platform_device *pdev = to_platform_device(dev); struct omap_device *od = to_omap_device(pdev); + int i; if (!od) return 0; @@ -850,6 +851,15 @@ static int __init omap_device_late_idle(struct device *dev, void *data) * If omap_device state is enabled, but has no driver bound, * idle it. */ + + /* + * Some devices (like memory controllers) are always kept + * enabled, and should not be idled even with no drivers. + */ + for (i = 0; i < od->hwmods_cnt; i++) + if (od->hwmods[i]->flags & HWMOD_INIT_NO_IDLE) + return 0; + if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) { if (od->_state == OMAP_DEVICE_STATE_ENABLED) { dev_warn(dev, "%s: enabled but no driver. Idling\n", From 7268032dfb1180fca6e91a738380b7ac53684247 Mon Sep 17 00:00:00 2001 From: Rajendra Nayak <rnayak@ti.com> Date: Sun, 28 Jul 2013 23:01:51 -0600 Subject: [PATCH 649/913] ARM: OMAP2+: Sync hwmod state with the pm_runtime and omap_device state Some hwmods which are marked with HWMOD_INIT_NO_IDLE are left in enabled state post setup(). When a omap_device gets created for such hwmods make sure the omap_device and pm_runtime states are also in sync for such hwmods by doing a omap_device_enable() and pm_runtime_set_active() for the device. Signed-off-by: Rajendra Nayak <rnayak@ti.com> Tested-by: Mark Jackson <mpfj-list@newflow.co.uk> Signed-off-by: Paul Walmsley <paul@pwsan.com> --- arch/arm/mach-omap2/omap_device.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index 1c82cdedd358..f99f68e1e85b 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c @@ -129,6 +129,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev) struct device_node *node = pdev->dev.of_node; const char *oh_name; int oh_cnt, i, ret = 0; + bool device_active = false; oh_cnt = of_property_count_strings(node, "ti,hwmods"); if (oh_cnt <= 0) { @@ -152,6 +153,8 @@ static int omap_device_build_from_dt(struct platform_device *pdev) goto odbfd_exit1; } hwmods[i] = oh; + if (oh->flags & HWMOD_INIT_NO_IDLE) + device_active = true; } od = omap_device_alloc(pdev, hwmods, oh_cnt); @@ -172,6 +175,11 @@ static int omap_device_build_from_dt(struct platform_device *pdev) pdev->dev.pm_domain = &omap_device_pm_domain; + if (device_active) { + omap_device_enable(pdev); + pm_runtime_set_active(&pdev->dev); + } + odbfd_exit1: kfree(hwmods); odbfd_exit: From 130142d91467e8a07f3a863db369225a89e84d75 Mon Sep 17 00:00:00 2001 From: Afzal Mohammed <afzal@ti.com> Date: Fri, 5 Jul 2013 20:43:00 +0530 Subject: [PATCH 650/913] ARM: OMAP2+: hwmod: rt address space index for DT Address space is being removed from hwmod database and DT information in <reg> property is being used. Currently the 0th index of device address space is used to map for register target address. This is not always true, eg. cpgmac has it's sysconfig in second address space. Handle it by specifying index of device address space to be used for register target. As default value of this field would be zero with static initialization, existing behaviour of using first address space for register target while using DT would be kept as such. Signed-off-by: Afzal Mohammed <afzal@ti.com> Tested-by: Mugunthan V N <mugunthanvnm@ti.com> [paul@pwsan.com: use u8 rather than int to save memory] Signed-off-by: Paul Walmsley <paul@pwsan.com> --- arch/arm/mach-omap2/omap_hwmod.c | 2 +- arch/arm/mach-omap2/omap_hwmod.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 7341eff63f56..7f4db12b1459 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -2386,7 +2386,7 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); if (np) - va_start = of_iomap(np, 0); + va_start = of_iomap(np, oh->mpu_rt_idx); } else { va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); } diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h index 8440a21fc60a..e1482a9b3bc2 100644 --- a/arch/arm/mach-omap2/omap_hwmod.h +++ b/arch/arm/mach-omap2/omap_hwmod.h @@ -616,6 +616,7 @@ struct omap_hwmod_link { * @voltdm: pointer to voltage domain (filled in at runtime) * @dev_attr: arbitrary device attributes that can be passed to the driver * @_sysc_cache: internal-use hwmod flags + * @mpu_rt_idx: index of device address space for register target (for DT boot) * @_mpu_rt_va: cached register target start address (internal use) * @_mpu_port: cached MPU register target slave (internal use) * @opt_clks_cnt: number of @opt_clks @@ -665,6 +666,7 @@ struct omap_hwmod { struct list_head node; struct omap_hwmod_ocp_if *_mpu_port; u16 flags; + u8 mpu_rt_idx; u8 response_lat; u8 rst_lines_cnt; u8 opt_clks_cnt; From 50c2a3a1518befe992f868fc1fd867bdad9776ad Mon Sep 17 00:00:00 2001 From: Afzal Mohammed <afzal@ti.com> Date: Fri, 5 Jul 2013 20:43:17 +0530 Subject: [PATCH 651/913] ARM: OMAP2+: hwmod: AM335x: fix cpgmac address space Register target address to be used for cpgmac is the second device address space. By default, hwmod picks first address space (0th index) for register target. With removal of address space from hwmod and using DT instead, cpgmac is getting wrong address space for register target. Fix it by indicating the address space to be used for register target. Signed-off-by: Afzal Mohammed <afzal@ti.com> Tested-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: Paul Walmsley <paul@pwsan.com> --- arch/arm/mach-omap2/omap_hwmod_33xx_data.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c index d4114a919df7..eb2f3b93b51c 100644 --- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c @@ -562,6 +562,7 @@ static struct omap_hwmod am33xx_cpgmac0_hwmod = { .clkdm_name = "cpsw_125mhz_clkdm", .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY), .main_clk = "cpsw_125mhz_gclk", + .mpu_rt_idx = 1, .prcm = { .omap4 = { .clkctrl_offs = AM33XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET, From 610d80eaa987e7b1a2d07ee800c9722e227a3b47 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen <lars@metafoo.de> Date: Tue, 30 Jul 2013 13:34:09 +0200 Subject: [PATCH 652/913] ASoC: bf5xx-ac97: Fix compile error with SND_BF5XX_HAVE_COLD_RESET MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If CONFIG_SND_BF5XX_HAVE_COLD_RESET is enabled building the blackfin ac97 driver fails with the following compile error: sound/soc/blackfin/bf5xx-ac97.c: In function ‘asoc_bfin_ac97_probe’: sound/soc/blackfin/bf5xx-ac97.c:297: error: expected ‘;’ before ‘{’ token sound/soc/blackfin/bf5xx-ac97.c:302: error: label ‘gpio_err’ used but not defined The issue was introduced in commit 6dab2fd7 ("ASoC: bf5xx-ac97: Convert to devm_gpio_request_one()"). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org> --- sound/soc/blackfin/bf5xx-ac97.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index efb1daecd0dd..e82eb373a731 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c @@ -294,11 +294,12 @@ static int asoc_bfin_ac97_probe(struct platform_device *pdev) /* Request PB3 as reset pin */ ret = devm_gpio_request_one(&pdev->dev, CONFIG_SND_BF5XX_RESET_GPIO_NUM, - GPIOF_OUT_INIT_HIGH, "SND_AD198x RESET") { + GPIOF_OUT_INIT_HIGH, "SND_AD198x RESET"); + if (ret) { dev_err(&pdev->dev, "Failed to request GPIO_%d for reset: %d\n", CONFIG_SND_BF5XX_RESET_GPIO_NUM, ret); - goto gpio_err; + return ret; } #endif From 016d5baad04269e8559332df05f89bd95b52d6ad Mon Sep 17 00:00:00 2001 From: Lan Tianyu <tianyu.lan@intel.com> Date: Tue, 30 Jul 2013 14:00:42 +0200 Subject: [PATCH 653/913] ACPI / battery: Fix parsing _BIX return value The _BIX method returns extended battery info as a package. According the ACPI spec (ACPI 5, Section 10.2.2.2), the first member of that package should be "Revision". However, the current ACPI battery driver treats the first member as "Power Unit" which should be the second member. This causes the result of _BIX return data parsing to be incorrect. Fix this by adding a new member called 'revision' to struct acpi_battery and adding the offsetof() information on it to extended_info_offsets[] as the first row. [rjw: Changelog] Reported-and-tested-by: Jan Hoffmann <jan.christian.hoffmann@gmail.com> References: http://bugzilla.kernel.org/show_bug.cgi?id=60519 Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> Cc: 2.6.34+ <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/battery.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 082b4dd252a8..d405fbad406a 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -117,6 +117,7 @@ struct acpi_battery { struct acpi_device *device; struct notifier_block pm_nb; unsigned long update_time; + int revision; int rate_now; int capacity_now; int voltage_now; @@ -359,6 +360,7 @@ static struct acpi_offsets info_offsets[] = { }; static struct acpi_offsets extended_info_offsets[] = { + {offsetof(struct acpi_battery, revision), 0}, {offsetof(struct acpi_battery, power_unit), 0}, {offsetof(struct acpi_battery, design_capacity), 0}, {offsetof(struct acpi_battery, full_charge_capacity), 0}, From 2b44c4db2e2f1765d35163a861d301038e0c8a75 Mon Sep 17 00:00:00 2001 From: Colin Cross <ccross@android.com> Date: Wed, 24 Jul 2013 17:41:33 -0700 Subject: [PATCH 654/913] freezer: set PF_SUSPEND_TASK flag on tasks that call freeze_processes Calling freeze_processes sets a global flag that will cause any process that calls try_to_freeze to enter the refrigerator. It skips sending a signal to the current task, but if the current task ever hits try_to_freeze, all threads will be frozen and the system will deadlock. Set a new flag, PF_SUSPEND_TASK, on the task that calls freeze_processes. The flag notifies the freezer that the thread is involved in suspend and should not be frozen. Also add a WARN_ON in thaw_processes if the caller does not have the PF_SUSPEND_TASK flag set to catch if a different task calls thaw_processes than the one that called freeze_processes, leaving a task with PF_SUSPEND_TASK permanently set on it. Threads that spawn off a task with PF_SUSPEND_TASK set (which swsusp does) will also have PF_SUSPEND_TASK set, preventing them from freezing while they are helping with suspend, but they need to be dead by the time suspend is triggered, otherwise they may run when userspace is expected to be frozen. Add a WARN_ON in thaw_processes if more than one thread has the PF_SUSPEND_TASK flag set. Reported-and-tested-by: Michael Leun <lkml20130126@newton.leun.net> Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- include/linux/sched.h | 1 + kernel/freezer.c | 2 +- kernel/power/process.c | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 50d04b92ceda..d722490da030 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1628,6 +1628,7 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ +#define PF_SUSPEND_TASK 0x80000000 /* this thread called freeze_processes and should not be frozen */ /* * Only the _current_ task can read/write to tsk->flags, but other diff --git a/kernel/freezer.c b/kernel/freezer.c index 8b2afc1c9df0..b462fa197517 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -33,7 +33,7 @@ static DEFINE_SPINLOCK(freezer_lock); */ bool freezing_slow_path(struct task_struct *p) { - if (p->flags & PF_NOFREEZE) + if (p->flags & (PF_NOFREEZE | PF_SUSPEND_TASK)) return false; if (pm_nosig_freezing || cgroup_freezing(p)) diff --git a/kernel/power/process.c b/kernel/power/process.c index fc0df8486449..06ec8869dbf1 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c @@ -109,6 +109,8 @@ static int try_to_freeze_tasks(bool user_only) /** * freeze_processes - Signal user space processes to enter the refrigerator. + * The current thread will not be frozen. The same process that calls + * freeze_processes must later call thaw_processes. * * On success, returns 0. On failure, -errno and system is fully thawed. */ @@ -120,6 +122,9 @@ int freeze_processes(void) if (error) return error; + /* Make sure this task doesn't get frozen */ + current->flags |= PF_SUSPEND_TASK; + if (!pm_freezing) atomic_inc(&system_freezing_cnt); @@ -168,6 +173,7 @@ int freeze_kernel_threads(void) void thaw_processes(void) { struct task_struct *g, *p; + struct task_struct *curr = current; if (pm_freezing) atomic_dec(&system_freezing_cnt); @@ -182,10 +188,15 @@ void thaw_processes(void) read_lock(&tasklist_lock); do_each_thread(g, p) { + /* No other threads should have PF_SUSPEND_TASK set */ + WARN_ON((p != curr) && (p->flags & PF_SUSPEND_TASK)); __thaw_task(p); } while_each_thread(g, p); read_unlock(&tasklist_lock); + WARN_ON(!(curr->flags & PF_SUSPEND_TASK)); + curr->flags &= ~PF_SUSPEND_TASK; + usermodehelper_enable(); schedule(); From 179fbd5a45f0d4034cc6fd37b8d367a3b79663c4 Mon Sep 17 00:00:00 2001 From: David Vrabel <david.vrabel@citrix.com> Date: Fri, 19 Jul 2013 15:51:58 +0100 Subject: [PATCH 655/913] xen/evtchn: avoid a deadlock when unbinding an event channel Unbinding an event channel (either with the ioctl or when the evtchn device is closed) may deadlock because disable_irq() is called with port_user_lock held which is also locked by the interrupt handler. Think of the IOCTL_EVTCHN_UNBIND is being serviced, the routine has just taken the lock, and an interrupt happens. The evtchn_interrupt is invoked, tries to take the lock and spins forever. A quick glance at the code shows that the spinlock is a local IRQ variant. Unfortunately that does not help as "disable_irq() waits for the interrupt handler on all CPUs to stop running. If the irq occurs on another VCPU, it tries to take port_user_lock and can't because the unbind ioctl is holding it." (from David). Hence we cannot depend on the said spinlock to protect us. We could make it a system wide IRQ disable spinlock but there is a better way. We can piggyback on the fact that the existence of the spinlock is to make get_port_user() checks be up-to-date. And we can alter those checks to not depend on the spin lock (as it's protected by u->bind_mutex in the ioctl) and can remove the unnecessary locking (this is IOCTL_EVTCHN_UNBIND) path. In the interrupt handler we cannot use the mutex, but we do not need it. "The unbind disables the irq before making the port user stale, so when you clear it you are guaranteed that the interrupt handler that might use that port cannot be running." (from David). Hence this patch removes the spinlock usage on the teardown path and piggybacks on disable_irq happening before we muck with the get_port_user() data. This ensures that the interrupt handler will never run on stale data. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> [v1: Expanded the commit description a bit] --- drivers/xen/evtchn.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index 8feecf01d55c..b6165e047f48 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c @@ -379,18 +379,12 @@ static long evtchn_ioctl(struct file *file, if (unbind.port >= NR_EVENT_CHANNELS) break; - spin_lock_irq(&port_user_lock); - rc = -ENOTCONN; - if (get_port_user(unbind.port) != u) { - spin_unlock_irq(&port_user_lock); + if (get_port_user(unbind.port) != u) break; - } disable_irq(irq_from_evtchn(unbind.port)); - spin_unlock_irq(&port_user_lock); - evtchn_unbind_from_user(u, unbind.port); rc = 0; @@ -490,26 +484,15 @@ static int evtchn_release(struct inode *inode, struct file *filp) int i; struct per_user_data *u = filp->private_data; - spin_lock_irq(&port_user_lock); - - free_page((unsigned long)u->ring); - for (i = 0; i < NR_EVENT_CHANNELS; i++) { if (get_port_user(i) != u) continue; disable_irq(irq_from_evtchn(i)); - } - - spin_unlock_irq(&port_user_lock); - - for (i = 0; i < NR_EVENT_CHANNELS; i++) { - if (get_port_user(i) != u) - continue; - evtchn_unbind_from_user(get_port_user(i), i); } + free_page((unsigned long)u->ring); kfree(u->name); kfree(u); From 0e003b709ef9f4c43f6338834526c3556ea71b19 Mon Sep 17 00:00:00 2001 From: Stefan Haberland <stefan.haberland@de.ibm.com> Date: Tue, 30 Jul 2013 10:49:43 +0200 Subject: [PATCH 656/913] s390/dasd: fix hanging devices after path events The processing of the dasd_block tasklet may have been interrupted by a path event. Restart the dasd tasklets in sleep_on_immediately function. Signed-off-by: Stefan Haberland <stefan.haberland@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- drivers/s390/block/dasd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 17150a778984..451bf99582ff 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -2392,6 +2392,12 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) rc = cqr->intrc; else rc = -EIO; + + /* kick tasklets */ + dasd_schedule_device_bh(device); + if (device->block) + dasd_schedule_block_bh(device->block); + return rc; } From 7ad18dd03c426b017df12a45a56e5b36d5976afb Mon Sep 17 00:00:00 2001 From: "Steven J. Hill" <Steven.Hill@imgtec.com> Date: Wed, 3 Jul 2013 17:28:22 +0000 Subject: [PATCH 657/913] MIPS: Fix multiple definitions of UNCAC_BASE. Fix build error below: arch/mips/include/asm/mach-generic/spaces.h:29:0: warning: "UNCAC_BASE" redefined [enabled by default] In file included from arch/mips/include/asm/addrspace.h:13:0, from arch/mips/include/asm/barrier.h:11, from arch/mips/include/asm/bitops.h:18, from include/linux/bitops.h:22, from include/linux/kernel.h:10, from include/asm-generic/bug.h:13, from arch/mips/include/asm/bug.h:41, from include/linux/bug.h:4, from include/linux/page-flags.h:9, from kernel/bounds.c:9: arch/mips/include/asm/mach-ar7/spaces.h:20:0: note: this is the location of the previous definition Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5583/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/include/asm/mach-generic/spaces.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/mips/include/asm/mach-generic/spaces.h b/arch/mips/include/asm/mach-generic/spaces.h index 5b2f2e68e57f..9488fa5f8866 100644 --- a/arch/mips/include/asm/mach-generic/spaces.h +++ b/arch/mips/include/asm/mach-generic/spaces.h @@ -25,8 +25,12 @@ #else #define CAC_BASE _AC(0x80000000, UL) #endif +#ifndef IO_BASE #define IO_BASE _AC(0xa0000000, UL) +#endif +#ifndef UNCAC_BASE #define UNCAC_BASE _AC(0xa0000000, UL) +#endif #ifndef MAP_BASE #ifdef CONFIG_KVM_GUEST From 1d3e2d79a7d5ab56b382ea96b64c4daa9d6f0ce4 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" <macro@linux-mips.org> Date: Sun, 28 Jul 2013 21:20:25 +0100 Subject: [PATCH 658/913] MIPS: uapi/asm/siginfo.h: Fix GCC 4.1.2 compilation It wasn't until GCC 4.3 I believe that the __SIZEOF_*__ predefined macros were added. The change below switches <uapi/asm/siginfo.h> to the _MIPS_SZLONG macro so that compilation with e.g. GCC 4.1.2 succeeds. This is a user API header so I think this is even more important, for older userland support. The change adds an unsuccessful default too, to catch any compiler configuration oddities. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5630/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/include/uapi/asm/siginfo.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/mips/include/uapi/asm/siginfo.h b/arch/mips/include/uapi/asm/siginfo.h index b7a23064841f..88e292b7719e 100644 --- a/arch/mips/include/uapi/asm/siginfo.h +++ b/arch/mips/include/uapi/asm/siginfo.h @@ -25,11 +25,12 @@ struct siginfo; /* * Careful to keep union _sifields from shifting ... */ -#if __SIZEOF_LONG__ == 4 +#if _MIPS_SZLONG == 32 #define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) -#endif -#if __SIZEOF_LONG__ == 8 +#elif _MIPS_SZLONG == 64 #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) +#else +#error _MIPS_SZLONG neither 32 nor 64 #endif #include <asm-generic/siginfo.h> From 314878d246955e0c6fff95d8ae64285fe828c785 Mon Sep 17 00:00:00 2001 From: Markos Chandras <markos.chandras@imgtec.com> Date: Tue, 23 Jul 2013 15:40:37 +0100 Subject: [PATCH 659/913] MIPS: Set default CPU type for BCM47XX platforms If neither BCM47XX_SSD nor BCM47XX_BCMA is selected, then no CPU type is available leading to build problems. We fix this problem by using MIPS32r1 as the default CPU type for the BCM47XX platform. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Acked-by: Steven J. Hill <Steven.Hill@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5618/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/Kconfig | 1 + arch/mips/bcm47xx/Kconfig | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index c3abed332301..e12764c2a9d0 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -114,6 +114,7 @@ config BCM47XX select FW_CFE select HW_HAS_PCI select IRQ_CPU + select SYS_HAS_CPU_MIPS32_R1 select NO_EXCEPT_FILL select SYS_SUPPORTS_32BIT_KERNEL select SYS_SUPPORTS_LITTLE_ENDIAN diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig index ba611927749b..2b8b118398c4 100644 --- a/arch/mips/bcm47xx/Kconfig +++ b/arch/mips/bcm47xx/Kconfig @@ -2,7 +2,6 @@ if BCM47XX config BCM47XX_SSB bool "SSB Support for Broadcom BCM47XX" - select SYS_HAS_CPU_MIPS32_R1 select SSB select SSB_DRIVER_MIPS select SSB_DRIVER_EXTIF From c055629b279d68c79b8776681c17a2234fecf8af Mon Sep 17 00:00:00 2001 From: Markos Chandras <markos.chandras@imgtec.com> Date: Thu, 25 Jul 2013 16:11:28 +0100 Subject: [PATCH 660/913] MIPS: powertv: Fix arguments for free_reserved_area() Commit 6e7582bf35b8a5a330fd08b398ae445bac86917a "MIPS: PowerTV: use free_reserved_area() to simplify code" merged in 3.11-rc1, broke the build for the powertv defconfig with the following build error: arch/mips/powertv/asic/asic_devices.c: In function 'platform_release_memory': arch/mips/powertv/asic/asic_devices.c:533:7: error: passing argument 1 of 'free_reserved_area' makes pointer from integer without a cast [-Werror] The free_reserved_area() function expects a void * pointer for the start address and a void * pointer for the end one. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5624/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/powertv/asic/asic_devices.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/mips/powertv/asic/asic_devices.c b/arch/mips/powertv/asic/asic_devices.c index 9f64c2387808..0238af1ba503 100644 --- a/arch/mips/powertv/asic/asic_devices.c +++ b/arch/mips/powertv/asic/asic_devices.c @@ -529,8 +529,7 @@ EXPORT_SYMBOL(asic_resource_get); */ void platform_release_memory(void *ptr, int size) { - free_reserved_area((unsigned long)ptr, (unsigned long)(ptr + size), - -1, NULL); + free_reserved_area(ptr, ptr + size, -1, NULL); } EXPORT_SYMBOL(platform_release_memory); From c4091d3fbbed922a3641e5e749655e49cc0d4dee Mon Sep 17 00:00:00 2001 From: Florian Fainelli <florian@openwrt.org> Date: Wed, 24 Jul 2013 17:12:10 +0100 Subject: [PATCH 661/913] MIPS: BMIPS: do not change interrupt routing depending on boot CPU Commit 4df715aa ("MIPS: BMIPS: support booting from physical CPU other than 0") changed the interupt routing when we are booting from physical CPU 0, but the settings are actually correct if we are booting from physical CPU 0 or CPU 1. Revert that specific change. Signed-off-by: Florian Fainelli <florian@openwrt.org> Cc: linux-mips@linux-mips.org Cc: cernekee@gmail.com Cc: jogo@openwrt.org Cc: blogic@openwrt.org Patchwork: https://patchwork.linux-mips.org/patch/5622/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/kernel/smp-bmips.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index c0bb4d59076a..89417c9c6aca 100644 --- a/arch/mips/kernel/smp-bmips.c +++ b/arch/mips/kernel/smp-bmips.c @@ -79,15 +79,9 @@ static void __init bmips_smp_setup(void) * MIPS interrupts 0,1 (SW INT 0,1) cross over to the other thread * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output - * - * If booting from TP1, leave the existing CMT interrupt routing - * such that TP0 responds to SW1 and TP1 responds to SW0. */ - if (boot_cpu == 0) - change_c0_brcm_cmt_intr(0xf8018000, + change_c0_brcm_cmt_intr(0xf8018000, (0x02 << 27) | (0x03 << 15)); - else - change_c0_brcm_cmt_intr(0xf8018000, (0x1d << 27)); /* single core, 2 threads (2 pipelines) */ max_cpus = 2; From ff5fadaff39180dc0b652753b5614a564711be29 Mon Sep 17 00:00:00 2001 From: Florian Fainelli <florian@openwrt.org> Date: Wed, 24 Jul 2013 17:12:11 +0100 Subject: [PATCH 662/913] MIPS: BMIPS: fix slave CPU booting when physical CPU is not 0 The current BMIPS SMP code assumes that the slave CPU is physical and logical CPU 1, but on some systems such as BCM3368, the slave CPU is physical CPU0. Fix the code to read the physical CPU (thread ID) we are running this code on, and adjust the relocation vector address based on it. This allows bringing up the second CPU on BCM3368 for instance. Signed-off-by: Florian Fainelli <florian@openwrt.org> Cc: linux-mips@linux-mips.org Cc: cernekee@gmail.com Cc: jogo@openwrt.org Cc: blogic@openwrt.org Patchwork: https://patchwork.linux-mips.org/patch/5621/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/kernel/bmips_vec.S | 6 +++++- arch/mips/kernel/smp-bmips.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/mips/kernel/bmips_vec.S b/arch/mips/kernel/bmips_vec.S index f739aedcb509..bd79c4f9bff4 100644 --- a/arch/mips/kernel/bmips_vec.S +++ b/arch/mips/kernel/bmips_vec.S @@ -54,7 +54,11 @@ LEAF(bmips_smp_movevec) /* set up CPU1 CBR; move BASE to 0xa000_0000 */ li k0, 0xff400000 mtc0 k0, $22, 6 - li k1, CKSEG1 | BMIPS_RELO_VECTOR_CONTROL_1 + /* set up relocation vector address based on thread ID */ + mfc0 k1, $22, 3 + srl k1, 16 + andi k1, 0x8000 + or k1, CKSEG1 | BMIPS_RELO_VECTOR_CONTROL_0 or k0, k1 li k1, 0xa0080000 sw k1, 0(k0) diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index 89417c9c6aca..159abc8842d2 100644 --- a/arch/mips/kernel/smp-bmips.c +++ b/arch/mips/kernel/smp-bmips.c @@ -196,9 +196,15 @@ static void bmips_init_secondary(void) #if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) void __iomem *cbr = BMIPS_GET_CBR(); unsigned long old_vec; + unsigned long relo_vector; + int boot_cpu; - old_vec = __raw_readl(cbr + BMIPS_RELO_VECTOR_CONTROL_1); - __raw_writel(old_vec & ~0x20000000, cbr + BMIPS_RELO_VECTOR_CONTROL_1); + boot_cpu = !!(read_c0_brcm_cmt_local() & (1 << 31)); + relo_vector = boot_cpu ? BMIPS_RELO_VECTOR_CONTROL_0 : + BMIPS_RELO_VECTOR_CONTROL_1; + + old_vec = __raw_readl(cbr + relo_vector); + __raw_writel(old_vec & ~0x20000000, cbr + relo_vector); clear_c0_cause(smp_processor_id() ? C_SW1 : C_SW0); #elif defined(CONFIG_CPU_BMIPS5000) From ae1fe07f3f422c62a0baf6a777141d7110e8a111 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Thu, 25 Jul 2013 19:48:32 +0300 Subject: [PATCH 663/913] RDMA/cxgb4: Fix stack info leak in c4iw_create_qp() "uresp.ma_sync_key" doesn't get set on this path so we leak 8 bytes of data. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/hw/cxgb4/qp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index 232040447e8a..a4975e1654a6 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c @@ -1657,6 +1657,8 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, if (mm5) { uresp.ma_sync_key = ucontext->key; ucontext->key += PAGE_SIZE; + } else { + uresp.ma_sync_key = 0; } uresp.sq_key = ucontext->key; ucontext->key += PAGE_SIZE; From 63ea37495714849a5a7986244d9d656e0af14961 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Mon, 29 Jul 2013 22:34:29 +0300 Subject: [PATCH 664/913] RDMA/ocrdma: Fix several stack info leaks A grab bag of places which don't properly initialize stack data. I removed one place which cleared ".rsvd" because it's not needed now that I have added a memset() earlier in the function. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index dcfbab177faa..f36630e4b6be 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -242,6 +242,7 @@ struct ib_ucontext *ocrdma_alloc_ucontext(struct ib_device *ibdev, memset(ctx->ah_tbl.va, 0, map_len); ctx->ah_tbl.len = map_len; + memset(&resp, 0, sizeof(resp)); resp.ah_tbl_len = ctx->ah_tbl.len; resp.ah_tbl_page = ctx->ah_tbl.pa; @@ -253,7 +254,6 @@ struct ib_ucontext *ocrdma_alloc_ucontext(struct ib_device *ibdev, resp.wqe_size = dev->attr.wqe_size; resp.rqe_size = dev->attr.rqe_size; resp.dpp_wqe_size = dev->attr.wqe_size; - resp.rsvd = 0; memcpy(resp.fw_ver, dev->attr.fw_ver, sizeof(resp.fw_ver)); status = ib_copy_to_udata(udata, &resp, sizeof(resp)); @@ -338,6 +338,7 @@ static int ocrdma_copy_pd_uresp(struct ocrdma_pd *pd, struct ocrdma_alloc_pd_uresp rsp; struct ocrdma_ucontext *uctx = get_ocrdma_ucontext(ib_ctx); + memset(&rsp, 0, sizeof(rsp)); rsp.id = pd->id; rsp.dpp_enabled = pd->dpp_enabled; db_page_addr = pd->dev->nic_info.unmapped_db + @@ -692,6 +693,7 @@ static int ocrdma_copy_cq_uresp(struct ocrdma_cq *cq, struct ib_udata *udata, struct ocrdma_ucontext *uctx; struct ocrdma_create_cq_uresp uresp; + memset(&uresp, 0, sizeof(uresp)); uresp.cq_id = cq->id; uresp.page_size = cq->len; uresp.num_pages = 1; @@ -1460,6 +1462,7 @@ static int ocrdma_copy_srq_uresp(struct ocrdma_srq *srq, struct ib_udata *udata) int status; struct ocrdma_create_srq_uresp uresp; + memset(&uresp, 0, sizeof(uresp)); uresp.rq_dbid = srq->rq.dbid; uresp.num_rq_pages = 1; uresp.rq_page_addr[0] = srq->rq.pa; From 604296303f5f2698e4682c8aefb413554bc4b12a Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Thu, 25 Jul 2013 20:04:59 +0300 Subject: [PATCH 665/913] RDMA/nes: Fix info leaks in nes_create_qp() and nes_create_cq() We pass a few bytes of uninitialized stack memory to the user here. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/hw/nes/nes_verbs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 8f67fe2e91e6..5b53ca5a2284 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c @@ -1384,6 +1384,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd, if (ibpd->uobject) { uresp.mmap_sq_db_index = nesqp->mmap_sq_db_index; + uresp.mmap_rq_db_index = 0; uresp.actual_sq_size = sq_size; uresp.actual_rq_size = rq_size; uresp.qp_id = nesqp->hwqp.qp_id; @@ -1767,7 +1768,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, resp.cq_id = nescq->hw_cq.cq_number; resp.cq_size = nescq->hw_cq.cq_size; resp.mmap_db_index = 0; - if (ib_copy_to_udata(udata, &resp, sizeof resp)) { + if (ib_copy_to_udata(udata, &resp, sizeof resp - sizeof resp.reserved)) { nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); kfree(nescq); return ERR_PTR(-EFAULT); From 246fcdbc9d6c7ee1b12e299427efbc2ab49e40b5 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Mon, 29 Jul 2013 22:19:14 +0300 Subject: [PATCH 666/913] RDMA/cxgb3: Fix stack info leak in iwch_create_cq() The "uresp.reserved" field isn't initialized on this path so it could leak uninitialized stack information to the user. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/hw/cxgb3/iwch_provider.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index e87f2201b220..d2283837d451 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c @@ -226,6 +226,7 @@ static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, int ve mm->len = PAGE_ALIGN(((1UL << uresp.size_log2) + 1) * sizeof(struct t3_cqe)); uresp.memsize = mm->len; + uresp.reserved = 0; resplen = sizeof uresp; } if (ib_copy_to_udata(udata, &uresp, resplen)) { From b268e4db3d04ed83ecc76b0454b12a8884445f88 Mon Sep 17 00:00:00 2001 From: Mike Marciniszyn <mike.marciniszyn@intel.com> Date: Fri, 12 Jul 2013 09:24:56 -0400 Subject: [PATCH 667/913] IB/qib: Add err_decode() call for ring dump Commit 0b3ddf380ca7 ("Log all SDMA errors unconditionally") missed part of the patch. This also corrects a format warning when dma_addr_t is 32 bits on a 64 bit system. Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/hw/qib/qib_iba7322.c | 2 ++ drivers/infiniband/hw/qib/qib_sdma.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index 21e8b09d4bf8..016e7429adf6 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c @@ -1596,6 +1596,8 @@ static void sdma_7322_p_errors(struct qib_pportdata *ppd, u64 errs) struct qib_devdata *dd = ppd->dd; errs &= QIB_E_P_SDMAERRS; + err_decode(ppd->cpspec->sdmamsgbuf, sizeof(ppd->cpspec->sdmamsgbuf), + errs, qib_7322p_error_msgs); if (errs & QIB_E_P_SDMAUNEXPDATA) qib_dev_err(dd, "IB%u:%u SDmaUnexpData\n", dd->unit, diff --git a/drivers/infiniband/hw/qib/qib_sdma.c b/drivers/infiniband/hw/qib/qib_sdma.c index 32162d355370..9b5322d8cd5a 100644 --- a/drivers/infiniband/hw/qib/qib_sdma.c +++ b/drivers/infiniband/hw/qib/qib_sdma.c @@ -717,7 +717,7 @@ void dump_sdma_state(struct qib_pportdata *ppd) struct qib_sdma_txreq *txp, *txpnext; __le64 *descqp; u64 desc[2]; - dma_addr_t addr; + u64 addr; u16 gen, dwlen, dwoffset; u16 head, tail, cnt; From 741ddbcfd26f192b0677961385b599aa785f8119 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Date: Tue, 23 Jul 2013 17:46:58 +0100 Subject: [PATCH 668/913] xen/tmem: do not allow XEN_TMEM on ARM64 tmem is not supported on arm or arm64 yet. Will revert this once the Xen hypervisor supports it. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/xen/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 9e02d60a364b..23eae5cb69c2 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig @@ -145,7 +145,7 @@ config SWIOTLB_XEN config XEN_TMEM tristate - depends on !ARM + depends on !ARM && !ARM64 default m if (CLEANCACHE || FRONTSWAP) help Shim to interface in-kernel Transcendent Memory hooks From 42a21826dc54583cdb79cc8477732e911ac9c376 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Tue, 30 Jul 2013 00:22:53 -0400 Subject: [PATCH 669/913] drm/radeon/atom: initialize more atom interpretor elements to 0 The ProcessAuxChannel table on some rv635 boards assumes the divmul members are initialized to 0 otherwise we get an invalid fb offset since it has a bad mask set when setting the fb base. While here initialize all the atom interpretor elements to 0. Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=60639 Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org --- drivers/gpu/drm/radeon/atom.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index fb441a790f3d..15da7ef344a4 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c @@ -1222,12 +1222,17 @@ int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) int r; mutex_lock(&ctx->mutex); + /* reset data block */ + ctx->data_block = 0; /* reset reg block */ ctx->reg_block = 0; /* reset fb window */ ctx->fb_base = 0; /* reset io mode */ ctx->io_mode = ATOM_IO_MM; + /* reset divmul */ + ctx->divmul[0] = 0; + ctx->divmul[1] = 0; r = atom_execute_table_locked(ctx, index, params); mutex_unlock(&ctx->mutex); return r; From a838834b2f7cbc09b6319a1fc332c03e4d665b20 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Tue, 30 Jul 2013 16:43:55 -0400 Subject: [PATCH 670/913] drm: fix 64 bit drm fixed point helpers Sign bit wasn't handled properly and a small typo. Thanks to Christian for helping me sort this out. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- include/drm/drm_fixed.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h index f5e1168c7647..d639049a613d 100644 --- a/include/drm/drm_fixed.h +++ b/include/drm/drm_fixed.h @@ -84,12 +84,12 @@ static inline int drm_fixp2int(int64_t a) return ((s64)a) >> DRM_FIXED_POINT; } -static inline s64 drm_fixp_msbset(int64_t a) +static inline unsigned drm_fixp_msbset(int64_t a) { unsigned shift, sign = (a >> 63) & 1; for (shift = 62; shift > 0; --shift) - if ((a >> shift) != sign) + if (((a >> shift) & 1) != sign) return shift; return 0; @@ -100,9 +100,9 @@ static inline s64 drm_fixp_mul(s64 a, s64 b) unsigned shift = drm_fixp_msbset(a) + drm_fixp_msbset(b); s64 result; - if (shift > 63) { - shift = shift - 63; - a >>= shift >> 1; + if (shift > 61) { + shift = shift - 61; + a >>= (shift >> 1) + (shift & 1); b >>= shift >> 1; } else shift = 0; @@ -120,7 +120,7 @@ static inline s64 drm_fixp_mul(s64 a, s64 b) static inline s64 drm_fixp_div(s64 a, s64 b) { - unsigned shift = 63 - drm_fixp_msbset(a); + unsigned shift = 62 - drm_fixp_msbset(a); s64 result; a <<= shift; @@ -154,7 +154,7 @@ static inline s64 drm_fixp_exp(s64 x) } if (x < 0) - sum = drm_fixp_div(1, sum); + sum = drm_fixp_div(DRM_FIXED_ONE, sum); return sum; } From 31f731af513bb9925d0a29dba34bb4f71141bf91 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Tue, 30 Jul 2013 16:56:52 -0400 Subject: [PATCH 671/913] drm/radeon/dpm: fix calculations in si_calculate_leakage_for_v_and_t_formula Need to make some slight adjustments for the fixed point math to work properly. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/si_dpm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 1604a87cf2fe..cfb444870068 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -1765,8 +1765,9 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe { s64 kt, kv, leakage_w, i_leakage, vddc; s64 temperature, t_slope, t_intercept, av, bv, t_ref; + s64 tmp; - i_leakage = drm_int2fixp(ileakage / 100); + i_leakage = drm_int2fixp(ileakage) / 100; vddc = div64_s64(drm_int2fixp(v), 1000); temperature = div64_s64(drm_int2fixp(t), 1000); @@ -1776,8 +1777,9 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe bv = div64_s64(drm_int2fixp(coeff->bv), 100000000); t_ref = drm_int2fixp(coeff->t_ref); - kt = drm_fixp_div(drm_fixp_exp(drm_fixp_mul(drm_fixp_mul(t_slope, vddc) + t_intercept, temperature)), - drm_fixp_exp(drm_fixp_mul(drm_fixp_mul(t_slope, vddc) + t_intercept, t_ref))); + tmp = drm_fixp_mul(t_slope, vddc) + t_intercept; + kt = drm_fixp_exp(drm_fixp_mul(tmp, temperature)); + kt = drm_fixp_div(kt, drm_fixp_exp(drm_fixp_mul(tmp, t_ref))); kv = drm_fixp_mul(av, drm_fixp_exp(drm_fixp_mul(bv, vddc))); leakage_w = drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage, kt), kv), vddc); From 5a344dda944b4eea5a95e47a49ae5b53ce4f49b6 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Tue, 30 Jul 2013 17:02:29 -0400 Subject: [PATCH 672/913] drm/radeon/dpm: re-enable cac control on SI Now that the fixed point functions are fixed we can re-enable cac support. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/si_dpm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index cfb444870068..7ad22e87cd62 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -2044,8 +2044,7 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev) ni_pi->enable_sq_ramping = false; si_pi->enable_dte = false; - /* XXX: fix me */ - if (0/*si_pi->powertune_data->enable_powertune_by_default*/) { + if (si_pi->powertune_data->enable_powertune_by_default) { ni_pi->enable_power_containment= true; ni_pi->enable_cac = true; if (si_pi->dte_data.enable_dte_by_default) { From 27d470c1ab555a1c0b87099c242dc479e19076af Mon Sep 17 00:00:00 2001 From: Linus Walleij <linus.walleij@linaro.org> Date: Mon, 29 Jul 2013 11:48:29 +0200 Subject: [PATCH 673/913] Revert "gpio/omap: fix build error when OF_GPIO is not defined." This reverts commit 949eb1a4d29dc75e0b5b16b03747886b52ecf854. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/gpio/gpio-omap.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index c57244ef428b..3a0c1606f885 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1037,18 +1037,6 @@ omap_mpuio_alloc_gc(struct gpio_bank *bank, unsigned int irq_start, IRQ_NOREQUEST | IRQ_NOPROBE, 0); } -#if defined(CONFIG_OF_GPIO) -static inline bool omap_gpio_chip_boot_dt(struct gpio_chip *chip) -{ - return chip->of_node != NULL; -} -#else -static inline bool omap_gpio_chip_boot_dt(struct gpio_chip *chip) -{ - return false; -} -#endif - static void omap_gpio_chip_init(struct gpio_bank *bank) { int j; @@ -1089,7 +1077,7 @@ static void omap_gpio_chip_init(struct gpio_bank *bank) * irq_create_of_mapping() only for the GPIO lines that * are used as interrupts. */ - if (!omap_gpio_chip_boot_dt(&bank->chip)) + if (!bank->chip.of_node) for (j = 0; j < bank->width; j++) irq_create_mapping(bank->domain, j); irq_set_chained_handler(bank->irq, gpio_irq_handler); @@ -1125,7 +1113,7 @@ static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq, * but until then this has to be done on a per driver * basis. Remove this once this is managed by the core. */ - if (omap_gpio_chip_boot_dt(&bank->chip)) { + if (bank->chip.of_node) { gpio = irq_to_gpio(bank, hwirq); ret = gpio_request_one(gpio, GPIOF_IN, NULL); if (ret) { From c119fee06309a5b6969992b6fe2593299c803c81 Mon Sep 17 00:00:00 2001 From: Linus Walleij <linus.walleij@linaro.org> Date: Mon, 29 Jul 2013 11:48:54 +0200 Subject: [PATCH 674/913] Revert "gpio/omap: auto request GPIO as input if used as IRQ via DT" This reverts commit b4419e1a15905191661ffe75ba2f9e649f5d565e. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/gpio/gpio-omap.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 3a0c1606f885..5e667ff91dc3 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1090,8 +1090,6 @@ static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq, irq_hw_number_t hwirq) { struct gpio_bank *bank = d->host_data; - int gpio; - int ret; if (!bank) return -EINVAL; @@ -1106,22 +1104,6 @@ static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq, set_irq_flags(virq, IRQF_VALID); } - /* - * REVISIT most GPIO IRQ chip drivers need to call - * gpio_request() before a GPIO line can be used as an - * IRQ. Ideally this should be handled by the IRQ core - * but until then this has to be done on a per driver - * basis. Remove this once this is managed by the core. - */ - if (bank->chip.of_node) { - gpio = irq_to_gpio(bank, hwirq); - ret = gpio_request_one(gpio, GPIOF_IN, NULL); - if (ret) { - dev_err(bank->dev, "Could not request GPIO%d\n", gpio); - return ret; - } - } - return 0; } From 253403b035ac55ddd00282ab2dc8e948facc0da6 Mon Sep 17 00:00:00 2001 From: Linus Walleij <linus.walleij@linaro.org> Date: Mon, 29 Jul 2013 11:49:21 +0200 Subject: [PATCH 675/913] Revert "gpio/omap: don't create an IRQ mapping for every GPIO on DT" This reverts commit 0e970cec05635adbe7b686063e2548a8e4afb8f4. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/gpio/gpio-omap.c | 54 +++++++++++----------------------------- 1 file changed, 14 insertions(+), 40 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 5e667ff91dc3..dfeb3a3a8f20 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1068,50 +1068,24 @@ static void omap_gpio_chip_init(struct gpio_bank *bank) gpiochip_add(&bank->chip); - /* - * REVISIT these explicit calls to irq_create_mapping() - * to do the GPIO to IRQ domain mapping for each GPIO in - * the bank can be removed once all OMAP platforms have - * been migrated to Device Tree boot only. - * Since in DT boot irq_create_mapping() is called from - * irq_create_of_mapping() only for the GPIO lines that - * are used as interrupts. - */ - if (!bank->chip.of_node) - for (j = 0; j < bank->width; j++) - irq_create_mapping(bank->domain, j); + for (j = 0; j < bank->width; j++) { + int irq = irq_create_mapping(bank->domain, j); + irq_set_lockdep_class(irq, &gpio_lock_class); + irq_set_chip_data(irq, bank); + if (bank->is_mpuio) { + omap_mpuio_alloc_gc(bank, irq, bank->width); + } else { + irq_set_chip_and_handler(irq, &gpio_irq_chip, + handle_simple_irq); + set_irq_flags(irq, IRQF_VALID); + } + } irq_set_chained_handler(bank->irq, gpio_irq_handler); irq_set_handler_data(bank->irq, bank); } static const struct of_device_id omap_gpio_match[]; -static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq, - irq_hw_number_t hwirq) -{ - struct gpio_bank *bank = d->host_data; - - if (!bank) - return -EINVAL; - - irq_set_lockdep_class(virq, &gpio_lock_class); - irq_set_chip_data(virq, bank); - if (bank->is_mpuio) { - omap_mpuio_alloc_gc(bank, virq, bank->width); - } else { - irq_set_chip_and_handler(virq, &gpio_irq_chip, - handle_simple_irq); - set_irq_flags(virq, IRQF_VALID); - } - - return 0; -} - -static struct irq_domain_ops omap_gpio_irq_ops = { - .xlate = irq_domain_xlate_onetwocell, - .map = omap_gpio_irq_map, -}; - static int omap_gpio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1177,10 +1151,10 @@ static int omap_gpio_probe(struct platform_device *pdev) } bank->domain = irq_domain_add_legacy(node, bank->width, irq_base, - 0, &omap_gpio_irq_ops, bank); + 0, &irq_domain_simple_ops, NULL); #else bank->domain = irq_domain_add_linear(node, bank->width, - &omap_gpio_irq_ops, bank); + &irq_domain_simple_ops, NULL); #endif if (!bank->domain) { dev_err(dev, "Couldn't register an IRQ domain\n"); From 011b2039dfd46fa030138b2e2ed3c55c8341151d Mon Sep 17 00:00:00 2001 From: Stephen Boyd <sboyd@codeaurora.org> Date: Wed, 24 Jul 2013 13:20:48 -0700 Subject: [PATCH 676/913] gpio_msm: Fix build error due to missing err.h drivers/gpio/gpio-msm-v1.c: In function 'gpio_msm_v1_probe': drivers/gpio/gpio-msm-v1.c:656:2: error: implicit declaration of function 'IS_ERR' [-Werror=implicit-function-declaration] drivers/gpio/gpio-msm-v1.c:657:3: error: implicit declaration of function 'PTR_ERR' [-Werror=implicit-function-declaration] This driver failed to compile after commit 68515bb (gpio_msm: Convert to use devm_ioremap_resource, 2013-06-10). Acked-by: Tushar Behera <tushar.behera@linaro.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/gpio/gpio-msm-v1.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-msm-v1.c b/drivers/gpio/gpio-msm-v1.c index e3ceaacde45c..73b73969d361 100644 --- a/drivers/gpio/gpio-msm-v1.c +++ b/drivers/gpio/gpio-msm-v1.c @@ -21,6 +21,7 @@ #include <linux/module.h> #include <linux/device.h> #include <linux/platform_device.h> +#include <linux/err.h> #include <mach/msm_gpiomux.h> From 3c93f039d29326954b2c503a71e1eab9ae49063b Mon Sep 17 00:00:00 2001 From: Roland Dreier <roland@purestorage.com> Date: Tue, 30 Jul 2013 15:48:35 -0700 Subject: [PATCH 677/913] Revert "RDMA/nes: Fix compilation error when nes_debug is enabled" This reverts commit bca1935ccdec, which removes variables nes_tcp_state_str and nes_iwarp_state_str, assuming that they aren't defined. However, they are defined within a #ifdef NES_DEBUG statement, which if enabled causes "defined but not used" compiler warning, when the variables are removed. Signed-off-by: Tatyana Nikolova <Tatyana.E.Nikolova@intel.com> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/hw/nes/nes_hw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index 418004c93feb..90200245c5eb 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c @@ -3570,10 +3570,10 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, tcp_state = (aeq_info & NES_AEQE_TCP_STATE_MASK) >> NES_AEQE_TCP_STATE_SHIFT; iwarp_state = (aeq_info & NES_AEQE_IWARP_STATE_MASK) >> NES_AEQE_IWARP_STATE_SHIFT; nes_debug(NES_DBG_AEQ, "aeid = 0x%04X, qp-cq id = %d, aeqe = %p," - " Tcp state = %d, iWARP state = %d\n", + " Tcp state = %s, iWARP state = %s\n", async_event_id, le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]), aeqe, - tcp_state, iwarp_state); + nes_tcp_state_str[tcp_state], nes_iwarp_state_str[iwarp_state]); aeqe_cq_id = le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]); if (aeq_info & NES_AEQE_QP) { From a264b981f2c76e281ef27e7232774bf6c54ec865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de> Date: Tue, 30 Jul 2013 11:29:40 +0200 Subject: [PATCH 678/913] net/fec: Don't let ndo_start_xmit return NETDEV_TX_BUSY without link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't test for having link and let hardware deal with this situation. Without this patch I see a machine running an -rt patched Linux being stuck in sch_direct_xmit when it looses link while there is still a packet to be sent. In this case the fec_enet_start_xmit routine returned NETDEV_TX_BUSY which makes the network stack reschedule the packet and so sch_direct_xmit calls fec_enet_start_xmit again. I failed to reproduce a complete hang without -rt, but I think the problem exists there, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/freescale/fec_main.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 0dda45481d16..77ea0db0bbfc 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -294,11 +294,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) unsigned short status; unsigned int index; - if (!fep->link) { - /* Link is down or auto-negotiation is in progress. */ - return NETDEV_TX_BUSY; - } - /* Fill in a Tx ring entry */ bdp = fep->cur_tx; From 8fb488d740582314534c278b5d1e3a1888b850b9 Mon Sep 17 00:00:00 2001 From: Paul Bolle <pebolle@tiscali.nl> Date: Wed, 24 Jul 2013 15:06:07 -0700 Subject: [PATCH 679/913] RDMA/cma: Fix gcc warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building cma.o triggers this gcc warning: drivers/infiniband/core/cma.c: In function ‘rdma_resolve_addr’: drivers/infiniband/core/cma.c:465:23: warning: ‘port’ may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/infiniband/core/cma.c:426:5: note: ‘port’ was declared here This is a false positive, as "port" will always be initialized if we're at "found". But if we assign to "id_priv->id.port_num" directly, we can drop "port". That will, obviously, silence gcc. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/core/cma.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index f1c279fabe64..84487a2e651a 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -423,7 +423,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) struct sockaddr_ib *addr; union ib_gid gid, sgid, *dgid; u16 pkey, index; - u8 port, p; + u8 p; int i; cma_dev = NULL; @@ -443,7 +443,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) if (!memcmp(&gid, dgid, sizeof(gid))) { cma_dev = cur_dev; sgid = gid; - port = p; + id_priv->id.port_num = p; goto found; } @@ -451,7 +451,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) dgid->global.subnet_prefix)) { cma_dev = cur_dev; sgid = gid; - port = p; + id_priv->id.port_num = p; } } } @@ -462,7 +462,6 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) found: cma_attach_to_dev(id_priv, cma_dev); - id_priv->id.port_num = port; addr = (struct sockaddr_ib *) cma_src_addr(id_priv); memcpy(&addr->sib_addr, &sgid, sizeof sgid); cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr); From 9ea7187c53f63e31f2d1b2b1e474e31808565009 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz <sameo@linux.intel.com> Date: Wed, 31 Jul 2013 01:19:43 +0200 Subject: [PATCH 680/913] NFC: netlink: Rename CMD_FW_UPLOAD to CMD_FW_DOWNLOAD Loading a firmware into a target is typically called firmware download, not firmware upload. So we rename the netlink API to NFC_CMD_FW_DOWNLOAD in order to avoid any terminology confusion from userspace. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> --- include/net/nfc/hci.h | 2 +- include/net/nfc/nfc.h | 4 ++-- include/uapi/linux/nfc.h | 6 +++--- net/nfc/core.c | 20 ++++++++++---------- net/nfc/hci/core.c | 8 ++++---- net/nfc/netlink.c | 12 ++++++------ net/nfc/nfc.h | 6 +++--- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h index 0af851c3b038..b64b7bce4b94 100644 --- a/include/net/nfc/hci.h +++ b/include/net/nfc/hci.h @@ -59,7 +59,7 @@ struct nfc_hci_ops { struct nfc_target *target); int (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event, struct sk_buff *skb); - int (*fw_upload)(struct nfc_hci_dev *hdev, const char *firmware_name); + int (*fw_download)(struct nfc_hci_dev *hdev, const char *firmware_name); int (*discover_se)(struct nfc_hci_dev *dev); int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx); int (*disable_se)(struct nfc_hci_dev *dev, u32 se_idx); diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 0e353f1658bb..5f286b726bb6 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h @@ -68,7 +68,7 @@ struct nfc_ops { void *cb_context); int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb); int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target); - int (*fw_upload)(struct nfc_dev *dev, const char *firmware_name); + int (*fw_download)(struct nfc_dev *dev, const char *firmware_name); /* Secure Element API */ int (*discover_se)(struct nfc_dev *dev); @@ -127,7 +127,7 @@ struct nfc_dev { int targets_generation; struct device dev; bool dev_up; - bool fw_upload_in_progress; + bool fw_download_in_progress; u8 rf_mode; bool polling; struct nfc_target *active_target; diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h index caed0f324d5f..8137dd8d2adf 100644 --- a/include/uapi/linux/nfc.h +++ b/include/uapi/linux/nfc.h @@ -69,8 +69,8 @@ * starting a poll from a device which has a secure element enabled means * we want to do SE based card emulation. * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element. - * @NFC_CMD_FW_UPLOAD: Request to Load/flash firmware, or event to inform that - * some firmware was loaded + * @NFC_CMD_FW_DOWNLOAD: Request to Load/flash firmware, or event to inform + * that some firmware was loaded */ enum nfc_commands { NFC_CMD_UNSPEC, @@ -94,7 +94,7 @@ enum nfc_commands { NFC_CMD_DISABLE_SE, NFC_CMD_LLC_SDREQ, NFC_EVENT_LLC_SDRES, - NFC_CMD_FW_UPLOAD, + NFC_CMD_FW_DOWNLOAD, NFC_EVENT_SE_ADDED, NFC_EVENT_SE_REMOVED, /* private: internal use only */ diff --git a/net/nfc/core.c b/net/nfc/core.c index dc96a83aa6ab..1d074dd1650f 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c @@ -44,7 +44,7 @@ DEFINE_MUTEX(nfc_devlist_mutex); /* NFC device ID bitmap */ static DEFINE_IDA(nfc_index_ida); -int nfc_fw_upload(struct nfc_dev *dev, const char *firmware_name) +int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name) { int rc = 0; @@ -62,28 +62,28 @@ int nfc_fw_upload(struct nfc_dev *dev, const char *firmware_name) goto error; } - if (!dev->ops->fw_upload) { + if (!dev->ops->fw_download) { rc = -EOPNOTSUPP; goto error; } - dev->fw_upload_in_progress = true; - rc = dev->ops->fw_upload(dev, firmware_name); + dev->fw_download_in_progress = true; + rc = dev->ops->fw_download(dev, firmware_name); if (rc) - dev->fw_upload_in_progress = false; + dev->fw_download_in_progress = false; error: device_unlock(&dev->dev); return rc; } -int nfc_fw_upload_done(struct nfc_dev *dev, const char *firmware_name) +int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name) { - dev->fw_upload_in_progress = false; + dev->fw_download_in_progress = false; - return nfc_genl_fw_upload_done(dev, firmware_name); + return nfc_genl_fw_download_done(dev, firmware_name); } -EXPORT_SYMBOL(nfc_fw_upload_done); +EXPORT_SYMBOL(nfc_fw_download_done); /** * nfc_dev_up - turn on the NFC device @@ -110,7 +110,7 @@ int nfc_dev_up(struct nfc_dev *dev) goto error; } - if (dev->fw_upload_in_progress) { + if (dev->fw_download_in_progress) { rc = -EBUSY; goto error; } diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index 7b1c186736eb..fe66908401f5 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c @@ -809,14 +809,14 @@ static void nfc_hci_recv_from_llc(struct nfc_hci_dev *hdev, struct sk_buff *skb) } } -static int hci_fw_upload(struct nfc_dev *nfc_dev, const char *firmware_name) +static int hci_fw_download(struct nfc_dev *nfc_dev, const char *firmware_name) { struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); - if (!hdev->ops->fw_upload) + if (!hdev->ops->fw_download) return -ENOTSUPP; - return hdev->ops->fw_upload(hdev, firmware_name); + return hdev->ops->fw_download(hdev, firmware_name); } static struct nfc_ops hci_nfc_ops = { @@ -831,7 +831,7 @@ static struct nfc_ops hci_nfc_ops = { .im_transceive = hci_transceive, .tm_send = hci_tm_send, .check_presence = hci_check_presence, - .fw_upload = hci_fw_upload, + .fw_download = hci_fw_download, .discover_se = hci_discover_se, .enable_se = hci_enable_se, .disable_se = hci_disable_se, diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index b05ad909778f..f16fd59d4160 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c @@ -1089,7 +1089,7 @@ exit: return rc; } -static int nfc_genl_fw_upload(struct sk_buff *skb, struct genl_info *info) +static int nfc_genl_fw_download(struct sk_buff *skb, struct genl_info *info) { struct nfc_dev *dev; int rc; @@ -1108,13 +1108,13 @@ static int nfc_genl_fw_upload(struct sk_buff *skb, struct genl_info *info) nla_strlcpy(firmware_name, info->attrs[NFC_ATTR_FIRMWARE_NAME], sizeof(firmware_name)); - rc = nfc_fw_upload(dev, firmware_name); + rc = nfc_fw_download(dev, firmware_name); nfc_put_device(dev); return rc; } -int nfc_genl_fw_upload_done(struct nfc_dev *dev, const char *firmware_name) +int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name) { struct sk_buff *msg; void *hdr; @@ -1124,7 +1124,7 @@ int nfc_genl_fw_upload_done(struct nfc_dev *dev, const char *firmware_name) return -ENOMEM; hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, - NFC_CMD_FW_UPLOAD); + NFC_CMD_FW_DOWNLOAD); if (!hdr) goto free_msg; @@ -1251,8 +1251,8 @@ static struct genl_ops nfc_genl_ops[] = { .policy = nfc_genl_policy, }, { - .cmd = NFC_CMD_FW_UPLOAD, - .doit = nfc_genl_fw_upload, + .cmd = NFC_CMD_FW_DOWNLOAD, + .doit = nfc_genl_fw_download, .policy = nfc_genl_policy, }, { diff --git a/net/nfc/nfc.h b/net/nfc/nfc.h index ee85a1fc1b24..820a7850c36a 100644 --- a/net/nfc/nfc.h +++ b/net/nfc/nfc.h @@ -123,10 +123,10 @@ static inline void nfc_device_iter_exit(struct class_dev_iter *iter) class_dev_iter_exit(iter); } -int nfc_fw_upload(struct nfc_dev *dev, const char *firmware_name); -int nfc_genl_fw_upload_done(struct nfc_dev *dev, const char *firmware_name); +int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name); +int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name); -int nfc_fw_upload_done(struct nfc_dev *dev, const char *firmware_name); +int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name); int nfc_dev_up(struct nfc_dev *dev); From ff862a4668dd6dba962b1d2d8bd344afa6375683 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Sun, 28 Jul 2013 23:04:45 +0300 Subject: [PATCH 681/913] af_key: more info leaks in pfkey messages This is inspired by a5cc68f3d6 "af_key: fix info leaks in notify messages". There are some struct members which don't get initialized and could disclose small amounts of private information. Acked-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/key/af_key.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/key/af_key.c b/net/key/af_key.c index 9da862070dd8..ab8bd2cabfa0 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -2081,6 +2081,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * pol->sadb_x_policy_type = IPSEC_POLICY_NONE; } pol->sadb_x_policy_dir = dir+1; + pol->sadb_x_policy_reserved = 0; pol->sadb_x_policy_id = xp->index; pol->sadb_x_policy_priority = xp->priority; @@ -3137,7 +3138,9 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; pol->sadb_x_policy_dir = XFRM_POLICY_OUT + 1; + pol->sadb_x_policy_reserved = 0; pol->sadb_x_policy_id = xp->index; + pol->sadb_x_policy_priority = xp->priority; /* Set sadb_comb's. */ if (x->id.proto == IPPROTO_AH) @@ -3525,6 +3528,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; pol->sadb_x_policy_dir = dir + 1; + pol->sadb_x_policy_reserved = 0; pol->sadb_x_policy_id = 0; pol->sadb_x_policy_priority = 0; From e1ee3673a83cc02b6b5e43c9e647d8dd5e1c4e26 Mon Sep 17 00:00:00 2001 From: Pablo Neira <pablo@netfilter.org> Date: Mon, 29 Jul 2013 12:30:04 +0200 Subject: [PATCH 682/913] genetlink: fix usage of NLM_F_EXCL or NLM_F_REPLACE Currently, it is not possible to use neither NLM_F_EXCL nor NLM_F_REPLACE from genetlink. This is due to this checking in genl_family_rcv_msg: if (nlh->nlmsg_flags & NLM_F_DUMP) NLM_F_DUMP is NLM_F_MATCH|NLM_F_ROOT. Thus, if NLM_F_EXCL or NLM_F_REPLACE flag is set, genetlink believes that you're requesting a dump and it calls the .dumpit callback. The solution that I propose is to refine this checking to make it stricter: if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) And given the combination NLM_F_REPLACE and NLM_F_EXCL does not make sense to me, it removes the ambiguity. There was a patch that tried to fix this some time ago (0ab03c2 netlink: test for all flags of the NLM_F_DUMP composite) but it tried to resolve this ambiguity in *all* existing netlink subsystems, not only genetlink. That patch was reverted since it broke iproute2, which is using NLM_F_ROOT to request the dump of the routing cache. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/netlink/genetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 1076fe16b122..512718adb0d5 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -571,7 +571,7 @@ static int genl_family_rcv_msg(struct genl_family *family, !capable(CAP_NET_ADMIN)) return -EPERM; - if (nlh->nlmsg_flags & NLM_F_DUMP) { + if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { struct netlink_dump_control c = { .dump = ops->dumpit, .done = ops->done, From e1b4d3036c07ff137955fb1c0197ab62534f46ec Mon Sep 17 00:00:00 2001 From: Ben Widawsky <ben@bwidawsk.net> Date: Tue, 30 Jul 2013 16:27:57 -0700 Subject: [PATCH 683/913] drm/i915: fix missed hunk after GT access breakage Upon some code refactoring, a hunk was missed. This was fixed for next, but missed the current trees, and hasn't yet been merged by Dave Airlie. It is fixed in: commit 907b28c56ea40629aa6595ddfa414ec2fc7da41c Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri Jul 19 20:36:52 2013 +0100 drm/i915: Colocate all GT access routines in the same file It is introduced by: commit 181d1b9e31c668259d3798c521672afb8edd355c Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Sun Jul 21 13:16:24 2013 +0200 drm/i915: fix up gt init sequence fallout Reported-by: Dave Jones <davej@redhat.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/i915/i915_dma.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 66c63808fa35..f4669802a0fb 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1594,6 +1594,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) intel_detect_pch(dev); intel_irq_init(dev); + intel_pm_init(dev); intel_gt_sanitize(dev); intel_gt_init(dev); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index d2ee3343c943..1929bffc1c77 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1582,6 +1582,7 @@ void i915_hangcheck_elapsed(unsigned long data); void i915_handle_error(struct drm_device *dev, bool wedged); extern void intel_irq_init(struct drm_device *dev); +extern void intel_pm_init(struct drm_device *dev); extern void intel_hpd_init(struct drm_device *dev); extern void intel_gt_init(struct drm_device *dev); extern void intel_gt_sanitize(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 51a2a60f5bfc..f895d1508df8 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5536,6 +5536,12 @@ void intel_gt_init(struct drm_device *dev) dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get; dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put; } +} + +void intel_pm_init(struct drm_device *dev) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work, intel_gen6_powersave_work); } From 8c4f3c3fa9681dc549cd35419b259496082fef8b Mon Sep 17 00:00:00 2001 From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org> Date: Tue, 30 Jul 2013 00:04:32 -0400 Subject: [PATCH 684/913] ftrace: Check module functions being traced on reload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's been a nasty bug that would show up and not give much info. The bug displayed the following warning: WARNING: at kernel/trace/ftrace.c:1529 __ftrace_hash_rec_update+0x1e3/0x230() Pid: 20903, comm: bash Tainted: G O 3.6.11+ #38405.trunk Call Trace: [<ffffffff8103e5ff>] warn_slowpath_common+0x7f/0xc0 [<ffffffff8103e65a>] warn_slowpath_null+0x1a/0x20 [<ffffffff810c2ee3>] __ftrace_hash_rec_update+0x1e3/0x230 [<ffffffff810c4f28>] ftrace_hash_move+0x28/0x1d0 [<ffffffff811401cc>] ? kfree+0x2c/0x110 [<ffffffff810c68ee>] ftrace_regex_release+0x8e/0x150 [<ffffffff81149f1e>] __fput+0xae/0x220 [<ffffffff8114a09e>] ____fput+0xe/0x10 [<ffffffff8105fa22>] task_work_run+0x72/0x90 [<ffffffff810028ec>] do_notify_resume+0x6c/0xc0 [<ffffffff8126596e>] ? trace_hardirqs_on_thunk+0x3a/0x3c [<ffffffff815c0f88>] int_signal+0x12/0x17 ---[ end trace 793179526ee09b2c ]--- It was finally narrowed down to unloading a module that was being traced. It was actually more than that. When functions are being traced, there's a table of all functions that have a ref count of the number of active tracers attached to that function. When a function trace callback is registered to a function, the function's record ref count is incremented. When it is unregistered, the function's record ref count is decremented. If an inconsistency is detected (ref count goes below zero) the above warning is shown and the function tracing is permanently disabled until reboot. The ftrace callback ops holds a hash of functions that it filters on (and/or filters off). If the hash is empty, the default means to filter all functions (for the filter_hash) or to disable no functions (for the notrace_hash). When a module is unloaded, it frees the function records that represent the module functions. These records exist on their own pages, that is function records for one module will not exist on the same page as function records for other modules or even the core kernel. Now when a module unloads, the records that represents its functions are freed. When the module is loaded again, the records are recreated with a default ref count of zero (unless there's a callback that traces all functions, then they will also be traced, and the ref count will be incremented). The problem is that if an ftrace callback hash includes functions of the module being unloaded, those hash entries will not be removed. If the module is reloaded in the same location, the hash entries still point to the functions of the module but the module's ref counts do not reflect that. With the help of Steve and Joern, we found a reproducer: Using uinput module and uinput_release function. cd /sys/kernel/debug/tracing modprobe uinput echo uinput_release > set_ftrace_filter echo function > current_tracer rmmod uinput modprobe uinput # check /proc/modules to see if loaded in same addr, otherwise try again echo nop > current_tracer [BOOM] The above loads the uinput module, which creates a table of functions that can be traced within the module. We add uinput_release to the filter_hash to trace just that function. Enable function tracincg, which increments the ref count of the record associated to uinput_release. Remove uinput, which frees the records including the one that represents uinput_release. Load the uinput module again (and make sure it's at the same address). This recreates the function records all with a ref count of zero, including uinput_release. Disable function tracing, which will decrement the ref count for uinput_release which is now zero because of the module removal and reload, and we have a mismatch (below zero ref count). The solution is to check all currently tracing ftrace callbacks to see if any are tracing any of the module's functions when a module is loaded (it already does that with callbacks that trace all functions). If a callback happens to have a module function being traced, it increments that records ref count and starts tracing that function. There may be a strange side effect with this, where tracing module functions on unload and then reloading a new module may have that new module's functions being traced. This may be something that confuses the user, but it's not a big deal. Another approach is to disable all callback hashes on module unload, but this leaves some ftrace callbacks that may not be registered, but can still have hashes tracing the module's function where ftrace doesn't know about it. That situation can cause the same bug. This solution solves that case too. Another benefit of this solution, is it is possible to trace a module's function on unload and load. Link: http://lkml.kernel.org/r/20130705142629.GA325@redhat.com Reported-by: Jörn Engel <joern@logfs.org> Reported-by: Dave Jones <davej@redhat.com> Reported-by: Steve Hodgson <steve@purestorage.com> Tested-by: Steve Hodgson <steve@purestorage.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/ftrace.c | 71 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 62 insertions(+), 9 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 92d3334de0c3..a6d098c6df3f 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -2169,12 +2169,57 @@ static cycle_t ftrace_update_time; static unsigned long ftrace_update_cnt; unsigned long ftrace_update_tot_cnt; -static int ops_traces_mod(struct ftrace_ops *ops) +static inline int ops_traces_mod(struct ftrace_ops *ops) { - struct ftrace_hash *hash; + /* + * Filter_hash being empty will default to trace module. + * But notrace hash requires a test of individual module functions. + */ + return ftrace_hash_empty(ops->filter_hash) && + ftrace_hash_empty(ops->notrace_hash); +} - hash = ops->filter_hash; - return ftrace_hash_empty(hash); +/* + * Check if the current ops references the record. + * + * If the ops traces all functions, then it was already accounted for. + * If the ops does not trace the current record function, skip it. + * If the ops ignores the function via notrace filter, skip it. + */ +static inline bool +ops_references_rec(struct ftrace_ops *ops, struct dyn_ftrace *rec) +{ + /* If ops isn't enabled, ignore it */ + if (!(ops->flags & FTRACE_OPS_FL_ENABLED)) + return 0; + + /* If ops traces all mods, we already accounted for it */ + if (ops_traces_mod(ops)) + return 0; + + /* The function must be in the filter */ + if (!ftrace_hash_empty(ops->filter_hash) && + !ftrace_lookup_ip(ops->filter_hash, rec->ip)) + return 0; + + /* If in notrace hash, we ignore it too */ + if (ftrace_lookup_ip(ops->notrace_hash, rec->ip)) + return 0; + + return 1; +} + +static int referenced_filters(struct dyn_ftrace *rec) +{ + struct ftrace_ops *ops; + int cnt = 0; + + for (ops = ftrace_ops_list; ops != &ftrace_list_end; ops = ops->next) { + if (ops_references_rec(ops, rec)) + cnt++; + } + + return cnt; } static int ftrace_update_code(struct module *mod) @@ -2183,6 +2228,7 @@ static int ftrace_update_code(struct module *mod) struct dyn_ftrace *p; cycle_t start, stop; unsigned long ref = 0; + bool test = false; int i; /* @@ -2196,9 +2242,12 @@ static int ftrace_update_code(struct module *mod) for (ops = ftrace_ops_list; ops != &ftrace_list_end; ops = ops->next) { - if (ops->flags & FTRACE_OPS_FL_ENABLED && - ops_traces_mod(ops)) - ref++; + if (ops->flags & FTRACE_OPS_FL_ENABLED) { + if (ops_traces_mod(ops)) + ref++; + else + test = true; + } } } @@ -2208,12 +2257,16 @@ static int ftrace_update_code(struct module *mod) for (pg = ftrace_new_pgs; pg; pg = pg->next) { for (i = 0; i < pg->index; i++) { + int cnt = ref; + /* If something went wrong, bail without enabling anything */ if (unlikely(ftrace_disabled)) return -1; p = &pg->records[i]; - p->flags = ref; + if (test) + cnt += referenced_filters(p); + p->flags = cnt; /* * Do the initial record conversion from mcount jump @@ -2233,7 +2286,7 @@ static int ftrace_update_code(struct module *mod) * conversion puts the module to the correct state, thus * passing the ftrace_make_call check. */ - if (ftrace_start_up && ref) { + if (ftrace_start_up && cnt) { int failed = __ftrace_replace_code(p, 1); if (failed) ftrace_bug(failed, p->ip); From 3c4d9276626c93477af0b0b9d46b4dcb37e2eed2 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Date: Tue, 23 Jul 2013 23:12:41 -0700 Subject: [PATCH 685/913] shdma: fixup sh_dmae_get_partial() calculation error sh_desc->hw.tcr is controlling real data size, and, register TCR is controlling data transfer count which was xmit_shifted value of hw.tcr. Current sh_dmae_get_partial() is calculating in different unit. This patch fixes it. This bug has been present since c014906a870ce70e009def0c9d170ccabeb0be63 ("dmaengine: shdma: extend .device_terminate_all() to record partial transfer"), which was added in 2.6.34-rc1. Cc: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au> --- drivers/dma/sh/shdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c index b67f45f5c271..5039fbc88254 100644 --- a/drivers/dma/sh/shdma.c +++ b/drivers/dma/sh/shdma.c @@ -400,8 +400,8 @@ static size_t sh_dmae_get_partial(struct shdma_chan *schan, shdma_chan); struct sh_dmae_desc *sh_desc = container_of(sdesc, struct sh_dmae_desc, shdma_desc); - return (sh_desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) << - sh_chan->xmit_shift; + return sh_desc->hw.tcr - + (sh_dmae_readl(sh_chan, TCR) << sh_chan->xmit_shift); } /* Called from error IRQ or NMI */ From fa3e0cee12fbdd9e0b03470b2b8cf968f537c161 Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Date: Sat, 27 Jul 2013 03:46:33 +0400 Subject: [PATCH 686/913] ARM: shmobile: BOCK-W: fix SDHI0 PFC settings The following message is printed on the BOCK-W kernel bootup: sh-pfc pfc-r8a7778: invalid group "sdhi0" for function "sdhi0" In addition, SD card cannot be detected. The reason is apparently that commit ca7bb309485e4ec89a9addd47bea (ARM: shmobile: bockw: add SDHI0 support) matched the previous version of commit 564617d2f92473031d035deb273da5 (sh-pfc: r8a7778: add SDHI support). Add the missing pin groups according to the BOCK-W board schematics. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au> --- arch/arm/mach-shmobile/board-bockw.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c index d5554646916c..3354a85c90f7 100644 --- a/arch/arm/mach-shmobile/board-bockw.c +++ b/arch/arm/mach-shmobile/board-bockw.c @@ -167,7 +167,13 @@ static const struct pinctrl_map bockw_pinctrl_map[] = { "usb1", "usb1"), /* SDHI0 */ PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", - "sdhi0", "sdhi0"), + "sdhi0_data4", "sdhi0"), + PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", + "sdhi0_ctrl", "sdhi0"), + PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", + "sdhi0_cd", "sdhi0"), + PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", + "sdhi0_wp", "sdhi0"), }; #define FPGA 0x18200000 From a601469386b543df2a4d97ad7d524716945278a3 Mon Sep 17 00:00:00 2001 From: Simon Horman <horms+renesas@verge.net.au> Date: Fri, 26 Jul 2013 17:53:42 +0900 Subject: [PATCH 687/913] ARM: shmobile: lager: do not annotate gpio_buttons as __initdata When the gpio-keys device is registered using platform_device_register_data() the platform data argument, lager_keys_pdata is duplicated and thus should be marked as __initdata to avoid wasting memory. However, this is not true of gpio_buttons, a reference to it rather than its value is duplicated when lager_keys_pdata is duplicated. This avoids accessing freed memory if gpio-key events occur after unused kernel memory is freed late in the kernel's boot. This but was added when support for gpio-keys was added to lager in c3842e4fcbb7664276443b79187b7808c2e80a35 ("ARM: shmobile: lager: support GPIO switches") which was included in v3.11-rc1. Tested-by: Magnus Damm <damm@opensource.se> Signed-off-by: Simon Horman <horms+renesas@verge.net.au> --- arch/arm/mach-shmobile/board-lager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c index d73e21d3ea8a..8d6bd5c5efb9 100644 --- a/arch/arm/mach-shmobile/board-lager.c +++ b/arch/arm/mach-shmobile/board-lager.c @@ -59,7 +59,7 @@ static __initdata struct gpio_led_platform_data lager_leds_pdata = { #define GPIO_KEY(c, g, d, ...) \ { .code = c, .gpio = g, .desc = d, .active_low = 1 } -static __initdata struct gpio_keys_button gpio_buttons[] = { +static struct gpio_keys_button gpio_buttons[] = { GPIO_KEY(KEY_4, RCAR_GP_PIN(1, 28), "SW2-pin4"), GPIO_KEY(KEY_3, RCAR_GP_PIN(1, 26), "SW2-pin3"), GPIO_KEY(KEY_2, RCAR_GP_PIN(1, 24), "SW2-pin2"), From 7b70176421993866e616f1cbc4d0dd4054f1bf78 Mon Sep 17 00:00:00 2001 From: Eric Dumazet <edumazet@google.com> Date: Mon, 29 Jul 2013 10:24:04 -0700 Subject: [PATCH 688/913] atl1c: Fix misuse of netdev_alloc_skb in refilling rx ring On Mon, 2013-07-29 at 08:30 -0700, Eric Dumazet wrote: > On Mon, 2013-07-29 at 13:09 +0100, Luis Henriques wrote: > > > > > I confirm that I can't reproduce the issue using this patch. > > > > Thanks, I'll send a polished patch, as this one had an error if > build_skb() returns NULL (in case sk_buff allocation fails) Please try the following patch : It should use 2K frags instead of 4K for normal 1500 mtu Thanks ! [PATCH] atl1c: use custom skb allocator We had reports ( https://bugzilla.kernel.org/show_bug.cgi?id=54021 ) that using high order pages for skb allocations is problematic for atl1c We do not know exactly what the problem is, but we suspect that crossing 4K pages is not well supported by this hardware. Use a custom allocator, using page allocator and 2K fragments for optimal stack behavior. We might make this allocator generic in future kernels. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Luis Henriques <luis.henriques@canonical.com> Cc: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/atheros/atl1c/atl1c.h | 3 ++ .../net/ethernet/atheros/atl1c/atl1c_main.c | 40 ++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c.h b/drivers/net/ethernet/atheros/atl1c/atl1c.h index b2bf324631dc..0f0556526ba9 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c.h +++ b/drivers/net/ethernet/atheros/atl1c/atl1c.h @@ -520,6 +520,9 @@ struct atl1c_adapter { struct net_device *netdev; struct pci_dev *pdev; struct napi_struct napi; + struct page *rx_page; + unsigned int rx_page_offset; + unsigned int rx_frag_size; struct atl1c_hw hw; struct atl1c_hw_stats hw_stats; struct mii_if_info mii; /* MII interface info */ diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 786a87483298..a36a760ada28 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -481,10 +481,15 @@ static int atl1c_set_mac_addr(struct net_device *netdev, void *p) static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter, struct net_device *dev) { + unsigned int head_size; int mtu = dev->mtu; adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ? roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE; + + head_size = SKB_DATA_ALIGN(adapter->rx_buffer_len + NET_SKB_PAD) + + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + adapter->rx_frag_size = roundup_pow_of_two(head_size); } static netdev_features_t atl1c_fix_features(struct net_device *netdev, @@ -952,6 +957,10 @@ static void atl1c_free_ring_resources(struct atl1c_adapter *adapter) kfree(adapter->tpd_ring[0].buffer_info); adapter->tpd_ring[0].buffer_info = NULL; } + if (adapter->rx_page) { + put_page(adapter->rx_page); + adapter->rx_page = NULL; + } } /** @@ -1639,6 +1648,35 @@ static inline void atl1c_rx_checksum(struct atl1c_adapter *adapter, skb_checksum_none_assert(skb); } +static struct sk_buff *atl1c_alloc_skb(struct atl1c_adapter *adapter) +{ + struct sk_buff *skb; + struct page *page; + + if (adapter->rx_frag_size > PAGE_SIZE) + return netdev_alloc_skb(adapter->netdev, + adapter->rx_buffer_len); + + page = adapter->rx_page; + if (!page) { + adapter->rx_page = page = alloc_page(GFP_ATOMIC); + if (unlikely(!page)) + return NULL; + adapter->rx_page_offset = 0; + } + + skb = build_skb(page_address(page) + adapter->rx_page_offset, + adapter->rx_frag_size); + if (likely(skb)) { + adapter->rx_page_offset += adapter->rx_frag_size; + if (adapter->rx_page_offset >= PAGE_SIZE) + adapter->rx_page = NULL; + else + get_page(page); + } + return skb; +} + static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter) { struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring; @@ -1660,7 +1698,7 @@ static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter) while (next_info->flags & ATL1C_BUFFER_FREE) { rfd_desc = ATL1C_RFD_DESC(rfd_ring, rfd_next_to_use); - skb = netdev_alloc_skb(adapter->netdev, adapter->rx_buffer_len); + skb = atl1c_alloc_skb(adapter); if (unlikely(!skb)) { if (netif_msg_rx_err(adapter)) dev_warn(&pdev->dev, "alloc rx buffer failed\n"); From aded09555b7a0748a692d0d644ac54c10c1c0757 Mon Sep 17 00:00:00 2001 From: "Arnaud Patard \\(Rtp\\)" <arnaud.patard@rtp-net.org> Date: Mon, 29 Jul 2013 21:56:47 +0200 Subject: [PATCH 689/913] mvneta: Fix hang when loading the mvneta driver When the mvneta driver is compiled, it'll be loaded with clocks disabled. This implies that the clocks should be enabled again before any register access or it'll hang. To fix it: - enable clock earlier - move timer callback after setting timer.data Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/marvell/mvneta.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 712779fb12b7..3ac29c64bd6c 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -2728,20 +2728,10 @@ static int mvneta_probe(struct platform_device *pdev) pp = netdev_priv(dev); - pp->tx_done_timer.function = mvneta_tx_done_timer_callback; - init_timer(&pp->tx_done_timer); - clear_bit(MVNETA_F_TX_DONE_TIMER_BIT, &pp->flags); - pp->weight = MVNETA_RX_POLL_WEIGHT; pp->phy_node = phy_node; pp->phy_interface = phy_mode; - pp->base = of_iomap(dn, 0); - if (pp->base == NULL) { - err = -ENOMEM; - goto err_free_irq; - } - pp->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(pp->clk)) { err = PTR_ERR(pp->clk); @@ -2765,7 +2755,16 @@ static int mvneta_probe(struct platform_device *pdev) } } + pp->base = of_iomap(dn, 0); + if (pp->base == NULL) { + err = -ENOMEM; + goto err_free_irq; + } + pp->tx_done_timer.data = (unsigned long)dev; + pp->tx_done_timer.function = mvneta_tx_done_timer_callback; + init_timer(&pp->tx_done_timer); + clear_bit(MVNETA_F_TX_DONE_TIMER_BIT, &pp->flags); pp->tx_ring_size = MVNETA_MAX_TXD; pp->rx_ring_size = MVNETA_MAX_RXD; From 5445eaf309ff2868c77354016505fc7315947a35 Mon Sep 17 00:00:00 2001 From: "Arnaud Patard \\(Rtp\\)" <arnaud.patard@rtp-net.org> Date: Mon, 29 Jul 2013 21:56:48 +0200 Subject: [PATCH 690/913] mvneta: Try to fix mvneta when compiled as module When the mvneta driver is compiled as module, the clock is disabled before it's loading. This will reset the registers values and all configuration made by the bootloader. This patch sets the "sgmii serdes configuration" register to a magical value found in: https://github.com/yellowback/ubuntu-precise-armadaxp/blob/master/arch/arm/mach-armadaxp/armada_xp_family/ctrlEnv/mvCtrlEnvLib.c With this change, the interrupts are working/generated and ethernet is working. Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/marvell/mvneta.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 3ac29c64bd6c..b017818bccae 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -88,6 +88,8 @@ #define MVNETA_TX_IN_PRGRS BIT(1) #define MVNETA_TX_FIFO_EMPTY BIT(8) #define MVNETA_RX_MIN_FRAME_SIZE 0x247c +#define MVNETA_SGMII_SERDES_CFG 0x24A0 +#define MVNETA_SGMII_SERDES_PROTO 0x0cc7 #define MVNETA_TYPE_PRIO 0x24bc #define MVNETA_FORCE_UNI BIT(21) #define MVNETA_TXQ_CMD_1 0x24e4 @@ -655,6 +657,8 @@ static void mvneta_port_sgmii_config(struct mvneta_port *pp) val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); val |= MVNETA_GMAC2_PSC_ENABLE; mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); + + mvreg_write(pp, MVNETA_SGMII_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO); } /* Start the Ethernet port RX and TX activity */ @@ -2735,11 +2739,17 @@ static int mvneta_probe(struct platform_device *pdev) pp->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(pp->clk)) { err = PTR_ERR(pp->clk); - goto err_unmap; + goto err_free_irq; } clk_prepare_enable(pp->clk); + pp->base = of_iomap(dn, 0); + if (pp->base == NULL) { + err = -ENOMEM; + goto err_clk; + } + dt_mac_addr = of_get_mac_address(dn); if (dt_mac_addr && is_valid_ether_addr(dt_mac_addr)) { mac_from = "device tree"; @@ -2755,12 +2765,6 @@ static int mvneta_probe(struct platform_device *pdev) } } - pp->base = of_iomap(dn, 0); - if (pp->base == NULL) { - err = -ENOMEM; - goto err_free_irq; - } - pp->tx_done_timer.data = (unsigned long)dev; pp->tx_done_timer.function = mvneta_tx_done_timer_callback; init_timer(&pp->tx_done_timer); @@ -2775,7 +2779,7 @@ static int mvneta_probe(struct platform_device *pdev) err = mvneta_init(pp, phy_addr); if (err < 0) { dev_err(&pdev->dev, "can't init eth hal\n"); - goto err_clk; + goto err_unmap; } mvneta_port_power_up(pp, phy_mode); @@ -2805,10 +2809,10 @@ static int mvneta_probe(struct platform_device *pdev) err_deinit: mvneta_deinit(pp); -err_clk: - clk_disable_unprepare(pp->clk); err_unmap: iounmap(pp->base); +err_clk: + clk_disable_unprepare(pp->clk); err_free_irq: irq_dispose_mapping(dev->irq); err_free_netdev: From a661b43fd047ef501da43a19975415f861c7c3db Mon Sep 17 00:00:00 2001 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Tue, 30 Jul 2013 07:57:06 +0800 Subject: [PATCH 691/913] mlx5: fix error return code in mlx5_alloc_uuars() Fix to return -ENOMEM from the ioremap error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/uar.c b/drivers/net/ethernet/mellanox/mlx5/core/uar.c index 71d4a3937200..68f5d9c77c7b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/uar.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/uar.c @@ -164,6 +164,7 @@ int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari) uuari->uars[i].map = ioremap(addr, PAGE_SIZE); if (!uuari->uars[i].map) { mlx5_cmd_free_uar(dev, uuari->uars[i].index); + err = -ENOMEM; goto out_count; } mlx5_core_dbg(dev, "allocated uar index 0x%x, mmaped at %p\n", From e511d1ae16745baca1e6d807c5b963716e8bdd01 Mon Sep 17 00:00:00 2001 From: Sean Hefty <sean.hefty@intel.com> Date: Wed, 24 Jul 2013 15:06:08 -0700 Subject: [PATCH 692/913] RDMA/cma: Fix accessing invalid private data for UD If a application is using AF_IB with a UD QP, but does not provide any private data, we will end up accessing invalid memory. Check for this case and handle it appropriately. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/core/cma.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 84487a2e651a..431465563364 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -2676,29 +2676,32 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv, { struct ib_cm_sidr_req_param req; struct ib_cm_id *id; + void *private_data; int offset, ret; + memset(&req, 0, sizeof req); offset = cma_user_data_offset(id_priv); req.private_data_len = offset + conn_param->private_data_len; if (req.private_data_len < conn_param->private_data_len) return -EINVAL; if (req.private_data_len) { - req.private_data = kzalloc(req.private_data_len, GFP_ATOMIC); - if (!req.private_data) + private_data = kzalloc(req.private_data_len, GFP_ATOMIC); + if (!private_data) return -ENOMEM; } else { - req.private_data = NULL; + private_data = NULL; } if (conn_param->private_data && conn_param->private_data_len) - memcpy((void *) req.private_data + offset, - conn_param->private_data, conn_param->private_data_len); + memcpy(private_data + offset, conn_param->private_data, + conn_param->private_data_len); - if (req.private_data) { - ret = cma_format_hdr((void *) req.private_data, id_priv); + if (private_data) { + ret = cma_format_hdr(private_data, id_priv); if (ret) goto out; + req.private_data = private_data; } id = ib_create_cm_id(id_priv->id.device, cma_sidr_rep_handler, @@ -2720,7 +2723,7 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv, id_priv->cm_id.ib = NULL; } out: - kfree(req.private_data); + kfree(private_data); return ret; } From 5eb695c1773b439fb668127d3738d348a46a2748 Mon Sep 17 00:00:00 2001 From: Sean Hefty <sean.hefty@intel.com> Date: Wed, 24 Jul 2013 15:06:09 -0700 Subject: [PATCH 693/913] RDMA/cma: Only call cma_save_ib_info() for CM REQs Calling cma_save_ib_info() for CM SIDR REQs results in a crash accessing an invalid path record pointer. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/core/cma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 431465563364..7c0f9535fb7d 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -879,7 +879,8 @@ static int cma_save_net_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_id { struct cma_hdr *hdr; - if (listen_id->route.addr.src_addr.ss_family == AF_IB) { + if ((listen_id->route.addr.src_addr.ss_family == AF_IB) && + (ib_event->event == IB_CM_REQ_RECEIVED)) { cma_save_ib_info(id, listen_id, ib_event->param.req_rcvd.primary_path); return 0; } From d2ee88d0aaacac664aff6ca5fc0bd7705d8f2414 Mon Sep 17 00:00:00 2001 From: Ralf Baechle <ralf@linux-mips.org> Date: Wed, 31 Jul 2013 10:15:19 +0200 Subject: [PATCH 694/913] ASoC: au1x: Fix build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit d8b51c11ff5a70244753ba60abfd47088cf4dcd4 [ASoC: ac97c: Use module_platform_driver()] broke the build: CC sound/soc/au1x/ac97c.o /home/ralf/src/linux/upstream-sfr/sound/soc/au1x/ac97c.c:344:1: error: expected identifier or ‘(’ before ‘&’ token /home/ralf/src/linux/upstream-sfr/sound/soc/au1x/ac97c.c:344:1: error: pasting "__initcall_" and "&" does not give a valid preprocessing token /home/ralf/src/linux/upstream-sfr/sound/soc/au1x/ac97c.c:344:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘&’ token /home/ralf/src/linux/upstream-sfr/sound/soc/au1x/ac97c.c:344:1: error: expected identifier or ‘(’ before ‘&’ token /home/ralf/src/linux/upstream-sfr/sound/soc/au1x/ac97c.c:344:1: error: pasting "__exitcall_" and "&" does not give a valid preprocessing token /home/ralf/src/linux/upstream-sfr/sound/soc/au1x/ac97c.c:344:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘&’ token /home/ralf/src/linux/upstream-sfr/sound/soc/au1x/ac97c.c:334:31: warning: ‘au1xac97c_driver’ defined but not used [-Wunused-variable] make[5]: *** [sound/soc/au1x/ac97c.o] Error 1 make[4]: *** [sound/soc/au1x] Error 2 make[3]: *** [sound/soc] Error 2 Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Mark Brown <broonie@linaro.org> --- sound/soc/au1x/ac97c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c index d6f7694fcad4..c8a2de103c5f 100644 --- a/sound/soc/au1x/ac97c.c +++ b/sound/soc/au1x/ac97c.c @@ -341,7 +341,7 @@ static struct platform_driver au1xac97c_driver = { .remove = au1xac97c_drvremove, }; -module_platform_driver(&au1xac97c_driver); +module_platform_driver(au1xac97c_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Au1000/1500/1100 AC97C ASoC driver"); From bed859c1eea89feaba2acbb57d967a6d6f68af09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de> Date: Tue, 30 Jul 2013 11:33:00 +0100 Subject: [PATCH 695/913] ARM: 7800/1: ARMv7-M: Fix name of NVIC handler function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The name changed in response to review comments for the nvic irqchip driver when the original name was already accepted into Russell King's tree. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/kernel/entry-v7m.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/kernel/entry-v7m.S b/arch/arm/kernel/entry-v7m.S index e00621f1403f..52b26432c9a9 100644 --- a/arch/arm/kernel/entry-v7m.S +++ b/arch/arm/kernel/entry-v7m.S @@ -49,7 +49,7 @@ __irq_entry: mov r1, sp stmdb sp!, {lr} @ routine called with r0 = irq number, r1 = struct pt_regs * - bl nvic_do_IRQ + bl nvic_handle_irq pop {lr} @ From 067e710b9a982a92cc8294d7fa0f1e924c65bba1 Mon Sep 17 00:00:00 2001 From: Paul Walmsley <paul@pwsan.com> Date: Tue, 30 Jul 2013 12:38:45 +0100 Subject: [PATCH 696/913] ARM: 7801/1: v6: prevent gcc 4.5 from reordering extended CP15 reads above is_smp() test Commit 621a0147d5c921f4cc33636ccd0602ad5d7cbfbc ("ARM: 7757/1: mm: don't flush icache in switch_mm with hardware broadcasting") breaks the boot on OMAP2430SDP with omap2plus_defconfig. Tracked to an undefined instruction abort from the CP15 read in cache_ops_need_broadcast(). It turns out that gcc 4.5 reorders the extended CP15 read above the is_smp() test. This breaks ARM1136 r0 cores, since they don't support several CP15 registers that later ARM cores do. ARM1136JF-S TRM section 3.2.1 "Register allocation" has the details. So mark the extended CP15 read as clobbering memory, which prevents the compiler from reordering it before the is_smp() test. Russell states that the code generated from this approach is preferable to marking the inline asm as volatile. Remove the existing condition code clobber as it's obsolete, per Nico's post: http://www.spinics.net/lists/arm-kernel/msg261208.html This patch is a collaboration with Will Deacon and Russell King. Comments from Paul Walmsley: Russell, if you accept this one, might you also add Will's ack from the lists: Comments from Paul Walmsley: I'd also be obliged if you could add a Cc: line for Jonathan Austin, since he helped test: Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Nicolas Pitre <nicolas.pitre@linaro.org> Cc: Tony Lindgren <tony@atomide.com> Acked-by: Will Deacon <will.deacon@arm.com> Cc: Jonathan Austin <jonathan.austin@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/include/asm/cputype.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h index 8c25dc4e9851..9672e978d50d 100644 --- a/arch/arm/include/asm/cputype.h +++ b/arch/arm/include/asm/cputype.h @@ -89,13 +89,18 @@ extern unsigned int processor_id; __val; \ }) +/* + * The memory clobber prevents gcc 4.5 from reordering the mrc before + * any is_smp() tests, which can cause undefined instruction aborts on + * ARM1136 r0 due to the missing extended CP15 registers. + */ #define read_cpuid_ext(ext_reg) \ ({ \ unsigned int __val; \ asm("mrc p15, 0, %0, c0, " ext_reg \ : "=r" (__val) \ : \ - : "cc"); \ + : "memory"); \ __val; \ }) From da0a12caffad2eeadea429f83818408e7b77379a Mon Sep 17 00:00:00 2001 From: Li Zefan <lizefan@huawei.com> Date: Wed, 31 Jul 2013 16:16:28 +0800 Subject: [PATCH 697/913] cgroup: fix a leak when percpu_ref_init() fails ss->css_free() is not called when perfcpu_ref_init() fails. Signed-off-by: Li Zefan <lizefan@huawei.com> Signed-off-by: Tejun Heo <tj@kernel.org> --- kernel/cgroup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c index afb8d53ca6c7..468e410f9e61 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -4344,8 +4344,10 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry, } err = percpu_ref_init(&css->refcnt, css_release); - if (err) + if (err) { + ss->css_free(cgrp); goto err_free_all; + } init_cgroup_css(css, ss, cgrp); From 4f8b19143d74e1c3360b21640065765a12bafb1b Mon Sep 17 00:00:00 2001 From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Date: Wed, 31 Jul 2013 13:28:52 +0100 Subject: [PATCH 698/913] ASoC: wm0010: Fix resource leak If kzalloc() fails for `img' then we are going to leak the memory for `out'. We are freeing the memory of all the tx/rx transfers but the tx/rx buf pointers will be NULL if we drop out earlier. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org> --- sound/soc/codecs/wm0010.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c index f5e835662cdc..10adc4145d46 100644 --- a/sound/soc/codecs/wm0010.c +++ b/sound/soc/codecs/wm0010.c @@ -410,6 +410,16 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec) rec->command, rec->length); len = rec->length + 8; + xfer = kzalloc(sizeof(*xfer), GFP_KERNEL); + if (!xfer) { + dev_err(codec->dev, "Failed to allocate xfer\n"); + ret = -ENOMEM; + goto abort; + } + + xfer->codec = codec; + list_add_tail(&xfer->list, &xfer_list); + out = kzalloc(len, GFP_KERNEL); if (!out) { dev_err(codec->dev, @@ -417,6 +427,7 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec) ret = -ENOMEM; goto abort1; } + xfer->t.rx_buf = out; img = kzalloc(len, GFP_KERNEL); if (!img) { @@ -425,24 +436,13 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec) ret = -ENOMEM; goto abort1; } + xfer->t.tx_buf = img; byte_swap_64((u64 *)&rec->command, img, len); - xfer = kzalloc(sizeof(*xfer), GFP_KERNEL); - if (!xfer) { - dev_err(codec->dev, "Failed to allocate xfer\n"); - ret = -ENOMEM; - goto abort1; - } - - xfer->codec = codec; - list_add_tail(&xfer->list, &xfer_list); - spi_message_init(&xfer->m); xfer->m.complete = wm0010_boot_xfer_complete; xfer->m.context = xfer; - xfer->t.tx_buf = img; - xfer->t.rx_buf = out; xfer->t.len = len; xfer->t.bits_per_word = 8; From d982057f631df04f8d78321084a1a71ca51f3364 Mon Sep 17 00:00:00 2001 From: Torsten Kaiser <just.for.lkml@googlemail.com> Date: Tue, 23 Jul 2013 22:58:23 +0200 Subject: [PATCH 699/913] x86, amd, microcode: Fix error path in apply_microcode_amd() Return -1 (like Intels apply_microcode) when the loading fails, also do not set the active microcode level on failure. Signed-off-by: Torsten Kaiser <just.for.lkml@googlemail.com> Link: http://lkml.kernel.org/r/20130723225823.2e4e7588@googlemail.com Acked-by: Borislav Petkov <bp@suse.de> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> --- arch/x86/kernel/microcode_amd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 47ebb1dbfbcb..7a0adb7ee433 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c @@ -220,12 +220,13 @@ int apply_microcode_amd(int cpu) return 0; } - if (__apply_microcode_amd(mc_amd)) + if (__apply_microcode_amd(mc_amd)) { pr_err("CPU%d: update failed for patch_level=0x%08x\n", cpu, mc_amd->hdr.patch_id); - else - pr_info("CPU%d: new patch_level=0x%08x\n", cpu, - mc_amd->hdr.patch_id); + return -1; + } + pr_info("CPU%d: new patch_level=0x%08x\n", cpu, + mc_amd->hdr.patch_id); uci->cpu_sig.rev = mc_amd->hdr.patch_id; c->microcode = mc_amd->hdr.patch_id; From 776164c1faac4966ab14418bb0922e1820da1d19 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Fri, 26 Jul 2013 17:12:56 +0200 Subject: [PATCH 700/913] debugfs: debugfs_remove_recursive() must not rely on list_empty(d_subdirs) debugfs_remove_recursive() is wrong, 1. it wrongly assumes that !list_empty(d_subdirs) means that this dir should be removed. This is not that bad by itself, but: 2. if d_subdirs does not becomes empty after __debugfs_remove() it gives up and silently fails, it doesn't even try to remove other entries. However ->d_subdirs can be non-empty because it still has the already deleted !debugfs_positive() entries. 3. simple_release_fs() is called even if __debugfs_remove() fails. Suppose we have dir1/ dir2/ file2 file1 and someone opens dir1/dir2/file2. Now, debugfs_remove_recursive(dir1/dir2) succeeds, and dir1/dir2 goes away. But debugfs_remove_recursive(dir1) silently fails and doesn't remove this directory. Because it tries to delete (the already deleted) dir1/dir2/file2 again and then fails due to "Avoid infinite loop" logic. Test-case: #!/bin/sh cd /sys/kernel/debug/tracing echo 'p:probe/sigprocmask sigprocmask' >> kprobe_events sleep 1000 < events/probe/sigprocmask/id & echo -n >| kprobe_events [ -d events/probe ] && echo "ERR!! failed to rm probe" And after that it is not possible to create another probe entry. With this patch debugfs_remove_recursive() skips !debugfs_positive() files although this is not strictly needed. The most important change is that it does not try to make ->d_subdirs empty, it simply scans the whole list(s) recursively and removes as much as possible. Link: http://lkml.kernel.org/r/20130726151256.GC19472@redhat.com Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- fs/debugfs/inode.c | 71 +++++++++++++++------------------------------- 1 file changed, 23 insertions(+), 48 deletions(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 4888cb3fdef7..c7c83ff0f752 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -533,8 +533,7 @@ EXPORT_SYMBOL_GPL(debugfs_remove); */ void debugfs_remove_recursive(struct dentry *dentry) { - struct dentry *child; - struct dentry *parent; + struct dentry *child, *next, *parent; if (IS_ERR_OR_NULL(dentry)) return; @@ -544,61 +543,37 @@ void debugfs_remove_recursive(struct dentry *dentry) return; parent = dentry; + down: mutex_lock(&parent->d_inode->i_mutex); + list_for_each_entry_safe(child, next, &parent->d_subdirs, d_u.d_child) { + if (!debugfs_positive(child)) + continue; - while (1) { - /* - * When all dentries under "parent" has been removed, - * walk up the tree until we reach our starting point. - */ - if (list_empty(&parent->d_subdirs)) { - mutex_unlock(&parent->d_inode->i_mutex); - if (parent == dentry) - break; - parent = parent->d_parent; - mutex_lock(&parent->d_inode->i_mutex); - } - child = list_entry(parent->d_subdirs.next, struct dentry, - d_u.d_child); - next_sibling: - - /* - * If "child" isn't empty, walk down the tree and - * remove all its descendants first. - */ + /* perhaps simple_empty(child) makes more sense */ if (!list_empty(&child->d_subdirs)) { mutex_unlock(&parent->d_inode->i_mutex); parent = child; - mutex_lock(&parent->d_inode->i_mutex); - continue; + goto down; } - __debugfs_remove(child, parent); - if (parent->d_subdirs.next == &child->d_u.d_child) { - /* - * Try the next sibling. - */ - if (child->d_u.d_child.next != &parent->d_subdirs) { - child = list_entry(child->d_u.d_child.next, - struct dentry, - d_u.d_child); - goto next_sibling; - } - - /* - * Avoid infinite loop if we fail to remove - * one dentry. - */ - mutex_unlock(&parent->d_inode->i_mutex); - break; - } - simple_release_fs(&debugfs_mount, &debugfs_mount_count); + up: + if (!__debugfs_remove(child, parent)) + simple_release_fs(&debugfs_mount, &debugfs_mount_count); } - parent = dentry->d_parent; - mutex_lock(&parent->d_inode->i_mutex); - __debugfs_remove(dentry, parent); mutex_unlock(&parent->d_inode->i_mutex); - simple_release_fs(&debugfs_mount, &debugfs_mount_count); + child = parent; + parent = parent->d_parent; + mutex_lock(&parent->d_inode->i_mutex); + + if (child != dentry) { + next = list_entry(child->d_u.d_child.next, struct dentry, + d_u.d_child); + goto up; + } + + if (!__debugfs_remove(child, parent)) + simple_release_fs(&debugfs_mount, &debugfs_mount_count); + mutex_unlock(&parent->d_inode->i_mutex); } EXPORT_SYMBOL_GPL(debugfs_remove_recursive); From 481f2d4f89f87a0baa26147f323380e31cfa7c44 Mon Sep 17 00:00:00 2001 From: Julius Werner <jwerner@chromium.org> Date: Tue, 30 Jul 2013 19:51:20 -0700 Subject: [PATCH 701/913] usb: core: don't try to reset_device() a port that got just disconnected The USB hub driver's event handler contains a check to catch SuperSpeed devices that transitioned into the SS.Inactive state and tries to fix them with a reset. It decides whether to do a plain hub port reset or call the usb_reset_device() function based on whether there was a device attached to the port. However, there are device/hub combinations (found with a JetFlash Transcend mass storage stick (8564:1000) on the root hub of an Intel LynxPoint PCH) which can transition to the SS.Inactive state on disconnect (and stay there long enough for the host to notice). In this case, above-mentioned reset check will call usb_reset_device() on the stale device data structure. The kernel will send pointless LPM control messages to the no longer connected device address and can even cause several 5 second khubd stalls on some (buggy?) host controllers, before finally accepting the device's fate amongst a flurry of error messages. This patch makes the choice of reset dependent on the port status that has just been read from the hub in addition to the existence of an in-kernel data structure for the device, and only proceeds with the more extensive reset if both are valid. Signed-off-by: Julius Werner <jwerner@chromium.org> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> --- drivers/usb/core/hub.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 4a8a1d68002c..558313de4911 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -4798,7 +4798,8 @@ static void hub_events(void) hub->ports[i - 1]->child; dev_dbg(hub_dev, "warm reset port %d\n", i); - if (!udev) { + if (!udev || !(portstatus & + USB_PORT_STAT_CONNECTION)) { status = hub_port_reset(hub, i, NULL, HUB_BH_RESET_TIME, true); @@ -4808,8 +4809,8 @@ static void hub_events(void) usb_lock_device(udev); status = usb_reset_device(udev); usb_unlock_device(udev); + connect_change = 0; } - connect_change = 0; } if (connect_change) From 2816c551c796ec14620325b2c9ed75b9979d3125 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Mon, 29 Jul 2013 19:50:33 +0200 Subject: [PATCH 702/913] tracing: trace_remove_event_call() should fail if call/file is in use Change trace_remove_event_call(call) to return the error if this call is active. This is what the callers assume but can't verify outside of the tracing locks. Both trace_kprobe.c/trace_uprobe.c need the additional changes, unregister_trace_probe() should abort if trace_remove_event_call() fails. The caller is going to free this call/file so we must ensure that nobody can use them after trace_remove_event_call() succeeds. debugfs should be fine after the previous changes and event_remove() does TRACE_REG_UNREGISTER, but still there are 2 reasons why we need the additional checks: - There could be a perf_event(s) attached to this tp_event, so the patch checks ->perf_refcount. - TRACE_REG_UNREGISTER can be suppressed by FTRACE_EVENT_FL_SOFT_MODE, so we simply check FTRACE_EVENT_FL_ENABLED protected by event_mutex. Link: http://lkml.kernel.org/r/20130729175033.GB26284@redhat.com Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- include/linux/ftrace_event.h | 2 +- kernel/trace/trace_events.c | 37 +++++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 4372658c73ae..f98ab063e95e 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h @@ -332,7 +332,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type, const char *name, int offset, int size, int is_signed, int filter_type); extern int trace_add_event_call(struct ftrace_event_call *call); -extern void trace_remove_event_call(struct ftrace_event_call *call); +extern int trace_remove_event_call(struct ftrace_event_call *call); #define is_signed_type(type) (((type)(-1)) < (type)1) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index a67c913e2f9f..ec04836273c0 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -1713,16 +1713,47 @@ static void __trace_remove_event_call(struct ftrace_event_call *call) destroy_preds(call); } -/* Remove an event_call */ -void trace_remove_event_call(struct ftrace_event_call *call) +static int probe_remove_event_call(struct ftrace_event_call *call) { + struct trace_array *tr; + struct ftrace_event_file *file; + +#ifdef CONFIG_PERF_EVENTS + if (call->perf_refcount) + return -EBUSY; +#endif + do_for_each_event_file(tr, file) { + if (file->event_call != call) + continue; + /* + * We can't rely on ftrace_event_enable_disable(enable => 0) + * we are going to do, FTRACE_EVENT_FL_SOFT_MODE can suppress + * TRACE_REG_UNREGISTER. + */ + if (file->flags & FTRACE_EVENT_FL_ENABLED) + return -EBUSY; + break; + } while_for_each_event_file(); + + __trace_remove_event_call(call); + + return 0; +} + +/* Remove an event_call */ +int trace_remove_event_call(struct ftrace_event_call *call) +{ + int ret; + mutex_lock(&trace_types_lock); mutex_lock(&event_mutex); down_write(&trace_event_sem); - __trace_remove_event_call(call); + ret = probe_remove_event_call(call); up_write(&trace_event_sem); mutex_unlock(&event_mutex); mutex_unlock(&trace_types_lock); + + return ret; } #define for_each_event(event, start, end) \ From 2ba64035d0ca966fd189bc3e0826343fc81bf482 Mon Sep 17 00:00:00 2001 From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org> Date: Wed, 31 Jul 2013 13:16:22 -0400 Subject: [PATCH 703/913] tracing: Add comment to describe special break case in probe_remove_event_call() The "break" used in the do_for_each_event_file() is used as an optimization as the loop is really a double loop. The loop searches all event files for each trace_array. There's only one matching event file per trace_array and after we find the event file for the trace_array, the break is used to jump to the next trace_array and start the search there. As this is not a standard way of using "break" in C code, it requires a comment right before the break to let people know what is going on. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_events.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index ec04836273c0..29a7ebcfb426 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -1732,6 +1732,12 @@ static int probe_remove_event_call(struct ftrace_event_call *call) */ if (file->flags & FTRACE_EVENT_FL_ENABLED) return -EBUSY; + /* + * The do_for_each_event_file_safe() is + * a double loop. After finding the call for this + * trace_array, we use break to jump to the next + * trace_array. + */ break; } while_for_each_event_file(); From 8e552e535948fe8612d36a7beaf19519140bc285 Mon Sep 17 00:00:00 2001 From: Yonghua Zheng <younghua.zheng@gmail.com> Date: Tue, 30 Jul 2013 14:16:10 +0800 Subject: [PATCH 704/913] HID: hidraw: fix improper mutex release Mutex can not be released unless all hid_device members are properly initialized. Otherwise it would result in a race condition that can cause NULL pointer kernel panic issue in hidraw_open where it uses uninitialized 'list' member in list_add_tail(). Signed-off-by: Yonghua Zheng <younghua.zheng@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> --- drivers/hid/hidraw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index a7451632ceb4..6f1feb2c2e97 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -518,7 +518,6 @@ int hidraw_connect(struct hid_device *hid) goto out; } - mutex_unlock(&minors_lock); init_waitqueue_head(&dev->wait); INIT_LIST_HEAD(&dev->list); @@ -528,6 +527,7 @@ int hidraw_connect(struct hid_device *hid) dev->exist = 1; hid->hidraw = dev; + mutex_unlock(&minors_lock); out: return result; From 008eb957dafea32bac993be5cbeaf4ca0ee8b0aa Mon Sep 17 00:00:00 2001 From: James Hogan <james.hogan@imgtec.com> Date: Fri, 26 Jul 2013 13:34:43 +0100 Subject: [PATCH 705/913] usb: xhci: add missing dma-mapping.h includes A randconfig build hit the following build errors because xhci.c and xhci-mem.c use dma mapping functions but don't include <linux/dma-mapping.h>. Add the missing includes to fix the build errors. drivers/usb/host/xhci.c In function 'xhci_gen_setup': drivers/usb/host/xhci.c +4872 : error: implicit declaration of function 'dma_set_mask' drivers/usb/host/xhci.c +4872 : error: implicit declaration of function 'DMA_BIT_MASK' drivers/usb/host/xhci-mem.c In function 'xhci_free_stream_ctx': drivers/usb/host/xhci-mem.c +435 : error: implicit declaration of function 'dma_free_coherent' drivers/usb/host/xhci-mem.c In function 'xhci_alloc_stream_ctx': drivers/usb/host/xhci-mem.c +463 : error: implicit declaration of function 'dma_alloc_coherent' Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-usb@vger.kernel.org Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> --- drivers/usb/host/xhci-mem.c | 1 + drivers/usb/host/xhci.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index df6978abd7e6..6f8c2fd47675 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -24,6 +24,7 @@ #include <linux/pci.h> #include <linux/slab.h> #include <linux/dmapool.h> +#include <linux/dma-mapping.h> #include "xhci.h" diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 41eb4fc33453..9478caa2f71f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -27,6 +27,7 @@ #include <linux/moduleparam.h> #include <linux/slab.h> #include <linux/dmi.h> +#include <linux/dma-mapping.h> #include "xhci.h" From 953b3539ef9301b8ef73f4b6e2fd824b86aae65a Mon Sep 17 00:00:00 2001 From: Avinash Patil <patila@marvell.com> Date: Mon, 29 Jul 2013 16:32:37 -0700 Subject: [PATCH 706/913] mwifiex: check for bss_role instead of bss_mode for STA operations This patch fixes an issue wherein association would fail on P2P interfaces. This happened because we are checking priv->mode against NL80211_IFTYPE_STATION. While this check is correct for infrastructure stations, it would fail P2P clients for which mode is NL80211_IFTYPE_P2P_CLIENT. Better check would be bss_role which has only 2 values: STA/AP. Cc: <stable@vger.kernel.org> # 3.10.y Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Stone Piao <piaoyun@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/mwifiex/cfg80211.c | 4 ++-- drivers/net/wireless/mwifiex/join.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index ef5fa890a286..89459db4c53b 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c @@ -1716,9 +1716,9 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); int ret; - if (priv->bss_mode != NL80211_IFTYPE_STATION) { + if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) { wiphy_err(wiphy, - "%s: reject infra assoc request in non-STA mode\n", + "%s: reject infra assoc request in non-STA role\n", dev->name); return -EINVAL; } diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index 1c8a771e8e81..12e778159ec5 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c @@ -1291,8 +1291,10 @@ int mwifiex_associate(struct mwifiex_private *priv, { u8 current_bssid[ETH_ALEN]; - /* Return error if the adapter or table entry is not marked as infra */ - if ((priv->bss_mode != NL80211_IFTYPE_STATION) || + /* Return error if the adapter is not STA role or table entry + * is not marked as infra. + */ + if ((GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) || (bss_desc->bss_mode != NL80211_IFTYPE_STATION)) return -1; From 237b2ac8ac89a6b0120decdd05c7bf4637deb98a Mon Sep 17 00:00:00 2001 From: Avinash Patil <patila@marvell.com> Date: Mon, 29 Jul 2013 16:32:38 -0700 Subject: [PATCH 707/913] mwifiex: fix wrong data rates in P2P client This patch fixes an issue wherein adhoc rates were being copied into association request from P2P client. Cc: <stable@vger.kernel.org> # 3.10.y Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Stone Piao <piaoyun@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/mwifiex/cfp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c index 988552dece75..5178c4630d89 100644 --- a/drivers/net/wireless/mwifiex/cfp.c +++ b/drivers/net/wireless/mwifiex/cfp.c @@ -415,7 +415,8 @@ u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates) u32 k = 0; struct mwifiex_adapter *adapter = priv->adapter; - if (priv->bss_mode == NL80211_IFTYPE_STATION) { + if (priv->bss_mode == NL80211_IFTYPE_STATION || + priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) { switch (adapter->config_bands) { case BAND_B: dev_dbg(adapter->dev, "info: infra band=%d " From 6621fe18cdce50df9c3954f878183321dfe3078c Mon Sep 17 00:00:00 2001 From: Stone Piao <piaoyun@marvell.com> Date: Mon, 29 Jul 2013 16:32:39 -0700 Subject: [PATCH 708/913] mwifiex: fix command 0x2c timeout during p2p_find or p2p_connect We missed bss_mode check for P2P client. Signed-off-by: Stone Piao <piaoyun@marvell.com> Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/mwifiex/sta_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 206c3e038072..8af97abf7108 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c @@ -257,10 +257,10 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, goto done; } - if (priv->bss_mode == NL80211_IFTYPE_STATION) { + if (priv->bss_mode == NL80211_IFTYPE_STATION || + priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) { u8 config_bands; - /* Infra mode */ ret = mwifiex_deauthenticate(priv, NULL); if (ret) goto done; From d6158a55738863b3fe2d48bbb3bf33005ef834b8 Mon Sep 17 00:00:00 2001 From: Luciano Coelho <coelho@ti.com> Date: Tue, 30 Jul 2013 20:45:41 +0300 Subject: [PATCH 709/913] MAINTAINERS: change email of TI WiLink drivers' maintainer Soon the coelho@ti.com email will not be valid anymore, so change it to my private one. Cc: Luciano Coelho <luca@coelho.fi> Signed-off-by: Luciano Coelho <coelho@ti.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 7a403ba167d2..6447bec7f33f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8272,7 +8272,7 @@ S: Maintained F: sound/soc/codecs/twl4030* TI WILINK WIRELESS DRIVERS -M: Luciano Coelho <coelho@ti.com> +M: Luciano Coelho <luca@coelho.fi> L: linux-wireless@vger.kernel.org W: http://wireless.kernel.org/en/users/Drivers/wl12xx W: http://wireless.kernel.org/en/users/Drivers/wl1251 From 3eac103f83ab0c2013b734981d92d56be51a1a9c Mon Sep 17 00:00:00 2001 From: Jack Morgenstein <jackm@dev.mellanox.co.il> Date: Thu, 18 Jul 2013 14:02:30 +0300 Subject: [PATCH 710/913] IB/mlx4: Use default pkey when creating tunnel QPs When creating tunnel QPs for special QP tunneling, look for the default pkey in the slave's virtual pkey table. If it is present, use the real pkey index where the default pkey is located. If the default pkey is not found in the pkey table, use the real pkey index which is stored at index 0 in the slave's virtual pkey table (this is the current behavior). This change is required to support cloud computing, where the paravirtualized index of the default pkey is moved to index 1 or higher. The pkey at paravirtualized index 0 is used for the default IPoIB interface created by the VF. Its possible for the pkey value at paravirtualized index 0 to be invalid (zero) at VF probe time (pkey index 0 is mapped to real pkey index 127, which contains pkey = 0). At some point after the VF probe, the cloud computing interface at the hypervisor maps virtual index 0 for the VF to the pkey index containing the pkey that IPoIB will use in its operation. However, when the tunnel QP is created, the pkey at the slave's virtual index 0 is still mapped to the invalid pkey index, so tunnel QP creation fails. This commit causes the hypervisor to search for the default pkey in the slave's pkey table -- and this pkey is present in the table (at index > 0) at tunnel QP creation time, so that the tunnel QP creation will succeed. Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/hw/mlx4/mad.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 4d599cedbb0b..f2a3f48107e7 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -1511,8 +1511,14 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx, memset(&attr, 0, sizeof attr); attr.qp_state = IB_QPS_INIT; - attr.pkey_index = - to_mdev(ctx->ib_dev)->pkeys.virt2phys_pkey[ctx->slave][ctx->port - 1][0]; + ret = 0; + if (create_tun) + ret = find_slave_port_pkey_ix(to_mdev(ctx->ib_dev), ctx->slave, + ctx->port, IB_DEFAULT_PKEY_FULL, + &attr.pkey_index); + if (ret || !create_tun) + attr.pkey_index = + to_mdev(ctx->ib_dev)->pkeys.virt2phys_pkey[ctx->slave][ctx->port - 1][0]; attr.qkey = IB_QP1_QKEY; attr.port_num = ctx->port; ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT); From f928d4f2a86f46b030fa0850385b4391fc2b5918 Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Thu, 4 Jul 2013 11:00:23 +0100 Subject: [PATCH 711/913] ARM: poison the vectors page Fill the empty regions of the vectors page with an exception generating instruction. This ensures that any inappropriate branch to the vector page is appropriately trapped, rather than just encountering some code to execute. (The vectors page was filled with zero before, which corresponds with the "andeq r0, r0, r0" instruction - a no-op.) Cc: <stable@vger.kernel.org> Acked-by Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/kernel/traps.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index cab094c234ee..9433e8a12b5e 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -818,9 +818,19 @@ void __init early_trap_init(void *vectors_base) extern char __vectors_start[], __vectors_end[]; extern char __kuser_helper_start[], __kuser_helper_end[]; int kuser_sz = __kuser_helper_end - __kuser_helper_start; + unsigned i; vectors_page = vectors_base; + /* + * Poison the vectors page with an undefined instruction. This + * instruction is chosen to be undefined for both ARM and Thumb + * ISAs. The Thumb version is an undefined instruction with a + * branch back to the undefined instruction. + */ + for (i = 0; i < PAGE_SIZE / sizeof(u32); i++) + ((u32 *)vectors_base)[i] = 0xe7fddef1; + /* * Copy the vectors, stubs and kuser helpers (in entry-armv.S) * into the vector page, mapped at 0xffff0000, and ensure these From 5b43e7a383d69381ffe53423e46dd0fafae07da3 Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Thu, 4 Jul 2013 11:32:04 +0100 Subject: [PATCH 712/913] ARM: poison memory between kuser helpers Poison the memory between each kuser helper. This ensures that any branch between the kuser helpers will be appropriately trapped. Cc: <stable@vger.kernel.org> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/kernel/entry-armv.S | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index a39cfc2a1f90..02437345289a 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -742,6 +742,17 @@ ENDPROC(__switch_to) #endif .endm + .macro kuser_pad, sym, size + .if (. - \sym) & 3 + .rept 4 - (. - \sym) & 3 + .byte 0 + .endr + .endif + .rept (\size - (. - \sym)) / 4 + .word 0xe7fddef1 + .endr + .endm + .align 5 .globl __kuser_helper_start __kuser_helper_start: @@ -832,18 +843,13 @@ kuser_cmpxchg64_fixup: #error "incoherent kernel configuration" #endif - /* pad to next slot */ - .rept (16 - (. - __kuser_cmpxchg64)/4) - .word 0 - .endr - - .align 5 + kuser_pad __kuser_cmpxchg64, 64 __kuser_memory_barrier: @ 0xffff0fa0 smp_dmb arm usr_ret lr - .align 5 + kuser_pad __kuser_memory_barrier, 32 __kuser_cmpxchg: @ 0xffff0fc0 @@ -916,13 +922,14 @@ kuser_cmpxchg32_fixup: #endif - .align 5 + kuser_pad __kuser_cmpxchg, 32 __kuser_get_tls: @ 0xffff0fe0 ldr r0, [pc, #(16 - 8)] @ read TLS, set in kuser_get_tls_init usr_ret lr mrc p15, 0, r0, c13, c0, 3 @ 0xffff0fe8 hardware TLS code - .rep 4 + kuser_pad __kuser_get_tls, 16 + .rep 3 .word 0 @ 0xffff0ff0 software TLS value, then .endr @ pad up to __kuser_helper_version From 19accfd373847ac3d10623c5d20f948846299741 Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Thu, 4 Jul 2013 11:40:32 +0100 Subject: [PATCH 713/913] ARM: move vector stubs Move the machine vector stubs into the page above the vector page, which we can prevent from being visible to userspace. Also move the reset stub, and place the swi vector at a location that the 'ldr' can get to it. This hides pointers into the kernel which could give valuable information to attackers, and reduces the number of exploitable instructions at a fixed address. Cc: <stable@vger.kernel.org> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/Kconfig | 3 ++- arch/arm/kernel/entry-armv.S | 50 +++++++++++++++++------------------- arch/arm/kernel/traps.c | 4 +-- arch/arm/mm/mmu.c | 10 +++++++- 4 files changed, 37 insertions(+), 30 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ba412e02ec0c..123b7924904f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -218,7 +218,8 @@ config VECTORS_BASE default DRAM_BASE if REMAP_VECTORS_TO_RAM default 0x00000000 help - The base address of exception vectors. + The base address of exception vectors. This must be two pages + in size. config ARM_PATCH_PHYS_VIRT bool "Patch physical to virtual translations at runtime" if EMBEDDED diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 02437345289a..79a41fa978f5 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -944,9 +944,9 @@ __kuser_helper_end: /* * Vector stubs. * - * This code is copied to 0xffff0200 so we can use branches in the - * vectors, rather than ldr's. Note that this code must not - * exceed 0x300 bytes. + * This code is copied to 0xffff1000 so we can use branches in the + * vectors, rather than ldr's. Note that this code must not exceed + * a page size. * * Common stub entry macro: * Enter in IRQ mode, spsr = SVC/USR CPSR, lr = SVC/USR PC @@ -995,6 +995,15 @@ ENDPROC(vector_\name) .globl __stubs_start __stubs_start: + @ This must be the first word + .word vector_swi + +vector_rst: + ARM( swi SYS_ERROR0 ) + THUMB( svc #0 ) + THUMB( nop ) + b vector_und + /* * Interrupt dispatcher */ @@ -1088,6 +1097,16 @@ __stubs_start: .align 5 +/*============================================================================= + * Address exception handler + *----------------------------------------------------------------------------- + * These aren't too critical. + * (they're not supposed to happen, and won't happen in 32-bit data mode). + */ + +vector_addrexcptn: + b vector_addrexcptn + /*============================================================================= * Undefined FIQs *----------------------------------------------------------------------------- @@ -1101,35 +1120,14 @@ __stubs_start: vector_fiq: subs pc, lr, #4 -/*============================================================================= - * Address exception handler - *----------------------------------------------------------------------------- - * These aren't too critical. - * (they're not supposed to happen, and won't happen in 32-bit data mode). - */ - -vector_addrexcptn: - b vector_addrexcptn - -/* - * We group all the following data together to optimise - * for CPUs with separate I & D caches. - */ - .align 5 - -.LCvswi: - .word vector_swi - .globl __stubs_end __stubs_end: - .equ stubs_offset, __vectors_start + 0x200 - __stubs_start + .equ stubs_offset, __vectors_start + 0x1000 - __stubs_start .globl __vectors_start __vectors_start: - ARM( swi SYS_ERROR0 ) - THUMB( svc #0 ) - THUMB( nop ) + W(b) vector_rst + stubs_offset W(b) vector_und + stubs_offset W(ldr) pc, .LCvswi + stubs_offset W(b) vector_pabt + stubs_offset diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 9433e8a12b5e..2c8c7fa78b8c 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -837,7 +837,7 @@ void __init early_trap_init(void *vectors_base) * are visible to the instruction stream. */ memcpy((void *)vectors, __vectors_start, __vectors_end - __vectors_start); - memcpy((void *)vectors + 0x200, __stubs_start, __stubs_end - __stubs_start); + memcpy((void *)vectors + 0x1000, __stubs_start, __stubs_end - __stubs_start); memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz); /* @@ -852,7 +852,7 @@ void __init early_trap_init(void *vectors_base) memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE), sigreturn_codes, sizeof(sigreturn_codes)); - flush_icache_range(vectors, vectors + PAGE_SIZE); + flush_icache_range(vectors, vectors + PAGE_SIZE * 2); modify_domain(DOMAIN_USER, DOMAIN_CLIENT); #else /* ifndef CONFIG_CPU_V7M */ /* diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 4f56617a2392..9ea274d1af69 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1160,7 +1160,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc) /* * Allocate the vector page early. */ - vectors = early_alloc(PAGE_SIZE); + vectors = early_alloc(PAGE_SIZE * 2); early_trap_init(vectors); @@ -1210,10 +1210,18 @@ static void __init devicemaps_init(struct machine_desc *mdesc) if (!vectors_high()) { map.virtual = 0; + map.length = PAGE_SIZE * 2; map.type = MT_LOW_VECTORS; create_mapping(&map); } + /* Now create a kernel read-only mapping */ + map.pfn += 1; + map.virtual = 0xffff0000 + PAGE_SIZE; + map.length = PAGE_SIZE; + map.type = MT_LOW_VECTORS; + create_mapping(&map); + /* * Ask the machine support to map in the statically mapped devices. */ From b9b32bf70f2fb710b07c94e13afbc729afe221da Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Thu, 4 Jul 2013 12:03:31 +0100 Subject: [PATCH 714/913] ARM: use linker magic for vectors and vector stubs Use linker magic to create the vectors and vector stubs: we can tell the linker to place them at an appropriate VMA, but keep the LMA within the kernel. This gets rid of some unnecessary symbol manipulation, and have the linker calculate the relocations appropriately. Cc: <stable@vger.kernel.org> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/kernel/entry-armv.S | 28 ++++++++++------------------ arch/arm/kernel/vmlinux.lds.S | 17 +++++++++++++++++ 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 79a41fa978f5..7e1ae91e5b1a 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -993,7 +993,7 @@ ENDPROC(vector_\name) 1: .endm - .globl __stubs_start + .section .stubs, "ax", %progbits __stubs_start: @ This must be the first word .word vector_swi @@ -1120,24 +1120,16 @@ vector_addrexcptn: vector_fiq: subs pc, lr, #4 - .globl __stubs_end -__stubs_end: - - .equ stubs_offset, __vectors_start + 0x1000 - __stubs_start - - .globl __vectors_start + .section .vectors, "ax", %progbits __vectors_start: - W(b) vector_rst + stubs_offset - W(b) vector_und + stubs_offset - W(ldr) pc, .LCvswi + stubs_offset - W(b) vector_pabt + stubs_offset - W(b) vector_dabt + stubs_offset - W(b) vector_addrexcptn + stubs_offset - W(b) vector_irq + stubs_offset - W(b) vector_fiq + stubs_offset - - .globl __vectors_end -__vectors_end: + W(b) vector_rst + W(b) vector_und + W(ldr) pc, __vectors_start + 0x1000 + W(b) vector_pabt + W(b) vector_dabt + W(b) vector_addrexcptn + W(b) vector_irq + W(b) vector_fiq .data diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index fa25e4e425f6..7bcee5c9b604 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -148,6 +148,23 @@ SECTIONS . = ALIGN(PAGE_SIZE); __init_begin = .; #endif + /* + * The vectors and stubs are relocatable code, and the + * only thing that matters is their relative offsets + */ + __vectors_start = .; + .vectors 0 : AT(__vectors_start) { + *(.vectors) + } + . = __vectors_start + SIZEOF(.vectors); + __vectors_end = .; + + __stubs_start = .; + .stubs 0x1000 : AT(__stubs_start) { + *(.stubs) + } + . = __stubs_start + SIZEOF(.stubs); + __stubs_end = .; INIT_TEXT_SECTION(8) .exit.text : { From e39e3f3ebfef03450cf7bfa7a974a8c61f7980c8 Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Tue, 9 Jul 2013 01:03:17 +0100 Subject: [PATCH 715/913] ARM: update FIQ support for relocation of vectors FIQ should no longer copy the FIQ code into the user visible vector page. Instead, it should use the hidden page. This change makes that happen. Cc: <stable@vger.kernel.org> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/kernel/entry-armv.S | 3 +++ arch/arm/kernel/fiq.c | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 7e1ae91e5b1a..94caefb550bf 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -1120,6 +1120,9 @@ vector_addrexcptn: vector_fiq: subs pc, lr, #4 + .globl vector_fiq_offset + .equ vector_fiq_offset, vector_fiq + .section .vectors, "ax", %progbits __vectors_start: W(b) vector_rst diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c index 2adda11f712f..25442f451148 100644 --- a/arch/arm/kernel/fiq.c +++ b/arch/arm/kernel/fiq.c @@ -47,6 +47,11 @@ #include <asm/irq.h> #include <asm/traps.h> +#define FIQ_OFFSET ({ \ + extern void *vector_fiq_offset; \ + (unsigned)&vector_fiq_offset; \ + }) + static unsigned long no_fiq_insn; /* Default reacquire function @@ -80,13 +85,16 @@ int show_fiq_list(struct seq_file *p, int prec) void set_fiq_handler(void *start, unsigned int length) { #if defined(CONFIG_CPU_USE_DOMAINS) - memcpy((void *)0xffff001c, start, length); + void *base = (void *)0xffff0000; #else - memcpy(vectors_page + 0x1c, start, length); + void *base = vectors_page; #endif - flush_icache_range(0xffff001c, 0xffff001c + length); + unsigned offset = FIQ_OFFSET; + + memcpy(base + offset, start, length); + flush_icache_range(0xffff0000 + offset, 0xffff0000 + offset + length); if (!vectors_high()) - flush_icache_range(0x1c, 0x1c + length); + flush_icache_range(offset, offset + length); } int claim_fiq(struct fiq_handler *f) @@ -144,6 +152,7 @@ EXPORT_SYMBOL(disable_fiq); void __init init_FIQ(int start) { - no_fiq_insn = *(unsigned long *)0xffff001c; + unsigned offset = FIQ_OFFSET; + no_fiq_insn = *(unsigned long *)(0xffff0000 + offset); fiq_start = start; } From f6f91b0d9fd971c630cef908dde8fe8795aefbf8 Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Tue, 23 Jul 2013 18:37:00 +0100 Subject: [PATCH 716/913] ARM: allow kuser helpers to be removed from the vector page Provide a kernel configuration option to allow the kernel user helpers to be removed from the vector page, thereby preventing their use with ROP (return orientated programming) attacks. This option is only visible for CPU architectures which natively support all the operations which kernel user helpers would normally provide, and must be enabled with caution. Cc: <stable@vger.kernel.org> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/kernel/entry-armv.S | 3 +++ arch/arm/kernel/traps.c | 23 ++++++++++++++--------- arch/arm/mm/Kconfig | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 9 deletions(-) diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 94caefb550bf..d40d0ef389db 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -753,6 +753,7 @@ ENDPROC(__switch_to) .endr .endm +#ifdef CONFIG_KUSER_HELPERS .align 5 .globl __kuser_helper_start __kuser_helper_start: @@ -939,6 +940,8 @@ __kuser_helper_version: @ 0xffff0ffc .globl __kuser_helper_end __kuser_helper_end: +#endif + THUMB( .thumb ) /* diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 2c8c7fa78b8c..e3ca35ccd38e 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -800,15 +800,26 @@ void __init trap_init(void) return; } -static void __init kuser_get_tls_init(unsigned long vectors) +#ifdef CONFIG_KUSER_HELPERS +static void __init kuser_init(void *vectors) { + extern char __kuser_helper_start[], __kuser_helper_end[]; + int kuser_sz = __kuser_helper_end - __kuser_helper_start; + + memcpy(vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz); + /* * vectors + 0xfe0 = __kuser_get_tls * vectors + 0xfe8 = hardware TLS instruction at 0xffff0fe8 */ if (tls_emu || has_tls_reg) - memcpy((void *)vectors + 0xfe0, (void *)vectors + 0xfe8, 4); + memcpy(vectors + 0xfe0, vectors + 0xfe8, 4); } +#else +static void __init kuser_init(void *vectors) +{ +} +#endif void __init early_trap_init(void *vectors_base) { @@ -816,8 +827,6 @@ void __init early_trap_init(void *vectors_base) unsigned long vectors = (unsigned long)vectors_base; extern char __stubs_start[], __stubs_end[]; extern char __vectors_start[], __vectors_end[]; - extern char __kuser_helper_start[], __kuser_helper_end[]; - int kuser_sz = __kuser_helper_end - __kuser_helper_start; unsigned i; vectors_page = vectors_base; @@ -838,12 +847,8 @@ void __init early_trap_init(void *vectors_base) */ memcpy((void *)vectors, __vectors_start, __vectors_end - __vectors_start); memcpy((void *)vectors + 0x1000, __stubs_start, __stubs_end - __stubs_start); - memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz); - /* - * Do processor specific fixups for the kuser helpers - */ - kuser_get_tls_init(vectors); + kuser_init(vectors_base); /* * Copy signal return handlers into the vector page, and diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index 6cacdc8dd654..db5c2cab8fda 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig @@ -421,24 +421,28 @@ config CPU_32v3 select CPU_USE_DOMAINS if MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP select TLS_REG_EMUL if SMP || !MMU + select NEED_KUSER_HELPERS config CPU_32v4 bool select CPU_USE_DOMAINS if MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP select TLS_REG_EMUL if SMP || !MMU + select NEED_KUSER_HELPERS config CPU_32v4T bool select CPU_USE_DOMAINS if MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP select TLS_REG_EMUL if SMP || !MMU + select NEED_KUSER_HELPERS config CPU_32v5 bool select CPU_USE_DOMAINS if MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP select TLS_REG_EMUL if SMP || !MMU + select NEED_KUSER_HELPERS config CPU_32v6 bool @@ -776,6 +780,7 @@ config CPU_BPREDICT_DISABLE config TLS_REG_EMUL bool + select NEED_KUSER_HELPERS help An SMP system using a pre-ARMv6 processor (there are apparently a few prototypes like that in existence) and therefore access to @@ -783,11 +788,40 @@ config TLS_REG_EMUL config NEEDS_SYSCALL_FOR_CMPXCHG bool + select NEED_KUSER_HELPERS help SMP on a pre-ARMv6 processor? Well OK then. Forget about fast user space cmpxchg support. It is just not possible. +config NEED_KUSER_HELPERS + bool + +config KUSER_HELPERS + bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS + default y + help + Warning: disabling this option may break user programs. + + Provide kuser helpers in the vector page. The kernel provides + helper code to userspace in read only form at a fixed location + in the high vector page to allow userspace to be independent of + the CPU type fitted to the system. This permits binaries to be + run on ARMv4 through to ARMv7 without modification. + + However, the fixed address nature of these helpers can be used + by ROP (return orientated programming) authors when creating + exploits. + + If all of the binaries and libraries which run on your platform + are built specifically for your platform, and make no use of + these helpers, then you can turn this option off. However, + when such an binary or library is run, it will receive a SIGILL + signal, which will terminate the program. + + Say N here only if you are absolutely certain that you do not + need these helpers; otherwise, the safe option is to say Y. + config DMA_CACHE_RWFO bool "Enable read/write for ownership DMA cache maintenance" depends on CPU_V6K && SMP From 281d1a9211986cfdccbefcd6128049a0a0d473b2 Mon Sep 17 00:00:00 2001 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Date: Tue, 30 Jul 2013 07:54:26 +0800 Subject: [PATCH 717/913] IB/mlx5: Fix error return code in init_one() Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/hw/mlx5/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 8000fff4d444..b1cbf338bcf6 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -1426,7 +1426,8 @@ static int init_one(struct pci_dev *pdev, if (err) goto err_eqs; - if (ib_register_device(&dev->ib_dev, NULL)) + err = ib_register_device(&dev->ib_dev, NULL); + if (err) goto err_rsrc; err = create_umr_res(dev); @@ -1434,8 +1435,9 @@ static int init_one(struct pci_dev *pdev, goto err_dev; for (i = 0; i < ARRAY_SIZE(mlx5_class_attributes); i++) { - if (device_create_file(&dev->ib_dev.dev, - mlx5_class_attributes[i])) + err = device_create_file(&dev->ib_dev.dev, + mlx5_class_attributes[i]); + if (err) goto err_umrc; } From 92b0ca7cb149d20bd97a2ad88d860745045a77dc Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Thu, 25 Jul 2013 20:04:36 +0300 Subject: [PATCH 718/913] IB/mlx5: Fix stack info leak in mlx5_ib_alloc_ucontext() We don't set "resp.reserved". Since it's at the end of the struct that means we don't have to copy it to the user. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Eli Cohen <eli@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/hw/mlx5/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index b1cbf338bcf6..3f831de9a4d8 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -619,7 +619,8 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, resp.tot_uuars = req.total_num_uuars; resp.num_ports = dev->mdev.caps.num_ports; - err = ib_copy_to_udata(udata, &resp, sizeof(resp)); + err = ib_copy_to_udata(udata, &resp, + sizeof(resp) - sizeof(resp.reserved)); if (err) goto out_uars; From 11940c8728b8e4bd67d0afacefbb9391ff8f4201 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Mon, 22 Jul 2013 11:02:01 +0300 Subject: [PATCH 719/913] mlx5_core: Fix use after free in mlx5_cmd_comp_handler() We can't dereference "ent" after passing it to free_cmd(). Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Eli Cohen <eli@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index 205753a04cfc..40374063c01e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -1113,7 +1113,13 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector) for (i = 0; i < (1 << cmd->log_sz); i++) { if (test_bit(i, &vector)) { + struct semaphore *sem; + ent = cmd->ent_arr[i]; + if (ent->page_queue) + sem = &cmd->pages_sem; + else + sem = &cmd->sem; ktime_get_ts(&ent->ts2); memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); dump_command(dev, ent, 0); @@ -1136,10 +1142,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector) } else { complete(&ent->done); } - if (ent->page_queue) - up(&cmd->pages_sem); - else - up(&cmd->sem); + up(sem); } } } From cd23b14b654769db83c9684ae1ba32c0e066670f Mon Sep 17 00:00:00 2001 From: Eli Cohen <eli@dev.mellanox.co.il> Date: Thu, 18 Jul 2013 15:31:08 +0300 Subject: [PATCH 720/913] mlx5_core: Implement new initialization sequence Introduce enbale_hca and disable_hca commands to signify when the driver starts or ceases to operate on the device. In addition the driver will use boot and init pages count; boot pages is required to allow firmware to complete boot commands and the other to complete init hca. Command interface revision is bumped to 4 to enforce using supported firmware. This patch breaks compatibility with old versions of firmware (< 4); however, the first GA firmware we will publish will support version 4 so this should not be a problem. Signed-off-by: Eli Cohen <eli@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 8 ++- .../net/ethernet/mellanox/mlx5/core/main.c | 69 +++++++++++++++++-- .../ethernet/mellanox/mlx5/core/pagealloc.c | 20 ++++-- include/linux/mlx5/device.h | 20 ++++++ include/linux/mlx5/driver.h | 4 +- 5 files changed, 106 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index 40374063c01e..c571de85d0f9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -46,7 +46,7 @@ #include "mlx5_core.h" enum { - CMD_IF_REV = 3, + CMD_IF_REV = 4, }; enum { @@ -282,6 +282,12 @@ const char *mlx5_command_str(int command) case MLX5_CMD_OP_TEARDOWN_HCA: return "TEARDOWN_HCA"; + case MLX5_CMD_OP_ENABLE_HCA: + return "MLX5_CMD_OP_ENABLE_HCA"; + + case MLX5_CMD_OP_DISABLE_HCA: + return "MLX5_CMD_OP_DISABLE_HCA"; + case MLX5_CMD_OP_QUERY_PAGES: return "QUERY_PAGES"; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 12242de2b0e3..b47739b0b5f6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -249,6 +249,44 @@ static int set_hca_ctrl(struct mlx5_core_dev *dev) return err; } +static int mlx5_core_enable_hca(struct mlx5_core_dev *dev) +{ + int err; + struct mlx5_enable_hca_mbox_in in; + struct mlx5_enable_hca_mbox_out out; + + memset(&in, 0, sizeof(in)); + memset(&out, 0, sizeof(out)); + in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_ENABLE_HCA); + err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); + if (err) + return err; + + if (out.hdr.status) + return mlx5_cmd_status_to_err(&out.hdr); + + return 0; +} + +static int mlx5_core_disable_hca(struct mlx5_core_dev *dev) +{ + int err; + struct mlx5_disable_hca_mbox_in in; + struct mlx5_disable_hca_mbox_out out; + + memset(&in, 0, sizeof(in)); + memset(&out, 0, sizeof(out)); + in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DISABLE_HCA); + err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); + if (err) + return err; + + if (out.hdr.status) + return mlx5_cmd_status_to_err(&out.hdr); + + return 0; +} + int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev) { struct mlx5_priv *priv = &dev->priv; @@ -304,28 +342,41 @@ int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev) } mlx5_pagealloc_init(dev); + + err = mlx5_core_enable_hca(dev); + if (err) { + dev_err(&pdev->dev, "enable hca failed\n"); + goto err_pagealloc_cleanup; + } + + err = mlx5_satisfy_startup_pages(dev, 1); + if (err) { + dev_err(&pdev->dev, "failed to allocate boot pages\n"); + goto err_disable_hca; + } + err = set_hca_ctrl(dev); if (err) { dev_err(&pdev->dev, "set_hca_ctrl failed\n"); - goto err_pagealloc_cleanup; + goto reclaim_boot_pages; } err = handle_hca_cap(dev); if (err) { dev_err(&pdev->dev, "handle_hca_cap failed\n"); - goto err_pagealloc_cleanup; + goto reclaim_boot_pages; } - err = mlx5_satisfy_startup_pages(dev); + err = mlx5_satisfy_startup_pages(dev, 0); if (err) { - dev_err(&pdev->dev, "failed to allocate startup pages\n"); - goto err_pagealloc_cleanup; + dev_err(&pdev->dev, "failed to allocate init pages\n"); + goto reclaim_boot_pages; } err = mlx5_pagealloc_start(dev); if (err) { dev_err(&pdev->dev, "mlx5_pagealloc_start failed\n"); - goto err_reclaim_pages; + goto reclaim_boot_pages; } err = mlx5_cmd_init_hca(dev); @@ -396,9 +447,12 @@ err_stop_poll: err_pagealloc_stop: mlx5_pagealloc_stop(dev); -err_reclaim_pages: +reclaim_boot_pages: mlx5_reclaim_startup_pages(dev); +err_disable_hca: + mlx5_core_disable_hca(dev); + err_pagealloc_cleanup: mlx5_pagealloc_cleanup(dev); mlx5_cmd_cleanup(dev); @@ -434,6 +488,7 @@ void mlx5_dev_cleanup(struct mlx5_core_dev *dev) mlx5_cmd_teardown_hca(dev); mlx5_pagealloc_stop(dev); mlx5_reclaim_startup_pages(dev); + mlx5_core_disable_hca(dev); mlx5_pagealloc_cleanup(dev); mlx5_cmd_cleanup(dev); iounmap(dev->iseg); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c index f0bf46339b28..4a3e137931a3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c @@ -64,7 +64,7 @@ struct mlx5_query_pages_inbox { struct mlx5_query_pages_outbox { struct mlx5_outbox_hdr hdr; - u8 reserved[2]; + __be16 num_boot_pages; __be16 func_id; __be16 init_pages; __be16 num_pages; @@ -146,7 +146,7 @@ static struct page *remove_page(struct mlx5_core_dev *dev, u64 addr) } static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, - s16 *pages, s16 *init_pages) + s16 *pages, s16 *init_pages, u16 *boot_pages) { struct mlx5_query_pages_inbox in; struct mlx5_query_pages_outbox out; @@ -164,8 +164,13 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, if (pages) *pages = be16_to_cpu(out.num_pages); + if (init_pages) *init_pages = be16_to_cpu(out.init_pages); + + if (boot_pages) + *boot_pages = be16_to_cpu(out.num_boot_pages); + *func_id = be16_to_cpu(out.func_id); return err; @@ -357,19 +362,22 @@ void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, queue_work(dev->priv.pg_wq, &req->work); } -int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev) +int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot) { + u16 uninitialized_var(boot_pages); s16 uninitialized_var(init_pages); u16 uninitialized_var(func_id); int err; - err = mlx5_cmd_query_pages(dev, &func_id, NULL, &init_pages); + err = mlx5_cmd_query_pages(dev, &func_id, NULL, &init_pages, + &boot_pages); if (err) return err; - mlx5_core_dbg(dev, "requested %d init pages for func_id 0x%x\n", init_pages, func_id); - return give_pages(dev, func_id, init_pages, 0); + mlx5_core_dbg(dev, "requested %d init pages and %d boot pages for func_id 0x%x\n", + init_pages, boot_pages, func_id); + return give_pages(dev, func_id, boot ? boot_pages : init_pages, 0); } static int optimal_reclaimed_pages(void) diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index 8de8d8f22384..737685e9e852 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h @@ -690,6 +690,26 @@ struct mlx5_query_cq_mbox_out { __be64 pas[0]; }; +struct mlx5_enable_hca_mbox_in { + struct mlx5_inbox_hdr hdr; + u8 rsvd[8]; +}; + +struct mlx5_enable_hca_mbox_out { + struct mlx5_outbox_hdr hdr; + u8 rsvd[8]; +}; + +struct mlx5_disable_hca_mbox_in { + struct mlx5_inbox_hdr hdr; + u8 rsvd[8]; +}; + +struct mlx5_disable_hca_mbox_out { + struct mlx5_outbox_hdr hdr; + u8 rsvd[8]; +}; + struct mlx5_eq_context { u8 status; u8 ec_oi; diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index f22e4419839b..2aa258b0ced1 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -101,6 +101,8 @@ enum { MLX5_CMD_OP_QUERY_ADAPTER = 0x101, MLX5_CMD_OP_INIT_HCA = 0x102, MLX5_CMD_OP_TEARDOWN_HCA = 0x103, + MLX5_CMD_OP_ENABLE_HCA = 0x104, + MLX5_CMD_OP_DISABLE_HCA = 0x105, MLX5_CMD_OP_QUERY_PAGES = 0x107, MLX5_CMD_OP_MANAGE_PAGES = 0x108, MLX5_CMD_OP_SET_HCA_CAP = 0x109, @@ -690,7 +692,7 @@ int mlx5_pagealloc_start(struct mlx5_core_dev *dev); void mlx5_pagealloc_stop(struct mlx5_core_dev *dev); void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, s16 npages); -int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev); +int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot); int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev); void mlx5_register_debugfs(void); void mlx5_unregister_debugfs(void); From 618af3846be1d29118b00529e68971e8c95d5b72 Mon Sep 17 00:00:00 2001 From: Andi Shyti <andi@etezian.org> Date: Tue, 16 Jul 2013 15:35:01 +0200 Subject: [PATCH 721/913] mlx5_core: Variable may be used uninitialized In the sq_overhead() function, if qp_typ is equal to IB_QPT_RC, size will be used uninitialized. Signed-off-by: Andi Shyti <andi@etezian.org> Acked-by: Eli Cohen <eli@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/hw/mlx5/qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 16ac54c9819f..045f8cdbd303 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -199,7 +199,7 @@ static int set_rq_size(struct mlx5_ib_dev *dev, struct ib_qp_cap *cap, static int sq_overhead(enum ib_qp_type qp_type) { - int size; + int size = 0; switch (qp_type) { case IB_QPT_XRC_INI: From ef5ed4166ffc192434a9d7324339ed1d308fc2dc Mon Sep 17 00:00:00 2001 From: Jack Morgenstein <jackm@dev.mellanox.co.il> Date: Thu, 18 Jul 2013 14:02:29 +0300 Subject: [PATCH 722/913] IB/core: Create QP1 using the pkey index which contains the default pkey Currently, QP1 is created using pkey index 0. This patch simply looks for the index containing the default pkey, rather than hard-coding pkey index 0. This change will have no effect in native mode, since QP0 and QP1 are created before the SM configures the port, so pkey table will still be the default table defined by the IB Spec, in C10-123: "If non-volatile storage is not used to hold P_Key Table contents, then if a PM (Partition Manager) is not present, and prior to PM initialization of the P_Key Table, the P_Key Table must act as if it contains a single valid entry, at P_Key_ix = 0, containing the default partition key. All other entries in the P_Key Table must be invalid." Thus, in the native mode case, the driver will find the default pkey at index 0 (so it will be no different than the hard-coding). However, in SR-IOV mode, for VFs, the pkey table may be paravirtualized, so that the VF's pkey index zero may not necessarily be mapped to the real pkey index 0. For VFs, therefore, it is important to find the virtual index which maps to the real default pkey. This commit does the following for QP1 creation: 1. Find the pkey index containing the default pkey, and use that index if found. ib_find_pkey() returns the index of the limited-membership default pkey (0x7FFF) if the full-member default pkey is not in the table. 2. If neither form of the default pkey is found, use pkey index 0 (previous behavior). Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Reviewed-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/core/mad.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index dc3fd1e8af07..4c837e66516b 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -2663,6 +2663,7 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) int ret, i; struct ib_qp_attr *attr; struct ib_qp *qp; + u16 pkey_index; attr = kmalloc(sizeof *attr, GFP_KERNEL); if (!attr) { @@ -2670,6 +2671,11 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) return -ENOMEM; } + ret = ib_find_pkey(port_priv->device, port_priv->port_num, + IB_DEFAULT_PKEY_FULL, &pkey_index); + if (ret) + pkey_index = 0; + for (i = 0; i < IB_MAD_QPS_CORE; i++) { qp = port_priv->qp_info[i].qp; if (!qp) @@ -2680,7 +2686,7 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) * one is needed for the Reset to Init transition */ attr->qp_state = IB_QPS_INIT; - attr->pkey_index = 0; + attr->pkey_index = pkey_index; attr->qkey = (qp->qp_num == 0) ? 0 : IB_QP1_QKEY; ret = ib_modify_qp(qp, attr, IB_QP_STATE | IB_QP_PKEY_INDEX | IB_QP_QKEY); From 3d790a4c269aefef8f6d32efb07333bc65bd43fe Mon Sep 17 00:00:00 2001 From: Or Gerlitz <ogerlitz@mellanox.com> Date: Thu, 18 Jul 2013 14:02:31 +0300 Subject: [PATCH 723/913] IPoIB: Make sure child devices use valid/proper pkeys Make sure that the IB invalid pkey (0x0000 or 0x8000) isn't used for child devices. Also, make sure to always set the full membership bit for the pkey of devices created by rtnl link ops. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 +- drivers/infiniband/ulp/ipoib/ipoib_netlink.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index b6e049a3c7a8..c6f71a88c55c 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -1461,7 +1461,7 @@ static ssize_t create_child(struct device *dev, if (sscanf(buf, "%i", &pkey) != 1) return -EINVAL; - if (pkey < 0 || pkey > 0xffff) + if (pkey <= 0 || pkey > 0xffff || pkey == 0x8000) return -EINVAL; /* diff --git a/drivers/infiniband/ulp/ipoib/ipoib_netlink.c b/drivers/infiniband/ulp/ipoib/ipoib_netlink.c index 74685936c948..f81abe16cf09 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_netlink.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_netlink.c @@ -119,6 +119,15 @@ static int ipoib_new_child_link(struct net *src_net, struct net_device *dev, } else child_pkey = nla_get_u16(data[IFLA_IPOIB_PKEY]); + if (child_pkey == 0 || child_pkey == 0x8000) + return -EINVAL; + + /* + * Set the full membership bit, so that we join the right + * broadcast group, etc. + */ + child_pkey |= 0x8000; + err = __ipoib_vlan_add(ppriv, netdev_priv(dev), child_pkey, IPOIB_RTNL_CHILD); if (!err && data) From c2904141696ee19551f1553944446f23cdd5d95e Mon Sep 17 00:00:00 2001 From: Erez Shitrit <erezsh@mellanox.com> Date: Thu, 18 Jul 2013 14:02:32 +0300 Subject: [PATCH 724/913] IPoIB: Fix pkey change flow for virtualization environments IPoIB's required behaviour w.r.t to the pkey used by the device is the following: - For "parent" interfaces (e.g ib0, ib1, etc) who are created automatically as a result of hot-plug events from the IB core, the driver needs to take whatever pkey vlaue it finds in index 0, and stick to that index. - For child interfaces (e.g ib0.8001, etc) created by admin directive, the driver needs to use and stick to the value provided during its creation. In SR-IOV environment its possible for the VF probe to take place before the cloud management software provisions the suitable pkey for the VF in the paravirtualed PKEY table index 0. When this is the case, the VF IB stack will find in index 0 an invalide pkey, which is all zeros. Moreover, the cloud managment can assign the pkey value at index 0 at any time of the guest life cycle. The correct behavior for IPoIB to address these requirements for parent interfaces is to use PKEY_CHANGE event as trigger to optionally re-init the device pkey value and re-create all the relevant resources accordingly, if the value of the pkey in index 0 has changed (from invalid to valid or from valid value X to invalid value Y). This patch enhances the heavy flushing code which is triggered by pkey change event, to behave correctly for parent devices. For child devices, the code remains the same, namely chases pkey value and not index. Signed-off-by: Erez Shitrit <erezsh@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com> --- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 76 ++++++++++++++++++++----- 1 file changed, 63 insertions(+), 13 deletions(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 2cfa76f5d99e..196b1d13cbcb 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -932,12 +932,47 @@ int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port) return 0; } +/* + * Takes whatever value which is in pkey index 0 and updates priv->pkey + * returns 0 if the pkey value was changed. + */ +static inline int update_parent_pkey(struct ipoib_dev_priv *priv) +{ + int result; + u16 prev_pkey; + + prev_pkey = priv->pkey; + result = ib_query_pkey(priv->ca, priv->port, 0, &priv->pkey); + if (result) { + ipoib_warn(priv, "ib_query_pkey port %d failed (ret = %d)\n", + priv->port, result); + return result; + } + + priv->pkey |= 0x8000; + + if (prev_pkey != priv->pkey) { + ipoib_dbg(priv, "pkey changed from 0x%x to 0x%x\n", + prev_pkey, priv->pkey); + /* + * Update the pkey in the broadcast address, while making sure to set + * the full membership bit, so that we join the right broadcast group. + */ + priv->dev->broadcast[8] = priv->pkey >> 8; + priv->dev->broadcast[9] = priv->pkey & 0xff; + return 0; + } + + return 1; +} + static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, enum ipoib_flush_level level) { struct ipoib_dev_priv *cpriv; struct net_device *dev = priv->dev; u16 new_index; + int result; mutex_lock(&priv->vlan_mutex); @@ -951,6 +986,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, mutex_unlock(&priv->vlan_mutex); if (!test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) { + /* for non-child devices must check/update the pkey value here */ + if (level == IPOIB_FLUSH_HEAVY && + !test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) + update_parent_pkey(priv); ipoib_dbg(priv, "Not flushing - IPOIB_FLAG_INITIALIZED not set.\n"); return; } @@ -961,21 +1000,32 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, } if (level == IPOIB_FLUSH_HEAVY) { - if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &new_index)) { - clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); - ipoib_ib_dev_down(dev, 0); - ipoib_ib_dev_stop(dev, 0); - if (ipoib_pkey_dev_delay_open(dev)) + /* child devices chase their origin pkey value, while non-child + * (parent) devices should always takes what present in pkey index 0 + */ + if (test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { + if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &new_index)) { + clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); + ipoib_ib_dev_down(dev, 0); + ipoib_ib_dev_stop(dev, 0); + if (ipoib_pkey_dev_delay_open(dev)) + return; + } + /* restart QP only if P_Key index is changed */ + if (test_and_set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags) && + new_index == priv->pkey_index) { + ipoib_dbg(priv, "Not flushing - P_Key index not changed.\n"); return; + } + priv->pkey_index = new_index; + } else { + result = update_parent_pkey(priv); + /* restart QP only if P_Key value changed */ + if (result) { + ipoib_dbg(priv, "Not flushing - P_Key value not changed.\n"); + return; + } } - - /* restart QP only if P_Key index is changed */ - if (test_and_set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags) && - new_index == priv->pkey_index) { - ipoib_dbg(priv, "Not flushing - P_Key index not changed.\n"); - return; - } - priv->pkey_index = new_index; } if (level == IPOIB_FLUSH_LIGHT) { From 3964acd0dbec123aa0a621973a2a0580034b4788 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Wed, 31 Jul 2013 13:53:28 -0700 Subject: [PATCH 725/913] mm: mempolicy: fix mbind_range() && vma_adjust() interaction vma_adjust() does vma_set_policy(vma, vma_policy(next)) and this is doubly wrong: 1. This leaks vma->vm_policy if it is not NULL and not equal to next->vm_policy. This can happen if vma_merge() expands "area", not prev (case 8). 2. This sets the wrong policy if vma_merge() joins prev and area, area is the vma the caller needs to update and it still has the old policy. Revert commit 1444f92c8498 ("mm: merging memory blocks resets mempolicy") which introduced these problems. Change mbind_range() to recheck mpol_equal() after vma_merge() to fix the problem that commit tried to address. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Steven T Hampson <steven.t.hampson@intel.com> Cc: Mel Gorman <mgorman@suse.de> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Rik van Riel <riel@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- mm/mempolicy.c | 6 +++++- mm/mmap.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 74310017296e..4baf12e534d1 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -732,7 +732,10 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, if (prev) { vma = prev; next = vma->vm_next; - continue; + if (mpol_equal(vma_policy(vma), new_pol)) + continue; + /* vma_merge() joined vma && vma->next, case 8 */ + goto replace; } if (vma->vm_start != vmstart) { err = split_vma(vma->vm_mm, vma, vmstart, 1); @@ -744,6 +747,7 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, if (err) goto out; } + replace: err = vma_replace_policy(vma, new_pol); if (err) goto out; diff --git a/mm/mmap.c b/mm/mmap.c index fbad7b091090..1edbaa3136c3 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -865,7 +865,7 @@ again: remove_next = 1 + (end > next->vm_end); if (next->anon_vma) anon_vma_merge(vma, next); mm->map_count--; - vma_set_policy(vma, vma_policy(next)); + mpol_put(vma_policy(next)); kmem_cache_free(vm_area_cachep, next); /* * In mprotect's case 6 (see comments on vma_merge), From 62c610460d73fcfa5637cb497c6923ef1c42b12d Mon Sep 17 00:00:00 2001 From: Gu Zheng <guz.fnst@cn.fujitsu.com> Date: Wed, 31 Jul 2013 13:53:29 -0700 Subject: [PATCH 726/913] ocfs2/refcounttree: add the missing NULL check of the return value of find_or_create_page() Add the missing NULL check of the return value of find_or_create_page() in function ocfs2_duplicate_clusters_by_page(). [akpm@linux-foundation.org: fix layout, per Joel] Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Acked-by: Joel Becker <jlbec@evilplan.org> Cc: Mark Fasheh <mfasheh@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- fs/ocfs2/refcounttree.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 998b17eda09d..9f6b96a09615 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c @@ -2965,6 +2965,11 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, to = map_end & (PAGE_CACHE_SIZE - 1); page = find_or_create_page(mapping, page_index, GFP_NOFS); + if (!page) { + ret = -ENOMEM; + mlog_errno(ret); + break; + } /* * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page From d39de28c95876f8becb559d242eefe718ea1f747 Mon Sep 17 00:00:00 2001 From: Ben Hutchings <ben@decadent.org.uk> Date: Wed, 31 Jul 2013 13:53:30 -0700 Subject: [PATCH 727/913] dmi_scan: add comments on dmi_present() and the loop in dmi_scan_machine() My previous refactoring in commit 79bae42d51a5 ("dmi_scan: refactor dmi_scan_machine(), {smbios,dmi}_present()") resulted in slightly tricky code (though I think it's more elegant). Explain what it's doing. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Cc: Zhenzhong Duan <zhenzhong.duan@oracle.com> Cc: Jean Delvare <jdelvare@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- drivers/firmware/dmi_scan.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index eb760a218da4..232fa8fce26a 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -419,6 +419,13 @@ static void __init dmi_format_ids(char *buf, size_t len) dmi_get_system_info(DMI_BIOS_DATE)); } +/* + * Check for DMI/SMBIOS headers in the system firmware image. Any + * SMBIOS header must start 16 bytes before the DMI header, so take a + * 32 byte buffer and check for DMI at offset 16 and SMBIOS at offset + * 0. If the DMI header is present, set dmi_ver accordingly (SMBIOS + * takes precedence) and return 0. Otherwise return 1. + */ static int __init dmi_present(const u8 *buf) { int smbios_ver; @@ -506,6 +513,13 @@ void __init dmi_scan_machine(void) if (p == NULL) goto error; + /* + * Iterate over all possible DMI header addresses q. + * Maintain the 32 bytes around q in buf. On the + * first iteration, substitute zero for the + * out-of-range bytes so there is no chance of falsely + * detecting an SMBIOS header. + */ memset(buf, 0, 16); for (q = p; q < p + 0x10000; q += 16) { memcpy_fromio(buf + 16, q, 16); From 5c4a97d1dabb3443da7acc309ae61c5de8494fa9 Mon Sep 17 00:00:00 2001 From: Joe Perches <joe@perches.com> Date: Wed, 31 Jul 2013 13:53:32 -0700 Subject: [PATCH 728/913] MAINTAINERS: dynamic debug: Jason's not there... He must be too, umm, busy to update his own bouncing email address too. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Jason Baron <jbaron@akamai.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a26b10e52aea..d83f70ffdbed 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2871,7 +2871,7 @@ F: drivers/media/usb/dvb-usb-v2/dvb_usb* F: drivers/media/usb/dvb-usb-v2/usb_urb.c DYNAMIC DEBUG -M: Jason Baron <jbaron@redhat.com> +M: Jason Baron <jbaron@akamai.com> S: Maintained F: lib/dynamic_debug.c F: include/linux/dynamic_debug.h From 4e5052948110140f1628dd986e27912b0e6b2065 Mon Sep 17 00:00:00 2001 From: Markus Trippelsdorf <markus@trippelsdorf.de> Date: Wed, 31 Jul 2013 13:53:33 -0700 Subject: [PATCH 729/913] .gitignore: ignore *.lz4 files Now that lz4 kernel compression is available, add *.lz4 to .gitignore. Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de> Acked-by: Kyungsik Lee <kyungsik.lee@lge.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3b8b9b33be38..7e9932e55475 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ modules.builtin *.bz2 *.lzma *.xz +*.lz4 *.lzo *.patch *.gcno From f93f3c4ee48727713c3349b659adf8048fd4524b Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Wed, 31 Jul 2013 13:53:34 -0700 Subject: [PATCH 730/913] rapidio: fix use after free in rio_unregister_scan() We're freeing the list iterator so we can't move to the next entry. Since there is only one matching mport_id, we can just break after finding it. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Ryan Mallon <rmallon@gmail.com> Acked-by: Alexandre Bounine <alexandre.bounine@idt.com> Cc: Matt Porter <mporter@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- drivers/rapidio/rio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index f4f30af2df68..2e8a20cac588 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c @@ -1715,11 +1715,13 @@ int rio_unregister_scan(int mport_id, struct rio_scan *scan_ops) (mport_id == RIO_MPORT_ANY && port->nscan == scan_ops)) port->nscan = NULL; - list_for_each_entry(scan, &rio_scans, node) + list_for_each_entry(scan, &rio_scans, node) { if (scan->mport_id == mport_id) { list_del(&scan->node); kfree(scan); + break; } + } mutex_unlock(&rio_mport_list_lock); From 10e84b97ed799be404836dc7f71ab47d4571265a Mon Sep 17 00:00:00 2001 From: Dave Kleikamp <dave.kleikamp@oracle.com> Date: Wed, 31 Jul 2013 13:53:35 -0700 Subject: [PATCH 731/913] mm: sched: numa: fix NUMA balancing when !SCHED_DEBUG Commit 3105b86a9fee ("mm: sched: numa: Control enabling and disabling of NUMA balancing if !SCHED_DEBUG") defined numabalancing_enabled to control the enabling and disabling of automatic NUMA balancing, but it is never used. I believe the intention was to use this in place of sched_feat_numa(NUMA). Currently, if SCHED_DEBUG is not defined, sched_feat_numa(NUMA) will never be changed from the initial "false". Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com> Acked-by: Mel Gorman <mgorman@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index bb456f44b7b1..9565645e3202 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -851,7 +851,7 @@ void task_numa_fault(int node, int pages, bool migrated) { struct task_struct *p = current; - if (!sched_feat_numa(NUMA)) + if (!numabalancing_enabled) return; /* FIXME: Allocate task-specific structure for placement policy here */ @@ -5786,7 +5786,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued) entity_tick(cfs_rq, se, queued); } - if (sched_feat_numa(NUMA)) + if (numabalancing_enabled) task_tick_numa(rq, curr); update_rq_runnable_avg(rq, 1); From 31a1b26f16e822577def5402ffc79cfe4aed2db9 Mon Sep 17 00:00:00 2001 From: Andrew Morton <akpm@linux-foundation.org> Date: Wed, 31 Jul 2013 13:53:36 -0700 Subject: [PATCH 732/913] arch/x86/platform/ce4100/ce4100.c: include reboot.h Fix the build: arch/x86/platform/ce4100/ce4100.c: In function 'x86_ce4100_early_setup': arch/x86/platform/ce4100/ce4100.c:165:2: error: 'reboot_type' undeclared (first use in this function) Reported-by: Wu Fengguang <fengguang.wu@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- arch/x86/platform/ce4100/ce4100.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c index 643b8b5eee86..8244f5ec2f4c 100644 --- a/arch/x86/platform/ce4100/ce4100.c +++ b/arch/x86/platform/ce4100/ce4100.c @@ -12,6 +12,7 @@ #include <linux/kernel.h> #include <linux/irq.h> #include <linux/module.h> +#include <linux/reboot.h> #include <linux/serial_reg.h> #include <linux/serial_8250.h> #include <linux/reboot.h> From ef2a2cbdda7e9d084a85846770fcc844958881f6 Mon Sep 17 00:00:00 2001 From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Date: Wed, 31 Jul 2013 13:53:37 -0700 Subject: [PATCH 733/913] mm/swap.c: clear PageActive before adding pages onto unevictable list As a result of commit 13f7f78981e4 ("mm: pagevec: defer deciding which LRU to add a page to until pagevec drain time"), pages on unevictable lists can have both of PageActive and PageUnevictable set. This is not only confusing, but also corrupts page migration and shrink_[in]active_list. This patch fixes the problem by adding ClearPageActive before adding pages into unevictable list. It also cleans up VM_BUG_ONs. Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Mel Gorman <mgorman@suse.de> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- mm/swap.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/swap.c b/mm/swap.c index 4a1d0d2c52fa..d3982c062629 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -512,12 +512,7 @@ EXPORT_SYMBOL(__lru_cache_add); */ void lru_cache_add(struct page *page) { - if (PageActive(page)) { - VM_BUG_ON(PageUnevictable(page)); - } else if (PageUnevictable(page)) { - VM_BUG_ON(PageActive(page)); - } - + VM_BUG_ON(PageActive(page) && PageUnevictable(page)); VM_BUG_ON(PageLRU(page)); __lru_cache_add(page); } @@ -539,6 +534,7 @@ void add_page_to_unevictable_list(struct page *page) spin_lock_irq(&zone->lru_lock); lruvec = mem_cgroup_page_lruvec(page, zone); + ClearPageActive(page); SetPageUnevictable(page); SetPageLRU(page); add_page_to_lru_list(page, lruvec, LRU_UNEVICTABLE); @@ -833,7 +829,6 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec, int active = PageActive(page); enum lru_list lru = page_lru(page); - VM_BUG_ON(PageUnevictable(page)); VM_BUG_ON(PageLRU(page)); SetPageLRU(page); From e180cf806a93ea1abbce47b245d25204ff557ce9 Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Date: Wed, 31 Jul 2013 13:53:39 -0700 Subject: [PATCH 734/913] thp, mm: avoid PageUnevictable on active/inactive lru lists active/inactive lru lists can contain unevicable pages (i.e. ramfs pages that have been placed on the LRU lists when first allocated), but these pages must not have PageUnevictable set - otherwise shrink_[in]active_list goes crazy: kernel BUG at /home/space/kas/git/public/linux-next/mm/vmscan.c:1122! 1090 static unsigned long isolate_lru_pages(unsigned long nr_to_scan, 1091 struct lruvec *lruvec, struct list_head *dst, 1092 unsigned long *nr_scanned, struct scan_control *sc, 1093 isolate_mode_t mode, enum lru_list lru) 1094 { ... 1108 switch (__isolate_lru_page(page, mode)) { 1109 case 0: ... 1116 case -EBUSY: ... 1121 default: 1122 BUG(); 1123 } 1124 } ... 1130 } __isolate_lru_page() returns EINVAL for PageUnevictable(page). For lru_add_page_tail(), it means we should not set PageUnevictable() for tail pages unless we're sure that it will go to LRU_UNEVICTABLE. Let's just copy PG_active and PG_unevictable from head page in __split_huge_page_refcount(), it will simplify lru_add_page_tail(). This will fix one more bug in lru_add_page_tail(): if page_evictable(page_tail) is false and PageLRU(page) is true, page_tail will go to the same lru as page, but nobody cares to sync page_tail active/inactive state with page. So we can end up with inactive page on active lru. The patch will fix it as well since we copy PG_active from head page. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by: Dave Hansen <dave.hansen@linux.intel.com> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Mel Gorman <mgorman@suse.de> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- mm/huge_memory.c | 4 +++- mm/swap.c | 20 ++------------------ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 243e710c6039..a92012a71702 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1620,7 +1620,9 @@ static void __split_huge_page_refcount(struct page *page, ((1L << PG_referenced) | (1L << PG_swapbacked) | (1L << PG_mlocked) | - (1L << PG_uptodate))); + (1L << PG_uptodate) | + (1L << PG_active) | + (1L << PG_unevictable))); page_tail->flags |= (1L << PG_dirty); /* clear PageTail before overwriting first_page */ diff --git a/mm/swap.c b/mm/swap.c index d3982c062629..62b78a6e224f 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -770,8 +770,6 @@ EXPORT_SYMBOL(__pagevec_release); void lru_add_page_tail(struct page *page, struct page *page_tail, struct lruvec *lruvec, struct list_head *list) { - int uninitialized_var(active); - enum lru_list lru; const int file = 0; VM_BUG_ON(!PageHead(page)); @@ -783,20 +781,6 @@ void lru_add_page_tail(struct page *page, struct page *page_tail, if (!list) SetPageLRU(page_tail); - if (page_evictable(page_tail)) { - if (PageActive(page)) { - SetPageActive(page_tail); - active = 1; - lru = LRU_ACTIVE_ANON; - } else { - active = 0; - lru = LRU_INACTIVE_ANON; - } - } else { - SetPageUnevictable(page_tail); - lru = LRU_UNEVICTABLE; - } - if (likely(PageLRU(page))) list_add_tail(&page_tail->lru, &page->lru); else if (list) { @@ -812,13 +796,13 @@ void lru_add_page_tail(struct page *page, struct page *page_tail, * Use the standard add function to put page_tail on the list, * but then correct its position so they all end up in order. */ - add_page_to_lru_list(page_tail, lruvec, lru); + add_page_to_lru_list(page_tail, lruvec, page_lru(page_tail)); list_head = page_tail->lru.prev; list_move_tail(&page_tail->lru, list_head); } if (!PageUnevictable(page)) - update_page_reclaim_stat(lruvec, file, active); + update_page_reclaim_stat(lruvec, file, PageActive(page_tail)); } #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ From 9d8c5b5284e4a0167c5f7b1193692492358b8700 Mon Sep 17 00:00:00 2001 From: Heesub Shin <heesub.shin@samsung.com> Date: Wed, 31 Jul 2013 13:53:40 -0700 Subject: [PATCH 735/913] mm: zbud: fix condition check on allocation size zbud_alloc() incorrectly verifies the size of allocation limit. It should deny the allocation request greater than (PAGE_SIZE - ZHDR_SIZE_ALIGNED - CHUNK_SIZE), not (PAGE_SIZE - ZHDR_SIZE_ALIGNED) which has no remaining spaces for its buddy. There is no point in spending the entire zbud page storing only a single page, since we don't have any benefits. Signed-off-by: Heesub Shin <heesub.shin@samsung.com> Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com> Cc: Bob Liu <bob.liu@oracle.com> Cc: Dongjun Shin <d.j.shin@samsung.com> Cc: Sunae Seo <sunae.seo@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- mm/zbud.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/zbud.c b/mm/zbud.c index 9bb4710e3589..ad1e781284fd 100644 --- a/mm/zbud.c +++ b/mm/zbud.c @@ -257,7 +257,7 @@ int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp, if (size <= 0 || gfp & __GFP_HIGHMEM) return -EINVAL; - if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED) + if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED - CHUNK_SIZE) return -ENOSPC; chunks = size_to_chunks(size); spin_lock(&pool->lock); From b99b94b52339dc186810e29f1f6472d86c42d2d9 Mon Sep 17 00:00:00 2001 From: Grygorii Strashko <grygorii.strashko@ti.com> Date: Wed, 31 Jul 2013 13:53:41 -0700 Subject: [PATCH 736/913] drivers/rtc/rtc-twl.c: fix: rtcX/wakealarm attribute isn't created The device_init_wakeup() should be called before rtc_device_register(). Otherwise, sysfs "sys/class/rtc/rtcX/wakealarm" attribute will not be seen from User space. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Cc: Kevin Hilman <khilman@linaro.org> Cc: Tony Lindgren <tony@atomide.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- drivers/rtc/rtc-twl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 02faf3c4e0d5..c2e80d7ca5e2 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c @@ -524,6 +524,8 @@ static int twl_rtc_probe(struct platform_device *pdev) if (ret < 0) goto out1; + device_init_wakeup(&pdev->dev, 1); + rtc = rtc_device_register(pdev->name, &pdev->dev, &twl_rtc_ops, THIS_MODULE); if (IS_ERR(rtc)) { @@ -542,7 +544,6 @@ static int twl_rtc_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, rtc); - device_init_wakeup(&pdev->dev, 1); return 0; out2: From b9ee979e9d770dc10f94936ef6ff9efddc23c911 Mon Sep 17 00:00:00 2001 From: Joe Perches <joe@perches.com> Date: Wed, 31 Jul 2013 13:53:42 -0700 Subject: [PATCH 737/913] printk: move to separate directory for easier modification Make it easier to break up printk into bite-sized chunks. Remove printk path/filename from comment. Signed-off-by: Joe Perches <joe@perches.com> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Cc: Ming Lei <ming.lei@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- Documentation/DocBook/device-drivers.tmpl | 2 +- kernel/Makefile | 3 ++- kernel/printk/Makefile | 1 + kernel/{ => printk}/printk.c | 0 4 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 kernel/printk/Makefile rename kernel/{ => printk}/printk.c (100%) diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl index cbfdf5486639..fe397f90a34f 100644 --- a/Documentation/DocBook/device-drivers.tmpl +++ b/Documentation/DocBook/device-drivers.tmpl @@ -84,7 +84,7 @@ X!Iinclude/linux/kobject.h <sect1><title>Kernel utility functions</title> !Iinclude/linux/kernel.h -!Ekernel/printk.c +!Ekernel/printk/printk.c !Ekernel/panic.c !Ekernel/sys.c !Ekernel/rcupdate.c diff --git a/kernel/Makefile b/kernel/Makefile index 470839d1a30e..35ef1185e359 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -2,7 +2,7 @@ # Makefile for the linux kernel. # -obj-y = fork.o exec_domain.o panic.o printk.o \ +obj-y = fork.o exec_domain.o panic.o \ cpu.o exit.o itimer.o time.o softirq.o resource.o \ sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \ signal.o sys.o kmod.o workqueue.o pid.o task_work.o \ @@ -24,6 +24,7 @@ endif obj-y += sched/ obj-y += power/ +obj-y += printk/ obj-y += cpu/ obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o diff --git a/kernel/printk/Makefile b/kernel/printk/Makefile new file mode 100644 index 000000000000..36d306d9273c --- /dev/null +++ b/kernel/printk/Makefile @@ -0,0 +1 @@ +obj-y = printk.o diff --git a/kernel/printk.c b/kernel/printk/printk.c similarity index 100% rename from kernel/printk.c rename to kernel/printk/printk.c From d197c43d04decb6b1298fa3ef26ea04a9ca7c977 Mon Sep 17 00:00:00 2001 From: Joe Perches <joe@perches.com> Date: Wed, 31 Jul 2013 13:53:44 -0700 Subject: [PATCH 738/913] printk: add console_cmdline.h Add an include file for the console_cmdline struct so that the braille console driver can be separated. Signed-off-by: Joe Perches <joe@perches.com> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Cc: Ming Lei <ming.lei@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- kernel/printk/console_cmdline.h | 14 ++++++++++++++ kernel/printk/printk.c | 12 +++--------- 2 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 kernel/printk/console_cmdline.h diff --git a/kernel/printk/console_cmdline.h b/kernel/printk/console_cmdline.h new file mode 100644 index 000000000000..cbd69d842341 --- /dev/null +++ b/kernel/printk/console_cmdline.h @@ -0,0 +1,14 @@ +#ifndef _CONSOLE_CMDLINE_H +#define _CONSOLE_CMDLINE_H + +struct console_cmdline +{ + char name[8]; /* Name of the driver */ + int index; /* Minor dev. to use */ + char *options; /* Options for the driver */ +#ifdef CONFIG_A11Y_BRAILLE_CONSOLE + char *brl_options; /* Options for braille driver */ +#endif +}; + +#endif diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 69b0890ed7e5..4da2b2c7f67d 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -51,6 +51,8 @@ #define CREATE_TRACE_POINTS #include <trace/events/printk.h> +#include "console_cmdline.h" + /* printk's without a loglevel use this.. */ #define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL @@ -105,19 +107,11 @@ static struct console *exclusive_console; /* * Array of consoles built from command line options (console=) */ -struct console_cmdline -{ - char name[8]; /* Name of the driver */ - int index; /* Minor dev. to use */ - char *options; /* Options for the driver */ -#ifdef CONFIG_A11Y_BRAILLE_CONSOLE - char *brl_options; /* Options for braille driver */ -#endif -}; #define MAX_CMDLINECONSOLES 8 static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; + static int selected_console = -1; static int preferred_console = -1; int console_set_on_cmdline; From bbeddf52adc1b4207674ab88686cbbe58c24f721 Mon Sep 17 00:00:00 2001 From: Joe Perches <joe@perches.com> Date: Wed, 31 Jul 2013 13:53:45 -0700 Subject: [PATCH 739/913] printk: move braille console support into separate braille.[ch] files Create files with prototypes and static inlines for braille support. Make braille_console functions return 1 on success. Corrected CONFIG_A11Y_BRAILLE_CONSOLE=n _braille_console_setup return value to NULL. Signed-off-by: Joe Perches <joe@perches.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Cc: Ming Lei <ming.lei@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- .../accessibility/braille/braille_console.c | 9 +++- kernel/printk/Makefile | 1 + kernel/printk/braille.c | 48 +++++++++++++++++++ kernel/printk/braille.h | 48 +++++++++++++++++++ kernel/printk/printk.c | 44 +++++------------ 5 files changed, 117 insertions(+), 33 deletions(-) create mode 100644 kernel/printk/braille.c create mode 100644 kernel/printk/braille.h diff --git a/drivers/accessibility/braille/braille_console.c b/drivers/accessibility/braille/braille_console.c index d21167bfc865..dc34a5b8bcee 100644 --- a/drivers/accessibility/braille/braille_console.c +++ b/drivers/accessibility/braille/braille_console.c @@ -359,6 +359,9 @@ int braille_register_console(struct console *console, int index, char *console_options, char *braille_options) { int ret; + + if (!(console->flags & CON_BRL)) + return 0; if (!console_options) /* Only support VisioBraille for now */ console_options = "57600o8"; @@ -374,15 +377,17 @@ int braille_register_console(struct console *console, int index, braille_co = console; register_keyboard_notifier(&keyboard_notifier_block); register_vt_notifier(&vt_notifier_block); - return 0; + return 1; } int braille_unregister_console(struct console *console) { if (braille_co != console) return -EINVAL; + if (!(console->flags & CON_BRL)) + return 0; unregister_keyboard_notifier(&keyboard_notifier_block); unregister_vt_notifier(&vt_notifier_block); braille_co = NULL; - return 0; + return 1; } diff --git a/kernel/printk/Makefile b/kernel/printk/Makefile index 36d306d9273c..85405bdcf2b3 100644 --- a/kernel/printk/Makefile +++ b/kernel/printk/Makefile @@ -1 +1,2 @@ obj-y = printk.o +obj-$(CONFIG_A11Y_BRAILLE_CONSOLE) += braille.o diff --git a/kernel/printk/braille.c b/kernel/printk/braille.c new file mode 100644 index 000000000000..b51087fb9ace --- /dev/null +++ b/kernel/printk/braille.c @@ -0,0 +1,48 @@ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include <linux/kernel.h> +#include <linux/console.h> +#include <linux/string.h> + +#include "console_cmdline.h" +#include "braille.h" + +char *_braille_console_setup(char **str, char **brl_options) +{ + if (!memcmp(*str, "brl,", 4)) { + *brl_options = ""; + *str += 4; + } else if (!memcmp(str, "brl=", 4)) { + *brl_options = *str + 4; + *str = strchr(*brl_options, ','); + if (!*str) + pr_err("need port name after brl=\n"); + else + *((*str)++) = 0; + } + + return *str; +} + +int +_braille_register_console(struct console *console, struct console_cmdline *c) +{ + int rtn = 0; + + if (c->brl_options) { + console->flags |= CON_BRL; + rtn = braille_register_console(console, c->index, c->options, + c->brl_options); + } + + return rtn; +} + +int +_braille_unregister_console(struct console *console) +{ + if (console->flags & CON_BRL) + return braille_unregister_console(console); + + return 0; +} diff --git a/kernel/printk/braille.h b/kernel/printk/braille.h new file mode 100644 index 000000000000..769d771145c8 --- /dev/null +++ b/kernel/printk/braille.h @@ -0,0 +1,48 @@ +#ifndef _PRINTK_BRAILLE_H +#define _PRINTK_BRAILLE_H + +#ifdef CONFIG_A11Y_BRAILLE_CONSOLE + +static inline void +braille_set_options(struct console_cmdline *c, char *brl_options) +{ + c->brl_options = brl_options; +} + +char * +_braille_console_setup(char **str, char **brl_options); + +int +_braille_register_console(struct console *console, struct console_cmdline *c); + +int +_braille_unregister_console(struct console *console); + +#else + +static inline void +braille_set_options(struct console_cmdline *c, char *brl_options) +{ +} + +static inline char * +_braille_console_setup(char **str, char **brl_options) +{ + return NULL; +} + +static inline int +_braille_register_console(struct console *console, struct console_cmdline *c) +{ + return 0; +} + +static inline int +_braille_unregister_console(struct console *console) +{ + return 0; +} + +#endif + +#endif diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 4da2b2c7f67d..5a022e0c654c 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -52,6 +52,7 @@ #include <trace/events/printk.h> #include "console_cmdline.h" +#include "braille.h" /* printk's without a loglevel use this.. */ #define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL @@ -1769,9 +1770,8 @@ static int __add_preferred_console(char *name, int idx, char *options, c = &console_cmdline[i]; strlcpy(c->name, name, sizeof(c->name)); c->options = options; -#ifdef CONFIG_A11Y_BRAILLE_CONSOLE - c->brl_options = brl_options; -#endif + braille_set_options(c, brl_options); + c->index = idx; return 0; } @@ -1784,20 +1784,8 @@ static int __init console_setup(char *str) char *s, *options, *brl_options = NULL; int idx; -#ifdef CONFIG_A11Y_BRAILLE_CONSOLE - if (!memcmp(str, "brl,", 4)) { - brl_options = ""; - str += 4; - } else if (!memcmp(str, "brl=", 4)) { - brl_options = str + 4; - str = strchr(brl_options, ','); - if (!str) { - printk(KERN_ERR "need port name after brl=\n"); - return 1; - } - *(str++) = 0; - } -#endif + if (_braille_console_setup(&str, &brl_options)) + return 1; /* * Decode str into name, index, options. @@ -2291,16 +2279,10 @@ void register_console(struct console *newcon) continue; if (newcon->index < 0) newcon->index = console_cmdline[i].index; -#ifdef CONFIG_A11Y_BRAILLE_CONSOLE - if (console_cmdline[i].brl_options) { - newcon->flags |= CON_BRL; - braille_register_console(newcon, - console_cmdline[i].index, - console_cmdline[i].options, - console_cmdline[i].brl_options); + + if (_braille_register_console(newcon, &console_cmdline[i])) return; - } -#endif + if (newcon->setup && newcon->setup(newcon, console_cmdline[i].options) != 0) break; @@ -2388,13 +2370,13 @@ EXPORT_SYMBOL(register_console); int unregister_console(struct console *console) { struct console *a, *b; - int res = 1; + int res; -#ifdef CONFIG_A11Y_BRAILLE_CONSOLE - if (console->flags & CON_BRL) - return braille_unregister_console(console); -#endif + res = _braille_unregister_console(console); + if (res) + return res; + res = 1; console_lock(); if (console_drivers == console) { console_drivers=console->next; From 23475408c618ecd5b44b7e069fd65ec73d17d9f0 Mon Sep 17 00:00:00 2001 From: Joe Perches <joe@perches.com> Date: Wed, 31 Jul 2013 13:53:46 -0700 Subject: [PATCH 740/913] printk: use pointer for console_cmdline indexing Make the code a bit more compact by always using a pointer for the active console_cmdline. Move overly indented code to correct indent level. Signed-off-by: Joe Perches <joe@perches.com> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Cc: Ming Lei <ming.lei@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- kernel/printk/printk.c | 49 ++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 5a022e0c654c..8f1fb50aa3ce 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -1756,18 +1756,19 @@ static int __add_preferred_console(char *name, int idx, char *options, * See if this tty is not yet registered, and * if we have a slot free. */ - for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) - if (strcmp(console_cmdline[i].name, name) == 0 && - console_cmdline[i].index == idx) { - if (!brl_options) - selected_console = i; - return 0; + for (i = 0, c = console_cmdline; + i < MAX_CMDLINECONSOLES && c->name[0]; + i++, c++) { + if (strcmp(c->name, name) == 0 && c->index == idx) { + if (!brl_options) + selected_console = i; + return 0; } + } if (i == MAX_CMDLINECONSOLES) return -E2BIG; if (!brl_options) selected_console = i; - c = &console_cmdline[i]; strlcpy(c->name, name, sizeof(c->name)); c->options = options; braille_set_options(c, brl_options); @@ -1840,15 +1841,15 @@ int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, cha struct console_cmdline *c; int i; - for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) - if (strcmp(console_cmdline[i].name, name) == 0 && - console_cmdline[i].index == idx) { - c = &console_cmdline[i]; - strlcpy(c->name, name_new, sizeof(c->name)); - c->name[sizeof(c->name) - 1] = 0; - c->options = options; - c->index = idx_new; - return i; + for (i = 0, c = console_cmdline; + i < MAX_CMDLINECONSOLES && c->name[0]; + i++, c++) + if (strcmp(c->name, name) == 0 && c->index == idx) { + strlcpy(c->name, name_new, sizeof(c->name)); + c->name[sizeof(c->name) - 1] = 0; + c->options = options; + c->index = idx_new; + return i; } /* not found */ return -1; @@ -2223,6 +2224,7 @@ void register_console(struct console *newcon) int i; unsigned long flags; struct console *bcon = NULL; + struct console_cmdline *c; /* * before we register a new CON_BOOT console, make sure we don't @@ -2270,24 +2272,25 @@ void register_console(struct console *newcon) * See if this console matches one we selected on * the command line. */ - for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; - i++) { - if (strcmp(console_cmdline[i].name, newcon->name) != 0) + for (i = 0, c = console_cmdline; + i < MAX_CMDLINECONSOLES && c->name[0]; + i++, c++) { + if (strcmp(c->name, newcon->name) != 0) continue; if (newcon->index >= 0 && - newcon->index != console_cmdline[i].index) + newcon->index != c->index) continue; if (newcon->index < 0) - newcon->index = console_cmdline[i].index; + newcon->index = c->index; - if (_braille_register_console(newcon, &console_cmdline[i])) + if (_braille_register_console(newcon, c)) return; if (newcon->setup && newcon->setup(newcon, console_cmdline[i].options) != 0) break; newcon->flags |= CON_ENABLED; - newcon->index = console_cmdline[i].index; + newcon->index = c->index; if (i == selected_console) { newcon->flags |= CON_CONSDEV; preferred_console = selected_console; From 62e32ac3505a0cab1c5ef8ea2c0eab3b26ed855f Mon Sep 17 00:00:00 2001 From: Joe Perches <joe@perches.com> Date: Wed, 31 Jul 2013 13:53:47 -0700 Subject: [PATCH 741/913] printk: rename struct log to struct printk_log Rename the struct to enable moving portions of printk.c to separate files. The rename changes output of /proc/vmcoreinfo. Signed-off-by: Joe Perches <joe@perches.com> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Cc: Ming Lei <ming.lei@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- kernel/printk/printk.c | 80 +++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 8f1fb50aa3ce..5b5a7080e2a5 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -173,7 +173,7 @@ static int console_may_schedule; * 67 "g" * 0032 00 00 00 padding to next message header * - * The 'struct log' buffer header must never be directly exported to + * The 'struct printk_log' buffer header must never be directly exported to * userspace, it is a kernel-private implementation detail that might * need to be changed in the future, when the requirements change. * @@ -195,7 +195,7 @@ enum log_flags { LOG_CONT = 8, /* text is a fragment of a continuation line */ }; -struct log { +struct printk_log { u64 ts_nsec; /* timestamp in nanoseconds */ u16 len; /* length of entire record */ u16 text_len; /* length of text buffer */ @@ -243,7 +243,7 @@ static u32 clear_idx; #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) #define LOG_ALIGN 4 #else -#define LOG_ALIGN __alignof__(struct log) +#define LOG_ALIGN __alignof__(struct printk_log) #endif #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); @@ -254,35 +254,35 @@ static u32 log_buf_len = __LOG_BUF_LEN; static volatile unsigned int logbuf_cpu = UINT_MAX; /* human readable text of the record */ -static char *log_text(const struct log *msg) +static char *log_text(const struct printk_log *msg) { - return (char *)msg + sizeof(struct log); + return (char *)msg + sizeof(struct printk_log); } /* optional key/value pair dictionary attached to the record */ -static char *log_dict(const struct log *msg) +static char *log_dict(const struct printk_log *msg) { - return (char *)msg + sizeof(struct log) + msg->text_len; + return (char *)msg + sizeof(struct printk_log) + msg->text_len; } /* get record by index; idx must point to valid msg */ -static struct log *log_from_idx(u32 idx) +static struct printk_log *log_from_idx(u32 idx) { - struct log *msg = (struct log *)(log_buf + idx); + struct printk_log *msg = (struct printk_log *)(log_buf + idx); /* * A length == 0 record is the end of buffer marker. Wrap around and * read the message at the start of the buffer. */ if (!msg->len) - return (struct log *)log_buf; + return (struct printk_log *)log_buf; return msg; } /* get next record; idx must point to valid msg */ static u32 log_next(u32 idx) { - struct log *msg = (struct log *)(log_buf + idx); + struct printk_log *msg = (struct printk_log *)(log_buf + idx); /* length == 0 indicates the end of the buffer; wrap */ /* @@ -291,7 +291,7 @@ static u32 log_next(u32 idx) * return the one after that. */ if (!msg->len) { - msg = (struct log *)log_buf; + msg = (struct printk_log *)log_buf; return msg->len; } return idx + msg->len; @@ -303,11 +303,11 @@ static void log_store(int facility, int level, const char *dict, u16 dict_len, const char *text, u16 text_len) { - struct log *msg; + struct printk_log *msg; u32 size, pad_len; /* number of '\0' padding bytes to next message */ - size = sizeof(struct log) + text_len + dict_len; + size = sizeof(struct printk_log) + text_len + dict_len; pad_len = (-size) & (LOG_ALIGN - 1); size += pad_len; @@ -319,7 +319,7 @@ static void log_store(int facility, int level, else free = log_first_idx - log_next_idx; - if (free > size + sizeof(struct log)) + if (free > size + sizeof(struct printk_log)) break; /* drop old messages until we have enough contiuous space */ @@ -327,18 +327,18 @@ static void log_store(int facility, int level, log_first_seq++; } - if (log_next_idx + size + sizeof(struct log) >= log_buf_len) { + if (log_next_idx + size + sizeof(struct printk_log) >= log_buf_len) { /* * This message + an additional empty header does not fit * at the end of the buffer. Add an empty header with len == 0 * to signify a wrap around. */ - memset(log_buf + log_next_idx, 0, sizeof(struct log)); + memset(log_buf + log_next_idx, 0, sizeof(struct printk_log)); log_next_idx = 0; } /* fill message */ - msg = (struct log *)(log_buf + log_next_idx); + msg = (struct printk_log *)(log_buf + log_next_idx); memcpy(log_text(msg), text, text_len); msg->text_len = text_len; memcpy(log_dict(msg), dict, dict_len); @@ -351,7 +351,7 @@ static void log_store(int facility, int level, else msg->ts_nsec = local_clock(); memset(log_dict(msg) + dict_len, 0, pad_len); - msg->len = sizeof(struct log) + text_len + dict_len + pad_len; + msg->len = sizeof(struct printk_log) + text_len + dict_len + pad_len; /* insert message */ log_next_idx += msg->len; @@ -474,7 +474,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct devkmsg_user *user = file->private_data; - struct log *msg; + struct printk_log *msg; u64 ts_usec; size_t i; char cont = '-'; @@ -719,14 +719,14 @@ void log_buf_kexec_setup(void) VMCOREINFO_SYMBOL(log_first_idx); VMCOREINFO_SYMBOL(log_next_idx); /* - * Export struct log size and field offsets. User space tools can + * Export struct printk_log size and field offsets. User space tools can * parse it and detect any changes to structure down the line. */ - VMCOREINFO_STRUCT_SIZE(log); - VMCOREINFO_OFFSET(log, ts_nsec); - VMCOREINFO_OFFSET(log, len); - VMCOREINFO_OFFSET(log, text_len); - VMCOREINFO_OFFSET(log, dict_len); + VMCOREINFO_STRUCT_SIZE(printk_log); + VMCOREINFO_OFFSET(printk_log, ts_nsec); + VMCOREINFO_OFFSET(printk_log, len); + VMCOREINFO_OFFSET(printk_log, text_len); + VMCOREINFO_OFFSET(printk_log, dict_len); } #endif @@ -879,7 +879,7 @@ static size_t print_time(u64 ts, char *buf) (unsigned long)ts, rem_nsec / 1000); } -static size_t print_prefix(const struct log *msg, bool syslog, char *buf) +static size_t print_prefix(const struct printk_log *msg, bool syslog, char *buf) { size_t len = 0; unsigned int prefix = (msg->facility << 3) | msg->level; @@ -902,7 +902,7 @@ static size_t print_prefix(const struct log *msg, bool syslog, char *buf) return len; } -static size_t msg_print_text(const struct log *msg, enum log_flags prev, +static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev, bool syslog, char *buf, size_t size) { const char *text = log_text(msg); @@ -964,7 +964,7 @@ static size_t msg_print_text(const struct log *msg, enum log_flags prev, static int syslog_print(char __user *buf, int size) { char *text; - struct log *msg; + struct printk_log *msg; int len = 0; text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL); @@ -1055,7 +1055,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) idx = clear_idx; prev = 0; while (seq < log_next_seq) { - struct log *msg = log_from_idx(idx); + struct printk_log *msg = log_from_idx(idx); len += msg_print_text(msg, prev, true, NULL, 0); prev = msg->flags; @@ -1068,7 +1068,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) idx = clear_idx; prev = 0; while (len > size && seq < log_next_seq) { - struct log *msg = log_from_idx(idx); + struct printk_log *msg = log_from_idx(idx); len -= msg_print_text(msg, prev, true, NULL, 0); prev = msg->flags; @@ -1082,7 +1082,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) len = 0; prev = 0; while (len >= 0 && seq < next_seq) { - struct log *msg = log_from_idx(idx); + struct printk_log *msg = log_from_idx(idx); int textlen; textlen = msg_print_text(msg, prev, true, text, @@ -1228,7 +1228,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) error = 0; while (seq < log_next_seq) { - struct log *msg = log_from_idx(idx); + struct printk_log *msg = log_from_idx(idx); error += msg_print_text(msg, prev, true, NULL, 0); idx = log_next(idx); @@ -1714,10 +1714,10 @@ static struct cont { u8 level; bool flushed:1; } cont; -static struct log *log_from_idx(u32 idx) { return NULL; } +static struct printk_log *log_from_idx(u32 idx) { return NULL; } static u32 log_next(u32 idx) { return 0; } static void call_console_drivers(int level, const char *text, size_t len) {} -static size_t msg_print_text(const struct log *msg, enum log_flags prev, +static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev, bool syslog, char *buf, size_t size) { return 0; } static size_t cont_print_text(char *text, size_t size) { return 0; } @@ -2029,7 +2029,7 @@ void console_unlock(void) console_cont_flush(text, sizeof(text)); again: for (;;) { - struct log *msg; + struct printk_log *msg; size_t len; int level; @@ -2645,7 +2645,7 @@ void kmsg_dump(enum kmsg_dump_reason reason) bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper, bool syslog, char *line, size_t size, size_t *len) { - struct log *msg; + struct printk_log *msg; size_t l = 0; bool ret = false; @@ -2757,7 +2757,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, idx = dumper->cur_idx; prev = 0; while (seq < dumper->next_seq) { - struct log *msg = log_from_idx(idx); + struct printk_log *msg = log_from_idx(idx); l += msg_print_text(msg, prev, true, NULL, 0); idx = log_next(idx); @@ -2770,7 +2770,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, idx = dumper->cur_idx; prev = 0; while (l > size && seq < dumper->next_seq) { - struct log *msg = log_from_idx(idx); + struct printk_log *msg = log_from_idx(idx); l -= msg_print_text(msg, prev, true, NULL, 0); idx = log_next(idx); @@ -2785,7 +2785,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, l = 0; prev = 0; while (seq < dumper->next_seq) { - struct log *msg = log_from_idx(idx); + struct printk_log *msg = log_from_idx(idx); l += msg_print_text(msg, prev, syslog, buf + l, size - l); idx = log_next(idx); From 22f2020f84c6da2dd0acb2dce12e39e59ff7c8be Mon Sep 17 00:00:00 2001 From: Michal Hocko <mhocko@suse.cz> Date: Wed, 31 Jul 2013 13:53:48 -0700 Subject: [PATCH 742/913] vmpressure: change vmpressure::sr_lock to spinlock There is nothing that can sleep inside critical sections protected by this lock and those sections are really small so there doesn't make much sense to use mutex for them. Change the log to a spinlock Signed-off-by: Michal Hocko <mhocko@suse.cz> Reported-by: Tejun Heo <tj@kernel.org> Cc: Anton Vorontsov <anton.vorontsov@linaro.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Li Zefan <lizefan@huawei.com> Reviewed-by: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- include/linux/vmpressure.h | 2 +- mm/vmpressure.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h index 76be077340ea..2081680e015d 100644 --- a/include/linux/vmpressure.h +++ b/include/linux/vmpressure.h @@ -12,7 +12,7 @@ struct vmpressure { unsigned long scanned; unsigned long reclaimed; /* The lock is used to keep the scanned/reclaimed above in sync. */ - struct mutex sr_lock; + struct spinlock sr_lock; /* The list of vmpressure_event structs. */ struct list_head events; diff --git a/mm/vmpressure.c b/mm/vmpressure.c index 736a6011c2c8..f4ee6a190a4d 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c @@ -180,12 +180,12 @@ static void vmpressure_work_fn(struct work_struct *work) if (!vmpr->scanned) return; - mutex_lock(&vmpr->sr_lock); + spin_lock(&vmpr->sr_lock); scanned = vmpr->scanned; reclaimed = vmpr->reclaimed; vmpr->scanned = 0; vmpr->reclaimed = 0; - mutex_unlock(&vmpr->sr_lock); + spin_unlock(&vmpr->sr_lock); do { if (vmpressure_event(vmpr, scanned, reclaimed)) @@ -240,11 +240,11 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, if (!scanned) return; - mutex_lock(&vmpr->sr_lock); + spin_lock(&vmpr->sr_lock); vmpr->scanned += scanned; vmpr->reclaimed += reclaimed; scanned = vmpr->scanned; - mutex_unlock(&vmpr->sr_lock); + spin_unlock(&vmpr->sr_lock); if (scanned < vmpressure_win || work_pending(&vmpr->work)) return; @@ -367,7 +367,7 @@ void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft, */ void vmpressure_init(struct vmpressure *vmpr) { - mutex_init(&vmpr->sr_lock); + spin_lock_init(&vmpr->sr_lock); mutex_init(&vmpr->events_lock); INIT_LIST_HEAD(&vmpr->events); INIT_WORK(&vmpr->work, vmpressure_work_fn); From 8e0ed445b3478468372449859c45c6b3032acf2f Mon Sep 17 00:00:00 2001 From: Michal Hocko <mhocko@suse.cz> Date: Wed, 31 Jul 2013 13:53:50 -0700 Subject: [PATCH 743/913] vmpressure: do not check for pending work to prevent from new work because it is racy and it doesn't give us much anyway as schedule_work handles this case already. Signed-off-by: Michal Hocko <mhocko@suse.cz> Reported-by: Tejun Heo <tj@kernel.org> Cc: Anton Vorontsov <anton.vorontsov@linaro.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Li Zefan <lizefan@huawei.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- mm/vmpressure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmpressure.c b/mm/vmpressure.c index f4ee6a190a4d..192f9731931d 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c @@ -246,7 +246,7 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, scanned = vmpr->scanned; spin_unlock(&vmpr->sr_lock); - if (scanned < vmpressure_win || work_pending(&vmpr->work)) + if (scanned < vmpressure_win) return; schedule_work(&vmpr->work); } From 33cb876e947b9ddda8dca3fb99234b743a597ef9 Mon Sep 17 00:00:00 2001 From: Michal Hocko <mhocko@suse.cz> Date: Wed, 31 Jul 2013 13:53:51 -0700 Subject: [PATCH 744/913] vmpressure: make sure there are no events queued after memcg is offlined vmpressure is called synchronously from reclaim where the target_memcg is guaranteed to be alive but the eventfd is signaled from the work queue context. This means that memcg (along with vmpressure structure which is embedded into it) might go away while the work item is pending which would result in use-after-release bug. We have two possible ways how to fix this. Either vmpressure pins memcg before it schedules vmpr->work and unpin it in vmpressure_work_fn or explicitely flush the work item from the css_offline context (as suggested by Tejun). This patch implements the later one and it introduces vmpressure_cleanup which flushes the vmpressure work queue item item. It hooks into mem_cgroup_css_offline after the memcg itself is cleaned up. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Michal Hocko <mhocko@suse.cz> Reported-by: Tejun Heo <tj@kernel.org> Cc: Anton Vorontsov <anton.vorontsov@linaro.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Li Zefan <lizefan@huawei.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- include/linux/vmpressure.h | 1 + mm/memcontrol.c | 1 + mm/vmpressure.c | 16 ++++++++++++++++ 3 files changed, 18 insertions(+) diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h index 2081680e015d..7dc17e2456de 100644 --- a/include/linux/vmpressure.h +++ b/include/linux/vmpressure.h @@ -30,6 +30,7 @@ extern void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio); extern void vmpressure_init(struct vmpressure *vmpr); +extern void vmpressure_cleanup(struct vmpressure *vmpr); extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 00a7a664b9c1..c290a1cf3862 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6335,6 +6335,7 @@ static void mem_cgroup_css_offline(struct cgroup *cont) mem_cgroup_invalidate_reclaim_iterators(memcg); mem_cgroup_reparent_charges(memcg); mem_cgroup_destroy_all_caches(memcg); + vmpressure_cleanup(&memcg->vmpressure); } static void mem_cgroup_css_free(struct cgroup *cont) diff --git a/mm/vmpressure.c b/mm/vmpressure.c index 192f9731931d..0c1e37d829fa 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c @@ -372,3 +372,19 @@ void vmpressure_init(struct vmpressure *vmpr) INIT_LIST_HEAD(&vmpr->events); INIT_WORK(&vmpr->work, vmpressure_work_fn); } + +/** + * vmpressure_cleanup() - shuts down vmpressure control structure + * @vmpr: Structure to be cleaned up + * + * This function should be called before the structure in which it is + * embedded is cleaned up. + */ +void vmpressure_cleanup(struct vmpressure *vmpr) +{ + /* + * Make sure there is no pending work before eventfd infrastructure + * goes away. + */ + flush_work(&vmpr->work); +} From 50861f5a02dbf939c27d35a26c472885e2844188 Mon Sep 17 00:00:00 2001 From: John David Anglin <dave.anglin@bell.net> Date: Tue, 23 Jul 2013 12:27:52 -0400 Subject: [PATCH 745/913] parisc: Fix cache routines to ignore vma's with an invalid pfn The parisc architecture does not have a pte special bit. As a result, special mappings are handled with the VM_PFNMAP and VM_MIXEDMAP flags. VM_MIXEDMAP mappings may or may not have a "struct page" backing. When pfn_valid() is false, there is no "struct page" backing. Otherwise, they are treated as normal pages. The FireGL driver uses the VM_MIXEDMAP without a backing "struct page". This treatment caused a panic due to a TLB data miss in update_mmu_cache. This appeared to be in the code generated for page_address(). We were in fact using a very circular bit of code to determine the physical address of the PFN in various cache routines. This wasn't valid when there was no "struct page" backing. The needed address can in fact be determined simply from the PFN itself without using the "struct page". The attached patch updates update_mmu_cache(), flush_cache_mm(), flush_cache_range() and flush_cache_page() to check pfn_valid() and to directly compute the PFN physical and virtual addresses. Signed-off-by: John David Anglin <dave.anglin@bell.net> Cc: <stable@vger.kernel.org> # 3.10 Signed-off-by: Helge Deller <deller@gmx.de> --- arch/parisc/kernel/cache.c | 133 +++++++++++++++++++------------------ 1 file changed, 70 insertions(+), 63 deletions(-) diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index 2e65aa54bd10..c035673209f7 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c @@ -71,18 +71,27 @@ flush_cache_all_local(void) } EXPORT_SYMBOL(flush_cache_all_local); +/* Virtual address of pfn. */ +#define pfn_va(pfn) __va(PFN_PHYS(pfn)) + void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) { - struct page *page = pte_page(*ptep); + unsigned long pfn = pte_pfn(*ptep); + struct page *page; - if (pfn_valid(page_to_pfn(page)) && page_mapping(page) && - test_bit(PG_dcache_dirty, &page->flags)) { + /* We don't have pte special. As a result, we can be called with + an invalid pfn and we don't need to flush the kernel dcache page. + This occurs with FireGL card in C8000. */ + if (!pfn_valid(pfn)) + return; - flush_kernel_dcache_page(page); + page = pfn_to_page(pfn); + if (page_mapping(page) && test_bit(PG_dcache_dirty, &page->flags)) { + flush_kernel_dcache_page_addr(pfn_va(pfn)); clear_bit(PG_dcache_dirty, &page->flags); } else if (parisc_requires_coherency()) - flush_kernel_dcache_page(page); + flush_kernel_dcache_page_addr(pfn_va(pfn)); } void @@ -495,44 +504,42 @@ static inline pte_t *get_ptep(pgd_t *pgd, unsigned long addr) void flush_cache_mm(struct mm_struct *mm) { + struct vm_area_struct *vma; + pgd_t *pgd; + /* Flushing the whole cache on each cpu takes forever on rp3440, etc. So, avoid it if the mm isn't too big. */ - if (mm_total_size(mm) < parisc_cache_flush_threshold) { - struct vm_area_struct *vma; + if (mm_total_size(mm) >= parisc_cache_flush_threshold) { + flush_cache_all(); + return; + } - if (mm->context == mfsp(3)) { - for (vma = mm->mmap; vma; vma = vma->vm_next) { - flush_user_dcache_range_asm(vma->vm_start, - vma->vm_end); - if (vma->vm_flags & VM_EXEC) - flush_user_icache_range_asm( - vma->vm_start, vma->vm_end); - } - } else { - pgd_t *pgd = mm->pgd; - - for (vma = mm->mmap; vma; vma = vma->vm_next) { - unsigned long addr; - - for (addr = vma->vm_start; addr < vma->vm_end; - addr += PAGE_SIZE) { - pte_t *ptep = get_ptep(pgd, addr); - if (ptep != NULL) { - pte_t pte = *ptep; - __flush_cache_page(vma, addr, - page_to_phys(pte_page(pte))); - } - } - } + if (mm->context == mfsp(3)) { + for (vma = mm->mmap; vma; vma = vma->vm_next) { + flush_user_dcache_range_asm(vma->vm_start, vma->vm_end); + if ((vma->vm_flags & VM_EXEC) == 0) + continue; + flush_user_icache_range_asm(vma->vm_start, vma->vm_end); } return; } -#ifdef CONFIG_SMP - flush_cache_all(); -#else - flush_cache_all_local(); -#endif + pgd = mm->pgd; + for (vma = mm->mmap; vma; vma = vma->vm_next) { + unsigned long addr; + + for (addr = vma->vm_start; addr < vma->vm_end; + addr += PAGE_SIZE) { + unsigned long pfn; + pte_t *ptep = get_ptep(pgd, addr); + if (!ptep) + continue; + pfn = pte_pfn(*ptep); + if (!pfn_valid(pfn)) + continue; + __flush_cache_page(vma, addr, PFN_PHYS(pfn)); + } + } } void @@ -556,33 +563,32 @@ flush_user_icache_range(unsigned long start, unsigned long end) void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end) { + unsigned long addr; + pgd_t *pgd; + BUG_ON(!vma->vm_mm->context); - if ((end - start) < parisc_cache_flush_threshold) { - if (vma->vm_mm->context == mfsp(3)) { - flush_user_dcache_range_asm(start, end); - if (vma->vm_flags & VM_EXEC) - flush_user_icache_range_asm(start, end); - } else { - unsigned long addr; - pgd_t *pgd = vma->vm_mm->pgd; - - for (addr = start & PAGE_MASK; addr < end; - addr += PAGE_SIZE) { - pte_t *ptep = get_ptep(pgd, addr); - if (ptep != NULL) { - pte_t pte = *ptep; - flush_cache_page(vma, - addr, pte_pfn(pte)); - } - } - } - } else { -#ifdef CONFIG_SMP + if ((end - start) >= parisc_cache_flush_threshold) { flush_cache_all(); -#else - flush_cache_all_local(); -#endif + return; + } + + if (vma->vm_mm->context == mfsp(3)) { + flush_user_dcache_range_asm(start, end); + if (vma->vm_flags & VM_EXEC) + flush_user_icache_range_asm(start, end); + return; + } + + pgd = vma->vm_mm->pgd; + for (addr = start & PAGE_MASK; addr < end; addr += PAGE_SIZE) { + unsigned long pfn; + pte_t *ptep = get_ptep(pgd, addr); + if (!ptep) + continue; + pfn = pte_pfn(*ptep); + if (pfn_valid(pfn)) + __flush_cache_page(vma, addr, PFN_PHYS(pfn)); } } @@ -591,9 +597,10 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long { BUG_ON(!vma->vm_mm->context); - flush_tlb_page(vma, vmaddr); - __flush_cache_page(vma, vmaddr, page_to_phys(pfn_to_page(pfn))); - + if (pfn_valid(pfn)) { + flush_tlb_page(vma, vmaddr); + __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn)); + } } #ifdef CONFIG_PARISC_TMPALIAS From 06f0cce43a32bd2357cea1d8733bba48693d556b Mon Sep 17 00:00:00 2001 From: Alex Ivanov <gnidorah@p0n4ik.tk> Date: Wed, 10 Jul 2013 21:14:55 +0200 Subject: [PATCH 746/913] parisc: agp/parisc-agp: allow binding of user memory to the AGP GART MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow binding of user memory to the AGP GART on systems with HP Quicksilver AGP bus. This resolves 'bind memory failed' error seen in dmesg: [29.365973] [TTM] AGP Bind memory failed. … [29.367030] [drm] Forcing AGP to PCI mode The system doesn't more fail to bind the memory, and hence not falling back to the PCI mode (if other failures aren't detected). This is just a simple write down from the following patches: agp/amd-k7: Allow binding user memory to the AGP GART agp/hp-agp: Allow binding user memory to the AGP GART Signed-off-by: Alex Ivanov <gnidorah@p0n4ik.tk> Cc: <stable@vger.kernel.org> # 3.10 Signed-off-by: Helge Deller <deller@gmx.de> --- drivers/char/agp/parisc-agp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index bf5d2477cb77..15f2e7025b78 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c @@ -129,7 +129,8 @@ parisc_agp_insert_memory(struct agp_memory *mem, off_t pg_start, int type) off_t j, io_pg_start; int io_pg_count; - if (type != 0 || mem->type != 0) { + if (type != mem->type || + agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type)) { return -EINVAL; } @@ -175,7 +176,8 @@ parisc_agp_remove_memory(struct agp_memory *mem, off_t pg_start, int type) struct _parisc_agp_info *info = &parisc_agp_info; int i, io_pg_start, io_pg_count; - if (type != 0 || mem->type != 0) { + if (type != mem->type || + agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type)) { return -EINVAL; } From 78f1386cb0777e7413df734ddc30e41d0a6522a9 Mon Sep 17 00:00:00 2001 From: Helge Deller <deller@gmx.de> Date: Wed, 10 Jul 2013 23:50:35 +0200 Subject: [PATCH 747/913] parisc: add defconfig for c8000 machine Signed-off-by: Helge Deller <deller@gmx.de> --- arch/parisc/configs/c8000_defconfig | 279 ++++++++++++++++++++++++++++ 1 file changed, 279 insertions(+) create mode 100644 arch/parisc/configs/c8000_defconfig diff --git a/arch/parisc/configs/c8000_defconfig b/arch/parisc/configs/c8000_defconfig new file mode 100644 index 000000000000..f11006361297 --- /dev/null +++ b/arch/parisc/configs/c8000_defconfig @@ -0,0 +1,279 @@ +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_FHANDLE=y +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_BSD_PROCESS_ACCT_V3=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_RD_BZIP2=y +CONFIG_RD_LZMA=y +CONFIG_RD_LZO=y +CONFIG_EXPERT=y +CONFIG_SYSCTL_SYSCALL=y +CONFIG_SLAB=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_MODVERSIONS=y +CONFIG_BLK_DEV_INTEGRITY=y +CONFIG_PA8X00=y +CONFIG_MLONGCALLS=y +CONFIG_64BIT=y +CONFIG_SMP=y +CONFIG_PREEMPT=y +# CONFIG_CROSS_MEMORY_ATTACH is not set +CONFIG_IOMMU_CCIO=y +CONFIG_PCI=y +CONFIG_PCI_LBA=y +# CONFIG_SUPERIO is not set +# CONFIG_CHASSIS_LCD_LED is not set +# CONFIG_PDC_CHASSIS is not set +# CONFIG_PDC_CHASSIS_WARN is not set +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +CONFIG_BINFMT_MISC=m +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_XFRM_USER=m +CONFIG_XFRM_SUB_POLICY=y +CONFIG_NET_KEY=m +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_RARP=y +CONFIG_NET_IPIP=m +CONFIG_IP_MROUTE=y +CONFIG_IP_PIMSM_V1=y +CONFIG_IP_PIMSM_V2=y +CONFIG_SYN_COOKIES=y +CONFIG_INET_AH=m +CONFIG_INET_ESP=m +CONFIG_INET_IPCOMP=m +CONFIG_INET_XFRM_MODE_BEET=m +CONFIG_INET_DIAG=m +# CONFIG_IPV6 is not set +CONFIG_IP_DCCP=m +# CONFIG_IP_DCCP_CCID3 is not set +CONFIG_TIPC=m +CONFIG_LLC2=m +CONFIG_DNS_RESOLVER=y +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +# CONFIG_STANDALONE is not set +CONFIG_PARPORT=y +CONFIG_PARPORT_PC=y +CONFIG_PARPORT_PC_FIFO=y +CONFIG_BLK_DEV_UMEM=m +CONFIG_BLK_DEV_LOOP=m +CONFIG_BLK_DEV_CRYPTOLOOP=m +CONFIG_BLK_DEV_SX8=m +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=6144 +CONFIG_CDROM_PKTCDVD=m +CONFIG_CDROM_PKTCDVD_WCACHE=y +CONFIG_ATA_OVER_ETH=m +CONFIG_IDE=y +CONFIG_BLK_DEV_IDECD=y +CONFIG_BLK_DEV_PLATFORM=y +CONFIG_BLK_DEV_GENERIC=y +CONFIG_BLK_DEV_SIIMAGE=y +CONFIG_SCSI=y +CONFIG_BLK_DEV_SD=y +CONFIG_CHR_DEV_ST=m +CONFIG_BLK_DEV_SR=m +CONFIG_CHR_DEV_SG=y +CONFIG_CHR_DEV_SCH=m +CONFIG_SCSI_CONSTANTS=y +CONFIG_SCSI_LOGGING=y +CONFIG_SCSI_FC_ATTRS=y +CONFIG_SCSI_SAS_LIBSAS=m +CONFIG_ISCSI_TCP=m +CONFIG_ISCSI_BOOT_SYSFS=m +CONFIG_FUSION=y +CONFIG_FUSION_SPI=y +CONFIG_FUSION_SAS=y +CONFIG_NETDEVICES=y +CONFIG_DUMMY=m +CONFIG_NETCONSOLE=m +CONFIG_TUN=y +CONFIG_E1000=y +CONFIG_PPP=m +CONFIG_PPP_BSDCOMP=m +CONFIG_PPP_DEFLATE=m +CONFIG_PPP_MPPE=m +CONFIG_PPPOE=m +CONFIG_PPP_ASYNC=m +CONFIG_PPP_SYNC_TTY=m +# CONFIG_WLAN is not set +CONFIG_INPUT_FF_MEMLESS=m +# CONFIG_KEYBOARD_ATKBD is not set +# CONFIG_KEYBOARD_HIL_OLD is not set +# CONFIG_KEYBOARD_HIL is not set +CONFIG_MOUSE_PS2=m +CONFIG_INPUT_MISC=y +CONFIG_INPUT_CM109=m +CONFIG_SERIO_SERPORT=m +CONFIG_SERIO_PARKBD=m +CONFIG_SERIO_GSCPS2=m +# CONFIG_HP_SDC is not set +CONFIG_SERIO_PCIPS2=m +CONFIG_SERIO_LIBPS2=y +CONFIG_SERIO_RAW=m +CONFIG_SERIAL_8250=y +# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_NR_UARTS=8 +CONFIG_SERIAL_8250_RUNTIME_UARTS=8 +CONFIG_SERIAL_8250_EXTENDED=y +# CONFIG_SERIAL_MUX is not set +CONFIG_SERIAL_JSM=m +CONFIG_PRINTER=y +CONFIG_HW_RANDOM=y +CONFIG_RAW_DRIVER=m +CONFIG_PTP_1588_CLOCK=y +CONFIG_SSB=m +CONFIG_SSB_DRIVER_PCICORE=y +CONFIG_AGP=y +CONFIG_AGP_PARISC=y +CONFIG_DRM=y +CONFIG_DRM_RADEON=y +CONFIG_FIRMWARE_EDID=y +CONFIG_FB_FOREIGN_ENDIAN=y +CONFIG_FB_MODE_HELPERS=y +CONFIG_FB_TILEBLITTING=y +# CONFIG_FB_STI is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_LCD_CLASS_DEVICE is not set +# CONFIG_BACKLIGHT_GENERIC is not set +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_STI_CONSOLE is not set +CONFIG_LOGO=y +# CONFIG_LOGO_LINUX_MONO is not set +# CONFIG_LOGO_LINUX_VGA16 is not set +# CONFIG_LOGO_LINUX_CLUT224 is not set +CONFIG_SOUND=m +CONFIG_SND=m +CONFIG_SND_SEQUENCER=m +CONFIG_SND_SEQ_DUMMY=m +CONFIG_SND_MIXER_OSS=m +CONFIG_SND_PCM_OSS=m +CONFIG_SND_SEQUENCER_OSS=y +CONFIG_SND_VERBOSE_PRINTK=y +CONFIG_SND_AD1889=m +# CONFIG_SND_USB is not set +# CONFIG_SND_GSC is not set +CONFIG_HID_A4TECH=m +CONFIG_HID_APPLE=m +CONFIG_HID_BELKIN=m +CONFIG_HID_CHERRY=m +CONFIG_HID_CHICONY=m +CONFIG_HID_CYPRESS=m +CONFIG_HID_DRAGONRISE=m +CONFIG_HID_EZKEY=m +CONFIG_HID_KYE=m +CONFIG_HID_GYRATION=m +CONFIG_HID_TWINHAN=m +CONFIG_HID_KENSINGTON=m +CONFIG_HID_LOGITECH=m +CONFIG_HID_LOGITECH_DJ=m +CONFIG_HID_MICROSOFT=m +CONFIG_HID_MONTEREY=m +CONFIG_HID_NTRIG=m +CONFIG_HID_ORTEK=m +CONFIG_HID_PANTHERLORD=m +CONFIG_HID_PETALYNX=m +CONFIG_HID_SAMSUNG=m +CONFIG_HID_SUNPLUS=m +CONFIG_HID_GREENASIA=m +CONFIG_HID_SMARTJOYPLUS=m +CONFIG_HID_TOPSEED=m +CONFIG_HID_THRUSTMASTER=m +CONFIG_HID_ZEROPLUS=m +CONFIG_USB_HID=m +CONFIG_USB=y +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_STORAGE=y +CONFIG_EXT2_FS=y +CONFIG_EXT2_FS_XATTR=y +CONFIG_EXT2_FS_POSIX_ACL=y +CONFIG_EXT2_FS_SECURITY=y +CONFIG_EXT3_FS=y +# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set +CONFIG_EXT4_FS=m +CONFIG_REISERFS_FS=m +CONFIG_REISERFS_PROC_INFO=y +CONFIG_XFS_FS=m +CONFIG_XFS_POSIX_ACL=y +CONFIG_QUOTA=y +CONFIG_QFMT_V1=m +CONFIG_QFMT_V2=m +CONFIG_AUTOFS4_FS=m +CONFIG_FUSE_FS=m +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_PROC_KCORE=y +CONFIG_TMPFS=y +CONFIG_TMPFS_XATTR=y +CONFIG_NFS_FS=m +CONFIG_NLS_CODEPAGE_437=m +CONFIG_NLS_CODEPAGE_737=m +CONFIG_NLS_CODEPAGE_775=m +CONFIG_NLS_CODEPAGE_850=m +CONFIG_NLS_CODEPAGE_852=m +CONFIG_NLS_CODEPAGE_855=m +CONFIG_NLS_CODEPAGE_857=m +CONFIG_NLS_CODEPAGE_860=m +CONFIG_NLS_CODEPAGE_861=m +CONFIG_NLS_CODEPAGE_862=m +CONFIG_NLS_CODEPAGE_863=m +CONFIG_NLS_CODEPAGE_864=m +CONFIG_NLS_CODEPAGE_865=m +CONFIG_NLS_CODEPAGE_866=m +CONFIG_NLS_CODEPAGE_869=m +CONFIG_NLS_CODEPAGE_936=m +CONFIG_NLS_CODEPAGE_950=m +CONFIG_NLS_CODEPAGE_932=m +CONFIG_NLS_CODEPAGE_949=m +CONFIG_NLS_CODEPAGE_874=m +CONFIG_NLS_ISO8859_8=m +CONFIG_NLS_CODEPAGE_1250=m +CONFIG_NLS_CODEPAGE_1251=m +CONFIG_NLS_ASCII=m +CONFIG_NLS_ISO8859_1=m +CONFIG_NLS_ISO8859_2=m +CONFIG_NLS_ISO8859_3=m +CONFIG_NLS_ISO8859_4=m +CONFIG_NLS_ISO8859_5=m +CONFIG_NLS_ISO8859_6=m +CONFIG_NLS_ISO8859_7=m +CONFIG_NLS_ISO8859_9=m +CONFIG_NLS_ISO8859_13=m +CONFIG_NLS_ISO8859_14=m +CONFIG_NLS_ISO8859_15=m +CONFIG_NLS_KOI8_R=m +CONFIG_NLS_KOI8_U=m +CONFIG_NLS_UTF8=m +CONFIG_UNUSED_SYMBOLS=y +CONFIG_DEBUG_FS=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_DEBUG_SLAB=y +CONFIG_DEBUG_SLAB_LEAK=y +CONFIG_DEBUG_MEMORY_INIT=y +CONFIG_DEBUG_STACKOVERFLOW=y +CONFIG_LOCKUP_DETECTOR=y +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y +CONFIG_PANIC_ON_OOPS=y +CONFIG_DEBUG_RT_MUTEXES=y +CONFIG_RT_MUTEX_TESTER=y +CONFIG_PROVE_RCU_DELAY=y +CONFIG_DEBUG_BLOCK_EXT_DEVT=y +CONFIG_LATENCYTOP=y +CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y +CONFIG_KEYS=y +# CONFIG_CRYPTO_HW is not set +CONFIG_FONTS=y From 5a0ce2dc218ea9a6e659dcc5a4827975cb13104f Mon Sep 17 00:00:00 2001 From: John David Anglin <dave.anglin@bell.net> Date: Sun, 28 Jul 2013 17:49:53 -0400 Subject: [PATCH 748/913] parisc: Remove arch/parisc/kernel/sys32.h header The KERNEL_SYSCALL define is not used anymore so the header can be removed. Signed-off-by: John David Anglin <dave.anglin@bell.net> Signed-off-by: Helge Deller <deller@gmx.de> --- arch/parisc/kernel/signal.c | 7 ------ arch/parisc/kernel/signal32.c | 1 - arch/parisc/kernel/sys32.h | 36 ------------------------------- arch/parisc/kernel/sys_parisc32.c | 2 -- 4 files changed, 46 deletions(-) delete mode 100644 arch/parisc/kernel/sys32.h diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c index 940188d1942c..07349b002687 100644 --- a/arch/parisc/kernel/signal.c +++ b/arch/parisc/kernel/signal.c @@ -55,13 +55,6 @@ * this. */ #define A(__x) ((unsigned long)(__x)) -/* - * Atomically swap in the new signal mask, and wait for a signal. - */ -#ifdef CONFIG_64BIT -#include "sys32.h" -#endif - /* * Do a signal return - restore sigcontext. */ diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c index 33eca1b04926..6c6a271a6140 100644 --- a/arch/parisc/kernel/signal32.c +++ b/arch/parisc/kernel/signal32.c @@ -34,7 +34,6 @@ #include <asm/uaccess.h> #include "signal32.h" -#include "sys32.h" #define DEBUG_COMPAT_SIG 0 #define DEBUG_COMPAT_SIG_LEVEL 2 diff --git a/arch/parisc/kernel/sys32.h b/arch/parisc/kernel/sys32.h deleted file mode 100644 index 60dd470f39f8..000000000000 --- a/arch/parisc/kernel/sys32.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2002 Richard Hirst <rhirst at parisc-linux.org> - * Copyright (C) 2003 James Bottomley <jejb at parisc-linux.org> - * Copyright (C) 2003 Randolph Chung <tausq with parisc-linux.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#ifndef _PARISC64_KERNEL_SYS32_H -#define _PARISC64_KERNEL_SYS32_H - -#include <linux/compat.h> - -/* Call a kernel syscall which will use kernel space instead of user - * space for its copy_to/from_user. - */ -#define KERNEL_SYSCALL(ret, syscall, args...) \ -{ \ - mm_segment_t old_fs = get_fs(); \ - set_fs(KERNEL_DS); \ - ret = syscall(args); \ - set_fs (old_fs); \ -} - -#endif diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c index a134ff4da12e..bb9f3b64de55 100644 --- a/arch/parisc/kernel/sys_parisc32.c +++ b/arch/parisc/kernel/sys_parisc32.c @@ -42,8 +42,6 @@ #include <asm/uaccess.h> #include <asm/mmu_context.h> -#include "sys32.h" - #undef DEBUG #ifdef DEBUG From dd5e6d6a3db09b16b7c222943977865eead88cc3 Mon Sep 17 00:00:00 2001 From: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Date: Tue, 30 Jul 2013 02:02:16 +0200 Subject: [PATCH 749/913] parisc: Fix interrupt routing for C8000 serial ports We can't use dev->mod_index for selecting the interrupt routing entry, because it's not an index into interrupt routing table. It will be even wrong on a machine with 2 CPUs (4 cores). But all needed information is contained in the PAT entries for the serial ports. mod[0] contains the iosapic address and mod_info has some indications for the interrupt input (at least it looks like it). This patch implements the searching for the right iosapic and uses this interrupt input information. Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: <stable@vger.kernel.org> # 3.10 Signed-off-by: Helge Deller <deller@gmx.de> --- arch/parisc/include/asm/parisc-device.h | 3 ++ arch/parisc/kernel/inventory.c | 1 + drivers/parisc/iosapic.c | 38 ++++++++++++++++++------- drivers/tty/serial/8250/8250_gsc.c | 3 +- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/arch/parisc/include/asm/parisc-device.h b/arch/parisc/include/asm/parisc-device.h index 9afdad6c2ffb..eaf4dc1c7294 100644 --- a/arch/parisc/include/asm/parisc-device.h +++ b/arch/parisc/include/asm/parisc-device.h @@ -23,6 +23,7 @@ struct parisc_device { /* generic info returned from pdc_pat_cell_module() */ unsigned long mod_info; /* PAT specific - Misc Module info */ unsigned long pmod_loc; /* physical Module location */ + unsigned long mod0; #endif u64 dma_mask; /* DMA mask for I/O */ struct device dev; @@ -61,4 +62,6 @@ parisc_get_drvdata(struct parisc_device *d) extern struct bus_type parisc_bus_type; +int iosapic_serial_irq(struct parisc_device *dev); + #endif /*_ASM_PARISC_PARISC_DEVICE_H_*/ diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c index 3295ef4a185d..f0b6722fc706 100644 --- a/arch/parisc/kernel/inventory.c +++ b/arch/parisc/kernel/inventory.c @@ -211,6 +211,7 @@ pat_query_module(ulong pcell_loc, ulong mod_index) /* REVISIT: who is the consumer of this? not sure yet... */ dev->mod_info = pa_pdc_cell->mod_info; /* pass to PAT_GET_ENTITY() */ dev->pmod_loc = pa_pdc_cell->mod_location; + dev->mod0 = pa_pdc_cell->mod[0]; register_parisc_device(dev); /* advertise device */ diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index e79e006eb9ab..9ee04b4b68bf 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -811,18 +811,28 @@ int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev) return pcidev->irq; } -static struct iosapic_info *first_isi = NULL; +static struct iosapic_info *iosapic_list; #ifdef CONFIG_64BIT -int iosapic_serial_irq(int num) +int iosapic_serial_irq(struct parisc_device *dev) { - struct iosapic_info *isi = first_isi; - struct irt_entry *irte = NULL; /* only used if PAT PDC */ + struct iosapic_info *isi; + struct irt_entry *irte; struct vector_info *vi; - int isi_line; /* line used by device */ + int cnt; + int intin; + + intin = (dev->mod_info >> 24) & 15; /* lookup IRT entry for isi/slot/pin set */ - irte = &irt_cell[num]; + for (cnt = 0; cnt < irt_num_entry; cnt++) { + irte = &irt_cell[cnt]; + if (COMPARE_IRTE_ADDR(irte, dev->mod0) && + irte->dest_iosapic_intin == intin) + break; + } + if (cnt >= irt_num_entry) + return 0; /* no irq found, force polling */ DBG_IRT("iosapic_serial_irq(): irte %p %x %x %x %x %x %x %x %x\n", irte, @@ -834,11 +844,17 @@ int iosapic_serial_irq(int num) irte->src_seg_id, irte->dest_iosapic_intin, (u32) irte->dest_iosapic_addr); - isi_line = irte->dest_iosapic_intin; + + /* search for iosapic */ + for (isi = iosapic_list; isi; isi = isi->isi_next) + if (isi->isi_hpa == dev->mod0) + break; + if (!isi) + return 0; /* no iosapic found, force polling */ /* get vector info for this input line */ - vi = isi->isi_vector + isi_line; - DBG_IRT("iosapic_serial_irq: line %d vi 0x%p\n", isi_line, vi); + vi = isi->isi_vector + intin; + DBG_IRT("iosapic_serial_irq: line %d vi 0x%p\n", iosapic_intin, vi); /* If this IRQ line has already been setup, skip it */ if (vi->irte) @@ -941,8 +957,8 @@ void *iosapic_register(unsigned long hpa) vip->irqline = (unsigned char) cnt; vip->iosapic = isi; } - if (!first_isi) - first_isi = isi; + isi->isi_next = iosapic_list; + iosapic_list = isi; return isi; } diff --git a/drivers/tty/serial/8250/8250_gsc.c b/drivers/tty/serial/8250/8250_gsc.c index bb91b4713ebd..2e3ea1a70d7b 100644 --- a/drivers/tty/serial/8250/8250_gsc.c +++ b/drivers/tty/serial/8250/8250_gsc.c @@ -31,9 +31,8 @@ static int __init serial_init_chip(struct parisc_device *dev) int err; #ifdef CONFIG_64BIT - extern int iosapic_serial_irq(int cellnum); if (!dev->irq && (dev->id.sversion == 0xad)) - dev->irq = iosapic_serial_irq(dev->mod_index-1); + dev->irq = iosapic_serial_irq(dev); #endif if (!dev->irq) { From b2f47377e871a5f3cc5bd0dd58d3ea1fbc58948d Mon Sep 17 00:00:00 2001 From: hayeswang <hayeswang@realtek.com> Date: Wed, 31 Jul 2013 17:21:22 +0800 Subject: [PATCH 750/913] net/usb/r815x: replace USB buffer from stack to DMA-able Some USB buffers use stack which may not be DMA-able. Use the buffers from kmalloc to replace those one. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/usb/r815x.c | 44 +++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/drivers/net/usb/r815x.c b/drivers/net/usb/r815x.c index 852392269718..e9b99bad02a7 100644 --- a/drivers/net/usb/r815x.c +++ b/drivers/net/usb/r815x.c @@ -24,34 +24,43 @@ static int pla_read_word(struct usb_device *udev, u16 index) { - int data, ret; + int ret; u8 shift = index & 2; - __le32 ocp_data; + __le32 *tmp; + + tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); + if (!tmp) + return -ENOMEM; index &= ~3; ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, - index, MCU_TYPE_PLA, &ocp_data, sizeof(ocp_data), - 500); + index, MCU_TYPE_PLA, tmp, sizeof(*tmp), 500); if (ret < 0) - return ret; + goto out2; - data = __le32_to_cpu(ocp_data); - data >>= (shift * 8); - data &= 0xffff; + ret = __le32_to_cpu(*tmp); + ret >>= (shift * 8); + ret &= 0xffff; - return data; +out2: + kfree(tmp); + return ret; } static int pla_write_word(struct usb_device *udev, u16 index, u32 data) { - __le32 ocp_data; + __le32 *tmp; u32 mask = 0xffff; u16 byen = BYTE_EN_WORD; u8 shift = index & 2; int ret; + tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); + if (!tmp) + return -ENOMEM; + data &= mask; if (shift) { @@ -63,19 +72,20 @@ static int pla_write_word(struct usb_device *udev, u16 index, u32 data) ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, - index, MCU_TYPE_PLA, &ocp_data, sizeof(ocp_data), - 500); + index, MCU_TYPE_PLA, tmp, sizeof(*tmp), 500); if (ret < 0) - return ret; + goto out3; - data |= __le32_to_cpu(ocp_data) & ~mask; - ocp_data = __cpu_to_le32(data); + data |= __le32_to_cpu(*tmp) & ~mask; + *tmp = __cpu_to_le32(data); ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RTL815x_REQ_SET_REGS, RTL815x_REQT_WRITE, - index, MCU_TYPE_PLA | byen, &ocp_data, - sizeof(ocp_data), 500); + index, MCU_TYPE_PLA | byen, tmp, sizeof(*tmp), + 500); +out3: + kfree(tmp); return ret; } From b771721a748875e3654debdf68ad4708477f18c4 Mon Sep 17 00:00:00 2001 From: hayeswang <hayeswang@realtek.com> Date: Wed, 31 Jul 2013 17:21:23 +0800 Subject: [PATCH 751/913] net/usb/r815x: avoid to call mdio functions for runtime-suspended device Don't replace the usb_control_msg() with usbnet_{read,write}_cmd() which couldn't be called inside suspend/resume callback. Keep the basic functions unlimited. Instead, using usb_autopm_get_interface() and usb_autopm_put_interface() in r815x_mdio_{read,write}(). Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/usb/r815x.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/r815x.c b/drivers/net/usb/r815x.c index e9b99bad02a7..1a80e76ce0b9 100644 --- a/drivers/net/usb/r815x.c +++ b/drivers/net/usb/r815x.c @@ -126,11 +126,18 @@ out1: static int r815x_mdio_read(struct net_device *netdev, int phy_id, int reg) { struct usbnet *dev = netdev_priv(netdev); + int ret; if (phy_id != R815x_PHY_ID) return -EINVAL; - return ocp_reg_read(dev, BASE_MII + reg * 2); + if (usb_autopm_get_interface(dev->intf) < 0) + return -ENODEV; + + ret = ocp_reg_read(dev, BASE_MII + reg * 2); + + usb_autopm_put_interface(dev->intf); + return ret; } static @@ -141,7 +148,12 @@ void r815x_mdio_write(struct net_device *netdev, int phy_id, int reg, int val) if (phy_id != R815x_PHY_ID) return; + if (usb_autopm_get_interface(dev->intf) < 0) + return; + ocp_reg_write(dev, BASE_MII + reg * 2, val); + + usb_autopm_put_interface(dev->intf); } static int r8153_bind(struct usbnet *dev, struct usb_interface *intf) From 543ae7f9c4e69816043ac3b526310353b413b325 Mon Sep 17 00:00:00 2001 From: hayeswang <hayeswang@realtek.com> Date: Wed, 31 Jul 2013 17:21:24 +0800 Subject: [PATCH 752/913] net/usb/r815x: change the return value for bind functions Replace 0 with the result from usbnet_cdc_bind(). Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/usb/r815x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/r815x.c b/drivers/net/usb/r815x.c index 1a80e76ce0b9..2df2f4fb42a7 100644 --- a/drivers/net/usb/r815x.c +++ b/drivers/net/usb/r815x.c @@ -172,7 +172,7 @@ static int r8153_bind(struct usbnet *dev, struct usb_interface *intf) dev->mii.phy_id = R815x_PHY_ID; dev->mii.supports_gmii = 1; - return 0; + return status; } static int r8152_bind(struct usbnet *dev, struct usb_interface *intf) @@ -191,7 +191,7 @@ static int r8152_bind(struct usbnet *dev, struct usb_interface *intf) dev->mii.phy_id = R815x_PHY_ID; dev->mii.supports_gmii = 0; - return 0; + return status; } static const struct driver_info r8152_info = { From 31787f5398c3c5aced755e8abd5ae00a2c371cd4 Mon Sep 17 00:00:00 2001 From: hayeswang <hayeswang@realtek.com> Date: Wed, 31 Jul 2013 17:21:25 +0800 Subject: [PATCH 753/913] net/usb/r8152: make sure the USB buffer is DMA-able Allocate the required memory before calling usb_control_msg. And the additional memory copy is necessary. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/usb/r8152.c | 60 ++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index ee13f9eb740c..ef033ab80e7f 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -344,17 +344,41 @@ static const int multicast_filter_limit = 32; static int get_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) { - return usb_control_msg(tp->udev, usb_rcvctrlpipe(tp->udev, 0), + int ret; + void *tmp; + + tmp = kmalloc(size, GFP_KERNEL); + if (!tmp) + return -ENOMEM; + + ret = usb_control_msg(tp->udev, usb_rcvctrlpipe(tp->udev, 0), RTL8152_REQ_GET_REGS, RTL8152_REQT_READ, - value, index, data, size, 500); + value, index, tmp, size, 500); + + memcpy(data, tmp, size); + kfree(tmp); + + return ret; } static int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) { - return usb_control_msg(tp->udev, usb_sndctrlpipe(tp->udev, 0), + int ret; + void *tmp; + + tmp = kmalloc(size, GFP_KERNEL); + if (!tmp) + return -ENOMEM; + + memcpy(tmp, data, size); + + ret = usb_control_msg(tp->udev, usb_sndctrlpipe(tp->udev, 0), RTL8152_REQ_SET_REGS, RTL8152_REQT_WRITE, - value, index, data, size, 500); + value, index, tmp, size, 500); + + kfree(tmp); + return ret; } static int generic_ocp_read(struct r8152 *tp, u16 index, u16 size, @@ -685,21 +709,14 @@ static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data) static inline void set_ethernet_addr(struct r8152 *tp) { struct net_device *dev = tp->netdev; - u8 *node_id; + u8 node_id[8] = {0}; - node_id = kmalloc(sizeof(u8) * 8, GFP_KERNEL); - if (!node_id) { - netif_err(tp, probe, dev, "out of memory"); - return; - } - - if (pla_ocp_read(tp, PLA_IDR, sizeof(u8) * 8, node_id) < 0) + if (pla_ocp_read(tp, PLA_IDR, sizeof(node_id), node_id) < 0) netif_notice(tp, probe, dev, "inet addr fail\n"); else { memcpy(dev->dev_addr, node_id, dev->addr_len); memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); } - kfree(node_id); } static int rtl8152_set_mac_address(struct net_device *netdev, void *p) @@ -882,15 +899,10 @@ static void rtl8152_set_rx_mode(struct net_device *netdev) static void _rtl8152_set_rx_mode(struct net_device *netdev) { struct r8152 *tp = netdev_priv(netdev); - u32 tmp, *mc_filter; /* Multicast hash filter */ + u32 mc_filter[2]; /* Multicast hash filter */ + __le32 tmp[2]; u32 ocp_data; - mc_filter = kmalloc(sizeof(u32) * 2, GFP_KERNEL); - if (!mc_filter) { - netif_err(tp, link, netdev, "out of memory"); - return; - } - clear_bit(RTL8152_SET_RX_MODE, &tp->flags); netif_stop_queue(netdev); ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); @@ -918,14 +930,12 @@ static void _rtl8152_set_rx_mode(struct net_device *netdev) } } - tmp = mc_filter[0]; - mc_filter[0] = __cpu_to_le32(swab32(mc_filter[1])); - mc_filter[1] = __cpu_to_le32(swab32(tmp)); + tmp[0] = __cpu_to_le32(swab32(mc_filter[1])); + tmp[1] = __cpu_to_le32(swab32(mc_filter[0])); - pla_ocp_write(tp, PLA_MAR, BYTE_EN_DWORD, sizeof(u32) * 2, mc_filter); + pla_ocp_write(tp, PLA_MAR, BYTE_EN_DWORD, sizeof(tmp), tmp); ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); netif_wake_queue(netdev); - kfree(mc_filter); } static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb, From c8826de8af3b3c849ba9197851211ced62387a57 Mon Sep 17 00:00:00 2001 From: hayeswang <hayeswang@realtek.com> Date: Wed, 31 Jul 2013 17:21:26 +0800 Subject: [PATCH 754/913] net/usb/r8152: adjust relative ocp function - fix the conversion between cpu and __le32 - replace some pla_ocp and usb_ocp functions with generic_ocp function Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/usb/r8152.c | 66 ++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 43 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index ef033ab80e7f..11c51f275366 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -514,37 +514,31 @@ int usb_ocp_write(struct r8152 *tp, u16 index, u16 byteen, u16 size, void *data) static u32 ocp_read_dword(struct r8152 *tp, u16 type, u16 index) { - u32 data; + __le32 data; - if (type == MCU_TYPE_PLA) - pla_ocp_read(tp, index, sizeof(data), &data); - else - usb_ocp_read(tp, index, sizeof(data), &data); + generic_ocp_read(tp, index, sizeof(data), &data, type); return __le32_to_cpu(data); } static void ocp_write_dword(struct r8152 *tp, u16 type, u16 index, u32 data) { - if (type == MCU_TYPE_PLA) - pla_ocp_write(tp, index, BYTE_EN_DWORD, sizeof(data), &data); - else - usb_ocp_write(tp, index, BYTE_EN_DWORD, sizeof(data), &data); + __le32 tmp = __cpu_to_le32(data); + + generic_ocp_write(tp, index, BYTE_EN_DWORD, sizeof(tmp), &tmp, type); } static u16 ocp_read_word(struct r8152 *tp, u16 type, u16 index) { u32 data; + __le32 tmp; u8 shift = index & 2; index &= ~3; - if (type == MCU_TYPE_PLA) - pla_ocp_read(tp, index, sizeof(data), &data); - else - usb_ocp_read(tp, index, sizeof(data), &data); + generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); - data = __le32_to_cpu(data); + data = __le32_to_cpu(tmp); data >>= (shift * 8); data &= 0xffff; @@ -553,7 +547,8 @@ static u16 ocp_read_word(struct r8152 *tp, u16 type, u16 index) static void ocp_write_word(struct r8152 *tp, u16 type, u16 index, u32 data) { - u32 tmp, mask = 0xffff; + u32 mask = 0xffff; + __le32 tmp; u16 byen = BYTE_EN_WORD; u8 shift = index & 2; @@ -566,34 +561,25 @@ static void ocp_write_word(struct r8152 *tp, u16 type, u16 index, u32 data) index &= ~3; } - if (type == MCU_TYPE_PLA) - pla_ocp_read(tp, index, sizeof(tmp), &tmp); - else - usb_ocp_read(tp, index, sizeof(tmp), &tmp); + generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); - tmp = __le32_to_cpu(tmp) & ~mask; - tmp |= data; - tmp = __cpu_to_le32(tmp); + data |= __le32_to_cpu(tmp) & ~mask; + tmp = __cpu_to_le32(data); - if (type == MCU_TYPE_PLA) - pla_ocp_write(tp, index, byen, sizeof(tmp), &tmp); - else - usb_ocp_write(tp, index, byen, sizeof(tmp), &tmp); + generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); } static u8 ocp_read_byte(struct r8152 *tp, u16 type, u16 index) { u32 data; + __le32 tmp; u8 shift = index & 3; index &= ~3; - if (type == MCU_TYPE_PLA) - pla_ocp_read(tp, index, sizeof(data), &data); - else - usb_ocp_read(tp, index, sizeof(data), &data); + generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); - data = __le32_to_cpu(data); + data = __le32_to_cpu(tmp); data >>= (shift * 8); data &= 0xff; @@ -602,7 +588,8 @@ static u8 ocp_read_byte(struct r8152 *tp, u16 type, u16 index) static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data) { - u32 tmp, mask = 0xff; + u32 mask = 0xff; + __le32 tmp; u16 byen = BYTE_EN_BYTE; u8 shift = index & 3; @@ -615,19 +602,12 @@ static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data) index &= ~3; } - if (type == MCU_TYPE_PLA) - pla_ocp_read(tp, index, sizeof(tmp), &tmp); - else - usb_ocp_read(tp, index, sizeof(tmp), &tmp); + generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); - tmp = __le32_to_cpu(tmp) & ~mask; - tmp |= data; - tmp = __cpu_to_le32(tmp); + data |= __le32_to_cpu(tmp) & ~mask; + tmp = __cpu_to_le32(data); - if (type == MCU_TYPE_PLA) - pla_ocp_write(tp, index, byen, sizeof(tmp), &tmp); - else - usb_ocp_write(tp, index, byen, sizeof(tmp), &tmp); + generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); } static void r8152_mdio_write(struct r8152 *tp, u32 reg_addr, u32 value) From 8cb3b9c3642c0263d48f31d525bcee7170eedc20 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@oracle.com> Date: Tue, 30 Jul 2013 13:23:39 +0300 Subject: [PATCH 755/913] net_sched: info leak in atm_tc_dump_class() The "pvc" struct has a hole after pvc.sap_family which is not cleared. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/sched/sch_atm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index ca8e0a57d945..1f9c31411f19 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c @@ -605,6 +605,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, struct sockaddr_atmpvc pvc; int state; + memset(&pvc, 0, sizeof(pvc)); pvc.sap_family = AF_ATMPVC; pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1; pvc.sap_addr.vpi = flow->vcc->vpi; From d9d10a30964504af834d8d250a0c76d4ae91eb1e Mon Sep 17 00:00:00 2001 From: Joe Perches <joe@perches.com> Date: Tue, 30 Jul 2013 10:31:00 -0700 Subject: [PATCH 756/913] ndisc: Add missing inline to ndisc_addr_option_pad Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- include/net/ndisc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 949d77528f2f..6fea32340ae8 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -119,7 +119,7 @@ extern struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len, * if RFC 3831 IPv6-over-Fibre Channel is ever implemented it may * also need a pad of 2. */ -static int ndisc_addr_option_pad(unsigned short type) +static inline int ndisc_addr_option_pad(unsigned short type) { switch (type) { case ARPHRD_INFINIBAND: return 2; From cf3c4c03060b688cbc389ebc5065ebcce5653e96 Mon Sep 17 00:00:00 2001 From: Neil Horman <nhorman@tuxdriver.com> Date: Wed, 31 Jul 2013 09:03:56 -0400 Subject: [PATCH 757/913] 8139cp: Add dma_mapping_error checking Self explanitory dma_mapping_error addition to the 8139 driver, based on this: https://bugzilla.redhat.com/show_bug.cgi?id=947250 It showed several backtraces arising for dma_map_* usage without checking the return code on the mapping. Add the check and abort the rx/tx operation if its failed. Untested as I have no hardware and the reporter has wandered off, but seems pretty straightforward. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> CC: "David S. Miller" <davem@davemloft.net> CC: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/realtek/8139cp.c | 48 +++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index e6acb9fa5767..6f35f8404d68 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c @@ -478,7 +478,7 @@ rx_status_loop: while (1) { u32 status, len; - dma_addr_t mapping; + dma_addr_t mapping, new_mapping; struct sk_buff *skb, *new_skb; struct cp_desc *desc; const unsigned buflen = cp->rx_buf_sz; @@ -520,6 +520,13 @@ rx_status_loop: goto rx_next; } + new_mapping = dma_map_single(&cp->pdev->dev, new_skb->data, buflen, + PCI_DMA_FROMDEVICE); + if (dma_mapping_error(&cp->pdev->dev, new_mapping)) { + dev->stats.rx_dropped++; + goto rx_next; + } + dma_unmap_single(&cp->pdev->dev, mapping, buflen, PCI_DMA_FROMDEVICE); @@ -531,12 +538,11 @@ rx_status_loop: skb_put(skb, len); - mapping = dma_map_single(&cp->pdev->dev, new_skb->data, buflen, - PCI_DMA_FROMDEVICE); cp->rx_skb[rx_tail] = new_skb; cp_rx_skb(cp, skb, desc); rx++; + mapping = new_mapping; rx_next: cp->rx_ring[rx_tail].opts2 = 0; @@ -716,6 +722,22 @@ static inline u32 cp_tx_vlan_tag(struct sk_buff *skb) TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00; } +static void unwind_tx_frag_mapping(struct cp_private *cp, struct sk_buff *skb, + int first, int entry_last) +{ + int frag, index; + struct cp_desc *txd; + skb_frag_t *this_frag; + for (frag = 0; frag+first < entry_last; frag++) { + index = first+frag; + cp->tx_skb[index] = NULL; + txd = &cp->tx_ring[index]; + this_frag = &skb_shinfo(skb)->frags[frag]; + dma_unmap_single(&cp->pdev->dev, le64_to_cpu(txd->addr), + skb_frag_size(this_frag), PCI_DMA_TODEVICE); + } +} + static netdev_tx_t cp_start_xmit (struct sk_buff *skb, struct net_device *dev) { @@ -749,6 +771,9 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, len = skb->len; mapping = dma_map_single(&cp->pdev->dev, skb->data, len, PCI_DMA_TODEVICE); + if (dma_mapping_error(&cp->pdev->dev, mapping)) + goto out_dma_error; + txd->opts2 = opts2; txd->addr = cpu_to_le64(mapping); wmb(); @@ -786,6 +811,9 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, first_len = skb_headlen(skb); first_mapping = dma_map_single(&cp->pdev->dev, skb->data, first_len, PCI_DMA_TODEVICE); + if (dma_mapping_error(&cp->pdev->dev, first_mapping)) + goto out_dma_error; + cp->tx_skb[entry] = skb; entry = NEXT_TX(entry); @@ -799,6 +827,11 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, mapping = dma_map_single(&cp->pdev->dev, skb_frag_address(this_frag), len, PCI_DMA_TODEVICE); + if (dma_mapping_error(&cp->pdev->dev, mapping)) { + unwind_tx_frag_mapping(cp, skb, first_entry, entry); + goto out_dma_error; + } + eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; ctrl = eor | len | DescOwn; @@ -859,11 +892,16 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1)) netif_stop_queue(dev); +out_unlock: spin_unlock_irqrestore(&cp->lock, intr_flags); cpw8(TxPoll, NormalTxPoll); return NETDEV_TX_OK; +out_dma_error: + kfree_skb(skb); + cp->dev->stats.tx_dropped++; + goto out_unlock; } /* Set or clear the multicast filter for this adaptor. @@ -1054,6 +1092,10 @@ static int cp_refill_rx(struct cp_private *cp) mapping = dma_map_single(&cp->pdev->dev, skb->data, cp->rx_buf_sz, PCI_DMA_FROMDEVICE); + if (dma_mapping_error(&cp->pdev->dev, mapping)) { + kfree_skb(skb); + goto err_out; + } cp->rx_skb[i] = skb; cp->rx_ring[i].opts2 = 0; From b00589af3b04736376f24625ab0b394642e89e29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@web.de> Date: Thu, 1 Aug 2013 01:06:20 +0200 Subject: [PATCH 758/913] bridge: disable snooping if there is no querier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If there is no querier on a link then we won't get periodic reports and therefore won't be able to learn about multicast listeners behind ports, potentially leading to lost multicast packets, especially for multicast listeners that joined before the creation of the bridge. These lost multicast packets can appear since c5c23260594 ("bridge: Add multicast_querier toggle and disable queries by default") in particular. With this patch we are flooding multicast packets if our querier is disabled and if we didn't detect any other querier. A grace period of the Maximum Response Delay of the querier is added to give multicast responses enough time to arrive and to be learned from before disabling the flooding behaviour again. Signed-off-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/bridge/br_device.c | 3 ++- net/bridge/br_input.c | 3 ++- net/bridge/br_multicast.c | 39 ++++++++++++++++++++++++++++++--------- net/bridge/br_private.h | 12 ++++++++++++ 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 2ef66781fedb..69363bd37f64 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -70,7 +70,8 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) } mdst = br_mdb_get(br, skb, vid); - if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) + if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && + br_multicast_querier_exists(br)) br_multicast_deliver(mdst, skb); else br_flood_deliver(br, skb, false); diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index 1b8b8b824cd7..8c561c0aa636 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c @@ -101,7 +101,8 @@ int br_handle_frame_finish(struct sk_buff *skb) unicast = false; } else if (is_multicast_ether_addr(dest)) { mdst = br_mdb_get(br, skb, vid); - if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) { + if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && + br_multicast_querier_exists(br)) { if ((mdst && mdst->mglist) || br_multicast_is_router(br)) skb2 = skb; diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 4b99c9a27044..61c5e819380e 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -1014,6 +1014,16 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, } #endif +static void br_multicast_update_querier_timer(struct net_bridge *br, + unsigned long max_delay) +{ + if (!timer_pending(&br->multicast_querier_timer)) + br->multicast_querier_delay_time = jiffies + max_delay; + + mod_timer(&br->multicast_querier_timer, + jiffies + br->multicast_querier_interval); +} + /* * Add port to router_list * list is maintained ordered by pointer value @@ -1064,11 +1074,11 @@ timer: static void br_multicast_query_received(struct net_bridge *br, struct net_bridge_port *port, - int saddr) + int saddr, + unsigned long max_delay) { if (saddr) - mod_timer(&br->multicast_querier_timer, - jiffies + br->multicast_querier_interval); + br_multicast_update_querier_timer(br, max_delay); else if (timer_pending(&br->multicast_querier_timer)) return; @@ -1096,8 +1106,6 @@ static int br_ip4_multicast_query(struct net_bridge *br, (port && port->state == BR_STATE_DISABLED)) goto out; - br_multicast_query_received(br, port, !!iph->saddr); - group = ih->group; if (skb->len == sizeof(*ih)) { @@ -1121,6 +1129,8 @@ static int br_ip4_multicast_query(struct net_bridge *br, IGMPV3_MRC(ih3->code) * (HZ / IGMP_TIMER_SCALE) : 1; } + br_multicast_query_received(br, port, !!iph->saddr, max_delay); + if (!group) goto out; @@ -1176,8 +1186,6 @@ static int br_ip6_multicast_query(struct net_bridge *br, (port && port->state == BR_STATE_DISABLED)) goto out; - br_multicast_query_received(br, port, !ipv6_addr_any(&ip6h->saddr)); - if (skb->len == sizeof(*mld)) { if (!pskb_may_pull(skb, sizeof(*mld))) { err = -EINVAL; @@ -1198,6 +1206,9 @@ static int br_ip6_multicast_query(struct net_bridge *br, max_delay = mld2q->mld2q_mrc ? MLDV2_MRC(ntohs(mld2q->mld2q_mrc)) : 1; } + br_multicast_query_received(br, port, !ipv6_addr_any(&ip6h->saddr), + max_delay); + if (!group) goto out; @@ -1643,6 +1654,8 @@ void br_multicast_init(struct net_bridge *br) br->multicast_querier_interval = 255 * HZ; br->multicast_membership_interval = 260 * HZ; + br->multicast_querier_delay_time = 0; + spin_lock_init(&br->multicast_lock); setup_timer(&br->multicast_router_timer, br_multicast_local_router_expired, 0); @@ -1831,6 +1844,8 @@ unlock: int br_multicast_set_querier(struct net_bridge *br, unsigned long val) { + unsigned long max_delay; + val = !!val; spin_lock_bh(&br->multicast_lock); @@ -1838,8 +1853,14 @@ int br_multicast_set_querier(struct net_bridge *br, unsigned long val) goto unlock; br->multicast_querier = val; - if (val) - br_multicast_start_querier(br); + if (!val) + goto unlock; + + max_delay = br->multicast_query_response_interval; + if (!timer_pending(&br->multicast_querier_timer)) + br->multicast_querier_delay_time = jiffies + max_delay; + + br_multicast_start_querier(br); unlock: spin_unlock_bh(&br->multicast_lock); diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 3be89b3ce17b..2f7da41851bf 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -267,6 +267,7 @@ struct net_bridge unsigned long multicast_query_interval; unsigned long multicast_query_response_interval; unsigned long multicast_startup_query_interval; + unsigned long multicast_querier_delay_time; spinlock_t multicast_lock; struct net_bridge_mdb_htable __rcu *mdb; @@ -501,6 +502,13 @@ static inline bool br_multicast_is_router(struct net_bridge *br) (br->multicast_router == 1 && timer_pending(&br->multicast_router_timer)); } + +static inline bool br_multicast_querier_exists(struct net_bridge *br) +{ + return time_is_before_jiffies(br->multicast_querier_delay_time) && + (br->multicast_querier || + timer_pending(&br->multicast_querier_timer)); +} #else static inline int br_multicast_rcv(struct net_bridge *br, struct net_bridge_port *port, @@ -557,6 +565,10 @@ static inline bool br_multicast_is_router(struct net_bridge *br) { return 0; } +static inline bool br_multicast_querier_exists(struct net_bridge *br) +{ + return false; +} static inline void br_mdb_init(void) { } From aa52aeea2725839bdd3dcce394486e9a043065e0 Mon Sep 17 00:00:00 2001 From: Asias He <asias@redhat.com> Date: Thu, 1 Aug 2013 11:07:18 +0930 Subject: [PATCH 759/913] virtio-scsi: Fix virtqueue affinity setup vscsi->num_queues counts the number of request virtqueue which does not include the control and event virtqueue. It is wrong to subtract VIRTIO_SCSI_VQ_BASE from vscsi->num_queues. This patch fixes the following panic. (qemu) device_del scsi0 BUG: unable to handle kernel NULL pointer dereference at 0000000000000020 IP: [<ffffffff8179b29f>] __virtscsi_set_affinity+0x6f/0x120 PGD 0 Oops: 0000 [#1] SMP Modules linked in: CPU: 0 PID: 659 Comm: kworker/0:1 Not tainted 3.11.0-rc2+ #1172 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 Workqueue: kacpi_hotplug _handle_hotplug_event_func task: ffff88007bee1cc0 ti: ffff88007bfe4000 task.ti: ffff88007bfe4000 RIP: 0010:[<ffffffff8179b29f>] [<ffffffff8179b29f>] __virtscsi_set_affinity+0x6f/0x120 RSP: 0018:ffff88007bfe5a38 EFLAGS: 00010202 RAX: 0000000000000010 RBX: ffff880077fd0d28 RCX: 0000000000000050 RDX: 0000000000000000 RSI: 0000000000000246 RDI: 0000000000000000 RBP: ffff88007bfe5a58 R08: ffff880077f6ff00 R09: 0000000000000001 R10: ffffffff8143e673 R11: 0000000000000001 R12: 0000000000000001 R13: ffff880077fd0800 R14: 0000000000000000 R15: ffff88007bf489b0 FS: 0000000000000000(0000) GS:ffff88007ea00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000020 CR3: 0000000079f8b000 CR4: 00000000000006f0 Stack: ffff880077fd0d28 0000000000000000 ffff880077fd0800 0000000000000008 ffff88007bfe5a78 ffffffff8179b37d ffff88007bccc800 ffff88007bccc800 ffff88007bfe5a98 ffffffff8179b3b6 ffff88007bccc800 ffff880077fd0d28 Call Trace: [<ffffffff8179b37d>] virtscsi_set_affinity+0x2d/0x40 [<ffffffff8179b3b6>] virtscsi_remove_vqs+0x26/0x50 [<ffffffff8179c7d2>] virtscsi_remove+0x82/0xa0 [<ffffffff814cb6b2>] virtio_dev_remove+0x22/0x70 [<ffffffff8167ca49>] __device_release_driver+0x69/0xd0 [<ffffffff8167cb9d>] device_release_driver+0x2d/0x40 [<ffffffff8167bb96>] bus_remove_device+0x116/0x150 [<ffffffff81679936>] device_del+0x126/0x1e0 [<ffffffff81679a06>] device_unregister+0x16/0x30 [<ffffffff814cb889>] unregister_virtio_device+0x19/0x30 [<ffffffff814cdad6>] virtio_pci_remove+0x36/0x80 [<ffffffff81464ae7>] pci_device_remove+0x37/0x70 [<ffffffff8167ca49>] __device_release_driver+0x69/0xd0 [<ffffffff8167cb9d>] device_release_driver+0x2d/0x40 [<ffffffff8167bb96>] bus_remove_device+0x116/0x150 [<ffffffff81679936>] device_del+0x126/0x1e0 [<ffffffff8145edfc>] pci_stop_bus_device+0x9c/0xb0 [<ffffffff8145f036>] pci_stop_and_remove_bus_device+0x16/0x30 [<ffffffff81474a9e>] acpiphp_disable_slot+0x8e/0x150 [<ffffffff81474f6a>] hotplug_event_func+0xba/0x1a0 [<ffffffff814906c8>] ? acpi_os_release_object+0xe/0x12 [<ffffffff81475911>] _handle_hotplug_event_func+0x31/0x70 [<ffffffff810b5333>] process_one_work+0x183/0x500 [<ffffffff810b66e2>] worker_thread+0x122/0x400 [<ffffffff810b65c0>] ? manage_workers+0x2d0/0x2d0 [<ffffffff810bc5de>] kthread+0xce/0xe0 [<ffffffff810bc510>] ? kthread_freezable_should_stop+0x70/0x70 [<ffffffff81ca045c>] ret_from_fork+0x7c/0xb0 [<ffffffff810bc510>] ? kthread_freezable_should_stop+0x70/0x70 Code: 01 00 00 00 74 59 45 31 e4 83 bb c8 01 00 00 02 74 46 66 2e 0f 1f 84 00 00 00 00 00 49 63 c4 48 c1 e0 04 48 8b bc 0 3 10 02 00 00 <48> 8b 47 20 48 8b 80 d0 01 00 00 48 8b 40 50 48 85 c0 74 07 be RIP [<ffffffff8179b29f>] __virtscsi_set_affinity+0x6f/0x120 RSP <ffff88007bfe5a38> CR2: 0000000000000020 ---[ end trace 99679331a3775f48 ]--- CC: stable@vger.kernel.org Signed-off-by: Asias He <asias@redhat.com> Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/scsi/virtio_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 2168258fb2c3..74b88efde6ad 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -751,7 +751,7 @@ static void __virtscsi_set_affinity(struct virtio_scsi *vscsi, bool affinity) vscsi->affinity_hint_set = true; } else { - for (i = 0; i < vscsi->num_queues - VIRTIO_SCSI_VQ_BASE; i++) + for (i = 0; i < vscsi->num_queues; i++) virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1); vscsi->affinity_hint_set = false; From 40c32592668b727cbfcf7b1c0567f581bd62a5e4 Mon Sep 17 00:00:00 2001 From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org> Date: Wed, 3 Jul 2013 23:33:50 -0400 Subject: [PATCH 760/913] tracing/kprobes: Fail to unregister if probe event files are in use When a probe is being removed, it cleans up the event files that correspond to the probe. But there is a race between writing to one of these files and deleting the probe. This is especially true for the "enable" file. CPU 0 CPU 1 ----- ----- fd = open("enable",O_WRONLY); probes_open() release_all_trace_probes() unregister_trace_probe() if (trace_probe_is_enabled(tp)) return -EBUSY write(fd, "1", 1) __ftrace_set_clr_event() call->class->reg() (kprobe_register) enable_trace_probe(tp) __unregister_trace_probe(tp); list_del(&tp->list) unregister_probe_event(tp) <-- fails! free_trace_probe(tp) write(fd, "0", 1) __ftrace_set_clr_event() call->class->unreg (kprobe_register) disable_trace_probe(tp) <-- BOOM! A test program was written that used two threads to simulate the above scenario adding a nanosleep() interval to change the timings and after several thousand runs, it was able to trigger this bug and crash: BUG: unable to handle kernel paging request at 00000005000000f9 IP: [<ffffffff810dee70>] probes_open+0x3b/0xa7 PGD 7808a067 PUD 0 Oops: 0000 [#1] PREEMPT SMP Dumping ftrace buffer: --------------------------------- Modules linked in: ipt_MASQUERADE sunrpc ip6t_REJECT nf_conntrack_ipv6 CPU: 1 PID: 2070 Comm: test-kprobe-rem Not tainted 3.11.0-rc3-test+ #47 Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./To be filled by O.E.M., BIOS SDBLI944.86P 05/08/2007 task: ffff880077756440 ti: ffff880076e52000 task.ti: ffff880076e52000 RIP: 0010:[<ffffffff810dee70>] [<ffffffff810dee70>] probes_open+0x3b/0xa7 RSP: 0018:ffff880076e53c38 EFLAGS: 00010203 RAX: 0000000500000001 RBX: ffff88007844f440 RCX: 0000000000000003 RDX: 0000000000000003 RSI: 0000000000000003 RDI: ffff880076e52000 RBP: ffff880076e53c58 R08: ffff880076e53bd8 R09: 0000000000000000 R10: ffff880077756440 R11: 0000000000000006 R12: ffffffff810dee35 R13: ffff880079250418 R14: 0000000000000000 R15: ffff88007844f450 FS: 00007f87a276f700(0000) GS:ffff88007d480000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 00000005000000f9 CR3: 0000000077262000 CR4: 00000000000007e0 Stack: ffff880076e53c58 ffffffff81219ea0 ffff88007844f440 ffffffff810dee35 ffff880076e53ca8 ffffffff81130f78 ffff8800772986c0 ffff8800796f93a0 ffffffff81d1b5d8 ffff880076e53e04 0000000000000000 ffff88007844f440 Call Trace: [<ffffffff81219ea0>] ? security_file_open+0x2c/0x30 [<ffffffff810dee35>] ? unregister_trace_probe+0x4b/0x4b [<ffffffff81130f78>] do_dentry_open+0x162/0x226 [<ffffffff81131186>] finish_open+0x46/0x54 [<ffffffff8113f30b>] do_last+0x7f6/0x996 [<ffffffff8113cc6f>] ? inode_permission+0x42/0x44 [<ffffffff8113f6dd>] path_openat+0x232/0x496 [<ffffffff8113fc30>] do_filp_open+0x3a/0x8a [<ffffffff8114ab32>] ? __alloc_fd+0x168/0x17a [<ffffffff81131f4e>] do_sys_open+0x70/0x102 [<ffffffff8108f06e>] ? trace_hardirqs_on_caller+0x160/0x197 [<ffffffff81131ffe>] SyS_open+0x1e/0x20 [<ffffffff81522742>] system_call_fastpath+0x16/0x1b Code: e5 41 54 53 48 89 f3 48 83 ec 10 48 23 56 78 48 39 c2 75 6c 31 f6 48 c7 RIP [<ffffffff810dee70>] probes_open+0x3b/0xa7 RSP <ffff880076e53c38> CR2: 00000005000000f9 ---[ end trace 35f17d68fc569897 ]--- The unregister_trace_probe() must be done first, and if it fails it must fail the removal of the kprobe. Several changes have already been made by Oleg Nesterov and Masami Hiramatsu to allow moving the unregister_probe_event() before the removal of the probe and exit the function if it fails. This prevents the tp structure from being used after it is freed. Link: http://lkml.kernel.org/r/20130704034038.819592356@goodmis.org Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_kprobe.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 3811487e7a7a..243f6834d026 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -95,7 +95,7 @@ static __kprobes bool trace_probe_is_on_module(struct trace_probe *tp) } static int register_probe_event(struct trace_probe *tp); -static void unregister_probe_event(struct trace_probe *tp); +static int unregister_probe_event(struct trace_probe *tp); static DEFINE_MUTEX(probe_lock); static LIST_HEAD(probe_list); @@ -351,9 +351,12 @@ static int unregister_trace_probe(struct trace_probe *tp) if (trace_probe_is_enabled(tp)) return -EBUSY; + /* Will fail if probe is being used by ftrace or perf */ + if (unregister_probe_event(tp)) + return -EBUSY; + __unregister_trace_probe(tp); list_del(&tp->list); - unregister_probe_event(tp); return 0; } @@ -632,7 +635,9 @@ static int release_all_trace_probes(void) /* TODO: Use batch unregistration */ while (!list_empty(&probe_list)) { tp = list_entry(probe_list.next, struct trace_probe, list); - unregister_trace_probe(tp); + ret = unregister_trace_probe(tp); + if (ret) + goto end; free_trace_probe(tp); } @@ -1247,11 +1252,15 @@ static int register_probe_event(struct trace_probe *tp) return ret; } -static void unregister_probe_event(struct trace_probe *tp) +static int unregister_probe_event(struct trace_probe *tp) { + int ret; + /* tp->event is unregistered in trace_remove_event_call() */ - trace_remove_event_call(&tp->call); - kfree(tp->call.print_fmt); + ret = trace_remove_event_call(&tp->call); + if (!ret) + kfree(tp->call.print_fmt); + return ret; } /* Make a debugfs interface for controlling probe points */ From e8e813ed268d90c1377f53460527c419eb52c67a Mon Sep 17 00:00:00 2001 From: Michael Ellerman <michael@ellerman.id.au> Date: Tue, 4 Jun 2013 14:21:17 +1000 Subject: [PATCH 761/913] powerpc: Rename PMU interrupts from CNT to PMI Back in commit 89713ed "Add timer, performance monitor and machine check counts to /proc/interrupts" we added a count of PMU interrupts to the output of /proc/interrupts. At the time we named them "CNT" to match x86. However in commit 89ccf46 "Rename 'performance counter interrupt'", the x86 guys renamed theirs from "CNT" to "PMI". Arguably changing the name could break someone's script, but I think the chance of that is minimal, and it's preferable to have a name that 1) is somewhat meaningful, and 2) matches x86. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/kernel/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 2e51cde616d2..c69440cef7af 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -362,7 +362,7 @@ int arch_show_interrupts(struct seq_file *p, int prec) seq_printf(p, "%10u ", per_cpu(irq_stat, j).spurious_irqs); seq_printf(p, " Spurious interrupts\n"); - seq_printf(p, "%*s: ", prec, "CNT"); + seq_printf(p, "%*s: ", prec, "PMI"); for_each_online_cpu(j) seq_printf(p, "%10u ", per_cpu(irq_stat, j).pmu_irqs); seq_printf(p, " Performance monitoring interrupts\n"); From 8d7c55d01e4648605fd0dacc82d8d3989ead4db7 Mon Sep 17 00:00:00 2001 From: Michael Ellerman <michael@ellerman.id.au> Date: Tue, 23 Jul 2013 18:07:45 +1000 Subject: [PATCH 762/913] powerpc/perf: Export PERF_EVENT_CONFIG_EBB_SHIFT to userspace We use bit 63 of the event code for userspace to request that the event be counted using EBB (Event Based Branches). Export this value, making it part of the API - though only on processors that support EBB. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/perf_event_server.h | 6 +----- arch/powerpc/include/uapi/asm/Kbuild | 1 + arch/powerpc/include/uapi/asm/perf_event.h | 18 ++++++++++++++++++ arch/powerpc/perf/core-book3s.c | 2 +- arch/powerpc/perf/power8-pmu.c | 6 +++--- 5 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 arch/powerpc/include/uapi/asm/perf_event.h diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h index 2dd7bfc459be..8b2492644754 100644 --- a/arch/powerpc/include/asm/perf_event_server.h +++ b/arch/powerpc/include/asm/perf_event_server.h @@ -12,6 +12,7 @@ #include <linux/types.h> #include <asm/hw_irq.h> #include <linux/device.h> +#include <uapi/asm/perf_event.h> #define MAX_HWEVENTS 8 #define MAX_EVENT_ALTERNATIVES 8 @@ -69,11 +70,6 @@ struct power_pmu { #define PPMU_LIMITED_PMC_REQD 2 /* have to put this on a limited PMC */ #define PPMU_ONLY_COUNT_RUN 4 /* only counting in run state */ -/* - * We use the event config bit 63 as a flag to request EBB. - */ -#define EVENT_CONFIG_EBB_SHIFT 63 - extern int register_power_pmu(struct power_pmu *); struct pt_regs; diff --git a/arch/powerpc/include/uapi/asm/Kbuild b/arch/powerpc/include/uapi/asm/Kbuild index 5182c8622b54..48be855ef37b 100644 --- a/arch/powerpc/include/uapi/asm/Kbuild +++ b/arch/powerpc/include/uapi/asm/Kbuild @@ -20,6 +20,7 @@ header-y += mman.h header-y += msgbuf.h header-y += nvram.h header-y += param.h +header-y += perf_event.h header-y += poll.h header-y += posix_types.h header-y += ps3fb.h diff --git a/arch/powerpc/include/uapi/asm/perf_event.h b/arch/powerpc/include/uapi/asm/perf_event.h new file mode 100644 index 000000000000..80a4d40cf5bc --- /dev/null +++ b/arch/powerpc/include/uapi/asm/perf_event.h @@ -0,0 +1,18 @@ +/* + * Copyright 2013 Michael Ellerman, IBM Corp. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; version 2 of the + * License. + */ + +#ifndef _UAPI_ASM_POWERPC_PERF_EVENT_H +#define _UAPI_ASM_POWERPC_PERF_EVENT_H + +/* + * We use bit 63 of perf_event_attr.config as a flag to request EBB. + */ +#define PERF_EVENT_CONFIG_EBB_SHIFT 63 + +#endif /* _UAPI_ASM_POWERPC_PERF_EVENT_H */ diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 24a45f91c65f..eeae308cf982 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -484,7 +484,7 @@ static bool is_ebb_event(struct perf_event *event) * use bit 63 of the event code for something else if they wish. */ return (ppmu->flags & PPMU_EBB) && - ((event->attr.config >> EVENT_CONFIG_EBB_SHIFT) & 1); + ((event->attr.config >> PERF_EVENT_CONFIG_EBB_SHIFT) & 1); } static int ebb_event_check(struct perf_event *event) diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c index 7466374d2787..2ee4a707f0df 100644 --- a/arch/powerpc/perf/power8-pmu.c +++ b/arch/powerpc/perf/power8-pmu.c @@ -118,7 +118,7 @@ (EVENT_UNIT_MASK << EVENT_UNIT_SHIFT) | \ (EVENT_COMBINE_MASK << EVENT_COMBINE_SHIFT) | \ (EVENT_MARKED_MASK << EVENT_MARKED_SHIFT) | \ - (EVENT_EBB_MASK << EVENT_CONFIG_EBB_SHIFT) | \ + (EVENT_EBB_MASK << PERF_EVENT_CONFIG_EBB_SHIFT) | \ EVENT_PSEL_MASK) /* MMCRA IFM bits - POWER8 */ @@ -233,10 +233,10 @@ static int power8_get_constraint(u64 event, unsigned long *maskp, unsigned long pmc = (event >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK; unit = (event >> EVENT_UNIT_SHIFT) & EVENT_UNIT_MASK; cache = (event >> EVENT_CACHE_SEL_SHIFT) & EVENT_CACHE_SEL_MASK; - ebb = (event >> EVENT_CONFIG_EBB_SHIFT) & EVENT_EBB_MASK; + ebb = (event >> PERF_EVENT_CONFIG_EBB_SHIFT) & EVENT_EBB_MASK; /* Clear the EBB bit in the event, so event checks work below */ - event &= ~(EVENT_EBB_MASK << EVENT_CONFIG_EBB_SHIFT); + event &= ~(EVENT_EBB_MASK << PERF_EVENT_CONFIG_EBB_SHIFT); if (pmc) { if (pmc > 6) From 3be7db6ab45b21345386d1a466da133b19cde5e4 Mon Sep 17 00:00:00 2001 From: Robert Jennings <rcj@linux.vnet.ibm.com> Date: Wed, 24 Jul 2013 20:13:21 -0500 Subject: [PATCH 763/913] powerpc: VPHN topology change updates all siblings When an associativity level change is found for one thread, the siblings threads need to be updated as well. This is done today for PRRN in stage_topology_update() but is missing for VPHN in update_cpu_associativity_changes_mask(). This patch will correctly update all thread siblings during a topology change. Without this patch a topology update can result in a CPU in init_sched_groups_power() getting stuck indefinitely in a loop. This loop is built in build_sched_groups(). As a result of the thread moving to a node separate from its siblings the struct sched_group will have its next pointer set to point to itself rather than the sched_group struct of the next thread. This happens because we have a domain without the SD_OVERLAP flag, which is correct, and a topology that doesn't conform with reality (threads on the same core assigned to different numa nodes). When this list is traversed by init_sched_groups_power() it will reach the thread's sched_group structure and loop indefinitely; the cpu will be stuck at this point. The bug was exposed when VPHN was enabled in commit b7abef0 (v3.9). Cc: <stable@vger.kernel.org> [v3.9+] Reported-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/smp.h | 4 +++ arch/powerpc/mm/numa.c | 57 +++++++++++++++++++++++++--------- 2 files changed, 47 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h index ffbaabebcdca..48cfc858abd6 100644 --- a/arch/powerpc/include/asm/smp.h +++ b/arch/powerpc/include/asm/smp.h @@ -145,6 +145,10 @@ extern void __cpu_die(unsigned int cpu); #define smp_setup_cpu_maps() static inline void inhibit_secondary_onlining(void) {} static inline void uninhibit_secondary_onlining(void) {} +static inline const struct cpumask *cpu_sibling_mask(int cpu) +{ + return cpumask_of(cpu); +} #endif /* CONFIG_SMP */ diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 08397217e8ac..5850798826cd 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -27,6 +27,7 @@ #include <linux/seq_file.h> #include <linux/uaccess.h> #include <linux/slab.h> +#include <asm/cputhreads.h> #include <asm/sparsemem.h> #include <asm/prom.h> #include <asm/smp.h> @@ -1318,7 +1319,8 @@ static int update_cpu_associativity_changes_mask(void) } } if (changed) { - cpumask_set_cpu(cpu, changes); + cpumask_or(changes, changes, cpu_sibling_mask(cpu)); + cpu = cpu_last_thread_sibling(cpu); } } @@ -1426,7 +1428,7 @@ static int update_cpu_topology(void *data) if (!data) return -EINVAL; - cpu = get_cpu(); + cpu = smp_processor_id(); for (update = data; update; update = update->next) { if (cpu != update->cpu) @@ -1446,12 +1448,12 @@ static int update_cpu_topology(void *data) */ int arch_update_cpu_topology(void) { - unsigned int cpu, changed = 0; + unsigned int cpu, sibling, changed = 0; struct topology_update_data *updates, *ud; unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; cpumask_t updated_cpus; struct device *dev; - int weight, i = 0; + int weight, new_nid, i = 0; weight = cpumask_weight(&cpu_associativity_changes_mask); if (!weight) @@ -1464,19 +1466,46 @@ int arch_update_cpu_topology(void) cpumask_clear(&updated_cpus); for_each_cpu(cpu, &cpu_associativity_changes_mask) { - ud = &updates[i++]; - ud->cpu = cpu; + /* + * If siblings aren't flagged for changes, updates list + * will be too short. Skip on this update and set for next + * update. + */ + if (!cpumask_subset(cpu_sibling_mask(cpu), + &cpu_associativity_changes_mask)) { + pr_info("Sibling bits not set for associativity " + "change, cpu%d\n", cpu); + cpumask_or(&cpu_associativity_changes_mask, + &cpu_associativity_changes_mask, + cpu_sibling_mask(cpu)); + cpu = cpu_last_thread_sibling(cpu); + continue; + } + + /* Use associativity from first thread for all siblings */ vphn_get_associativity(cpu, associativity); - ud->new_nid = associativity_to_nid(associativity); + new_nid = associativity_to_nid(associativity); + if (new_nid < 0 || !node_online(new_nid)) + new_nid = first_online_node; - if (ud->new_nid < 0 || !node_online(ud->new_nid)) - ud->new_nid = first_online_node; + if (new_nid == numa_cpu_lookup_table[cpu]) { + cpumask_andnot(&cpu_associativity_changes_mask, + &cpu_associativity_changes_mask, + cpu_sibling_mask(cpu)); + cpu = cpu_last_thread_sibling(cpu); + continue; + } - ud->old_nid = numa_cpu_lookup_table[cpu]; - cpumask_set_cpu(cpu, &updated_cpus); - - if (i < weight) - ud->next = &updates[i]; + for_each_cpu(sibling, cpu_sibling_mask(cpu)) { + ud = &updates[i++]; + ud->cpu = sibling; + ud->new_nid = new_nid; + ud->old_nid = numa_cpu_lookup_table[sibling]; + cpumask_set_cpu(sibling, &updated_cpus); + if (i < weight) + ud->next = &updates[i]; + } + cpu = cpu_last_thread_sibling(cpu); } stop_machine(update_cpu_topology, &updates[0], &updated_cpus); From fe956a1d4081ce1a959f87df397a15e252201f10 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen <aaro.koskinen@iki.fi> Date: Sun, 21 Jul 2013 03:30:11 +0300 Subject: [PATCH 764/913] powerpc/windfarm: Fix noisy slots-fan on Xserve (rm31) slots-fan on G5 Xserve is always running at full speed with windfarm_rm31 driver, resulting in a very high acoustic noise level. It seems the fan parameters are incorrect, and have been copied from the Drive Bay fan (RPM, not present on rm31) of the legacy therm_pm72 driver. This patch changes the parameters to match the Slots fan (PWM) of therm_pm72. With the patch, slots-fan speed drops from 99% to 19% during normal use, and slots-temp settle to ~42'C. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> CC: <stable@vger.kernel.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- drivers/macintosh/windfarm_rm31.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/macintosh/windfarm_rm31.c b/drivers/macintosh/windfarm_rm31.c index 0b9a79b2f48a..82fc86a90c1a 100644 --- a/drivers/macintosh/windfarm_rm31.c +++ b/drivers/macintosh/windfarm_rm31.c @@ -439,15 +439,15 @@ static void backside_setup_pid(void) /* Slots fan */ static const struct wf_pid_param slots_param = { - .interval = 5, - .history_len = 2, - .gd = 30 << 20, - .gp = 5 << 20, - .gr = 0, - .itarget = 40 << 16, - .additive = 1, - .min = 300, - .max = 4000, + .interval = 1, + .history_len = 20, + .gd = 0, + .gp = 0, + .gr = 0x00100000, + .itarget = 3200000, + .additive = 0, + .min = 20, + .max = 100, }; static void slots_fan_tick(void) From 2865a8fb44cc32420407362cbda80c10fa09c6b2 Mon Sep 17 00:00:00 2001 From: Shaohua Li <shli@kernel.org> Date: Thu, 1 Aug 2013 09:56:36 +0800 Subject: [PATCH 765/913] workqueue: copy workqueue_attrs with all fields $echo '0' > /sys/bus/workqueue/devices/xxx/numa $cat /sys/bus/workqueue/devices/xxx/numa I got 1. It should be 0, the reason is copy_workqueue_attrs() called in apply_workqueue_attrs() doesn't copy no_numa field. Fix it by making copy_workqueue_attrs() copy ->no_numa too. This would also make get_unbound_pool() set a pool's ->no_numa attribute according to the workqueue attributes used when the pool was created. While harmelss, as ->no_numa isn't a pool attribute, this is a bit confusing. Clear it explicitly. tj: Updated description and comments a bit. Signed-off-by: Shaohua Li <shli@fusionio.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: stable@vger.kernel.org --- kernel/workqueue.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 55f5f0afcd0d..726adc84b3ca 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -3416,6 +3416,12 @@ static void copy_workqueue_attrs(struct workqueue_attrs *to, { to->nice = from->nice; cpumask_copy(to->cpumask, from->cpumask); + /* + * Unlike hash and equality test, this function doesn't ignore + * ->no_numa as it is used for both pool and wq attrs. Instead, + * get_unbound_pool() explicitly clears ->no_numa after copying. + */ + to->no_numa = from->no_numa; } /* hash value of the content of @attr */ @@ -3583,6 +3589,12 @@ static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs) lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */ copy_workqueue_attrs(pool->attrs, attrs); + /* + * no_numa isn't a worker_pool attribute, always clear it. See + * 'struct workqueue_attrs' comments for detail. + */ + pool->attrs->no_numa = false; + /* if cpumask is contained inside a NUMA node, we belong to that node */ if (wq_numa_enabled) { for_each_node(node) { From 447383d2ba6061bb069da45f95f223a01bba61dd Mon Sep 17 00:00:00 2001 From: NeilBrown <neilb@suse.de> Date: Thu, 25 Jul 2013 11:30:23 +1000 Subject: [PATCH 766/913] NFSD/sunrpc: avoid deadlock on TCP connection due to memory pressure. Since we enabled auto-tuning for sunrpc TCP connections we do not guarantee that there is enough write-space on each connection to queue a reply. If memory pressure causes the window to shrink too small, the request throttling in sunrpc/svc will not accept any requests so no more requests will be handled. Even when pressure decreases the window will not grow again until data is sent on the connection. This means we get a deadlock: no requests will be handled until there is more space, and no space will be allocated until a request is handled. This can be simulated by modifying svc_tcp_has_wspace to inflate the number of byte required and removing the 'svc_sock_setbufsize' calls in svc_setup_socket. I found that multiplying by 16 was enough to make the requirement exceed the default allocation. With this modification in place: mount -o vers=3,proto=tcp 127.0.0.1:/home /mnt would block and eventually time out because the nfs server could not accept any requests. This patch relaxes the request throttling to always allow at least one request through per connection. It does this by checking both sk_stream_min_wspace() and xprt->xpt_reserved are zero. The first is zero when the TCP transmit queue is empty. The second is zero when there are no RPC requests being processed. When both of these are zero the socket is idle and so one more request can safely be allowed through. Applying this patch allows the above mount command to succeed cleanly. Tracing shows that the allocated write buffer space quickly grows and after a few requests are handled, the extra tests are no longer needed to permit further requests to be processed. The main purpose of request throttling is to handle the case when one client is slow at collecting replies and the send queue gets full of replies that the client hasn't acknowledged (at the TCP level) yet. As we only change behaviour when the send queue is empty this main purpose is still preserved. Reported-by: Ben Myers <bpm@sgi.com> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com> --- net/sunrpc/svcsock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 305374d4fb98..7762b9f8a8b7 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -1193,7 +1193,9 @@ static int svc_tcp_has_wspace(struct svc_xprt *xprt) if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) return 1; required = atomic_read(&xprt->xpt_reserved) + serv->sv_max_mesg; - if (sk_stream_wspace(svsk->sk_sk) >= required) + if (sk_stream_wspace(svsk->sk_sk) >= required || + (sk_stream_min_wspace(svsk->sk_sk) == 0 && + atomic_read(&xprt->xpt_reserved) == 0)) return 1; set_bit(SOCK_NOSPACE, &svsk->sk_sock->flags); return 0; From 9f96392b0ae6aefc02a9b900c3f4889dfafc8402 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" <bfields@redhat.com> Date: Mon, 10 Jun 2013 16:06:44 -0400 Subject: [PATCH 767/913] svcrpc: fix gss_rpc_upcall create error Cc: stable@vger.kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com> --- net/sunrpc/auth_gss/gss_rpc_upcall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c index d304f41260f2..1e1ccf539fac 100644 --- a/net/sunrpc/auth_gss/gss_rpc_upcall.c +++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c @@ -120,7 +120,7 @@ static int gssp_rpc_create(struct net *net, struct rpc_clnt **_clnt) if (IS_ERR(clnt)) { dprintk("RPC: failed to create AF_LOCAL gssproxy " "client (errno %ld).\n", PTR_ERR(clnt)); - result = -PTR_ERR(clnt); + result = PTR_ERR(clnt); *_clnt = NULL; goto out; } From dc43376c26cef74226174a2394f37f2a3f8a8639 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" <bfields@redhat.com> Date: Fri, 7 Jun 2013 10:11:19 -0400 Subject: [PATCH 768/913] svcrpc: fix gss-proxy xdr decoding oops Uninitialized stack data was being used as the destination for memcpy's. Longer term we'll just delete some of this code; all we're doing is skipping over xdr that we don't care about. Cc: stable@vger.kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com> --- net/sunrpc/auth_gss/gss_rpc_xdr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c b/net/sunrpc/auth_gss/gss_rpc_xdr.c index 357f613df7ff..3c85d1c8a028 100644 --- a/net/sunrpc/auth_gss/gss_rpc_xdr.c +++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c @@ -430,7 +430,7 @@ static int dummy_enc_nameattr_array(struct xdr_stream *xdr, static int dummy_dec_nameattr_array(struct xdr_stream *xdr, struct gssx_name_attr_array *naa) { - struct gssx_name_attr dummy; + struct gssx_name_attr dummy = { .attr = {.len = 0} }; u32 count, i; __be32 *p; @@ -493,12 +493,13 @@ static int gssx_enc_name(struct xdr_stream *xdr, return err; } + static int gssx_dec_name(struct xdr_stream *xdr, struct gssx_name *name) { - struct xdr_netobj dummy_netobj; - struct gssx_name_attr_array dummy_name_attr_array; - struct gssx_option_array dummy_option_array; + struct xdr_netobj dummy_netobj = { .len = 0 }; + struct gssx_name_attr_array dummy_name_attr_array = { .count = 0 }; + struct gssx_option_array dummy_option_array = { .count = 0 }; int err; /* name->display_name */ From 743e217129f69aab074abe520a464fd0c6b1cca1 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" <bfields@redhat.com> Date: Wed, 31 Jul 2013 14:11:14 -0400 Subject: [PATCH 769/913] svcrpc: fix kfree oops in gss-proxy code mech_oid.data is an array, not kmalloc()'d memory. Cc: stable@vger.kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com> --- net/sunrpc/auth_gss/gss_rpc_upcall.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c index 1e1ccf539fac..af7ffd447fee 100644 --- a/net/sunrpc/auth_gss/gss_rpc_upcall.c +++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c @@ -328,7 +328,6 @@ void gssp_free_upcall_data(struct gssp_upcall_data *data) kfree(data->in_handle.data); kfree(data->out_handle.data); kfree(data->out_token.data); - kfree(data->mech_oid.data); free_svc_cred(&data->creds); } From 7193bd17ea92c4c89016c304362c9be93ce50050 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" <bfields@redhat.com> Date: Wed, 31 Jul 2013 17:51:42 -0400 Subject: [PATCH 770/913] svcrpc: set cr_gss_mech from gss-proxy as well as legacy upcall The change made to rsc_parse() in 0dc1531aca7fd1440918bd55844a054e9c29acad "svcrpc: store gss mech in svc_cred" should also have been propagated to the gss-proxy codepath. This fixes a crash in the gss-proxy case. Signed-off-by: J. Bruce Fields <bfields@redhat.com> --- net/sunrpc/auth_gss/svcauth_gss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index d0347d148b34..09fb638bcaa4 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -1180,6 +1180,7 @@ static int gss_proxy_save_rsc(struct cache_detail *cd, gm = gss_mech_get_by_OID(&ud->mech_oid); if (!gm) goto out; + rsci.cred.cr_gss_mech = gm; status = -EINVAL; /* mech-specific data: */ @@ -1195,7 +1196,6 @@ static int gss_proxy_save_rsc(struct cache_detail *cd, rscp = rsc_update(cd, &rsci, rscp); status = 0; out: - gss_mech_put(gm); rsc_free(&rsci); if (rscp) cache_put(&rscp->h, cd); From 48be69a026b2c17350a5ef18a1959a919f60be7d Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Wed, 24 Jul 2013 00:29:18 +0100 Subject: [PATCH 771/913] ARM: move signal handlers into a vdso-like page Move the signal handlers into a VDSO page rather than keeping them in the vectors page. This allows us to place them randomly within this page, and also map the page at a random location within userspace further protecting these code fragments from ROP attacks. The new VDSO page is also poisoned in the same way as the vector page. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/include/asm/elf.h | 4 +++ arch/arm/include/asm/mmu.h | 1 + arch/arm/kernel/process.c | 40 ++++++++++++++++++++++++++--- arch/arm/kernel/signal.c | 52 +++++++++++++++++++++++++++++++++----- arch/arm/kernel/signal.h | 12 --------- arch/arm/kernel/traps.c | 9 ------- 6 files changed, 87 insertions(+), 31 deletions(-) delete mode 100644 arch/arm/kernel/signal.h diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index 38050b1c4800..9c9b30717fda 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h @@ -130,4 +130,8 @@ struct mm_struct; extern unsigned long arch_randomize_brk(struct mm_struct *mm); #define arch_randomize_brk arch_randomize_brk +#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 +struct linux_binprm; +int arch_setup_additional_pages(struct linux_binprm *, int); + #endif diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h index e3d55547e755..7345e37155d5 100644 --- a/arch/arm/include/asm/mmu.h +++ b/arch/arm/include/asm/mmu.h @@ -8,6 +8,7 @@ typedef struct { atomic64_t id; #endif unsigned int vmalloc_seq; + unsigned long sigpage; } mm_context_t; #ifdef CONFIG_CPU_HAS_ASID diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index d3ca4f6915af..566d0d71a1e7 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -428,8 +428,8 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) #ifdef CONFIG_MMU /* * The vectors page is always readable from user space for the - * atomic helpers and the signal restart code. Insert it into the - * gate_vma so that it is visible through ptrace and /proc/<pid>/mem. + * atomic helpers. Insert it into the gate_vma so that it is visible + * through ptrace and /proc/<pid>/mem. */ static struct vm_area_struct gate_vma = { .vm_start = 0xffff0000, @@ -461,6 +461,40 @@ int in_gate_area_no_mm(unsigned long addr) const char *arch_vma_name(struct vm_area_struct *vma) { - return (vma == &gate_vma) ? "[vectors]" : NULL; + return (vma == &gate_vma) ? "[vectors]" : + (vma->vm_mm && vma->vm_start == vma->vm_mm->context.sigpage) ? + "[sigpage]" : NULL; +} + +extern struct page *get_signal_page(void); + +int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) +{ + struct mm_struct *mm = current->mm; + struct page *page; + unsigned long addr; + int ret; + + page = get_signal_page(); + if (!page) + return -ENOMEM; + + down_write(&mm->mmap_sem); + addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0); + if (IS_ERR_VALUE(addr)) { + ret = addr; + goto up_fail; + } + + ret = install_special_mapping(mm, addr, PAGE_SIZE, + VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, + &page); + + if (ret == 0) + mm->context.sigpage = addr; + + up_fail: + up_write(&mm->mmap_sem); + return ret; } #endif diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 1c16c35c271a..0f17e06d51e6 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -8,6 +8,7 @@ * published by the Free Software Foundation. */ #include <linux/errno.h> +#include <linux/random.h> #include <linux/signal.h> #include <linux/personality.h> #include <linux/uaccess.h> @@ -15,12 +16,11 @@ #include <asm/elf.h> #include <asm/cacheflush.h> +#include <asm/traps.h> #include <asm/ucontext.h> #include <asm/unistd.h> #include <asm/vfp.h> -#include "signal.h" - /* * For ARM syscalls, we encode the syscall number into the instruction. */ @@ -40,11 +40,13 @@ #define SWI_THUMB_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_sigreturn - __NR_SYSCALL_BASE)) #define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE)) -const unsigned long sigreturn_codes[7] = { +static const unsigned long sigreturn_codes[7] = { MOV_R7_NR_SIGRETURN, SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN, MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN, }; +static unsigned long signal_return_offset; + #ifdef CONFIG_CRUNCH static int preserve_crunch_context(struct crunch_sigframe __user *frame) { @@ -401,12 +403,15 @@ setup_return(struct pt_regs *regs, struct ksignal *ksig, return 1; if ((cpsr & MODE32_BIT) && !IS_ENABLED(CONFIG_ARM_MPU)) { + struct mm_struct *mm = current->mm; + /* - * 32-bit code can use the new high-page - * signal return code support except when the MPU has - * protected the vectors page from PL0 + * 32-bit code can use the signal return page + * except when the MPU has protected the vectors + * page from PL0 */ - retcode = KERN_SIGRETURN_CODE + (idx << 2) + thumb; + retcode = mm->context.sigpage + signal_return_offset + + (idx << 2) + thumb; } else { /* * Ensure that the instruction cache sees @@ -608,3 +613,36 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) } while (thread_flags & _TIF_WORK_MASK); return 0; } + +static struct page *signal_page; + +struct page *get_signal_page(void) +{ + if (!signal_page) { + unsigned long ptr; + unsigned offset; + void *addr; + + signal_page = alloc_pages(GFP_KERNEL, 0); + + if (!signal_page) + return NULL; + + addr = page_address(signal_page); + + /* Give the signal return code some randomness */ + offset = 0x200 + (get_random_int() & 0x7fc); + signal_return_offset = offset; + + /* + * Copy signal return handlers into the vector page, and + * set sigreturn to be a pointer to these. + */ + memcpy(addr + offset, sigreturn_codes, sizeof(sigreturn_codes)); + + ptr = (unsigned long)addr + offset; + flush_icache_range(ptr, ptr + sizeof(sigreturn_codes)); + } + + return signal_page; +} diff --git a/arch/arm/kernel/signal.h b/arch/arm/kernel/signal.h deleted file mode 100644 index 5ff067b7c752..000000000000 --- a/arch/arm/kernel/signal.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * linux/arch/arm/kernel/signal.h - * - * Copyright (C) 2005-2009 Russell King. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#define KERN_SIGRETURN_CODE (CONFIG_VECTORS_BASE + 0x00000500) - -extern const unsigned long sigreturn_codes[7]; diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index e3ca35ccd38e..ab517fcce21b 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -35,8 +35,6 @@ #include <asm/tls.h> #include <asm/system_misc.h> -#include "signal.h" - static const char *handler[]= { "prefetch abort", "data abort", "address exception", "interrupt" }; void *vectors_page; @@ -850,13 +848,6 @@ void __init early_trap_init(void *vectors_base) kuser_init(vectors_base); - /* - * Copy signal return handlers into the vector page, and - * set sigreturn to be a pointer to these. - */ - memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE), - sigreturn_codes, sizeof(sigreturn_codes)); - flush_icache_range(vectors, vectors + PAGE_SIZE * 2); modify_domain(DOMAIN_USER, DOMAIN_CLIENT); #else /* ifndef CONFIG_CPU_V7M */ From a5463cd3435475386cbbe7b06e01292ac169d36f Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Wed, 31 Jul 2013 21:58:56 +0100 Subject: [PATCH 772/913] ARM: make vectors page inaccessible from userspace If kuser helpers are not provided by the kernel, disable user access to the vectors page. With the kuser helpers gone, there is no reason for this page to be visible to userspace. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/include/asm/page.h | 2 ++ arch/arm/kernel/process.c | 7 ++++++- arch/arm/mm/mmu.c | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h index 6363f3d1d505..4355f0ec44d6 100644 --- a/arch/arm/include/asm/page.h +++ b/arch/arm/include/asm/page.h @@ -142,7 +142,9 @@ extern void __cpu_copy_user_highpage(struct page *to, struct page *from, #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) extern void copy_page(void *to, const void *from); +#ifdef CONFIG_KUSER_HELPERS #define __HAVE_ARCH_GATE_AREA 1 +#endif #ifdef CONFIG_ARM_LPAE #include <asm/pgtable-3level-types.h> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 566d0d71a1e7..1e6c33d01c05 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -426,6 +426,7 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) } #ifdef CONFIG_MMU +#ifdef CONFIG_KUSER_HELPERS /* * The vectors page is always readable from user space for the * atomic helpers. Insert it into the gate_vma so that it is visible @@ -458,10 +459,14 @@ int in_gate_area_no_mm(unsigned long addr) { return in_gate_area(NULL, addr); } +#define is_gate_vma(vma) ((vma) = &gate_vma) +#else +#define is_gate_vma(vma) 0 +#endif const char *arch_vma_name(struct vm_area_struct *vma) { - return (vma == &gate_vma) ? "[vectors]" : + return is_gate_vma(vma) ? "[vectors]" : (vma->vm_mm && vma->vm_start == vma->vm_mm->context.sigpage) ? "[sigpage]" : NULL; } diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 9ea274d1af69..ca46f413d867 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1205,7 +1205,11 @@ static void __init devicemaps_init(struct machine_desc *mdesc) map.pfn = __phys_to_pfn(virt_to_phys(vectors)); map.virtual = 0xffff0000; map.length = PAGE_SIZE; +#ifdef CONFIG_KUSER_HELPERS map.type = MT_HIGH_VECTORS; +#else + map.type = MT_LOW_VECTORS; +#endif create_mapping(&map); if (!vectors_high()) { From 44424c34049f41123a3a8b4853822f47f4ff03a2 Mon Sep 17 00:00:00 2001 From: Stephen Boyd <sboyd@codeaurora.org> Date: Tue, 30 Jul 2013 23:09:46 +0100 Subject: [PATCH 773/913] ARM: 7803/1: Fix deadlock scenario with smp_send_stop() If one process calls sys_reboot and that process then stops other CPUs while those CPUs are within a spin_lock() region we can potentially encounter a deadlock scenario like below. CPU 0 CPU 1 ----- ----- spin_lock(my_lock) smp_send_stop() <send IPI> handle_IPI() disable_preemption/irqs while(1); <PREEMPT> spin_lock(my_lock) <--- Waits forever We shouldn't attempt to run any other tasks after we send a stop IPI to a CPU so disable preemption so that this task runs to completion. We use local_irq_disable() here for cross-arch consistency with x86. Reported-by: Sundarajan Srinivasan <sundaraj@codeaurora.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/kernel/process.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index d3ca4f6915af..08b47ebd3144 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -197,6 +197,7 @@ void machine_shutdown(void) */ void machine_halt(void) { + local_irq_disable(); smp_send_stop(); local_irq_disable(); @@ -211,6 +212,7 @@ void machine_halt(void) */ void machine_power_off(void) { + local_irq_disable(); smp_send_stop(); if (pm_power_off) @@ -230,6 +232,7 @@ void machine_power_off(void) */ void machine_restart(char *cmd) { + local_irq_disable(); smp_send_stop(); arm_pm_restart(reboot_mode, cmd); From 2449189bb7c73b5fe55a18bc0d289e39bdcd4998 Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Wed, 31 Jul 2013 11:37:17 +0100 Subject: [PATCH 774/913] ARM: Add .text annotations where required after __CPUINIT removal Commit 8bd26e3a7 (arm: delete __cpuinit/__CPUINIT usage from all ARM users) caused some code to leak into sections which are discarded through the removal of __CPUINIT annotations. Add appropriate .text annotations to bring these back into the kernel text. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/kernel/head-nommu.S | 1 + arch/arm/kernel/head.S | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S index b361de143756..14235ba64a90 100644 --- a/arch/arm/kernel/head-nommu.S +++ b/arch/arm/kernel/head-nommu.S @@ -87,6 +87,7 @@ ENTRY(stext) ENDPROC(stext) #ifdef CONFIG_SMP + .text ENTRY(secondary_startup) /* * Common entry point for secondary CPUs. diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 9cf6063020ae..2c7cc1e03473 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -343,6 +343,7 @@ __turn_mmu_on_loc: .long __turn_mmu_on_end #if defined(CONFIG_SMP) + .text ENTRY(secondary_startup) /* * Common entry point for secondary CPUs. From 36dd1f3e02a4aed850a7b7318d7abd4f4d50528c Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Date: Thu, 1 Aug 2013 15:44:19 +0200 Subject: [PATCH 775/913] PCI: mvebu: Disable prefetchable memory support in PCI-to-PCI bridge The Marvell PCIe driver uses an emulated PCI-to-PCI bridge to be able to dynamically set up MBus address decoding windows for PCI I/O and memory regions depending on the PCI devices enumerated by Linux. However, this emulated PCI-to-PCI bridge logic makes the Linux PCI core believe that prefetchable memory regions are supported (because the registers are read/write), while in fact no adress decoding window is ever created for such regions. Since the Marvell MBus address decoding windows do not distinguish memory regions and prefetchable memory regions, this patch takes a simple approach: change the PCI-to-PCI bridge emulation to let the Linux PCI core know that we don't support prefetchable memory regions. To achieve this, we simply make the prefetchable memory base a read-only register that always returns 0. Reading/writing all the other prefetchable memory related registers has no effect. This problem was originally reported by Finn Hoffmann <finn@uni-bremen.de>, who couldn't get a RTL8111/8168B PCI NIC working on the NSA310 Kirkwood platform after updating to 3.11-rc. The problem was that the PCI-to-PCI bridge emulation was making the Linux PCI core believe that we support prefetchable memory, so the Linux PCI core was only filling the prefetchable memory base and limit registers, which does not lead to a MBus window being created. The below patch has been confirmed by Finn Hoffmann to fix his problem on Kirkwood, and has otherwise been successfully tested on the Armada XP GP platform with a e1000e PCIe NIC and a Marvell SATA PCIe card. Reported-by: Finn Hoffmann <finn@uni-bremen.de> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> --- drivers/pci/host/pci-mvebu.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index 13a633b1612e..7bf3926aecc0 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c @@ -86,10 +86,6 @@ struct mvebu_sw_pci_bridge { u16 secondary_status; u16 membase; u16 memlimit; - u16 prefmembase; - u16 prefmemlimit; - u32 prefbaseupper; - u32 preflimitupper; u16 iobaseupper; u16 iolimitupper; u8 cappointer; @@ -419,15 +415,7 @@ static int mvebu_sw_pci_bridge_read(struct mvebu_pcie_port *port, break; case PCI_PREF_MEMORY_BASE: - *value = (bridge->prefmemlimit << 16 | bridge->prefmembase); - break; - - case PCI_PREF_BASE_UPPER32: - *value = bridge->prefbaseupper; - break; - - case PCI_PREF_LIMIT_UPPER32: - *value = bridge->preflimitupper; + *value = 0; break; case PCI_IO_BASE_UPPER16: @@ -501,19 +489,6 @@ static int mvebu_sw_pci_bridge_write(struct mvebu_pcie_port *port, mvebu_pcie_handle_membase_change(port); break; - case PCI_PREF_MEMORY_BASE: - bridge->prefmembase = value & 0xffff; - bridge->prefmemlimit = value >> 16; - break; - - case PCI_PREF_BASE_UPPER32: - bridge->prefbaseupper = value; - break; - - case PCI_PREF_LIMIT_UPPER32: - bridge->preflimitupper = value; - break; - case PCI_IO_BASE_UPPER16: bridge->iobaseupper = value & 0xffff; bridge->iolimitupper = value >> 16; From 2ac3ac8f86f2fe065d746d9a9abaca867adec577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kube=C4=8Dek?= <mkubecek@suse.cz> Date: Thu, 1 Aug 2013 10:04:14 +0200 Subject: [PATCH 776/913] ipv6: prevent fib6_run_gc() contention On a high-traffic router with many processors and many IPv6 dst entries, soft lockup in fib6_run_gc() can occur when number of entries reaches gc_thresh. This happens because fib6_run_gc() uses fib6_gc_lock to allow only one thread to run the garbage collector but ip6_dst_gc() doesn't update net->ipv6.ip6_rt_last_gc until fib6_run_gc() returns. On a system with many entries, this can take some time so that in the meantime, other threads pass the tests in ip6_dst_gc() (ip6_rt_last_gc is still not updated) and wait for the lock. They then have to run the garbage collector one after another which blocks them for quite long. Resolve this by replacing special value ~0UL of expire parameter to fib6_run_gc() by explicit "force" parameter to choose between spin_lock_bh() and spin_trylock_bh() and call fib6_run_gc() with force=false if gc_thresh is reached but not max_size. Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: David S. Miller <davem@davemloft.net> --- include/net/ip6_fib.h | 2 +- net/ipv6/ip6_fib.c | 19 ++++++++----------- net/ipv6/ndisc.c | 4 ++-- net/ipv6/route.c | 4 ++-- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 2a601e7da1bf..48ec25a7fcb6 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -300,7 +300,7 @@ extern void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info); extern void fib6_run_gc(unsigned long expires, - struct net *net); + struct net *net, bool force); extern void fib6_gc_cleanup(void); diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 5fc9c7a68d8d..d872553ca933 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -1632,19 +1632,16 @@ static int fib6_age(struct rt6_info *rt, void *arg) static DEFINE_SPINLOCK(fib6_gc_lock); -void fib6_run_gc(unsigned long expires, struct net *net) +void fib6_run_gc(unsigned long expires, struct net *net, bool force) { - if (expires != ~0UL) { + if (force) { spin_lock_bh(&fib6_gc_lock); - gc_args.timeout = expires ? (int)expires : - net->ipv6.sysctl.ip6_rt_gc_interval; - } else { - if (!spin_trylock_bh(&fib6_gc_lock)) { - mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); - return; - } - gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval; + } else if (!spin_trylock_bh(&fib6_gc_lock)) { + mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); + return; } + gc_args.timeout = expires ? (int)expires : + net->ipv6.sysctl.ip6_rt_gc_interval; gc_args.more = icmp6_dst_gc(); @@ -1661,7 +1658,7 @@ void fib6_run_gc(unsigned long expires, struct net *net) static void fib6_gc_timer_cb(unsigned long arg) { - fib6_run_gc(0, (struct net *)arg); + fib6_run_gc(0, (struct net *)arg, true); } static int __net_init fib6_net_init(struct net *net) diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 24c03396e008..79aa9652ed86 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1576,7 +1576,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, switch (event) { case NETDEV_CHANGEADDR: neigh_changeaddr(&nd_tbl, dev); - fib6_run_gc(~0UL, net); + fib6_run_gc(0, net, false); idev = in6_dev_get(dev); if (!idev) break; @@ -1586,7 +1586,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, break; case NETDEV_DOWN: neigh_ifdown(&nd_tbl, dev); - fib6_run_gc(~0UL, net); + fib6_run_gc(0, net, false); break; case NETDEV_NOTIFY_PEERS: ndisc_send_unsol_na(dev); diff --git a/net/ipv6/route.c b/net/ipv6/route.c index a8c891aa2464..824c424f9648 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1326,7 +1326,7 @@ static int ip6_dst_gc(struct dst_ops *ops) goto out; net->ipv6.ip6_rt_gc_expire++; - fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net); + fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size); net->ipv6.ip6_rt_last_gc = now; entries = dst_entries_get_slow(ops); if (entries < ops->gc_thresh) @@ -2827,7 +2827,7 @@ int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write, net = (struct net *)ctl->extra1; delay = net->ipv6.sysctl.flush_delay; proc_dointvec(ctl, write, buffer, lenp, ppos); - fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net); + fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0); return 0; } From 49a18d86f66d33a20144ecb5a34bba0d1856b260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kube=C4=8Dek?= <mkubecek@suse.cz> Date: Thu, 1 Aug 2013 10:04:24 +0200 Subject: [PATCH 777/913] ipv6: update ip6_rt_last_gc every time GC is run As pointed out by Eric Dumazet, net->ipv6.ip6_rt_last_gc should hold the last time garbage collector was run so that we should update it whenever fib6_run_gc() calls fib6_clean_all(), not only if we got there from ip6_dst_gc(). Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/ipv6/ip6_fib.c | 6 +++++- net/ipv6/route.c | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index d872553ca933..bff3d821c7eb 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -1634,6 +1634,8 @@ static DEFINE_SPINLOCK(fib6_gc_lock); void fib6_run_gc(unsigned long expires, struct net *net, bool force) { + unsigned long now; + if (force) { spin_lock_bh(&fib6_gc_lock); } else if (!spin_trylock_bh(&fib6_gc_lock)) { @@ -1646,10 +1648,12 @@ void fib6_run_gc(unsigned long expires, struct net *net, bool force) gc_args.more = icmp6_dst_gc(); fib6_clean_all(net, fib6_age, 0, NULL); + now = jiffies; + net->ipv6.ip6_rt_last_gc = now; if (gc_args.more) mod_timer(&net->ipv6.ip6_fib_timer, - round_jiffies(jiffies + round_jiffies(now + net->ipv6.sysctl.ip6_rt_gc_interval)); else del_timer(&net->ipv6.ip6_fib_timer); diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 824c424f9648..b70f8979003b 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1311,7 +1311,6 @@ static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg), static int ip6_dst_gc(struct dst_ops *ops) { - unsigned long now = jiffies; struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; @@ -1321,13 +1320,12 @@ static int ip6_dst_gc(struct dst_ops *ops) int entries; entries = dst_entries_get_fast(ops); - if (time_after(rt_last_gc + rt_min_interval, now) && + if (time_after(rt_last_gc + rt_min_interval, jiffies) && entries <= rt_max_size) goto out; net->ipv6.ip6_rt_gc_expire++; fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size); - net->ipv6.ip6_rt_last_gc = now; entries = dst_entries_get_slow(ops); if (entries < ops->gc_thresh) net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; From 3f8f52982ad020f0704548c46de66bf464d3b967 Mon Sep 17 00:00:00 2001 From: Jiri Pirko <jiri@resnulli.us> Date: Thu, 1 Aug 2013 10:41:27 +0200 Subject: [PATCH 778/913] ipv6: move peer_addr init into ipv6_add_addr() Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/ipv6/addrconf.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index cfdcf7b2daf6..a0ce957fb671 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -813,7 +813,8 @@ static u32 inet6_addr_hash(const struct in6_addr *addr) /* On success it returns ifp with increased reference count */ static struct inet6_ifaddr * -ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, +ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, + const struct in6_addr *peer_addr, int pfxlen, int scope, u32 flags) { struct inet6_ifaddr *ifa = NULL; @@ -863,6 +864,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, } ifa->addr = *addr; + if (peer_addr) + ifa->peer_addr = *peer_addr; spin_lock_init(&ifa->lock); spin_lock_init(&ifa->state_lock); @@ -1123,8 +1126,8 @@ retry: ift = !max_addresses || ipv6_count_addresses(idev) < max_addresses ? - ipv6_add_addr(idev, &addr, tmp_plen, ipv6_addr_scope(&addr), - addr_flags) : NULL; + ipv6_add_addr(idev, &addr, NULL, tmp_plen, + ipv6_addr_scope(&addr), addr_flags) : NULL; if (IS_ERR_OR_NULL(ift)) { in6_ifa_put(ifp); in6_dev_put(idev); @@ -2179,7 +2182,8 @@ ok: */ if (!max_addresses || ipv6_count_addresses(in6_dev) < max_addresses) - ifp = ipv6_add_addr(in6_dev, &addr, pinfo->prefix_len, + ifp = ipv6_add_addr(in6_dev, &addr, NULL, + pinfo->prefix_len, addr_type&IPV6_ADDR_SCOPE_MASK, addr_flags); @@ -2455,15 +2459,13 @@ static int inet6_addr_add(struct net *net, int ifindex, const struct in6_addr *p prefered_lft = timeout; } - ifp = ipv6_add_addr(idev, pfx, plen, scope, ifa_flags); + ifp = ipv6_add_addr(idev, pfx, peer_pfx, plen, scope, ifa_flags); if (!IS_ERR(ifp)) { spin_lock_bh(&ifp->lock); ifp->valid_lft = valid_lft; ifp->prefered_lft = prefered_lft; ifp->tstamp = jiffies; - if (peer_pfx) - ifp->peer_addr = *peer_pfx; spin_unlock_bh(&ifp->lock); addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, @@ -2557,7 +2559,7 @@ static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr, { struct inet6_ifaddr *ifp; - ifp = ipv6_add_addr(idev, addr, plen, scope, IFA_F_PERMANENT); + ifp = ipv6_add_addr(idev, addr, NULL, plen, scope, IFA_F_PERMANENT); if (!IS_ERR(ifp)) { spin_lock_bh(&ifp->lock); ifp->flags &= ~IFA_F_TENTATIVE; @@ -2683,7 +2685,7 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr #endif - ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, addr_flags); + ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags); if (!IS_ERR(ifp)) { addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0); addrconf_dad_start(ifp); From 8a226b2cfa776db6011fc84b71578513161cd3d3 Mon Sep 17 00:00:00 2001 From: Jiri Benc <jbenc@redhat.com> Date: Thu, 1 Aug 2013 10:41:28 +0200 Subject: [PATCH 779/913] ipv6: prevent race between address creation and removal There's a race in IPv6 automatic addess assignment. The address is created with zero lifetime when it's added to various address lists. Before it gets assigned the correct lifetime, there's a window where a new address may be configured. This causes the semi-initiated address to be deleted in addrconf_verify. This was discovered as a reference leak caused by concurrent run of __ipv6_ifa_notify for both RTM_NEWADDR and RTM_DELADDR with the same address. Fix this by setting the lifetime before the address is added to inet6_addr_lst. A few notes: 1. In addrconf_prefix_rcv, by setting update_lft to zero, the if (update_lft) { ... } condition is no longer executed for newly created addresses. This is okay, as the ifp fields are set in ipv6_add_addr now and ipv6_ifa_notify is called (and has been called) through addrconf_dad_start. 2. The removal of the whole block under ifp->lock in inet6_addr_add is okay, too, as tstamp is initialized to jiffies in ipv6_add_addr. Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/ipv6/addrconf.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index a0ce957fb671..da4241c8c7da 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -815,7 +815,7 @@ static u32 inet6_addr_hash(const struct in6_addr *addr) static struct inet6_ifaddr * ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, const struct in6_addr *peer_addr, int pfxlen, - int scope, u32 flags) + int scope, u32 flags, u32 valid_lft, u32 prefered_lft) { struct inet6_ifaddr *ifa = NULL; struct rt6_info *rt; @@ -875,6 +875,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, ifa->scope = scope; ifa->prefix_len = pfxlen; ifa->flags = flags | IFA_F_TENTATIVE; + ifa->valid_lft = valid_lft; + ifa->prefered_lft = prefered_lft; ifa->cstamp = ifa->tstamp = jiffies; ifa->tokenized = false; @@ -1127,7 +1129,8 @@ retry: ift = !max_addresses || ipv6_count_addresses(idev) < max_addresses ? ipv6_add_addr(idev, &addr, NULL, tmp_plen, - ipv6_addr_scope(&addr), addr_flags) : NULL; + ipv6_addr_scope(&addr), addr_flags, + tmp_valid_lft, tmp_prefered_lft) : NULL; if (IS_ERR_OR_NULL(ift)) { in6_ifa_put(ifp); in6_dev_put(idev); @@ -1139,8 +1142,6 @@ retry: spin_lock_bh(&ift->lock); ift->ifpub = ifp; - ift->valid_lft = tmp_valid_lft; - ift->prefered_lft = tmp_prefered_lft; ift->cstamp = now; ift->tstamp = tmp_tstamp; spin_unlock_bh(&ift->lock); @@ -2185,14 +2186,16 @@ ok: ifp = ipv6_add_addr(in6_dev, &addr, NULL, pinfo->prefix_len, addr_type&IPV6_ADDR_SCOPE_MASK, - addr_flags); + addr_flags, valid_lft, + prefered_lft); if (IS_ERR_OR_NULL(ifp)) { in6_dev_put(in6_dev); return; } - update_lft = create = 1; + update_lft = 0; + create = 1; ifp->cstamp = jiffies; ifp->tokenized = tokenized; addrconf_dad_start(ifp); @@ -2213,7 +2216,7 @@ ok: stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ; else stored_lft = 0; - if (!update_lft && stored_lft) { + if (!update_lft && !create && stored_lft) { if (valid_lft > MIN_VALID_LIFETIME || valid_lft > stored_lft) update_lft = 1; @@ -2459,15 +2462,10 @@ static int inet6_addr_add(struct net *net, int ifindex, const struct in6_addr *p prefered_lft = timeout; } - ifp = ipv6_add_addr(idev, pfx, peer_pfx, plen, scope, ifa_flags); + ifp = ipv6_add_addr(idev, pfx, peer_pfx, plen, scope, ifa_flags, + valid_lft, prefered_lft); if (!IS_ERR(ifp)) { - spin_lock_bh(&ifp->lock); - ifp->valid_lft = valid_lft; - ifp->prefered_lft = prefered_lft; - ifp->tstamp = jiffies; - spin_unlock_bh(&ifp->lock); - addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, expires, flags); /* @@ -2559,7 +2557,8 @@ static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr, { struct inet6_ifaddr *ifp; - ifp = ipv6_add_addr(idev, addr, NULL, plen, scope, IFA_F_PERMANENT); + ifp = ipv6_add_addr(idev, addr, NULL, plen, + scope, IFA_F_PERMANENT, 0, 0); if (!IS_ERR(ifp)) { spin_lock_bh(&ifp->lock); ifp->flags &= ~IFA_F_TENTATIVE; @@ -2685,7 +2684,7 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr #endif - ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags); + ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags, 0, 0); if (!IS_ERR(ifp)) { addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0); addrconf_dad_start(ifp); From 0508ad646836007e6e6b62331eee7356844eac3d Mon Sep 17 00:00:00 2001 From: Or Gerlitz <ogerlitz@mellanox.com> Date: Thu, 1 Aug 2013 19:55:00 +0300 Subject: [PATCH 780/913] net/mlx4_core: Don't give VFs MAC addresses which are derived from the PF MAC If the user has not assigned a MAC address to a VM, then don't give it MAC which is based on the PF one. The current derivation scheme is wrong and leads to VM MAC collisions when the number of cards/hypervisors becomes big enough. Instead, just give it zeros and let them figure out what to do with that. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/mellanox/mlx4/fw.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index 8873d6802c80..6fc6dabc78d5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c @@ -845,16 +845,7 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave, MLX4_CMD_NATIVE); if (!err && dev->caps.function != slave) { - /* if config MAC in DB use it */ - if (priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac) - def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac; - else { - /* set slave default_mac address */ - MLX4_GET(def_mac, outbox->buf, QUERY_PORT_MAC_OFFSET); - def_mac += slave << 8; - priv->mfunc.master.vf_admin[slave].vport[vhcr->in_modifier].mac = def_mac; - } - + def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac; MLX4_PUT(outbox->buf, def_mac, QUERY_PORT_MAC_OFFSET); /* get port type - currently only eth is enabled */ From b30513202c6c14120f70b2e9aa1e97d47bbc2313 Mon Sep 17 00:00:00 2001 From: Jack Morgenstein <jackm@dev.mellanox.co.il> Date: Thu, 1 Aug 2013 19:55:01 +0300 Subject: [PATCH 781/913] net/mlx4_core: VFs must ignore the enable_64b_cqe_eqe module param Slaves get the 64B CQE/EQE state from QUERY_HCA, not from the module parameter. If the parameter is set to zero, the slave outputs an incorrect/irrelevant warning message that 64B CQEs/EQEs are supported but not enabled (even if the hypervisor has enabled 64B CQEs/EQEs). Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/mellanox/mlx4/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index e85af922dcdc..36be3208786a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -371,7 +371,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) dev->caps.sqp_demux = (mlx4_is_master(dev)) ? MLX4_MAX_NUM_SLAVES : 0; - if (!enable_64b_cqe_eqe) { + if (!enable_64b_cqe_eqe && !mlx4_is_slave(dev)) { if (dev_cap->flags & (MLX4_DEV_CAP_FLAG_64B_CQE | MLX4_DEV_CAP_FLAG_64B_EQE)) { mlx4_warn(dev, "64B EQEs/CQEs supported by the device but not enabled\n"); From dfcefb0be1231982784df2152213103ad33c1cfd Mon Sep 17 00:00:00 2001 From: Cong Wang <amwang@redhat.com> Date: Thu, 1 Aug 2013 11:10:24 +0800 Subject: [PATCH 782/913] net: fix a compile error when CONFIG_NET_LL_RX_POLL is not set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When CONFIG_NET_LL_RX_POLL is not set, I got: net/socket.c: In function ‘sock_poll’: net/socket.c:1165:4: error: implicit declaration of function ‘sk_busy_loop’ [-Werror=implicit-function-declaration] Fix this by adding a nop when !CONFIG_NET_LL_RX_POLL. Cc: Eliezer Tamir <eliezer.tamir@linux.intel.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- include/net/busy_poll.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h index a14339c2985f..6cd8848fec68 100644 --- a/include/net/busy_poll.h +++ b/include/net/busy_poll.h @@ -181,5 +181,10 @@ static inline bool busy_loop_timeout(unsigned long end_time) return true; } +static inline bool sk_busy_loop(struct sock *sk, int nonblock) +{ + return false; +} + #endif /* CONFIG_NET_LL_RX_POLL */ #endif /* _LINUX_NET_BUSY_POLL_H */ From e0d1095ae3405404d247afb00233ef837d58da83 Mon Sep 17 00:00:00 2001 From: Cong Wang <amwang@redhat.com> Date: Thu, 1 Aug 2013 11:10:25 +0800 Subject: [PATCH 783/913] net: rename CONFIG_NET_LL_RX_POLL to CONFIG_NET_RX_BUSY_POLL Eliezer renames several *ll_poll to *busy_poll, but forgets CONFIG_NET_LL_RX_POLL, so in case of confusion, rename it too. Cc: Eliezer Tamir <eliezer.tamir@linux.intel.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- Documentation/sysctl/net.txt | 4 ++-- drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 8 ++++---- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 12 ++++++------ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 +++--- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 6 +++--- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 6 +++--- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 10 +++++----- include/linux/netdevice.h | 2 +- include/linux/skbuff.h | 2 +- include/net/busy_poll.h | 6 +++--- include/net/sock.h | 2 +- net/Kconfig | 2 +- net/core/skbuff.c | 2 +- net/core/sock.c | 6 +++--- net/core/sysctl_net_core.c | 2 +- net/socket.c | 2 +- 18 files changed, 41 insertions(+), 41 deletions(-) diff --git a/Documentation/sysctl/net.txt b/Documentation/sysctl/net.txt index 1c15043aaee4..d569f2a424d5 100644 --- a/Documentation/sysctl/net.txt +++ b/Documentation/sysctl/net.txt @@ -52,7 +52,7 @@ Default: 64 busy_read ---------------- -Low latency busy poll timeout for socket reads. (needs CONFIG_NET_LL_RX_POLL) +Low latency busy poll timeout for socket reads. (needs CONFIG_NET_RX_BUSY_POLL) Approximate time in us to busy loop waiting for packets on the device queue. This sets the default value of the SO_BUSY_POLL socket option. Can be set or overridden per socket by setting socket option SO_BUSY_POLL, @@ -63,7 +63,7 @@ Default: 0 (off) busy_poll ---------------- -Low latency busy poll timeout for poll and select. (needs CONFIG_NET_LL_RX_POLL) +Low latency busy poll timeout for poll and select. (needs CONFIG_NET_RX_BUSY_POLL) Approximate time in us to busy loop waiting for events. Recommended value depends on the number of sockets you poll on. For several sockets 50, for several hundreds 100. diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index dedbd76c033e..d80e34b8285f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h @@ -486,7 +486,7 @@ struct bnx2x_fastpath { struct napi_struct napi; -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL unsigned int state; #define BNX2X_FP_STATE_IDLE 0 #define BNX2X_FP_STATE_NAPI (1 << 0) /* NAPI owns this FP */ @@ -498,7 +498,7 @@ struct bnx2x_fastpath { #define BNX2X_FP_USER_PEND (BNX2X_FP_STATE_POLL | BNX2X_FP_STATE_POLL_YIELD) /* protect state */ spinlock_t lock; -#endif /* CONFIG_NET_LL_RX_POLL */ +#endif /* CONFIG_NET_RX_BUSY_POLL */ union host_hc_status_block status_blk; /* chip independent shortcuts into sb structure */ @@ -572,7 +572,7 @@ struct bnx2x_fastpath { #define bnx2x_fp_stats(bp, fp) (&((bp)->fp_stats[(fp)->index])) #define bnx2x_fp_qstats(bp, fp) (&((bp)->fp_stats[(fp)->index].eth_q_stats)) -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL static inline void bnx2x_fp_init_lock(struct bnx2x_fastpath *fp) { spin_lock_init(&fp->lock); @@ -680,7 +680,7 @@ static inline bool bnx2x_fp_ll_polling(struct bnx2x_fastpath *fp) { return false; } -#endif /* CONFIG_NET_LL_RX_POLL */ +#endif /* CONFIG_NET_RX_BUSY_POLL */ /* Use 2500 as a mini-jumbo MTU for FCoE */ #define BNX2X_FCOE_MINI_JUMBO_MTU 2500 diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index ee350bde1818..f2d1ff10054b 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -3117,7 +3117,7 @@ int bnx2x_poll(struct napi_struct *napi, int budget) return work_done; } -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL /* must be called with local_bh_disable()d */ int bnx2x_low_latency_recv(struct napi_struct *napi) { diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index e5da07858a2f..e06186c305d8 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -12026,7 +12026,7 @@ static const struct net_device_ops bnx2x_netdev_ops = { .ndo_fcoe_get_wwn = bnx2x_fcoe_get_wwn, #endif -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL .ndo_busy_poll = bnx2x_low_latency_recv, #endif }; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 7be725cdfea8..a6494e5daffe 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h @@ -54,7 +54,7 @@ #include <net/busy_poll.h> -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL #define LL_EXTENDED_STATS #endif /* common prefix used by pr_<> macros */ @@ -366,7 +366,7 @@ struct ixgbe_q_vector { struct rcu_head rcu; /* to avoid race with update stats on free */ char name[IFNAMSIZ + 9]; -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL unsigned int state; #define IXGBE_QV_STATE_IDLE 0 #define IXGBE_QV_STATE_NAPI 1 /* NAPI owns this QV */ @@ -377,12 +377,12 @@ struct ixgbe_q_vector { #define IXGBE_QV_YIELD (IXGBE_QV_STATE_NAPI_YIELD | IXGBE_QV_STATE_POLL_YIELD) #define IXGBE_QV_USER_PEND (IXGBE_QV_STATE_POLL | IXGBE_QV_STATE_POLL_YIELD) spinlock_t lock; -#endif /* CONFIG_NET_LL_RX_POLL */ +#endif /* CONFIG_NET_RX_BUSY_POLL */ /* for dynamic allocation of rings associated with this q_vector */ struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp; }; -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector) { @@ -462,7 +462,7 @@ static inline bool ixgbe_qv_ll_polling(struct ixgbe_q_vector *q_vector) WARN_ON(!(q_vector->state & IXGBE_QV_LOCKED)); return q_vector->state & IXGBE_QV_USER_PEND; } -#else /* CONFIG_NET_LL_RX_POLL */ +#else /* CONFIG_NET_RX_BUSY_POLL */ static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector) { } @@ -491,7 +491,7 @@ static inline bool ixgbe_qv_ll_polling(struct ixgbe_q_vector *q_vector) { return false; } -#endif /* CONFIG_NET_LL_RX_POLL */ +#endif /* CONFIG_NET_RX_BUSY_POLL */ #ifdef CONFIG_IXGBE_HWMON diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index bad8f14b1941..be4b1fb3d0d2 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -1998,7 +1998,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, return total_rx_packets; } -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL /* must be called with local_bh_disable()d */ static int ixgbe_low_latency_recv(struct napi_struct *napi) { @@ -2030,7 +2030,7 @@ static int ixgbe_low_latency_recv(struct napi_struct *napi) return found; } -#endif /* CONFIG_NET_LL_RX_POLL */ +#endif /* CONFIG_NET_RX_BUSY_POLL */ /** * ixgbe_configure_msix - Configure MSI-X hardware @@ -7227,7 +7227,7 @@ static const struct net_device_ops ixgbe_netdev_ops = { #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = ixgbe_netpoll, #endif -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL .ndo_busy_poll = ixgbe_low_latency_recv, #endif #ifdef IXGBE_FCOE diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index 727874f575ce..a28cd801a236 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c @@ -223,7 +223,7 @@ static int mlx4_en_get_sset_count(struct net_device *dev, int sset) case ETH_SS_STATS: return (priv->stats_bitmap ? bit_count : NUM_ALL_STATS) + (priv->tx_ring_num * 2) + -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL (priv->rx_ring_num * 5); #else (priv->rx_ring_num * 2); @@ -276,7 +276,7 @@ static void mlx4_en_get_ethtool_stats(struct net_device *dev, for (i = 0; i < priv->rx_ring_num; i++) { data[index++] = priv->rx_ring[i].packets; data[index++] = priv->rx_ring[i].bytes; -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL data[index++] = priv->rx_ring[i].yields; data[index++] = priv->rx_ring[i].misses; data[index++] = priv->rx_ring[i].cleaned; @@ -344,7 +344,7 @@ static void mlx4_en_get_strings(struct net_device *dev, "rx%d_packets", i); sprintf(data + (index++) * ETH_GSTRING_LEN, "rx%d_bytes", i); -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL sprintf(data + (index++) * ETH_GSTRING_LEN, "rx%d_napi_yield", i); sprintf(data + (index++) * ETH_GSTRING_LEN, diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 5eac871399d8..fa37b7a61213 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -68,7 +68,7 @@ int mlx4_en_setup_tc(struct net_device *dev, u8 up) return 0; } -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL /* must be called with local_bh_disable()d */ static int mlx4_en_low_latency_recv(struct napi_struct *napi) { @@ -94,7 +94,7 @@ static int mlx4_en_low_latency_recv(struct napi_struct *napi) return done; } -#endif /* CONFIG_NET_LL_RX_POLL */ +#endif /* CONFIG_NET_RX_BUSY_POLL */ #ifdef CONFIG_RFS_ACCEL @@ -2140,7 +2140,7 @@ static const struct net_device_ops mlx4_netdev_ops = { #ifdef CONFIG_RFS_ACCEL .ndo_rx_flow_steer = mlx4_en_filter_rfs, #endif -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL .ndo_busy_poll = mlx4_en_low_latency_recv, #endif }; diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 35fb60e2320c..5e0aa569306a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h @@ -292,7 +292,7 @@ struct mlx4_en_rx_ring { void *rx_info; unsigned long bytes; unsigned long packets; -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL unsigned long yields; unsigned long misses; unsigned long cleaned; @@ -318,7 +318,7 @@ struct mlx4_en_cq { struct mlx4_cqe *buf; #define MLX4_EN_OPCODE_ERROR 0x1e -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL unsigned int state; #define MLX4_EN_CQ_STATE_IDLE 0 #define MLX4_EN_CQ_STATE_NAPI 1 /* NAPI owns this CQ */ @@ -329,7 +329,7 @@ struct mlx4_en_cq { #define CQ_YIELD (MLX4_EN_CQ_STATE_NAPI_YIELD | MLX4_EN_CQ_STATE_POLL_YIELD) #define CQ_USER_PEND (MLX4_EN_CQ_STATE_POLL | MLX4_EN_CQ_STATE_POLL_YIELD) spinlock_t poll_lock; /* protects from LLS/napi conflicts */ -#endif /* CONFIG_NET_LL_RX_POLL */ +#endif /* CONFIG_NET_RX_BUSY_POLL */ }; struct mlx4_en_port_profile { @@ -580,7 +580,7 @@ struct mlx4_mac_entry { struct rcu_head rcu; }; -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL static inline void mlx4_en_cq_init_lock(struct mlx4_en_cq *cq) { spin_lock_init(&cq->poll_lock); @@ -687,7 +687,7 @@ static inline bool mlx4_en_cq_ll_polling(struct mlx4_en_cq *cq) { return false; } -#endif /* CONFIG_NET_LL_RX_POLL */ +#endif /* CONFIG_NET_RX_BUSY_POLL */ #define MLX4_EN_WOL_DO_MODIFY (1ULL << 63) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 0741a1e919a5..9a4156845e93 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -973,7 +973,7 @@ struct net_device_ops { gfp_t gfp); void (*ndo_netpoll_cleanup)(struct net_device *dev); #endif -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL int (*ndo_busy_poll)(struct napi_struct *dev); #endif int (*ndo_set_vf_mac)(struct net_device *dev, diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 5afefa01a13c..3b71a4e83642 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -501,7 +501,7 @@ struct sk_buff { /* 7/9 bit hole (depending on ndisc_nodetype presence) */ kmemcheck_bitfield_end(flags2); -#if defined CONFIG_NET_DMA || defined CONFIG_NET_LL_RX_POLL +#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL union { unsigned int napi_id; dma_cookie_t dma_cookie; diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h index 6cd8848fec68..f18b91966d3d 100644 --- a/include/net/busy_poll.h +++ b/include/net/busy_poll.h @@ -27,7 +27,7 @@ #include <linux/netdevice.h> #include <net/ip.h> -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL struct napi_struct; extern unsigned int sysctl_net_busy_read __read_mostly; @@ -146,7 +146,7 @@ static inline void sk_mark_napi_id(struct sock *sk, struct sk_buff *skb) sk->sk_napi_id = skb->napi_id; } -#else /* CONFIG_NET_LL_RX_POLL */ +#else /* CONFIG_NET_RX_BUSY_POLL */ static inline unsigned long net_busy_loop_on(void) { return 0; @@ -186,5 +186,5 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock) return false; } -#endif /* CONFIG_NET_LL_RX_POLL */ +#endif /* CONFIG_NET_RX_BUSY_POLL */ #endif /* _LINUX_NET_BUSY_POLL_H */ diff --git a/include/net/sock.h b/include/net/sock.h index 95a5a2c6925a..31d5cfbb51ec 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -327,7 +327,7 @@ struct sock { #ifdef CONFIG_RPS __u32 sk_rxhash; #endif -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL unsigned int sk_napi_id; unsigned int sk_ll_usec; #endif diff --git a/net/Kconfig b/net/Kconfig index 37702491abe9..2b406608a1a4 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -244,7 +244,7 @@ config NETPRIO_CGROUP Cgroup subsystem for use in assigning processes to network priorities on a per-interface basis -config NET_LL_RX_POLL +config NET_RX_BUSY_POLL boolean default y diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 3df4d4ccf440..2c3d0f53d198 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -740,7 +740,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old) skb_copy_secmark(new, old); -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL new->napi_id = old->napi_id; #endif } diff --git a/net/core/sock.c b/net/core/sock.c index 548d716c5f62..2c097c5a35dd 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -900,7 +900,7 @@ set_rcvbuf: sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool); break; -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL case SO_BUSY_POLL: /* allow unprivileged users to decrease the value */ if ((val > sk->sk_ll_usec) && !capable(CAP_NET_ADMIN)) @@ -1170,7 +1170,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE); break; -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL case SO_BUSY_POLL: v.val = sk->sk_ll_usec; break; @@ -2292,7 +2292,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) sk->sk_stamp = ktime_set(-1L, 0); -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL sk->sk_napi_id = 0; sk->sk_ll_usec = sysctl_net_busy_read; #endif diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 660968616637..b59b6804fd98 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c @@ -298,7 +298,7 @@ static struct ctl_table net_core_table[] = { .proc_handler = flow_limit_table_len_sysctl }, #endif /* CONFIG_NET_FLOW_LIMIT */ -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL { .procname = "busy_poll", .data = &sysctl_net_busy_poll, diff --git a/net/socket.c b/net/socket.c index 829b460acb87..b2d7c629eeb9 100644 --- a/net/socket.c +++ b/net/socket.c @@ -106,7 +106,7 @@ #include <linux/atalk.h> #include <net/busy_poll.h> -#ifdef CONFIG_NET_LL_RX_POLL +#ifdef CONFIG_NET_RX_BUSY_POLL unsigned int sysctl_net_busy_read __read_mostly; unsigned int sysctl_net_busy_poll __read_mostly; #endif From c6c2401d8bbaf9edc189b4c35a8cb2780b8b988e Mon Sep 17 00:00:00 2001 From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org> Date: Wed, 3 Jul 2013 23:33:51 -0400 Subject: [PATCH 784/913] tracing/uprobes: Fail to unregister if probe event files are in use Uprobes suffer the same problem that kprobes have. There's a race between writing to the "enable" file and removing the probe. The probe checks for it being in use and if it is not, goes about deleting the probe and the event that represents it. But the problem with that is, after it checks if it is in use it can be enabled, and the deletion of the event (access to the probe) will fail, as it is in use. But the uprobe will still be deleted. This is a problem as the event can reference the uprobe that was deleted. The fix is to remove the event first, and check to make sure the event removal succeeds. Then it is safe to remove the probe. When the event exists, either ftrace or perf can enable the probe and prevent the event from being removed. Link: http://lkml.kernel.org/r/20130704034038.991525256@goodmis.org Acked-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace_uprobe.c | 51 +++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index a23d2d71188e..272261b5f94f 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -70,7 +70,7 @@ struct trace_uprobe { (sizeof(struct probe_arg) * (n))) static int register_uprobe_event(struct trace_uprobe *tu); -static void unregister_uprobe_event(struct trace_uprobe *tu); +static int unregister_uprobe_event(struct trace_uprobe *tu); static DEFINE_MUTEX(uprobe_lock); static LIST_HEAD(uprobe_list); @@ -164,11 +164,17 @@ static struct trace_uprobe *find_probe_event(const char *event, const char *grou } /* Unregister a trace_uprobe and probe_event: call with locking uprobe_lock */ -static void unregister_trace_uprobe(struct trace_uprobe *tu) +static int unregister_trace_uprobe(struct trace_uprobe *tu) { + int ret; + + ret = unregister_uprobe_event(tu); + if (ret) + return ret; + list_del(&tu->list); - unregister_uprobe_event(tu); free_trace_uprobe(tu); + return 0; } /* Register a trace_uprobe and probe_event */ @@ -181,9 +187,12 @@ static int register_trace_uprobe(struct trace_uprobe *tu) /* register as an event */ old_tp = find_probe_event(tu->call.name, tu->call.class->system); - if (old_tp) + if (old_tp) { /* delete old event */ - unregister_trace_uprobe(old_tp); + ret = unregister_trace_uprobe(old_tp); + if (ret) + goto end; + } ret = register_uprobe_event(tu); if (ret) { @@ -256,6 +265,8 @@ static int create_trace_uprobe(int argc, char **argv) group = UPROBE_EVENT_SYSTEM; if (is_delete) { + int ret; + if (!event) { pr_info("Delete command needs an event name.\n"); return -EINVAL; @@ -269,9 +280,9 @@ static int create_trace_uprobe(int argc, char **argv) return -ENOENT; } /* delete an event */ - unregister_trace_uprobe(tu); + ret = unregister_trace_uprobe(tu); mutex_unlock(&uprobe_lock); - return 0; + return ret; } if (argc < 2) { @@ -408,16 +419,20 @@ fail_address_parse: return ret; } -static void cleanup_all_probes(void) +static int cleanup_all_probes(void) { struct trace_uprobe *tu; + int ret = 0; mutex_lock(&uprobe_lock); while (!list_empty(&uprobe_list)) { tu = list_entry(uprobe_list.next, struct trace_uprobe, list); - unregister_trace_uprobe(tu); + ret = unregister_trace_uprobe(tu); + if (ret) + break; } mutex_unlock(&uprobe_lock); + return ret; } /* Probes listing interfaces */ @@ -462,8 +477,13 @@ static const struct seq_operations probes_seq_op = { static int probes_open(struct inode *inode, struct file *file) { - if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) - cleanup_all_probes(); + int ret; + + if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) { + ret = cleanup_all_probes(); + if (ret) + return ret; + } return seq_open(file, &probes_seq_op); } @@ -968,12 +988,17 @@ static int register_uprobe_event(struct trace_uprobe *tu) return ret; } -static void unregister_uprobe_event(struct trace_uprobe *tu) +static int unregister_uprobe_event(struct trace_uprobe *tu) { + int ret; + /* tu->event is unregistered in trace_remove_event_call() */ - trace_remove_event_call(&tu->call); + ret = trace_remove_event_call(&tu->call); + if (ret) + return ret; kfree(tu->call.print_fmt); tu->call.print_fmt = NULL; + return 0; } /* Make a trace interface for controling probe points */ From c756891a4e1c08c43780e17aca1d2b849ef31d1a Mon Sep 17 00:00:00 2001 From: Ying Xue <ying.xue@windriver.com> Date: Thu, 1 Aug 2013 08:29:18 -0400 Subject: [PATCH 785/913] tipc: fix oops when creating server socket fails When creation of TIPC internal server socket fails, we get an oops with the following dump: BUG: unable to handle kernel NULL pointer dereference at 0000000000000020 IP: [<ffffffffa0011f49>] tipc_close_conn+0x59/0xb0 [tipc] PGD 13719067 PUD 12008067 PMD 0 Oops: 0000 [#1] SMP DEBUG_PAGEALLOC Modules linked in: tipc(+) CPU: 4 PID: 4340 Comm: insmod Not tainted 3.10.0+ #1 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007 task: ffff880014360000 ti: ffff88001374c000 task.ti: ffff88001374c000 RIP: 0010:[<ffffffffa0011f49>] [<ffffffffa0011f49>] tipc_close_conn+0x59/0xb0 [tipc] RSP: 0018:ffff88001374dc98 EFLAGS: 00010292 RAX: 0000000000000000 RBX: ffff880012ac09d8 RCX: 0000000000000000 RDX: 0000000000000046 RSI: 0000000000000001 RDI: ffff880014360000 RBP: ffff88001374dcb8 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffa0016fa0 R13: ffffffffa0017010 R14: ffffffffa0017010 R15: ffff880012ac09d8 FS: 0000000000000000(0000) GS:ffff880016600000(0063) knlGS:00000000f76668d0 CS: 0010 DS: 002b ES: 002b CR0: 000000008005003b CR2: 0000000000000020 CR3: 0000000012227000 CR4: 00000000000006e0 Stack: ffff88001374dcb8 ffffffffa0016fa0 0000000000000000 0000000000000001 ffff88001374dcf8 ffffffffa0012922 ffff88001374dce8 00000000ffffffea ffffffffa0017100 0000000000000000 ffff8800134241a8 ffffffffa0017150 Call Trace: [<ffffffffa0012922>] tipc_server_stop+0xa2/0x1b0 [tipc] [<ffffffffa0009995>] tipc_subscr_stop+0x15/0x20 [tipc] [<ffffffffa00130f5>] tipc_core_stop+0x1d/0x33 [tipc] [<ffffffffa001f0d4>] tipc_init+0xd4/0xf8 [tipc] [<ffffffffa001f000>] ? 0xffffffffa001efff [<ffffffff8100023f>] do_one_initcall+0x3f/0x150 [<ffffffff81082f4d>] ? __blocking_notifier_call_chain+0x7d/0xd0 [<ffffffff810cc58a>] load_module+0x11aa/0x19c0 [<ffffffff810c8d60>] ? show_initstate+0x50/0x50 [<ffffffff8190311c>] ? retint_restore_args+0xe/0xe [<ffffffff810cce79>] SyS_init_module+0xd9/0x110 [<ffffffff8190dc65>] sysenter_dispatch+0x7/0x1f Code: 6c 24 70 4c 89 ef e8 b7 04 8f e1 8b 73 04 4c 89 e7 e8 7c 9e 32 e1 41 83 ac 24 b8 00 00 00 01 4c 89 ef e8 eb 0a 8f e1 48 8b 43 08 <4c> 8b 68 20 4d 8d a5 48 03 00 00 4c 89 e7 e8 04 05 8f e1 4c 89 RIP [<ffffffffa0011f49>] tipc_close_conn+0x59/0xb0 [tipc] RSP <ffff88001374dc98> CR2: 0000000000000020 ---[ end trace b02321f40e4269a3 ]--- We have the following call chain: tipc_core_start() ret = tipc_subscr_start() ret = tipc_server_start(){ server->enabled = 1; ret = tipc_open_listening_sock() } I.e., the server->enabled flag is unconditionally set to 1, whatever the return value of tipc_open_listening_sock(). This causes a crash when tipc_core_start() tries to clean up resources after a failed initialization: if (ret == failed) tipc_subscr_stop() tipc_server_stop(){ if (server->enabled) tipc_close_conn(){ NULL reference of con->sock-sk OOPS! } } To avoid this, tipc_server_start() should only set server->enabled to 1 in case of a succesful socket creation. In case of failure, it should release all allocated resources before returning. Problem introduced in commit c5fa7b3cf3cb22e4ac60485fc2dc187fe012910f ("tipc: introduce new TIPC server infrastructure") in v3.11-rc1. Note that it won't be seen often; it takes a module load under memory constrained conditions in order to trigger the failure condition. Signed-off-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/tipc/server.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/net/tipc/server.c b/net/tipc/server.c index 19da5abe0fa6..fd3fa57a410e 100644 --- a/net/tipc/server.c +++ b/net/tipc/server.c @@ -355,8 +355,12 @@ static int tipc_open_listening_sock(struct tipc_server *s) return PTR_ERR(con); sock = tipc_create_listen_sock(con); - if (!sock) + if (!sock) { + idr_remove(&s->conn_idr, con->conid); + s->idr_in_use--; + kfree(con); return -EINVAL; + } tipc_register_callbacks(sock, con); return 0; @@ -563,9 +567,14 @@ int tipc_server_start(struct tipc_server *s) kmem_cache_destroy(s->rcvbuf_cache); return ret; } + ret = tipc_open_listening_sock(s); + if (ret < 0) { + tipc_work_stop(s); + kmem_cache_destroy(s->rcvbuf_cache); + return ret; + } s->enabled = 1; - - return tipc_open_listening_sock(s); + return ret; } void tipc_server_stop(struct tipc_server *s) From 266e83474c98e9f18d31f4837cfe05819a660d32 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" <mst@redhat.com> Date: Thu, 1 Aug 2013 13:43:19 +0300 Subject: [PATCH 786/913] macvlan: better mode validation macvlan passthrough mode is special: it's not possible to switch to or from it through a netlink command. But if you try, the command will succeed, which is confusing. Validate input and return error to user. Cc: Sridhar Samudrala <sri@us.ibm.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/macvlan.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 18373b6ae37d..13937f9c04ad 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -863,6 +863,18 @@ static int macvlan_changelink(struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) { struct macvlan_dev *vlan = netdev_priv(dev); + enum macvlan_mode mode; + bool set_mode = false; + + /* Validate mode, but don't set yet: setting flags may fail. */ + if (data && data[IFLA_MACVLAN_MODE]) { + set_mode = true; + mode = nla_get_u32(data[IFLA_MACVLAN_MODE]); + /* Passthrough mode can't be set or cleared dynamically */ + if ((mode == MACVLAN_MODE_PASSTHRU) != + (vlan->mode == MACVLAN_MODE_PASSTHRU)) + return -EINVAL; + } if (data && data[IFLA_MACVLAN_FLAGS]) { __u16 flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]); @@ -879,8 +891,8 @@ static int macvlan_changelink(struct net_device *dev, } vlan->flags = flags; } - if (data && data[IFLA_MACVLAN_MODE]) - vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]); + if (set_mode) + vlan->mode = mode; return 0; } From 787381415cf967c5d6d1d7c5b5bd893376945edd Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" <mst@redhat.com> Date: Thu, 1 Aug 2013 13:50:10 +0300 Subject: [PATCH 787/913] macvlan: handle set_promiscuity failures It's quite unlikely that dev_set_promiscuity will fail, but worth checking just in case. Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/macvlan.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 13937f9c04ad..d0f9c2fd1d4f 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -337,8 +337,11 @@ static int macvlan_open(struct net_device *dev) int err; if (vlan->port->passthru) { - if (!(vlan->flags & MACVLAN_FLAG_NOPROMISC)) - dev_set_promiscuity(lowerdev, 1); + if (!(vlan->flags & MACVLAN_FLAG_NOPROMISC)) { + err = dev_set_promiscuity(lowerdev, 1); + if (err < 0) + goto out; + } goto hash_add; } From 697aebab78a88c6b164cfb74d19b86817d2ccd82 Mon Sep 17 00:00:00 2001 From: Takashi Iwai <tiwai@suse.de> Date: Thu, 1 Aug 2013 08:38:27 +0200 Subject: [PATCH 788/913] ALSA: hda - Fix missing fixup for Mac Mini with STAC9221 A fixup for Apple Mac Mini was lost during the adaption to the generic parser because the fallback for the generic ID 8384:7680 was dropped, and it resulted in the silence output (and maybe other problems). Unfortunately, just adding the missing subsystem ID wasn't enough, in this case. The subsystem ID of this machine is 0000:0100 (what Apple thought...?), and since snd_hda_pick_fixup() doesn't take the vendor id zero into account, the driver ignored this entry. Now it's fixed to regard the vendor id zero as a valid value. Reported-and-tested-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: <stable@vger.kernel.org> [v3.9+] Signed-off-by: Takashi Iwai <tiwai@suse.de> --- sound/pci/hda/hda_auto_parser.c | 2 +- sound/pci/hda/patch_sigmatel.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c index 7c11d46b84d3..48a9d004d6d9 100644 --- a/sound/pci/hda/hda_auto_parser.c +++ b/sound/pci/hda/hda_auto_parser.c @@ -860,7 +860,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec, } } if (id < 0 && quirk) { - for (q = quirk; q->subvendor; q++) { + for (q = quirk; q->subvendor || q->subdevice; q++) { unsigned int vendorid = q->subdevice | (q->subvendor << 16); unsigned int mask = 0xffff0000 | q->subdevice_mask; diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 92b9b4324372..6d1924c19abf 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2819,6 +2819,7 @@ static const struct hda_pintbl ecs202_pin_configs[] = { /* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */ static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl[] = { + SND_PCI_QUIRK(0x0000, 0x0100, "Mac Mini", STAC_INTEL_MAC_V3), SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1), SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2), SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2), From 005358c8c05998bef5e136ca7e7d6b1dc5326b49 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen <tomi.valkeinen@ti.com> Date: Fri, 2 Aug 2013 10:15:01 +0300 Subject: [PATCH 789/913] OMAPDSS: analog-tv-connector: compile fix connector-analog-tv.c uses omap_dss_pal_timings, defined in omapdss's venc.c, for default timings. omap_dss_pal_timings only exists when VENC is enabled in the kernel config, so disabling VENC breaks omap_dss_pal_timings connector-analog-tv compilation. Instead of adding dependency to VENC, add internal default timings to the connector driver, because the connector driver should not depend on VENC, and it can be used with any other analog TV encoder. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- .../omap2/displays-new/connector-analog-tv.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/video/omap2/displays-new/connector-analog-tv.c b/drivers/video/omap2/displays-new/connector-analog-tv.c index 5338f362293b..1b60698f141e 100644 --- a/drivers/video/omap2/displays-new/connector-analog-tv.c +++ b/drivers/video/omap2/displays-new/connector-analog-tv.c @@ -28,6 +28,20 @@ struct panel_drv_data { bool invert_polarity; }; +static const struct omap_video_timings tvc_pal_timings = { + .x_res = 720, + .y_res = 574, + .pixel_clock = 13500, + .hsw = 64, + .hfp = 12, + .hbp = 68, + .vsw = 5, + .vfp = 5, + .vbp = 41, + + .interlace = true, +}; + #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) static int tvc_connect(struct omap_dss_device *dssdev) @@ -212,14 +226,14 @@ static int tvc_probe(struct platform_device *pdev) return -ENODEV; } - ddata->timings = omap_dss_pal_timings; + ddata->timings = tvc_pal_timings; dssdev = &ddata->dssdev; dssdev->driver = &tvc_driver; dssdev->dev = &pdev->dev; dssdev->type = OMAP_DISPLAY_TYPE_VENC; dssdev->owner = THIS_MODULE; - dssdev->panel.timings = omap_dss_pal_timings; + dssdev->panel.timings = tvc_pal_timings; r = omapdss_register_display(dssdev); if (r) { From 208df1e4cbb13140d2f822cd2b15c00b51978776 Mon Sep 17 00:00:00 2001 From: Hector Palacios <hector.palacios@digi.com> Date: Thu, 1 Aug 2013 10:40:35 +0200 Subject: [PATCH 790/913] video: mxsfb: fix color settings for 18bit data bus and 32bpp For a combination of 18bit LCD data bus width and a color mode of 32bpp, the driver was setting the color mapping to rgb666, which is wrong, as the color in memory realy has an rgb888 layout. This patch also removes the setting of flag CTRL_DF24 that makes the driver dimiss the upper 2 bits when handling 32/24bpp colors in a diplay with 18bit data bus width. This flag made true color images display wrong in such configurations. Finally, the color mapping rgb666 has also been removed as nobody is using it and high level applications like Qt5 cannot work with it either. Reference: https://lkml.org/lkml/2013/5/23/220 Signed-off-by: Hector Palacios <hector.palacios@digi.com> Acked-by: Juergen Beisert <jbe@pengutronix.de> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- drivers/video/mxsfb.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 3ba37713b1f9..dc09ebe4aba5 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -239,24 +239,6 @@ static const struct fb_bitfield def_rgb565[] = { } }; -static const struct fb_bitfield def_rgb666[] = { - [RED] = { - .offset = 16, - .length = 6, - }, - [GREEN] = { - .offset = 8, - .length = 6, - }, - [BLUE] = { - .offset = 0, - .length = 6, - }, - [TRANSP] = { /* no support for transparency */ - .length = 0, - } -}; - static const struct fb_bitfield def_rgb888[] = { [RED] = { .offset = 16, @@ -309,9 +291,6 @@ static int mxsfb_check_var(struct fb_var_screeninfo *var, break; case STMLCDIF_16BIT: case STMLCDIF_18BIT: - /* 24 bit to 18 bit mapping */ - rgb = def_rgb666; - break; case STMLCDIF_24BIT: /* real 24 bit */ rgb = def_rgb888; @@ -453,11 +432,6 @@ static int mxsfb_set_par(struct fb_info *fb_info) return -EINVAL; case STMLCDIF_16BIT: case STMLCDIF_18BIT: - /* 24 bit to 18 bit mapping */ - ctrl |= CTRL_DF24; /* ignore the upper 2 bits in - * each colour component - */ - break; case STMLCDIF_24BIT: /* real 24 bit */ break; From 70a0f6032985f156bd7e957cfec99c3dd3d592a2 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen <tomi.valkeinen@ti.com> Date: Tue, 23 Jul 2013 10:57:47 +0300 Subject: [PATCH 791/913] ARM: OMAP: dss-common: fix Panda's DVI DDC channel Panda's DVI connector's DDC pins are connected to OMAP's third i2c bus. With non-DT, the bus number was 3, and that is what is used in the dss-common.c which contains the platform data for Panda's DVI. However, with DT, the bus number is 2. As we now only have DT boot for Panda, we have to change the bus number to make DVI EDID read operational. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> --- arch/arm/mach-omap2/dss-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c index 393aeefaebb0..043e5705f2a6 100644 --- a/arch/arm/mach-omap2/dss-common.c +++ b/arch/arm/mach-omap2/dss-common.c @@ -42,7 +42,7 @@ /* Using generic display panel */ static struct tfp410_platform_data omap4_dvi_panel = { - .i2c_bus_num = 3, + .i2c_bus_num = 2, .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, }; From 6431f5d7c6025f8b007af06ea090de308f7e6881 Mon Sep 17 00:00:00 2001 From: "Sumit.Saxena@lsi.com" <Sumit.Saxena@lsi.com> Date: Tue, 16 Jul 2013 02:26:05 +0530 Subject: [PATCH 792/913] [SCSI] megaraid_sas: megaraid_sas driver init fails in kdump kernel Problem: When Hardware IOMMU is on, megaraid_sas driver initialization fails in kdump kernel with LSI MegaRAID controller(device id-0x73). Actually this issue needs fix in firmware, but for firmware running in field, this driver fix is proposed to resolve the issue. At firmware initialization time, if firmware does not come to ready state, driver will reset the adapter and retry for firmware transition to ready state unconditionally(not only executed for kdump kernel). Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com> Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Cc: stable@vger.kernel.org Signed-off-by: James Bottomley <JBottomley@Parallels.com> --- drivers/scsi/megaraid/megaraid_sas_base.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 0177295599e0..1f0ca68409d4 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3547,11 +3547,21 @@ static int megasas_init_fw(struct megasas_instance *instance) break; } - /* - * We expect the FW state to be READY - */ - if (megasas_transition_to_ready(instance, 0)) - goto fail_ready_state; + if (megasas_transition_to_ready(instance, 0)) { + atomic_set(&instance->fw_reset_no_pci_access, 1); + instance->instancet->adp_reset + (instance, instance->reg_set); + atomic_set(&instance->fw_reset_no_pci_access, 0); + dev_info(&instance->pdev->dev, + "megasas: FW restarted successfully from %s!\n", + __func__); + + /*waitting for about 30 second before retry*/ + ssleep(30); + + if (megasas_transition_to_ready(instance, 0)) + goto fail_ready_state; + } /* * MSI-X host index 0 is common for all adapter. From e09056b25c38357df5c01985a0b3af608bccbfc0 Mon Sep 17 00:00:00 2001 From: Chris Leech <cleech@redhat.com> Date: Tue, 23 Jul 2013 13:04:58 -0700 Subject: [PATCH 793/913] [SCSI] fnic: BUG: sleeping function called from invalid context during probe I hit this during driver probe with the latest fnic updates (this trace is from a backport into a distro kernel, but the issue is the same). > BUG: sleeping function called from invalid context at mm/slab.c:3113 > in_atomic(): 0, irqs_disabled(): 1, pid: 610, name: work_for_cpu > INFO: lockdep is turned off. > irq event stamp: 0 > hardirqs last enabled at (0): [<(null)>] (null) > hardirqs last disabled at (0): [<ffffffff81070aa5>] > copy_process+0x5e5/0x1670 > softirqs last enabled at (0): [<ffffffff81070aa5>] > copy_process+0x5e5/0x1670 > softirqs last disabled at (0): [<(null)>] (null) > Pid: 610, comm: work_for_cpu Not tainted > Call Trace: > [<ffffffff810b2d10>] ? print_irqtrace_events+0xd0/0xe0 > [<ffffffff8105c1a7>] ? __might_sleep+0xf7/0x130 > [<ffffffff81184efb>] ? kmem_cache_alloc_trace+0x20b/0x2d0 > [<ffffffff8109709e>] ? __create_workqueue_key+0x3e/0x1d0 > [<ffffffff8109709e>] ? __create_workqueue_key+0x3e/0x1d0 > [<ffffffffa00c101c>] ? fnic_probe+0x977/0x11aa [fnic] > [<ffffffffa00c1048>] ? fnic_probe+0x9a3/0x11aa [fnic] > [<ffffffff81096f00>] ? do_work_for_cpu+0x0/0x30 > [<ffffffff812c6da7>] ? local_pci_probe+0x17/0x20 > [<ffffffff81096f18>] ? do_work_for_cpu+0x18/0x30 > [<ffffffff8109cdc6>] ? kthread+0x96/0xa0 > [<ffffffff8100c1ca>] ? child_rip+0xa/0x20 > [<ffffffff81550f80>] ? _spin_unlock_irq+0x30/0x40 > [<ffffffff8100bb10>] ? restore_args+0x0/0x30 > [<ffffffff8109cd30>] ? kthread+0x0/0xa0 > [<ffffffff8100c1c0>] ? child_rip+0x0/0x20 The problem is in this hunk of "FIP VLAN Discovery Feature Support" (d3c995f1dcf938f1084388d92b8fb97bec366566) create_singlethreaded_workqueue cannot be called with irqs disabled @@ -620,7 +634,29 @@ static int __devinit fnic_probe(struct pci_dev *pdev, vnic_dev_packet_filter(fnic->vdev, 1, 1, 0, 0, 0); vnic_dev_add_addr(fnic->vdev, FIP_ALL_ENODE_MACS); vnic_dev_add_addr(fnic->vdev, fnic->ctlr.ctl_src_addr); + fnic->set_vlan = fnic_set_vlan; fcoe_ctlr_init(&fnic->ctlr, FIP_MODE_AUTO); + setup_timer(&fnic->fip_timer, fnic_fip_notify_timer, + (unsigned long)fnic); + spin_lock_init(&fnic->vlans_lock); + INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame); + INIT_WORK(&fnic->event_work, fnic_handle_event); + skb_queue_head_init(&fnic->fip_frame_queue); + spin_lock_irqsave(&fnic_list_lock, flags); + if (!fnic_fip_queue) { + fnic_fip_queue = + create_singlethread_workqueue("fnic_fip_q"); + if (!fnic_fip_queue) { + spin_unlock_irqrestore(&fnic_list_lock, flags); + printk(KERN_ERR PFX "fnic FIP work queue " + "create failed\n"); + err = -ENOMEM; + goto err_out_free_max_pool; + } + } + spin_unlock_irqrestore(&fnic_list_lock, flags); + INIT_LIST_HEAD(&fnic->evlist); + INIT_LIST_HEAD(&fnic->vlans); } else { shost_printk(KERN_INFO, fnic->lport->host, "firmware uses non-FIP mode\n"); The attempts to make fnic_fip_queue a single instance for the driver while it's being created in probe look awkward anyway, why is this not created in fnic_init_module like the event workqueue? Signed-off-by: Chris Leech <cleech@redhat.com> Tested-by: Anantha Tungarakodi <atungara@cisco.com> Acked-by: Hiral Patel <hiralpat@cisco.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com> --- drivers/scsi/fnic/fnic.h | 2 +- drivers/scsi/fnic/fnic_main.c | 22 +++++++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h index b6d1f92ed33c..c18c68150e9f 100644 --- a/drivers/scsi/fnic/fnic.h +++ b/drivers/scsi/fnic/fnic.h @@ -38,7 +38,7 @@ #define DRV_NAME "fnic" #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" -#define DRV_VERSION "1.5.0.22" +#define DRV_VERSION "1.5.0.23" #define PFX DRV_NAME ": " #define DFX DRV_NAME "%d: " diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index 5f09d1814d26..42e15ee6e1bb 100644 --- a/drivers/scsi/fnic/fnic_main.c +++ b/drivers/scsi/fnic/fnic_main.c @@ -642,19 +642,6 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame); INIT_WORK(&fnic->event_work, fnic_handle_event); skb_queue_head_init(&fnic->fip_frame_queue); - spin_lock_irqsave(&fnic_list_lock, flags); - if (!fnic_fip_queue) { - fnic_fip_queue = - create_singlethread_workqueue("fnic_fip_q"); - if (!fnic_fip_queue) { - spin_unlock_irqrestore(&fnic_list_lock, flags); - printk(KERN_ERR PFX "fnic FIP work queue " - "create failed\n"); - err = -ENOMEM; - goto err_out_free_max_pool; - } - } - spin_unlock_irqrestore(&fnic_list_lock, flags); INIT_LIST_HEAD(&fnic->evlist); INIT_LIST_HEAD(&fnic->vlans); } else { @@ -960,6 +947,13 @@ static int __init fnic_init_module(void) spin_lock_init(&fnic_list_lock); INIT_LIST_HEAD(&fnic_list); + fnic_fip_queue = create_singlethread_workqueue("fnic_fip_q"); + if (!fnic_fip_queue) { + printk(KERN_ERR PFX "fnic FIP work queue create failed\n"); + err = -ENOMEM; + goto err_create_fip_workq; + } + fnic_fc_transport = fc_attach_transport(&fnic_fc_functions); if (!fnic_fc_transport) { printk(KERN_ERR PFX "fc_attach_transport error\n"); @@ -978,6 +972,8 @@ static int __init fnic_init_module(void) err_pci_register: fc_release_transport(fnic_fc_transport); err_fc_transport: + destroy_workqueue(fnic_fip_queue); +err_create_fip_workq: destroy_workqueue(fnic_event_queue); err_create_fnic_workq: kmem_cache_destroy(fnic_io_req_cache); From 7562523e84ddc742fe1f9db8bd76b01acca89f6b Mon Sep 17 00:00:00 2001 From: "Martin K. Petersen" <martin.petersen@oracle.com> Date: Tue, 30 Jul 2013 22:58:34 -0400 Subject: [PATCH 794/913] [SCSI] Don't attempt to send extended INQUIRY command if skip_vpd_pages is set If a device has the skip_vpd_pages flag set we should simply fail the scsi_get_vpd_page() call. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Tested-by: Stuart Foster <smf.linux@ntlworld.com> Cc: stable@vger.kernel.org Signed-off-by: James Bottomley <JBottomley@Parallels.com> --- drivers/scsi/scsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 3b1ea34e1f5a..eaa808e6ba91 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -1031,6 +1031,9 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf, { int i, result; + if (sdev->skip_vpd_pages) + goto fail; + /* Ask for all the pages supported by this device */ result = scsi_vpd_inquiry(sdev, buf, 0, buf_len); if (result) From cbd375567f7e4811b1c721f75ec519828ac6583f Mon Sep 17 00:00:00 2001 From: stephen hemminger <stephen@networkplumber.org> Date: Thu, 1 Aug 2013 22:32:07 -0700 Subject: [PATCH 795/913] htb: fix sign extension bug When userspace passes a large priority value the assignment of the unsigned value hopt->prio to signed int cl->prio causes cl->prio to become negative and the comparison is with TC_HTB_NUMPRIO is always false. The result is that HTB crashes by referencing outside the array when processing packets. With this patch the large value wraps around like other values outside the normal range. See: https://bugzilla.kernel.org/show_bug.cgi?id=60669 Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/sched/sch_htb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index c2124ea29f45..45e751527dfc 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -100,7 +100,7 @@ struct htb_class { struct psched_ratecfg ceil; s64 buffer, cbuffer;/* token bucket depth/rate */ s64 mbuffer; /* max wait time */ - int prio; /* these two are used only by leaves... */ + u32 prio; /* these two are used only by leaves... */ int quantum; /* but stored for parent-to-leaf return */ struct tcf_proto *filter_list; /* class attached filters */ From 7069f982b9099133b44e3cecbdd0192d81590bec Mon Sep 17 00:00:00 2001 From: Felipe Balbi <balbi@ti.com> Date: Fri, 2 Aug 2013 10:44:10 +0300 Subject: [PATCH 796/913] net: ethernet: cpsw: drop IRQF_DISABLED IRQF_DISABLED is a no-op by now and should be removed. Signed-off-by: Felipe Balbi <balbi@ti.com> Acked-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/ti/cpsw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 05a1674e204f..22a7a4336211 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1867,7 +1867,7 @@ static int cpsw_probe(struct platform_device *pdev) while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { for (i = res->start; i <= res->end; i++) { - if (request_irq(i, cpsw_interrupt, IRQF_DISABLED, + if (request_irq(i, cpsw_interrupt, 0, dev_name(&pdev->dev), priv)) { dev_err(priv->dev, "error attaching irq\n"); goto clean_ale_ret; From 9bb8eeb554795e6fac7cacf7af44bf413e75c9b9 Mon Sep 17 00:00:00 2001 From: Lekensteyn <lekensteyn@gmail.com> Date: Fri, 2 Aug 2013 10:36:55 +0200 Subject: [PATCH 797/913] r8169: remove "PHY reset until link up" log spam This message was added in commit a7154cb8 (June 2004, [PATCH] r8169: link handling and phy reset rework) and is printed every ten seconds when no cable is connected and runtime power management is disabled. (Before that commit, "Reset RTL8169s PHY" would be printed instead.) Signed-off-by: Peter Wu <lekensteyn@gmail.com> Acked-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/realtek/r8169.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 880015cae6a3..b5eb4195fc99 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -3689,7 +3689,7 @@ static void rtl_phy_work(struct rtl8169_private *tp) if (tp->link_ok(ioaddr)) return; - netif_warn(tp, link, tp->dev, "PHY reset until link up\n"); + netif_dbg(tp, link, tp->dev, "PHY reset until link up\n"); tp->phy_reset_enable(tp); From 446266b0c742a2c9ee8f0dce759a0117bce58a86 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann <dborkman@redhat.com> Date: Fri, 2 Aug 2013 11:32:43 +0200 Subject: [PATCH 798/913] net: rtm_to_ifaddr: free ifa if ifa_cacheinfo processing fails Commit 5c766d642 ("ipv4: introduce address lifetime") leaves the ifa resource that was allocated via inet_alloc_ifa() unfreed when returning the function with -EINVAL. Thus, free it first via inet_free_ifa(). Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Reviewed-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/ipv4/devinet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 8d48c392adcc..34ca6d5a3a4b 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -772,7 +772,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh, ci = nla_data(tb[IFA_CACHEINFO]); if (!ci->ifa_valid || ci->ifa_prefered > ci->ifa_valid) { err = -EINVAL; - goto errout; + goto errout_free; } *pvalid_lft = ci->ifa_valid; *pprefered_lft = ci->ifa_prefered; @@ -780,6 +780,8 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh, return ifa; +errout_free: + inet_free_ifa(ifa); errout: return ERR_PTR(err); } From 3508ea333ed5414561af4c818b3b80c0acca1845 Mon Sep 17 00:00:00 2001 From: Denis Kirjanov <kda@linux-powerpc.org> Date: Fri, 2 Aug 2013 13:50:54 +0400 Subject: [PATCH 799/913] sis900: Fix the tx queue timeout issue [ 198.720048] ------------[ cut here ]------------ [ 198.720108] WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:255 dev_watchdog+0x229/0x240() [ 198.720118] NETDEV WATCHDOG: eth0 (sis900): transmit queue 0 timed out [ 198.720125] Modules linked in: bridge stp llc dmfe sundance 3c59x sis900 mii [ 198.720159] CPU: 0 PID: 0 Comm: swapper Not tainted 3.11.0-rc3+ #12 [ 198.720167] Hardware name: System Manufacturer System Name/TUSI-M, BIOS ASUS TUSI-M ACPI BIOS Revision 1013 Beta 001 12/14/2001 [ 198.720175] 000000ff c13fa6b9 c169ddcc c12208d6 c169ddf8 c1031e4d c1664a84 c169de24 [ 198.720197] 00000000 c165f5ea 000000ff c13fa6b9 00000001 000000ff c1664a84 c169de10 [ 198.720217] c1031f13 00000009 c169de08 c1664a84 c169de24 c169de50 c13fa6b9 c165f5ea [ 198.720240] Call Trace: [ 198.720257] [<c13fa6b9>] ? dev_watchdog+0x229/0x240 [ 198.720274] [<c12208d6>] dump_stack+0x16/0x20 [ 198.720306] [<c1031e4d>] warn_slowpath_common+0x7d/0xa0 [ 198.720318] [<c13fa6b9>] ? dev_watchdog+0x229/0x240 [ 198.720330] [<c1031f13>] warn_slowpath_fmt+0x33/0x40 [ 198.720342] [<c13fa6b9>] dev_watchdog+0x229/0x240 [ 198.720357] [<c103f158>] call_timer_fn+0x78/0x150 [ 198.720369] [<c103f0e0>] ? internal_add_timer+0x40/0x40 [ 198.720381] [<c13fa490>] ? dev_init_scheduler+0xa0/0xa0 [ 198.720392] [<c103f33f>] run_timer_softirq+0x10f/0x200 [ 198.720412] [<c103954f>] ? __do_softirq+0x6f/0x210 [ 198.720424] [<c13fa490>] ? dev_init_scheduler+0xa0/0xa0 [ 198.720435] [<c1039598>] __do_softirq+0xb8/0x210 [ 198.720467] [<c14b54d2>] ? _raw_spin_unlock+0x22/0x30 [ 198.720484] [<c1003245>] ? handle_irq+0x25/0xd0 [ 198.720496] [<c1039c0c>] irq_exit+0x9c/0xb0 [ 198.720508] [<c14bc9d7>] do_IRQ+0x47/0x94 [ 198.720534] [<c1056078>] ? hrtimer_start+0x28/0x30 [ 198.720564] [<c14bc8b1>] common_interrupt+0x31/0x38 [ 198.720589] [<c1008692>] ? default_idle+0x22/0xa0 [ 198.720600] [<c10083c7>] arch_cpu_idle+0x17/0x30 [ 198.720631] [<c106d23d>] cpu_startup_entry+0xcd/0x180 [ 198.720643] [<c14ae30a>] rest_init+0xaa/0xb0 [ 198.720654] [<c14ae260>] ? reciprocal_value+0x50/0x50 [ 198.720668] [<c17044e0>] ? repair_env_string+0x60/0x60 [ 198.720679] [<c1704bda>] start_kernel+0x29a/0x350 [ 198.720690] [<c17044e0>] ? repair_env_string+0x60/0x60 [ 198.720721] [<c1704269>] i386_start_kernel+0x39/0xa0 [ 198.720729] ---[ end trace 81e0a6266f5c73a8 ]--- [ 198.720740] eth0: Transmit timeout, status 00000204 00000000 timer routine checks the link status and if it's up calls netif_carrier_on() allowing upper layer to start the tx queue even if the auto-negotiation process is not finished. Also remove ugly auto-negotiation check from the sis900_start_xmit() CC: Duan Fugang <B38611@freescale.com> CC: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/sis/sis900.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/sis/sis900.c b/drivers/net/ethernet/sis/sis900.c index eb4aea3fe793..f5d7ad75e479 100644 --- a/drivers/net/ethernet/sis/sis900.c +++ b/drivers/net/ethernet/sis/sis900.c @@ -1318,7 +1318,7 @@ static void sis900_timer(unsigned long data) if (duplex){ sis900_set_mode(sis_priv, speed, duplex); sis630_set_eq(net_dev, sis_priv->chipset_rev); - netif_start_queue(net_dev); + netif_carrier_on(net_dev); } sis_priv->timer.expires = jiffies + HZ; @@ -1336,10 +1336,8 @@ static void sis900_timer(unsigned long data) status = sis900_default_phy(net_dev); mii_phy = sis_priv->mii; - if (status & MII_STAT_LINK){ + if (status & MII_STAT_LINK) sis900_check_mode(net_dev, mii_phy); - netif_carrier_on(net_dev); - } } else { /* Link ON -> OFF */ if (!(status & MII_STAT_LINK)){ @@ -1612,12 +1610,6 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev) unsigned int index_cur_tx, index_dirty_tx; unsigned int count_dirty_tx; - /* Don't transmit data before the complete of auto-negotiation */ - if(!sis_priv->autong_complete){ - netif_stop_queue(net_dev); - return NETDEV_TX_BUSY; - } - spin_lock_irqsave(&sis_priv->lock, flags); /* Calculate the next Tx descriptor entry. */ From 5f671d6b4ec3e6d66c2a868738af2cdea09e7509 Mon Sep 17 00:00:00 2001 From: Roman Gushchin <klamm@yandex-team.ru> Date: Fri, 2 Aug 2013 18:36:40 +0400 Subject: [PATCH 800/913] net: check net.core.somaxconn sysctl values It's possible to assign an invalid value to the net.core.somaxconn sysctl variable, because there is no checks at all. The sk_max_ack_backlog field of the sock structure is defined as unsigned short. Therefore, the backlog argument in inet_listen() shouldn't exceed USHRT_MAX. The backlog argument in the listen() syscall is truncated to the somaxconn value. So, the somaxconn value shouldn't exceed 65535 (USHRT_MAX). Also, negative values of somaxconn are meaningless. before: $ sysctl -w net.core.somaxconn=256 net.core.somaxconn = 256 $ sysctl -w net.core.somaxconn=65536 net.core.somaxconn = 65536 $ sysctl -w net.core.somaxconn=-100 net.core.somaxconn = -100 after: $ sysctl -w net.core.somaxconn=256 net.core.somaxconn = 256 $ sysctl -w net.core.somaxconn=65536 error: "Invalid argument" setting key "net.core.somaxconn" $ sysctl -w net.core.somaxconn=-100 error: "Invalid argument" setting key "net.core.somaxconn" Based on a prior patch from Changli Gao. Signed-off-by: Roman Gushchin <klamm@yandex-team.ru> Reported-by: Changli Gao <xiaosuo@gmail.com> Suggested-by: Eric Dumazet <edumazet@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/core/sysctl_net_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index b59b6804fd98..31107abd2783 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c @@ -21,7 +21,9 @@ #include <net/net_ratelimit.h> #include <net/busy_poll.h> +static int zero = 0; static int one = 1; +static int ushort_max = USHRT_MAX; #ifdef CONFIG_RPS static int rps_sock_flow_sysctl(struct ctl_table *table, int write, @@ -339,7 +341,9 @@ static struct ctl_table netns_core_table[] = { .data = &init_net.core.sysctl_somaxconn, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec + .extra1 = &zero, + .extra2 = &ushort_max, + .proc_handler = proc_dointvec_minmax }, { } }; From 6a8b7f0c85f1f42eb8b6e68ef3d5ba8020d8e272 Mon Sep 17 00:00:00 2001 From: Paul Moore <pmoore@redhat.com> Date: Fri, 2 Aug 2013 14:45:08 -0400 Subject: [PATCH 801/913] netlabel: use domain based selectors when address based selectors are not available NetLabel has the ability to selectively assign network security labels to outbound traffic based on either the LSM's "domain" (different for each LSM), the network destination, or a combination of both. Depending on the type of traffic, local or forwarded, and the type of traffic selector, domain or address based, different hooks are used to label the traffic; the goal being minimal overhead. Unfortunately, there is a bug such that a system using NetLabel domain based traffic selectors does not correctly label outbound local traffic that is not assigned to a socket. The issue is that in these cases the associated NetLabel hook only looks at the address based selectors and not the domain based selectors. This patch corrects this by checking both the domain and address based selectors so that the correct labeling is applied, regardless of the configuration type. In order to acomplish this fix, this patch also simplifies some of the NetLabel domainhash structures to use a more common outbound traffic mapping type: struct netlbl_dommap_def. This simplifies some of the code in this patch and paves the way for further simplifications in the future. Signed-off-by: Paul Moore <pmoore@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- net/netlabel/netlabel_cipso_v4.c | 4 +- net/netlabel/netlabel_domainhash.c | 104 ++++++++++++++--------------- net/netlabel/netlabel_domainhash.h | 46 ++++++------- net/netlabel/netlabel_kapi.c | 88 ++++++++++-------------- net/netlabel/netlabel_mgmt.c | 44 ++++++------ net/netlabel/netlabel_unlabeled.c | 2 +- 6 files changed, 130 insertions(+), 158 deletions(-) diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c index c15042f987bd..a1100640495d 100644 --- a/net/netlabel/netlabel_cipso_v4.c +++ b/net/netlabel/netlabel_cipso_v4.c @@ -691,8 +691,8 @@ static int netlbl_cipsov4_remove_cb(struct netlbl_dom_map *entry, void *arg) { struct netlbl_domhsh_walk_arg *cb_arg = arg; - if (entry->type == NETLBL_NLTYPE_CIPSOV4 && - entry->type_def.cipsov4->doi == cb_arg->doi) + if (entry->def.type == NETLBL_NLTYPE_CIPSOV4 && + entry->def.cipso->doi == cb_arg->doi) return netlbl_domhsh_remove_entry(entry, cb_arg->audit_info); return 0; diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c index 6bb1d42f0fac..85d842e6e431 100644 --- a/net/netlabel/netlabel_domainhash.c +++ b/net/netlabel/netlabel_domainhash.c @@ -84,15 +84,15 @@ static void netlbl_domhsh_free_entry(struct rcu_head *entry) #endif /* IPv6 */ ptr = container_of(entry, struct netlbl_dom_map, rcu); - if (ptr->type == NETLBL_NLTYPE_ADDRSELECT) { + if (ptr->def.type == NETLBL_NLTYPE_ADDRSELECT) { netlbl_af4list_foreach_safe(iter4, tmp4, - &ptr->type_def.addrsel->list4) { + &ptr->def.addrsel->list4) { netlbl_af4list_remove_entry(iter4); kfree(netlbl_domhsh_addr4_entry(iter4)); } #if IS_ENABLED(CONFIG_IPV6) netlbl_af6list_foreach_safe(iter6, tmp6, - &ptr->type_def.addrsel->list6) { + &ptr->def.addrsel->list6) { netlbl_af6list_remove_entry(iter6); kfree(netlbl_domhsh_addr6_entry(iter6)); } @@ -213,21 +213,21 @@ static void netlbl_domhsh_audit_add(struct netlbl_dom_map *entry, if (addr4 != NULL) { struct netlbl_domaddr4_map *map4; map4 = netlbl_domhsh_addr4_entry(addr4); - type = map4->type; - cipsov4 = map4->type_def.cipsov4; + type = map4->def.type; + cipsov4 = map4->def.cipso; netlbl_af4list_audit_addr(audit_buf, 0, NULL, addr4->addr, addr4->mask); #if IS_ENABLED(CONFIG_IPV6) } else if (addr6 != NULL) { struct netlbl_domaddr6_map *map6; map6 = netlbl_domhsh_addr6_entry(addr6); - type = map6->type; + type = map6->def.type; netlbl_af6list_audit_addr(audit_buf, 0, NULL, &addr6->addr, &addr6->mask); #endif /* IPv6 */ } else { - type = entry->type; - cipsov4 = entry->type_def.cipsov4; + type = entry->def.type; + cipsov4 = entry->def.cipso; } switch (type) { case NETLBL_NLTYPE_UNLABELED: @@ -265,26 +265,25 @@ static int netlbl_domhsh_validate(const struct netlbl_dom_map *entry) if (entry == NULL) return -EINVAL; - switch (entry->type) { + switch (entry->def.type) { case NETLBL_NLTYPE_UNLABELED: - if (entry->type_def.cipsov4 != NULL || - entry->type_def.addrsel != NULL) + if (entry->def.cipso != NULL || entry->def.addrsel != NULL) return -EINVAL; break; case NETLBL_NLTYPE_CIPSOV4: - if (entry->type_def.cipsov4 == NULL) + if (entry->def.cipso == NULL) return -EINVAL; break; case NETLBL_NLTYPE_ADDRSELECT: - netlbl_af4list_foreach(iter4, &entry->type_def.addrsel->list4) { + netlbl_af4list_foreach(iter4, &entry->def.addrsel->list4) { map4 = netlbl_domhsh_addr4_entry(iter4); - switch (map4->type) { + switch (map4->def.type) { case NETLBL_NLTYPE_UNLABELED: - if (map4->type_def.cipsov4 != NULL) + if (map4->def.cipso != NULL) return -EINVAL; break; case NETLBL_NLTYPE_CIPSOV4: - if (map4->type_def.cipsov4 == NULL) + if (map4->def.cipso == NULL) return -EINVAL; break; default: @@ -292,9 +291,9 @@ static int netlbl_domhsh_validate(const struct netlbl_dom_map *entry) } } #if IS_ENABLED(CONFIG_IPV6) - netlbl_af6list_foreach(iter6, &entry->type_def.addrsel->list6) { + netlbl_af6list_foreach(iter6, &entry->def.addrsel->list6) { map6 = netlbl_domhsh_addr6_entry(iter6); - switch (map6->type) { + switch (map6->def.type) { case NETLBL_NLTYPE_UNLABELED: break; default: @@ -402,32 +401,31 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, rcu_assign_pointer(netlbl_domhsh_def, entry); } - if (entry->type == NETLBL_NLTYPE_ADDRSELECT) { + if (entry->def.type == NETLBL_NLTYPE_ADDRSELECT) { netlbl_af4list_foreach_rcu(iter4, - &entry->type_def.addrsel->list4) + &entry->def.addrsel->list4) netlbl_domhsh_audit_add(entry, iter4, NULL, ret_val, audit_info); #if IS_ENABLED(CONFIG_IPV6) netlbl_af6list_foreach_rcu(iter6, - &entry->type_def.addrsel->list6) + &entry->def.addrsel->list6) netlbl_domhsh_audit_add(entry, NULL, iter6, ret_val, audit_info); #endif /* IPv6 */ } else netlbl_domhsh_audit_add(entry, NULL, NULL, ret_val, audit_info); - } else if (entry_old->type == NETLBL_NLTYPE_ADDRSELECT && - entry->type == NETLBL_NLTYPE_ADDRSELECT) { + } else if (entry_old->def.type == NETLBL_NLTYPE_ADDRSELECT && + entry->def.type == NETLBL_NLTYPE_ADDRSELECT) { struct list_head *old_list4; struct list_head *old_list6; - old_list4 = &entry_old->type_def.addrsel->list4; - old_list6 = &entry_old->type_def.addrsel->list6; + old_list4 = &entry_old->def.addrsel->list4; + old_list6 = &entry_old->def.addrsel->list6; /* we only allow the addition of address selectors if all of * the selectors do not exist in the existing domain map */ - netlbl_af4list_foreach_rcu(iter4, - &entry->type_def.addrsel->list4) + netlbl_af4list_foreach_rcu(iter4, &entry->def.addrsel->list4) if (netlbl_af4list_search_exact(iter4->addr, iter4->mask, old_list4)) { @@ -435,8 +433,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, goto add_return; } #if IS_ENABLED(CONFIG_IPV6) - netlbl_af6list_foreach_rcu(iter6, - &entry->type_def.addrsel->list6) + netlbl_af6list_foreach_rcu(iter6, &entry->def.addrsel->list6) if (netlbl_af6list_search_exact(&iter6->addr, &iter6->mask, old_list6)) { @@ -446,7 +443,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, #endif /* IPv6 */ netlbl_af4list_foreach_safe(iter4, tmp4, - &entry->type_def.addrsel->list4) { + &entry->def.addrsel->list4) { netlbl_af4list_remove_entry(iter4); iter4->valid = 1; ret_val = netlbl_af4list_add(iter4, old_list4); @@ -457,7 +454,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, } #if IS_ENABLED(CONFIG_IPV6) netlbl_af6list_foreach_safe(iter6, tmp6, - &entry->type_def.addrsel->list6) { + &entry->def.addrsel->list6) { netlbl_af6list_remove_entry(iter6); iter6->valid = 1; ret_val = netlbl_af6list_add(iter6, old_list6); @@ -538,18 +535,18 @@ int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry, struct netlbl_af4list *iter4; struct netlbl_domaddr4_map *map4; - switch (entry->type) { + switch (entry->def.type) { case NETLBL_NLTYPE_ADDRSELECT: netlbl_af4list_foreach_rcu(iter4, - &entry->type_def.addrsel->list4) { + &entry->def.addrsel->list4) { map4 = netlbl_domhsh_addr4_entry(iter4); - cipso_v4_doi_putdef(map4->type_def.cipsov4); + cipso_v4_doi_putdef(map4->def.cipso); } /* no need to check the IPv6 list since we currently * support only unlabeled protocols for IPv6 */ break; case NETLBL_NLTYPE_CIPSOV4: - cipso_v4_doi_putdef(entry->type_def.cipsov4); + cipso_v4_doi_putdef(entry->def.cipso); break; } call_rcu(&entry->rcu, netlbl_domhsh_free_entry); @@ -590,20 +587,21 @@ int netlbl_domhsh_remove_af4(const char *domain, entry_map = netlbl_domhsh_search(domain); else entry_map = netlbl_domhsh_search_def(domain); - if (entry_map == NULL || entry_map->type != NETLBL_NLTYPE_ADDRSELECT) + if (entry_map == NULL || + entry_map->def.type != NETLBL_NLTYPE_ADDRSELECT) goto remove_af4_failure; spin_lock(&netlbl_domhsh_lock); entry_addr = netlbl_af4list_remove(addr->s_addr, mask->s_addr, - &entry_map->type_def.addrsel->list4); + &entry_map->def.addrsel->list4); spin_unlock(&netlbl_domhsh_lock); if (entry_addr == NULL) goto remove_af4_failure; - netlbl_af4list_foreach_rcu(iter4, &entry_map->type_def.addrsel->list4) + netlbl_af4list_foreach_rcu(iter4, &entry_map->def.addrsel->list4) goto remove_af4_single_addr; #if IS_ENABLED(CONFIG_IPV6) - netlbl_af6list_foreach_rcu(iter6, &entry_map->type_def.addrsel->list6) + netlbl_af6list_foreach_rcu(iter6, &entry_map->def.addrsel->list6) goto remove_af4_single_addr; #endif /* IPv6 */ /* the domain mapping is empty so remove it from the mapping table */ @@ -616,7 +614,7 @@ remove_af4_single_addr: * shouldn't be a problem */ synchronize_rcu(); entry = netlbl_domhsh_addr4_entry(entry_addr); - cipso_v4_doi_putdef(entry->type_def.cipsov4); + cipso_v4_doi_putdef(entry->def.cipso); kfree(entry); return 0; @@ -693,8 +691,8 @@ struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain) * responsible for ensuring that rcu_read_[un]lock() is called. * */ -struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, - __be32 addr) +struct netlbl_dommap_def *netlbl_domhsh_getentry_af4(const char *domain, + __be32 addr) { struct netlbl_dom_map *dom_iter; struct netlbl_af4list *addr_iter; @@ -702,15 +700,13 @@ struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, dom_iter = netlbl_domhsh_search_def(domain); if (dom_iter == NULL) return NULL; - if (dom_iter->type != NETLBL_NLTYPE_ADDRSELECT) - return NULL; - addr_iter = netlbl_af4list_search(addr, - &dom_iter->type_def.addrsel->list4); + if (dom_iter->def.type != NETLBL_NLTYPE_ADDRSELECT) + return &dom_iter->def; + addr_iter = netlbl_af4list_search(addr, &dom_iter->def.addrsel->list4); if (addr_iter == NULL) return NULL; - - return netlbl_domhsh_addr4_entry(addr_iter); + return &(netlbl_domhsh_addr4_entry(addr_iter)->def); } #if IS_ENABLED(CONFIG_IPV6) @@ -725,7 +721,7 @@ struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, * responsible for ensuring that rcu_read_[un]lock() is called. * */ -struct netlbl_domaddr6_map *netlbl_domhsh_getentry_af6(const char *domain, +struct netlbl_dommap_def *netlbl_domhsh_getentry_af6(const char *domain, const struct in6_addr *addr) { struct netlbl_dom_map *dom_iter; @@ -734,15 +730,13 @@ struct netlbl_domaddr6_map *netlbl_domhsh_getentry_af6(const char *domain, dom_iter = netlbl_domhsh_search_def(domain); if (dom_iter == NULL) return NULL; - if (dom_iter->type != NETLBL_NLTYPE_ADDRSELECT) - return NULL; - addr_iter = netlbl_af6list_search(addr, - &dom_iter->type_def.addrsel->list6); + if (dom_iter->def.type != NETLBL_NLTYPE_ADDRSELECT) + return &dom_iter->def; + addr_iter = netlbl_af6list_search(addr, &dom_iter->def.addrsel->list6); if (addr_iter == NULL) return NULL; - - return netlbl_domhsh_addr6_entry(addr_iter); + return &(netlbl_domhsh_addr6_entry(addr_iter)->def); } #endif /* IPv6 */ diff --git a/net/netlabel/netlabel_domainhash.h b/net/netlabel/netlabel_domainhash.h index 90872c4ca30f..b9be0eed8980 100644 --- a/net/netlabel/netlabel_domainhash.h +++ b/net/netlabel/netlabel_domainhash.h @@ -43,37 +43,35 @@ #define NETLBL_DOMHSH_BITSIZE 7 /* Domain mapping definition structures */ +struct netlbl_domaddr_map { + struct list_head list4; + struct list_head list6; +}; +struct netlbl_dommap_def { + u32 type; + union { + struct netlbl_domaddr_map *addrsel; + struct cipso_v4_doi *cipso; + }; +}; #define netlbl_domhsh_addr4_entry(iter) \ container_of(iter, struct netlbl_domaddr4_map, list) struct netlbl_domaddr4_map { - u32 type; - union { - struct cipso_v4_doi *cipsov4; - } type_def; + struct netlbl_dommap_def def; struct netlbl_af4list list; }; #define netlbl_domhsh_addr6_entry(iter) \ container_of(iter, struct netlbl_domaddr6_map, list) struct netlbl_domaddr6_map { - u32 type; - - /* NOTE: no 'type_def' union needed at present since we don't currently - * support any IPv6 labeling protocols */ + struct netlbl_dommap_def def; struct netlbl_af6list list; }; -struct netlbl_domaddr_map { - struct list_head list4; - struct list_head list6; -}; + struct netlbl_dom_map { char *domain; - u32 type; - union { - struct cipso_v4_doi *cipsov4; - struct netlbl_domaddr_map *addrsel; - } type_def; + struct netlbl_dommap_def def; u32 valid; struct list_head list; @@ -97,16 +95,16 @@ int netlbl_domhsh_remove_af4(const char *domain, int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info); int netlbl_domhsh_remove_default(struct netlbl_audit *audit_info); struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain); -struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, - __be32 addr); +struct netlbl_dommap_def *netlbl_domhsh_getentry_af4(const char *domain, + __be32 addr); +#if IS_ENABLED(CONFIG_IPV6) +struct netlbl_dommap_def *netlbl_domhsh_getentry_af6(const char *domain, + const struct in6_addr *addr); +#endif /* IPv6 */ + int netlbl_domhsh_walk(u32 *skip_bkt, u32 *skip_chain, int (*callback) (struct netlbl_dom_map *entry, void *arg), void *cb_arg); -#if IS_ENABLED(CONFIG_IPV6) -struct netlbl_domaddr6_map *netlbl_domhsh_getentry_af6(const char *domain, - const struct in6_addr *addr); -#endif /* IPv6 */ - #endif diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c index 7c94aedd0912..96a458e12f60 100644 --- a/net/netlabel/netlabel_kapi.c +++ b/net/netlabel/netlabel_kapi.c @@ -122,7 +122,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain, } if (addr == NULL && mask == NULL) - entry->type = NETLBL_NLTYPE_UNLABELED; + entry->def.type = NETLBL_NLTYPE_UNLABELED; else if (addr != NULL && mask != NULL) { addrmap = kzalloc(sizeof(*addrmap), GFP_ATOMIC); if (addrmap == NULL) @@ -137,7 +137,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain, map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); if (map4 == NULL) goto cfg_unlbl_map_add_failure; - map4->type = NETLBL_NLTYPE_UNLABELED; + map4->def.type = NETLBL_NLTYPE_UNLABELED; map4->list.addr = addr4->s_addr & mask4->s_addr; map4->list.mask = mask4->s_addr; map4->list.valid = 1; @@ -154,7 +154,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain, map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); if (map6 == NULL) goto cfg_unlbl_map_add_failure; - map6->type = NETLBL_NLTYPE_UNLABELED; + map6->def.type = NETLBL_NLTYPE_UNLABELED; map6->list.addr = *addr6; map6->list.addr.s6_addr32[0] &= mask6->s6_addr32[0]; map6->list.addr.s6_addr32[1] &= mask6->s6_addr32[1]; @@ -174,8 +174,8 @@ int netlbl_cfg_unlbl_map_add(const char *domain, break; } - entry->type_def.addrsel = addrmap; - entry->type = NETLBL_NLTYPE_ADDRSELECT; + entry->def.addrsel = addrmap; + entry->def.type = NETLBL_NLTYPE_ADDRSELECT; } else { ret_val = -EINVAL; goto cfg_unlbl_map_add_failure; @@ -355,8 +355,8 @@ int netlbl_cfg_cipsov4_map_add(u32 doi, } if (addr == NULL && mask == NULL) { - entry->type_def.cipsov4 = doi_def; - entry->type = NETLBL_NLTYPE_CIPSOV4; + entry->def.cipso = doi_def; + entry->def.type = NETLBL_NLTYPE_CIPSOV4; } else if (addr != NULL && mask != NULL) { addrmap = kzalloc(sizeof(*addrmap), GFP_ATOMIC); if (addrmap == NULL) @@ -367,8 +367,8 @@ int netlbl_cfg_cipsov4_map_add(u32 doi, addrinfo = kzalloc(sizeof(*addrinfo), GFP_ATOMIC); if (addrinfo == NULL) goto out_addrinfo; - addrinfo->type_def.cipsov4 = doi_def; - addrinfo->type = NETLBL_NLTYPE_CIPSOV4; + addrinfo->def.cipso = doi_def; + addrinfo->def.type = NETLBL_NLTYPE_CIPSOV4; addrinfo->list.addr = addr->s_addr & mask->s_addr; addrinfo->list.mask = mask->s_addr; addrinfo->list.valid = 1; @@ -376,8 +376,8 @@ int netlbl_cfg_cipsov4_map_add(u32 doi, if (ret_val != 0) goto cfg_cipsov4_map_add_failure; - entry->type_def.addrsel = addrmap; - entry->type = NETLBL_NLTYPE_ADDRSELECT; + entry->def.addrsel = addrmap; + entry->def.type = NETLBL_NLTYPE_ADDRSELECT; } else { ret_val = -EINVAL; goto out_addrmap; @@ -657,14 +657,14 @@ int netlbl_sock_setattr(struct sock *sk, } switch (family) { case AF_INET: - switch (dom_entry->type) { + switch (dom_entry->def.type) { case NETLBL_NLTYPE_ADDRSELECT: ret_val = -EDESTADDRREQ; break; case NETLBL_NLTYPE_CIPSOV4: ret_val = cipso_v4_sock_setattr(sk, - dom_entry->type_def.cipsov4, - secattr); + dom_entry->def.cipso, + secattr); break; case NETLBL_NLTYPE_UNLABELED: ret_val = 0; @@ -754,23 +754,22 @@ int netlbl_conn_setattr(struct sock *sk, { int ret_val; struct sockaddr_in *addr4; - struct netlbl_domaddr4_map *af4_entry; + struct netlbl_dommap_def *entry; rcu_read_lock(); switch (addr->sa_family) { case AF_INET: addr4 = (struct sockaddr_in *)addr; - af4_entry = netlbl_domhsh_getentry_af4(secattr->domain, - addr4->sin_addr.s_addr); - if (af4_entry == NULL) { + entry = netlbl_domhsh_getentry_af4(secattr->domain, + addr4->sin_addr.s_addr); + if (entry == NULL) { ret_val = -ENOENT; goto conn_setattr_return; } - switch (af4_entry->type) { + switch (entry->type) { case NETLBL_NLTYPE_CIPSOV4: ret_val = cipso_v4_sock_setattr(sk, - af4_entry->type_def.cipsov4, - secattr); + entry->cipso, secattr); break; case NETLBL_NLTYPE_UNLABELED: /* just delete the protocols we support for right now @@ -812,36 +811,21 @@ int netlbl_req_setattr(struct request_sock *req, const struct netlbl_lsm_secattr *secattr) { int ret_val; - struct netlbl_dom_map *dom_entry; - struct netlbl_domaddr4_map *af4_entry; - u32 proto_type; - struct cipso_v4_doi *proto_cv4; + struct netlbl_dommap_def *entry; rcu_read_lock(); - dom_entry = netlbl_domhsh_getentry(secattr->domain); - if (dom_entry == NULL) { - ret_val = -ENOENT; - goto req_setattr_return; - } switch (req->rsk_ops->family) { case AF_INET: - if (dom_entry->type == NETLBL_NLTYPE_ADDRSELECT) { - struct inet_request_sock *req_inet = inet_rsk(req); - af4_entry = netlbl_domhsh_getentry_af4(secattr->domain, - req_inet->rmt_addr); - if (af4_entry == NULL) { - ret_val = -ENOENT; - goto req_setattr_return; - } - proto_type = af4_entry->type; - proto_cv4 = af4_entry->type_def.cipsov4; - } else { - proto_type = dom_entry->type; - proto_cv4 = dom_entry->type_def.cipsov4; + entry = netlbl_domhsh_getentry_af4(secattr->domain, + inet_rsk(req)->rmt_addr); + if (entry == NULL) { + ret_val = -ENOENT; + goto req_setattr_return; } - switch (proto_type) { + switch (entry->type) { case NETLBL_NLTYPE_CIPSOV4: - ret_val = cipso_v4_req_setattr(req, proto_cv4, secattr); + ret_val = cipso_v4_req_setattr(req, + entry->cipso, secattr); break; case NETLBL_NLTYPE_UNLABELED: /* just delete the protocols we support for right now @@ -899,23 +883,21 @@ int netlbl_skbuff_setattr(struct sk_buff *skb, { int ret_val; struct iphdr *hdr4; - struct netlbl_domaddr4_map *af4_entry; + struct netlbl_dommap_def *entry; rcu_read_lock(); switch (family) { case AF_INET: hdr4 = ip_hdr(skb); - af4_entry = netlbl_domhsh_getentry_af4(secattr->domain, - hdr4->daddr); - if (af4_entry == NULL) { + entry = netlbl_domhsh_getentry_af4(secattr->domain,hdr4->daddr); + if (entry == NULL) { ret_val = -ENOENT; goto skbuff_setattr_return; } - switch (af4_entry->type) { + switch (entry->type) { case NETLBL_NLTYPE_CIPSOV4: - ret_val = cipso_v4_skbuff_setattr(skb, - af4_entry->type_def.cipsov4, - secattr); + ret_val = cipso_v4_skbuff_setattr(skb, entry->cipso, + secattr); break; case NETLBL_NLTYPE_UNLABELED: /* just delete the protocols we support for right now diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c index c5384ffc6146..dd1c37d7acbc 100644 --- a/net/netlabel/netlabel_mgmt.c +++ b/net/netlabel/netlabel_mgmt.c @@ -104,7 +104,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, ret_val = -ENOMEM; goto add_failure; } - entry->type = nla_get_u32(info->attrs[NLBL_MGMT_A_PROTOCOL]); + entry->def.type = nla_get_u32(info->attrs[NLBL_MGMT_A_PROTOCOL]); if (info->attrs[NLBL_MGMT_A_DOMAIN]) { size_t tmp_size = nla_len(info->attrs[NLBL_MGMT_A_DOMAIN]); entry->domain = kmalloc(tmp_size, GFP_KERNEL); @@ -116,12 +116,12 @@ static int netlbl_mgmt_add_common(struct genl_info *info, info->attrs[NLBL_MGMT_A_DOMAIN], tmp_size); } - /* NOTE: internally we allow/use a entry->type value of + /* NOTE: internally we allow/use a entry->def.type value of * NETLBL_NLTYPE_ADDRSELECT but we don't currently allow users * to pass that as a protocol value because we need to know the * "real" protocol */ - switch (entry->type) { + switch (entry->def.type) { case NETLBL_NLTYPE_UNLABELED: break; case NETLBL_NLTYPE_CIPSOV4: @@ -132,7 +132,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, cipsov4 = cipso_v4_doi_getdef(tmp_val); if (cipsov4 == NULL) goto add_failure; - entry->type_def.cipsov4 = cipsov4; + entry->def.cipso = cipsov4; break; default: goto add_failure; @@ -172,9 +172,9 @@ static int netlbl_mgmt_add_common(struct genl_info *info, map->list.addr = addr->s_addr & mask->s_addr; map->list.mask = mask->s_addr; map->list.valid = 1; - map->type = entry->type; + map->def.type = entry->def.type; if (cipsov4) - map->type_def.cipsov4 = cipsov4; + map->def.cipso = cipsov4; ret_val = netlbl_af4list_add(&map->list, &addrmap->list4); if (ret_val != 0) { @@ -182,8 +182,8 @@ static int netlbl_mgmt_add_common(struct genl_info *info, goto add_failure; } - entry->type = NETLBL_NLTYPE_ADDRSELECT; - entry->type_def.addrsel = addrmap; + entry->def.type = NETLBL_NLTYPE_ADDRSELECT; + entry->def.addrsel = addrmap; #if IS_ENABLED(CONFIG_IPV6) } else if (info->attrs[NLBL_MGMT_A_IPV6ADDR]) { struct in6_addr *addr; @@ -223,7 +223,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, map->list.addr.s6_addr32[3] &= mask->s6_addr32[3]; map->list.mask = *mask; map->list.valid = 1; - map->type = entry->type; + map->def.type = entry->def.type; ret_val = netlbl_af6list_add(&map->list, &addrmap->list6); if (ret_val != 0) { @@ -231,8 +231,8 @@ static int netlbl_mgmt_add_common(struct genl_info *info, goto add_failure; } - entry->type = NETLBL_NLTYPE_ADDRSELECT; - entry->type_def.addrsel = addrmap; + entry->def.type = NETLBL_NLTYPE_ADDRSELECT; + entry->def.addrsel = addrmap; #endif /* IPv6 */ } @@ -281,14 +281,13 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, return ret_val; } - switch (entry->type) { + switch (entry->def.type) { case NETLBL_NLTYPE_ADDRSELECT: nla_a = nla_nest_start(skb, NLBL_MGMT_A_SELECTORLIST); if (nla_a == NULL) return -ENOMEM; - netlbl_af4list_foreach_rcu(iter4, - &entry->type_def.addrsel->list4) { + netlbl_af4list_foreach_rcu(iter4, &entry->def.addrsel->list4) { struct netlbl_domaddr4_map *map4; struct in_addr addr_struct; @@ -310,13 +309,13 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, return ret_val; map4 = netlbl_domhsh_addr4_entry(iter4); ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, - map4->type); + map4->def.type); if (ret_val != 0) return ret_val; - switch (map4->type) { + switch (map4->def.type) { case NETLBL_NLTYPE_CIPSOV4: ret_val = nla_put_u32(skb, NLBL_MGMT_A_CV4DOI, - map4->type_def.cipsov4->doi); + map4->def.cipso->doi); if (ret_val != 0) return ret_val; break; @@ -325,8 +324,7 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, nla_nest_end(skb, nla_b); } #if IS_ENABLED(CONFIG_IPV6) - netlbl_af6list_foreach_rcu(iter6, - &entry->type_def.addrsel->list6) { + netlbl_af6list_foreach_rcu(iter6, &entry->def.addrsel->list6) { struct netlbl_domaddr6_map *map6; nla_b = nla_nest_start(skb, NLBL_MGMT_A_ADDRSELECTOR); @@ -345,7 +343,7 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, return ret_val; map6 = netlbl_domhsh_addr6_entry(iter6); ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, - map6->type); + map6->def.type); if (ret_val != 0) return ret_val; @@ -356,14 +354,14 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, nla_nest_end(skb, nla_a); break; case NETLBL_NLTYPE_UNLABELED: - ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, entry->type); + ret_val = nla_put_u32(skb,NLBL_MGMT_A_PROTOCOL,entry->def.type); break; case NETLBL_NLTYPE_CIPSOV4: - ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, entry->type); + ret_val = nla_put_u32(skb,NLBL_MGMT_A_PROTOCOL,entry->def.type); if (ret_val != 0) return ret_val; ret_val = nla_put_u32(skb, NLBL_MGMT_A_CV4DOI, - entry->type_def.cipsov4->doi); + entry->def.cipso->doi); break; } diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index af3531926ee0..8f0897407a2c 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c @@ -1541,7 +1541,7 @@ int __init netlbl_unlabel_defconf(void) entry = kzalloc(sizeof(*entry), GFP_KERNEL); if (entry == NULL) return -ENOMEM; - entry->type = NETLBL_NLTYPE_UNLABELED; + entry->def.type = NETLBL_NLTYPE_UNLABELED; ret_val = netlbl_domhsh_add_default(entry, &audit_info); if (ret_val != 0) return ret_val; From ed5467da0e369e65b247b99eb6403cb79172bcda Mon Sep 17 00:00:00 2001 From: Andrew Vagin <avagin@openvz.org> Date: Fri, 2 Aug 2013 21:16:43 +0400 Subject: [PATCH 802/913] tracing: Fix fields of struct trace_iterator that are zeroed by mistake tracing_read_pipe zeros all fields bellow "seq". The declaration contains a comment about that, but it doesn't help. The first field is "snapshot", it's true when current open file is snapshot. Looks obvious, that it should not be zeroed. The second field is "started". It was converted from cpumask_t to cpumask_var_t (v2.6.28-4983-g4462344), in other words it was converted from cpumask to pointer on cpumask. Currently the reference on "started" memory is lost after the first read from tracing_read_pipe and a proper object will never be freed. The "started" is never dereferenced for trace_pipe, because trace_pipe can't have the TRACE_FILE_ANNOTATE options. Link: http://lkml.kernel.org/r/1375463803-3085183-1-git-send-email-avagin@openvz.org Cc: stable@vger.kernel.org # 2.6.30 Signed-off-by: Andrew Vagin <avagin@openvz.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- include/linux/ftrace_event.h | 10 ++++++---- kernel/trace/trace.c | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index f98ab063e95e..120d57a1c3a5 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h @@ -78,6 +78,11 @@ struct trace_iterator { /* trace_seq for __print_flags() and __print_symbolic() etc. */ struct trace_seq tmp_seq; + cpumask_var_t started; + + /* it's true when current open file is snapshot */ + bool snapshot; + /* The below is zeroed out in pipe_read */ struct trace_seq seq; struct trace_entry *ent; @@ -90,10 +95,7 @@ struct trace_iterator { loff_t pos; long idx; - cpumask_var_t started; - - /* it's true when current open file is snapshot */ - bool snapshot; + /* All new field here will be zeroed out in pipe_read */ }; enum trace_iter_flags { diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 882ec1dd1515..f5b35a5e852f 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -4151,6 +4151,7 @@ waitagain: memset(&iter->seq, 0, sizeof(struct trace_iterator) - offsetof(struct trace_iterator, seq)); + cpumask_clear(iter->started); iter->pos = -1; trace_event_read_lock(); From e67bc51e574ffe3c4bc1e09cab7658b1e780b4ce Mon Sep 17 00:00:00 2001 From: Dhaval Giani <dhaval.giani@gmail.com> Date: Fri, 2 Aug 2013 14:47:29 -0400 Subject: [PATCH 803/913] tracing: Fix trace_dump_stack() proto when CONFIG_TRACING is not set When CONFIG_TRACING is not enabled, the stub prototype for trace_dump_stack() is incorrect. It has (void) when it should be (int). Link: http://lkml.kernel.org/r/CAPhKKr_H=ukFnBL4WgDOVT5ay2xeF-Ho+CA0DWZX0E2JW-=vSQ@mail.gmail.com Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- include/linux/kernel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 3bef14c6586b..482ad2d84a32 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -629,7 +629,7 @@ extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); static inline void tracing_start(void) { } static inline void tracing_stop(void) { } static inline void ftrace_off_permanent(void) { } -static inline void trace_dump_stack(void) { } +static inline void trace_dump_stack(int skip) { } static inline void tracing_on(void) { } static inline void tracing_off(void) { } From 711e124379e0f889e40e2f01d7f5d61936d3cd23 Mon Sep 17 00:00:00 2001 From: Alexander Z Lam <azl@google.com> Date: Fri, 2 Aug 2013 18:36:15 -0700 Subject: [PATCH 804/913] tracing: Make TRACE_ITER_STOP_ON_FREE stop the correct buffer Releasing the free_buffer file in an instance causes the global buffer to be stopped when TRACE_ITER_STOP_ON_FREE is enabled. Operate on the correct buffer. Link: http://lkml.kernel.org/r/1375493777-17261-1-git-send-email-azl@google.com Cc: Vaibhav Nagarnaik <vnagarnaik@google.com> Cc: David Sharp <dhsharp@google.com> Cc: Alexander Z Lam <lambchop468@gmail.com> Cc: stable@vger.kernel.org # 3.10 Signed-off-by: Alexander Z Lam <azl@google.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index f5b35a5e852f..531c9e69d0b3 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -4469,7 +4469,7 @@ tracing_free_buffer_release(struct inode *inode, struct file *filp) /* disable tracing ? */ if (trace_flags & TRACE_ITER_STOP_ON_FREE) - tracing_off(); + tracer_tracing_off(tr); /* resize the ring buffer to 0 */ tracing_resize_ring_buffer(tr, 0, RING_BUFFER_ALL_CPUS); From 9457158bbc0ee04ecef76862d73eecd8076e9c7b Mon Sep 17 00:00:00 2001 From: Alexander Z Lam <azl@google.com> Date: Fri, 2 Aug 2013 18:36:16 -0700 Subject: [PATCH 805/913] tracing: Fix reset of time stamps during trace_clock changes Fixed two issues with changing the timestamp clock with trace_clock: - The global buffer was reset on instance clock changes. Change this to pass the correct per-instance buffer - ftrace_now() is used to set buf->time_start in tracing_reset_online_cpus(). This was incorrect because ftrace_now() used the global buffer's clock to return the current time. Change this to use buffer_ftrace_now() which returns the current time for the correct per-instance buffer. Also removed tracing_reset_current() because it is not used anywhere Link: http://lkml.kernel.org/r/1375493777-17261-2-git-send-email-azl@google.com Cc: Vaibhav Nagarnaik <vnagarnaik@google.com> Cc: David Sharp <dhsharp@google.com> Cc: Alexander Z Lam <lambchop468@gmail.com> Cc: stable@vger.kernel.org # 3.10 Signed-off-by: Alexander Z Lam <azl@google.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 531c9e69d0b3..496f94d57698 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -243,20 +243,25 @@ int filter_current_check_discard(struct ring_buffer *buffer, } EXPORT_SYMBOL_GPL(filter_current_check_discard); -cycle_t ftrace_now(int cpu) +cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu) { u64 ts; /* Early boot up does not have a buffer yet */ - if (!global_trace.trace_buffer.buffer) + if (!buf->buffer) return trace_clock_local(); - ts = ring_buffer_time_stamp(global_trace.trace_buffer.buffer, cpu); - ring_buffer_normalize_time_stamp(global_trace.trace_buffer.buffer, cpu, &ts); + ts = ring_buffer_time_stamp(buf->buffer, cpu); + ring_buffer_normalize_time_stamp(buf->buffer, cpu, &ts); return ts; } +cycle_t ftrace_now(int cpu) +{ + return buffer_ftrace_now(&global_trace.trace_buffer, cpu); +} + /** * tracing_is_enabled - Show if global_trace has been disabled * @@ -1211,7 +1216,7 @@ void tracing_reset_online_cpus(struct trace_buffer *buf) /* Make sure all commits have finished */ synchronize_sched(); - buf->time_start = ftrace_now(buf->cpu); + buf->time_start = buffer_ftrace_now(buf, buf->cpu); for_each_online_cpu(cpu) ring_buffer_reset_cpu(buffer, cpu); @@ -1219,11 +1224,6 @@ void tracing_reset_online_cpus(struct trace_buffer *buf) ring_buffer_record_enable(buffer); } -void tracing_reset_current(int cpu) -{ - tracing_reset(&global_trace.trace_buffer, cpu); -} - /* Must have trace_types_lock held */ void tracing_reset_all_online_cpus(void) { @@ -4634,12 +4634,12 @@ static ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf, * New clock may not be consistent with the previous clock. * Reset the buffer so that it doesn't have incomparable timestamps. */ - tracing_reset_online_cpus(&global_trace.trace_buffer); + tracing_reset_online_cpus(&tr->trace_buffer); #ifdef CONFIG_TRACER_MAX_TRACE if (tr->flags & TRACE_ARRAY_FL_GLOBAL && tr->max_buffer.buffer) ring_buffer_set_clock(tr->max_buffer.buffer, trace_clocks[i].func); - tracing_reset_online_cpus(&global_trace.max_buffer); + tracing_reset_online_cpus(&tr->max_buffer); #endif mutex_unlock(&trace_types_lock); From e0d407564b532d978b03ceccebd224a05d02f111 Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Sat, 3 Aug 2013 10:30:05 +0100 Subject: [PATCH 806/913] ARM: fix a cockup in 48be69a02 (ARM: move signal handlers into a vdso-like page) Unfortunately, I never committed the fix to a nasty oops which can occur as a result of that commit: ------------[ cut here ]------------ kernel BUG at /home/olof/work/batch/include/linux/mm.h:414! Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM Modules linked in: CPU: 0 PID: 490 Comm: killall5 Not tainted 3.11.0-rc3-00288-gabe0308 #53 task: e90acac0 ti: e9be8000 task.ti: e9be8000 PC is at special_mapping_fault+0xa4/0xc4 LR is at __do_fault+0x68/0x48c This doesn't show up unless you do quite a bit of testing; a simple boot test does not do this, so all my nightly tests were passing fine. The reason for this is that install_special_mapping() expects the page array to stick around, and as this was only inserting one page which was stored on the kernel stack, that's why this was blowing up. Reported-by: Olof Johansson <olof@lixom.net> Tested-by: Olof Johansson <olof@lixom.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/kernel/process.c | 9 +++++---- arch/arm/kernel/signal.c | 41 ++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 1e6c33d01c05..d03b5bd889c5 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -471,17 +471,18 @@ const char *arch_vma_name(struct vm_area_struct *vma) "[sigpage]" : NULL; } +static struct page *signal_page; extern struct page *get_signal_page(void); int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) { struct mm_struct *mm = current->mm; - struct page *page; unsigned long addr; int ret; - page = get_signal_page(); - if (!page) + if (!signal_page) + signal_page = get_signal_page(); + if (!signal_page) return -ENOMEM; down_write(&mm->mmap_sem); @@ -493,7 +494,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) ret = install_special_mapping(mm, addr, PAGE_SIZE, VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, - &page); + &signal_page); if (ret == 0) mm->context.sigpage = addr; diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 0f17e06d51e6..39e7105a9b70 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -614,35 +614,32 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) return 0; } -static struct page *signal_page; - struct page *get_signal_page(void) { - if (!signal_page) { - unsigned long ptr; - unsigned offset; - void *addr; + unsigned long ptr; + unsigned offset; + struct page *page; + void *addr; - signal_page = alloc_pages(GFP_KERNEL, 0); + page = alloc_pages(GFP_KERNEL, 0); - if (!signal_page) - return NULL; + if (!page) + return NULL; - addr = page_address(signal_page); + addr = page_address(page); - /* Give the signal return code some randomness */ - offset = 0x200 + (get_random_int() & 0x7fc); - signal_return_offset = offset; + /* Give the signal return code some randomness */ + offset = 0x200 + (get_random_int() & 0x7fc); + signal_return_offset = offset; - /* - * Copy signal return handlers into the vector page, and - * set sigreturn to be a pointer to these. - */ - memcpy(addr + offset, sigreturn_codes, sizeof(sigreturn_codes)); + /* + * Copy signal return handlers into the vector page, and + * set sigreturn to be a pointer to these. + */ + memcpy(addr + offset, sigreturn_codes, sizeof(sigreturn_codes)); - ptr = (unsigned long)addr + offset; - flush_icache_range(ptr, ptr + sizeof(sigreturn_codes)); - } + ptr = (unsigned long)addr + offset; + flush_icache_range(ptr, ptr + sizeof(sigreturn_codes)); - return signal_page; + return page; } From 8c0cc8a5d90bc7373a7a9e7f7a40eb41f51e03fc Mon Sep 17 00:00:00 2001 From: Russell King <rmk+kernel@arm.linux.org.uk> Date: Sat, 3 Aug 2013 10:39:51 +0100 Subject: [PATCH 807/913] ARM: fix nommu builds with 48be69a02 (ARM: move signal handlers into a vdso-like page) Olof reports that noMMU builds error out with: arch/arm/kernel/signal.c: In function 'setup_return': arch/arm/kernel/signal.c:413:25: error: 'mm_context_t' has no member named 'sigpage' This shows one of the evilnesses of IS_ENABLED(). Get rid of it here and replace it with #ifdef's - and as no noMMU platform can make use of sigpage, depend on CONIFG_MMU not CONFIG_ARM_MPU. Reported-by: Olof Johansson <olof@lixom.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/include/asm/elf.h | 2 ++ arch/arm/kernel/signal.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index 9c9b30717fda..56211f2084ef 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h @@ -130,8 +130,10 @@ struct mm_struct; extern unsigned long arch_randomize_brk(struct mm_struct *mm); #define arch_randomize_brk arch_randomize_brk +#ifdef CONFIG_MMU #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 struct linux_binprm; int arch_setup_additional_pages(struct linux_binprm *, int); +#endif #endif diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 39e7105a9b70..ab3304225272 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -402,7 +402,8 @@ setup_return(struct pt_regs *regs, struct ksignal *ksig, __put_user(sigreturn_codes[idx+1], rc+1)) return 1; - if ((cpsr & MODE32_BIT) && !IS_ENABLED(CONFIG_ARM_MPU)) { +#ifdef CONFIG_MMU + if (cpsr & MODE32_BIT) { struct mm_struct *mm = current->mm; /* @@ -412,7 +413,9 @@ setup_return(struct pt_regs *regs, struct ksignal *ksig, */ retcode = mm->context.sigpage + signal_return_offset + (idx << 2) + thumb; - } else { + } else +#endif + { /* * Ensure that the instruction cache sees * the return code written onto the stack. From 5c52add19733eb36d8619713312f5604efef3502 Mon Sep 17 00:00:00 2001 From: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Date: Tue, 30 Jul 2013 17:14:34 -0400 Subject: [PATCH 808/913] hwmon: (max6697) fix MAX6581 ideality Without this patch, the values for ideality (register 0x4b) and ideality selection mask (register 0x4c) are inverted. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Cc: stable@vger.kernel.org # 3.9+ Signed-off-by: Guenter Roeck <linux@roeck-us.net> --- drivers/hwmon/max6697.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c index 328fb0353c17..a41b5f3fc506 100644 --- a/drivers/hwmon/max6697.c +++ b/drivers/hwmon/max6697.c @@ -605,12 +605,12 @@ static int max6697_init_chip(struct i2c_client *client) if (ret < 0) return ret; ret = i2c_smbus_write_byte_data(client, MAX6581_REG_IDEALITY, - pdata->ideality_mask >> 1); + pdata->ideality_value); if (ret < 0) return ret; ret = i2c_smbus_write_byte_data(client, MAX6581_REG_IDEALITY_SELECT, - pdata->ideality_value); + pdata->ideality_mask >> 1); if (ret < 0) return ret; } From b6bb1c63dd46c4a9cdccbf5b5db49386eb6759a9 Mon Sep 17 00:00:00 2001 From: Mugunthan V N <mugunthanvnm@ti.com> Date: Sat, 3 Aug 2013 16:39:45 +0530 Subject: [PATCH 809/913] net: ethernet: davinci_emac: drop IRQF_DISABLED IRQF_DISABLED is a no-op by now and should be removed. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/ti/davinci_emac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 07b176bcf929..1a222bce4bd7 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c @@ -1568,8 +1568,7 @@ static int emac_dev_open(struct net_device *ndev) while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { for (i = res->start; i <= res->end; i++) { if (devm_request_irq(&priv->pdev->dev, i, emac_irq, - IRQF_DISABLED, - ndev->name, ndev)) + 0, ndev->name, ndev)) goto rollback; } k++; From 4a99ab56cea66f9f67b9d07ace5cd40a336c8e6f Mon Sep 17 00:00:00 2001 From: Shahed Shaikh <shahed.shaikh@qlogic.com> Date: Fri, 2 Aug 2013 23:15:54 -0400 Subject: [PATCH 810/913] qlcnic: Fix MAC address filter issue on 82xx adapter Driver was passing the address of a pointer instead of the pointer itself. Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index d3f8797efcc3..82a03d3de894 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c @@ -262,7 +262,7 @@ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr, mac_req = (struct qlcnic_mac_req *)&(req->words[0]); mac_req->op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD; - memcpy(mac_req->mac_addr, &uaddr, ETH_ALEN); + memcpy(mac_req->mac_addr, uaddr, ETH_ALEN); vlan_req = (struct qlcnic_vlan_req *)&req->words[1]; vlan_req->vlan_id = cpu_to_le16(vlan_id); From e0d138d99507362e2e77b4ff61b546a8b63d60b0 Mon Sep 17 00:00:00 2001 From: Shahed Shaikh <shahed.shaikh@qlogic.com> Date: Fri, 2 Aug 2013 23:15:55 -0400 Subject: [PATCH 811/913] qlcnic: Fix ingress MAC learning o Delete MAC address from the adapter's filter table if the source MAC address of ingress packet matches. Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- .../net/ethernet/qlogic/qlcnic/qlcnic_io.c | 99 ++++++++++++------- 1 file changed, 66 insertions(+), 33 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index 82a03d3de894..6946d354f44f 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c @@ -161,36 +161,68 @@ static inline int qlcnic_82xx_is_lb_pkt(u64 sts_data) return (qlcnic_get_sts_status(sts_data) == STATUS_CKSUM_LOOP) ? 1 : 0; } +static void qlcnic_delete_rx_list_mac(struct qlcnic_adapter *adapter, + struct qlcnic_filter *fil, + void *addr, u16 vlan_id) +{ + int ret; + u8 op; + + op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD; + ret = qlcnic_sre_macaddr_change(adapter, addr, vlan_id, op); + if (ret) + return; + + op = vlan_id ? QLCNIC_MAC_VLAN_DEL : QLCNIC_MAC_DEL; + ret = qlcnic_sre_macaddr_change(adapter, addr, vlan_id, op); + if (!ret) { + hlist_del(&fil->fnode); + adapter->rx_fhash.fnum--; + } +} + +static struct qlcnic_filter *qlcnic_find_mac_filter(struct hlist_head *head, + void *addr, u16 vlan_id) +{ + struct qlcnic_filter *tmp_fil = NULL; + struct hlist_node *n; + + hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { + if (!memcmp(tmp_fil->faddr, addr, ETH_ALEN) && + tmp_fil->vlan_id == vlan_id) + return tmp_fil; + } + + return NULL; +} + void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, int loopback_pkt, u16 vlan_id) { struct ethhdr *phdr = (struct ethhdr *)(skb->data); struct qlcnic_filter *fil, *tmp_fil; - struct hlist_node *n; struct hlist_head *head; unsigned long time; u64 src_addr = 0; - u8 hindex, found = 0, op; + u8 hindex, op; int ret; memcpy(&src_addr, phdr->h_source, ETH_ALEN); + hindex = qlcnic_mac_hash(src_addr) & + (adapter->fhash.fbucket_size - 1); if (loopback_pkt) { if (adapter->rx_fhash.fnum >= adapter->rx_fhash.fmax) return; - hindex = qlcnic_mac_hash(src_addr) & - (adapter->fhash.fbucket_size - 1); head = &(adapter->rx_fhash.fhead[hindex]); - hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { - if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && - tmp_fil->vlan_id == vlan_id) { - time = tmp_fil->ftime; - if (jiffies > (QLCNIC_READD_AGE * HZ + time)) - tmp_fil->ftime = jiffies; - return; - } + tmp_fil = qlcnic_find_mac_filter(head, &src_addr, vlan_id); + if (tmp_fil) { + time = tmp_fil->ftime; + if (time_after(jiffies, QLCNIC_READD_AGE * HZ + time)) + tmp_fil->ftime = jiffies; + return; } fil = kzalloc(sizeof(struct qlcnic_filter), GFP_ATOMIC); @@ -205,36 +237,37 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, adapter->rx_fhash.fnum++; spin_unlock(&adapter->rx_mac_learn_lock); } else { - hindex = qlcnic_mac_hash(src_addr) & - (adapter->fhash.fbucket_size - 1); - head = &(adapter->rx_fhash.fhead[hindex]); - spin_lock(&adapter->rx_mac_learn_lock); - hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { - if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && - tmp_fil->vlan_id == vlan_id) { - found = 1; - break; - } - } + head = &adapter->fhash.fhead[hindex]; - if (!found) { - spin_unlock(&adapter->rx_mac_learn_lock); - return; - } + spin_lock(&adapter->mac_learn_lock); - op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD; - ret = qlcnic_sre_macaddr_change(adapter, (u8 *)&src_addr, - vlan_id, op); - if (!ret) { + tmp_fil = qlcnic_find_mac_filter(head, &src_addr, vlan_id); + if (tmp_fil) { op = vlan_id ? QLCNIC_MAC_VLAN_DEL : QLCNIC_MAC_DEL; ret = qlcnic_sre_macaddr_change(adapter, (u8 *)&src_addr, vlan_id, op); if (!ret) { - hlist_del(&(tmp_fil->fnode)); - adapter->rx_fhash.fnum--; + hlist_del(&tmp_fil->fnode); + adapter->fhash.fnum--; } + + spin_unlock(&adapter->mac_learn_lock); + + return; } + + spin_unlock(&adapter->mac_learn_lock); + + head = &adapter->rx_fhash.fhead[hindex]; + + spin_lock(&adapter->rx_mac_learn_lock); + + tmp_fil = qlcnic_find_mac_filter(head, &src_addr, vlan_id); + if (tmp_fil) + qlcnic_delete_rx_list_mac(adapter, tmp_fil, &src_addr, + vlan_id); + spin_unlock(&adapter->rx_mac_learn_lock); } } From f91bbcb0b82186b4d5669021b142c263b66505e1 Mon Sep 17 00:00:00 2001 From: Himanshu Madhani <himanshu.madhani@qlogic.com> Date: Fri, 2 Aug 2013 23:15:56 -0400 Subject: [PATCH 812/913] qlcnic: Free up memory in error path. Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index 0581a484ceb5..8d401babd491 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c @@ -210,10 +210,10 @@ int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *adapter, u32 fw_cmd) if (err) { dev_info(&adapter->pdev->dev, "Failed to set driver version in firmware\n"); - return -EIO; + err = -EIO; } - - return 0; + qlcnic_free_mbx_args(&cmd); + return err; } int From 01b91f4c31e434d08fa6b7f4d261cc4e98c0772a Mon Sep 17 00:00:00 2001 From: Pratik Pujar <pratik.pujar@qlogic.com> Date: Fri, 2 Aug 2013 23:15:57 -0400 Subject: [PATCH 813/913] qlcnic: Removed adapter series name from warning messages. Signed-off-by: Pratik Pujar <pratik.pujar@qlogic.com> Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index cc78d3924c6a..a849446da7c9 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -2141,7 +2141,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (qlcnic_83xx_check(adapter) && !qlcnic_use_msi_x && !!qlcnic_use_msi) dev_warn(&pdev->dev, - "83xx adapter do not support MSI interrupts\n"); + "Device does not support MSI interrupts\n"); err = qlcnic_setup_intr(adapter, 0); if (err) { diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index 56e85f98117f..5d40045b3cea 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c @@ -562,7 +562,7 @@ static int qlcnic_sriov_setup_vf(struct qlcnic_adapter *adapter, INIT_LIST_HEAD(&adapter->vf_mc_list); if (!qlcnic_use_msi_x && !!qlcnic_use_msi) dev_warn(&adapter->pdev->dev, - "83xx adapter do not support MSI interrupts\n"); + "Device does not support MSI interrupts\n"); err = qlcnic_setup_intr(adapter, 1); if (err) { From 2e3ea7e763f2ce33bbede1cd5cb8d4cd60f3e11a Mon Sep 17 00:00:00 2001 From: Shahed Shaikh <shahed.shaikh@qlogic.com> Date: Fri, 2 Aug 2013 23:15:58 -0400 Subject: [PATCH 814/913] qlcnic: Fix external loopback test. Driver was not handling external loopback diagnostic test request. Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 05a847e599c6..7a58e390e935 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c @@ -150,6 +150,7 @@ static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = { "Link_Test_on_offline", "Interrupt_Test_offline", "Internal_Loopback_offline", + "External_Loopback_offline", "EEPROM_Test_offline" }; @@ -1026,8 +1027,15 @@ qlcnic_diag_test(struct net_device *dev, struct ethtool_test *eth_test, if (data[3]) eth_test->flags |= ETH_TEST_FL_FAILED; - data[4] = qlcnic_eeprom_test(dev); - if (data[4]) + if (eth_test->flags & ETH_TEST_FL_EXTERNAL_LB) { + data[4] = qlcnic_loopback_test(dev, QLCNIC_ELB_MODE); + if (data[4]) + eth_test->flags |= ETH_TEST_FL_FAILED; + eth_test->flags |= ETH_TEST_FL_EXTERNAL_LB_DONE; + } + + data[5] = qlcnic_eeprom_test(dev); + if (data[5]) eth_test->flags |= ETH_TEST_FL_FAILED; } } From beb3d3a4d4830b1e090eedef0d0d7870639f09e0 Mon Sep 17 00:00:00 2001 From: Rajesh Borundia <rajesh.borundia@qlogic.com> Date: Fri, 2 Aug 2013 23:15:59 -0400 Subject: [PATCH 815/913] qlcnic: Fix link speed display for 82xx adapter o Do not obtain link speed from register when adapter link is down. Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com> Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 7a58e390e935..ac42cde47888 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c @@ -301,9 +301,13 @@ int qlcnic_82xx_get_settings(struct qlcnic_adapter *adapter, } if (netif_running(adapter->netdev) && ahw->has_link_events) { - reg = QLCRD32(adapter, P3P_LINK_SPEED_REG(pcifn)); - speed = P3P_LINK_SPEED_VAL(pcifn, reg); - ahw->link_speed = speed * P3P_LINK_SPEED_MHZ; + if (ahw->linkup) { + reg = QLCRD32(adapter, + P3P_LINK_SPEED_REG(pcifn)); + speed = P3P_LINK_SPEED_VAL(pcifn, reg); + ahw->link_speed = speed * P3P_LINK_SPEED_MHZ; + } + ethtool_cmd_speed_set(ecmd, ahw->link_speed); ecmd->autoneg = ahw->link_autoneg; ecmd->duplex = ahw->link_duplex; From b1f5037f1b33a15fa2ad5c9c41837477465af063 Mon Sep 17 00:00:00 2001 From: Rajesh Borundia <rajesh.borundia@qlogic.com> Date: Fri, 2 Aug 2013 23:16:00 -0400 Subject: [PATCH 816/913] qlcnic: Fix link speed and duplex display for 83xx adapter o Set link speed and duplex to unknown when link is not up. Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com> Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- .../ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index bc483e1881a3..94ff7a43b679 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c @@ -2075,18 +2075,25 @@ void qlcnic_83xx_config_intr_coal(struct qlcnic_adapter *adapter) static void qlcnic_83xx_handle_link_aen(struct qlcnic_adapter *adapter, u32 data[]) { + struct qlcnic_hardware_context *ahw = adapter->ahw; u8 link_status, duplex; /* link speed */ link_status = LSB(data[3]) & 1; - adapter->ahw->link_speed = MSW(data[2]); - adapter->ahw->link_autoneg = MSB(MSW(data[3])); - adapter->ahw->module_type = MSB(LSW(data[3])); - duplex = LSB(MSW(data[3])); - if (duplex) - adapter->ahw->link_duplex = DUPLEX_FULL; - else - adapter->ahw->link_duplex = DUPLEX_HALF; - adapter->ahw->has_link_events = 1; + if (link_status) { + ahw->link_speed = MSW(data[2]); + duplex = LSB(MSW(data[3])); + if (duplex) + ahw->link_duplex = DUPLEX_FULL; + else + ahw->link_duplex = DUPLEX_HALF; + } else { + ahw->link_speed = SPEED_UNKNOWN; + ahw->link_duplex = DUPLEX_UNKNOWN; + } + + ahw->link_autoneg = MSB(MSW(data[3])); + ahw->module_type = MSB(LSW(data[3])); + ahw->has_link_events = 1; qlcnic_advert_link_change(adapter, link_status); } From 4bd8e7385961932d863ea976a67f384c3a8302cb Mon Sep 17 00:00:00 2001 From: Himanshu Madhani <himanshu.madhani@qlogic.com> Date: Fri, 2 Aug 2013 23:16:01 -0400 Subject: [PATCH 817/913] qlcnic: Fix for flash update failure on 83xx adapter Flash update routine was improperly checking register read API return value. Modify register read API and perform proper error check. Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 12 +-- .../ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 101 +++++++++++------- .../ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | 2 +- .../ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | 91 ++++++++++------ .../net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 10 +- .../ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 63 ++++++++--- .../net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 40 ++++--- .../net/ethernet/qlogic/qlcnic/qlcnic_hw.h | 2 +- .../net/ethernet/qlogic/qlcnic/qlcnic_init.c | 25 +++-- .../net/ethernet/qlogic/qlcnic/qlcnic_main.c | 17 +-- 10 files changed, 231 insertions(+), 132 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index f4bb8f5d7453..221645e9f182 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h @@ -1400,8 +1400,8 @@ void qlcnic_pci_camqm_write_2M(struct qlcnic_adapter *, u64, u64); #define ADDR_IN_RANGE(addr, low, high) \ (((addr) < (high)) && ((addr) >= (low))) -#define QLCRD32(adapter, off) \ - (adapter->ahw->hw_ops->read_reg)(adapter, off) +#define QLCRD32(adapter, off, err) \ + (adapter->ahw->hw_ops->read_reg)(adapter, off, err) #define QLCWR32(adapter, off, val) \ adapter->ahw->hw_ops->write_reg(adapter, off, val) @@ -1604,7 +1604,7 @@ struct qlcnic_nic_template { struct qlcnic_hardware_ops { void (*read_crb) (struct qlcnic_adapter *, char *, loff_t, size_t); void (*write_crb) (struct qlcnic_adapter *, char *, loff_t, size_t); - int (*read_reg) (struct qlcnic_adapter *, ulong); + int (*read_reg) (struct qlcnic_adapter *, ulong, int *); int (*write_reg) (struct qlcnic_adapter *, ulong, u32); void (*get_ocm_win) (struct qlcnic_hardware_context *); int (*get_mac_address) (struct qlcnic_adapter *, u8 *); @@ -1662,12 +1662,6 @@ static inline void qlcnic_write_crb(struct qlcnic_adapter *adapter, char *buf, adapter->ahw->hw_ops->write_crb(adapter, buf, offset, size); } -static inline int qlcnic_hw_read_wx_2M(struct qlcnic_adapter *adapter, - ulong off) -{ - return adapter->ahw->hw_ops->read_reg(adapter, off); -} - static inline int qlcnic_hw_write_wx_2M(struct qlcnic_adapter *adapter, ulong off, u32 data) { diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index 94ff7a43b679..92da9980a0a0 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c @@ -228,17 +228,17 @@ static int __qlcnic_set_win_base(struct qlcnic_adapter *adapter, u32 addr) return 0; } -int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *adapter, ulong addr) +int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *adapter, ulong addr, + int *err) { - int ret; struct qlcnic_hardware_context *ahw = adapter->ahw; - ret = __qlcnic_set_win_base(adapter, (u32) addr); - if (!ret) { + *err = __qlcnic_set_win_base(adapter, (u32) addr); + if (!*err) { return QLCRDX(ahw, QLCNIC_WILDCARD); } else { dev_err(&adapter->pdev->dev, - "%s failed, addr = 0x%x\n", __func__, (int)addr); + "%s failed, addr = 0x%lx\n", __func__, addr); return -EIO; } } @@ -561,7 +561,7 @@ void qlcnic_83xx_cam_unlock(struct qlcnic_adapter *adapter) void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf, loff_t offset, size_t size) { - int ret; + int ret = 0; u32 data; if (qlcnic_api_lock(adapter)) { @@ -571,7 +571,7 @@ void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf, return; } - ret = qlcnic_83xx_rd_reg_indirect(adapter, (u32) offset); + data = QLCRD32(adapter, (u32) offset, &ret); qlcnic_api_unlock(adapter); if (ret == -EIO) { @@ -580,7 +580,6 @@ void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf, __func__, (u32)offset); return; } - data = ret; memcpy(buf, &data, size); } @@ -2391,9 +2390,9 @@ int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr, u8 *p_data, int count) { - int i, ret; - u32 word, range, flash_offset, addr = flash_addr; + u32 word, range, flash_offset, addr = flash_addr, ret; ulong indirect_add, direct_window; + int i, err = 0; flash_offset = addr & (QLCNIC_FLASH_SECTOR_SIZE - 1); if (addr & 0x3) { @@ -2411,10 +2410,9 @@ int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *adapter, /* Multi sector read */ for (i = 0; i < count; i++) { indirect_add = QLC_83XX_FLASH_DIRECT_DATA(addr); - ret = qlcnic_83xx_rd_reg_indirect(adapter, - indirect_add); - if (ret == -EIO) - return -EIO; + ret = QLCRD32(adapter, indirect_add, &err); + if (err == -EIO) + return err; word = ret; *(u32 *)p_data = word; @@ -2435,10 +2433,9 @@ int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *adapter, /* Single sector read */ for (i = 0; i < count; i++) { indirect_add = QLC_83XX_FLASH_DIRECT_DATA(addr); - ret = qlcnic_83xx_rd_reg_indirect(adapter, - indirect_add); - if (ret == -EIO) - return -EIO; + ret = QLCRD32(adapter, indirect_add, &err); + if (err == -EIO) + return err; word = ret; *(u32 *)p_data = word; @@ -2454,10 +2451,13 @@ static int qlcnic_83xx_poll_flash_status_reg(struct qlcnic_adapter *adapter) { u32 status; int retries = QLC_83XX_FLASH_READ_RETRY_COUNT; + int err = 0; do { - status = qlcnic_83xx_rd_reg_indirect(adapter, - QLC_83XX_FLASH_STATUS); + status = QLCRD32(adapter, QLC_83XX_FLASH_STATUS, &err); + if (err == -EIO) + return err; + if ((status & QLC_83XX_FLASH_STATUS_READY) == QLC_83XX_FLASH_STATUS_READY) break; @@ -2509,7 +2509,8 @@ int qlcnic_83xx_disable_flash_write(struct qlcnic_adapter *adapter) int qlcnic_83xx_read_flash_mfg_id(struct qlcnic_adapter *adapter) { - int ret, mfg_id; + int ret, err = 0; + u32 mfg_id; if (qlcnic_83xx_lock_flash(adapter)) return -EIO; @@ -2524,9 +2525,11 @@ int qlcnic_83xx_read_flash_mfg_id(struct qlcnic_adapter *adapter) return -EIO; } - mfg_id = qlcnic_83xx_rd_reg_indirect(adapter, QLC_83XX_FLASH_RDDATA); - if (mfg_id == -EIO) - return -EIO; + mfg_id = QLCRD32(adapter, QLC_83XX_FLASH_RDDATA, &err); + if (err == -EIO) { + qlcnic_83xx_unlock_flash(adapter); + return err; + } adapter->flash_mfg_id = (mfg_id & 0xFF); qlcnic_83xx_unlock_flash(adapter); @@ -2643,7 +2646,7 @@ int qlcnic_83xx_flash_bulk_write(struct qlcnic_adapter *adapter, u32 addr, u32 *p_data, int count) { u32 temp; - int ret = -EIO; + int ret = -EIO, err = 0; if ((count < QLC_83XX_FLASH_WRITE_MIN) || (count > QLC_83XX_FLASH_WRITE_MAX)) { @@ -2652,8 +2655,10 @@ int qlcnic_83xx_flash_bulk_write(struct qlcnic_adapter *adapter, u32 addr, return -EIO; } - temp = qlcnic_83xx_rd_reg_indirect(adapter, - QLC_83XX_FLASH_SPI_CONTROL); + temp = QLCRD32(adapter, QLC_83XX_FLASH_SPI_CONTROL, &err); + if (err == -EIO) + return err; + qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_SPI_CONTROL, (temp | QLC_83XX_FLASH_SPI_CTRL)); qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, @@ -2702,13 +2707,18 @@ int qlcnic_83xx_flash_bulk_write(struct qlcnic_adapter *adapter, u32 addr, return -EIO; } - ret = qlcnic_83xx_rd_reg_indirect(adapter, QLC_83XX_FLASH_SPI_STATUS); + ret = QLCRD32(adapter, QLC_83XX_FLASH_SPI_STATUS, &err); + if (err == -EIO) + return err; + if ((ret & QLC_83XX_FLASH_SPI_CTRL) == QLC_83XX_FLASH_SPI_CTRL) { dev_err(&adapter->pdev->dev, "%s: failed at %d\n", __func__, __LINE__); /* Operation failed, clear error bit */ - temp = qlcnic_83xx_rd_reg_indirect(adapter, - QLC_83XX_FLASH_SPI_CONTROL); + temp = QLCRD32(adapter, QLC_83XX_FLASH_SPI_CONTROL, &err); + if (err == -EIO) + return err; + qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_SPI_CONTROL, (temp | QLC_83XX_FLASH_SPI_CTRL)); @@ -2830,6 +2840,7 @@ int qlcnic_83xx_ms_mem_write128(struct qlcnic_adapter *adapter, u64 addr, { int i, j, ret = 0; u32 temp; + int err = 0; /* Check alignment */ if (addr & 0xF) @@ -2862,8 +2873,12 @@ int qlcnic_83xx_ms_mem_write128(struct qlcnic_adapter *adapter, u64 addr, QLCNIC_TA_WRITE_START); for (j = 0; j < MAX_CTL_CHECK; j++) { - temp = qlcnic_83xx_rd_reg_indirect(adapter, - QLCNIC_MS_CTRL); + temp = QLCRD32(adapter, QLCNIC_MS_CTRL, &err); + if (err == -EIO) { + mutex_unlock(&adapter->ahw->mem_lock); + return err; + } + if ((temp & TA_CTL_BUSY) == 0) break; } @@ -2885,9 +2900,9 @@ int qlcnic_83xx_ms_mem_write128(struct qlcnic_adapter *adapter, u64 addr, int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr, u8 *p_data, int count) { - int i, ret; - u32 word, addr = flash_addr; + u32 word, addr = flash_addr, ret; ulong indirect_addr; + int i, err = 0; if (qlcnic_83xx_lock_flash(adapter) != 0) return -EIO; @@ -2907,10 +2922,10 @@ int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr, } indirect_addr = QLC_83XX_FLASH_DIRECT_DATA(addr); - ret = qlcnic_83xx_rd_reg_indirect(adapter, - indirect_addr); - if (ret == -EIO) - return -EIO; + ret = QLCRD32(adapter, indirect_addr, &err); + if (err == -EIO) + return err; + word = ret; *(u32 *)p_data = word; p_data = p_data + 4; @@ -3376,7 +3391,8 @@ int qlcnic_83xx_set_pauseparam(struct qlcnic_adapter *adapter, static int qlcnic_83xx_read_flash_status_reg(struct qlcnic_adapter *adapter) { - int ret; + int ret, err = 0; + u32 temp; qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, QLC_83XX_FLASH_OEM_READ_SIG); @@ -3386,8 +3402,11 @@ static int qlcnic_83xx_read_flash_status_reg(struct qlcnic_adapter *adapter) if (ret) return -EIO; - ret = qlcnic_83xx_rd_reg_indirect(adapter, QLC_83XX_FLASH_RDDATA); - return ret & 0xFF; + temp = QLCRD32(adapter, QLC_83XX_FLASH_RDDATA, &err); + if (err == -EIO) + return err; + + return temp & 0xFF; } int qlcnic_83xx_flash_test(struct qlcnic_adapter *adapter) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h index 2548d1403d75..272f56a2e14b 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h @@ -508,7 +508,7 @@ void qlcnic_83xx_add_sysfs(struct qlcnic_adapter *); void qlcnic_83xx_remove_sysfs(struct qlcnic_adapter *); void qlcnic_83xx_write_crb(struct qlcnic_adapter *, char *, loff_t, size_t); void qlcnic_83xx_read_crb(struct qlcnic_adapter *, char *, loff_t, size_t); -int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *, ulong); +int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *, ulong, int *); int qlcnic_83xx_wrt_reg_indirect(struct qlcnic_adapter *, ulong, u32); void qlcnic_83xx_process_rcv_diag(struct qlcnic_adapter *, int, u64 []); int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *, u32); diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index 51ab4b56fc91..9f4b8d5f0865 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c @@ -1303,8 +1303,11 @@ static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) { int i, j; u32 val = 0, val1 = 0, reg = 0; + int err = 0; - val = QLCRD32(adapter, QLC_83XX_SRE_SHIM_REG); + val = QLCRD32(adapter, QLC_83XX_SRE_SHIM_REG, &err); + if (err == -EIO) + return; dev_info(&adapter->pdev->dev, "SRE-Shim Ctrl:0x%x\n", val); for (j = 0; j < 2; j++) { @@ -1318,7 +1321,9 @@ static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) reg = QLC_83XX_PORT1_THRESHOLD; } for (i = 0; i < 8; i++) { - val = QLCRD32(adapter, reg + (i * 0x4)); + val = QLCRD32(adapter, reg + (i * 0x4), &err); + if (err == -EIO) + return; dev_info(&adapter->pdev->dev, "0x%x ", val); } dev_info(&adapter->pdev->dev, "\n"); @@ -1335,8 +1340,10 @@ static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) reg = QLC_83XX_PORT1_TC_MC_REG; } for (i = 0; i < 4; i++) { - val = QLCRD32(adapter, reg + (i * 0x4)); - dev_info(&adapter->pdev->dev, "0x%x ", val); + val = QLCRD32(adapter, reg + (i * 0x4), &err); + if (err == -EIO) + return; + dev_info(&adapter->pdev->dev, "0x%x ", val); } dev_info(&adapter->pdev->dev, "\n"); } @@ -1352,17 +1359,25 @@ static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) reg = QLC_83XX_PORT1_TC_STATS; } for (i = 7; i >= 0; i--) { - val = QLCRD32(adapter, reg); + val = QLCRD32(adapter, reg, &err); + if (err == -EIO) + return; val &= ~(0x7 << 29); /* Reset bits 29 to 31 */ QLCWR32(adapter, reg, (val | (i << 29))); - val = QLCRD32(adapter, reg); + val = QLCRD32(adapter, reg, &err); + if (err == -EIO) + return; dev_info(&adapter->pdev->dev, "0x%x ", val); } dev_info(&adapter->pdev->dev, "\n"); } - val = QLCRD32(adapter, QLC_83XX_PORT2_IFB_THRESHOLD); - val1 = QLCRD32(adapter, QLC_83XX_PORT3_IFB_THRESHOLD); + val = QLCRD32(adapter, QLC_83XX_PORT2_IFB_THRESHOLD, &err); + if (err == -EIO) + return; + val1 = QLCRD32(adapter, QLC_83XX_PORT3_IFB_THRESHOLD, &err); + if (err == -EIO) + return; dev_info(&adapter->pdev->dev, "IFB-Pause Thresholds: Port 2:0x%x, Port 3:0x%x\n", val, val1); @@ -1425,7 +1440,7 @@ static void qlcnic_83xx_take_eport_out_of_reset(struct qlcnic_adapter *adapter) static int qlcnic_83xx_check_heartbeat(struct qlcnic_adapter *p_dev) { u32 heartbeat, peg_status; - int retries, ret = -EIO; + int retries, ret = -EIO, err = 0; retries = QLCNIC_HEARTBEAT_CHECK_RETRY_COUNT; p_dev->heartbeat = QLC_SHARED_REG_RD32(p_dev, @@ -1453,11 +1468,11 @@ static int qlcnic_83xx_check_heartbeat(struct qlcnic_adapter *p_dev) "PEG_NET_2_PC: 0x%x, PEG_NET_3_PC: 0x%x,\n" "PEG_NET_4_PC: 0x%x\n", peg_status, QLC_SHARED_REG_RD32(p_dev, QLCNIC_PEG_HALT_STATUS2), - QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_0), - QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_1), - QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_2), - QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_3), - QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_4)); + QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_0, &err), + QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_1, &err), + QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_2, &err), + QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_3, &err), + QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_4, &err)); if (QLCNIC_FWERROR_CODE(peg_status) == 0x67) dev_err(&p_dev->pdev->dev, @@ -1501,18 +1516,22 @@ int qlcnic_83xx_check_hw_status(struct qlcnic_adapter *p_dev) static int qlcnic_83xx_poll_reg(struct qlcnic_adapter *p_dev, u32 addr, int duration, u32 mask, u32 status) { + int timeout_error, err = 0; u32 value; - int timeout_error; u8 retries; - value = qlcnic_83xx_rd_reg_indirect(p_dev, addr); + value = QLCRD32(p_dev, addr, &err); + if (err == -EIO) + return err; retries = duration / 10; do { if ((value & mask) != status) { timeout_error = 1; msleep(duration / 10); - value = qlcnic_83xx_rd_reg_indirect(p_dev, addr); + value = QLCRD32(p_dev, addr, &err); + if (err == -EIO) + return err; } else { timeout_error = 0; break; @@ -1606,9 +1625,12 @@ int qlcnic_83xx_get_reset_instruction_template(struct qlcnic_adapter *p_dev) static void qlcnic_83xx_read_write_crb_reg(struct qlcnic_adapter *p_dev, u32 raddr, u32 waddr) { - int value; + int err = 0; + u32 value; - value = qlcnic_83xx_rd_reg_indirect(p_dev, raddr); + value = QLCRD32(p_dev, raddr, &err); + if (err == -EIO) + return; qlcnic_83xx_wrt_reg_indirect(p_dev, waddr, value); } @@ -1617,12 +1639,16 @@ static void qlcnic_83xx_rmw_crb_reg(struct qlcnic_adapter *p_dev, u32 raddr, u32 waddr, struct qlc_83xx_rmw *p_rmw_hdr) { - int value; + int err = 0; + u32 value; - if (p_rmw_hdr->index_a) + if (p_rmw_hdr->index_a) { value = p_dev->ahw->reset.array[p_rmw_hdr->index_a]; - else - value = qlcnic_83xx_rd_reg_indirect(p_dev, raddr); + } else { + value = QLCRD32(p_dev, raddr, &err); + if (err == -EIO) + return; + } value &= p_rmw_hdr->mask; value <<= p_rmw_hdr->shl; @@ -1675,7 +1701,7 @@ static void qlcnic_83xx_poll_list(struct qlcnic_adapter *p_dev, long delay; struct qlc_83xx_entry *entry; struct qlc_83xx_poll *poll; - int i; + int i, err = 0; unsigned long arg1, arg2; poll = (struct qlc_83xx_poll *)((char *)p_hdr + @@ -1699,10 +1725,12 @@ static void qlcnic_83xx_poll_list(struct qlcnic_adapter *p_dev, arg1, delay, poll->mask, poll->status)){ - qlcnic_83xx_rd_reg_indirect(p_dev, - arg1); - qlcnic_83xx_rd_reg_indirect(p_dev, - arg2); + QLCRD32(p_dev, arg1, &err); + if (err == -EIO) + return; + QLCRD32(p_dev, arg2, &err); + if (err == -EIO) + return; } } } @@ -1768,7 +1796,7 @@ static void qlcnic_83xx_poll_read_list(struct qlcnic_adapter *p_dev, struct qlc_83xx_entry_hdr *p_hdr) { long delay; - int index, i, j; + int index, i, j, err; struct qlc_83xx_quad_entry *entry; struct qlc_83xx_poll *poll; unsigned long addr; @@ -1788,7 +1816,10 @@ static void qlcnic_83xx_poll_read_list(struct qlcnic_adapter *p_dev, poll->mask, poll->status)){ index = p_dev->ahw->reset.array_index; addr = entry->dr_addr; - j = qlcnic_83xx_rd_reg_indirect(p_dev, addr); + j = QLCRD32(p_dev, addr, &err); + if (err == -EIO) + return; + p_dev->ahw->reset.array[index++] = j; if (index == QLC_83XX_MAX_RESET_SEQ_ENTRIES) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index 8d401babd491..d09389b33474 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c @@ -104,7 +104,7 @@ static u32 qlcnic_poll_rsp(struct qlcnic_adapter *adapter) { u32 rsp; - int timeout = 0; + int timeout = 0, err = 0; do { /* give atleast 1ms for firmware to respond */ @@ -113,7 +113,7 @@ qlcnic_poll_rsp(struct qlcnic_adapter *adapter) if (++timeout > QLCNIC_OS_CRB_RETRY_COUNT) return QLCNIC_CDRP_RSP_TIMEOUT; - rsp = QLCRD32(adapter, QLCNIC_CDRP_CRB_OFFSET); + rsp = QLCRD32(adapter, QLCNIC_CDRP_CRB_OFFSET, &err); } while (!QLCNIC_CDRP_IS_RSP(rsp)); return rsp; @@ -122,7 +122,7 @@ qlcnic_poll_rsp(struct qlcnic_adapter *adapter) int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) { - int i; + int i, err = 0; u32 rsp; u32 signature; struct pci_dev *pdev = adapter->pdev; @@ -148,7 +148,7 @@ int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, dev_err(&pdev->dev, "card response timeout.\n"); cmd->rsp.arg[0] = QLCNIC_RCODE_TIMEOUT; } else if (rsp == QLCNIC_CDRP_RSP_FAIL) { - cmd->rsp.arg[0] = QLCRD32(adapter, QLCNIC_CDRP_ARG(1)); + cmd->rsp.arg[0] = QLCRD32(adapter, QLCNIC_CDRP_ARG(1), &err); switch (cmd->rsp.arg[0]) { case QLCNIC_RCODE_INVALID_ARGS: fmt = "CDRP invalid args: [%d]\n"; @@ -175,7 +175,7 @@ int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, cmd->rsp.arg[0] = QLCNIC_RCODE_SUCCESS; for (i = 1; i < cmd->rsp.num; i++) - cmd->rsp.arg[i] = QLCRD32(adapter, QLCNIC_CDRP_ARG(i)); + cmd->rsp.arg[i] = QLCRD32(adapter, QLCNIC_CDRP_ARG(i), &err); /* Release semaphore */ qlcnic_api_unlock(adapter); diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index ac42cde47888..7aac23ab31d1 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c @@ -267,7 +267,7 @@ int qlcnic_82xx_get_settings(struct qlcnic_adapter *adapter, { struct qlcnic_hardware_context *ahw = adapter->ahw; u32 speed, reg; - int check_sfp_module = 0; + int check_sfp_module = 0, err = 0; u16 pcifn = ahw->pci_func; /* read which mode */ @@ -290,7 +290,7 @@ int qlcnic_82xx_get_settings(struct qlcnic_adapter *adapter, } else if (adapter->ahw->port_type == QLCNIC_XGBE) { u32 val = 0; - val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR); + val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR, &err); if (val == QLCNIC_PORT_MODE_802_3_AP) { ecmd->supported = SUPPORTED_1000baseT_Full; @@ -303,7 +303,7 @@ int qlcnic_82xx_get_settings(struct qlcnic_adapter *adapter, if (netif_running(adapter->netdev) && ahw->has_link_events) { if (ahw->linkup) { reg = QLCRD32(adapter, - P3P_LINK_SPEED_REG(pcifn)); + P3P_LINK_SPEED_REG(pcifn), &err); speed = P3P_LINK_SPEED_VAL(pcifn, reg); ahw->link_speed = speed * P3P_LINK_SPEED_MHZ; } @@ -468,13 +468,14 @@ static int qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) static int qlcnic_82xx_get_registers(struct qlcnic_adapter *adapter, u32 *regs_buff) { - int i, j = 0; + int i, j = 0, err = 0; for (i = QLCNIC_DEV_INFO_SIZE + 1; diag_registers[j] != -1; j++, i++) regs_buff[i] = QLC_SHARED_REG_RD32(adapter, diag_registers[j]); j = 0; while (ext_diag_registers[j] != -1) - regs_buff[i++] = QLCRD32(adapter, ext_diag_registers[j++]); + regs_buff[i++] = QLCRD32(adapter, ext_diag_registers[j++], + &err); return i; } @@ -524,13 +525,16 @@ qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) static u32 qlcnic_test_link(struct net_device *dev) { struct qlcnic_adapter *adapter = netdev_priv(dev); + int err = 0; u32 val; if (qlcnic_83xx_check(adapter)) { val = qlcnic_83xx_test_link(adapter); return (val & 1) ? 0 : 1; } - val = QLCRD32(adapter, CRB_XG_STATE_P3P); + val = QLCRD32(adapter, CRB_XG_STATE_P3P, &err); + if (err == -EIO) + return err; val = XG_LINK_STATE_P3P(adapter->ahw->pci_func, val); return (val == XG_LINK_UP_P3P) ? 0 : 1; } @@ -663,6 +667,7 @@ qlcnic_get_pauseparam(struct net_device *netdev, { struct qlcnic_adapter *adapter = netdev_priv(netdev); int port = adapter->ahw->physical_port; + int err = 0; __u32 val; if (qlcnic_83xx_check(adapter)) { @@ -673,9 +678,13 @@ qlcnic_get_pauseparam(struct net_device *netdev, if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) return; /* get flow control settings */ - val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port)); + val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port), &err); + if (err == -EIO) + return; pause->rx_pause = qlcnic_gb_get_rx_flowctl(val); - val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL); + val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL, &err); + if (err == -EIO) + return; switch (port) { case 0: pause->tx_pause = !(qlcnic_gb_get_gb0_mask(val)); @@ -695,7 +704,9 @@ qlcnic_get_pauseparam(struct net_device *netdev, if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) return; pause->rx_pause = 1; - val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL); + val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL, &err); + if (err == -EIO) + return; if (port == 0) pause->tx_pause = !(qlcnic_xg_get_xg0_mask(val)); else @@ -712,6 +723,7 @@ qlcnic_set_pauseparam(struct net_device *netdev, { struct qlcnic_adapter *adapter = netdev_priv(netdev); int port = adapter->ahw->physical_port; + int err = 0; __u32 val; if (qlcnic_83xx_check(adapter)) @@ -722,7 +734,9 @@ qlcnic_set_pauseparam(struct net_device *netdev, if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) return -EIO; /* set flow control */ - val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port)); + val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port), &err); + if (err == -EIO) + return err; if (pause->rx_pause) qlcnic_gb_rx_flowctl(val); @@ -733,7 +747,9 @@ qlcnic_set_pauseparam(struct net_device *netdev, val); QLCWR32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port), val); /* set autoneg */ - val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL); + val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL, &err); + if (err == -EIO) + return err; switch (port) { case 0: if (pause->tx_pause) @@ -769,7 +785,9 @@ qlcnic_set_pauseparam(struct net_device *netdev, if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) return -EIO; - val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL); + val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL, &err); + if (err == -EIO) + return err; if (port == 0) { if (pause->tx_pause) qlcnic_xg_unset_xg0_mask(val); @@ -793,11 +811,14 @@ static int qlcnic_reg_test(struct net_device *dev) { struct qlcnic_adapter *adapter = netdev_priv(dev); u32 data_read; + int err = 0; if (qlcnic_83xx_check(adapter)) return qlcnic_83xx_reg_test(adapter); - data_read = QLCRD32(adapter, QLCNIC_PCIX_PH_REG(0)); + data_read = QLCRD32(adapter, QLCNIC_PCIX_PH_REG(0), &err); + if (err == -EIO) + return err; if ((data_read & 0xffff) != adapter->pdev->vendor) return 1; @@ -1269,17 +1290,20 @@ qlcnic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) { struct qlcnic_adapter *adapter = netdev_priv(dev); u32 wol_cfg; + int err = 0; if (qlcnic_83xx_check(adapter)) return; wol->supported = 0; wol->wolopts = 0; - wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV); + wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV, &err); + if (err == -EIO) + return; if (wol_cfg & (1UL << adapter->portnum)) wol->supported |= WAKE_MAGIC; - wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG); + wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG, &err); if (wol_cfg & (1UL << adapter->portnum)) wol->wolopts |= WAKE_MAGIC; } @@ -1289,17 +1313,22 @@ qlcnic_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) { struct qlcnic_adapter *adapter = netdev_priv(dev); u32 wol_cfg; + int err = 0; if (qlcnic_83xx_check(adapter)) return -EOPNOTSUPP; if (wol->wolopts & ~WAKE_MAGIC) return -EINVAL; - wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV); + wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV, &err); + if (err == -EIO) + return err; if (!(wol_cfg & (1 << adapter->portnum))) return -EOPNOTSUPP; - wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG); + wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG, &err); + if (err == -EIO) + return err; if (wol->wolopts & WAKE_MAGIC) wol_cfg |= 1UL << adapter->portnum; else diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index 4ed7e73d88d3..4d5f59b2d153 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c @@ -317,16 +317,20 @@ static void qlcnic_write_window_reg(u32 addr, void __iomem *bar0, u32 data) int qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg) { - int done = 0, timeout = 0; + int timeout = 0; + int err = 0; + u32 done = 0; while (!done) { - done = QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_LOCK(sem))); + done = QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_LOCK(sem)), + &err); if (done == 1) break; if (++timeout >= QLCNIC_PCIE_SEM_TIMEOUT) { dev_err(&adapter->pdev->dev, "Failed to acquire sem=%d lock; holdby=%d\n", - sem, id_reg ? QLCRD32(adapter, id_reg) : -1); + sem, + id_reg ? QLCRD32(adapter, id_reg, &err) : -1); return -EIO; } msleep(1); @@ -341,19 +345,22 @@ qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg) void qlcnic_pcie_sem_unlock(struct qlcnic_adapter *adapter, int sem) { - QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_UNLOCK(sem))); + int err = 0; + + QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_UNLOCK(sem)), &err); } int qlcnic_ind_rd(struct qlcnic_adapter *adapter, u32 addr) { + int err = 0; u32 data; if (qlcnic_82xx_check(adapter)) qlcnic_read_window_reg(addr, adapter->ahw->pci_base0, &data); else { - data = qlcnic_83xx_rd_reg_indirect(adapter, addr); - if (data == -EIO) - return -EIO; + data = QLCRD32(adapter, addr, &err); + if (err == -EIO) + return err; } return data; } @@ -1159,7 +1166,8 @@ int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *adapter, ulong off, return -EIO; } -int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong off) +int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong off, + int *err) { unsigned long flags; int rv; @@ -1415,7 +1423,7 @@ int qlcnic_pci_mem_read_2M(struct qlcnic_adapter *adapter, u64 off, u64 *data) int qlcnic_82xx_get_board_info(struct qlcnic_adapter *adapter) { - int offset, board_type, magic; + int offset, board_type, magic, err = 0; struct pci_dev *pdev = adapter->pdev; offset = QLCNIC_FW_MAGIC_OFFSET; @@ -1435,7 +1443,9 @@ int qlcnic_82xx_get_board_info(struct qlcnic_adapter *adapter) adapter->ahw->board_type = board_type; if (board_type == QLCNIC_BRDTYPE_P3P_4_GB_MM) { - u32 gpio = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_PAD_GPIO_I); + u32 gpio = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_PAD_GPIO_I, &err); + if (err == -EIO) + return err; if ((gpio & 0x8000) == 0) board_type = QLCNIC_BRDTYPE_P3P_10G_TP; } @@ -1475,10 +1485,13 @@ int qlcnic_wol_supported(struct qlcnic_adapter *adapter) { u32 wol_cfg; + int err = 0; - wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV); + wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV, &err); if (wol_cfg & (1UL << adapter->portnum)) { - wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG); + wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG, &err); + if (err == -EIO) + return err; if (wol_cfg & (1 << adapter->portnum)) return 1; } @@ -1539,6 +1552,7 @@ void qlcnic_82xx_get_func_no(struct qlcnic_adapter *adapter) void qlcnic_82xx_read_crb(struct qlcnic_adapter *adapter, char *buf, loff_t offset, size_t size) { + int err = 0; u32 data; u64 qmdata; @@ -1546,7 +1560,7 @@ void qlcnic_82xx_read_crb(struct qlcnic_adapter *adapter, char *buf, qlcnic_pci_camqm_read_2M(adapter, offset, &qmdata); memcpy(buf, &qmdata, size); } else { - data = QLCRD32(adapter, offset); + data = QLCRD32(adapter, offset, &err); memcpy(buf, &data, size); } } diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h index 2c22504f57aa..4a71b28effcb 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h @@ -154,7 +154,7 @@ struct qlcnic_hardware_context; struct qlcnic_adapter; int qlcnic_82xx_start_firmware(struct qlcnic_adapter *); -int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong); +int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong, int *); int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *, ulong, u32); int qlcnic_82xx_config_hw_lro(struct qlcnic_adapter *adapter, int); int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32); diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c index a2023090e866..974d62607e13 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c @@ -286,10 +286,11 @@ static int qlcnic_wait_rom_done(struct qlcnic_adapter *adapter) { long timeout = 0; long done = 0; + int err = 0; cond_resched(); while (done == 0) { - done = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_STATUS); + done = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_STATUS, &err); done &= 2; if (++timeout >= QLCNIC_MAX_ROM_WAIT_USEC) { dev_err(&adapter->pdev->dev, @@ -304,6 +305,8 @@ static int qlcnic_wait_rom_done(struct qlcnic_adapter *adapter) static int do_rom_fast_read(struct qlcnic_adapter *adapter, u32 addr, u32 *valp) { + int err = 0; + QLCWR32(adapter, QLCNIC_ROMUSB_ROM_ADDRESS, addr); QLCWR32(adapter, QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); QLCWR32(adapter, QLCNIC_ROMUSB_ROM_ABYTE_CNT, 3); @@ -317,7 +320,9 @@ static int do_rom_fast_read(struct qlcnic_adapter *adapter, udelay(10); QLCWR32(adapter, QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); - *valp = QLCRD32(adapter, QLCNIC_ROMUSB_ROM_RDATA); + *valp = QLCRD32(adapter, QLCNIC_ROMUSB_ROM_RDATA, &err); + if (err == -EIO) + return err; return 0; } @@ -369,11 +374,11 @@ int qlcnic_rom_fast_read(struct qlcnic_adapter *adapter, u32 addr, u32 *valp) int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) { - int addr, val; + int addr, err = 0; int i, n, init_delay; struct crb_addr_pair *buf; unsigned offset; - u32 off; + u32 off, val; struct pci_dev *pdev = adapter->pdev; QLC_SHARED_REG_WR32(adapter, QLCNIC_CMDPEG_STATE, 0); @@ -402,7 +407,9 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) QLCWR32(adapter, QLCNIC_CRB_NIU + 0xb0000, 0x00); /* halt sre */ - val = QLCRD32(adapter, QLCNIC_CRB_SRE + 0x1000); + val = QLCRD32(adapter, QLCNIC_CRB_SRE + 0x1000, &err); + if (err == -EIO) + return err; QLCWR32(adapter, QLCNIC_CRB_SRE + 0x1000, val & (~(0x1))); /* halt epg */ @@ -719,10 +726,12 @@ qlcnic_check_flash_fw_ver(struct qlcnic_adapter *adapter) static int qlcnic_has_mn(struct qlcnic_adapter *adapter) { - u32 capability; - capability = 0; + u32 capability = 0; + int err = 0; - capability = QLCRD32(adapter, QLCNIC_PEG_TUNE_CAPABILITY); + capability = QLCRD32(adapter, QLCNIC_PEG_TUNE_CAPABILITY, &err); + if (err == -EIO) + return err; if (capability & QLCNIC_PEG_TUNE_MN_PRESENT) return 1; diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index a849446da7c9..ee013fcc3322 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -977,8 +977,8 @@ qlcnic_check_options(struct qlcnic_adapter *adapter) static int qlcnic_initialize_nic(struct qlcnic_adapter *adapter) { - int err; struct qlcnic_info nic_info; + int err = 0; memset(&nic_info, 0, sizeof(struct qlcnic_info)); err = qlcnic_get_nic_info(adapter, &nic_info, adapter->ahw->pci_func); @@ -993,7 +993,9 @@ qlcnic_initialize_nic(struct qlcnic_adapter *adapter) if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_MORE_CAPS) { u32 temp; - temp = QLCRD32(adapter, CRB_FW_CAPABILITIES_2); + temp = QLCRD32(adapter, CRB_FW_CAPABILITIES_2, &err); + if (err == -EIO) + return err; adapter->ahw->extra_capability[0] = temp; } adapter->ahw->max_mac_filters = nic_info.max_mac_filters; @@ -3095,6 +3097,7 @@ qlcnic_check_health(struct qlcnic_adapter *adapter) { u32 state = 0, heartbeat; u32 peg_status; + int err = 0; if (qlcnic_check_temp(adapter)) goto detach; @@ -3141,11 +3144,11 @@ qlcnic_check_health(struct qlcnic_adapter *adapter) "PEG_NET_4_PC: 0x%x\n", peg_status, QLC_SHARED_REG_RD32(adapter, QLCNIC_PEG_HALT_STATUS2), - QLCRD32(adapter, QLCNIC_CRB_PEG_NET_0 + 0x3c), - QLCRD32(adapter, QLCNIC_CRB_PEG_NET_1 + 0x3c), - QLCRD32(adapter, QLCNIC_CRB_PEG_NET_2 + 0x3c), - QLCRD32(adapter, QLCNIC_CRB_PEG_NET_3 + 0x3c), - QLCRD32(adapter, QLCNIC_CRB_PEG_NET_4 + 0x3c)); + QLCRD32(adapter, QLCNIC_CRB_PEG_NET_0 + 0x3c, &err), + QLCRD32(adapter, QLCNIC_CRB_PEG_NET_1 + 0x3c, &err), + QLCRD32(adapter, QLCNIC_CRB_PEG_NET_2 + 0x3c, &err), + QLCRD32(adapter, QLCNIC_CRB_PEG_NET_3 + 0x3c, &err), + QLCRD32(adapter, QLCNIC_CRB_PEG_NET_4 + 0x3c, &err)); if (QLCNIC_FWERROR_CODE(peg_status) == 0x67) dev_err(&adapter->pdev->dev, "Firmware aborted with error code 0x00006700. " From adfb8e51332153016857194b85309150ac560286 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Thu, 1 Aug 2013 09:03:29 -0400 Subject: [PATCH 818/913] drm/radeon: fix 64 bit divide in SI spm code Forgot to use the appropriate math64 function. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@gmail.com> --- drivers/gpu/drm/radeon/si_dpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 7ad22e87cd62..41825575b403 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -1767,7 +1767,7 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe s64 temperature, t_slope, t_intercept, av, bv, t_ref; s64 tmp; - i_leakage = drm_int2fixp(ileakage) / 100; + i_leakage = div64_s64(drm_int2fixp(ileakage), 100); vddc = div64_s64(drm_int2fixp(v), 1000); temperature = div64_s64(drm_int2fixp(t), 1000); From 387aae6fdd737038e92d7bb40712bdf6dcb11945 Mon Sep 17 00:00:00 2001 From: Hugh Dickins <hughd@google.com> Date: Sun, 4 Aug 2013 11:30:25 -0700 Subject: [PATCH 819/913] tmpfs: fix SEEK_DATA/SEEK_HOLE regression Commit 46a1c2c7ae53 ("vfs: export lseek_execute() to modules") broke the tmpfs SEEK_DATA/SEEK_HOLE implementation, because vfs_setpos() converts the carefully prepared -ENXIO to -EINVAL. Other filesystems avoid it in error cases: do the same in tmpfs. Signed-off-by: Hugh Dickins <hughd@google.com> Cc: Jie Liu <jeff.liu@oracle.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- mm/shmem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index a87990cf9f94..8335dbd3fc35 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1798,7 +1798,8 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence) } } - offset = vfs_setpos(file, offset, MAX_LFS_FILESIZE); + if (offset >= 0) + offset = vfs_setpos(file, offset, MAX_LFS_FILESIZE); mutex_unlock(&inode->i_mutex); return offset; } From 95e8ce69a043bc501b45508cc31f1dc9a3f64d3e Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla <srinivas.kandagatla@st.com> Date: Thu, 1 Aug 2013 13:13:31 +0100 Subject: [PATCH 820/913] ARM: STi: Fix cpu nodes with correct device_type. This patch fixes cpu nodes with device_type = "cpu". This change was not necessary before 3.10-rc7. Without this patch STi SOCs does not boot as SMP. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Signed-off-by: Olof Johansson <olof@lixom.net> --- arch/arm/boot/dts/stih41x.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/stih41x.dtsi b/arch/arm/boot/dts/stih41x.dtsi index 7321403cab8a..f5b9898d9c6e 100644 --- a/arch/arm/boot/dts/stih41x.dtsi +++ b/arch/arm/boot/dts/stih41x.dtsi @@ -6,10 +6,12 @@ #address-cells = <1>; #size-cells = <0>; cpu@0 { + device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0>; }; cpu@1 { + device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <1>; }; From d6f67eb787cd9a5d7af2aaac403ea117578af6c9 Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla <srinivas.kandagatla@st.com> Date: Thu, 1 Aug 2013 13:13:41 +0100 Subject: [PATCH 821/913] ARM: STi: remove sti_secondary_start from INIT section. This patch removes sti_secondary_start from _INIT section, there are 2 reason for this removal. 1. discarding such a small code does not save much, given the RAM sizes. 2. Having this code discarded, creates corruption issue when we boot smp-kernel with nrcpus=1 or with single cpu node in DT. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Signed-off-by: Olof Johansson <olof@lixom.net> --- arch/arm/mach-sti/headsmp.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm/mach-sti/headsmp.S b/arch/arm/mach-sti/headsmp.S index 78ebc7559f53..4c09bae86edf 100644 --- a/arch/arm/mach-sti/headsmp.S +++ b/arch/arm/mach-sti/headsmp.S @@ -16,8 +16,6 @@ #include <linux/linkage.h> #include <linux/init.h> - __INIT - /* * ST specific entry point for secondary CPUs. This provides * a "holding pen" into which all secondary cores are held until we're From c095ba7224d8edc71dcef0d655911399a8bd4a3f Mon Sep 17 00:00:00 2001 From: Linus Torvalds <torvalds@linux-foundation.org> Date: Sun, 4 Aug 2013 13:46:46 -0700 Subject: [PATCH 822/913] Linux 3.11-rc4 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 95a8e55feceb..f93d4f7a90c2 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 11 SUBLEVEL = 0 -EXTRAVERSION = -rc3 +EXTRAVERSION = -rc4 NAME = Linux for Workgroups # *DOCUMENTATION* From a1632ad35c37a8bd7bd22dd601906bfef90ad3a6 Mon Sep 17 00:00:00 2001 From: Lucas Stach <dev@lynxeye.de> Date: Tue, 23 Jul 2013 11:11:45 -0700 Subject: [PATCH 823/913] ARM: tegra: enable ULPI phy on Colibri T20 This was missed when splitting out the phy from the controller node in commit 9dffe3be3f32 (ARM: tegra: modify ULPI reset GPIO properties). Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Olof Johansson <olof@lixom.net> --- arch/arm/boot/dts/tegra20-colibri-512.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/tegra20-colibri-512.dtsi b/arch/arm/boot/dts/tegra20-colibri-512.dtsi index 2fcb3f2ca160..5592be6f2f7a 100644 --- a/arch/arm/boot/dts/tegra20-colibri-512.dtsi +++ b/arch/arm/boot/dts/tegra20-colibri-512.dtsi @@ -457,6 +457,7 @@ }; usb-phy@c5004000 { + status = "okay"; nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1) GPIO_ACTIVE_LOW>; }; From b3b301c5fed8a0868e56c98b922cb0c881b3857d Mon Sep 17 00:00:00 2001 From: Felipe Contreras <felipe.contreras@gmail.com> Date: Sat, 3 Aug 2013 23:00:25 +0200 Subject: [PATCH 824/913] ACPI / video: improve quirk check in acpi_video_bqc_quirk() If the _BCL package ordering is descending, the first level (br->levels[2]) is likely to be 0, and if the number of levels matches the number of steps, we might confuse a returned level to mean the index. For example: current_level = max_level = 100 test_level = 0 returned level = 100 In this case 100 means the level, not the index, and _BCM failed. Still, if the _BCL package ordering is descending, the index of level 0 is also 100, so we assume _BQC is indexed, when it's not. This causes all _BQC calls to return bogus values causing weird behavior from the user's perspective. For example: xbacklight -set 10; xbacklight -set 20; would flash to 90% and then slowly down to the desired level (20). The solution is simple; test anything other than the first level (e.g. 1). [rjw: Changelog] Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 0ec434d2586d..e1284b8dc6ee 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -689,7 +689,7 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device, * Some systems always report current brightness level as maximum * through _BQC, we need to test another value for them. */ - test_level = current_level == max_level ? br->levels[2] : max_level; + test_level = current_level == max_level ? br->levels[3] : max_level; result = acpi_video_device_lcd_set_level(device, test_level); if (result) From 444ce9d44d00969479aa1d2675f305a779369194 Mon Sep 17 00:00:00 2001 From: Joe Perches <joe@perches.com> Date: Thu, 1 Aug 2013 21:03:32 -0700 Subject: [PATCH 825/913] MAINTAINERS: Add separate section for USB NETWORKING DRIVERS There are several drivers in drivers/net/usb/ that do not have specific MAINTAINERS that should have emails forwarded to the linux-usb mailing list. Add a section for those drivers. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index defc05383f83..7078e04ab8c6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8664,6 +8664,11 @@ T: git git://git.alsa-project.org/alsa-kernel.git S: Maintained F: sound/usb/midi.* +USB NETWORKING DRIVERS +L: linux-usb@vger.kernel.org +S: Odd Fixes +F: drivers/net/usb/ + USB OHCI DRIVER M: Alan Stern <stern@rowland.harvard.edu> L: linux-usb@vger.kernel.org From d6e102f498cbcc8dd2e36721a01213f036397112 Mon Sep 17 00:00:00 2001 From: Fabio Estevam <fabio.estevam@freescale.com> Date: Mon, 1 Jul 2013 18:14:21 -0300 Subject: [PATCH 826/913] i2c: i2c-mxs: Use DMA mode even for small transfers Recently we have been seing some reports about PIO mode not working properly. - http://www.spinics.net/lists/linux-i2c/msg11985.html - http://marc.info/?l=linux-i2c&m=137235593101385&w=2 - https://lkml.org/lkml/2013/6/24/430 Let's use DMA mode even for small transfers. Without this patch, i2c reads the incorrect sgtl5000 version on a mx28evk when touchscreen is enabled: [ 5.856270] sgtl5000 0-000a: Device with ID register 0 is not a sgtl5000 [ 9.877307] sgtl5000 0-000a: ASoC: failed to probe CODEC -19 [ 9.883528] mxs-sgtl5000 sound.12: ASoC: failed to instantiate card -19 [ 9.892955] mxs-sgtl5000 sound.12: snd_soc_register_card failed (-19) Cc: <stable@vger.kernel.org> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Marek Vasut <marex@denx.de> [wsa: we have a proper solution for -next, so this non intrusive solution is OK for now] Signed-off-by: Wolfram Sang <wsa@the-dreams.de> --- drivers/i2c/busses/i2c-mxs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index df8ff5aea5b5..e2e9a0dade96 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c @@ -493,7 +493,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, * based on this empirical measurement and a lot of previous frobbing. */ i2c->cmd_err = 0; - if (msg->len < 8) { + if (0) { /* disable PIO mode until a proper fix is made */ ret = mxs_i2c_pio_setup_xfer(adap, msg, flags); if (ret) mxs_i2c_reset(i2c); From 4c715661d9a2ceb12434784f10d252f353251906 Mon Sep 17 00:00:00 2001 From: Michael Brunner <mibru@gmx.de> Date: Fri, 26 Jul 2013 14:04:55 +0200 Subject: [PATCH 827/913] i2c: Fix Kontron PLD prescaler calculation Add some necessary braces that have been removed during driver cleanup. This fixes the I2C prescaler calculation. Signed-off-by: Michael Brunner <michael.brunner@kontron.com> Tested-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> --- drivers/i2c/busses/i2c-kempld.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-kempld.c b/drivers/i2c/busses/i2c-kempld.c index ccec916bc3eb..af8f65fb1c05 100644 --- a/drivers/i2c/busses/i2c-kempld.c +++ b/drivers/i2c/busses/i2c-kempld.c @@ -246,9 +246,9 @@ static void kempld_i2c_device_init(struct kempld_i2c_data *i2c) bus_frequency = KEMPLD_I2C_FREQ_MAX; if (pld->info.spec_major == 1) - prescale = pld->pld_clock / bus_frequency * 5 - 1000; + prescale = pld->pld_clock / (bus_frequency * 5) - 1000; else - prescale = pld->pld_clock / bus_frequency * 4 - 3000; + prescale = pld->pld_clock / (bus_frequency * 4) - 3000; if (prescale < 0) prescale = 0; From 3ac3bcb9625dad4074cb67a8e319ea369d61dcdb Mon Sep 17 00:00:00 2001 From: Markos Chandras <markos.chandras@imgtec.com> Date: Tue, 9 Jul 2013 09:21:35 +0100 Subject: [PATCH 828/913] MIPS: PNX833x: PNX8335_PCI_ETHERNET_INT depends on CONFIG_SOC_PNX8335 The PNX8335_PCI_ETHERNET_INT macro is defined in arch/mips/include/asm/mach-pnx833x/irq-mapping.h only if CONFIG_SOC_PNX8335 is selected. Fixes the following randconfig problem: arch/mips/pnx833x/common/platform.c:210:12: error: 'PNX8335_PIC_ETHERNET_INT' undeclared here (not in a function) Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Acked-by: Steven J. Hill <Steven.Hill@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5585/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/pnx833x/common/platform.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/pnx833x/common/platform.c b/arch/mips/pnx833x/common/platform.c index d22dc0d6f289..2b7e837dc2e2 100644 --- a/arch/mips/pnx833x/common/platform.c +++ b/arch/mips/pnx833x/common/platform.c @@ -206,11 +206,13 @@ static struct resource pnx833x_ethernet_resources[] = { .end = PNX8335_IP3902_PORTS_END, .flags = IORESOURCE_MEM, }, +#ifdef CONFIG_SOC_PNX8335 [1] = { .start = PNX8335_PIC_ETHERNET_INT, .end = PNX8335_PIC_ETHERNET_INT, .flags = IORESOURCE_IRQ, }, +#endif }; static struct platform_device pnx833x_ethernet_device = { From cf5b2d23a75cbb53785d270e76e4911e84797b72 Mon Sep 17 00:00:00 2001 From: Ralf Baechle <ralf@linux-mips.org> Date: Thu, 1 Aug 2013 18:31:05 +0200 Subject: [PATCH 829/913] MIPS: oprofile: Fix BUG due to smp_processor_id() in preemptible code. current_cpu_type() is not preemption-safe. If CONFIG_PREEMPT is enabled then mipsxx_reg_setup() can be called from preemptible state. Added get_cpu()/put_cpu() pair to make it preemption-safe. This was found while testing oprofile with CONFIG_DEBUG_PREEMPT enable. /usr/zntestsuite # opcontrol --init /usr/zntestsuite # opcontrol --setup --event=L2_CACHE_ACCESSES:500 --event=L2_CACHE_MISSES:500 --no-vmlinux /usr/zntestsuite # opcontrol --start Using 2.6+ OProfile kernel interface. BUG: using smp_processor_id() in preemptible [00000000] code: oprofiled/1362 caller is mipsxx_reg_setup+0x11c/0x164 CPU: 0 PID: 1362 Comm: oprofiled Not tainted 3.10.4 #18 Stack : 00000006 70757465 00000000 00000000 00000000 00000000 80b173f6 00000037 80b10000 00000000 80b21614 88f5a220 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 89c49c00 89c49c2c 80721254 807b7927 8012c1d0 80b10000 80721254 00000000 00000552 88f5a220 80b1335c 807b78e6 89c49ba8 ... Call Trace: [<801099a4>] show_stack+0x64/0x7c [<80665520>] dump_stack+0x20/0x2c [<803a2250>] debug_smp_processor_id+0xe0/0xf0 [<8052df24>] mipsxx_reg_setup+0x11c/0x164 [<8052cd70>] op_mips_setup+0x24/0x4c [<80529cfc>] oprofile_setup+0x5c/0x12c [<8052b9f8>] event_buffer_open+0x78/0xf8 [<801c3150>] do_dentry_open.isra.15+0x2b8/0x3b0 [<801c3270>] finish_open+0x28/0x4c [<801d49b8>] do_last.isra.41+0x2cc/0xd00 [<801d54a0>] path_openat+0xb4/0x4c4 [<801d5c44>] do_filp_open+0x3c/0xac [<801c4744>] do_sys_open+0x110/0x1f4 [<8010f47c>] stack_done+0x20/0x44 Bug reported and original patch by Jerin Jacob <jerinjacobk@gmail.com>. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Acked-by: Jerin Jacob <jerinjacobk@gmail.com> --- arch/mips/include/asm/cpu-features.h | 2 ++ arch/mips/oprofile/op_model_mipsxx.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h index 1dc086087a72..fa44f3ec5302 100644 --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h @@ -17,6 +17,8 @@ #define current_cpu_type() current_cpu_data.cputype #endif +#define boot_cpu_type() cpu_data[0].cputype + /* * SMP assumption: Options of CPU 0 are a superset of all processors. * This is true for all known MIPS systems. diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c index e4b1140cdae0..3a2b6e9f25cf 100644 --- a/arch/mips/oprofile/op_model_mipsxx.c +++ b/arch/mips/oprofile/op_model_mipsxx.c @@ -166,7 +166,7 @@ static void mipsxx_reg_setup(struct op_counter_config *ctr) reg.control[i] |= M_PERFCTL_USER; if (ctr[i].exl) reg.control[i] |= M_PERFCTL_EXL; - if (current_cpu_type() == CPU_XLR) + if (boot_cpu_type() == CPU_XLR) reg.control[i] |= M_PERFCTL_COUNT_ALL_THREADS; reg.counter[i] = 0x80000000 - ctr[i].count; } From fcfa66de8a2f0631a65a2cec0f6149dafd36ec81 Mon Sep 17 00:00:00 2001 From: Florian Fainelli <florian@openwrt.org> Date: Mon, 5 Aug 2013 11:50:25 +0100 Subject: [PATCH 830/913] MIPS: BMIPS: fix hardware interrupt routing for boot CPU != 0 The hardware interrupt routing for boot CPU != 0 is wrong because it will route all the hardware interrupts to TP0 which is not the one we booted from. Fix this by properly checking which boot CPU we are booting from and updating the right interrupt mask for the boot CPU. This fixes booting on BCM3368 with bmips_smp_emabled = 0. Signed-off-by: Florian Fainelli <florian@openwrt.org> Cc: linux-mips@linux-mips.org Cc: blogic@openwrt.org Cc: jogo@openwrt.org Cc: cernekee@gmail.com Patchwork: https://patchwork.linux-mips.org/patch/5650/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- arch/mips/kernel/smp-bmips.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index 159abc8842d2..126da74d4c55 100644 --- a/arch/mips/kernel/smp-bmips.c +++ b/arch/mips/kernel/smp-bmips.c @@ -66,6 +66,8 @@ static void __init bmips_smp_setup(void) int i, cpu = 1, boot_cpu = 0; #if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) + int cpu_hw_intr; + /* arbitration priority */ clear_c0_brcm_cmt_ctrl(0x30); @@ -80,8 +82,12 @@ static void __init bmips_smp_setup(void) * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output */ - change_c0_brcm_cmt_intr(0xf8018000, - (0x02 << 27) | (0x03 << 15)); + if (boot_cpu == 0) + cpu_hw_intr = 0x02; + else + cpu_hw_intr = 0x1d; + + change_c0_brcm_cmt_intr(0xf8018000, (cpu_hw_intr << 27) | (0x03 << 15)); /* single core, 2 threads (2 pipelines) */ max_cpus = 2; From 672fe15d091ce76d6fb98e489962e9add7c1ba4c Mon Sep 17 00:00:00 2001 From: Al Viro <viro@zeniv.linux.org.uk> Date: Mon, 5 Aug 2013 17:37:37 +0400 Subject: [PATCH 831/913] reiserfs: fix deadlock in umount Since remove_proc_entry() started to wait for IO in progress (i.e. since 2007 or so), the locking in fs/reiserfs/proc.c became wrong; if procfs read happens between the moment when umount() locks the victim superblock and removal of /proc/fs/reiserfs/<device>/*, we'll get a deadlock - read will wait for s_umount (in sget(), called by r_start()), while umount will wait in remove_proc_entry() for that read to finish, holding s_umount all along. Fortunately, the same change allows a much simpler race avoidance - all we need to do is remove the procfs entries in the very beginning of reiserfs ->kill_sb(); that'll guarantee that pointer to superblock will remain valid for the duration for procfs IO, so we don't need sget() to keep the sucker alive. As the matter of fact, we can get rid of the home-grown iterator completely, and use single_open() instead. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> --- fs/reiserfs/procfs.c | 99 +++++++++----------------------------------- fs/reiserfs/super.c | 3 +- 2 files changed, 20 insertions(+), 82 deletions(-) diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index 33532f79b4f7..a958444a75fc 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c @@ -19,12 +19,13 @@ /* * LOCKING: * - * We rely on new Alexander Viro's super-block locking. + * These guys are evicted from procfs as the very first step in ->kill_sb(). * */ -static int show_version(struct seq_file *m, struct super_block *sb) +static int show_version(struct seq_file *m, void *unused) { + struct super_block *sb = m->private; char *format; if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6)) { @@ -66,8 +67,9 @@ static int show_version(struct seq_file *m, struct super_block *sb) #define DJP( x ) le32_to_cpu( jp -> x ) #define JF( x ) ( r -> s_journal -> x ) -static int show_super(struct seq_file *m, struct super_block *sb) +static int show_super(struct seq_file *m, void *unused) { + struct super_block *sb = m->private; struct reiserfs_sb_info *r = REISERFS_SB(sb); seq_printf(m, "state: \t%s\n" @@ -128,8 +130,9 @@ static int show_super(struct seq_file *m, struct super_block *sb) return 0; } -static int show_per_level(struct seq_file *m, struct super_block *sb) +static int show_per_level(struct seq_file *m, void *unused) { + struct super_block *sb = m->private; struct reiserfs_sb_info *r = REISERFS_SB(sb); int level; @@ -186,8 +189,9 @@ static int show_per_level(struct seq_file *m, struct super_block *sb) return 0; } -static int show_bitmap(struct seq_file *m, struct super_block *sb) +static int show_bitmap(struct seq_file *m, void *unused) { + struct super_block *sb = m->private; struct reiserfs_sb_info *r = REISERFS_SB(sb); seq_printf(m, "free_block: %lu\n" @@ -218,8 +222,9 @@ static int show_bitmap(struct seq_file *m, struct super_block *sb) return 0; } -static int show_on_disk_super(struct seq_file *m, struct super_block *sb) +static int show_on_disk_super(struct seq_file *m, void *unused) { + struct super_block *sb = m->private; struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); struct reiserfs_super_block *rs = sb_info->s_rs; int hash_code = DFL(s_hash_function_code); @@ -261,8 +266,9 @@ static int show_on_disk_super(struct seq_file *m, struct super_block *sb) return 0; } -static int show_oidmap(struct seq_file *m, struct super_block *sb) +static int show_oidmap(struct seq_file *m, void *unused) { + struct super_block *sb = m->private; struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); struct reiserfs_super_block *rs = sb_info->s_rs; unsigned int mapsize = le16_to_cpu(rs->s_v1.s_oid_cursize); @@ -291,8 +297,9 @@ static int show_oidmap(struct seq_file *m, struct super_block *sb) return 0; } -static int show_journal(struct seq_file *m, struct super_block *sb) +static int show_journal(struct seq_file *m, void *unused) { + struct super_block *sb = m->private; struct reiserfs_sb_info *r = REISERFS_SB(sb); struct reiserfs_super_block *rs = r->s_rs; struct journal_params *jp = &rs->s_v1.s_journal; @@ -383,92 +390,24 @@ static int show_journal(struct seq_file *m, struct super_block *sb) return 0; } -/* iterator */ -static int test_sb(struct super_block *sb, void *data) -{ - return data == sb; -} - -static int set_sb(struct super_block *sb, void *data) -{ - return -ENOENT; -} - -struct reiserfs_seq_private { - struct super_block *sb; - int (*show) (struct seq_file *, struct super_block *); -}; - -static void *r_start(struct seq_file *m, loff_t * pos) -{ - struct reiserfs_seq_private *priv = m->private; - loff_t l = *pos; - - if (l) - return NULL; - - if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, priv->sb))) - return NULL; - - up_write(&priv->sb->s_umount); - return priv->sb; -} - -static void *r_next(struct seq_file *m, void *v, loff_t * pos) -{ - ++*pos; - if (v) - deactivate_super(v); - return NULL; -} - -static void r_stop(struct seq_file *m, void *v) -{ - if (v) - deactivate_super(v); -} - -static int r_show(struct seq_file *m, void *v) -{ - struct reiserfs_seq_private *priv = m->private; - return priv->show(m, v); -} - -static const struct seq_operations r_ops = { - .start = r_start, - .next = r_next, - .stop = r_stop, - .show = r_show, -}; - static int r_open(struct inode *inode, struct file *file) { - struct reiserfs_seq_private *priv; - int ret = seq_open_private(file, &r_ops, - sizeof(struct reiserfs_seq_private)); - - if (!ret) { - struct seq_file *m = file->private_data; - priv = m->private; - priv->sb = proc_get_parent_data(inode); - priv->show = PDE_DATA(inode); - } - return ret; + return single_open(file, PDE_DATA(inode), + proc_get_parent_data(inode)); } static const struct file_operations r_file_operations = { .open = r_open, .read = seq_read, .llseek = seq_lseek, - .release = seq_release_private, - .owner = THIS_MODULE, + .release = single_release, }; static struct proc_dir_entry *proc_info_root = NULL; static const char proc_info_root_name[] = "fs/reiserfs"; static void add_file(struct super_block *sb, char *name, - int (*func) (struct seq_file *, struct super_block *)) + int (*func) (struct seq_file *, void *)) { proc_create_data(name, 0, REISERFS_SB(sb)->procdir, &r_file_operations, func); diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index f8a23c3078f8..e2e202a07b31 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -499,6 +499,7 @@ int remove_save_link(struct inode *inode, int truncate) static void reiserfs_kill_sb(struct super_block *s) { if (REISERFS_SB(s)) { + reiserfs_proc_info_done(s); /* * Force any pending inode evictions to occur now. Any * inodes to be removed that have extended attributes @@ -554,8 +555,6 @@ static void reiserfs_put_super(struct super_block *s) REISERFS_SB(s)->reserved_blocks); } - reiserfs_proc_info_done(s); - reiserfs_write_unlock(s); mutex_destroy(&REISERFS_SB(s)->lock); kfree(s->s_fs_info); From e305f48bc453da773a3601135a2cce40b8e62856 Mon Sep 17 00:00:00 2001 From: Andy Lutomirski <luto@amacapital.net> Date: Thu, 1 Aug 2013 21:07:52 -0700 Subject: [PATCH 832/913] fs: Fix file mode for O_TMPFILE O_TMPFILE, like O_CREAT, should respect the requested mode and should create regular files. This fixes two bugs: O_TMPFILE required privilege (because the mode ended up as 000) and it produced bogus inodes with no type. Signed-off-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> --- fs/open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/open.c b/fs/open.c index d53e29895082..7931f76acc2b 100644 --- a/fs/open.c +++ b/fs/open.c @@ -823,7 +823,7 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o int lookup_flags = 0; int acc_mode; - if (flags & O_CREAT) + if (flags & (O_CREAT | __O_TMPFILE)) op->mode = (mode & S_IALLUGO) | S_IFREG; else op->mode = 0; From bb2314b47996491bbc5add73633905c3120b6268 Mon Sep 17 00:00:00 2001 From: Andy Lutomirski <luto@amacapital.net> Date: Thu, 1 Aug 2013 21:44:31 -0700 Subject: [PATCH 833/913] fs: Allow unprivileged linkat(..., AT_EMPTY_PATH) aka flink Every now and then someone proposes a new flink syscall, and this spawns a long discussion of whether it would be a security problem. I think that this is missing the point: flink is *already* allowed without privilege as long as /proc is mounted -- it's called AT_SYMLINK_FOLLOW. Now that O_TMPFILE is here, the ability to create a file with O_TMPFILE, write it, and link it in is very convenient. The only problem is that it requires that /proc be mounted so that you can do: linkat(AT_FDCWD, "/proc/self/fd/<tmpfd>", dfd, path, AT_SYMLINK_NOFOLLOW) This sucks -- it's much nicer to do: linkat(tmpfd, "", dfd, path, AT_EMPTY_PATH) Let's allow it. If this turns out to be excessively scary, it we could instead require that the inode in question be I_LINKABLE, but this seems pointless given the /proc situation Signed-off-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> --- fs/namei.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 8b61d103a8a7..89a612e392eb 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3671,15 +3671,11 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) return -EINVAL; /* - * To use null names we require CAP_DAC_READ_SEARCH - * This ensures that not everyone will be able to create - * handlink using the passed filedescriptor. + * Using empty names is equivalent to using AT_SYMLINK_FOLLOW + * on /proc/self/fd/<fd>. */ - if (flags & AT_EMPTY_PATH) { - if (!capable(CAP_DAC_READ_SEARCH)) - return -ENOENT; + if (flags & AT_EMPTY_PATH) how = LOOKUP_EMPTY; - } if (flags & AT_SYMLINK_FOLLOW) how |= LOOKUP_FOLLOW; From 3d62c45b38e534262d443b5820fb06a0e6d0d42f Mon Sep 17 00:00:00 2001 From: Zheng Liu <gnehzuil.liu@gmail.com> Date: Thu, 25 Jul 2013 08:13:19 +0800 Subject: [PATCH 834/913] vfs: add missing check for __O_TMPFILE in fcntl_init() As comment in include/uapi/asm-generic/fcntl.h described, when introducing new O_* bits, we need to check its uniqueness in fcntl_init(). But __O_TMPFILE bit is missing. So fix it. Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> --- fs/fcntl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fcntl.c b/fs/fcntl.c index 6599222536eb..65343c3741ff 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -730,14 +730,14 @@ static int __init fcntl_init(void) * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY * is defined as O_NONBLOCK on some platforms and not on others. */ - BUILD_BUG_ON(19 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( + BUILD_BUG_ON(20 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( O_RDONLY | O_WRONLY | O_RDWR | O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC | O_APPEND | /* O_NONBLOCK | */ __O_SYNC | O_DSYNC | FASYNC | O_DIRECT | O_LARGEFILE | O_DIRECTORY | O_NOFOLLOW | O_NOATIME | O_CLOEXEC | - __FMODE_EXEC | O_PATH + __FMODE_EXEC | O_PATH | __O_TMPFILE )); fasync_cache = kmem_cache_create("fasync_cache", From 2d49b5987561e480bdbd8692b27fc5f49a1e2f0b Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen <lars@metafoo.de> Date: Mon, 5 Aug 2013 11:21:29 +0200 Subject: [PATCH 835/913] regmap: cache: Make sure to sync the last register in a block regcache_sync_block_raw_flush() expects the address of the register after last register that needs to be synced as its parameter. But the last call to regcache_sync_block_raw_flush() in regcache_sync_block_raw() passes the address of the last register in the block. This effectively always skips over the last register in a block, even if it needs to be synced. In order to fix it increase the address by one register. The issue was introduced in commit 75a5f89 ("regmap: cache: Write consecutive registers in a single block write"). Cc: stable@vger.kernel.org # 3.10+ Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org> --- drivers/base/regmap/regcache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index e69102696533..3455f833e473 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -719,7 +719,8 @@ static int regcache_sync_block_raw(struct regmap *map, void *block, } } - return regcache_sync_block_raw_flush(map, &data, base, regtmp); + return regcache_sync_block_raw_flush(map, &data, base, regtmp + + map->reg_stride); } int regcache_sync_block(struct regmap *map, void *block, From 9a1b6bf818e74bb7aabaecb59492b739f2f4d742 Mon Sep 17 00:00:00 2001 From: Trond Myklebust <Trond.Myklebust@netapp.com> Date: Mon, 5 Aug 2013 12:06:12 -0400 Subject: [PATCH 836/913] LOCKD: Don't call utsname()->nodename from nlmclnt_setlockargs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Firstly, nlmclnt_setlockargs can be called from a reclaimer thread, in which case we're in entirely the wrong namespace. Secondly, commit 8aac62706adaaf0fab02c4327761561c8bda9448 (move exit_task_namespaces() outside of exit_notify()) now means that exit_task_work() is called after exit_task_namespaces(), which triggers an Oops when we're freeing up the locks. Fix this by ensuring that we initialise the nlm_host's rpc_client at mount time, so that the cl_nodename field is initialised to the value of utsname()->nodename that the net namespace uses. Then replace the lockd callers of utsname()->nodename. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Toralf Förster <toralf.foerster@gmx.de> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Nix <nix@esperi.org.uk> Cc: Jeff Layton <jlayton@redhat.com> Cc: stable@vger.kernel.org # 3.10.x --- fs/lockd/clntlock.c | 13 +++++++++---- fs/lockd/clntproc.c | 5 +++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index 01bfe7662751..41e491b8e5d7 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c @@ -64,12 +64,17 @@ struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init) nlm_init->protocol, nlm_version, nlm_init->hostname, nlm_init->noresvport, nlm_init->net); - if (host == NULL) { - lockd_down(nlm_init->net); - return ERR_PTR(-ENOLCK); - } + if (host == NULL) + goto out_nohost; + if (host->h_rpcclnt == NULL && nlm_bind_host(host) == NULL) + goto out_nobind; return host; +out_nobind: + nlmclnt_release_host(host); +out_nohost: + lockd_down(nlm_init->net); + return ERR_PTR(-ENOLCK); } EXPORT_SYMBOL_GPL(nlmclnt_init); diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 9760ecb9b60f..acd394716349 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c @@ -125,14 +125,15 @@ static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl) { struct nlm_args *argp = &req->a_args; struct nlm_lock *lock = &argp->lock; + char *nodename = req->a_host->h_rpcclnt->cl_nodename; nlmclnt_next_cookie(&argp->cookie); memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh)); - lock->caller = utsname()->nodename; + lock->caller = nodename; lock->oh.data = req->a_owner; lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", (unsigned int)fl->fl_u.nfs_fl.owner->pid, - utsname()->nodename); + nodename); lock->svid = fl->fl_u.nfs_fl.owner->pid; lock->fl.fl_start = fl->fl_start; lock->fl.fl_end = fl->fl_end; From 623cf33cb055b1e81fa47e4fc16789b2c129e31e Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Date: Tue, 6 Aug 2013 02:26:22 +0200 Subject: [PATCH 837/913] ACPI / PM: Walk physical_node_list under physical_node_lock The list of physical devices corresponding to an ACPI device object is walked by acpi_system_wakeup_device_seq_show() and physical_device_enable_wakeup() without taking that object's physical_node_lock mutex. Since each of those functions may be run at any time as a result of a user space action, the lack of appropriate locking in them may lead to a kernel crash if that happens during device hot-add or hot-remove involving the device object in question. Fix the issue by modifying acpi_system_wakeup_device_seq_show() and physical_device_enable_wakeup() to use physical_node_lock as appropriate. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: All <stable@vger.kernel.org> --- drivers/acpi/proc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index aa1227a7e3f2..04a13784dd20 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c @@ -311,6 +311,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) dev->pnp.bus_id, (u32) dev->wakeup.sleep_state); + mutex_lock(&dev->physical_node_lock); + if (!dev->physical_node_count) { seq_printf(seq, "%c%-8s\n", dev->wakeup.flags.run_wake ? '*' : ' ', @@ -338,6 +340,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) put_device(ldev); } } + + mutex_unlock(&dev->physical_node_lock); } mutex_unlock(&acpi_device_lock); return 0; @@ -347,12 +351,16 @@ static void physical_device_enable_wakeup(struct acpi_device *adev) { struct acpi_device_physical_node *entry; + mutex_lock(&adev->physical_node_lock); + list_for_each_entry(entry, &adev->physical_node_list, node) if (entry->dev && device_can_wakeup(entry->dev)) { bool enable = !device_may_wakeup(entry->dev); device_set_wakeup_enable(entry->dev, enable); } + + mutex_unlock(&adev->physical_node_lock); } static ssize_t From 00326ed6442c66021cd4b5e19e80f3e2027d5d42 Mon Sep 17 00:00:00 2001 From: Trond Myklebust <Trond.Myklebust@netapp.com> Date: Mon, 5 Aug 2013 14:10:43 -0400 Subject: [PATCH 838/913] SUNRPC: Don't auto-disconnect from the local rpcbind socket There is no need for the kernel to time out the AF_LOCAL connection to the rpcbind socket, and doing so is problematic because when it is time to reconnect, our process may no longer be using the same mount namespace. Reported-by: Nix <nix@esperi.org.uk> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Jeff Layton <jlayton@redhat.com> Cc: stable@vger.kernel.org # 3.9.x --- net/sunrpc/rpcb_clnt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 3df764dc330c..b0f723227157 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c @@ -238,6 +238,14 @@ static int rpcb_create_local_unix(struct net *net) .program = &rpcb_program, .version = RPCBVERS_2, .authflavor = RPC_AUTH_NULL, + /* + * We turn off the idle timeout to prevent the kernel + * from automatically disconnecting the socket. + * Otherwise, we'd have to cache the mount namespace + * of the caller and somehow pass that to the socket + * reconnect code. + */ + .flags = RPC_CLNT_CREATE_NO_IDLE_TIMEOUT, }; struct rpc_clnt *clnt, *clnt4; int result = 0; From 6ea062475a9a2ea6e1394487fa0e51b3459957d1 Mon Sep 17 00:00:00 2001 From: Casey Schaufler <casey@schaufler-ca.com> Date: Mon, 5 Aug 2013 13:21:22 -0700 Subject: [PATCH 839/913] Smack: IPv6 casting error fix for 3.11 The original implementation of the Smack IPv6 port based local controls works most of the time using a sockaddr as a temporary variable, but not always as it overflows in some circumstances. The correct data is a sockaddr_in6. A struct sockaddr isn't as large as a struct sockaddr_in6. There would need to be casting one way or the other. This patch gets it the right way. Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: James Morris <james.l.morris@oracle.com> --- security/smack/smack_lsm.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 3f7682a387b7..eefbd10e408f 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -1998,12 +1998,11 @@ static void smk_ipv6_port_label(struct socket *sock, struct sockaddr *address) * * Create or update the port list entry */ -static int smk_ipv6_port_check(struct sock *sk, struct sockaddr *address, +static int smk_ipv6_port_check(struct sock *sk, struct sockaddr_in6 *address, int act) { __be16 *bep; __be32 *be32p; - struct sockaddr_in6 *addr6; struct smk_port_label *spp; struct socket_smack *ssp = sk->sk_security; struct smack_known *skp; @@ -2025,10 +2024,9 @@ static int smk_ipv6_port_check(struct sock *sk, struct sockaddr *address, /* * Get the IP address and port from the address. */ - addr6 = (struct sockaddr_in6 *)address; - port = ntohs(addr6->sin6_port); - bep = (__be16 *)(&addr6->sin6_addr); - be32p = (__be32 *)(&addr6->sin6_addr); + port = ntohs(address->sin6_port); + bep = (__be16 *)(&address->sin6_addr); + be32p = (__be32 *)(&address->sin6_addr); /* * It's remote, so port lookup does no good. @@ -2060,9 +2058,9 @@ auditout: ad.a.u.net->family = sk->sk_family; ad.a.u.net->dport = port; if (act == SMK_RECEIVING) - ad.a.u.net->v6info.saddr = addr6->sin6_addr; + ad.a.u.net->v6info.saddr = address->sin6_addr; else - ad.a.u.net->v6info.daddr = addr6->sin6_addr; + ad.a.u.net->v6info.daddr = address->sin6_addr; #endif return smk_access(skp, object, MAY_WRITE, &ad); } @@ -2201,7 +2199,8 @@ static int smack_socket_connect(struct socket *sock, struct sockaddr *sap, case PF_INET6: if (addrlen < sizeof(struct sockaddr_in6)) return -EINVAL; - rc = smk_ipv6_port_check(sock->sk, sap, SMK_CONNECTING); + rc = smk_ipv6_port_check(sock->sk, (struct sockaddr_in6 *)sap, + SMK_CONNECTING); break; } return rc; @@ -3034,7 +3033,7 @@ static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size) { struct sockaddr_in *sip = (struct sockaddr_in *) msg->msg_name; - struct sockaddr *sap = (struct sockaddr *) msg->msg_name; + struct sockaddr_in6 *sap = (struct sockaddr_in6 *) msg->msg_name; int rc = 0; /* @@ -3121,9 +3120,8 @@ static struct smack_known *smack_from_secattr(struct netlbl_lsm_secattr *sap, return smack_net_ambient; } -static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr *sap) +static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr_in6 *sip) { - struct sockaddr_in6 *sip = (struct sockaddr_in6 *)sap; u8 nexthdr; int offset; int proto = -EINVAL; @@ -3181,7 +3179,7 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) struct netlbl_lsm_secattr secattr; struct socket_smack *ssp = sk->sk_security; struct smack_known *skp; - struct sockaddr sadd; + struct sockaddr_in6 sadd; int rc = 0; struct smk_audit_info ad; #ifdef CONFIG_AUDIT From 007ccfcf89401e764c33965b739310d86a94626d Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Date: Tue, 6 Aug 2013 14:32:54 +0200 Subject: [PATCH 840/913] ACPI: Drop physical_node_id_bitmap from struct acpi_device The physical_node_id_bitmap in struct acpi_device is only used for looking up the first currently unused dependent phyiscal node ID by acpi_bind_one(). It is not really necessary, however, because acpi_bind_one() walks the entire physical_node_list of the given device object for sanity checking anyway and if that list is always sorted by node_id, it is straightforward to find the first gap between the currently used node IDs and use that number as the ID of the new list node. This also removes the artificial limit of the maximum number of dependent physical devices per ACPI device object, which now depends only on the capacity of unsigend int. As a result, it fixes a regression introduced by commit e2ff394 (ACPI / memhotplug: Bind removable memory blocks to ACPI device nodes) that caused acpi_memory_enable_device() to fail when the number of 128 MB blocks within one removable memory module was greater than 32. Reported-and-tested-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Toshi Kani <toshi.kani@hp.com> Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> --- drivers/acpi/glue.c | 34 +++++++++++++++++++--------------- include/acpi/acpi_bus.h | 8 ++------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index f68095756fb7..17e15d11bd39 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -31,6 +31,7 @@ static LIST_HEAD(bus_type_list); static DECLARE_RWSEM(bus_type_sem); #define PHYSICAL_NODE_STRING "physical_node" +#define PHYSICAL_NODE_NAME_SIZE (sizeof(PHYSICAL_NODE_STRING) + 10) int register_acpi_bus_type(struct acpi_bus_type *type) { @@ -112,7 +113,9 @@ int acpi_bind_one(struct device *dev, acpi_handle handle) struct acpi_device *acpi_dev; acpi_status status; struct acpi_device_physical_node *physical_node, *pn; - char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; + char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; + struct list_head *physnode_list; + unsigned int node_id; int retval = -EINVAL; if (ACPI_HANDLE(dev)) { @@ -139,25 +142,27 @@ int acpi_bind_one(struct device *dev, acpi_handle handle) mutex_lock(&acpi_dev->physical_node_lock); - /* Sanity check. */ - list_for_each_entry(pn, &acpi_dev->physical_node_list, node) + /* + * Keep the list sorted by node_id so that the IDs of removed nodes can + * be recycled easily. + */ + physnode_list = &acpi_dev->physical_node_list; + node_id = 0; + list_for_each_entry(pn, &acpi_dev->physical_node_list, node) { + /* Sanity check. */ if (pn->dev == dev) { dev_warn(dev, "Already associated with ACPI node\n"); goto err_free; } - - /* allocate physical node id according to physical_node_id_bitmap */ - physical_node->node_id = - find_first_zero_bit(acpi_dev->physical_node_id_bitmap, - ACPI_MAX_PHYSICAL_NODE); - if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { - retval = -ENOSPC; - goto err_free; + if (pn->node_id == node_id) { + physnode_list = &pn->node; + node_id++; + } } - set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap); + physical_node->node_id = node_id; physical_node->dev = dev; - list_add_tail(&physical_node->node, &acpi_dev->physical_node_list); + list_add(&physical_node->node, physnode_list); acpi_dev->physical_node_count++; mutex_unlock(&acpi_dev->physical_node_lock); @@ -208,7 +213,7 @@ int acpi_unbind_one(struct device *dev) mutex_lock(&acpi_dev->physical_node_lock); list_for_each_safe(node, next, &acpi_dev->physical_node_list) { - char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; + char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; entry = list_entry(node, struct acpi_device_physical_node, node); @@ -216,7 +221,6 @@ int acpi_unbind_one(struct device *dev) continue; list_del(node); - clear_bit(entry->node_id, acpi_dev->physical_node_id_bitmap); acpi_dev->physical_node_count--; diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 56e6b68c8d2f..5026aaa35133 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -274,15 +274,12 @@ struct acpi_device_wakeup { }; struct acpi_device_physical_node { - u8 node_id; + unsigned int node_id; struct list_head node; struct device *dev; bool put_online:1; }; -/* set maximum of physical nodes to 32 for expansibility */ -#define ACPI_MAX_PHYSICAL_NODE 32 - /* Device */ struct acpi_device { int device_type; @@ -302,10 +299,9 @@ struct acpi_device { struct acpi_driver *driver; void *driver_data; struct device dev; - u8 physical_node_count; + unsigned int physical_node_count; struct list_head physical_node_list; struct mutex physical_node_lock; - DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE); struct list_head power_dependent; void (*remove)(struct acpi_device *); }; From 49ccc142f9cbc33fdda18e8fa90c1c5b4a79c0ad Mon Sep 17 00:00:00 2001 From: Mateusz Krawczuk <m.krawczuk@partner.samsung.com> Date: Tue, 6 Aug 2013 18:34:40 +0200 Subject: [PATCH 841/913] regmap: Add missing header for !CONFIG_REGMAP stubs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit regmap.h requires linux/err.h if CONFIG_REGMAP is not defined. Without it I get error. CC drivers/media/platform/exynos4-is/fimc-reg.o In file included from drivers/media/platform/exynos4-is/fimc-reg.c:14:0: include/linux/regmap.h: In function ‘regmap_write’: include/linux/regmap.h:525:10: error: ‘EINVAL’ undeclared (first use in this function) include/linux/regmap.h:525:10: note: each undeclared identifier is reported only once for each function it appears in Signed-off-by: Mateusz Krawczuk <m.krawczuk@partner.samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@kernel.org --- include/linux/regmap.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 75981d0b57dc..580a5320cc96 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -15,6 +15,7 @@ #include <linux/list.h> #include <linux/rbtree.h> +#include <linux/err.h> struct module; struct device; From 6160968cee8b90a5dd95318d716e31d7775c4ef3 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Tue, 6 Aug 2013 19:38:55 +0200 Subject: [PATCH 842/913] userns: unshare_userns(&cred) should not populate cred on failure unshare_userns(new_cred) does *new_cred = prepare_creds() before create_user_ns() which can fail. However, the caller expects that it doesn't need to take care of new_cred if unshare_userns() fails. We could change the single caller, sys_unshare(), but I think it would be more clean to avoid the side effects on failure, so with this patch unshare_userns() does put_cred() itself and initializes *new_cred only if create_user_ns() succeeeds. Cc: stable@vger.kernel.org Signed-off-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- kernel/user_namespace.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index d8c30db06c5b..6e50a44610ee 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c @@ -105,16 +105,21 @@ int create_user_ns(struct cred *new) int unshare_userns(unsigned long unshare_flags, struct cred **new_cred) { struct cred *cred; + int err = -ENOMEM; if (!(unshare_flags & CLONE_NEWUSER)) return 0; cred = prepare_creds(); - if (!cred) - return -ENOMEM; + if (cred) { + err = create_user_ns(cred); + if (err) + put_cred(cred); + else + *new_cred = cred; + } - *new_cred = cred; - return create_user_ns(cred); + return err; } void free_user_ns(struct user_namespace *ns) From 35114fcbe0b9b0fa3f6653a2a8e4c6b8a9f8cc2d Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Tue, 6 Aug 2013 17:43:37 +0200 Subject: [PATCH 843/913] Revert "ptrace: PTRACE_DETACH should do flush_ptrace_hw_breakpoint(child)" This reverts commit fab840fc2d542fabcab903db8e03589a6702ba5f. This commit even has the test-case to prove that the tracee can be killed by SIGTRAP if the debugger does not remove the breakpoints before PTRACE_DETACH. However, this is exactly what wineserver deliberately does, set_thread_context() calls PTRACE_ATTACH + PTRACE_DETACH just for PTRACE_POKEUSER(DR*) in between. So we should revert this fix and document that PTRACE_DETACH should keep the breakpoints. Reported-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- kernel/ptrace.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 4041f5747e73..a146ee327f6a 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -469,7 +469,6 @@ static int ptrace_detach(struct task_struct *child, unsigned int data) /* Architecture-specific hardware disable .. */ ptrace_disable(child); clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); - flush_ptrace_hw_breakpoint(child); write_lock_irq(&tasklist_lock); /* From 2cfe6c4ac7ee0193780d655c5dea5a73acae1f46 Mon Sep 17 00:00:00 2001 From: Steven Rostedt <rostedt@goodmis.org> Date: Mon, 5 Aug 2013 22:55:28 -0400 Subject: [PATCH 844/913] printk: Fix return of braille_register_console() Some of my configs I test with have CONFIG_A11Y_BRAILLE_CONSOLE set. When I started testing against v3.11-rc4 my console went bonkers. Using ktest to bisect the issue, it came down to: commit bbeddf52a "printk: move braille console support into separate braille.[ch] files" Looking into the patch I found the problem. It's with the return of braille_register_console(). As anything other than NULL is considered a failure. But for those of us that have CONFIG_A11Y_BRAILLE_CONSOLE set but do not define a "brl" or "brl=" on the command line, we still may want a console that those with sight can still use. Return NULL (success) if "brl" or "brl=" is not on the console line. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Joe Perches <joe@perches.com> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- kernel/printk/braille.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/printk/braille.c b/kernel/printk/braille.c index b51087fb9ace..276762f3a460 100644 --- a/kernel/printk/braille.c +++ b/kernel/printk/braille.c @@ -19,7 +19,8 @@ char *_braille_console_setup(char **str, char **brl_options) pr_err("need port name after brl=\n"); else *((*str)++) = 0; - } + } else + return NULL; return *str; } From 109a51598869a39fdcec2d49672a9a39b6d89481 Mon Sep 17 00:00:00 2001 From: Michal Srb <msrb@suse.com> Date: Tue, 6 Aug 2013 15:26:50 +0200 Subject: [PATCH 845/913] drm/cirrus: Invalidate page tables when pinning a BO This is a cirrus version of Egbert Eich's patch for mgag200. Without bo.bdev->dev_mapping set, the ttm_bo_unmap_virtual_locked called from ttm_bo_handle_move_mem returns with no effect. If any application accessed the memory before it was moved, it will access wrong memory next time. This causes crashes when changing resolution down. Signed-off-by: Michal Srb <msrb@suse.com> Cc: stable@vger.kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/cirrus/cirrus_ttm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c index 0047012045c2..69fd8f1ac8df 100644 --- a/drivers/gpu/drm/cirrus/cirrus_ttm.c +++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c @@ -328,6 +328,7 @@ int cirrus_bo_create(struct drm_device *dev, int size, int align, cirrusbo->gem.driver_private = NULL; cirrusbo->bo.bdev = &cirrus->ttm.bdev; + cirrusbo->bo.bdev->dev_mapping = dev->dev_mapping; cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); From ecaac1c866bcda4780a963b3d18cd310d971aea3 Mon Sep 17 00:00:00 2001 From: Egbert Eich <eich@suse.com> Date: Wed, 17 Jul 2013 17:40:56 +0200 Subject: [PATCH 846/913] drm/mgag200: Invalidate page tables when pinning a BO When a BO gets pinned the placement may get changed. If the memory is mapped into user space and user space has already accessed the mapped range the page tables are set up but now point to the wrong memory. Set bo.mdev->dev_mapping in mgag200_bo_create() to make sure that ttm_bo_unmap_virtual() called from ttm_bo_handle_move_mem() will take care of this. v2: Don't call ttm_bo_unmap_virtual() in mgag200_bo_pin(), fix comment. Signed-off-by: Egbert Eich <eich@suse.com> Cc: stable@vger.kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/mgag200/mgag200_ttm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c index 13878d5de063..d70e4a92773b 100644 --- a/drivers/gpu/drm/mgag200/mgag200_ttm.c +++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c @@ -323,6 +323,7 @@ int mgag200_bo_create(struct drm_device *dev, int size, int align, mgabo->gem.driver_private = NULL; mgabo->bo.bdev = &mdev->ttm.bdev; + mgabo->bo.bdev->dev_mapping = dev->dev_mapping; mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); From 3ac65259328324de323dc006b52ff7c1a5b18d19 Mon Sep 17 00:00:00 2001 From: Dave Airlie <airlied@redhat.com> Date: Wed, 7 Aug 2013 10:01:56 +1000 Subject: [PATCH 847/913] drm/ast: invalidate page tables when pinning a BO same fix as cirrus and mgag200. Cc: stable@vger.kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/ast/ast_ttm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c index 98d670825a1a..6e8887fe6c1b 100644 --- a/drivers/gpu/drm/ast/ast_ttm.c +++ b/drivers/gpu/drm/ast/ast_ttm.c @@ -323,6 +323,7 @@ int ast_bo_create(struct drm_device *dev, int size, int align, astbo->gem.driver_private = NULL; astbo->bo.bdev = &ast->ttm.bdev; + astbo->bo.bdev->dev_mapping = dev->dev_mapping; ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); From 0ce99f749b3834edeb500e17d6ad17e86b60ff83 Mon Sep 17 00:00:00 2001 From: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Fri, 26 Jul 2013 11:27:49 +0200 Subject: [PATCH 848/913] drm/i915: fix gen4 digital port hotplug definitions Apparently Bspec is wrong in this case here even for gm45. Note that Bspec is horribly misguided on i965g/gm, so we don't have any other data points besides that it seems to make machines work better. With this changes all the bits in PORT_HOTPLUG_STAT for the digital ports are ordered the same way. This seems to agree with what register dumps from the hpd storm handling code shows, where the LIVE bit and the short/long pulse STATUS bits light up at the same time with this enumeration (but no with the one from Bspec). Also tested on my gm45 which has two DP+ ports, and everything seems to still work as expected. References: http://www.mail-archive.com/intel-gfx@lists.freedesktop.org/msg23054.html Cc: Egbert Eich <eich@suse.com> Cc: Jan Niggemann <jn@hz6.de> Tested-by: Jan Niggemann <jn@hz6.de> [danvet: Add a big warning that Bspec seems to be wrong for these bits, suggested by Jani.] Acked-by: Jani Nikula <jani.nikula@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/i915_reg.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index f2326fc60ac9..6f514297c483 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -1856,10 +1856,16 @@ #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) #define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114) -/* HDMI/DP bits are gen4+ */ -#define PORTB_HOTPLUG_LIVE_STATUS (1 << 29) +/* + * HDMI/DP bits are gen4+ + * + * WARNING: Bspec for hpd status bits on gen4 seems to be completely confused. + * Please check the detailed lore in the commit message for for experimental + * evidence. + */ +#define PORTD_HOTPLUG_LIVE_STATUS (1 << 29) #define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) -#define PORTD_HOTPLUG_LIVE_STATUS (1 << 27) +#define PORTB_HOTPLUG_LIVE_STATUS (1 << 27) #define PORTD_HOTPLUG_INT_STATUS (3 << 21) #define PORTC_HOTPLUG_INT_STATUS (3 << 19) #define PORTB_HOTPLUG_INT_STATUS (3 << 17) From 9dbd8febb4dbc9199fcf340b882eb930e36b65b6 Mon Sep 17 00:00:00 2001 From: Paulo Zanoni <paulo.r.zanoni@intel.com> Date: Tue, 23 Jul 2013 10:48:11 -0300 Subject: [PATCH 849/913] drm/i915: update last_vblank when disabling the power well The DRM layer keeps track of our vblanks and it assumes our vblank counters only go back to zero when they overflow. The problem is that when we disable the power well our counters also go to zero, but it doesn't mean they did overflow. So on this patch we grab the lock and update last_vblank so the DRM layer won't think our counters overflowed. This patch fixes the following intel-gpu-tools test: ./kms_flip --run-subtest blocking-absolute-wf_vblank Regression introduced by the following commit: commit bf51d5e2cda5d36d98e4b46ac7fca9461e512c41 Author: Paulo Zanoni <paulo.r.zanoni@intel.com> Date: Wed Jul 3 17:12:13 2013 -0300 drm/i915: switch disable_power_well default value to 1 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66808 Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> [danvet: Added a comment that this might be better done in drm_vblank_post_modeset in general.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/intel_pm.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index f895d1508df8..b0e4a0bd1313 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5063,8 +5063,26 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable) } } else { if (enable_requested) { + unsigned long irqflags; + enum pipe p; + I915_WRITE(HSW_PWR_WELL_DRIVER, 0); + POSTING_READ(HSW_PWR_WELL_DRIVER); DRM_DEBUG_KMS("Requesting to disable the power well\n"); + + /* + * After this, the registers on the pipes that are part + * of the power well will become zero, so we have to + * adjust our counters according to that. + * + * FIXME: Should we do this in general in + * drm_vblank_post_modeset? + */ + spin_lock_irqsave(&dev->vbl_lock, irqflags); + for_each_pipe(p) + if (p != PIPE_A) + dev->last_vblank[p] = 0; + spin_unlock_irqrestore(&dev->vbl_lock, irqflags); } } } From 22505b82a2800bddb67908522833bef96dd15845 Mon Sep 17 00:00:00 2001 From: Aaron Lu <aaron.lu@intel.com> Date: Fri, 2 Aug 2013 09:16:03 +0800 Subject: [PATCH 850/913] drm/i915: avoid brightness overflow when doing scale Some card's max brightness level is pretty large, e.g. on Acer Aspire 4732Z, the max level is 989910. If user space set a large enough level then the current scale done in intel_panel_set_backlight will cause an integer overflow and the scaled level will be mistakenly small, leaving user with an almost black screen. This patch fixes this problem. Signed-off-by: Aaron Lu <aaron.lu@intel.com> [danvet: Add a comment to explain what's going on.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/intel_panel.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 67e2c1f1c9a8..5063eadac3ef 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -497,8 +497,11 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level, u32 max) goto out; } - /* scale to hardware */ - level = level * freq / max; + /* scale to hardware, but be careful to not overflow */ + if (freq < max) + level = level * freq / max; + else + level = freq / max * level; dev_priv->backlight.level = level; if (dev_priv->backlight.device) From 3eaba51cd399f5362a9fd9ebd5fb8b625b454271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com> Date: Mon, 5 Aug 2013 17:57:48 +0300 Subject: [PATCH 851/913] drm/i915: Don't call encoder's get_config unless encoder is active MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SDVO code tries to compare the encoder's and crtc's idea of the pixel_multiplier. Normally they have to match, but when transitioning to DPMS off, we turn off the pipe before reading out the pipe_config, so the pixel_multiplier in the pipe_config will be 0, whereas the encoder will still have its pixel_multiplier set to whatever value we were using when the display was active. This leads to a warning from intel_modeset_check_state(). WARNING: CPU: 1 PID: 2846 at drivers/gpu/drm/i915/intel_sdvo.c:1378 intel_sdvo_get_config+0x158/0x160() SDVO pixel multiplier mismatch, port: 0, encoder: 1 Modules linked in: snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep CPU: 1 PID: 2846 Comm: Xorg Not tainted 3.11.0-rc3-00208-gbe1e8d7-dirty #19 Hardware name: Apple Computer, Inc. Macmini1,1/Mac-F4208EC8, BIOS MM11.88Z.0055.B03.0604071521 04/07/06 00000000 00000000 ef0afa54 c1597bbb c1737ea4 ef0afa84 c10392ca c1737e6c ef0afab0 00000b1e c1737ea4 00000562 c12dfbe8 c12dfbe8 ef0afb14 00000000 f697ec00 ef0afa9c c103936e 00000009 ef0afa94 c1737e6c ef0afab0 ef0afadc Call Trace: [<c1597bbb>] dump_stack+0x41/0x56 [<c10392ca>] warn_slowpath_common+0x7a/0xa0 [<c103936e>] warn_slowpath_fmt+0x2e/0x30 [<c12dfbe8>] intel_sdvo_get_config+0x158/0x160 [<c12c3220>] check_crtc_state+0x1e0/0xb10 [<c12cdc7d>] intel_modeset_check_state+0x29d/0x7c0 [<c12dfe5c>] intel_sdvo_dpms+0x5c/0xa0 [<c12985de>] drm_mode_obj_set_property_ioctl+0x40e/0x420 [<c1298625>] drm_mode_connector_property_set_ioctl+0x35/0x40 [<c1289294>] drm_ioctl+0x3e4/0x540 [<c10fc1a2>] do_vfs_ioctl+0x72/0x570 [<c10fc72f>] SyS_ioctl+0x8f/0xa0 [<c159b7fa>] sysenter_do_call+0x12/0x22 ---[ end trace 7ce940aff1366d60 ]--- Fix the problem by skipping the encoder get_config() function for inactive encoders. Tested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/intel_display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5fb305840db8..e38b45786653 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -8269,9 +8269,11 @@ check_crtc_state(struct drm_device *dev) list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.head) { + enum pipe pipe; if (encoder->base.crtc != &crtc->base) continue; - if (encoder->get_config) + if (encoder->get_config && + encoder->get_hw_state(encoder, &pipe)) encoder->get_config(encoder, &pipe_config); } From 3f577573cd5482a32f85bd131e52f7cb4b9ac518 Mon Sep 17 00:00:00 2001 From: Jani Nikula <jani.nikula@intel.com> Date: Thu, 25 Jul 2013 14:31:30 +0300 Subject: [PATCH 852/913] drm/i915: do not disable backlight on vgaswitcheroo switch off On muxed systems, the other vgaswitcheroo client may depend on i915 to handle the backlight. We began switching off the backlight since commit a261b246ebd552fd5d5a8ed84cc931bb821c427f Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Thu Jul 26 19:21:47 2012 +0200 drm/i915: disable all crtcs at suspend time breaking backlight on discreet graphics in (some) muxed systems. Keep the backlight on when the state is changed through vgaswitcheroo. Note: The alternative would be to add a quirk table to achieve the same based on system identifiers, but AFAICS it would asymptotically approach effectively the same as this patch as more IDs are added, but with the maintenance burden of the quirk table. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=55311 Tested-by: Fede <fedevx@yahoo.com> Tested-by: Aximab <laurent.debian@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59785 Tested-by: sfievet <sebastien.fievet@free.fr> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Cc: stable@vger.kernel.org Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/i915/intel_panel.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 5063eadac3ef..5950888ae1d0 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -518,6 +518,17 @@ void intel_panel_disable_backlight(struct drm_device *dev) struct drm_i915_private *dev_priv = dev->dev_private; unsigned long flags; + /* + * Do not disable backlight on the vgaswitcheroo path. When switching + * away from i915, the other client may depend on i915 to handle the + * backlight. This will leave the backlight on unnecessarily when + * another client is not activated. + */ + if (dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) { + DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n"); + return; + } + spin_lock_irqsave(&dev_priv->backlight.lock, flags); dev_priv->backlight.enabled = false; From ddb6b5a964371e8e52e696b2b258bda144c8bd3f Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna <jussi.kivilinna@iki.fi> Date: Tue, 6 Aug 2013 14:53:24 +0300 Subject: [PATCH 853/913] ALSA: 6fire: fix DMA issues with URB transfer_buffer usage Patch fixes 6fire not to use stack as URB transfer_buffer. URB buffers need to be DMA-able, which stack is not. Furthermore, transfer_buffer should not be allocated as part of larger device structure because DMA coherency issues and patch fixes this issue too. Cc: stable@vger.kernel.org Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi> Tested-by: Torsten Schenk <torsten.schenk@zoho.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> --- sound/usb/6fire/comm.c | 38 +++++++++++++++++++++++++++++++++----- sound/usb/6fire/comm.h | 2 +- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/sound/usb/6fire/comm.c b/sound/usb/6fire/comm.c index 9e6e3ffd86bb..23452ee617e1 100644 --- a/sound/usb/6fire/comm.c +++ b/sound/usb/6fire/comm.c @@ -110,19 +110,37 @@ static int usb6fire_comm_send_buffer(u8 *buffer, struct usb_device *dev) static int usb6fire_comm_write8(struct comm_runtime *rt, u8 request, u8 reg, u8 value) { - u8 buffer[13]; /* 13: maximum length of message */ + u8 *buffer; + int ret; + + /* 13: maximum length of message */ + buffer = kmalloc(13, GFP_KERNEL); + if (!buffer) + return -ENOMEM; usb6fire_comm_init_buffer(buffer, 0x00, request, reg, value, 0x00); - return usb6fire_comm_send_buffer(buffer, rt->chip->dev); + ret = usb6fire_comm_send_buffer(buffer, rt->chip->dev); + + kfree(buffer); + return ret; } static int usb6fire_comm_write16(struct comm_runtime *rt, u8 request, u8 reg, u8 vl, u8 vh) { - u8 buffer[13]; /* 13: maximum length of message */ + u8 *buffer; + int ret; + + /* 13: maximum length of message */ + buffer = kmalloc(13, GFP_KERNEL); + if (!buffer) + return -ENOMEM; usb6fire_comm_init_buffer(buffer, 0x00, request, reg, vl, vh); - return usb6fire_comm_send_buffer(buffer, rt->chip->dev); + ret = usb6fire_comm_send_buffer(buffer, rt->chip->dev); + + kfree(buffer); + return ret; } int usb6fire_comm_init(struct sfire_chip *chip) @@ -135,6 +153,12 @@ int usb6fire_comm_init(struct sfire_chip *chip) if (!rt) return -ENOMEM; + rt->receiver_buffer = kzalloc(COMM_RECEIVER_BUFSIZE, GFP_KERNEL); + if (!rt->receiver_buffer) { + kfree(rt); + return -ENOMEM; + } + urb = &rt->receiver; rt->serial = 1; rt->chip = chip; @@ -153,6 +177,7 @@ int usb6fire_comm_init(struct sfire_chip *chip) urb->interval = 1; ret = usb_submit_urb(urb, GFP_KERNEL); if (ret < 0) { + kfree(rt->receiver_buffer); kfree(rt); snd_printk(KERN_ERR PREFIX "cannot create comm data receiver."); return ret; @@ -171,6 +196,9 @@ void usb6fire_comm_abort(struct sfire_chip *chip) void usb6fire_comm_destroy(struct sfire_chip *chip) { - kfree(chip->comm); + struct comm_runtime *rt = chip->comm; + + kfree(rt->receiver_buffer); + kfree(rt); chip->comm = NULL; } diff --git a/sound/usb/6fire/comm.h b/sound/usb/6fire/comm.h index 6a0840b0dcff..780d5ed8e5d8 100644 --- a/sound/usb/6fire/comm.h +++ b/sound/usb/6fire/comm.h @@ -24,7 +24,7 @@ struct comm_runtime { struct sfire_chip *chip; struct urb receiver; - u8 receiver_buffer[COMM_RECEIVER_BUFSIZE]; + u8 *receiver_buffer; u8 serial; /* urb serial */ From f480adaf1b7130ad43760f627b762f771fcfc5f5 Mon Sep 17 00:00:00 2001 From: Maxime Ripard <maxime.ripard@free-electrons.com> Date: Wed, 24 Jul 2013 09:14:35 +0200 Subject: [PATCH 854/913] i2c: mv64xxx: Document the newly introduced allwinner compatible Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> --- Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt index a1ee681942cc..6113f9275f42 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt @@ -4,7 +4,7 @@ Required properties : - reg : Offset and length of the register set for the device - - compatible : Should be "marvell,mv64xxx-i2c" + - compatible : Should be "marvell,mv64xxx-i2c" or "allwinner,sun4i-i2c" - interrupts : The interrupt number Optional properties : From c47205914cf5a8cf564ca560aa6eaa2287867e58 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" <bfields@redhat.com> Date: Wed, 7 Aug 2013 11:41:49 -0400 Subject: [PATCH 855/913] nfsd4: Fix MACH_CRED NULL dereference Fixes a NULL-dereference on attempts to use MACH_CRED protection over auth_sys. Signed-off-by: J. Bruce Fields <bfields@redhat.com> --- fs/nfsd/nfs4state.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 280acef6f0dc..43f42290e5df 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1264,6 +1264,8 @@ static bool svc_rqst_integrity_protected(struct svc_rqst *rqstp) struct svc_cred *cr = &rqstp->rq_cred; u32 service; + if (!cr->cr_gss_mech) + return false; service = gss_pseudoflavor_to_service(cr->cr_gss_mech, cr->cr_flavor); return service == RPC_GSS_SVC_INTEGRITY || service == RPC_GSS_SVC_PRIVACY; From 58cd57bfd9db3bc213bf9d6a10920f82095f0114 Mon Sep 17 00:00:00 2001 From: Weston Andros Adamson <dros@netapp.com> Date: Mon, 5 Aug 2013 15:47:07 -0400 Subject: [PATCH 856/913] nfsd: Fix SP4_MACH_CRED negotiation in EXCHANGE_ID - don't BUG_ON() when not SP4_NONE - calculate recv and send reserve sizes correctly Signed-off-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> --- fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/nfs4xdr.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 0d4c410e4589..419572f33b72 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1524,7 +1524,7 @@ static inline u32 nfsd4_write_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) { return (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\ - 1 + 1 + 0 + /* eir_flags, spr_how, SP4_NONE (for now) */\ + 1 + 1 + 2 + /* eir_flags, spr_how, spo_must_enforce & _allow */\ 2 + /*eir_server_owner.so_minor_id */\ /* eir_server_owner.so_major_id<> */\ XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 +\ diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 0c0f3ea90de5..c2a4701d7286 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3360,7 +3360,8 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr, 8 /* eir_clientid */ + 4 /* eir_sequenceid */ + 4 /* eir_flags */ + - 4 /* spr_how (SP4_NONE) */ + + 4 /* spr_how */ + + 8 /* spo_must_enforce, spo_must_allow */ + 8 /* so_minor_id */ + 4 /* so_major_id.len */ + (XDR_QUADLEN(major_id_sz) * 4) + @@ -3372,8 +3373,6 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr, WRITE32(exid->seqid); WRITE32(exid->flags); - /* state_protect4_r. Currently only support SP4_NONE */ - BUG_ON(exid->spa_how != SP4_NONE); WRITE32(exid->spa_how); switch (exid->spa_how) { case SP4_NONE: From 60ba4f4843f6e5e21a51ac32a689984374e77029 Mon Sep 17 00:00:00 2001 From: Linus Walleij <linus.walleij@linaro.org> Date: Wed, 31 Jul 2013 16:36:38 +0200 Subject: [PATCH 857/913] MAINTAINERS: delete Srinidhi from ux500 Srinidhi's mail address is now bouncing and he has requested me to delete this entry. Acked-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Kevin Hilman <khilman@linaro.org> --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a26b10e52aea..49d6e96a2f33 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1259,7 +1259,6 @@ F: drivers/rtc/rtc-coh901331.c T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git ARM/Ux500 ARM ARCHITECTURE -M: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> M: Linus Walleij <linus.walleij@linaro.org> L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained From 1154f858ab5cd3c5facde7cb9ac31c889eb780a8 Mon Sep 17 00:00:00 2001 From: Santosh Shilimkar <santosh.shilimkar@ti.com> Date: Mon, 5 Aug 2013 14:11:14 -0400 Subject: [PATCH 858/913] MAINTAINERS: add TI Keystone ARM platform Adding maintainer for arch/arm/mach-keystone/ Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Signed-off-by: Kevin Hilman <khilman@linaro.org> --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 49d6e96a2f33..55bd562b57d2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -965,6 +965,12 @@ M: Lennert Buytenhek <kernel@wantstofly.org> L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained +ARM/TEXAS INSTRUMENT KEYSTONE ARCHITECTURE +M: Santosh Shilimkar <santosh.shilimkar@ti.com> +L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) +S: Maintained +F: arch/arm/mach-keystone/ + ARM/LOGICPD PXA270 MACHINE SUPPORT M: Lennert Buytenhek <kernel@wantstofly.org> L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) From 1e385f6f97b8ab39e16a0956a1951e19a9376bab Mon Sep 17 00:00:00 2001 From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Date: Tue, 6 Aug 2013 19:11:11 +0900 Subject: [PATCH 859/913] ACPI / processor: move try_offline_node() after acpi_unmap_lsapic() try_offline_node() checks that all CPUs associated with the given node have been removed by using cpu_present_bits. If all cpus related to that node have been removed, try_offline_node() clears the node information. However, try_offline_node() called from acpi_processor_remove() never clears the node information. For disabling cpu_present_bits, acpi_unmap_lsapic() needs be called. Yet, acpi_unmap_lsapic() is called after try_offline_node() has run. So when try_offline_node() runs, the CPU's cpu_present_bits is always set. Fix the issue by moving try_offline_node() after acpi_unmap_lsapic(). The problem fixed here was uncovered by commit cecdb19 "ACPI / scan: Change the implementation of acpi_bus_trim()". [rjw: Changelog] Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Acked-by: Toshi Kani <toshi.kani@hp.com> Cc: 3.9+ <stable@vger.kernel.org> # 3.9+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/acpi_processor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index fd6c51cc3acb..5a74a9c1e42c 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -451,7 +451,6 @@ static void acpi_processor_remove(struct acpi_device *device) /* Clean up. */ per_cpu(processor_device_array, pr->id) = NULL; per_cpu(processors, pr->id) = NULL; - try_offline_node(cpu_to_node(pr->id)); /* Remove the CPU. */ get_online_cpus(); @@ -459,6 +458,8 @@ static void acpi_processor_remove(struct acpi_device *device) acpi_unmap_lsapic(pr->id); put_online_cpus(); + try_offline_node(cpu_to_node(pr->id)); + out: free_cpumask_var(pr->throttling.shared_cpu_map); kfree(pr); From f54fe64d14dff3df6d45a48115d248a82557811f Mon Sep 17 00:00:00 2001 From: Aaro Koskinen <aaro.koskinen@iki.fi> Date: Mon, 5 Aug 2013 21:27:12 +0300 Subject: [PATCH 860/913] cpufreq: loongson2: fix regression related to clock management Commit 42913c799 (MIPS: Loongson2: Use clk API instead of direct dereferences) broke the cpufreq functionality on Loongson2 boards: clk_set_rate() is called before the CPU frequency table is initialized, and therefore will always fail. Fix by moving the clk_set_rate() after the table initialization. Tested on Lemote FuLoong mini-PC. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Cc: 3.9+ <stable@vger.kernel.org> # 3.9+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/cpufreq/loongson2_cpufreq.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c index bb838b985077..9536852c504a 100644 --- a/drivers/cpufreq/loongson2_cpufreq.c +++ b/drivers/cpufreq/loongson2_cpufreq.c @@ -118,11 +118,6 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) clk_put(cpuclk); return -EINVAL; } - ret = clk_set_rate(cpuclk, rate); - if (ret) { - clk_put(cpuclk); - return ret; - } /* clock table init */ for (i = 2; @@ -130,6 +125,12 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) i++) loongson2_clockmod_table[i].frequency = (rate * i) / 8; + ret = clk_set_rate(cpuclk, rate); + if (ret) { + clk_put(cpuclk); + return ret; + } + policy->cur = loongson2_cpufreq_get(policy->cpu); cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0], From 6c4640c3adfd97ce10efed7c07405f52d002b9a8 Mon Sep 17 00:00:00 2001 From: Viresh Kumar <viresh.kumar@linaro.org> Date: Mon, 5 Aug 2013 12:28:02 +0530 Subject: [PATCH 861/913] cpufreq: rename ignore_nice as ignore_nice_load This sysfs file was called ignore_nice_load earlier and commit 4d5dcc4 (cpufreq: governor: Implement per policy instances of governors) changed its name to ignore_nice by mistake. Lets get it renamed back to its original name. Reported-by: Martin von Gagern <Martin.vGagern@gmx.net> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Cc: 3.10+ <stable@vger.kernel.org> # 3.10+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/cpufreq/cpufreq_conservative.c | 20 ++++++++++---------- drivers/cpufreq/cpufreq_governor.c | 8 ++++---- drivers/cpufreq/cpufreq_governor.h | 4 ++-- drivers/cpufreq/cpufreq_ondemand.c | 20 ++++++++++---------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 0ceb2eff5a7e..f97cb3d8c5a2 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c @@ -221,8 +221,8 @@ static ssize_t store_down_threshold(struct dbs_data *dbs_data, const char *buf, return count; } -static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, - size_t count) +static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data, + const char *buf, size_t count) { struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; unsigned int input, j; @@ -235,10 +235,10 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, if (input > 1) input = 1; - if (input == cs_tuners->ignore_nice) /* nothing to do */ + if (input == cs_tuners->ignore_nice_load) /* nothing to do */ return count; - cs_tuners->ignore_nice = input; + cs_tuners->ignore_nice_load = input; /* we need to re-evaluate prev_cpu_idle */ for_each_online_cpu(j) { @@ -246,7 +246,7 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, dbs_info = &per_cpu(cs_cpu_dbs_info, j); dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, &dbs_info->cdbs.prev_cpu_wall, 0); - if (cs_tuners->ignore_nice) + if (cs_tuners->ignore_nice_load) dbs_info->cdbs.prev_cpu_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; } @@ -279,7 +279,7 @@ show_store_one(cs, sampling_rate); show_store_one(cs, sampling_down_factor); show_store_one(cs, up_threshold); show_store_one(cs, down_threshold); -show_store_one(cs, ignore_nice); +show_store_one(cs, ignore_nice_load); show_store_one(cs, freq_step); declare_show_sampling_rate_min(cs); @@ -287,7 +287,7 @@ gov_sys_pol_attr_rw(sampling_rate); gov_sys_pol_attr_rw(sampling_down_factor); gov_sys_pol_attr_rw(up_threshold); gov_sys_pol_attr_rw(down_threshold); -gov_sys_pol_attr_rw(ignore_nice); +gov_sys_pol_attr_rw(ignore_nice_load); gov_sys_pol_attr_rw(freq_step); gov_sys_pol_attr_ro(sampling_rate_min); @@ -297,7 +297,7 @@ static struct attribute *dbs_attributes_gov_sys[] = { &sampling_down_factor_gov_sys.attr, &up_threshold_gov_sys.attr, &down_threshold_gov_sys.attr, - &ignore_nice_gov_sys.attr, + &ignore_nice_load_gov_sys.attr, &freq_step_gov_sys.attr, NULL }; @@ -313,7 +313,7 @@ static struct attribute *dbs_attributes_gov_pol[] = { &sampling_down_factor_gov_pol.attr, &up_threshold_gov_pol.attr, &down_threshold_gov_pol.attr, - &ignore_nice_gov_pol.attr, + &ignore_nice_load_gov_pol.attr, &freq_step_gov_pol.attr, NULL }; @@ -338,7 +338,7 @@ static int cs_init(struct dbs_data *dbs_data) tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; tuners->down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD; tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; - tuners->ignore_nice = 0; + tuners->ignore_nice_load = 0; tuners->freq_step = DEF_FREQUENCY_STEP; dbs_data->tuners = tuners; diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 7b839a8db2a7..e59afaa9da23 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -47,9 +47,9 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) unsigned int j; if (dbs_data->cdata->governor == GOV_ONDEMAND) - ignore_nice = od_tuners->ignore_nice; + ignore_nice = od_tuners->ignore_nice_load; else - ignore_nice = cs_tuners->ignore_nice; + ignore_nice = cs_tuners->ignore_nice_load; policy = cdbs->cur_policy; @@ -298,12 +298,12 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, cs_tuners = dbs_data->tuners; cs_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); sampling_rate = cs_tuners->sampling_rate; - ignore_nice = cs_tuners->ignore_nice; + ignore_nice = cs_tuners->ignore_nice_load; } else { od_tuners = dbs_data->tuners; od_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); sampling_rate = od_tuners->sampling_rate; - ignore_nice = od_tuners->ignore_nice; + ignore_nice = od_tuners->ignore_nice_load; od_ops = dbs_data->cdata->gov_ops; io_busy = od_tuners->io_is_busy; } diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 6663ec3b3056..d5f12b4b11b8 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h @@ -165,7 +165,7 @@ struct cs_cpu_dbs_info_s { /* Per policy Governers sysfs tunables */ struct od_dbs_tuners { - unsigned int ignore_nice; + unsigned int ignore_nice_load; unsigned int sampling_rate; unsigned int sampling_down_factor; unsigned int up_threshold; @@ -175,7 +175,7 @@ struct od_dbs_tuners { }; struct cs_dbs_tuners { - unsigned int ignore_nice; + unsigned int ignore_nice_load; unsigned int sampling_rate; unsigned int sampling_down_factor; unsigned int up_threshold; diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 93eb5cbcc1f6..c087347d6688 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -403,8 +403,8 @@ static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data, return count; } -static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, - size_t count) +static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data, + const char *buf, size_t count) { struct od_dbs_tuners *od_tuners = dbs_data->tuners; unsigned int input; @@ -419,10 +419,10 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, if (input > 1) input = 1; - if (input == od_tuners->ignore_nice) { /* nothing to do */ + if (input == od_tuners->ignore_nice_load) { /* nothing to do */ return count; } - od_tuners->ignore_nice = input; + od_tuners->ignore_nice_load = input; /* we need to re-evaluate prev_cpu_idle */ for_each_online_cpu(j) { @@ -430,7 +430,7 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, dbs_info = &per_cpu(od_cpu_dbs_info, j); dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy); - if (od_tuners->ignore_nice) + if (od_tuners->ignore_nice_load) dbs_info->cdbs.prev_cpu_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; @@ -461,7 +461,7 @@ show_store_one(od, sampling_rate); show_store_one(od, io_is_busy); show_store_one(od, up_threshold); show_store_one(od, sampling_down_factor); -show_store_one(od, ignore_nice); +show_store_one(od, ignore_nice_load); show_store_one(od, powersave_bias); declare_show_sampling_rate_min(od); @@ -469,7 +469,7 @@ gov_sys_pol_attr_rw(sampling_rate); gov_sys_pol_attr_rw(io_is_busy); gov_sys_pol_attr_rw(up_threshold); gov_sys_pol_attr_rw(sampling_down_factor); -gov_sys_pol_attr_rw(ignore_nice); +gov_sys_pol_attr_rw(ignore_nice_load); gov_sys_pol_attr_rw(powersave_bias); gov_sys_pol_attr_ro(sampling_rate_min); @@ -478,7 +478,7 @@ static struct attribute *dbs_attributes_gov_sys[] = { &sampling_rate_gov_sys.attr, &up_threshold_gov_sys.attr, &sampling_down_factor_gov_sys.attr, - &ignore_nice_gov_sys.attr, + &ignore_nice_load_gov_sys.attr, &powersave_bias_gov_sys.attr, &io_is_busy_gov_sys.attr, NULL @@ -494,7 +494,7 @@ static struct attribute *dbs_attributes_gov_pol[] = { &sampling_rate_gov_pol.attr, &up_threshold_gov_pol.attr, &sampling_down_factor_gov_pol.attr, - &ignore_nice_gov_pol.attr, + &ignore_nice_load_gov_pol.attr, &powersave_bias_gov_pol.attr, &io_is_busy_gov_pol.attr, NULL @@ -544,7 +544,7 @@ static int od_init(struct dbs_data *dbs_data) } tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; - tuners->ignore_nice = 0; + tuners->ignore_nice_load = 0; tuners->powersave_bias = default_powersave_bias; tuners->io_is_busy = should_io_be_busy(); From 60f75b8e97daf4a39790a20d962cb861b9220af5 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Date: Wed, 7 Aug 2013 22:55:00 +0200 Subject: [PATCH 862/913] ACPI: Try harder to resolve _ADR collisions for bridges In theory, under a given ACPI namespace node there should be only one child device object with _ADR whose value matches a given bus address exactly. In practice, however, there are systems in which multiple child device objects under a given parent have _ADR matching exactly the same address. In those cases we use _STA to determine which of the multiple matching devices is enabled, since some systems are known to indicate which ACPI device object to associate with the given physical (usually PCI) device this way. Unfortunately, as it turns out, there are systems in which many device objects under the same parent have _ADR matching exactly the same bus address and none of them has _STA, in which case they all should be regarded as enabled according to the spec. Still, if those device objects are supposed to represent bridges (e.g. this is the case for device objects corresponding to PCIe ports), we can try harder and skip the ones that have no child device objects in the ACPI namespace. With luck, we can avoid using device objects that we are not expected to use this way. Although this only works for bridges whose children also have ACPI namespace representation, it is sufficient to address graphics adapter detection issues on some systems, so rework the code finding a matching device ACPI handle for a given bus address to implement this idea. Introduce a new function, acpi_find_child(), taking three arguments: the ACPI handle of the device's parent, a bus address suitable for the device's bus type and a bool indicating if the device is a bridge and make it work as outlined above. Reimplement the function currently used for this purpose, acpi_get_child(), as a call to acpi_find_child() with the last argument set to 'false' and make the PCI subsystem use acpi_find_child() with the bridge information passed as the last argument to it. [Lan Tianyu notices that it is not sufficient to use pci_is_bridge() for that, because the device's subordinate pointer hasn't been set yet at this point, so use hdr_type instead.] This change fixes a regression introduced inadvertently by commit 33f767d (ACPI: Rework acpi_get_child() to be more efficient) which overlooked the fact that for acpi_walk_namespace() "post-order" means "after all children have been visited" rather than "on the way back", so for device objects without children and for namespace walks of depth 1, as in the acpi_get_child() case, the "post-order" callbacks ordering is actually the same as the ordering of "pre-order" ones. Since that commit changed the namespace walk in acpi_get_child() to terminate after finding the first matching object instead of going through all of them and returning the last one, it effectively changed the result returned by that function in some rare cases and that led to problems (the switch from a "pre-order" to a "post-order" callback was supposed to prevent that from happening, but it was ineffective). As it turns out, the systems where the change made by commit 33f767d actually matters are those where there are multiple ACPI device objects representing the same PCIe port (which effectively is a bridge). Moreover, only one of them, and the one we are expected to use, has child device objects in the ACPI namespace, so the regression can be addressed as described above. References: https://bugzilla.kernel.org/show_bug.cgi?id=60561 Reported-by: Peter Wu <lekensteyn@gmail.com> Tested-by: Vladimir Lalov <mail@vlalov.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Cc: 3.9+ <stable@vger.kernel.org> # 3.9+ --- drivers/acpi/glue.c | 99 ++++++++++++++++++++++++++++++++++------- drivers/pci/pci-acpi.c | 15 +++++-- include/acpi/acpi_bus.h | 6 ++- 3 files changed, 98 insertions(+), 22 deletions(-) diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 17e15d11bd39..408f6b2a5fa8 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -79,34 +79,99 @@ static struct acpi_bus_type *acpi_get_bus_type(struct device *dev) return ret; } -static acpi_status do_acpi_find_child(acpi_handle handle, u32 lvl_not_used, - void *addr_p, void **ret_p) +static acpi_status acpi_dev_present(acpi_handle handle, u32 lvl_not_used, + void *not_used, void **ret_p) { - unsigned long long addr, sta; - acpi_status status; + struct acpi_device *adev = NULL; - status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); - if (ACPI_SUCCESS(status) && addr == *((u64 *)addr_p)) { + acpi_bus_get_device(handle, &adev); + if (adev) { *ret_p = handle; - status = acpi_bus_get_status_handle(handle, &sta); - if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_ENABLED)) - return AE_CTRL_TERMINATE; + return AE_CTRL_TERMINATE; } return AE_OK; } -acpi_handle acpi_get_child(acpi_handle parent, u64 address) +static bool acpi_extra_checks_passed(acpi_handle handle, bool is_bridge) { - void *ret = NULL; + unsigned long long sta; + acpi_status status; - if (!parent) - return NULL; + status = acpi_bus_get_status_handle(handle, &sta); + if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED)) + return false; - acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, NULL, - do_acpi_find_child, &address, &ret); - return (acpi_handle)ret; + if (is_bridge) { + void *test = NULL; + + /* Check if this object has at least one child device. */ + acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, + acpi_dev_present, NULL, NULL, &test); + return !!test; + } + return true; } -EXPORT_SYMBOL(acpi_get_child); + +struct find_child_context { + u64 addr; + bool is_bridge; + acpi_handle ret; + bool ret_checked; +}; + +static acpi_status do_find_child(acpi_handle handle, u32 lvl_not_used, + void *data, void **not_used) +{ + struct find_child_context *context = data; + unsigned long long addr; + acpi_status status; + + status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); + if (ACPI_FAILURE(status) || addr != context->addr) + return AE_OK; + + if (!context->ret) { + /* This is the first matching object. Save its handle. */ + context->ret = handle; + return AE_OK; + } + /* + * There is more than one matching object with the same _ADR value. + * That really is unexpected, so we are kind of beyond the scope of the + * spec here. We have to choose which one to return, though. + * + * First, check if the previously found object is good enough and return + * its handle if so. Second, check the same for the object that we've + * just found. + */ + if (!context->ret_checked) { + if (acpi_extra_checks_passed(context->ret, context->is_bridge)) + return AE_CTRL_TERMINATE; + else + context->ret_checked = true; + } + if (acpi_extra_checks_passed(handle, context->is_bridge)) { + context->ret = handle; + return AE_CTRL_TERMINATE; + } + return AE_OK; +} + +acpi_handle acpi_find_child(acpi_handle parent, u64 addr, bool is_bridge) +{ + if (parent) { + struct find_child_context context = { + .addr = addr, + .is_bridge = is_bridge, + }; + + acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, do_find_child, + NULL, &context, NULL); + return context.ret; + } + return NULL; +} +EXPORT_SYMBOL_GPL(acpi_find_child); int acpi_bind_one(struct device *dev, acpi_handle handle) { diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index dbdc5f7e2b29..01e264fb50e0 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -317,13 +317,20 @@ void acpi_pci_remove_bus(struct pci_bus *bus) /* ACPI bus type */ static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) { - struct pci_dev * pci_dev; - u64 addr; + struct pci_dev *pci_dev = to_pci_dev(dev); + bool is_bridge; + u64 addr; - pci_dev = to_pci_dev(dev); + /* + * pci_is_bridge() is not suitable here, because pci_dev->subordinate + * is set only after acpi_pci_find_device() has been called for the + * given device. + */ + is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE + || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; /* Please ref to ACPI spec for the syntax of _ADR */ addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); - *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr); + *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge); if (!*handle) return -ENODEV; return 0; diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 5026aaa35133..94383a70c1a3 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -441,7 +441,11 @@ struct acpi_pci_root { }; /* helper */ -acpi_handle acpi_get_child(acpi_handle, u64); +acpi_handle acpi_find_child(acpi_handle, u64, bool); +static inline acpi_handle acpi_get_child(acpi_handle handle, u64 addr) +{ + return acpi_find_child(handle, addr, false); +} int acpi_is_root_bridge(acpi_handle); struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev)) From 786615bc1ce84150ded80daea6bd9f6297f48e73 Mon Sep 17 00:00:00 2001 From: Trond Myklebust <Trond.Myklebust@netapp.com> Date: Mon, 5 Aug 2013 16:04:47 -0400 Subject: [PATCH 863/913] SUNRPC: If the rpcbind channel is disconnected, fail the call to unregister If rpcbind causes our connection to the AF_LOCAL socket to close after we've registered a service, then we want to be careful about reconnecting since the mount namespace may have changed. By simply refusing to reconnect the AF_LOCAL socket in the case of unregister, we avoid the need to somehow save the mount namespace. While this may lead to some services not unregistering properly, it should be safe. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Nix <nix@esperi.org.uk> Cc: Jeff Layton <jlayton@redhat.com> Cc: stable@vger.kernel.org # 3.9.x --- include/linux/sunrpc/sched.h | 1 + net/sunrpc/clnt.c | 4 ++++ net/sunrpc/netns.h | 1 + net/sunrpc/rpcb_clnt.c | 40 ++++++++++++++++++++++++------------ 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 6d870353674a..1821445708d6 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h @@ -121,6 +121,7 @@ struct rpc_task_setup { #define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ #define RPC_TASK_SENT 0x0800 /* message was sent */ #define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ +#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */ #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 74f6a704e374..ecbc4e3d83ad 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -1660,6 +1660,10 @@ call_connect(struct rpc_task *task) task->tk_action = call_connect_status; if (task->tk_status < 0) return; + if (task->tk_flags & RPC_TASK_NOCONNECT) { + rpc_exit(task, -ENOTCONN); + return; + } xprt_connect(task); } } diff --git a/net/sunrpc/netns.h b/net/sunrpc/netns.h index 74d948f5d5a1..779742cfc1ff 100644 --- a/net/sunrpc/netns.h +++ b/net/sunrpc/netns.h @@ -23,6 +23,7 @@ struct sunrpc_net { struct rpc_clnt *rpcb_local_clnt4; spinlock_t rpcb_clnt_lock; unsigned int rpcb_users; + unsigned int rpcb_is_af_local : 1; struct mutex gssp_lock; wait_queue_head_t gssp_wq; diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index b0f723227157..1891a1022c17 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c @@ -204,13 +204,15 @@ void rpcb_put_local(struct net *net) } static void rpcb_set_local(struct net *net, struct rpc_clnt *clnt, - struct rpc_clnt *clnt4) + struct rpc_clnt *clnt4, + bool is_af_local) { struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); /* Protected by rpcb_create_local_mutex */ sn->rpcb_local_clnt = clnt; sn->rpcb_local_clnt4 = clnt4; + sn->rpcb_is_af_local = is_af_local ? 1 : 0; smp_wmb(); sn->rpcb_users = 1; dprintk("RPC: created new rpcb local clients (rpcb_local_clnt: " @@ -271,7 +273,7 @@ static int rpcb_create_local_unix(struct net *net) clnt4 = NULL; } - rpcb_set_local(net, clnt, clnt4); + rpcb_set_local(net, clnt, clnt4, true); out: return result; @@ -323,7 +325,7 @@ static int rpcb_create_local_net(struct net *net) clnt4 = NULL; } - rpcb_set_local(net, clnt, clnt4); + rpcb_set_local(net, clnt, clnt4, false); out: return result; @@ -384,13 +386,16 @@ static struct rpc_clnt *rpcb_create(struct net *net, const char *hostname, return rpc_create(&args); } -static int rpcb_register_call(struct rpc_clnt *clnt, struct rpc_message *msg) +static int rpcb_register_call(struct sunrpc_net *sn, struct rpc_clnt *clnt, struct rpc_message *msg, bool is_set) { - int result, error = 0; + int flags = RPC_TASK_NOCONNECT; + int error, result = 0; + if (is_set || !sn->rpcb_is_af_local) + flags = RPC_TASK_SOFTCONN; msg->rpc_resp = &result; - error = rpc_call_sync(clnt, msg, RPC_TASK_SOFTCONN); + error = rpc_call_sync(clnt, msg, flags); if (error < 0) { dprintk("RPC: failed to contact local rpcbind " "server (errno %d).\n", -error); @@ -447,16 +452,19 @@ int rpcb_register(struct net *net, u32 prog, u32 vers, int prot, unsigned short .rpc_argp = &map, }; struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); + bool is_set = false; dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " "rpcbind\n", (port ? "" : "un"), prog, vers, prot, port); msg.rpc_proc = &rpcb_procedures2[RPCBPROC_UNSET]; - if (port) + if (port != 0) { msg.rpc_proc = &rpcb_procedures2[RPCBPROC_SET]; + is_set = true; + } - return rpcb_register_call(sn->rpcb_local_clnt, &msg); + return rpcb_register_call(sn, sn->rpcb_local_clnt, &msg, is_set); } /* @@ -469,6 +477,7 @@ static int rpcb_register_inet4(struct sunrpc_net *sn, const struct sockaddr_in *sin = (const struct sockaddr_in *)sap; struct rpcbind_args *map = msg->rpc_argp; unsigned short port = ntohs(sin->sin_port); + bool is_set = false; int result; map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL); @@ -479,10 +488,12 @@ static int rpcb_register_inet4(struct sunrpc_net *sn, map->r_addr, map->r_netid); msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; - if (port) + if (port != 0) { msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; + is_set = true; + } - result = rpcb_register_call(sn->rpcb_local_clnt4, msg); + result = rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, is_set); kfree(map->r_addr); return result; } @@ -497,6 +508,7 @@ static int rpcb_register_inet6(struct sunrpc_net *sn, const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)sap; struct rpcbind_args *map = msg->rpc_argp; unsigned short port = ntohs(sin6->sin6_port); + bool is_set = false; int result; map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL); @@ -507,10 +519,12 @@ static int rpcb_register_inet6(struct sunrpc_net *sn, map->r_addr, map->r_netid); msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; - if (port) + if (port != 0) { msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; + is_set = true; + } - result = rpcb_register_call(sn->rpcb_local_clnt4, msg); + result = rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, is_set); kfree(map->r_addr); return result; } @@ -527,7 +541,7 @@ static int rpcb_unregister_all_protofamilies(struct sunrpc_net *sn, map->r_addr = ""; msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; - return rpcb_register_call(sn->rpcb_local_clnt4, msg); + return rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, false); } /** From f8806c843f88a6b7d657cf24c3682bc2efda6fdb Mon Sep 17 00:00:00 2001 From: Trond Myklebust <Trond.Myklebust@netapp.com> Date: Mon, 5 Aug 2013 13:26:31 -0400 Subject: [PATCH 864/913] NFS: Fix writeback performance issue on cache invalidation If a cache invalidation is triggered, and we happen to have a lot of writebacks cached at the time, then the call to invalidate_inode_pages2() will end up calling ->launder_page() on each and every dirty page in order to sync its contents to disk, thus defeating write coalescing. The following patch ensures that we try to sync the inode to disk before calling invalidate_inode_pages2() so that we do the writeback as efficiently as possible. Reported-by: William Dauchy <william@gandi.net> Reported-by: Pascal Bouchareine <pascal@gandi.net> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Tested-by: William Dauchy <william@gandi.net> Reviewed-by: Jeff Layton <jlayton@redhat.com> --- fs/nfs/inode.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index af6e806044d7..3ea4f641effc 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -963,9 +963,15 @@ EXPORT_SYMBOL_GPL(nfs_revalidate_inode); static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping) { struct nfs_inode *nfsi = NFS_I(inode); - + int ret; + if (mapping->nrpages != 0) { - int ret = invalidate_inode_pages2(mapping); + if (S_ISREG(inode->i_mode)) { + ret = nfs_sync_mapping(mapping); + if (ret < 0) + return ret; + } + ret = invalidate_inode_pages2(mapping); if (ret < 0) return ret; } From e890db0104826742818cbfb8fdb3000a38a9b97c Mon Sep 17 00:00:00 2001 From: Scott Mayhew <smayhew@redhat.com> Date: Wed, 31 Jul 2013 10:01:41 -0400 Subject: [PATCH 865/913] NFSv4: Fix the sync mount option for nfs4 mounts The sync mount option stopped working for NFSv4 mounts after commit c02d7adf8c5429727a98bad1d039bccad4c61c50 (NFSv4: Replace nfs4_path_walk() with FS path lookup in a private namespace). If MS_SYNCHRONOUS is set in the super_block that we're cloning from, then it should be set in the new super_block as well. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> --- fs/nfs/super.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 71fdc0dfa0d2..f6db66d8f647 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -2478,6 +2478,10 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server, if (server->flags & NFS_MOUNT_NOAC) sb_mntdata.mntflags |= MS_SYNCHRONOUS; + if (mount_info->cloned != NULL && mount_info->cloned->sb != NULL) + if (mount_info->cloned->sb->s_flags & MS_SYNCHRONOUS) + sb_mntdata.mntflags |= MS_SYNCHRONOUS; + /* Get a superblock - note that we may end up sharing one that already exists */ s = sget(nfs_mod->nfs_fs, compare_super, nfs_set_super, flags, &sb_mntdata); if (IS_ERR(s)) { From eddffa40841c0249678ee5551839e369baa97314 Mon Sep 17 00:00:00 2001 From: Trond Myklebust <Trond.Myklebust@netapp.com> Date: Wed, 7 Aug 2013 12:17:19 -0400 Subject: [PATCH 866/913] NFS: Remove unnecessary call to nfs_setsecurity in nfs_fhget() We only need to call it on the creation of the inode. Reported-by: Julia Lawall <Julia.Lawall@lip6.fr> Cc: Steve Dickson <SteveD@redhat.com> Cc: Dave Quigley <dpquigl@davequigley.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> --- fs/nfs/inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 3ea4f641effc..941246f2b43d 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -463,7 +463,6 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st unlock_new_inode(inode); } else nfs_refresh_inode(inode, fattr); - nfs_setsecurity(inode, fattr, label); dprintk("NFS: nfs_fhget(%s/%Ld fh_crc=0x%08x ct=%d)\n", inode->i_sb->s_id, (long long)NFS_FILEID(inode), From 95f595097b22827a5ee562afff402570c6b8205a Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Wed, 31 Jul 2013 09:16:42 -0400 Subject: [PATCH 867/913] drm/radeon: properly handle pm on gpu reset When we reset the GPU, we need to properly tear down power management before reseting the GPU and then set it back up again after reset. Add the missing radeon_pm_[suspend|resume] calls to the gpu reset function. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/radeon_device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 82335e38ec4f..84dd2dcbcf69 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -1519,6 +1519,7 @@ int radeon_gpu_reset(struct radeon_device *rdev) radeon_save_bios_scratch_regs(rdev); /* block TTM */ resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); + radeon_pm_suspend(rdev); radeon_suspend(rdev); for (i = 0; i < RADEON_NUM_RINGS; ++i) { @@ -1564,6 +1565,7 @@ retry: } } + radeon_pm_resume(rdev); drm_helper_resume_force_mode(rdev->ddev); ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); From e1accbf0543eecfdb161131208c3dfefee22d61f Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Mon, 29 Jul 2013 18:56:13 -0400 Subject: [PATCH 868/913] drm/radeon: select audio dto based on encoder id for DCE3 There are two audio dtos on radeon asics that you can select between. Normally, dto0 is used for hdmi and dto1 for DP, but it seems that the dto is somehow tied to the encoders on DCE3 asics. fixes: https://bugs.freedesktop.org/show_bug.cgi?id=67435 Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org --- drivers/gpu/drm/radeon/r600_hdmi.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index f48240bb8c56..b9b1139da356 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c @@ -242,9 +242,15 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) /* according to the reg specs, this should DCE3.2 only, but in * practice it seems to cover DCE3.0 as well. */ - WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); - WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); - WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ + if (dig->dig_encoder == 0) { + WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); + WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); + WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ + } else { + WREG32(DCCG_AUDIO_DTO1_PHASE, base_rate * 100); + WREG32(DCCG_AUDIO_DTO1_MODULE, clock * 100); + WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */ + } } else { /* according to the reg specs, this should be DCE2.0 and DCE3.0 */ WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) | From fda837241f3680e5dc554c26e178c2deec7a039c Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Wed, 31 Jul 2013 12:41:35 -0400 Subject: [PATCH 869/913] drm/radeon/dpm: adjust thermal protection requirements On rv770 and newer, clock gating is not required for thermal protection. The only requirement is that the design utilizes a thermal sensor. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/btc_dpm.c | 3 +-- drivers/gpu/drm/radeon/cypress_dpm.c | 3 +-- drivers/gpu/drm/radeon/ni_dpm.c | 3 +-- drivers/gpu/drm/radeon/rv770_dpm.c | 3 +-- drivers/gpu/drm/radeon/si_dpm.c | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c index 0bfd55e08820..e7c128b48112 100644 --- a/drivers/gpu/drm/radeon/btc_dpm.c +++ b/drivers/gpu/drm/radeon/btc_dpm.c @@ -2659,8 +2659,7 @@ int btc_dpm_init(struct radeon_device *rdev) pi->dynamic_pcie_gen2 = true; - if (pi->gfx_clock_gating && - (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) + if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) pi->thermal_protection = true; else pi->thermal_protection = false; diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c index 9bcdd174780f..c840e079be5b 100644 --- a/drivers/gpu/drm/radeon/cypress_dpm.c +++ b/drivers/gpu/drm/radeon/cypress_dpm.c @@ -2122,8 +2122,7 @@ int cypress_dpm_init(struct radeon_device *rdev) pi->dynamic_pcie_gen2 = true; - if (pi->gfx_clock_gating && - (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) + if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) pi->thermal_protection = true; else pi->thermal_protection = false; diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index 4f9b9bc20daa..c560318d3f19 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c @@ -4188,8 +4188,7 @@ int ni_dpm_init(struct radeon_device *rdev) pi->dynamic_pcie_gen2 = true; - if (pi->gfx_clock_gating && - (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) + if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) pi->thermal_protection = true; else pi->thermal_protection = false; diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c index 2d347925f77d..2ae54bba14d4 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.c +++ b/drivers/gpu/drm/radeon/rv770_dpm.c @@ -2393,8 +2393,7 @@ int rv770_dpm_init(struct radeon_device *rdev) pi->dynamic_pcie_gen2 = true; - if (pi->gfx_clock_gating && - (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) + if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) pi->thermal_protection = true; else pi->thermal_protection = false; diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 41825575b403..dc06e433048a 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -6366,8 +6366,7 @@ int si_dpm_init(struct radeon_device *rdev) eg_pi->sclk_deep_sleep = true; si_pi->sclk_deep_sleep_above_low = false; - if (pi->gfx_clock_gating && - (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) + if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) pi->thermal_protection = true; else pi->thermal_protection = false; From b841ce7b41ffbecf84285b381b3ac23f05256d31 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Wed, 31 Jul 2013 18:32:33 -0400 Subject: [PATCH 870/913] drm/radeon/dpm: fix spread spectrum setup (v2) Need to check for engine and memory clock ss separately and only enable dynamic ss if either of them are found. This should fix systems which have a ss table, but do not have entries for engine or memory. On those systems we may enable dynamic spread spectrum without enabling it on the engine or memory clocks which can lead to a hang in some cases. fixes some systems reported here: https://bugs.freedesktop.org/show_bug.cgi?id=66963 v2: fix typo Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/btc_dpm.c | 14 +------------ drivers/gpu/drm/radeon/cypress_dpm.c | 14 +------------ drivers/gpu/drm/radeon/ni_dpm.c | 14 +------------ drivers/gpu/drm/radeon/rv6xx_dpm.c | 19 ++++++++---------- drivers/gpu/drm/radeon/rv770_dpm.c | 30 ++++++++++++++++------------ drivers/gpu/drm/radeon/rv770_dpm.h | 1 + drivers/gpu/drm/radeon/si_dpm.c | 14 +------------ 7 files changed, 30 insertions(+), 76 deletions(-) diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c index e7c128b48112..9953e1fbc46d 100644 --- a/drivers/gpu/drm/radeon/btc_dpm.c +++ b/drivers/gpu/drm/radeon/btc_dpm.c @@ -2548,9 +2548,6 @@ int btc_dpm_init(struct radeon_device *rdev) { struct rv7xx_power_info *pi; struct evergreen_power_info *eg_pi; - int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); - u16 data_offset, size; - u8 frev, crev; struct atom_clock_dividers dividers; int ret; @@ -2633,16 +2630,7 @@ int btc_dpm_init(struct radeon_device *rdev) eg_pi->vddci_control = radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); - if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, - &frev, &crev, &data_offset)) { - pi->sclk_ss = true; - pi->mclk_ss = true; - pi->dynamic_ss = true; - } else { - pi->sclk_ss = false; - pi->mclk_ss = false; - pi->dynamic_ss = true; - } + rv770_get_engine_memory_ss(rdev); pi->asi = RV770_ASI_DFLT; pi->pasi = CYPRESS_HASI_DFLT; diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c index c840e079be5b..7e5d0b570a30 100644 --- a/drivers/gpu/drm/radeon/cypress_dpm.c +++ b/drivers/gpu/drm/radeon/cypress_dpm.c @@ -2038,9 +2038,6 @@ int cypress_dpm_init(struct radeon_device *rdev) { struct rv7xx_power_info *pi; struct evergreen_power_info *eg_pi; - int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); - uint16_t data_offset, size; - uint8_t frev, crev; struct atom_clock_dividers dividers; int ret; @@ -2092,16 +2089,7 @@ int cypress_dpm_init(struct radeon_device *rdev) eg_pi->vddci_control = radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); - if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, - &frev, &crev, &data_offset)) { - pi->sclk_ss = true; - pi->mclk_ss = true; - pi->dynamic_ss = true; - } else { - pi->sclk_ss = false; - pi->mclk_ss = false; - pi->dynamic_ss = true; - } + rv770_get_engine_memory_ss(rdev); pi->asi = RV770_ASI_DFLT; pi->pasi = CYPRESS_HASI_DFLT; diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index c560318d3f19..f0f5f748938a 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c @@ -4067,9 +4067,6 @@ int ni_dpm_init(struct radeon_device *rdev) struct rv7xx_power_info *pi; struct evergreen_power_info *eg_pi; struct ni_power_info *ni_pi; - int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); - u16 data_offset, size; - u8 frev, crev; struct atom_clock_dividers dividers; int ret; @@ -4162,16 +4159,7 @@ int ni_dpm_init(struct radeon_device *rdev) eg_pi->vddci_control = radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); - if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, - &frev, &crev, &data_offset)) { - pi->sclk_ss = true; - pi->mclk_ss = true; - pi->dynamic_ss = true; - } else { - pi->sclk_ss = false; - pi->mclk_ss = false; - pi->dynamic_ss = true; - } + rv770_get_engine_memory_ss(rdev); pi->asi = RV770_ASI_DFLT; pi->pasi = CYPRESS_HASI_DFLT; diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c index 363018c60412..e44a90a359a5 100644 --- a/drivers/gpu/drm/radeon/rv6xx_dpm.c +++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c @@ -1944,9 +1944,7 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev) int rv6xx_dpm_init(struct radeon_device *rdev) { - int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); - uint16_t data_offset, size; - uint8_t frev, crev; + struct radeon_atom_ss ss; struct atom_clock_dividers dividers; struct rv6xx_power_info *pi; int ret; @@ -1989,16 +1987,15 @@ int rv6xx_dpm_init(struct radeon_device *rdev) pi->gfx_clock_gating = true; - if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, - &frev, &crev, &data_offset)) { - pi->sclk_ss = true; - pi->mclk_ss = true; + pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, + ASIC_INTERNAL_ENGINE_SS, 0); + pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, + ASIC_INTERNAL_MEMORY_SS, 0); + + if (pi->sclk_ss || pi->mclk_ss) pi->dynamic_ss = true; - } else { - pi->sclk_ss = false; - pi->mclk_ss = false; + else pi->dynamic_ss = false; - } pi->dynamic_pcie_gen2 = true; diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c index 2ae54bba14d4..094c67a29d0d 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.c +++ b/drivers/gpu/drm/radeon/rv770_dpm.c @@ -2319,12 +2319,25 @@ int rv7xx_parse_power_table(struct radeon_device *rdev) return 0; } +void rv770_get_engine_memory_ss(struct radeon_device *rdev) +{ + struct rv7xx_power_info *pi = rv770_get_pi(rdev); + struct radeon_atom_ss ss; + + pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, + ASIC_INTERNAL_ENGINE_SS, 0); + pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, + ASIC_INTERNAL_MEMORY_SS, 0); + + if (pi->sclk_ss || pi->mclk_ss) + pi->dynamic_ss = true; + else + pi->dynamic_ss = false; +} + int rv770_dpm_init(struct radeon_device *rdev) { struct rv7xx_power_info *pi; - int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); - uint16_t data_offset, size; - uint8_t frev, crev; struct atom_clock_dividers dividers; int ret; @@ -2369,16 +2382,7 @@ int rv770_dpm_init(struct radeon_device *rdev) pi->mvdd_control = radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0); - if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, - &frev, &crev, &data_offset)) { - pi->sclk_ss = true; - pi->mclk_ss = true; - pi->dynamic_ss = true; - } else { - pi->sclk_ss = false; - pi->mclk_ss = false; - pi->dynamic_ss = false; - } + rv770_get_engine_memory_ss(rdev); pi->asi = RV770_ASI_DFLT; pi->pasi = RV770_HASI_DFLT; diff --git a/drivers/gpu/drm/radeon/rv770_dpm.h b/drivers/gpu/drm/radeon/rv770_dpm.h index 96b1b2a62a8a..9244effc6b59 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.h +++ b/drivers/gpu/drm/radeon/rv770_dpm.h @@ -275,6 +275,7 @@ void rv770_set_uvd_clock_before_set_eng_clock(struct radeon_device *rdev, void rv770_set_uvd_clock_after_set_eng_clock(struct radeon_device *rdev, struct radeon_ps *new_ps, struct radeon_ps *old_ps); +void rv770_get_engine_memory_ss(struct radeon_device *rdev); /* smc */ int rv770_read_smc_soft_register(struct radeon_device *rdev, diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index dc06e433048a..71a993f1c8c4 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -6253,9 +6253,6 @@ int si_dpm_init(struct radeon_device *rdev) struct evergreen_power_info *eg_pi; struct ni_power_info *ni_pi; struct si_power_info *si_pi; - int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); - u16 data_offset, size; - u8 frev, crev; struct atom_clock_dividers dividers; int ret; u32 mask; @@ -6346,16 +6343,7 @@ int si_dpm_init(struct radeon_device *rdev) si_pi->vddc_phase_shed_control = radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, VOLTAGE_OBJ_PHASE_LUT); - if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, - &frev, &crev, &data_offset)) { - pi->sclk_ss = true; - pi->mclk_ss = true; - pi->dynamic_ss = true; - } else { - pi->sclk_ss = false; - pi->mclk_ss = false; - pi->dynamic_ss = true; - } + rv770_get_engine_memory_ss(rdev); pi->asi = RV770_ASI_DFLT; pi->pasi = CYPRESS_HASI_DFLT; From 797f203f622164a322b9a0f962ce431e3f6ca48e Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Thu, 1 Aug 2013 11:54:07 -0400 Subject: [PATCH 871/913] drm/radeon/dpm: adjust power state properly for UVD on SI There are some hardware issue with reclocking on SI when UVD is active, so use a stable power state when UVD is active. Fixes possible hangs and performance issues when using UVD on SI. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/si_dpm.c | 44 ++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 71a993f1c8c4..88699e3cd868 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -2903,7 +2903,8 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, { struct ni_ps *ps = ni_get_ps(rps); struct radeon_clock_and_voltage_limits *max_limits; - bool disable_mclk_switching; + bool disable_mclk_switching = false; + bool disable_sclk_switching = false; u32 mclk, sclk; u16 vddc, vddci; int i; @@ -2911,8 +2912,11 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, if ((rdev->pm.dpm.new_active_crtc_count > 1) || ni_dpm_vblank_too_short(rdev)) disable_mclk_switching = true; - else - disable_mclk_switching = false; + + if (rps->vclk || rps->dclk) { + disable_mclk_switching = true; + disable_sclk_switching = true; + } if (rdev->pm.dpm.ac_power) max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; @@ -2940,27 +2944,43 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, if (disable_mclk_switching) { mclk = ps->performance_levels[ps->performance_level_count - 1].mclk; - sclk = ps->performance_levels[0].sclk; - vddc = ps->performance_levels[0].vddc; vddci = ps->performance_levels[ps->performance_level_count - 1].vddci; } else { - sclk = ps->performance_levels[0].sclk; mclk = ps->performance_levels[0].mclk; - vddc = ps->performance_levels[0].vddc; vddci = ps->performance_levels[0].vddci; } + if (disable_sclk_switching) { + sclk = ps->performance_levels[ps->performance_level_count - 1].sclk; + vddc = ps->performance_levels[ps->performance_level_count - 1].vddc; + } else { + sclk = ps->performance_levels[0].sclk; + vddc = ps->performance_levels[0].vddc; + } + /* adjusted low state */ ps->performance_levels[0].sclk = sclk; ps->performance_levels[0].mclk = mclk; ps->performance_levels[0].vddc = vddc; ps->performance_levels[0].vddci = vddci; - for (i = 1; i < ps->performance_level_count; i++) { - if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk) - ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk; - if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc) - ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; + if (disable_sclk_switching) { + sclk = ps->performance_levels[0].sclk; + for (i = 1; i < ps->performance_level_count; i++) { + if (sclk < ps->performance_levels[i].sclk) + sclk = ps->performance_levels[i].sclk; + } + for (i = 0; i < ps->performance_level_count; i++) { + ps->performance_levels[i].sclk = sclk; + ps->performance_levels[i].vddc = vddc; + } + } else { + for (i = 1; i < ps->performance_level_count; i++) { + if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk) + ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk; + if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc) + ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; + } } if (disable_mclk_switching) { From 2858c00d2823c83acce2a1175dbabb2cebee8678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com> Date: Thu, 1 Aug 2013 17:34:07 +0200 Subject: [PATCH 872/913] drm/radeon: fix halting UVD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing the clock/power or resetting the VCPU can cause hangs if that happens in the middle of a register write. Stall the memory and register bus before putting the VCPU into reset. Keep it in reset when unloading the module or suspending. Signed-off-by: Christian König <christian.koenig@amd.com> Cc: stable@vger.kernel.org Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/cik.c | 3 ++- drivers/gpu/drm/radeon/evergreen.c | 3 ++- drivers/gpu/drm/radeon/ni.c | 3 ++- drivers/gpu/drm/radeon/r600.c | 28 +++++++++++++++++++++++----- drivers/gpu/drm/radeon/radeon_asic.h | 2 +- drivers/gpu/drm/radeon/rv770.c | 2 ++ drivers/gpu/drm/radeon/si.c | 6 ++++-- 7 files changed, 36 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 6dacec4e2090..524db70aaf6e 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c @@ -6194,7 +6194,7 @@ int cik_suspend(struct radeon_device *rdev) radeon_vm_manager_fini(rdev); cik_cp_enable(rdev, false); cik_sdma_enable(rdev, false); - r600_uvd_rbc_stop(rdev); + r600_uvd_stop(rdev); radeon_uvd_suspend(rdev); cik_irq_suspend(rdev); radeon_wb_disable(rdev); @@ -6358,6 +6358,7 @@ void cik_fini(struct radeon_device *rdev) radeon_vm_manager_fini(rdev); radeon_ib_pool_fini(rdev); radeon_irq_kms_fini(rdev); + r600_uvd_stop(rdev); radeon_uvd_fini(rdev); cik_pcie_gart_fini(rdev); r600_vram_scratch_fini(rdev); diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 038dcac7670c..5b98e573d60a 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c @@ -5291,10 +5291,10 @@ int evergreen_resume(struct radeon_device *rdev) int evergreen_suspend(struct radeon_device *rdev) { r600_audio_fini(rdev); + r600_uvd_stop(rdev); radeon_uvd_suspend(rdev); r700_cp_stop(rdev); r600_dma_stop(rdev); - r600_uvd_rbc_stop(rdev); evergreen_irq_suspend(rdev); radeon_wb_disable(rdev); evergreen_pcie_gart_disable(rdev); @@ -5429,6 +5429,7 @@ void evergreen_fini(struct radeon_device *rdev) radeon_ib_pool_fini(rdev); radeon_irq_kms_fini(rdev); evergreen_pcie_gart_fini(rdev); + r600_uvd_stop(rdev); radeon_uvd_fini(rdev); r600_vram_scratch_fini(rdev); radeon_gem_fini(rdev); diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 56bd4f3be4fe..16e91b08bf57 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c @@ -2286,7 +2286,7 @@ int cayman_suspend(struct radeon_device *rdev) radeon_vm_manager_fini(rdev); cayman_cp_enable(rdev, false); cayman_dma_stop(rdev); - r600_uvd_rbc_stop(rdev); + r600_uvd_stop(rdev); radeon_uvd_suspend(rdev); evergreen_irq_suspend(rdev); radeon_wb_disable(rdev); @@ -2418,6 +2418,7 @@ void cayman_fini(struct radeon_device *rdev) radeon_vm_manager_fini(rdev); radeon_ib_pool_fini(rdev); radeon_irq_kms_fini(rdev); + r600_uvd_stop(rdev); radeon_uvd_fini(rdev); cayman_pcie_gart_fini(rdev); r600_vram_scratch_fini(rdev); diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 10f712e37003..0a9553abec54 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -2697,12 +2697,29 @@ int r600_uvd_rbc_start(struct radeon_device *rdev) return 0; } -void r600_uvd_rbc_stop(struct radeon_device *rdev) +void r600_uvd_stop(struct radeon_device *rdev) { struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; /* force RBC into idle state */ WREG32(UVD_RBC_RB_CNTL, 0x11010101); + + /* Stall UMC and register bus before resetting VCPU */ + WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); + WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); + mdelay(1); + + /* put VCPU into reset */ + WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); + mdelay(5); + + /* disable VCPU clock */ + WREG32(UVD_VCPU_CNTL, 0x0); + + /* Unstall UMC and register bus */ + WREG32_P(UVD_LMI_CTRL2, 0, ~(1 << 8)); + WREG32_P(UVD_RB_ARB_CTRL, 0, ~(1 << 3)); + ring->ready = false; } @@ -2722,6 +2739,11 @@ int r600_uvd_init(struct radeon_device *rdev) /* disable interupt */ WREG32_P(UVD_MASTINT_EN, 0, ~(1 << 1)); + /* Stall UMC and register bus before resetting VCPU */ + WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); + WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); + mdelay(1); + /* put LMI, VCPU, RBC etc... into reset */ WREG32(UVD_SOFT_RESET, LMI_SOFT_RESET | VCPU_SOFT_RESET | LBSI_SOFT_RESET | RBC_SOFT_RESET | CSM_SOFT_RESET | @@ -2751,10 +2773,6 @@ int r600_uvd_init(struct radeon_device *rdev) WREG32(UVD_MPC_SET_ALU, 0); WREG32(UVD_MPC_SET_MUX, 0x88); - /* Stall UMC */ - WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); - WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); - /* take all subblocks out of reset, except VCPU */ WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); mdelay(5); diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 902479fa737f..3d61d5aac18f 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h @@ -441,7 +441,7 @@ void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rde /* uvd */ int r600_uvd_init(struct radeon_device *rdev); int r600_uvd_rbc_start(struct radeon_device *rdev); -void r600_uvd_rbc_stop(struct radeon_device *rdev); +void r600_uvd_stop(struct radeon_device *rdev); int r600_uvd_ib_test(struct radeon_device *rdev, struct radeon_ring *ring); void r600_uvd_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence); diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 30ea14e8854c..f1010131bac0 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c @@ -1983,6 +1983,7 @@ int rv770_resume(struct radeon_device *rdev) int rv770_suspend(struct radeon_device *rdev) { r600_audio_fini(rdev); + r600_uvd_stop(rdev); radeon_uvd_suspend(rdev); r700_cp_stop(rdev); r600_dma_stop(rdev); @@ -2098,6 +2099,7 @@ void rv770_fini(struct radeon_device *rdev) radeon_ib_pool_fini(rdev); radeon_irq_kms_fini(rdev); rv770_pcie_gart_fini(rdev); + r600_uvd_stop(rdev); radeon_uvd_fini(rdev); r600_vram_scratch_fini(rdev); radeon_gem_fini(rdev); diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 6ca904673a4f..242c1ac83e23 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -6621,7 +6621,7 @@ int si_suspend(struct radeon_device *rdev) si_cp_enable(rdev, false); cayman_dma_stop(rdev); if (rdev->has_uvd) { - r600_uvd_rbc_stop(rdev); + r600_uvd_stop(rdev); radeon_uvd_suspend(rdev); } si_irq_suspend(rdev); @@ -6763,8 +6763,10 @@ void si_fini(struct radeon_device *rdev) radeon_vm_manager_fini(rdev); radeon_ib_pool_fini(rdev); radeon_irq_kms_fini(rdev); - if (rdev->has_uvd) + if (rdev->has_uvd) { + r600_uvd_stop(rdev); radeon_uvd_fini(rdev); + } si_pcie_gart_fini(rdev); r600_vram_scratch_fini(rdev); radeon_gem_fini(rdev); From ce149a9406c104e7a361afae18a13d4eaa5c2429 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Thu, 1 Aug 2013 14:35:02 -0400 Subject: [PATCH 873/913] drm/radeon/dpm: disable sclk ss on rv6xx Enabling spread spectrum on the engine clock leads to hangs on some asics. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=66963 Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/rv6xx_dpm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c index e44a90a359a5..bdd888b4db2b 100644 --- a/drivers/gpu/drm/radeon/rv6xx_dpm.c +++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c @@ -1992,6 +1992,9 @@ int rv6xx_dpm_init(struct radeon_device *rdev) pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, ASIC_INTERNAL_MEMORY_SS, 0); + /* Disable sclk ss, causes hangs on a lot of systems */ + pi->sclk_ss = false; + if (pi->sclk_ss || pi->mclk_ss) pi->dynamic_ss = true; else From 1518dd8efd47918bb269f1470030592875953f6c Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Tue, 30 Jul 2013 17:31:07 -0400 Subject: [PATCH 874/913] drm/radeon: fix audio dto calculation on DCE3+ (v3) Need to set the wallclock ratio and adjust the phase and module registers appropriately. May fix problems with audio timing at certain display timings. v2: properly handle clocks below 24mhz v3: rebase r600 changes Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/evergreen_hdmi.c | 26 +++++++++++++++++-- drivers/gpu/drm/radeon/evergreend.h | 3 +++ drivers/gpu/drm/radeon/r600_hdmi.c | 33 ++++++++++++++++++++++--- drivers/gpu/drm/radeon/r600d.h | 3 +++ 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index bb9ea3641312..b0e280058b9b 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c @@ -148,18 +148,40 @@ static void evergreen_audio_set_dto(struct drm_encoder *encoder, u32 clock) struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); u32 base_rate = 24000; + u32 max_ratio = clock / base_rate; + u32 dto_phase; + u32 dto_modulo = clock; + u32 wallclock_ratio; + u32 dto_cntl; if (!dig || !dig->afmt) return; + if (max_ratio >= 8) { + dto_phase = 192 * 1000; + wallclock_ratio = 3; + } else if (max_ratio >= 4) { + dto_phase = 96 * 1000; + wallclock_ratio = 2; + } else if (max_ratio >= 2) { + dto_phase = 48 * 1000; + wallclock_ratio = 1; + } else { + dto_phase = 24 * 1000; + wallclock_ratio = 0; + } + dto_cntl = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; + dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); + WREG32(DCCG_AUDIO_DTO0_CNTL, dto_cntl); + /* XXX two dtos; generally use dto0 for hdmi */ /* Express [24MHz / target pixel clock] as an exact rational * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator */ WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); - WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); - WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); + WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase); + WREG32(DCCG_AUDIO_DTO0_MODULE, dto_modulo); } diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index a7baf67aef6c..0d582ac1dc31 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h @@ -497,6 +497,9 @@ #define DCCG_AUDIO_DTO0_MODULE 0x05b4 #define DCCG_AUDIO_DTO0_LOAD 0x05b8 #define DCCG_AUDIO_DTO0_CNTL 0x05bc +# define DCCG_AUDIO_DTO_WALLCLOCK_RATIO(x) (((x) & 7) << 0) +# define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK 7 +# define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_SHIFT 0 #define DCCG_AUDIO_DTO1_PHASE 0x05c0 #define DCCG_AUDIO_DTO1_MODULE 0x05c4 diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index b9b1139da356..f264df5470f7 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c @@ -226,10 +226,29 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; u32 base_rate = 24000; + u32 max_ratio = clock / base_rate; + u32 dto_phase; + u32 dto_modulo = clock; + u32 wallclock_ratio; + u32 dto_cntl; if (!dig || !dig->afmt) return; + if (max_ratio >= 8) { + dto_phase = 192 * 1000; + wallclock_ratio = 3; + } else if (max_ratio >= 4) { + dto_phase = 96 * 1000; + wallclock_ratio = 2; + } else if (max_ratio >= 2) { + dto_phase = 48 * 1000; + wallclock_ratio = 1; + } else { + dto_phase = 24 * 1000; + wallclock_ratio = 0; + } + /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT. * doesn't matter which one you use. Just use the first one. */ @@ -243,12 +262,18 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) * practice it seems to cover DCE3.0 as well. */ if (dig->dig_encoder == 0) { - WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); - WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); + dto_cntl = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; + dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); + WREG32(DCCG_AUDIO_DTO0_CNTL, dto_cntl); + WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase); + WREG32(DCCG_AUDIO_DTO0_MODULE, dto_modulo); WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ } else { - WREG32(DCCG_AUDIO_DTO1_PHASE, base_rate * 100); - WREG32(DCCG_AUDIO_DTO1_MODULE, clock * 100); + dto_cntl = RREG32(DCCG_AUDIO_DTO1_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; + dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); + WREG32(DCCG_AUDIO_DTO1_CNTL, dto_cntl); + WREG32(DCCG_AUDIO_DTO1_PHASE, dto_phase); + WREG32(DCCG_AUDIO_DTO1_MODULE, dto_modulo); WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */ } } else { diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index 8e3fe815edab..7c780839a7f4 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h @@ -933,6 +933,9 @@ #define DCCG_AUDIO_DTO0_LOAD 0x051c # define DTO_LOAD (1 << 31) #define DCCG_AUDIO_DTO0_CNTL 0x0520 +# define DCCG_AUDIO_DTO_WALLCLOCK_RATIO(x) (((x) & 7) << 0) +# define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK 7 +# define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_SHIFT 0 #define DCCG_AUDIO_DTO1_PHASE 0x0524 #define DCCG_AUDIO_DTO1_MODULE 0x0528 From 6fab3febf6d949b0a12b1e4e73db38e4a177a79e Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Sun, 4 Aug 2013 12:13:17 -0400 Subject: [PATCH 875/913] drm/radeon: always program the MC on startup For r6xx+ asics. This mirrors the behavior of pre-r6xx asics. We need to program the MC even if something else in startup() fails. Failure to do so results in an unusable GPU. Based on a fix from: Mark Kettenis <kettenis@openbsd.org> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org --- drivers/gpu/drm/radeon/cik.c | 3 ++- drivers/gpu/drm/radeon/evergreen.c | 3 ++- drivers/gpu/drm/radeon/ni.c | 3 ++- drivers/gpu/drm/radeon/r600.c | 3 ++- drivers/gpu/drm/radeon/rv770.c | 3 ++- drivers/gpu/drm/radeon/si.c | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 524db70aaf6e..5b587876c7f5 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c @@ -5954,6 +5954,8 @@ static int cik_startup(struct radeon_device *rdev) struct radeon_ring *ring; int r; + cik_mc_program(rdev); + if (rdev->flags & RADEON_IS_IGP) { if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw) { @@ -5985,7 +5987,6 @@ static int cik_startup(struct radeon_device *rdev) if (r) return r; - cik_mc_program(rdev); r = cik_pcie_gart_enable(rdev); if (r) return r; diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 5b98e573d60a..d5b49e33315e 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c @@ -5106,6 +5106,8 @@ static int evergreen_startup(struct radeon_device *rdev) /* enable aspm */ evergreen_program_aspm(rdev); + evergreen_mc_program(rdev); + if (ASIC_IS_DCE5(rdev)) { if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { r = ni_init_microcode(rdev); @@ -5133,7 +5135,6 @@ static int evergreen_startup(struct radeon_device *rdev) if (r) return r; - evergreen_mc_program(rdev); if (rdev->flags & RADEON_IS_AGP) { evergreen_agp_enable(rdev); } else { diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 16e91b08bf57..12cebe46e34f 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c @@ -2079,6 +2079,8 @@ static int cayman_startup(struct radeon_device *rdev) /* enable aspm */ evergreen_program_aspm(rdev); + evergreen_mc_program(rdev); + if (rdev->flags & RADEON_IS_IGP) { if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { r = ni_init_microcode(rdev); @@ -2107,7 +2109,6 @@ static int cayman_startup(struct radeon_device *rdev) if (r) return r; - evergreen_mc_program(rdev); r = cayman_pcie_gart_enable(rdev); if (r) return r; diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 0a9553abec54..af848045670c 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -3330,6 +3330,8 @@ static int r600_startup(struct radeon_device *rdev) /* enable pcie gen2 link */ r600_pcie_gen2_enable(rdev); + r600_mc_program(rdev); + if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { r = r600_init_microcode(rdev); if (r) { @@ -3342,7 +3344,6 @@ static int r600_startup(struct radeon_device *rdev) if (r) return r; - r600_mc_program(rdev); if (rdev->flags & RADEON_IS_AGP) { r600_agp_enable(rdev); } else { diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index f1010131bac0..3cc08a4d99d9 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c @@ -1829,6 +1829,8 @@ static int rv770_startup(struct radeon_device *rdev) /* enable pcie gen2 link */ rv770_pcie_gen2_enable(rdev); + rv770_mc_program(rdev); + if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { r = r600_init_microcode(rdev); if (r) { @@ -1841,7 +1843,6 @@ static int rv770_startup(struct radeon_device *rdev) if (r) return r; - rv770_mc_program(rdev); if (rdev->flags & RADEON_IS_AGP) { rv770_agp_enable(rdev); } else { diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 242c1ac83e23..6a2dca4acfc1 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -6418,6 +6418,8 @@ static int si_startup(struct radeon_device *rdev) /* enable aspm */ si_program_aspm(rdev); + si_mc_program(rdev); + if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || !rdev->rlc_fw || !rdev->mc_fw) { r = si_init_microcode(rdev); @@ -6437,7 +6439,6 @@ static int si_startup(struct radeon_device *rdev) if (r) return r; - si_mc_program(rdev); r = si_pcie_gart_enable(rdev); if (r) return r; From 4ad9c1c774c2af152283f510062094e768876f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com> Date: Mon, 5 Aug 2013 14:10:55 +0200 Subject: [PATCH 876/913] drm/radeon: only save UVD bo when we have open handles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise just reinitialize from scratch on resume, and so make it more likely to succeed. Signed-off-by: Christian König <christian.koenig@amd.com> Cc: stable@vger.kernel.org Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/cik.c | 2 +- drivers/gpu/drm/radeon/radeon.h | 2 +- drivers/gpu/drm/radeon/radeon_fence.c | 2 +- drivers/gpu/drm/radeon/radeon_uvd.c | 46 +++++++++++++++++++-------- drivers/gpu/drm/radeon/rv770.c | 2 +- 5 files changed, 37 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 5b587876c7f5..58136f20c060 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c @@ -6980,7 +6980,7 @@ int cik_uvd_resume(struct radeon_device *rdev) /* programm the VCPU memory controller bits 0-27 */ addr = rdev->uvd.gpu_addr >> 3; - size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3; + size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3; WREG32(UVD_VCPU_CACHE_OFFSET0, addr); WREG32(UVD_VCPU_CACHE_SIZE0, size); diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 2f08219c39b6..76dbe8e9b5c8 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -1468,7 +1468,6 @@ struct radeon_uvd { void *cpu_addr; uint64_t gpu_addr; void *saved_bo; - unsigned fw_size; atomic_t handles[RADEON_MAX_UVD_HANDLES]; struct drm_file *filp[RADEON_MAX_UVD_HANDLES]; struct delayed_work idle_work; @@ -2066,6 +2065,7 @@ struct radeon_device { const struct firmware *mec_fw; /* CIK MEC firmware */ const struct firmware *sdma_fw; /* CIK SDMA firmware */ const struct firmware *smc_fw; /* SMC firmware */ + const struct firmware *uvd_fw; /* UVD firmware */ struct r600_blit r600_blit; struct r600_vram_scratch vram_scratch; int msi_enabled; /* msi enabled */ diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 7ddb0efe2408..ddb8f8e04eb5 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -782,7 +782,7 @@ int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring) } else { /* put fence directly behind firmware */ - index = ALIGN(rdev->uvd.fw_size, 8); + index = ALIGN(rdev->uvd_fw->size, 8); rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index; rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index; } diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 414fd145d20e..ca0d7358ed33 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c @@ -56,7 +56,6 @@ static void radeon_uvd_idle_work_handler(struct work_struct *work); int radeon_uvd_init(struct radeon_device *rdev) { - const struct firmware *fw; unsigned long bo_size; const char *fw_name; int i, r; @@ -105,14 +104,14 @@ int radeon_uvd_init(struct radeon_device *rdev) return -EINVAL; } - r = request_firmware(&fw, fw_name, rdev->dev); + r = request_firmware(&rdev->uvd_fw, fw_name, rdev->dev); if (r) { dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n", fw_name); return r; } - bo_size = RADEON_GPU_PAGE_ALIGN(fw->size + 8) + + bo_size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 8) + RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE; r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo); @@ -145,12 +144,6 @@ int radeon_uvd_init(struct radeon_device *rdev) radeon_bo_unreserve(rdev->uvd.vcpu_bo); - rdev->uvd.fw_size = fw->size; - memset(rdev->uvd.cpu_addr, 0, bo_size); - memcpy(rdev->uvd.cpu_addr, fw->data, fw->size); - - release_firmware(fw); - for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { atomic_set(&rdev->uvd.handles[i], 0); rdev->uvd.filp[i] = NULL; @@ -174,33 +167,60 @@ void radeon_uvd_fini(struct radeon_device *rdev) } radeon_bo_unref(&rdev->uvd.vcpu_bo); + + release_firmware(rdev->uvd_fw); } int radeon_uvd_suspend(struct radeon_device *rdev) { unsigned size; + void *ptr; + int i; if (rdev->uvd.vcpu_bo == NULL) return 0; + for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) + if (atomic_read(&rdev->uvd.handles[i])) + break; + + if (i == RADEON_MAX_UVD_HANDLES) + return 0; + size = radeon_bo_size(rdev->uvd.vcpu_bo); + size -= rdev->uvd_fw->size; + + ptr = rdev->uvd.cpu_addr; + ptr += rdev->uvd_fw->size; + rdev->uvd.saved_bo = kmalloc(size, GFP_KERNEL); - memcpy(rdev->uvd.saved_bo, rdev->uvd.cpu_addr, size); + memcpy(rdev->uvd.saved_bo, ptr, size); return 0; } int radeon_uvd_resume(struct radeon_device *rdev) { + unsigned size; + void *ptr; + if (rdev->uvd.vcpu_bo == NULL) return -EINVAL; + memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size); + + size = radeon_bo_size(rdev->uvd.vcpu_bo); + size -= rdev->uvd_fw->size; + + ptr = rdev->uvd.cpu_addr; + ptr += rdev->uvd_fw->size; + if (rdev->uvd.saved_bo != NULL) { - unsigned size = radeon_bo_size(rdev->uvd.vcpu_bo); - memcpy(rdev->uvd.cpu_addr, rdev->uvd.saved_bo, size); + memcpy(ptr, rdev->uvd.saved_bo, size); kfree(rdev->uvd.saved_bo); rdev->uvd.saved_bo = NULL; - } + } else + memset(ptr, 0, size); return 0; } diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 3cc08a4d99d9..bcc68ec204ad 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c @@ -813,7 +813,7 @@ int rv770_uvd_resume(struct radeon_device *rdev) /* programm the VCPU memory controller bits 0-27 */ addr = rdev->uvd.gpu_addr >> 3; - size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3; + size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3; WREG32(UVD_VCPU_CACHE_OFFSET0, addr); WREG32(UVD_VCPU_CACHE_SIZE0, size); From 641a00593f7d07eab778fbabf546fb68fff3d5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com> Date: Mon, 5 Aug 2013 14:10:56 +0200 Subject: [PATCH 877/913] drm/radeon: stop sending invalid UVD destroy msg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We also need to check the handle. Signed-off-by: Christian König <christian.koenig@amd.com> Cc: stable@vger.kernel.org Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/radeon_uvd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index ca0d7358ed33..4fec195e0dd4 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c @@ -235,8 +235,8 @@ void radeon_uvd_free_handles(struct radeon_device *rdev, struct drm_file *filp) { int i, r; for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { - if (rdev->uvd.filp[i] == filp) { - uint32_t handle = atomic_read(&rdev->uvd.handles[i]); + uint32_t handle = atomic_read(&rdev->uvd.handles[i]); + if (handle != 0 && rdev->uvd.filp[i] == filp) { struct radeon_fence *fence; r = radeon_uvd_get_destroy_msg(rdev, From 56cc2c15389770d2f95a791f73d0ab6b15d530e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com> Date: Mon, 5 Aug 2013 14:10:57 +0200 Subject: [PATCH 878/913] drm/radeon: add more UVD CS checking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve error handling in case userspace sends us an invalid command buffer. Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/radeon_uvd.c | 43 +++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 4fec195e0dd4..f1c15754e73c 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c @@ -357,8 +357,10 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, } r = radeon_bo_kmap(bo, &ptr); - if (r) + if (r) { + DRM_ERROR("Failed mapping the UVD message (%d)!\n", r); return r; + } msg = ptr + offset; @@ -384,8 +386,14 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, radeon_bo_kunmap(bo); return 0; } else { - /* it's a create msg, no special handling needed */ radeon_bo_kunmap(bo); + + if (msg_type != 0) { + DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type); + return -EINVAL; + } + + /* it's a create msg, no special handling needed */ } /* create or decode, validate the handle */ @@ -408,7 +416,7 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, int data0, int data1, - unsigned buf_sizes[]) + unsigned buf_sizes[], bool *has_msg_cmd) { struct radeon_cs_chunk *relocs_chunk; struct radeon_cs_reloc *reloc; @@ -437,7 +445,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, if (cmd < 0x4) { if ((end - start) < buf_sizes[cmd]) { - DRM_ERROR("buffer to small (%d / %d)!\n", + DRM_ERROR("buffer (%d) to small (%d / %d)!\n", cmd, (unsigned)(end - start), buf_sizes[cmd]); return -EINVAL; } @@ -462,9 +470,17 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, } if (cmd == 0) { + if (*has_msg_cmd) { + DRM_ERROR("More than one message in a UVD-IB!\n"); + return -EINVAL; + } + *has_msg_cmd = true; r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes); if (r) return r; + } else if (!*has_msg_cmd) { + DRM_ERROR("Message needed before other commands are send!\n"); + return -EINVAL; } return 0; @@ -473,7 +489,8 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, struct radeon_cs_packet *pkt, int *data0, int *data1, - unsigned buf_sizes[]) + unsigned buf_sizes[], + bool *has_msg_cmd) { int i, r; @@ -487,7 +504,8 @@ static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, *data1 = p->idx; break; case UVD_GPCOM_VCPU_CMD: - r = radeon_uvd_cs_reloc(p, *data0, *data1, buf_sizes); + r = radeon_uvd_cs_reloc(p, *data0, *data1, + buf_sizes, has_msg_cmd); if (r) return r; break; @@ -508,6 +526,9 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) struct radeon_cs_packet pkt; int r, data0 = 0, data1 = 0; + /* does the IB has a msg command */ + bool has_msg_cmd = false; + /* minimum buffer sizes */ unsigned buf_sizes[] = { [0x00000000] = 2048, @@ -534,8 +555,8 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) return r; switch (pkt.type) { case RADEON_PACKET_TYPE0: - r = radeon_uvd_cs_reg(p, &pkt, &data0, - &data1, buf_sizes); + r = radeon_uvd_cs_reg(p, &pkt, &data0, &data1, + buf_sizes, &has_msg_cmd); if (r) return r; break; @@ -547,6 +568,12 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) return -EINVAL; } } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); + + if (!has_msg_cmd) { + DRM_ERROR("UVD-IBs need a msg command!\n"); + return -EINVAL; + } + return 0; } From 3744b248f9c617295f1fd015d67281a67e592ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com> Date: Mon, 5 Aug 2013 14:10:58 +0200 Subject: [PATCH 879/913] drm/radeon: remove unnecessary unpin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't pin the BO on allocation, so don't unpin it on free. Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/radeon_gart.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 6a51d943ccf4..b990b1a2bd50 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c @@ -207,7 +207,6 @@ void radeon_gart_table_vram_free(struct radeon_device *rdev) if (rdev->gart.robj == NULL) { return; } - radeon_gart_table_vram_unpin(rdev); radeon_bo_unref(&rdev->gart.robj); } From f61d5b46771a352fad1ac7f99008ef52a7ffcb72 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Tue, 6 Aug 2013 12:40:16 -0400 Subject: [PATCH 880/913] drm/radeon/cik: use a mutex to properly lock srbm instanced registers We need proper locking in the driver when accessing instanced registers on CIK. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/cik.c | 10 ++++++++++ drivers/gpu/drm/radeon/radeon.h | 2 ++ drivers/gpu/drm/radeon/radeon_device.c | 1 + 3 files changed, 13 insertions(+) diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 58136f20c060..8928bd109c16 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c @@ -2587,9 +2587,11 @@ u32 cik_compute_ring_get_rptr(struct radeon_device *rdev, if (rdev->wb.enabled) { rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); } else { + mutex_lock(&rdev->srbm_mutex); cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); rptr = RREG32(CP_HQD_PQ_RPTR); cik_srbm_select(rdev, 0, 0, 0, 0); + mutex_unlock(&rdev->srbm_mutex); } rptr = (rptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; @@ -2604,9 +2606,11 @@ u32 cik_compute_ring_get_wptr(struct radeon_device *rdev, if (rdev->wb.enabled) { wptr = le32_to_cpu(rdev->wb.wb[ring->wptr_offs/4]); } else { + mutex_lock(&rdev->srbm_mutex); cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); wptr = RREG32(CP_HQD_PQ_WPTR); cik_srbm_select(rdev, 0, 0, 0, 0); + mutex_unlock(&rdev->srbm_mutex); } wptr = (wptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; @@ -2897,6 +2901,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) WREG32(CP_CPF_DEBUG, tmp); /* init the pipes */ + mutex_lock(&rdev->srbm_mutex); for (i = 0; i < (rdev->mec.num_pipe * rdev->mec.num_mec); i++) { int me = (i < 4) ? 1 : 2; int pipe = (i < 4) ? i : (i - 4); @@ -2919,6 +2924,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) WREG32(CP_HPD_EOP_CONTROL, tmp); } cik_srbm_select(rdev, 0, 0, 0, 0); + mutex_unlock(&rdev->srbm_mutex); /* init the queues. Just two for now. */ for (i = 0; i < 2; i++) { @@ -2972,6 +2978,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) mqd->static_thread_mgmt23[0] = 0xffffffff; mqd->static_thread_mgmt23[1] = 0xffffffff; + mutex_lock(&rdev->srbm_mutex); cik_srbm_select(rdev, rdev->ring[idx].me, rdev->ring[idx].pipe, rdev->ring[idx].queue, 0); @@ -3099,6 +3106,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) WREG32(CP_HQD_ACTIVE, mqd->queue_state.cp_hqd_active); cik_srbm_select(rdev, 0, 0, 0, 0); + mutex_unlock(&rdev->srbm_mutex); radeon_bo_kunmap(rdev->ring[idx].mqd_obj); radeon_bo_unreserve(rdev->ring[idx].mqd_obj); @@ -4320,6 +4328,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) /* XXX SH_MEM regs */ /* where to put LDS, scratch, GPUVM in FSA64 space */ + mutex_lock(&rdev->srbm_mutex); for (i = 0; i < 16; i++) { cik_srbm_select(rdev, 0, 0, 0, i); /* CP and shaders */ @@ -4335,6 +4344,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) /* XXX SDMA RLC - todo */ } cik_srbm_select(rdev, 0, 0, 0, 0); + mutex_unlock(&rdev->srbm_mutex); cik_pcie_gart_tlb_flush(rdev); DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 76dbe8e9b5c8..274b8e1b889f 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -2095,6 +2095,8 @@ struct radeon_device { /* ACPI interface */ struct radeon_atif atif; struct radeon_atcs atcs; + /* srbm instance registers */ + struct mutex srbm_mutex; }; int radeon_device_init(struct radeon_device *rdev, diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 84dd2dcbcf69..63398ae1dbf5 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -1163,6 +1163,7 @@ int radeon_device_init(struct radeon_device *rdev, mutex_init(&rdev->gem.mutex); mutex_init(&rdev->pm.mutex); mutex_init(&rdev->gpu_clock_mutex); + mutex_init(&rdev->srbm_mutex); init_rwsem(&rdev->pm.mclk_lock); init_rwsem(&rdev->exclusive_lock); init_waitqueue_head(&rdev->irq.vblank_queue); From 761bfb999868c413aabed8caa345694836ec6f11 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Tue, 6 Aug 2013 13:34:00 -0400 Subject: [PATCH 881/913] drm/radeon/dpm: require rlc for dpm The rlc is required for dpm to work properly, so if the rlc ucode is missing, don't enable dpm. Enabling dpm without the rlc enabled can result in hangs. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/radeon_pm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index f374c467aaca..6a7a80b8a00a 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -1176,7 +1176,10 @@ int radeon_pm_init(struct radeon_device *rdev) case CHIP_VERDE: case CHIP_OLAND: case CHIP_HAINAN: - if (radeon_dpm == 1) + /* DPM requires the RLC */ + if (!rdev->rlc_fw) + rdev->pm.pm_method = PM_METHOD_PROFILE; + else if (radeon_dpm == 1) rdev->pm.pm_method = PM_METHOD_DPM; else rdev->pm.pm_method = PM_METHOD_PROFILE; From 8a53fa23fd3e7c22d93f28e6aaae8358c53326ba Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Wed, 7 Aug 2013 16:09:08 -0400 Subject: [PATCH 882/913] drm/radeon: make missing smc ucode non-fatal The smc ucode is required for dpm (dynamic power management), but if it's missing just skip dpm setup and don't disable acceleration. Should fix: https://bugs.freedesktop.org/show_bug.cgi?id=67876 Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/ni.c | 10 +++++++--- drivers/gpu/drm/radeon/r600.c | 10 +++++++--- drivers/gpu/drm/radeon/radeon_pm.c | 6 +++++- drivers/gpu/drm/radeon/si.c | 10 +++++++--- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 12cebe46e34f..ccb4f8b54852 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c @@ -794,9 +794,13 @@ int ni_init_microcode(struct radeon_device *rdev) if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) { snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); - if (err) - goto out; - if (rdev->smc_fw->size != smc_req_size) { + if (err) { + printk(KERN_ERR + "smc: error loading firmware \"%s\"\n", + fw_name); + release_firmware(rdev->smc_fw); + rdev->smc_fw = NULL; + } else if (rdev->smc_fw->size != smc_req_size) { printk(KERN_ERR "ni_mc: Bogus length %zu in firmware \"%s\"\n", rdev->mc_fw->size, fw_name); diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index af848045670c..e66e72077350 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -2299,9 +2299,13 @@ int r600_init_microcode(struct radeon_device *rdev) if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) { snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name); err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); - if (err) - goto out; - if (rdev->smc_fw->size != smc_req_size) { + if (err) { + printk(KERN_ERR + "smc: error loading firmware \"%s\"\n", + fw_name); + release_firmware(rdev->smc_fw); + rdev->smc_fw = NULL; + } else if (rdev->smc_fw->size != smc_req_size) { printk(KERN_ERR "smc: Bogus length %zu in firmware \"%s\"\n", rdev->smc_fw->size, fw_name); diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 6a7a80b8a00a..c557850cd345 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -1176,9 +1176,13 @@ int radeon_pm_init(struct radeon_device *rdev) case CHIP_VERDE: case CHIP_OLAND: case CHIP_HAINAN: - /* DPM requires the RLC */ + /* DPM requires the RLC, RV770+ dGPU requires SMC */ if (!rdev->rlc_fw) rdev->pm.pm_method = PM_METHOD_PROFILE; + else if ((rdev->family >= CHIP_RV770) && + (!(rdev->flags & RADEON_IS_IGP)) && + (!rdev->smc_fw)) + rdev->pm.pm_method = PM_METHOD_PROFILE; else if (radeon_dpm == 1) rdev->pm.pm_method = PM_METHOD_DPM; else diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 6a2dca4acfc1..daa8d2df8ec5 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -1663,9 +1663,13 @@ static int si_init_microcode(struct radeon_device *rdev) snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); - if (err) - goto out; - if (rdev->smc_fw->size != smc_req_size) { + if (err) { + printk(KERN_ERR + "smc: error loading firmware \"%s\"\n", + fw_name); + release_firmware(rdev->smc_fw); + rdev->smc_fw = NULL; + } else if (rdev->smc_fw->size != smc_req_size) { printk(KERN_ERR "si_smc: Bogus length %zu in firmware \"%s\"\n", rdev->smc_fw->size, fw_name); From e91abf80a0998f326107874c88d549f94839f13c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com> Date: Wed, 12 Jun 2013 11:58:44 +0200 Subject: [PATCH 883/913] drm: Don't pass negative delta to ktime_sub_ns() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It takes an unsigned value. This happens not to blow up on 64-bit architectures, but it does on 32-bit, causing drm_calc_vbltimestamp_from_scanoutpos() to calculate totally bogus timestamps for vblank events. Which in turn causes e.g. gnome-shell to hang after a DPMS off cycle with current xf86-video-ati Git. [airlied: regression introduced in drm: use monotonic time in drm_calc_vbltimestamp_from_scanoutpos] Cc: stable@vger.kernel.org Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59339 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59836 Tested-by: shui yangwei <yangweix.shui@intel.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Imre Deak <imre.deak@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com> --- drivers/gpu/drm/drm_irq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 8bcce7866d36..f92da0a32f0d 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -708,7 +708,10 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, /* Subtract time delta from raw timestamp to get final * vblank_time timestamp for end of vblank. */ - etime = ktime_sub_ns(etime, delta_ns); + if (delta_ns < 0) + etime = ktime_add_ns(etime, -delta_ns); + else + etime = ktime_sub_ns(etime, delta_ns); *vblank_time = ktime_to_timeval(etime); DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n", From b72888cb0ba63b2dfc6c8d3cd78a7fea584bebc6 Mon Sep 17 00:00:00 2001 From: Trond Myklebust <Trond.Myklebust@netapp.com> Date: Wed, 7 Aug 2013 20:38:07 -0400 Subject: [PATCH 884/913] NFSv4: Fix up nfs4_proc_lookup_mountpoint Currently, we do not check the return value of client = rpc_clone_client(), nor do we shut down the resulting cloned rpc_clnt in the case where a NFS4ERR_WRONGSEC has caused nfs4_proc_lookup_common() to replace the original value of 'client' (causing a memory leak). Fix both issues and simplify the code by moving the call to rpc_clone_client() until after nfs4_proc_lookup_common() has done its business. Reported-by: Andy Adamson <andros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> --- fs/nfs/nfs4proc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index cf11799297c4..108a774095f7 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3071,15 +3071,13 @@ struct rpc_clnt * nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr) { + struct rpc_clnt *client = NFS_CLIENT(dir); int status; - struct rpc_clnt *client = rpc_clone_client(NFS_CLIENT(dir)); status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL); - if (status < 0) { - rpc_shutdown_client(client); + if (status < 0) return ERR_PTR(status); - } - return client; + return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client; } static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) From 57e6dae1087bbaa6b33d3dd8a8e90b63888939a3 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch <clemens@ladisch.de> Date: Thu, 8 Aug 2013 11:24:55 +0200 Subject: [PATCH 885/913] ALSA: usb-audio: do not trust too-big wMaxPacketSize values The driver used to assume that the streaming endpoint's wMaxPacketSize value would be an indication of how much data the endpoint expects or sends, and compute the number of packets per URB using this value. However, the Focusrite Scarlett 2i4 declares a value of 1024 bytes, while only about 88 or 44 bytes are be actually used. This discrepancy would result in URBs with far too few packets, which would not work correctly on the EHCI driver. To get correct URBs, use wMaxPacketSize only as an upper limit on the packet size. Reported-by: James Stone <jamesmstone@gmail.com> Tested-by: James Stone <jamesmstone@gmail.com> Cc: <stable@vger.kernel.org> # 2.6.35+ Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> --- sound/usb/endpoint.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 7a444b5501d9..659950e5b94f 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -591,17 +591,16 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep, ep->stride = frame_bits >> 3; ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0; - /* calculate max. frequency */ - if (ep->maxpacksize) { + /* assume max. frequency is 25% higher than nominal */ + ep->freqmax = ep->freqn + (ep->freqn >> 2); + maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3)) + >> (16 - ep->datainterval); + /* but wMaxPacketSize might reduce this */ + if (ep->maxpacksize && ep->maxpacksize < maxsize) { /* whatever fits into a max. size packet */ maxsize = ep->maxpacksize; ep->freqmax = (maxsize / (frame_bits >> 3)) << (16 - ep->datainterval); - } else { - /* no max. packet size: just take 25% higher than nominal */ - ep->freqmax = ep->freqn + (ep->freqn >> 2); - maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3)) - >> (16 - ep->datainterval); } if (ep->fill_max) From c4afd7b95fff2f4964e630d0de90e8bc94ae37f1 Mon Sep 17 00:00:00 2001 From: Cong Ding <dinggnu@gmail.com> Date: Sat, 27 Jul 2013 19:07:51 -0400 Subject: [PATCH 886/913] avr32: boards/atngw100/mrmt.c: fix building error there is an additional "{", which causes building error. Signed-off-by: Cong Ding <dinggnu@gmail.com> Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no> --- arch/avr32/boards/atngw100/mrmt.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c index f91431963452..7de083d19b7e 100644 --- a/arch/avr32/boards/atngw100/mrmt.c +++ b/arch/avr32/boards/atngw100/mrmt.c @@ -150,7 +150,6 @@ static struct ac97c_platform_data __initdata ac97c0_data = { static struct platform_device rmt_ts_device = { .name = "ucb1400_ts", .id = -1, - } }; #endif From 370905069ce6515f38d5de0a5b1c899cbe58fe22 Mon Sep 17 00:00:00 2001 From: Linus Torvalds <torvalds@linux-foundation.org> Date: Thu, 8 Aug 2013 09:06:37 -0700 Subject: [PATCH 887/913] Revert "slub: do not put a slab to cpu partial list when cpu_partial is 0" This reverts commit 318df36e57c0ca9f2146660d41ff28e8650af423. This commit caused Steven Rostedt's hackbench runs to run out of memory due to a leak. As noted by Joonsoo Kim, it is buggy in the following scenario: "I guess, you may set 0 to all kmem caches's cpu_partial via sysfs, doesn't it? In this case, memory leak is possible in following case. Code flow of possible leak is follwing case. * in __slab_free() 1. (!new.inuse || !prior) && !was_frozen 2. !kmem_cache_debug && !prior 3. new.frozen = 1 4. after cmpxchg_double_slab, run the (!n) case with new.frozen=1 5. with this patch, put_cpu_partial() doesn't do anything, because this cache's cpu_partial is 0 6. return In step 5, leak occur" And Steven does indeed have cpu_partial set to 0 due to RT testing. Joonsoo is cooking up a patch, but everybody agrees that reverting this for now is the right thing to do. Reported-and-bisected-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> Acked-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- mm/slub.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 2b02d666bf63..e3ba1f2cf60c 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1968,9 +1968,6 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain) int pages; int pobjects; - if (!s->cpu_partial) - return; - do { pages = 0; pobjects = 0; From 93d783bcca69bfacc8dc739d8a050498402587b5 Mon Sep 17 00:00:00 2001 From: Curt Brune <curt@cumulusnetworks.com> Date: Thu, 8 Aug 2013 12:11:03 -0700 Subject: [PATCH 888/913] hwmon: (adt7470) Fix incorrect return code check In adt7470_write_word_data(), which writes two bytes using i2c_smbus_write_byte_data(), the return codes are incorrectly AND-ed together when they should be OR-ed together. The return code of i2c_smbus_write_byte_data() is zero for success. The upshot is only the first byte was ever written to the hardware. The 2nd byte was never written out. I noticed that trying to set the fan speed limits was not working correctly on my system. Setting the fan speed limits is the only code that uses adt7470_write_word_data(). After making the change the limit settings work and the alarms work also. Signed-off-by: Curt Brune <curt@cumulusnetworks.com> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net> --- drivers/hwmon/adt7470.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c index 0f34bca9f5e5..6099f50b28aa 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c @@ -215,7 +215,7 @@ static inline int adt7470_write_word_data(struct i2c_client *client, u8 reg, u16 value) { return i2c_smbus_write_byte_data(client, reg, value & 0xFF) - && i2c_smbus_write_byte_data(client, reg + 1, value >> 8); + || i2c_smbus_write_byte_data(client, reg + 1, value >> 8); } static void adt7470_init_client(struct i2c_client *client) From 8742f229b635bf1c1c84a3dfe5e47c814c20b5c8 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Thu, 8 Aug 2013 18:55:32 +0200 Subject: [PATCH 889/913] userns: limit the maximum depth of user_namespace->parent chain Ensure that user_namespace->parent chain can't grow too much. Currently we use the hardroded 32 as limit. Reported-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- include/linux/user_namespace.h | 1 + kernel/user_namespace.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index b6b215f13b45..14105c26a836 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h @@ -23,6 +23,7 @@ struct user_namespace { struct uid_gid_map projid_map; atomic_t count; struct user_namespace *parent; + int level; kuid_t owner; kgid_t group; unsigned int proc_inum; diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index 6e50a44610ee..9064b919a406 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c @@ -62,6 +62,9 @@ int create_user_ns(struct cred *new) kgid_t group = new->egid; int ret; + if (parent_ns->level > 32) + return -EUSERS; + /* * Verify that we can not violate the policy of which files * may be accessed that is specified by the root directory, @@ -92,6 +95,7 @@ int create_user_ns(struct cred *new) atomic_set(&ns->count, 1); /* Leave the new->user_ns reference with the new user namespace. */ ns->parent = parent_ns; + ns->level = parent_ns->level + 1; ns->owner = owner; ns->group = group; From 4e90a2a7375e86827541bda9393414c03e7721c6 Mon Sep 17 00:00:00 2001 From: Anton Blanchard <anton@samba.org> Date: Wed, 31 Jul 2013 16:31:26 +1000 Subject: [PATCH 890/913] powerpc: On POWERNV enable PPC_DENORMALISATION by default We want PPC_DENORMALISATION enabled when POWERNV is enabled, so update the Kconfig. Signed-off-by: Anton Blanchard <anton@samba.org> Acked-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: <stable@vger.kernel.org> --- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 3bf72cd2c8fc..dbd9d3c991e8 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -566,7 +566,7 @@ config SCHED_SMT config PPC_DENORMALISATION bool "PowerPC denormalisation exception handling" depends on PPC_BOOK3S_64 - default "n" + default "y" if PPC_POWERNV ---help--- Add support for handling denormalisation of single precision values. Useful for bare metal only. If unsure say Y here. From 7e76f34fa103677a27d96a7cfef8ce61389a32de Mon Sep 17 00:00:00 2001 From: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com> Date: Thu, 8 Aug 2013 22:33:49 +0530 Subject: [PATCH 891/913] powerpc/pseries: Fix buffer overflow when reading from pstore When reading from pstore there is a buffer overflow during decompression due to the header added in unzip_oops. Remove unzip_oops and call pstore_decompress directly in nvram_pstore_read. Allocate buffer of size report_length of the oops header as header will not be deallocated in pstore. Since we have 'openssl' command line tool to decompress the compressed data, dump the compressed data in case decompression fails instead of not dumping anything. Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/platforms/pseries/nvram.c | 70 +++++++++----------------- 1 file changed, 24 insertions(+), 46 deletions(-) diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c index 9f8671a44551..893f36053c97 100644 --- a/arch/powerpc/platforms/pseries/nvram.c +++ b/arch/powerpc/platforms/pseries/nvram.c @@ -569,35 +569,6 @@ error: return ret; } -static int unzip_oops(char *oops_buf, char *big_buf) -{ - struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf; - u64 timestamp = oops_hdr->timestamp; - char *big_oops_data = NULL; - char *oops_data_buf = NULL; - size_t big_oops_data_sz; - int unzipped_len; - - big_oops_data = big_buf + sizeof(struct oops_log_info); - big_oops_data_sz = big_oops_buf_sz - sizeof(struct oops_log_info); - oops_data_buf = oops_buf + sizeof(struct oops_log_info); - - unzipped_len = nvram_decompress(oops_data_buf, big_oops_data, - oops_hdr->report_length, - big_oops_data_sz); - - if (unzipped_len < 0) { - pr_err("nvram: decompression failed; returned %d\n", - unzipped_len); - return -1; - } - oops_hdr = (struct oops_log_info *)big_buf; - oops_hdr->version = OOPS_HDR_VERSION; - oops_hdr->report_length = (u16) unzipped_len; - oops_hdr->timestamp = timestamp; - return 0; -} - static int nvram_pstore_open(struct pstore_info *psi) { /* Reset the iterator to start reading partitions again */ @@ -685,10 +656,9 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type, unsigned int err_type, id_no, size = 0; struct nvram_os_partition *part = NULL; char *buff = NULL, *big_buff = NULL; - int rc, sig = 0; + int sig = 0; loff_t p; -read_partition: read_type++; switch (nvram_type_ids[read_type]) { @@ -749,30 +719,36 @@ read_partition: *id = id_no; if (nvram_type_ids[read_type] == PSTORE_TYPE_DMESG) { + int length, unzipped_len; + oops_hdr = (struct oops_log_info *)buff; - *buf = buff + sizeof(*oops_hdr); + length = oops_hdr->report_length; + *buf = kmalloc(length, GFP_KERNEL); + if (*buf == NULL) + return -ENOMEM; + memcpy(*buf, buff + sizeof(*oops_hdr), length); + time->tv_sec = oops_hdr->timestamp; + time->tv_nsec = 0; + kfree(buff); if (err_type == ERR_TYPE_KERNEL_PANIC_GZ) { big_buff = kmalloc(big_oops_buf_sz, GFP_KERNEL); if (!big_buff) return -ENOMEM; - rc = unzip_oops(buff, big_buff); + unzipped_len = nvram_decompress(*buf, big_buff, + length, big_oops_buf_sz); - if (rc != 0) { - kfree(buff); + if (unzipped_len < 0) { + pr_err("nvram: decompression failed, returned " + "rc %d\n", unzipped_len); kfree(big_buff); - goto read_partition; + } else { + *buf = big_buff; + length = unzipped_len; } - - oops_hdr = (struct oops_log_info *)big_buff; - *buf = big_buff + sizeof(*oops_hdr); - kfree(buff); } - - time->tv_sec = oops_hdr->timestamp; - time->tv_nsec = 0; - return oops_hdr->report_length; + return length; } *buf = buff; @@ -816,6 +792,7 @@ static int nvram_pstore_init(void) static void __init nvram_init_oops_partition(int rtas_partition_exists) { int rc; + size_t size; rc = pseries_nvram_init_os_partition(&oops_log_partition); if (rc != 0) { @@ -844,8 +821,9 @@ static void __init nvram_init_oops_partition(int rtas_partition_exists) big_oops_buf_sz = (oops_data_sz * 100) / 45; big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); if (big_oops_buf) { - stream.workspace = kmalloc(zlib_deflate_workspacesize( - WINDOW_BITS, MEM_LEVEL), GFP_KERNEL); + size = max(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL), + zlib_inflate_workspacesize()); + stream.workspace = kmalloc(size, GFP_KERNEL); if (!stream.workspace) { pr_err("nvram: No memory for compression workspace; " "skipping compression of %s partition data\n", From 156c9ebdaca20d9ce428dc189f2b24d2a0ec8eaf Mon Sep 17 00:00:00 2001 From: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com> Date: Thu, 8 Aug 2013 22:34:00 +0530 Subject: [PATCH 892/913] powerpc/pseries: Add backward compatibilty to read old kernel oops-log Older kernels has just length information in their header. Handle it while reading old kernel oops log from pstore. Applies on top of powerpc/pseries: Fix buffer overflow when reading from pstore Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/platforms/pseries/nvram.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c index 893f36053c97..6a5f2b1f32ca 100644 --- a/arch/powerpc/platforms/pseries/nvram.c +++ b/arch/powerpc/platforms/pseries/nvram.c @@ -720,15 +720,25 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type, if (nvram_type_ids[read_type] == PSTORE_TYPE_DMESG) { int length, unzipped_len; + size_t hdr_size; oops_hdr = (struct oops_log_info *)buff; - length = oops_hdr->report_length; + if (oops_hdr->version < OOPS_HDR_VERSION) { + /* Old format oops header had 2-byte record size */ + hdr_size = sizeof(u16); + length = oops_hdr->version; + time->tv_sec = 0; + time->tv_nsec = 0; + } else { + hdr_size = sizeof(*oops_hdr); + length = oops_hdr->report_length; + time->tv_sec = oops_hdr->timestamp; + time->tv_nsec = 0; + } *buf = kmalloc(length, GFP_KERNEL); if (*buf == NULL) return -ENOMEM; - memcpy(*buf, buff + sizeof(*oops_hdr), length); - time->tv_sec = oops_hdr->timestamp; - time->tv_nsec = 0; + memcpy(*buf, buff + hdr_size, length); kfree(buff); if (err_type == ERR_TYPE_KERNEL_PANIC_GZ) { From 144136dd7a25a0ca4d86685f872168502f91f337 Mon Sep 17 00:00:00 2001 From: Mike Qiu <qiudayu@linux.vnet.ibm.com> Date: Tue, 6 Aug 2013 22:25:14 -0400 Subject: [PATCH 893/913] powerpc/eeh: Add missing procfs entry for PowerNV The procfs entry for global statistics has been missed on PowerNV platform and the patch is going to add that. Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com> Acked-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/kernel/eeh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index ea9414c8088d..55593ee2d5aa 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c @@ -1061,7 +1061,7 @@ static const struct file_operations proc_eeh_operations = { static int __init eeh_init_proc(void) { - if (machine_is(pseries)) + if (machine_is(pseries) || machine_is(powernv)) proc_create("powerpc/eeh", 0, NULL, &proc_eeh_operations); return 0; } From 2fb10672c828f6e08f1dbe3690167300035adddc Mon Sep 17 00:00:00 2001 From: Chen Gang <gang.chen@asianux.com> Date: Mon, 22 Jul 2013 14:32:35 +0800 Subject: [PATCH 894/913] powerpc/kvm: Add signed type cast for comparation 'rmls' is 'unsigned long', lpcr_rmls() will return negative number when failure occurs, so it need a type cast for comparing. 'lpid' is 'unsigned long', kvmppc_alloc_lpid() return negative number when failure occurs, so it need a type cast for comparing. Signed-off-by: Chen Gang <gang.chen@asianux.com> Acked-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/kvm/book3s_hv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 2efa9dde741a..7629cd3eb91a 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -1809,7 +1809,7 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu) rma_size <<= PAGE_SHIFT; rmls = lpcr_rmls(rma_size); err = -EINVAL; - if (rmls < 0) { + if ((long)rmls < 0) { pr_err("KVM: Can't use RMA of 0x%lx bytes\n", rma_size); goto out_srcu; } @@ -1874,7 +1874,7 @@ int kvmppc_core_init_vm(struct kvm *kvm) /* Allocate the guest's logical partition ID */ lpid = kvmppc_alloc_lpid(); - if (lpid < 0) + if ((long)lpid < 0) return -ENOMEM; kvm->arch.lpid = lpid; From e0e13614626bfb5a88678fd951d728ed40e3cbf6 Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> Date: Wed, 17 Jul 2013 12:10:29 -0300 Subject: [PATCH 895/913] powerpc/kvm/book3s_pr: Return appropriate error when allocation fails err was overwritten by a previous function call, and checked to be 0. If the following page allocation fails, 0 is going to be returned instead of -ENOMEM. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/kvm/book3s_pr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index 19498a567a81..c6e13d9a9e15 100644 --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c @@ -1047,11 +1047,12 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) if (err) goto free_shadow_vcpu; + err = -ENOMEM; p = __get_free_page(GFP_KERNEL|__GFP_ZERO); - /* the real shared page fills the last 4k of our page */ - vcpu->arch.shared = (void*)(p + PAGE_SIZE - 4096); if (!p) goto uninit_vcpu; + /* the real shared page fills the last 4k of our page */ + vcpu->arch.shared = (void *)(p + PAGE_SIZE - 4096); #ifdef CONFIG_PPC_BOOK3S_64 /* default to book3s_64 (970fx) */ From 88f094120bd2f012ff494ae50a8d4e0d8af8f69e Mon Sep 17 00:00:00 2001 From: Michael Neuling <mikey@neuling.org> Date: Fri, 9 Aug 2013 17:29:27 +1000 Subject: [PATCH 896/913] powerpc: Fix hypervisor facility unavaliable vector number Currently if we take hypervisor facility unavaliable (from 0xf80/0x4f80) we mark it as an OS facility unavaliable (0xf60) as the two share the same code path. The becomes a problem in facility_unavailable_exception() as we aren't able to see the hypervisor facility unavailable exceptions. Below fixes this by duplication the required macros. Signed-off-by: Michael Neuling <mikey@neuling.org> Cc: <stable@vger.kernel.org> [v3.10] Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/kernel/exceptions-64s.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 4e00d223b2e3..902ca3c6b4b6 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -848,7 +848,7 @@ hv_facility_unavailable_relon_trampoline: . = 0x4f80 SET_SCRATCH0(r13) EXCEPTION_PROLOG_0(PACA_EXGEN) - b facility_unavailable_relon_hv + b hv_facility_unavailable_relon_hv STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint) #ifdef CONFIG_PPC_DENORMALISATION @@ -1175,6 +1175,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX) b .ret_from_except STD_EXCEPTION_COMMON(0xf60, facility_unavailable, .facility_unavailable_exception) + STD_EXCEPTION_COMMON(0xf80, hv_facility_unavailable, .facility_unavailable_exception) .align 7 .globl __end_handlers @@ -1188,7 +1189,7 @@ __end_handlers: STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable) STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable) STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable) - STD_RELON_EXCEPTION_HV_OOL(0xf80, facility_unavailable) + STD_RELON_EXCEPTION_HV_OOL(0xf80, hv_facility_unavailable) #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) /* From 74e400cee6c0266ba2d940ed78d981f1e24a8167 Mon Sep 17 00:00:00 2001 From: Michael Neuling <mikey@neuling.org> Date: Fri, 9 Aug 2013 17:29:28 +1000 Subject: [PATCH 897/913] powerpc: Rework setting up H/FSCR bit definitions This reworks the Facility Status and Control Regsiter (FSCR) config bit definitions so that we can access the bit numbers. This is needed for a subsequent patch to fix the userspace DSCR handling. HFSCR and FSCR bit definitions are the same, so reuse them. Signed-off-by: Michael Neuling <mikey@neuling.org> Cc: <stable@vger.kernel.org> [v3.10] Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/reg.h | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index a6840e4e24f7..99222e27f173 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h @@ -254,19 +254,28 @@ #define SPRN_HRMOR 0x139 /* Real mode offset register */ #define SPRN_HSRR0 0x13A /* Hypervisor Save/Restore 0 */ #define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */ +/* HFSCR and FSCR bit numbers are the same */ +#define FSCR_TAR_LG 8 /* Enable Target Address Register */ +#define FSCR_EBB_LG 7 /* Enable Event Based Branching */ +#define FSCR_TM_LG 5 /* Enable Transactional Memory */ +#define FSCR_PM_LG 4 /* Enable prob/priv access to PMU SPRs */ +#define FSCR_BHRB_LG 3 /* Enable Branch History Rolling Buffer*/ +#define FSCR_DSCR_LG 2 /* Enable Data Stream Control Register */ +#define FSCR_VECVSX_LG 1 /* Enable VMX/VSX */ +#define FSCR_FP_LG 0 /* Enable Floating Point */ #define SPRN_FSCR 0x099 /* Facility Status & Control Register */ -#define FSCR_TAR (1 << (63-55)) /* Enable Target Address Register */ -#define FSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */ -#define FSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */ +#define FSCR_TAR __MASK(FSCR_TAR_LG) +#define FSCR_EBB __MASK(FSCR_EBB_LG) +#define FSCR_DSCR __MASK(FSCR_DSCR_LG) #define SPRN_HFSCR 0xbe /* HV=1 Facility Status & Control Register */ -#define HFSCR_TAR (1 << (63-55)) /* Enable Target Address Register */ -#define HFSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */ -#define HFSCR_TM (1 << (63-58)) /* Enable Transactional Memory */ -#define HFSCR_PM (1 << (63-60)) /* Enable prob/priv access to PMU SPRs */ -#define HFSCR_BHRB (1 << (63-59)) /* Enable Branch History Rolling Buffer*/ -#define HFSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */ -#define HFSCR_VECVSX (1 << (63-62)) /* Enable VMX/VSX */ -#define HFSCR_FP (1 << (63-63)) /* Enable Floating Point */ +#define HFSCR_TAR __MASK(FSCR_TAR_LG) +#define HFSCR_EBB __MASK(FSCR_EBB_LG) +#define HFSCR_TM __MASK(FSCR_TM_LG) +#define HFSCR_PM __MASK(FSCR_PM_LG) +#define HFSCR_BHRB __MASK(FSCR_BHRB_LG) +#define HFSCR_DSCR __MASK(FSCR_DSCR_LG) +#define HFSCR_VECVSX __MASK(FSCR_VECVSX_LG) +#define HFSCR_FP __MASK(FSCR_FP_LG) #define SPRN_TAR 0x32f /* Target Address Register */ #define SPRN_LPCR 0x13E /* LPAR Control Register */ #define LPCR_VPM0 (1ul << (63-0)) From 2517617e0de65f8f7cfe75cae745d06b1fa98586 Mon Sep 17 00:00:00 2001 From: Michael Neuling <mikey@neuling.org> Date: Fri, 9 Aug 2013 17:29:29 +1000 Subject: [PATCH 898/913] powerpc: Fix context switch DSCR on POWER8 POWER8 allows the DSCR to be accessed directly from userspace via a new SPR number 0x3 (Rather than 0x11. DSCR SPR number 0x11 is still used on POWER8 but like POWER7, is only accessible in HV and OS modes). Currently, we allow this by setting H/FSCR DSCR bit on boot. Unfortunately this doesn't work, as the kernel needs to see the DSCR change so that it knows to no longer restore the system wide version of DSCR on context switch (ie. to set thread.dscr_inherit). This clears the H/FSCR DSCR bit initially. If a process then accesses the DSCR (via SPR 0x3), it'll trap into the kernel where we set thread.dscr_inherit in facility_unavailable_exception(). We also change _switch() so that we set or clear the H/FSCR DSCR bit based on the thread.dscr_inherit. Signed-off-by: Michael Neuling <mikey@neuling.org> Cc: <stable@vger.kernel.org> [v3.10] Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/kernel/entry_64.S | 27 +++++++++++++++- arch/powerpc/kernel/traps.c | 58 ++++++++++++++++++++-------------- 2 files changed, 60 insertions(+), 25 deletions(-) diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index ab15b8d057ad..4674fe647ad7 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -584,9 +584,34 @@ BEGIN_FTR_SECTION ld r7,DSCR_DEFAULT@toc(2) ld r0,THREAD_DSCR(r4) cmpwi r6,0 + li r8, FSCR_DSCR bne 1f ld r0,0(r7) -1: cmpd r0,r25 + b 3f +1: + BEGIN_FTR_SECTION_NESTED(70) + mfspr r6, SPRN_FSCR + or r6, r6, r8 + mtspr SPRN_FSCR, r6 + BEGIN_FTR_SECTION_NESTED(69) + mfspr r6, SPRN_HFSCR + or r6, r6, r8 + mtspr SPRN_HFSCR, r6 + END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69) + b 4f + END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70) +3: + BEGIN_FTR_SECTION_NESTED(70) + mfspr r6, SPRN_FSCR + andc r6, r6, r8 + mtspr SPRN_FSCR, r6 + BEGIN_FTR_SECTION_NESTED(69) + mfspr r6, SPRN_HFSCR + andc r6, r6, r8 + mtspr SPRN_HFSCR, r6 + END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69) + END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70) +4: cmpd r0,r25 beq 2f mtspr SPRN_DSCR,r0 2: diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index bf33c22e38a4..e435bc089ea3 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -44,9 +44,7 @@ #include <asm/machdep.h> #include <asm/rtas.h> #include <asm/pmc.h> -#ifdef CONFIG_PPC32 #include <asm/reg.h> -#endif #ifdef CONFIG_PMAC_BACKLIGHT #include <asm/backlight.h> #endif @@ -1296,43 +1294,54 @@ void vsx_unavailable_exception(struct pt_regs *regs) die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT); } +#ifdef CONFIG_PPC64 void facility_unavailable_exception(struct pt_regs *regs) { static char *facility_strings[] = { - "FPU", - "VMX/VSX", - "DSCR", - "PMU SPRs", - "BHRB", - "TM", - "AT", - "EBB", - "TAR", + [FSCR_FP_LG] = "FPU", + [FSCR_VECVSX_LG] = "VMX/VSX", + [FSCR_DSCR_LG] = "DSCR", + [FSCR_PM_LG] = "PMU SPRs", + [FSCR_BHRB_LG] = "BHRB", + [FSCR_TM_LG] = "TM", + [FSCR_EBB_LG] = "EBB", + [FSCR_TAR_LG] = "TAR", }; - char *facility, *prefix; + char *facility = "unknown"; u64 value; + u8 status; + bool hv; - if (regs->trap == 0xf60) { - value = mfspr(SPRN_FSCR); - prefix = ""; - } else { + hv = (regs->trap == 0xf80); + if (hv) value = mfspr(SPRN_HFSCR); - prefix = "Hypervisor "; + else + value = mfspr(SPRN_FSCR); + + status = value >> 56; + if (status == FSCR_DSCR_LG) { + /* User is acessing the DSCR. Set the inherit bit and allow + * the user to set it directly in future by setting via the + * H/FSCR DSCR bit. + */ + current->thread.dscr_inherit = 1; + if (hv) + mtspr(SPRN_HFSCR, value | HFSCR_DSCR); + else + mtspr(SPRN_FSCR, value | FSCR_DSCR); + return; } - value = value >> 56; + if ((status < ARRAY_SIZE(facility_strings)) && + facility_strings[status]) + facility = facility_strings[status]; /* We restore the interrupt state now */ if (!arch_irq_disabled_regs(regs)) local_irq_enable(); - if (value < ARRAY_SIZE(facility_strings)) - facility = facility_strings[value]; - else - facility = "unknown"; - pr_err("%sFacility '%s' unavailable, exception at 0x%lx, MSR=%lx\n", - prefix, facility, regs->nip, regs->msr); + hv ? "Hypervisor " : "", facility, regs->nip, regs->msr); if (user_mode(regs)) { _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); @@ -1341,6 +1350,7 @@ void facility_unavailable_exception(struct pt_regs *regs) die("Unexpected facility unavailable exception", regs, SIGABRT); } +#endif #ifdef CONFIG_PPC_TRANSACTIONAL_MEM From c2d52644e2da8a07ecab5ca62dd0bc563089e8dc Mon Sep 17 00:00:00 2001 From: Michael Neuling <mikey@neuling.org> Date: Fri, 9 Aug 2013 17:29:30 +1000 Subject: [PATCH 899/913] powerpc: Save the TAR register earlier This moves us to save the Target Address Register (TAR) a earlier in __switch_to. It introduces a new function save_tar() to do this. We need to save the TAR earlier as we will overwrite it in the transactional memory reclaim/recheckpoint path. We are going to do this in a subsequent patch which will fix saving the TAR register when it's modified inside a transaction. Signed-off-by: Michael Neuling <mikey@neuling.org> Cc: <stable@vger.kernel.org> [v3.10] Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/switch_to.h | 9 +++++++++ arch/powerpc/kernel/entry_64.S | 9 --------- arch/powerpc/kernel/process.c | 10 ++++++++++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h index 49a13e0ef234..294c2cedcf7a 100644 --- a/arch/powerpc/include/asm/switch_to.h +++ b/arch/powerpc/include/asm/switch_to.h @@ -15,6 +15,15 @@ extern struct task_struct *__switch_to(struct task_struct *, struct thread_struct; extern struct task_struct *_switch(struct thread_struct *prev, struct thread_struct *next); +#ifdef CONFIG_PPC_BOOK3S_64 +static inline void save_tar(struct thread_struct *prev) +{ + if (cpu_has_feature(CPU_FTR_ARCH_207S)) + prev->tar = mfspr(SPRN_TAR); +} +#else +static inline void save_tar(struct thread_struct *prev) {} +#endif extern void giveup_fpu(struct task_struct *); extern void load_up_fpu(void); diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 4674fe647ad7..2bd0b885b0fe 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -449,15 +449,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_DSCR) #ifdef CONFIG_PPC_BOOK3S_64 BEGIN_FTR_SECTION - /* - * Back up the TAR across context switches. Note that the TAR is not - * available for use in the kernel. (To provide this, the TAR should - * be backed up/restored on exception entry/exit instead, and be in - * pt_regs. FIXME, this should be in pt_regs anyway (for debug).) - */ - mfspr r0,SPRN_TAR - std r0,THREAD_TAR(r3) - /* Event based branch registers */ mfspr r0, SPRN_BESCR std r0, THREAD_BESCR(r3) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index c517dbe705fd..8083be20fe5e 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -600,6 +600,16 @@ struct task_struct *__switch_to(struct task_struct *prev, struct ppc64_tlb_batch *batch; #endif + /* Back up the TAR across context switches. + * Note that the TAR is not available for use in the kernel. (To + * provide this, the TAR should be backed up/restored on exception + * entry/exit instead, and be in pt_regs. FIXME, this should be in + * pt_regs anyway (for debug).) + * Save the TAR here before we do treclaim/trecheckpoint as these + * will change the TAR. + */ + save_tar(&prev->thread); + __switch_to_tm(prev); #ifdef CONFIG_SMP From 28e61cc466d8daace4b0f04ba2b83e0bd68f5832 Mon Sep 17 00:00:00 2001 From: Michael Neuling <mikey@neuling.org> Date: Fri, 9 Aug 2013 17:29:31 +1000 Subject: [PATCH 900/913] powerpc/tm: Fix context switching TAR, PPR and DSCR SPRs If a transaction is rolled back, the Target Address Register (TAR), Processor Priority Register (PPR) and Data Stream Control Register (DSCR) should be restored to the checkpointed values before the transaction began. Any changes to these SPRs inside the transaction should not be visible in the abort handler. Currently Linux doesn't save or restore the checkpointed TAR, PPR or DSCR. If we preempt a processes inside a transaction which has modified any of these, on process restore, that same transaction may be aborted we but we won't see the checkpointed versions of these SPRs. This adds checkpointed versions of these SPRs to the thread_struct and adds the save/restore of these three SPRs to the treclaim/trechkpt code. Without this if any of these SPRs are modified during a transaction, users may incorrectly see a speculated SPR value even if the transaction is aborted. Signed-off-by: Michael Neuling <mikey@neuling.org> Cc: <stable@vger.kernel.org> [v3.10] Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/processor.h | 4 ++++ arch/powerpc/kernel/asm-offsets.c | 3 +++ arch/powerpc/kernel/tm.S | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 47a35b08b963..e378cccfca55 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h @@ -247,6 +247,10 @@ struct thread_struct { unsigned long tm_orig_msr; /* Thread's MSR on ctx switch */ struct pt_regs ckpt_regs; /* Checkpointed registers */ + unsigned long tm_tar; + unsigned long tm_ppr; + unsigned long tm_dscr; + /* * Transactional FP and VSX 0-31 register set. * NOTE: the sense of these is the opposite of the integer ckpt_regs! diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index c7e8afc2ead0..8207459efe56 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -138,6 +138,9 @@ int main(void) DEFINE(THREAD_TM_TFHAR, offsetof(struct thread_struct, tm_tfhar)); DEFINE(THREAD_TM_TEXASR, offsetof(struct thread_struct, tm_texasr)); DEFINE(THREAD_TM_TFIAR, offsetof(struct thread_struct, tm_tfiar)); + DEFINE(THREAD_TM_TAR, offsetof(struct thread_struct, tm_tar)); + DEFINE(THREAD_TM_PPR, offsetof(struct thread_struct, tm_ppr)); + DEFINE(THREAD_TM_DSCR, offsetof(struct thread_struct, tm_dscr)); DEFINE(PT_CKPT_REGS, offsetof(struct thread_struct, ckpt_regs)); DEFINE(THREAD_TRANSACT_VR0, offsetof(struct thread_struct, transact_vr[0])); diff --git a/arch/powerpc/kernel/tm.S b/arch/powerpc/kernel/tm.S index 51be8fb24803..0554d1f6d70d 100644 --- a/arch/powerpc/kernel/tm.S +++ b/arch/powerpc/kernel/tm.S @@ -233,6 +233,16 @@ dont_backup_fp: std r5, _CCR(r7) std r6, _XER(r7) + + /* ******************** TAR, PPR, DSCR ********** */ + mfspr r3, SPRN_TAR + mfspr r4, SPRN_PPR + mfspr r5, SPRN_DSCR + + std r3, THREAD_TM_TAR(r12) + std r4, THREAD_TM_PPR(r12) + std r5, THREAD_TM_DSCR(r12) + /* MSR and flags: We don't change CRs, and we don't need to alter * MSR. */ @@ -347,6 +357,16 @@ dont_restore_fp: mtmsr r6 /* FP/Vec off again! */ restore_gprs: + + /* ******************** TAR, PPR, DSCR ********** */ + ld r4, THREAD_TM_TAR(r3) + ld r5, THREAD_TM_PPR(r3) + ld r6, THREAD_TM_DSCR(r3) + + mtspr SPRN_TAR, r4 + mtspr SPRN_PPR, r5 + mtspr SPRN_DSCR, r6 + /* ******************** CR,LR,CCR,MSR ********** */ ld r3, _CTR(r7) ld r4, _LINK(r7) From 8e5654ce6914b950b42d1f896f3d8a75fbf307ae Mon Sep 17 00:00:00 2001 From: Jiri Kosina <jkosina@suse.cz> Date: Fri, 9 Aug 2013 11:34:19 +0200 Subject: [PATCH 901/913] Revert "HID: hid-logitech-dj: querying_devices was never set" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 407a2c2a4d85100c8c67953e4bac2f4a6c942335. Explanation provided by Benjamin Tissoires: Commit "HID: hid-logitech-dj, querying_devices was never set" activate a flag which guarantees that we do not ask the receiver for too many enumeration. When the flag is set, each following enumeration call is discarded (the usb request is not forwarded to the receiver). The flag is then released when the driver receive a pairing information event, which normally follows the enumeration request. However, the USB3 bug makes the driver think the enumeration request has been forwarded to the receiver. However, it is actually not the case because the USB stack returns -EPIPE. So, when a new unknown device appears, the workaround consisting in asking for a new enumeration is not working anymore: this new enumeration is discarded because of the flag, which is never reset. A solution could be to trigger a timeout before releasing it, but for now, let's just revert the patch. Reported-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Tested-by: Sune Mølgaard <sune@molgaard.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz> --- drivers/hid/hid-logitech-dj.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 7a5764843bfb..cd33084c7860 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c @@ -488,8 +488,6 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) if (djrcv_dev->querying_devices) return 0; - djrcv_dev->querying_devices = true; - dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); if (!dj_report) return -ENOMEM; From 201d3dfa4da10ac45b260320b94e2f2f0e10d687 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov <oleg@redhat.com> Date: Fri, 9 Aug 2013 17:19:13 +0200 Subject: [PATCH 902/913] dlm: kill the unnecessary and wrong device_close()->recalc_sigpending() device_close()->recalc_sigpending() is not needed, sigprocmask() takes care of TIF_SIGPENDING correctly. And without ->siglock it is racy and wrong, it can wrongly clear TIF_SIGPENDING and miss a signal. But even with this patch device_close() is still buggy: 1. sigprocmask() should not be used, we have set_task_blocked(), but this is minor. 2. We should never block SIGKILL or SIGSTOP, and this is what the code tries to do. 3. This can't protect against SIGKILL or SIGSTOP anyway. Another thread can do signal_wake_up(), say, do_signal_stop() or complete_signal() or debugger. 4. sigprocmask(SIG_BLOCK, allsigs) doesn't necessarily clears TIF_SIGPENDING, say, freezing() or ->jobctl. 5. device_write() looks equally wrong by the same reason. Looks like, this tries to protect some wait_event_interruptible() logic from signals, it should be turned into uninterruptible wait. Or we need to implement something like signals_stop/start for such a use-case. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- fs/dlm/user.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/dlm/user.c b/fs/dlm/user.c index 911649a47dd5..812149119fa3 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c @@ -686,7 +686,6 @@ static int device_close(struct inode *inode, struct file *file) device_remove_lockspace() */ sigprocmask(SIG_SETMASK, &tmpsig, NULL); - recalc_sigpending(); return 0; } From 7cddc193924ef6ce679ef0977e01e96d0aedfd1d Mon Sep 17 00:00:00 2001 From: Jie Liu <jeff.liu@oracle.com> Date: Fri, 28 Jun 2013 13:15:52 +0800 Subject: [PATCH 903/913] btrfs: fix file truncation if FALLOC_FL_KEEP_SIZE is specified Create a small file and fallocate it to a big size with FALLOC_FL_KEEP_SIZE option, then truncate it back to the small size again, the disk free space is not changed back in this case. i.e, total 4 -rw-r--r-- 1 root root 512 Jun 28 11:35 test Filesystem Size Used Avail Use% Mounted on .... /dev/sdb1 8.0G 56K 7.2G 1% /mnt -rw-r--r-- 1 root root 512 Jun 28 11:35 /mnt/test Filesystem Size Used Avail Use% Mounted on .... /dev/sdb1 8.0G 5.1G 2.2G 70% /mnt Filesystem Size Used Avail Use% Mounted on .... /dev/sdb1 8.0G 5.1G 2.2G 70% /mnt With this fix, the truncated up space is back as: Filesystem Size Used Avail Use% Mounted on .... /dev/sdb1 8.0G 56K 7.2G 1% /mnt Signed-off-by: Jie Liu <jeff.liu@oracle.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com> --- fs/btrfs/inode.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 6d1b93c8aafb..0fd7647c8932 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4391,9 +4391,6 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr) int mask = attr->ia_valid; int ret; - if (newsize == oldsize) - return 0; - /* * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a * special case where we need to update the times despite not having From e68afa49aec5f0851e550ee1de48fcc3a9bf5ef7 Mon Sep 17 00:00:00 2001 From: Liu Bo <bo.li.liu@oracle.com> Date: Mon, 1 Jul 2013 22:13:26 +0800 Subject: [PATCH 904/913] Btrfs: fix a bug of snapshot-aware defrag to make it work on partial extents For partial extents, snapshot-aware defrag does not work as expected, since a) we use the wrong logical offset to search for parents, which should be disk_bytenr + extent_offset, not just disk_bytenr, b) 'offset' returned by the backref walking just refers to key.offset, not the 'offset' stored in btrfs_extent_data_ref which is (key.offset - extent_offset). The reproducer: $ mkfs.btrfs sda $ mount sda /mnt $ btrfs sub create /mnt/sub $ for i in `seq 5 -1 1`; do dd if=/dev/zero of=/mnt/sub/foo bs=5k count=1 seek=$i conv=notrunc oflag=sync; done $ btrfs sub snap /mnt/sub /mnt/snap1 $ btrfs sub snap /mnt/sub /mnt/snap2 $ sync; btrfs filesystem defrag /mnt/sub/foo; $ umount /mnt $ btrfs-debug-tree sda (Here we can check whether the defrag operation is snapshot-awared. This addresses the above two problems. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com> --- fs/btrfs/inode.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 0fd7647c8932..c72033ee6017 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2166,16 +2166,23 @@ static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id, if (btrfs_file_extent_disk_bytenr(leaf, extent) != old->bytenr) continue; - extent_offset = btrfs_file_extent_offset(leaf, extent); - if (key.offset - extent_offset != offset) + /* + * 'offset' refers to the exact key.offset, + * NOT the 'offset' field in btrfs_extent_data_ref, ie. + * (key.offset - extent_offset). + */ + if (key.offset != offset) continue; + extent_offset = btrfs_file_extent_offset(leaf, extent); num_bytes = btrfs_file_extent_num_bytes(leaf, extent); + if (extent_offset >= old->extent_offset + old->offset + old->len || extent_offset + num_bytes <= old->extent_offset + old->offset) continue; + ret = 0; break; } @@ -2187,7 +2194,7 @@ static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id, backref->root_id = root_id; backref->inum = inum; - backref->file_pos = offset + extent_offset; + backref->file_pos = offset; backref->num_bytes = num_bytes; backref->extent_offset = extent_offset; backref->generation = btrfs_file_extent_generation(leaf, extent); @@ -2210,7 +2217,8 @@ static noinline bool record_extent_backrefs(struct btrfs_path *path, new->path = path; list_for_each_entry_safe(old, tmp, &new->head, list) { - ret = iterate_inodes_from_logical(old->bytenr, fs_info, + ret = iterate_inodes_from_logical(old->bytenr + + old->extent_offset, fs_info, path, record_one_backref, old); BUG_ON(ret < 0 && ret != -ENOENT); From b5b9b5b318f9b6fef1bd3e2c8c63d0bff47703a1 Mon Sep 17 00:00:00 2001 From: Liu Bo <bo.li.liu@oracle.com> Date: Wed, 3 Jul 2013 14:40:44 +0800 Subject: [PATCH 905/913] Btrfs: fix extent buffer leak after backref walking commit 47fb091fb787420cd195e66f162737401cce023f(Btrfs: fix unlock after free on rewinded tree blocks) takes an extra increment on the reference of allocated dummy extent buffer, so now we cannot free this dummy one, and end up with extent buffer leak. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com> --- fs/btrfs/ctree.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 5bf4c39e2ad6..ed504607d8ec 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1271,7 +1271,6 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb, BUG_ON(!eb_rewin); } - extent_buffer_get(eb_rewin); btrfs_tree_read_unlock(eb); free_extent_buffer(eb); From b76bb70136375c32d3b0bbbe2ebef738913d5b90 Mon Sep 17 00:00:00 2001 From: Josef Bacik <jbacik@fusionio.com> Date: Fri, 5 Jul 2013 13:52:51 -0400 Subject: [PATCH 906/913] Btrfs: do not offset physical if we're compressed xfstest btrfs/276 was freaking out on slower boxes partly because fiemap was offsetting the physical based on the extent offset. This is perfectly fine with uncompressed extents, however the extent offset is into the uncompressed area, not the compressed. So we can return a physical value that isn't at all within the area we have allocated on disk. Fix this by returning the start of the extent if it is compressed no matter what the offset. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com> --- fs/btrfs/extent_io.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 583d98bd065e..fe443fece851 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -4048,7 +4048,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, } while (!end) { - u64 offset_in_extent; + u64 offset_in_extent = 0; /* break if the extent we found is outside the range */ if (em->start >= max || extent_map_end(em) < off) @@ -4064,9 +4064,12 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, /* * record the offset from the start of the extent - * for adjusting the disk offset below + * for adjusting the disk offset below. Only do this if the + * extent isn't compressed since our in ram offset may be past + * what we have actually allocated on disk. */ - offset_in_extent = em_start - em->start; + if (!test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) + offset_in_extent = em_start - em->start; em_end = extent_map_end(em); em_len = em_end - em_start; emflags = em->flags; From 8ca15e05e6ac2745725d2d62394cfbe4ac335e84 Mon Sep 17 00:00:00 2001 From: Josef Bacik <jbacik@fusionio.com> Date: Fri, 5 Jul 2013 13:58:19 -0400 Subject: [PATCH 907/913] Btrfs: fix backref walking when we hit a compressed extent If you do btrfs inspect-internal logical-resolve on a compressed extent that has been partly overwritten it won't find anything. This is because we try and match the extent offset we've searched for based on the extent offset in the data extent entry. However this doesn't work for compressed extents because the offsets are for the uncompressed size, not the compressed size. So instead only do this check if we are not compressed, that way we can get an actual entry for the physical offset rather than nothing for compressed. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com> --- fs/btrfs/backref.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index eaf133384a8f..30dbe1c61857 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -36,16 +36,23 @@ static int check_extent_in_eb(struct btrfs_key *key, struct extent_buffer *eb, u64 extent_item_pos, struct extent_inode_elem **eie) { - u64 data_offset; - u64 data_len; + u64 offset = 0; struct extent_inode_elem *e; - data_offset = btrfs_file_extent_offset(eb, fi); - data_len = btrfs_file_extent_num_bytes(eb, fi); + if (!btrfs_file_extent_compression(eb, fi) && + !btrfs_file_extent_encryption(eb, fi) && + !btrfs_file_extent_other_encoding(eb, fi)) { + u64 data_offset; + u64 data_len; - if (extent_item_pos < data_offset || - extent_item_pos >= data_offset + data_len) - return 1; + data_offset = btrfs_file_extent_offset(eb, fi); + data_len = btrfs_file_extent_num_bytes(eb, fi); + + if (extent_item_pos < data_offset || + extent_item_pos >= data_offset + data_len) + return 1; + offset = extent_item_pos - data_offset; + } e = kmalloc(sizeof(*e), GFP_NOFS); if (!e) @@ -53,7 +60,7 @@ static int check_extent_in_eb(struct btrfs_key *key, struct extent_buffer *eb, e->next = *eie; e->inum = key->objectid; - e->offset = key->offset + (extent_item_pos - data_offset); + e->offset = key->offset + offset; *eie = e; return 0; From ed8c4913da4951957bf8afc788522788881ff405 Mon Sep 17 00:00:00 2001 From: Josef Bacik <jbacik@fusionio.com> Date: Fri, 5 Jul 2013 14:03:47 -0400 Subject: [PATCH 908/913] Btrfs: make sure the backref walker catches all refs to our extent Because we don't mess with the offset into the extent for compressed we will properly find both extents for this case [extent a][extent b][rest of extent a] but because we already added a ref for the front half we won't add the inode information for the second half. This causes us to leak that memory and not print out the other offset when we do logical-resolve. So fix this by calling ulist_add_merge and then add our eie to the existing entry if there is one. With this patch we get both offsets out of logical-resolve. With this and the other 2 patches I've sent we now pass btrfs/276 on my vm with compress-force=lzo set. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com> --- fs/btrfs/backref.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 30dbe1c61857..8bc5e8ccb091 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -196,7 +196,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, struct extent_buffer *eb; struct btrfs_key key; struct btrfs_file_extent_item *fi; - struct extent_inode_elem *eie = NULL; + struct extent_inode_elem *eie = NULL, *old = NULL; u64 disk_byte; if (level != 0) { @@ -230,6 +230,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, if (disk_byte == wanted_disk_byte) { eie = NULL; + old = NULL; if (extent_item_pos) { ret = check_extent_in_eb(&key, eb, fi, *extent_item_pos, @@ -237,18 +238,20 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, if (ret < 0) break; } - if (!ret) { - ret = ulist_add(parents, eb->start, - (uintptr_t)eie, GFP_NOFS); - if (ret < 0) - break; - if (!extent_item_pos) { - ret = btrfs_next_old_leaf(root, path, - time_seq); - continue; - } + if (ret > 0) + goto next; + ret = ulist_add_merge(parents, eb->start, + (uintptr_t)eie, + (u64 *)&old, GFP_NOFS); + if (ret < 0) + break; + if (!ret && extent_item_pos) { + while (old->next) + old = old->next; + old->next = eie; } } +next: ret = btrfs_next_old_item(root, path, time_seq); } From ee20a98314e52a6675e94d1a07ca205ffdf09a72 Mon Sep 17 00:00:00 2001 From: Josef Bacik <jbacik@fusionio.com> Date: Thu, 11 Jul 2013 10:34:59 -0400 Subject: [PATCH 909/913] Btrfs: allow splitting of hole em's when dropping extent cache I noticed while running multi-threaded fsync tests that sometimes fsck would complain about an improper gap. This happens because we fail to add a hole extent to the file, which was happening when we'd split a hole EM because btrfs_drop_extent_cache was just discarding the whole em instead of splitting it. So this patch fixes this by allowing us to split a hole em properly, which means that added holes actually get logged properly and we no longer see this fsck error. Thankfully we're tolerant of these sort of problems so a user would not see any adverse effects of this bug, other than fsck complaining. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com> --- fs/btrfs/file.c | 64 +++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index a005fe2c072a..8e686a427ce2 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -596,20 +596,29 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, if (no_splits) goto next; - if (em->block_start < EXTENT_MAP_LAST_BYTE && - em->start < start) { + if (em->start < start) { split->start = em->start; split->len = start - em->start; - split->orig_start = em->orig_start; - split->block_start = em->block_start; - if (compressed) - split->block_len = em->block_len; - else - split->block_len = split->len; - split->ram_bytes = em->ram_bytes; - split->orig_block_len = max(split->block_len, - em->orig_block_len); + if (em->block_start < EXTENT_MAP_LAST_BYTE) { + split->orig_start = em->orig_start; + split->block_start = em->block_start; + + if (compressed) + split->block_len = em->block_len; + else + split->block_len = split->len; + split->orig_block_len = max(split->block_len, + em->orig_block_len); + split->ram_bytes = em->ram_bytes; + } else { + split->orig_start = split->start; + split->block_len = 0; + split->block_start = em->block_start; + split->orig_block_len = 0; + split->ram_bytes = split->len; + } + split->generation = gen; split->bdev = em->bdev; split->flags = flags; @@ -620,8 +629,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, split = split2; split2 = NULL; } - if (em->block_start < EXTENT_MAP_LAST_BYTE && - testend && em->start + em->len > start + len) { + if (testend && em->start + em->len > start + len) { u64 diff = start + len - em->start; split->start = start + len; @@ -630,18 +638,28 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, split->flags = flags; split->compress_type = em->compress_type; split->generation = gen; - split->orig_block_len = max(em->block_len, - em->orig_block_len); - split->ram_bytes = em->ram_bytes; - if (compressed) { - split->block_len = em->block_len; - split->block_start = em->block_start; - split->orig_start = em->orig_start; + if (em->block_start < EXTENT_MAP_LAST_BYTE) { + split->orig_block_len = max(em->block_len, + em->orig_block_len); + + split->ram_bytes = em->ram_bytes; + if (compressed) { + split->block_len = em->block_len; + split->block_start = em->block_start; + split->orig_start = em->orig_start; + } else { + split->block_len = split->len; + split->block_start = em->block_start + + diff; + split->orig_start = em->orig_start; + } } else { - split->block_len = split->len; - split->block_start = em->block_start + diff; - split->orig_start = em->orig_start; + split->ram_bytes = split->len; + split->orig_start = split->start; + split->block_len = 0; + split->block_start = em->block_start; + split->orig_block_len = 0; } ret = add_extent_mapping(em_tree, split, modified); From f3b15ccdbb9a79781578249a63318805e55a6c34 Mon Sep 17 00:00:00 2001 From: Josef Bacik <jbacik@fusionio.com> Date: Mon, 22 Jul 2013 12:54:30 -0400 Subject: [PATCH 910/913] Btrfs: release both paths before logging dir/changed extents The ceph guys tripped over this bug where we were still holding onto the original path that we used to copy the inode with when logging. This is based on Chris's fix which was reported to fix the problem. We need to drop the paths in two cases anyway so just move the drop up so that we don't have duplicate code. Thanks, Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com> --- fs/btrfs/tree-log.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 2c6791493637..ff60d8978ae2 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -3746,8 +3746,9 @@ next_slot: } log_extents: + btrfs_release_path(path); + btrfs_release_path(dst_path); if (fast_search) { - btrfs_release_path(dst_path); ret = btrfs_log_changed_extents(trans, root, inode, dst_path); if (ret) { err = ret; @@ -3764,8 +3765,6 @@ log_extents: } if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) { - btrfs_release_path(path); - btrfs_release_path(dst_path); ret = log_directory_changes(trans, root, inode, path, dst_path); if (ret) { err = ret; From cfad392b22163eba71d882950e17d2c4d43b2bad Mon Sep 17 00:00:00 2001 From: Josef Bacik <jbacik@fusionio.com> Date: Thu, 25 Jul 2013 15:11:47 -0400 Subject: [PATCH 911/913] Btrfs: check to see if root_list is empty before adding it to dead roots A user reported a panic when running with autodefrag and deleting snapshots. This is because we could end up trying to add the root to the dead roots list twice. To fix this check to see if we are empty before adding ourselves to the dead roots list. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com> --- fs/btrfs/transaction.c | 8 ++++---- fs/btrfs/transaction.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index d58cce77fc6c..af1931a5960d 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -983,12 +983,12 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans, * a dirty root struct and adds it into the list of dead roots that need to * be deleted */ -int btrfs_add_dead_root(struct btrfs_root *root) +void btrfs_add_dead_root(struct btrfs_root *root) { spin_lock(&root->fs_info->trans_lock); - list_add_tail(&root->root_list, &root->fs_info->dead_roots); + if (list_empty(&root->root_list)) + list_add_tail(&root->root_list, &root->fs_info->dead_roots); spin_unlock(&root->fs_info->trans_lock); - return 0; } /* @@ -1925,7 +1925,7 @@ int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root) } root = list_first_entry(&fs_info->dead_roots, struct btrfs_root, root_list); - list_del(&root->root_list); + list_del_init(&root->root_list); spin_unlock(&fs_info->trans_lock); pr_debug("btrfs: cleaner removing %llu\n", diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h index 005b0375d18c..defbc4269897 100644 --- a/fs/btrfs/transaction.h +++ b/fs/btrfs/transaction.h @@ -143,7 +143,7 @@ int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid); int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, struct btrfs_root *root); -int btrfs_add_dead_root(struct btrfs_root *root); +void btrfs_add_dead_root(struct btrfs_root *root); int btrfs_defrag_root(struct btrfs_root *root); int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root); int btrfs_commit_transaction(struct btrfs_trans_handle *trans, From db62efbbf883c099d44b0fafe18f8ad8f0396892 Mon Sep 17 00:00:00 2001 From: Zach Brown <zab@redhat.com> Date: Thu, 11 Jul 2013 16:19:42 -0700 Subject: [PATCH 912/913] btrfs: don't loop on large offsets in readdir When btrfs readdir() hits the last entry it sets the readdir offset to a huge value to stop buggy apps from breaking when the same name is returned by readdir() with concurrent rename()s. But unconditionally setting the offset to INT_MAX causes readdir() to loop returning any entries with offsets past INT_MAX. It only takes a few hours of constant file creation and removal to create entries past INT_MAX. So let's set the huge offset to LLONG_MAX if the last entry has already overflowed 32bit loff_t. Without large offsets behaviour is identical. With large offsets 64bit apps will work and 32bit apps will be no more broken than they currently are if they see large offsets. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com> --- fs/btrfs/inode.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c72033ee6017..021694c08181 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -5170,14 +5170,31 @@ next: } /* Reached end of directory/root. Bump pos past the last item. */ - if (key_type == BTRFS_DIR_INDEX_KEY) - /* - * 32-bit glibc will use getdents64, but then strtol - - * so the last number we can serve is this. - */ - ctx->pos = 0x7fffffff; - else - ctx->pos++; + ctx->pos++; + + /* + * Stop new entries from being returned after we return the last + * entry. + * + * New directory entries are assigned a strictly increasing + * offset. This means that new entries created during readdir + * are *guaranteed* to be seen in the future by that readdir. + * This has broken buggy programs which operate on names as + * they're returned by readdir. Until we re-use freed offsets + * we have this hack to stop new entries from being returned + * under the assumption that they'll never reach this huge + * offset. + * + * This is being careful not to overflow 32bit loff_t unless the + * last entry requires it because doing so has broken 32bit apps + * in the past. + */ + if (key_type == BTRFS_DIR_INDEX_KEY) { + if (ctx->pos >= INT_MAX) + ctx->pos = LLONG_MAX; + else + ctx->pos = INT_MAX; + } nopos: ret = 0; err: From d4e4ab86bcba5a72779c43dc1459f71fea3d89c8 Mon Sep 17 00:00:00 2001 From: Linus Torvalds <torvalds@linux-foundation.org> Date: Sun, 11 Aug 2013 18:04:20 -0700 Subject: [PATCH 913/913] Linux 3.11-rc5 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f93d4f7a90c2..6e488480bff3 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 11 SUBLEVEL = 0 -EXTRAVERSION = -rc4 +EXTRAVERSION = -rc5 NAME = Linux for Workgroups # *DOCUMENTATION*