ATHCTRL for ATH

Milan Obuch current at dino.sk
Sun Aug 21 06:10:20 GMT 2005


On Sunday 21 August 2005 03:32, Daniel Dvorak wrote:
> Hi all,
>
> I have one question for you. My friend use Linux Debian and he use atheros
> cards with madwifi drivers. Sam work together with others developers and I
> found out that he committed interesting tool for linux users.
>
> This tool is athctrl, which you know "athctrl program that sets the ack+cts
> timeouts based on the distance between two stations". And I think that this
> feature is useful not only for linux users but of course for users of
> others os like FreeBSD etc.
>
> So, I do not know why the tool is not in main tree fbsd, maybe there is
> reason for this and I do not know. Which it is my mistake, so if it is
> true, I am sorry. Of course, I could not imagine how much work somebody has
> to do for this, but I would like to only ask if possible now before final
> release 6.0 or in the future.
>
> Does somebody think somebody could commit this tool for FreeBSD users ?
>
> Thank you for your attention and time.
>
> Bye
>
> Daniel
>

While I do not think this will be in FreeBSD's tree, you could test following 
simple program to check if it meets your expectations. Computed values need 
to be set per hand with sysctl, but it is really simple.

Milan

/*-
 * Copyright (c) 2002-2004 Gunter Burchardt, Local-Web AG
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
 *    redistribution must be conditioned upon including a substantially
 *    similar Disclaimer requirement for further binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * 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.
 *
 * NO WARRANTY
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
 *
 */

/*
 * Simple Atheros-specific tool to inspect and set atheros specific values
 * athctrl [-i interface] [-d distance]
 * (default interface is ath0).
 */

#include <stdio.h>
#include <unistd.h>


static void usage(void)
{
    fprintf(stderr,
        "Atheros driver control\n"
        "Copyright (c) 2002-2004 Gunter Burchardt, Local-Web AG\n"
        "\n"
        "usage: athctrl [-i interface] [-d distance]\n"
        "\n"
        "options:\n"
        "   -h   show this usage\n"
        "   -d   specify the maximum distance of a sta or the distance\n"
                "        of the master\n");

    exit(1);
}

int
main(int argc, char *argv[])
{
        int distance = -1;
        int c;

        for (;;) {
        c = getopt(argc, argv, "d:h");
        if (c < 0)
            break;
        switch (c) {
        case 'h':
            usage();
            break;
        case 'd':
                        distance = atoi(optarg);
            break;

        default:
            usage();
            break;
        }
    }

        if(distance >= 0){
        int slottime = 9+(distance/300)+((distance%300)?1:0);
                int acktimeout = slottime*2+3;
                int ctstimeout = slottime*2+3;

                printf("Setting distance on interface ath to %i meters\n", 
distance);
                fprintf(stdout, "slottime: %d\n", slottime);
                fprintf(stdout, "acktimeout: %d\n", acktimeout);
                fprintf(stdout, "ctstimeout: %d\n", ctstimeout);
        }else{
                usage();
        }
}


More information about the freebsd-current mailing list