~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/staging/ath6kl/miscdrv/credit_dist.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#define DATA_SVCS_USED 4
42
42
#endif
43
43
 
44
 
static void RedistributeCredits(COMMON_CREDIT_STATE_INFO *pCredInfo,
45
 
                                HTC_ENDPOINT_CREDIT_DIST *pEPDistList);
 
44
static void RedistributeCredits(struct common_credit_state_info *pCredInfo,
 
45
                                struct htc_endpoint_credit_dist *pEPDistList);
46
46
 
47
 
static void SeekCredits(COMMON_CREDIT_STATE_INFO *pCredInfo,
48
 
                        HTC_ENDPOINT_CREDIT_DIST *pEPDistList);
 
47
static void SeekCredits(struct common_credit_state_info *pCredInfo,
 
48
                        struct htc_endpoint_credit_dist *pEPDistList);
49
49
 
50
50
/* reduce an ep's credits back to a set limit */
51
 
static INLINE void ReduceCredits(COMMON_CREDIT_STATE_INFO *pCredInfo,
52
 
                                HTC_ENDPOINT_CREDIT_DIST  *pEpDist,
 
51
static INLINE void ReduceCredits(struct common_credit_state_info *pCredInfo,
 
52
                                struct htc_endpoint_credit_dist  *pEpDist,
53
53
                                int                       Limit)
54
54
{
55
55
    int credits;
81
81
 * This function is called in the context of HTCStart() to setup initial (application-specific)
82
82
 * credit distributions */
83
83
static void ar6000_credit_init(void                     *Context,
84
 
                               HTC_ENDPOINT_CREDIT_DIST *pEPList,
 
84
                               struct htc_endpoint_credit_dist *pEPList,
85
85
                               int                      TotalCredits)
86
86
{
87
 
    HTC_ENDPOINT_CREDIT_DIST *pCurEpDist;
 
87
    struct htc_endpoint_credit_dist *pCurEpDist;
88
88
    int                      count;
89
 
    COMMON_CREDIT_STATE_INFO *pCredInfo = (COMMON_CREDIT_STATE_INFO *)Context;
 
89
    struct common_credit_state_info *pCredInfo = (struct common_credit_state_info *)Context;
90
90
 
91
91
    pCredInfo->CurrentFreeCredits = TotalCredits;
92
92
    pCredInfo->TotalAvailableCredits = TotalCredits;
136
136
 
137
137
    if (pCredInfo->CurrentFreeCredits <= 0) {
138
138
        AR_DEBUG_PRINTF(ATH_LOG_INF, ("Not enough credits (%d) to do credit distributions \n", TotalCredits));
139
 
        A_ASSERT(FALSE);
 
139
        A_ASSERT(false);
140
140
        return;
141
141
    }
142
142
 
175
175
 *
176
176
 */
177
177
static void ar6000_credit_distribute(void                     *Context,
178
 
                                     HTC_ENDPOINT_CREDIT_DIST *pEPDistList,
 
178
                                     struct htc_endpoint_credit_dist *pEPDistList,
179
179
                                     HTC_CREDIT_DIST_REASON   Reason)
180
180
{
181
 
    HTC_ENDPOINT_CREDIT_DIST *pCurEpDist;
182
 
    COMMON_CREDIT_STATE_INFO *pCredInfo = (COMMON_CREDIT_STATE_INFO *)Context;
 
181
    struct htc_endpoint_credit_dist *pCurEpDist;
 
182
    struct common_credit_state_info *pCredInfo = (struct common_credit_state_info *)Context;
183
183
 
184
184
    switch (Reason) {
185
185
        case HTC_CREDIT_DIST_SEND_COMPLETE :
243
243
}
244
244
 
245
245
/* redistribute credits based on activity change */
246
 
static void RedistributeCredits(COMMON_CREDIT_STATE_INFO *pCredInfo,
247
 
                                HTC_ENDPOINT_CREDIT_DIST *pEPDistList)
 
246
static void RedistributeCredits(struct common_credit_state_info *pCredInfo,
 
247
                                struct htc_endpoint_credit_dist *pEPDistList)
248
248
{
249
 
    HTC_ENDPOINT_CREDIT_DIST *pCurEpDist = pEPDistList;
 
249
    struct htc_endpoint_credit_dist *pCurEpDist = pEPDistList;
250
250
 
251
251
        /* walk through the list and remove credits from inactive endpoints */
252
252
    while (pCurEpDist != NULL) {
283
283
}
284
284
 
285
285
/* HTC has an endpoint that needs credits, pEPDist is the endpoint in question */
286
 
static void SeekCredits(COMMON_CREDIT_STATE_INFO *pCredInfo,
287
 
                        HTC_ENDPOINT_CREDIT_DIST *pEPDist)
 
286
static void SeekCredits(struct common_credit_state_info *pCredInfo,
 
287
                        struct htc_endpoint_credit_dist *pEPDist)
288
288
{
289
 
    HTC_ENDPOINT_CREDIT_DIST *pCurEpDist;
 
289
    struct htc_endpoint_credit_dist *pCurEpDist;
290
290
    int                      credits = 0;
291
291
    int                      need;
292
292
 
341
341
        credits = min(pCredInfo->CurrentFreeCredits,pEPDist->TxCreditsSeek);
342
342
 
343
343
        if (credits >= pEPDist->TxCreditsSeek) {
344
 
                /* we found some to fullfill the seek request */
 
344
                /* we found some to fulfill the seek request */
345
345
            break;
346
346
        }
347
347
 
364
364
 
365
365
            if ((pCurEpDist->TxCreditsAssigned - need) >= pCurEpDist->TxCreditsMin) {
366
366
                    /* the current one has been allocated more than it's minimum and it
367
 
                     * has enough credits assigned above it's minimum to fullfill our need
368
 
                     * try to take away just enough to fullfill our need */
 
367
                     * has enough credits assigned above it's minimum to fulfill our need
 
368
                     * try to take away just enough to fulfill our need */
369
369
                ReduceCredits(pCredInfo,
370
370
                              pCurEpDist,
371
371
                              pCurEpDist->TxCreditsAssigned - need);
382
382
            /* return what we can get */
383
383
        credits = min(pCredInfo->CurrentFreeCredits,pEPDist->TxCreditsSeek);
384
384
 
385
 
    } while (FALSE);
 
385
    } while (false);
386
386
 
387
387
        /* did we find some credits? */
388
388
    if (credits) {
393
393
}
394
394
 
395
395
/* initialize and setup credit distribution */
396
 
A_STATUS ar6000_setup_credit_dist(HTC_HANDLE HTCHandle, COMMON_CREDIT_STATE_INFO *pCredInfo)
 
396
int ar6000_setup_credit_dist(HTC_HANDLE HTCHandle, struct common_credit_state_info *pCredInfo)
397
397
{
398
398
    HTC_SERVICE_ID servicepriority[5];
399
399
 
400
 
    A_MEMZERO(pCredInfo,sizeof(COMMON_CREDIT_STATE_INFO));
 
400
    A_MEMZERO(pCredInfo,sizeof(struct common_credit_state_info));
401
401
 
402
402
    servicepriority[0] = WMI_CONTROL_SVC;  /* highest */
403
403
    servicepriority[1] = WMI_DATA_VO_SVC;
413
413
                             servicepriority,
414
414
                             5);
415
415
 
416
 
    return A_OK;
 
416
    return 0;
417
417
}
418
418