From: kemal <kemalinanc8@gmail.com>
To: 9front@9front.org
Subject: Re: [9front] driver for intel wireless 7260?
Date: Sat, 14 Aug 2021 17:50:43 +0000 [thread overview]
Message-ID: <CABO6shdiWhkwWUKDu3kA7tC4det+cDcHr5rTcQu0Gh4OFnak+Q@mail.gmail.com> (raw)
In-Reply-To: <CABO6she2Q-_4uet7fNuo2WvWuMivjQzUftdM3Kb2osoCefTwWg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 535 bytes --]
2021-08-13 23:41 GMT, kemal <kemalinanc8@gmail.com>:
> the current diff is attached.
also ignore this diff.
driver was reading the mac address from the nvm wrong.
1- as driver reads 8 bytes from nvm instead of 6 so fw doesn't
spit us an ADVANCED_SYSASSERT, it was reading 2 more
extra bytes. apparently those 2 extra bytes were put to
the first 2 bytes of our buffer, so we got to skip that.
2- the mac address is encoded in a weird le16 order. we have
to byte swap so we get the correct mac address.
the current diff is attached.
[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 6315 bytes --]
--- /sys/src/9/pc/etheriwl.c
+++ /sys/src/9/pc/etheriwl.c
@@ -329,7 +329,29 @@
SchedTransTblOff = 0x7E0, // +q*2
};
+/*
+ * uCode TLV api
+ */
enum {
+ /* api[0] */
+ UcodeApiSta = 1<<30,
+};
+
+/*
+ * uCode capabilities
+ */
+enum {
+ /* capa[0] */
+ UcodeCapLar = 1<<1,
+
+ /* capa[1] */
+ UcodeCapQuota = 1<<12,
+
+ /* capa[2] */
+ UcodeCapLar2 = 1<<9,
+};
+
+enum {
FilterPromisc = 1<<0,
FilterCtl = 1<<1,
FilterMulticast = 1<<2,
@@ -418,6 +440,7 @@
uint build;
char descr[64+1];
+ u32int flags;
u32int capa[4];
u32int api[4];
@@ -635,7 +658,7 @@
Type2030 = 12,
Type2000 = 16,
- Type7260 = 30,
+ Type7260 = 20,
Type8265 = 35,
};
@@ -1478,6 +1501,11 @@
s = &i->boot.text;
s->addr = 0x00000000;
goto Sect;
+ case 18:
+ if(l < 4)
+ goto Tooshort;
+ i->flags = get32(p);
+ break;
case 19:
if(i->main.nsect >= nelem(i->main.sect))
return "too many main sections";
@@ -1984,7 +2012,7 @@
*p++ = mcc[0];
*p++ = 0;
*p++ = 0; // reserved
- if(1){
+ if(ctlr->fw->capa[2] & UcodeCapLar2){
p += 4;
p += 5*4;
}
@@ -2272,7 +2300,15 @@
ea[5] = a1 >> 0;
}
} else {
- readnvmsect(ctlr, 0, ea, Eaddrlen, 0x15<<1);
+ /* fw gets angry if we read 6 bytes */
+ readnvmsect(ctlr, 0, buf, 8, 0x15<<1);
+ /* the first 2 bytes is garbage and the byte order is le16 */
+ ea[0] = buf[3];
+ ea[1] = buf[2];
+ ea[2] = buf[5];
+ ea[3] = buf[4];
+ ea[4] = buf[7];
+ ea[5] = buf[6];
}
memmove(ctlr->edev->addr, ea, Eaddrlen);
@@ -2366,7 +2402,7 @@
p += 2; /* sleep_tx_count */
p++; /* sleep state flags */
- *p++ = (ctlr->fw->api[0] & (1<<30)) != 0 ? type : 0; /* station_type */
+ *p++ = ctlr->fw->api[0] & UcodeApiSta ? type : 0; /* station_type */
p += 2; /* assoc id */
@@ -2375,7 +2411,7 @@
put32(p, 1<<0);
p += 4; /* tfd_queue_mask */
- if(1){
+ if(ctlr->fw->api[0] & UcodeApiSta){
p += 2; /* rx_ba_window */
p++; /* sp_length */
p++; /* uapsd_acs */
@@ -2640,7 +2676,7 @@
static char*
settimeevent(Ctlr *ctlr, int amr, int ival)
{
- int duration, delay, timeid;
+ int timeid;
uchar c[9*4], *p;
char *err;
@@ -2662,14 +2698,6 @@
break;
}
- if(ival){
- duration = ival*2;
- delay = ival/2;
- } else {
- duration = 1024;
- delay = 0;
- }
-
memset(p = c, 0, sizeof(c));
put32(p, ctlr->macid);
p += 4;
@@ -2678,32 +2706,36 @@
put32(p, timeid);
p += 4;
- put32(p, 0); // apply time
- p += 4;
- put32(p, delay);
- p += 4;
- put32(p, 0); // depends on
- p += 4;
- put32(p, 1); // interval
- p += 4;
- put32(p, duration);
- p += 4;
- *p++ = 1; // repeat
- *p++ = 0; // max frags
- put16(p, 1<<0 | 1<<1 | 1<<11); // policy
- p += 2;
+ if(amr == CmdRemove)
+ p += 6*4;
+ else{
+ put32(p, 0); // apply time
+ p += 4;
+ put32(p, ival/2); // max delay
+ p += 4;
+ put32(p, 0); // depends on
+ p += 4;
+ put32(p, 1); // interval
+ p += 4;
+ put32(p, ival? ival*2: 1024); // duration
+ p += 4;
+ *p++ = 1; // repeat
+ *p++ = 0; // max frags
+ put16(p, 1<<0 | 1<<1 | 1<<11); // policy
+ p += 2;
+ }
ctlr->te.active = 0;
if((err = cmd(ctlr, 41, c, p - c)) != nil)
return err;
+ tsleep(&ctlr->te, timeeventdone, ctlr, 100);
if(amr == CmdRemove){
ctlr->te.active = 0;
ctlr->te.id = -1;
return nil;
- }
- tsleep(&ctlr->te, timeeventdone, ctlr, 100);
- return ctlr->te.active? nil: "timeevent did not start";
+ }else
+ return ctlr->te.active? nil: "timeevent did not start";
}
@@ -2713,6 +2745,9 @@
uchar c[4*(3*4)], *p;
int i;
+ if((ctlr->fw->capa[1] & UcodeCapQuota) == 0)
+ return nil;
+
i = 0;
p = c;
@@ -2822,13 +2857,13 @@
return cmd(ctlr, 210, c, 11*4);
}
-static void
+static char*
tttxbackoff(Ctlr *ctlr)
{
uchar c[4];
put32(c, 0);
- cmd(ctlr, 126, c, sizeof(c));
+ return cmd(ctlr, 126, c, sizeof(c));
}
static char*
@@ -2848,6 +2883,9 @@
char *err;
if(ctlr->calib.done == 0){
+ if(ctlr->family == 7000)
+ if((err = sendbtcoexadv(ctlr)) != nil)
+ return err;
if((err = readnvmconfig(ctlr)) != nil)
return err;
}
@@ -2897,16 +2935,16 @@
/* Initialize tx backoffs to the minimum. */
if(ctlr->family == 7000)
- tttxbackoff(ctlr);
+ if((err = tttxbackoff(ctlr)) != nil)
+ return err;
if((err = updatedevicepower(ctlr)) != nil){
print("can't update device power: %s\n", err);
return err;
}
- if((err = sendmccupdate(ctlr, "ZZ")) != nil){
- print("can't disable beacon filter: %s\n", err);
- return err;
- }
+ if(ctlr->fw->capa[0] & UcodeCapLar)
+ if((err = sendmccupdate(ctlr, "ZZ")) != nil)
+ return err;
if((err = disablebeaconfilter(ctlr)) != nil){
print("can't disable beacon filter: %s\n", err);
return err;
@@ -3418,6 +3456,7 @@
static char*
qcmd(Ctlr *ctlr, uint qid, uint code, uchar *data, int size, Block *block)
{
+ char *err;
int hdrlen;
Block *bcmd;
uchar *d, *c;
@@ -3452,10 +3491,10 @@
return "qcmd: broken";
}
/* wake up the nic (just needed for 7k) */
- if(ctlr->family == 7000 && q->n == 0)
- if(niclock(ctlr) != nil){
+ if(ctlr->family == 7000 && qid == 4 && q->n == 0)
+ if((err = niclock(ctlr)) != nil){
iunlock(ctlr);
- return "qcmd: busy";
+ return err;
}
q->n++;
q->lastcmd = code;
@@ -3586,9 +3625,16 @@
int i;
for(i = 0; i < nelem(ctlr->tx); i++)
- flushq(ctlr, i);
- settimeevent(ctlr, CmdRemove, 0);
+ if((err = flushq(ctlr, i)) != nil){
+ print("can't flush queue %d: %s\n", i, err);
+ return err;
+ }
+ if((err = settimeevent(ctlr, CmdRemove, 0)) != nil){
+ print("can't remove time event: %s\n", err);
+ return err;
+ }
+
if((err = setbindingquotas(ctlr, -1)) != nil){
print("can't disable quotas: %s\n", err);
return err;
@@ -3630,7 +3676,7 @@
return err;
}
if((err = setbindingcontext(ctlr, CmdAdd)) != nil){
- print("removing bindingcontext: %s\n", err);
+ print("adding bindingcontext: %s\n", err);
return err;
}
if((err = setmcastfilter(ctlr)) != nil){
@@ -4283,8 +4329,8 @@
if(tx != nil && tx->n > 0){
tx->n--;
wakeup(tx);
- /* unlock 7k family nics as all commands are done */
- if(ctlr->family == 7000 && tx->n == 0)
+ /* unlock 7k family nics as the command is done */
+ if(ctlr->family == 7000 && qid == 4 && tx->n == 0)
nicunlock(ctlr);
}
}
next prev parent reply other threads:[~2021-08-14 21:13 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 4:43 qwx
2021-08-06 4:57 ` Skylar Bleed
2021-08-06 10:06 ` cinap_lenrek
2021-08-06 17:56 ` Skylar Bleed
2021-08-06 23:48 ` cinap_lenrek
2021-08-07 2:59 ` Skylar Bleed
2021-08-07 11:16 ` cinap_lenrek
2021-08-07 14:39 ` Skylar Bleed
2021-08-07 22:14 ` kemal
2021-08-08 14:35 ` Skylar Bleed
2021-08-09 12:05 ` kemal
2021-08-10 15:11 ` Skylar Bleed
2021-08-12 21:03 ` kemal
2021-08-13 19:49 ` Skylar Bleed
2021-08-14 13:26 ` kemal
2021-08-13 23:41 ` kemal
2021-08-14 17:25 ` cinap_lenrek
2021-08-14 17:50 ` kemal [this message]
2021-08-07 22:27 ` ori
2021-08-07 10:30 ` kemal
2021-08-06 14:07 ` kemal
-- strict thread matches above, loose matches on Subject: below --
2021-07-26 16:30 Skylar Bleed
2021-07-26 19:29 ` cinap_lenrek
2021-07-27 7:21 ` Aw: " Eckard Brauer
2021-08-04 20:50 ` kemal
2021-08-05 0:32 ` kemal
2021-08-05 7:52 ` cinap_lenrek
2021-08-05 12:41 ` kemal
2021-08-05 21:19 ` Eckard Brauer
2021-08-05 22:33 ` cinap_lenrek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABO6shdiWhkwWUKDu3kA7tC4det+cDcHr5rTcQu0Gh4OFnak+Q@mail.gmail.com \
--to=kemalinanc8@gmail.com \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).