From owner-freebsd-arm@freebsd.org Sun Sep 4 21:18:29 2016 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B70CB71F58 for ; Sun, 4 Sep 2016 21:18:29 +0000 (UTC) (envelope-from otacilio.neto@bsd.com.br) Received: from mail-qk0-x234.google.com (mail-qk0-x234.google.com [IPv6:2607:f8b0:400d:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B6AF66B for ; Sun, 4 Sep 2016 21:18:28 +0000 (UTC) (envelope-from otacilio.neto@bsd.com.br) Received: by mail-qk0-x234.google.com with SMTP id l2so175903762qkf.3 for ; Sun, 04 Sep 2016 14:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsd.com.br; s=capeta; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=ebwVzSb4WbxfT2bms9783Bn1Q6z67h8ue/vs4tNo6A4=; b=QBag56Y6eMpXKvEUkjLqnneZQTbi/0Hb68ziXV8MRsmzpmALwUG4ufxBXdqi0REpB0 yL4AKslnz9HuZ8edXUq7V45zJH6daAavquF7BojsEg0+AADRdDjRwtVZc52zuYEms23H FdhdDidKnXE1ifqWAfCzDTgeYxbNot/wzcBao= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=ebwVzSb4WbxfT2bms9783Bn1Q6z67h8ue/vs4tNo6A4=; b=DG9kXkVBX6Jj0oO2sarUuAgqwW2El3T/8PvWXOf+Z8BLBDNBUob6m0QjrFcYV3fGFb scPd1+aVq/LwUHgEkOym/wAvwP7ctZqefJ7/88GnbB+ej7OU/6YI0+04EXbNeFXWWht0 jtyIAbjNf1wyR2OEDhPa1+AzC2CLBdTBTnvZyTrj9IuLyQimjaCsah8YilEbEBjqC0sE 2iVy2OVWoXUv9pfxt1mKspffg2DzQVzj7DtdVEgrbBtH9KDKCotnwim2q7bMPEWjFR66 SWxulvkeVc/na02vWXTxMEgyipDuISNKXTSX9vibJ7f0HF7j8RvdpSyD+i4COO8TPqo8 ewiw== X-Gm-Message-State: AE9vXwPAzAD/ysgFuyiQ1qcCZ2AzkDls+X2AaOIVNOQg8papVV4NRU0lk4TE7V8cvmzg2g== X-Received: by 10.55.74.14 with SMTP id x14mr34732531qka.102.1473023908008; Sun, 04 Sep 2016 14:18:28 -0700 (PDT) Received: from [192.168.0.11] ([187.60.94.34]) by smtp.googlemail.com with ESMTPSA id v68sm12881409qkd.9.2016.09.04.14.18.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 14:18:27 -0700 (PDT) To: "freebsd-arm@freebsd.org" , "freebsd-wireless@freebsd.org" From: =?UTF-8?B?T3RhY8OtbGlv?= Subject: Small example program shut down urtwn Message-ID: Date: Sun, 4 Sep 2016 18:18:09 -0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 21:18:29 -0000 Dears I wrote these two small programs to help debug a problem that I think I have found when using urtwn driver in a baglebone black. The problem is 100% reproducible. In a server machine I run: serverUDP 2508 In beaglebone black I run: ./clientUDP servername 2508 9216 0 All the times, after some packages be sent the urtwn interface do not respond from ping and stops send others packages. Some times this error message appears: % urtwn0: device timeout I have tested with RTL8192CU and RTL8188CUS The problem do no occurs in my notebook. Following the server and client #include #include #include #include #include #include #include #include #define BUFFER_LEN 1024*1024 void diep(char *s) { perror(s); exit(1); } int main(int argc, char **argv) { int lidos; struct sockaddr_in si_me, si_other; int s, i, slen=sizeof(si_other); char buf[BUFFER_LEN]; int aux; if(argc != 2){ fprintf(stderr, "Voce deve usar %s \n", argv[0]); exit(1); } if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1) diep("socket"); memset((char *) &si_me, 0, sizeof(si_me)); si_me.sin_family = AF_INET; si_me.sin_port = htons(strtol(argv[1], (char **)NULL, 10)); si_me.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(s, (struct sockaddr *)&si_me, sizeof(si_me))==-1) diep("bind"); i = 1; do { if ((lidos = recvfrom(s, buf, BUFFER_LEN, 0, (struct sockaddr *)&si_other, (socklen_t *)&slen))==-1) diep("recvfrom()"); aux = ntohl(*(int*)&buf[0]); printf("Perdidos %d pacotes (%0.2f%%)\n", aux - i, 100*((float)(aux - i))/((float)aux)); printf("Sequencia %0000d Recebidos %d bytes\n", aux, lidos); i++; }while(lidos>0); close(s); return 0; } #include #include #include #include #include #include #include #include #include #include #include #include #define SOCKET_ERROR -1 #define INVALID_SOCKET -1 #define SRV_IP "127.0.0.1" void diep(char *s) { perror(s); exit(1); } int main(int argc, char **argv) { struct sockaddr_in si_other; int s, i, slen=sizeof(si_other); char *buf; int tamanho; int npack; struct addrinfo *result = NULL, *ptr = NULL, hints; int iResult, aux; fd_set fdset; if(argc != 5){ fprintf(stderr,"Voce deve usar %s \n", argv[0]); exit(1); } tamanho = (int)strtol(argv[3], (char **)NULL, 10); npack = (int)strtol(argv[4], (char **)NULL, 10); buf = malloc(tamanho); bzero(&hints, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; iResult = getaddrinfo(argv[1], argv[2], &hints, &result); if ( iResult != 0 ) { printf("getaddrinfo failed with error: %d\n", iResult); return 1; } // Attempt to connect to an address until one succeeds for(ptr=result; ptr != NULL ;ptr=ptr->ai_next) { // Create a SOCKET for connecting to server s = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol); if (s < 0){ perror("socket"); return 1; } // Connect to server. iResult = connect(s, ptr->ai_addr, (int)ptr->ai_addrlen); if (iResult == SOCKET_ERROR) { close(s); s = INVALID_SOCKET; continue; } break; } freeaddrinfo(result); FD_ZERO(&fdset); FD_SET(s, &fdset); for (i=1; i<=npack || npack==0; i++) { aux = htonl(i); memcpy(&buf[0], &aux, sizeof(aux)); aux = htonl(npack); memcpy(&buf[0+sizeof(i)], &aux, sizeof(aux)); do{ if(select(s+1, NULL, &fdset, NULL, NULL )<0) diep("select()"); }while(!FD_ISSET(s, &fdset)); if (send(s, buf, tamanho, 0)==-1) diep("sendto()"); } printf("Enviados %d pacotes de %d bytes\n", npack, tamanho); close(s); return 0; }