From owner-freebsd-arm@freebsd.org Tue Sep 6 04:47:59 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 8FE6CA9DA6B; Tue, 6 Sep 2016 04:47:59 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (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 58DD9CB8; Tue, 6 Sep 2016 04:47:59 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x22f.google.com with SMTP id i184so175132912itf.1; Mon, 05 Sep 2016 21:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=WHmIMEzxliCPWVnhCKCyQJ4YDGqYItd50ETBhHnfE5U=; b=Al+S2sdBhB+3bngqkFU5S5uiv9mCe5jl0sOSygrPi8EFdpFMSjXgVsOtT+mV1ATaS9 8R/eD7dGn9VO9/2cPBGIuSlBMX6k5wsNBuP1uffaYujjrwLAcbU0nBzkwsCOlH4JXI+p 9y+1Lrbl7qayoeAB3pKDA5k155H4khvDbxMrdhT9GxvW17itM2OeMMmC+JsE6yVz6E8A iFj+R3iSnBSQkDixlhkc07HjGutt0UskwmiBFiRFcySkhHLTlB4LAAfp/8MYf15cbIEW DMOApiLrvNUhalpQFNoIB+VlmUcjW3jEfbKIDg+aQ4gXr/4yDGm0peY8AatD8nVIKv6l GqFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=WHmIMEzxliCPWVnhCKCyQJ4YDGqYItd50ETBhHnfE5U=; b=QkU8uT3TdwD5Z0aShMSpkB++DJ6ioxm/aSBeBzKsf123Ff+DpxyU5LyFXcwbhOl3XE jv1T/e6wTbHj15ccVuxtS4VQ+e5w2Lzq1JhFNZGk5vqrzdoQVOXvcPj0ogfdxMPC/4Aw o425oQg+s8pruBzIuI4khG4XvImABFBW6MYjr77+h6rgPgpOnBq6+Uv7ACnMQZ1i6cAx xpNIrrH8xbp0k+oBupcRhZK/xU8o8ZZAVqaL4slQ950RUWodp2PmyJ+TXe6pHp6DeC3U N/MbVKbS7hHPDJh3EsJobuHdtki+3Lve8M5hd5wHvsGGatbHupu/EVVrzUjl6Yufv63Z heAw== X-Gm-Message-State: AE9vXwM1qq6IZ+aKtiQVv6B9bqMGZCgvY2Bb8t9q5UZwcZ0SSaXyd2QRW3gGPF8a+dSxrZ1W82cIiI3AsTojPQ== X-Received: by 10.107.164.76 with SMTP id n73mr2654649ioe.165.1473137278603; Mon, 05 Sep 2016 21:47:58 -0700 (PDT) MIME-Version: 1.0 Sender: adrian.chadd@gmail.com Received: by 10.36.141.129 with HTTP; Mon, 5 Sep 2016 21:47:57 -0700 (PDT) In-Reply-To: References: From: Adrian Chadd Date: Mon, 5 Sep 2016 21:47:57 -0700 X-Google-Sender-Auth: 8lvnxnmnjYKk-VDntQD1wdILqJ8 Message-ID: Subject: Re: Small example program shut down urtwn To: =?UTF-8?B?T3RhY8OtbGlv?= Cc: "freebsd-arm@freebsd.org" , "freebsd-wireless@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: Tue, 06 Sep 2016 04:47:59 -0000 hm, interesting! I wonder if urtwn and/or usb is missing some bus barriers for ARM or something? -a On 4 September 2016 at 14:18, Otac=C3=ADlio wrot= e: > Dears > > I wrote these two small programs to help debug a problem that I think I h= ave > 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=3Dsizeof(si_other); > char buf[BUFFER_LEN]; > int aux; > > if(argc !=3D 2){ > fprintf(stderr, "Voce deve usar %s \n", argv[0]); > exit(1); > } > > if ((s=3Dsocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))=3D=3D-1) > diep("socket"); > > memset((char *) &si_me, 0, sizeof(si_me)); > si_me.sin_family =3D AF_INET; > si_me.sin_port =3D htons(strtol(argv[1], (char **)NULL, 10)); > si_me.sin_addr.s_addr =3D htonl(INADDR_ANY); > if (bind(s, (struct sockaddr *)&si_me, sizeof(si_me))=3D=3D-1) > diep("bind"); > > i =3D 1; > do { > if ((lidos =3D recvfrom(s, buf, BUFFER_LEN, 0, (struct sockaddr > *)&si_other, (socklen_t *)&slen))=3D=3D-1) > diep("recvfrom()"); > aux =3D ntohl(*(int*)&buf[0]); > printf("Perdidos %d pacotes (%0.2f%%)\n", aux - i, 100*((float)(a= ux > - 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=3Dsizeof(si_other); > char *buf; > int tamanho; > int npack; > struct addrinfo *result =3D NULL, > *ptr =3D NULL, > hints; > int iResult, aux; > fd_set fdset; > > if(argc !=3D 5){ > fprintf(stderr,"Voce deve usar %s de pacotes>\n", argv[0]); > exit(1); > } > > tamanho =3D (int)strtol(argv[3], (char **)NULL, 10); > npack =3D (int)strtol(argv[4], (char **)NULL, 10); > > buf =3D malloc(tamanho); > > bzero(&hints, sizeof(hints)); > hints.ai_family =3D AF_UNSPEC; > hints.ai_socktype =3D SOCK_DGRAM; > hints.ai_protocol =3D IPPROTO_UDP; > > iResult =3D getaddrinfo(argv[1], argv[2], &hints, &result); > if ( iResult !=3D 0 ) { > printf("getaddrinfo failed with error: %d\n", iResult); > return 1; > } > > // Attempt to connect to an address until one succeeds > for(ptr=3Dresult; ptr !=3D NULL ;ptr=3Dptr->ai_next) { > > // Create a SOCKET for connecting to server > s =3D socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol); > if (s < 0){ > perror("socket"); > return 1; > } > > // Connect to server. > iResult =3D connect(s, ptr->ai_addr, (int)ptr->ai_addrlen); > if (iResult =3D=3D SOCKET_ERROR) { > close(s); > s =3D INVALID_SOCKET; > continue; > } > > break; > } > > freeaddrinfo(result); > FD_ZERO(&fdset); > FD_SET(s, &fdset); > for (i=3D1; i<=3Dnpack || npack=3D=3D0; i++) { > aux =3D htonl(i); > memcpy(&buf[0], &aux, sizeof(aux)); > aux =3D 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)=3D=3D-1) > diep("sendto()"); > } > printf("Enviados %d pacotes de %d bytes\n", npack, tamanho); > > close(s); > return 0; > } > _______________________________________________ > freebsd-wireless@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-wireless > To unsubscribe, send any mail to "freebsd-wireless-unsubscribe@freebsd.or= g"