Changeset 231b3fd in mainline for uspace/lib/nic/src/nic_driver.c


Ignore:
Timestamp:
2018-08-25T21:35:26Z (6 years ago)
Author:
GitHub <noreply@…>
Parents:
e2625b1a (diff), 3c45353 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jakub Jermář <jakub@…> (2018-08-25 21:35:26)
git-committer:
GitHub <noreply@…> (2018-08-25 21:35:26)
Message:

Merge 3c453534a2b093c8039d8e8059b923c71f3492a3 into e2625b1a1e5a2895b86f0e39c2d70a39e49e042a

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/nic/src/nic_driver.c

    re2625b1a r231b3fd  
    384384 *  @return Current polling mode of the controller
    385385 */
    386 nic_poll_mode_t nic_query_poll_mode(nic_t *nic_data, struct timeval *period)
     386nic_poll_mode_t nic_query_poll_mode(nic_t *nic_data, struct timespec *period)
    387387{
    388388        if (period)
     
    400400 */
    401401errno_t nic_report_poll_mode(nic_t *nic_data, nic_poll_mode_t mode,
    402     struct timeval *period)
     402    struct timespec *period)
    403403{
    404404        errno_t rc = EOK;
     
    408408        if (mode == NIC_POLL_PERIODIC) {
    409409                if (period) {
    410                         memcpy(&nic_data->default_poll_period, period, sizeof(struct timeval));
    411                         memcpy(&nic_data->poll_period, period, sizeof(struct timeval));
     410                        memcpy(&nic_data->default_poll_period, period, sizeof(struct timespec));
     411                        memcpy(&nic_data->poll_period, period, sizeof(struct timespec));
    412412                } else {
    413413                        rc = EINVAL;
     
    10301030 *  @returns Nonzero if t is zero interval
    10311031 */
    1032 static int timeval_nonpositive(struct timeval t)
    1033 {
    1034         return (t.tv_sec <= 0) && (t.tv_usec <= 0);
     1032static int timespec_nonpositive(struct timespec t)
     1033{
     1034        return (t.tv_sec <= 0) && (t.tv_nsec <= 0);
    10351035}
    10361036
     
    10511051                int run = info->run;
    10521052                int running = info->running;
    1053                 struct timeval remaining = nic->poll_period;
     1053                struct timespec remaining = nic->poll_period;
    10541054                fibril_rwlock_read_unlock(&nic->main_lock);
    10551055
    10561056                if (!running) {
    10571057                        remaining.tv_sec = 5;
    1058                         remaining.tv_usec = 0;
     1058                        remaining.tv_nsec = 0;
    10591059                }
    10601060
    10611061                /* Wait the period (keep attention to overflows) */
    1062                 while (!timeval_nonpositive(remaining)) {
    1063                         suseconds_t wait = 0;
     1062                while (!timespec_nonpositive(remaining)) {
     1063                        usec_t wait = 0;
    10641064                        if (remaining.tv_sec > 0) {
    10651065                                time_t wait_sec = remaining.tv_sec;
     
    10711071                                        wait_sec = 5;
    10721072
    1073                                 wait = (suseconds_t) wait_sec * 1000000;
     1073                                wait = SEC2USEC(wait_sec);
    10741074
    10751075                                remaining.tv_sec -= wait_sec;
    10761076                        } else {
    1077                                 wait = remaining.tv_usec;
     1077                                wait = NSEC2USEC(remaining.tv_nsec);
    10781078
    10791079                                if (wait > 5 * 1000000) {
     
    10811081                                }
    10821082
    1083                                 remaining.tv_usec -= wait;
     1083                                remaining.tv_nsec -= USEC2NSEC(wait);
    10841084                        }
    10851085                        fibril_usleep(wait);
Note: See TracChangeset for help on using the changeset viewer.