Staging driver changes for 7.1-rc1

Here is the "big" set of staging driver changes for 7.1-rc1.
 
 Nothing major in here at all, just lots of little cleanups for the
 staging drivers, driven by new developers getting their feet wet in
 kernel development.  "Largest" thing in here is the change of some of
 the octeon variable types into proper kernel ones.
 
 Full details are in the shortlog.
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCaeSwQw8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+yn5CACeOUA5iM3jzCYLcTzNZCWxtJNndmEAoLmP6DeO
 1gDkw56spKf7LIpi75vJ
 =8gS1
 -----END PGP SIGNATURE-----

Merge tag 'staging-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver updates from Greg KH:
 "Here is the "big" set of staging driver changes for 7.1-rc1.

  Nothing major in here at all, just lots of little cleanups for the
  staging drivers, driven by new developers getting their feet wet in
  kernel development. "Largest" thing in here is the change of some of
  the octeon variable types into proper kernel ones.

  Full details are in the shortlog.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'staging-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (154 commits)
  staging: rtl8723bs: remove redundant & parentheses
  staging: most: dim2: replace BUG_ON() in poison_channel()
  staging: most: dim2: replace BUG_ON() in enqueue()
  staging: most: dim2: replace BUG_ON() in configure_channel()
  staging: most: dim2: replace BUG_ON() in service_done_flag()
  staging: most: dim2: replace BUG_ON() in try_start_dim_transfer()
  staging: rtl8723bs: remove unused RTL8188E antenna selection macros
  staging: rtl8723bs: remove redundant blank lines in basic_types.h
  staging: rtl8723bs: wrap complex macros with parentheses
  staging: rtl8723bs: remove unused WRITEEF/READEF byte macros
  staging: rtl8723bs: rename camelCase variable
  staging: greybus: audio: fix error message for BTN_3 button
  staging: rtl8723bs: rename variables to snake_case
  staging: rtl8723bs: fix spelling in comment
  staging: rtl8723bs: cleanup return in sdio_init()
  staging: rtl8723bs: use direct returns in sdio_dvobj_init()
  staging: rtl8723bs: remove unused arg at odm_interface.h
  greybus: raw: fix use-after-free if write is called after disconnect
  greybus: raw: fix use-after-free on cdev close
  staging: rtl8723bs: fix logical continuations in xmit_linux.c
  ...
This commit is contained in:
Linus Torvalds 2026-04-19 08:51:32 -07:00
commit bea8d77e45
91 changed files with 1726 additions and 2258 deletions

View File

@ -71,8 +71,8 @@ struct axis_fifo {
unsigned int rx_fifo_depth;
unsigned int tx_fifo_depth;
int has_rx_fifo;
int has_tx_fifo;
u32 has_rx_fifo;
u32 has_tx_fifo;
wait_queue_head_t read_queue;
struct mutex read_lock; /* lock for reading */
@ -392,60 +392,39 @@ static int axis_fifo_parse_dt(struct axis_fifo *fifo)
ret = of_property_read_u32(node, "xlnx,axi-str-rxd-tdata-width",
&value);
if (ret) {
dev_err(fifo->dt_device, "missing xlnx,axi-str-rxd-tdata-width property\n");
goto end;
} else if (value != 32) {
dev_err(fifo->dt_device, "xlnx,axi-str-rxd-tdata-width only supports 32 bits\n");
ret = -EIO;
goto end;
}
if (ret)
return ret;
if (value != 32)
return -EINVAL;
ret = of_property_read_u32(node, "xlnx,axi-str-txd-tdata-width",
&value);
if (ret) {
dev_err(fifo->dt_device, "missing xlnx,axi-str-txd-tdata-width property\n");
goto end;
} else if (value != 32) {
dev_err(fifo->dt_device, "xlnx,axi-str-txd-tdata-width only supports 32 bits\n");
ret = -EIO;
goto end;
}
if (ret)
return ret;
if (value != 32)
return -EINVAL;
ret = of_property_read_u32(node, "xlnx,rx-fifo-depth",
&fifo->rx_fifo_depth);
if (ret) {
dev_err(fifo->dt_device, "missing xlnx,rx-fifo-depth property\n");
ret = -EIO;
goto end;
}
if (ret)
return ret;
ret = of_property_read_u32(node, "xlnx,tx-fifo-depth",
&fifo->tx_fifo_depth);
if (ret) {
dev_err(fifo->dt_device, "missing xlnx,tx-fifo-depth property\n");
ret = -EIO;
goto end;
}
if (ret)
return ret;
ret = of_property_read_u32(node, "xlnx,use-rx-data",
&fifo->has_rx_fifo);
if (ret) {
dev_err(fifo->dt_device, "missing xlnx,use-rx-data property\n");
ret = -EIO;
goto end;
}
if (ret)
return ret;
ret = of_property_read_u32(node, "xlnx,use-tx-data",
&fifo->has_tx_fifo);
if (ret) {
dev_err(fifo->dt_device, "missing xlnx,use-tx-data property\n");
ret = -EIO;
goto end;
}
if (ret)
return ret;
end:
return ret;
return 0;
}
static int axis_fifo_probe(struct platform_device *pdev)

View File

@ -86,7 +86,11 @@ config FB_TFT_PCD8544
config FB_TFT_RA8875
tristate "FB driver for the RA8875 LCD Controller"
help
Generic Framebuffer support for RA8875
This enables generic framebuffer support for the RAiO RA8875
display controller. The controller is intended for medium size text/graphic
mixed displays with a resolution of up to 800x480 pixels.
Say Y if you have such a display that utilizes this controller.
config FB_TFT_S6D02A1
tristate "FB driver for the S6D02A1 LCD Controller"

View File

@ -6,27 +6,12 @@ The module 'fbtft' makes writing drivers for some of these displays very easy.
Development is done on a Raspberry Pi running the Raspbian "wheezy" distribution.
INSTALLATION
Download kernel sources
For new hardware support consider using DRM subsystem (see TODO).
From Linux 3.15
cd drivers/video/fbdev/fbtft
git clone https://github.com/notro/fbtft.git
NOTE:
Add to drivers/video/fbdev/Kconfig: source "drivers/video/fbdev/fbtft/Kconfig"
Add to drivers/video/fbdev/Makefile: obj-y += fbtft/
Before Linux 3.15
cd drivers/video
git clone https://github.com/notro/fbtft.git
Add to drivers/video/Kconfig: source "drivers/video/fbtft/Kconfig"
Add to drivers/video/Makefile: obj-y += fbtft/
Enable driver(s) in menuconfig and build the kernel
See wiki for more information: https://github.com/notro/fbtft/wiki
Source: https://github.com/notro/fbtft/
The driver is in maintenance mode, only performance issue or bug fixes
are accepted, which effectively means the patches must be tested on
the real hardware (the patch must be accompanied with the information
what hardware is that). The treewide changes may also be accepted as
an exception.

View File

@ -376,7 +376,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
/* write bitmap */
gpiod_set_value(par->RS, 1); /* RS->1 (data mode) */
par->fbtftops.write(par, buf, len);
ret = par->fbtftops.write(par, buf, len);
if (ret < 0)
dev_err(par->info->device,
"write failed and returned: %d\n",

View File

@ -106,13 +106,6 @@ static int init_display(struct fbtft_par *par)
return 0;
}
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS, 0x00, xs, 0x00, xe);
write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS, 0x00, ys, 0x00, ye);
write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
}
static int set_var(struct fbtft_par *par)
{
/* MADCTL - Memory data access control */
@ -207,7 +200,6 @@ static struct fbtft_display display = {
.gamma = DEFAULT_GAMMA,
.fbtftops = {
.init_display = init_display,
.set_addr_win = set_addr_win,
.set_var = set_var,
.set_gamma = set_gamma,
},

View File

@ -61,18 +61,6 @@ static int init_display(struct fbtft_par *par)
return 0;
};
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
/* column address */
write_reg(par, 0x2a, xs >> 8, xs & 0xff, xe >> 8, xe & 0xff);
/* Row address */
write_reg(par, 0x2b, ys >> 8, ys & 0xff, ye >> 8, ye & 0xff);
/* memory write */
write_reg(par, 0x2c);
}
#define my BIT(7)
#define mx BIT(6)
#define mv BIT(5)
@ -130,7 +118,6 @@ static struct fbtft_display display = {
.gamma = DEFAULT_GAMMA,
.fbtftops = {
.init_display = init_display,
.set_addr_win = set_addr_win,
.set_var = set_var,
.set_gamma = set_gamma,
},

View File

@ -129,19 +129,6 @@ static int init_display(struct fbtft_par *par)
return 0;
}
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
xs >> 8, xs & 0xff, /* XSTART */
xe >> 8, xe & 0xff); /* XEND */
write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
ys >> 8, ys & 0xff, /* YSTART */
ye >> 8, ye & 0xff); /* YEND */
write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
}
#define HX8357D_MADCTL_MY 0x80
#define HX8357D_MADCTL_MX 0x40
#define HX8357D_MADCTL_MV 0x20
@ -184,7 +171,6 @@ static struct fbtft_display display = {
.gamma_len = 14,
.fbtftops = {
.init_display = init_display,
.set_addr_win = set_addr_win,
.set_var = set_var,
},
};

View File

@ -60,7 +60,7 @@
* configure to constrain the memory and resolution to a fixed dimension (in
* that case 128x128) but they leaved those pins configured for 128x160 so
* there was several pixel memory addressing problems.
* I solved by setup several parameters that dinamically fix the resolution as
* I solved by setup several parameters that dynamically fix the resolution as
* needit so below the parameters for this display. If you have a strain or a
* correct display (can happen with chinese) you can copy those parameters and
* create setup for different displays.

View File

@ -78,17 +78,6 @@ static int init_display(struct fbtft_par *par)
return 0;
}
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
}
#define ILI9340_MADCTL_MV 0x20
#define ILI9340_MADCTL_MX 0x40
#define ILI9340_MADCTL_MY 0x80
@ -122,7 +111,6 @@ static struct fbtft_display display = {
.height = HEIGHT,
.fbtftops = {
.init_display = init_display,
.set_addr_win = set_addr_win,
.set_var = set_var,
},
};

View File

@ -65,17 +65,6 @@ static int init_display(struct fbtft_par *par)
return 0;
}
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
(xs >> 8) & 0xFF, xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF);
write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
(ys >> 8) & 0xFF, ys & 0xFF, (ye >> 8) & 0xFF, ye & 0xFF);
write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
}
#define MEM_Y BIT(7) /* MY row address order */
#define MEM_X BIT(6) /* MX column address order */
#define MEM_V BIT(5) /* MV row / column exchange */
@ -139,7 +128,6 @@ static struct fbtft_display display = {
.gamma = DEFAULT_GAMMA,
.fbtftops = {
.init_display = init_display,
.set_addr_win = set_addr_win,
.set_var = set_var,
.set_gamma = set_gamma,
},

View File

@ -42,17 +42,6 @@ static const s16 default_init_sequence[] = {
-3
};
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
xs >> 8, xs & 0xff, xe >> 8, xe & 0xff);
write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
ys >> 8, ys & 0xff, ye >> 8, ye & 0xff);
write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
}
#define HFLIP 0x01
#define VFLIP 0x02
#define ROW_X_COL 0x20
@ -86,7 +75,6 @@ static struct fbtft_display display = {
.height = HEIGHT,
.init_sequence = default_init_sequence,
.fbtftops = {
.set_addr_win = set_addr_win,
.set_var = set_var,
},
};

View File

@ -43,17 +43,6 @@ static const s16 default_init_sequence[] = {
-3
};
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
}
static int set_var(struct fbtft_par *par)
{
switch (par->info->var.rotate) {
@ -86,7 +75,6 @@ static struct fbtft_display display = {
.height = HEIGHT,
.init_sequence = default_init_sequence,
.fbtftops = {
.set_addr_win = set_addr_win,
.set_var = set_var,
},
};

View File

@ -97,17 +97,6 @@ static const s16 default_init_sequence[] = {
};
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
}
#define MY BIT(7)
#define MX BIT(6)
#define MV BIT(5)
@ -149,7 +138,6 @@ static struct fbtft_display display = {
.height = 160,
.init_sequence = default_init_sequence,
.fbtftops = {
.set_addr_win = set_addr_win,
.set_var = set_var,
},
};

View File

@ -83,17 +83,6 @@ static const s16 default_init_sequence[] = {
-3
};
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
}
#define MY BIT(7)
#define MX BIT(6)
#define MV BIT(5)
@ -168,7 +157,6 @@ static struct fbtft_display display = {
.gamma_len = 16,
.gamma = DEFAULT_GAMMA,
.fbtftops = {
.set_addr_win = set_addr_win,
.set_var = set_var,
.set_gamma = set_gamma,
},

View File

@ -41,23 +41,12 @@ static int init_display(struct fbtft_par *par)
0x00, 0x35, 0x33, 0x00, 0x00, 0x00);
write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, 0x55);
write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
udelay(250);
fsleep(250);
write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
return 0;
}
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
}
static int set_var(struct fbtft_par *par)
{
switch (par->info->var.rotate) {
@ -88,7 +77,6 @@ static struct fbtft_display display = {
.height = HEIGHT,
.fbtftops = {
.init_display = init_display,
.set_addr_win = set_addr_win,
.set_var = set_var,
},
};

View File

@ -300,12 +300,6 @@ static void fbtft_mkdirty(struct fb_info *info, int y, int height)
struct fbtft_par *par = info->par;
struct fb_deferred_io *fbdefio = info->fbdefio;
/* special case, needed ? */
if (y == -1) {
y = 0;
height = info->var.yres;
}
/* Mark display lines/area as dirty */
spin_lock(&par->dirty_lock);
if (y < par->dirty_lines_start)
@ -413,9 +407,12 @@ static int fbtft_fb_blank(int blank, struct fb_info *info)
static void fbtft_ops_damage_range(struct fb_info *info, off_t off, size_t len)
{
struct fbtft_par *par = info->par;
u32 start, end;
/* TODO: only mark changed area update all for now */
par->fbtftops.mkdirty(info, -1, 0);
start = off / info->fix.line_length;
end = (off + len - 1) / info->fix.line_length;
par->fbtftops.mkdirty(info, start, end - start + 1);
}
static void fbtft_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height)

View File

@ -58,7 +58,7 @@ int main(int argc, char *argv[])
goto close_fd;
}
printf("UID received: 0x%llx\n", *(unsigned long long int *)(uid.uid));
printf("UID received: 0x%llx\n", *(unsigned long long *)(uid.uid));
/* Get certificate */
printf("Get IMS certificate\n");

View File

@ -123,7 +123,7 @@ menuconfig GREYBUS_BRIDGED_PHY
help
Select this option to pick from a variety of Greybus Bridged
PHY class drivers. These drivers emulate a number of
different "traditional" busses by tunneling them over Greybus.
different "traditional" buses by tunneling them over Greybus.
Examples of this include serial, SPI, USB, and others.
To compile this code as a module, chose M here: the module

View File

@ -300,16 +300,16 @@ static ssize_t state_show(struct device *dev,
switch (apb->state) {
case ARCHE_PLATFORM_STATE_OFF:
return sprintf(buf, "off%s\n",
return sysfs_emit(buf, "off%s\n",
apb->init_disabled ? ",disabled" : "");
case ARCHE_PLATFORM_STATE_ACTIVE:
return sprintf(buf, "active\n");
return sysfs_emit(buf, "active\n");
case ARCHE_PLATFORM_STATE_STANDBY:
return sprintf(buf, "standby\n");
return sysfs_emit(buf, "standby\n");
case ARCHE_PLATFORM_STATE_FW_FLASHING:
return sprintf(buf, "fw_flashing\n");
return sysfs_emit(buf, "fw_flashing\n");
default:
return sprintf(buf, "unknown state\n");
return sysfs_emit(buf, "unknown state\n");
}
}

View File

@ -374,15 +374,15 @@ static ssize_t state_show(struct device *dev,
switch (arche_pdata->state) {
case ARCHE_PLATFORM_STATE_OFF:
return sprintf(buf, "off\n");
return sysfs_emit(buf, "off\n");
case ARCHE_PLATFORM_STATE_ACTIVE:
return sprintf(buf, "active\n");
return sysfs_emit(buf, "active\n");
case ARCHE_PLATFORM_STATE_STANDBY:
return sprintf(buf, "standby\n");
return sysfs_emit(buf, "standby\n");
case ARCHE_PLATFORM_STATE_FW_FLASHING:
return sprintf(buf, "fw_flashing\n");
return sysfs_emit(buf, "fw_flashing\n");
default:
return sprintf(buf, "unknown state\n");
return sysfs_emit(buf, "unknown state\n");
}
}

View File

@ -781,7 +781,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module,
ret = snd_jack_set_key(module->button.jack.jack, SND_JACK_BTN_3,
KEY_VOLUMEDOWN);
if (ret) {
dev_err(module->dev, "Failed to set BTN_0\n");
dev_err(module->dev, "Failed to set BTN_3\n");
goto free_jacks;
}
}

View File

@ -105,18 +105,6 @@ void gb_audio_manager_remove_all(void)
}
EXPORT_SYMBOL_GPL(gb_audio_manager_remove_all);
struct gb_audio_manager_module *gb_audio_manager_get_module(int id)
{
struct gb_audio_manager_module *module;
down_read(&modules_rwsem);
module = gb_audio_manager_get_locked(id);
kobject_get(&module->kobj);
up_read(&modules_rwsem);
return module;
}
EXPORT_SYMBOL_GPL(gb_audio_manager_get_module);
void gb_audio_manager_put_module(struct gb_audio_manager_module *module)
{
kobject_put(&module->kobj);

View File

@ -54,13 +54,6 @@ int gb_audio_manager_remove(int id);
*/
void gb_audio_manager_remove_all(void);
/*
* Retrieves a gb_audio_manager_module_descriptor for the specified id.
* Returns the gb_audio_manager_module_descriptor structure,
* or NULL if there is no module with the specified ID.
*/
struct gb_audio_manager_module *gb_audio_manager_get_module(int id);
/*
* Decreases the refcount of the module, obtained by the get function.
* Modules are removed via gb_audio_manager_remove

View File

@ -69,14 +69,13 @@ static void gb_audio_module_release(struct kobject *kobj)
struct gb_audio_manager_module *module = to_gb_audio_module(kobj);
pr_info("Destroying audio module #%d\n", module->id);
/* TODO -> delete from list */
kfree(module);
}
static ssize_t gb_audio_module_name_show(struct gb_audio_manager_module *module,
struct gb_audio_manager_module_attribute *attr, char *buf)
{
return sprintf(buf, "%s", module->desc.name);
return sysfs_emit(buf, "%s", module->desc.name);
}
static struct gb_audio_manager_module_attribute gb_audio_module_name_attribute =
@ -85,7 +84,7 @@ static struct gb_audio_manager_module_attribute gb_audio_module_name_attribute =
static ssize_t gb_audio_module_vid_show(struct gb_audio_manager_module *module,
struct gb_audio_manager_module_attribute *attr, char *buf)
{
return sprintf(buf, "%d", module->desc.vid);
return sysfs_emit(buf, "%d", module->desc.vid);
}
static struct gb_audio_manager_module_attribute gb_audio_module_vid_attribute =
@ -94,7 +93,7 @@ static struct gb_audio_manager_module_attribute gb_audio_module_vid_attribute =
static ssize_t gb_audio_module_pid_show(struct gb_audio_manager_module *module,
struct gb_audio_manager_module_attribute *attr, char *buf)
{
return sprintf(buf, "%d", module->desc.pid);
return sysfs_emit(buf, "%d", module->desc.pid);
}
static struct gb_audio_manager_module_attribute gb_audio_module_pid_attribute =
@ -104,7 +103,7 @@ static ssize_t gb_audio_module_intf_id_show(struct gb_audio_manager_module *modu
struct gb_audio_manager_module_attribute *attr,
char *buf)
{
return sprintf(buf, "%d", module->desc.intf_id);
return sysfs_emit(buf, "%d", module->desc.intf_id);
}
static struct gb_audio_manager_module_attribute
@ -115,7 +114,7 @@ static ssize_t gb_audio_module_ip_devices_show(struct gb_audio_manager_module *m
struct gb_audio_manager_module_attribute *attr,
char *buf)
{
return sprintf(buf, "0x%X", module->desc.ip_devices);
return sysfs_emit(buf, "0x%X", module->desc.ip_devices);
}
static struct gb_audio_manager_module_attribute
@ -126,7 +125,7 @@ static ssize_t gb_audio_module_op_devices_show(struct gb_audio_manager_module *m
struct gb_audio_manager_module_attribute *attr,
char *buf)
{
return sprintf(buf, "0x%X", module->desc.op_devices);
return sysfs_emit(buf, "0x%X", module->desc.op_devices);
}
static struct gb_audio_manager_module_attribute

View File

@ -125,7 +125,7 @@ static ssize_t field##_show(struct device *dev, \
char *buf) \
{ \
struct gb_loopback *gb = dev_get_drvdata(dev); \
return sprintf(buf, "%u\n", gb->field); \
return sysfs_emit(buf, "%u\n", gb->field); \
} \
static DEVICE_ATTR_RO(field)
@ -137,8 +137,8 @@ static ssize_t name##_##field##_show(struct device *dev, \
struct gb_loopback *gb = dev_get_drvdata(dev); \
/* Report 0 for min and max if no transfer succeeded */ \
if (!gb->requests_completed) \
return sprintf(buf, "0\n"); \
return sprintf(buf, "%" #type "\n", gb->name.field); \
return sysfs_emit(buf, "0\n"); \
return sysfs_emit(buf, "%" #type "\n", gb->name.field); \
} \
static DEVICE_ATTR_RO(name##_##field)
@ -158,7 +158,7 @@ static ssize_t name##_avg_show(struct device *dev, \
rem = do_div(avg, count); \
rem *= 1000000; \
do_div(rem, count); \
return sprintf(buf, "%llu.%06u\n", avg, (u32)rem); \
return sysfs_emit(buf, "%llu.%06u\n", avg, (u32)rem); \
} \
static DEVICE_ATTR_RO(name##_avg)
@ -173,7 +173,7 @@ static ssize_t field##_show(struct device *dev, \
char *buf) \
{ \
struct gb_loopback *gb = dev_get_drvdata(dev); \
return sprintf(buf, "%" #type "\n", gb->field); \
return sysfs_emit(buf, "%" #type "\n", gb->field); \
} \
static ssize_t field##_store(struct device *dev, \
struct device_attribute *attr, \
@ -193,13 +193,13 @@ static ssize_t field##_store(struct device *dev, \
} \
static DEVICE_ATTR_RW(field)
#define gb_dev_loopback_ro_attr(field, conn) \
#define gb_dev_loopback_ro_attr(field) \
static ssize_t field##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
{ \
struct gb_loopback *gb = dev_get_drvdata(dev); \
return sprintf(buf, "%u\n", gb->field); \
return sysfs_emit(buf, "%u\n", gb->field); \
} \
static DEVICE_ATTR_RO(field)
@ -209,7 +209,7 @@ static ssize_t field##_show(struct device *dev, \
char *buf) \
{ \
struct gb_loopback *gb = dev_get_drvdata(dev); \
return sprintf(buf, "%" #type "\n", gb->field); \
return sysfs_emit(buf, "%" #type "\n", gb->field); \
} \
static ssize_t field##_store(struct device *dev, \
struct device_attribute *attr, \
@ -305,7 +305,7 @@ gb_dev_loopback_rw_attr(us_wait, d);
/* Maximum iterations for a given operation: 1-(2^32-1), 0 implies infinite */
gb_dev_loopback_rw_attr(iteration_max, u);
/* The current index of the for (i = 0; i < iteration_max; i++) loop */
gb_dev_loopback_ro_attr(iteration_count, false);
gb_dev_loopback_ro_attr(iteration_count);
/* A flag to indicate synchronous or asynchronous operations */
gb_dev_loopback_rw_attr(async, u);
/* Timeout of an individual asynchronous request */

View File

@ -215,7 +215,7 @@ static int gb_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
/*
* Set period and duty cycle
*
* PWM privodes 64-bit period and duty_cycle, but greybus only accepts
* PWM provides 64-bit period and duty_cycle, but greybus only accepts
* 32-bit, so their values have to be limited to U32_MAX.
*/
if (period > U32_MAX)

View File

@ -21,9 +21,10 @@ struct gb_raw {
struct list_head list;
int list_data;
struct mutex list_lock;
dev_t dev;
struct rw_semaphore disconnect_lock;
bool disconnected;
struct cdev cdev;
struct device *device;
struct device dev;
};
struct raw_data {
@ -148,6 +149,15 @@ static int gb_raw_send(struct gb_raw *raw, u32 len, const char __user *data)
return retval;
}
static void raw_dev_release(struct device *dev)
{
struct gb_raw *raw = container_of(dev, struct gb_raw, dev);
ida_free(&minors, MINOR(raw->dev.devt));
kfree(raw);
}
static int gb_raw_probe(struct gb_bundle *bundle,
const struct greybus_bundle_id *id)
{
@ -164,63 +174,59 @@ static int gb_raw_probe(struct gb_bundle *bundle,
if (cport_desc->protocol_id != GREYBUS_PROTOCOL_RAW)
return -ENODEV;
raw = kzalloc_obj(*raw);
if (!raw)
minor = ida_alloc(&minors, GFP_KERNEL);
if (minor < 0)
return minor;
raw = kzalloc_obj(*raw, GFP_KERNEL);
if (!raw) {
ida_free(&minors, minor);
return -ENOMEM;
}
device_initialize(&raw->dev);
raw->dev.devt = MKDEV(raw_major, minor);
raw->dev.class = &raw_class;
raw->dev.parent = &bundle->dev;
raw->dev.release = raw_dev_release;
retval = dev_set_name(&raw->dev, "gb!raw%d", minor);
if (retval)
goto error_put_device;
connection = gb_connection_create(bundle, le16_to_cpu(cport_desc->id),
gb_raw_request_handler);
if (IS_ERR(connection)) {
retval = PTR_ERR(connection);
goto error_free;
goto error_put_device;
}
INIT_LIST_HEAD(&raw->list);
mutex_init(&raw->list_lock);
init_rwsem(&raw->disconnect_lock);
raw->connection = connection;
greybus_set_drvdata(bundle, raw);
minor = ida_alloc(&minors, GFP_KERNEL);
if (minor < 0) {
retval = minor;
goto error_connection_destroy;
}
raw->dev = MKDEV(raw_major, minor);
cdev_init(&raw->cdev, &raw_fops);
retval = gb_connection_enable(connection);
if (retval)
goto error_remove_ida;
goto error_connection_destroy;
retval = cdev_add(&raw->cdev, raw->dev, 1);
retval = cdev_device_add(&raw->cdev, &raw->dev);
if (retval)
goto error_connection_disable;
raw->device = device_create(&raw_class, &connection->bundle->dev,
raw->dev, raw, "gb!raw%d", minor);
if (IS_ERR(raw->device)) {
retval = PTR_ERR(raw->device);
goto error_del_cdev;
}
return 0;
error_del_cdev:
cdev_del(&raw->cdev);
error_connection_disable:
gb_connection_disable(connection);
error_remove_ida:
ida_free(&minors, minor);
error_connection_destroy:
gb_connection_destroy(connection);
error_free:
kfree(raw);
error_put_device:
put_device(&raw->dev);
return retval;
}
@ -231,11 +237,13 @@ static void gb_raw_disconnect(struct gb_bundle *bundle)
struct raw_data *raw_data;
struct raw_data *temp;
// FIXME - handle removing a connection when the char device node is open.
device_destroy(&raw_class, raw->dev);
cdev_del(&raw->cdev);
cdev_device_del(&raw->cdev, &raw->dev);
down_write(&raw->disconnect_lock);
raw->disconnected = true;
up_write(&raw->disconnect_lock);
gb_connection_disable(connection);
ida_free(&minors, MINOR(raw->dev));
gb_connection_destroy(connection);
mutex_lock(&raw->list_lock);
@ -244,8 +252,7 @@ static void gb_raw_disconnect(struct gb_bundle *bundle)
kfree(raw_data);
}
mutex_unlock(&raw->list_lock);
kfree(raw);
put_device(&raw->dev);
}
/*
@ -278,11 +285,22 @@ static ssize_t raw_write(struct file *file, const char __user *buf,
if (count > MAX_PACKET_SIZE)
return -E2BIG;
down_read(&raw->disconnect_lock);
if (raw->disconnected) {
retval = -ENODEV;
goto exit;
}
retval = gb_raw_send(raw, count, buf);
if (retval)
return retval;
goto exit;
return count;
retval = count;
exit:
up_read(&raw->disconnect_lock);
return retval;
}
static ssize_t raw_read(struct file *file, char __user *buf, size_t count,

View File

@ -206,7 +206,7 @@ static int gb_sdio_request_handler(struct gb_operation *op)
struct gb_message *request;
struct gb_sdio_event_request *payload;
u8 type = op->type;
int ret = 0;
int ret = 0;
u8 event;
if (type != GB_SDIO_TYPE_EVENT) {
@ -372,7 +372,7 @@ static int gb_sdio_transfer(struct gb_sdio_host *host, struct mmc_data *data)
left = data->blksz * data->blocks;
while (left) {
/* check is a stop transmission is pending */
/* check if a stop transmission is pending */
spin_lock(&host->xfer);
if (host->xfer_stop) {
host->xfer_stop = false;

View File

@ -101,11 +101,11 @@ following components are available
Userspace can access the driver by means of character devices.
2) Networking
Standard networking applications (e.g. iperf) can by used to access
Standard networking applications (e.g. iperf) can be used to access
the driver via the networking subsystem.
3) Video4Linux (v4l2)
Standard video applications (e.g. VLC) can by used to access the
Standard video applications (e.g. VLC) can be used to access the
driver via the V4L subsystem.
4) Advanced Linux Sound Architecture (ALSA)
@ -121,7 +121,7 @@ The driver is to be configured via configfs. Each loaded component kernel
object (see section 1.3) registers a subsystem with configfs, which is used to
configure and establish communication pathways (links) to attached devices on
the bus. To do so, the user has to descend into the component's configuration
directory and create a new directory (child config itmes). The name of this
directory and create a new directory (child config items). The name of this
directory will be used as a reference for the link and it will contain the
following attributes:
@ -129,7 +129,7 @@ following attributes:
configure the buffer size for this channel
- subbuffer_size
configure the sub-buffer size for this channel (needed for
synchronous and isochrnous data)
synchronous and isochronous data)
- num_buffers
configure number of buffers used for this channel
- datatype
@ -229,7 +229,7 @@ packets within one USB transaction. This renders
bytes for padding.
Note that at least (2 * subbuffer_size) bytes for isochronous data or
(subbuffer_size * packts_per_xact) bytes for synchronous data need to
(subbuffer_size * packets_per_xact) bytes for synchronous data need to
be put in the transmission buffer and passed to the driver.
Since adapter drivers are allowed to change a chosen configuration to best

View File

@ -7,9 +7,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/printk.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
@ -17,7 +15,6 @@
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/most.h>
#include <linux/of.h>
@ -168,8 +165,8 @@ static int try_start_dim_transfer(struct hdm_channel *hdm_ch)
unsigned long flags;
struct dim_ch_state st;
BUG_ON(!hdm_ch);
BUG_ON(!hdm_ch->is_initialized);
if (!hdm_ch || !hdm_ch->is_initialized)
return -EINVAL;
spin_lock_irqsave(&dim_lock, flags);
if (list_empty(head)) {
@ -190,7 +187,10 @@ static int try_start_dim_transfer(struct hdm_channel *hdm_ch)
return -EAGAIN;
}
BUG_ON(mbo->bus_address == 0);
if (mbo->bus_address == 0) {
spin_unlock_irqrestore(&dim_lock, flags);
return -EFAULT;
}
if (!dim_enqueue_buffer(&hdm_ch->ch, mbo->bus_address, buf_size)) {
list_del(head->next);
spin_unlock_irqrestore(&dim_lock, flags);
@ -246,9 +246,9 @@ static void retrieve_netinfo(struct dim2_hdm *dev, struct mbo *mbo)
{
u8 *data = mbo->virt_address;
pr_info("Node Address: 0x%03x\n", (u16)data[16] << 8 | data[17]);
dev_dbg(&dev->dev, "Node Address: 0x%03x\n", (u16)data[16] << 8 | data[17]);
dev->link_state = data[18];
pr_info("NIState: %d\n", dev->link_state);
dev_dbg(&dev->dev, "NIState: %d\n", dev->link_state);
memcpy(dev->mac_addrs, data + 19, 6);
dev->deliver_netinfo++;
wake_up_interruptible(&dev->netinfo_waitq);
@ -271,8 +271,8 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx)
unsigned long flags;
u8 *data;
BUG_ON(!hdm_ch);
BUG_ON(!hdm_ch->is_initialized);
if (!hdm_ch || !hdm_ch->is_initialized)
return;
spin_lock_irqsave(&dim_lock, flags);
@ -457,7 +457,8 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx,
int const ch_addr = ch_idx * 2 + 2;
struct hdm_channel *const hdm_ch = dev->hch + ch_idx;
BUG_ON(ch_idx < 0 || ch_idx >= DMA_CHANNELS);
if (ch_idx < 0 || ch_idx >= DMA_CHANNELS)
return -EINVAL;
if (hdm_ch->is_initialized)
return -EPERM;
@ -472,13 +473,13 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx,
case MOST_CH_CONTROL:
new_size = dim_norm_ctrl_async_buffer_size(buf_size);
if (new_size == 0) {
pr_err("%s: too small buffer size\n", hdm_ch->name);
dev_err(&dev->dev, "%s: too small buffer size\n", hdm_ch->name);
return -EINVAL;
}
ccfg->buffer_size = new_size;
if (new_size != buf_size)
pr_warn("%s: fixed buffer size (%d -> %d)\n",
hdm_ch->name, buf_size, new_size);
dev_warn(&dev->dev, "%s: fixed buffer size (%d -> %d)\n",
hdm_ch->name, buf_size, new_size);
spin_lock_irqsave(&dim_lock, flags);
hal_ret = dim_init_control(&hdm_ch->ch, is_tx, ch_addr,
is_tx ? new_size * 2 : new_size);
@ -486,13 +487,13 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx,
case MOST_CH_ASYNC:
new_size = dim_norm_ctrl_async_buffer_size(buf_size);
if (new_size == 0) {
pr_err("%s: too small buffer size\n", hdm_ch->name);
dev_err(&dev->dev, "%s: too small buffer size\n", hdm_ch->name);
return -EINVAL;
}
ccfg->buffer_size = new_size;
if (new_size != buf_size)
pr_warn("%s: fixed buffer size (%d -> %d)\n",
hdm_ch->name, buf_size, new_size);
dev_warn(&dev->dev, "%s: fixed buffer size (%d -> %d)\n",
hdm_ch->name, buf_size, new_size);
spin_lock_irqsave(&dim_lock, flags);
hal_ret = dim_init_async(&hdm_ch->ch, is_tx, ch_addr,
is_tx ? new_size * 2 : new_size);
@ -500,41 +501,41 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx,
case MOST_CH_ISOC:
new_size = dim_norm_isoc_buffer_size(buf_size, sub_size);
if (new_size == 0) {
pr_err("%s: invalid sub-buffer size or too small buffer size\n",
hdm_ch->name);
dev_err(&dev->dev, "%s: invalid sub-buffer size or too small buffer size\n",
hdm_ch->name);
return -EINVAL;
}
ccfg->buffer_size = new_size;
if (new_size != buf_size)
pr_warn("%s: fixed buffer size (%d -> %d)\n",
hdm_ch->name, buf_size, new_size);
dev_warn(&dev->dev, "%s: fixed buffer size (%d -> %d)\n",
hdm_ch->name, buf_size, new_size);
spin_lock_irqsave(&dim_lock, flags);
hal_ret = dim_init_isoc(&hdm_ch->ch, is_tx, ch_addr, sub_size);
break;
case MOST_CH_SYNC:
new_size = dim_norm_sync_buffer_size(buf_size, sub_size);
if (new_size == 0) {
pr_err("%s: invalid sub-buffer size or too small buffer size\n",
hdm_ch->name);
dev_err(&dev->dev, "%s: invalid sub-buffer size or too small buffer size\n",
hdm_ch->name);
return -EINVAL;
}
ccfg->buffer_size = new_size;
if (new_size != buf_size)
pr_warn("%s: fixed buffer size (%d -> %d)\n",
hdm_ch->name, buf_size, new_size);
dev_warn(&dev->dev, "%s: fixed buffer size (%d -> %d)\n",
hdm_ch->name, buf_size, new_size);
spin_lock_irqsave(&dim_lock, flags);
hal_ret = dim_init_sync(&hdm_ch->ch, is_tx, ch_addr, sub_size);
break;
default:
pr_err("%s: configure failed, bad channel type: %d\n",
hdm_ch->name, ccfg->data_type);
dev_err(&dev->dev, "%s: configure failed, bad channel type: %d\n",
hdm_ch->name, ccfg->data_type);
return -EINVAL;
}
if (hal_ret != DIM_NO_ERROR) {
spin_unlock_irqrestore(&dim_lock, flags);
pr_err("%s: configure failed (%d), type: %d, is_tx: %d\n",
hdm_ch->name, hal_ret, ccfg->data_type, (int)is_tx);
dev_err(&dev->dev, "%s: configure failed (%d), type: %d, is_tx: %d\n",
hdm_ch->name, hal_ret, ccfg->data_type, (int)is_tx);
return -ENODEV;
}
@ -569,7 +570,8 @@ static int enqueue(struct most_interface *most_iface, int ch_idx,
struct hdm_channel *hdm_ch = dev->hch + ch_idx;
unsigned long flags;
BUG_ON(ch_idx < 0 || ch_idx >= DMA_CHANNELS);
if (ch_idx < 0 || ch_idx >= DMA_CHANNELS)
return -EINVAL;
if (!hdm_ch->is_initialized)
return -EPERM;
@ -608,7 +610,7 @@ static void request_netinfo(struct most_interface *most_iface, int ch_idx,
return;
if (dev->atx_idx < 0) {
pr_err("Async Tx Not initialized\n");
dev_err(&dev->dev, "Async Tx Not initialized\n");
return;
}
@ -645,7 +647,8 @@ static int poison_channel(struct most_interface *most_iface, int ch_idx)
u8 hal_ret;
int ret = 0;
BUG_ON(ch_idx < 0 || ch_idx >= DMA_CHANNELS);
if (ch_idx < 0 || ch_idx >= DMA_CHANNELS)
return -EINVAL;
if (!hdm_ch->is_initialized)
return -EPERM;
@ -657,7 +660,7 @@ static int poison_channel(struct most_interface *most_iface, int ch_idx)
dev->atx_idx = -1;
spin_unlock_irqrestore(&dim_lock, flags);
if (hal_ret != DIM_NO_ERROR) {
pr_err("HAL Failed to close channel %s\n", hdm_ch->name);
dev_err(&dev->dev, "HAL Failed to close channel %s\n", hdm_ch->name);
ret = -EFAULT;
}
@ -799,8 +802,7 @@ static int dim2_probe(struct platform_device *pdev)
dev_fcnt = pdata->fcnt;
}
dev_info(&pdev->dev, "sync: num of frames per sub-buffer: %u\n",
dev_fcnt);
dev_dbg(&pdev->dev, "sync: num of frames per sub-buffer: %u\n", dev_fcnt);
hal_ret = dim_startup(dev->io_base, dev->clk_speed, dev_fcnt);
if (hal_ret != DIM_NO_ERROR) {
dev_err(&pdev->dev, "dim_startup failed: %d\n", hal_ret);
@ -925,28 +927,32 @@ static int fsl_mx6_enable(struct platform_device *pdev)
int ret;
dev->clk = devm_clk_get(&pdev->dev, "mlb");
if (IS_ERR_OR_NULL(dev->clk)) {
dev_err(&pdev->dev, "unable to get mlb clock\n");
return -EFAULT;
}
if (IS_ERR(dev->clk))
return dev_err_probe(&pdev->dev, PTR_ERR(dev->clk),
"unable to get mlb clock\n");
ret = clk_prepare_enable(dev->clk);
if (ret) {
dev_err(&pdev->dev, "%s\n", "clk_prepare_enable failed");
dev_err(&pdev->dev, "clk_prepare_enable failed\n");
return ret;
}
if (dev->clk_speed >= CLK_2048FS) {
/* enable pll */
dev->clk_pll = devm_clk_get(&pdev->dev, "pll8_mlb");
if (IS_ERR_OR_NULL(dev->clk_pll)) {
dev_err(&pdev->dev, "unable to get mlb pll clock\n");
if (IS_ERR(dev->clk_pll)) {
clk_disable_unprepare(dev->clk);
return -EFAULT;
return dev_err_probe(&pdev->dev, PTR_ERR(dev->clk_pll),
"unable to get mlb pll clock\n");
}
writel(0x888, dev->io_base + 0x38);
clk_prepare_enable(dev->clk_pll);
ret = clk_prepare_enable(dev->clk_pll);
if (ret) {
dev_err(&pdev->dev, "failed to enable pll clock\n");
clk_disable_unprepare(dev->clk);
return ret;
}
}
return 0;
@ -975,7 +981,7 @@ static int rcar_gen2_enable(struct platform_device *pdev)
ret = clk_prepare_enable(dev->clk);
if (ret) {
dev_err(&pdev->dev, "%s\n", "clk_prepare_enable failed");
dev_err(&pdev->dev, "clk_prepare_enable failed\n");
return ret;
}
@ -1020,7 +1026,7 @@ static int rcar_gen3_enable(struct platform_device *pdev)
ret = clk_prepare_enable(dev->clk);
if (ret) {
dev_err(&pdev->dev, "%s\n", "clk_prepare_enable failed");
dev_err(&pdev->dev, "clk_prepare_enable failed\n");
return ret;
}

View File

@ -11,9 +11,8 @@
#include "hal.h"
#include "errors.h"
#include "reg.h"
#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/io.h>
#include <linux/kernel.h>
/*
* Size factor for isochronous DBR buffer.
@ -45,8 +44,6 @@
#define DBR_SIZE (16 * 1024) /* specified by IP */
#define DBR_BLOCK_SIZE (DBR_SIZE / 32 / DBR_MAP_SIZE)
#define ROUND_UP_TO(x, d) (DIV_ROUND_UP(x, (d)) * (d))
/* -------------------------------------------------------------------------- */
/* generic helper functions and macros */
@ -758,7 +755,7 @@ static u8 init_ctrl_async(struct dim_channel *ch, u8 type, u8 is_tx,
return DIM_INIT_ERR_CHANNEL_ADDRESS;
if (!ch->dbr_size)
ch->dbr_size = ROUND_UP_TO(hw_buffer_size, DBR_BLOCK_SIZE);
ch->dbr_size = round_up(hw_buffer_size, DBR_BLOCK_SIZE);
ch->dbr_addr = alloc_dbr(ch->dbr_size);
if (ch->dbr_addr >= DBR_SIZE)
return DIM_INIT_ERR_OUT_OF_MEMORY;

View File

@ -10,7 +10,6 @@
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/wait.h>

View File

@ -659,8 +659,10 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
nvec_tx_set(nvec);
to_send = nvec->tx->data[0];
nvec->tx->pos = 1;
/* delay ACK due to AP20 HW Bug
do not replace by usleep_range */
/*
* delay ACK due to AP20 HW Bug
* do not replace by usleep_range
*/
udelay(33);
} else if (status == (I2C_SL_IRQ)) {
nvec->rx->data[1] = received;
@ -811,13 +813,12 @@ static int tegra_nvec_probe(struct platform_device *pdev)
nvec->irq = platform_get_irq(pdev, 0);
if (nvec->irq < 0)
return -ENODEV;
return nvec->irq;
i2c_clk = devm_clk_get(dev, "div-clk");
if (IS_ERR(i2c_clk)) {
dev_err(dev, "failed to get controller clock\n");
return -ENODEV;
}
if (IS_ERR(i2c_clk))
return dev_err_probe(dev, PTR_ERR(i2c_clk),
"failed to get controller clock\n");
nvec->rst = devm_reset_control_get_exclusive(dev, "i2c");
if (IS_ERR(nvec->rst)) {
@ -849,10 +850,8 @@ static int tegra_nvec_probe(struct platform_device *pdev)
err = devm_request_irq(dev, nvec->irq, nvec_interrupt, IRQF_NO_AUTOEN,
"nvec", nvec);
if (err) {
dev_err(dev, "couldn't request irq\n");
return -ENODEV;
}
if (err)
return dev_err_probe(dev, err, "couldn't request irq\n");
tegra_init_i2c_slave(nvec);

View File

@ -535,7 +535,7 @@ void cvm_oct_rx_shutdown(void)
cvmx_write_csr(CVMX_POW_WQ_INT_THRX(i), 0);
/* Free the interrupt handler */
free_irq(oct_rx_group[i].irq, cvm_oct_device);
free_irq(oct_rx_group[i].irq, &oct_rx_group[i].napi);
netif_napi_del(&oct_rx_group[i].napi);
}

View File

@ -449,8 +449,6 @@ netdev_tx_t cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
case QUEUE_CORE:
__skb_queue_tail(&priv->tx_free_list[qos], skb);
break;
default:
BUG();
}
while (skb_to_free > 0) {

File diff suppressed because it is too large Load Diff

View File

@ -367,7 +367,6 @@ void add_ratid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
void update_bmc_sta(struct adapter *padapter)
{
unsigned char network_type;
int support_rate_num = 0;
unsigned int tx_ra_bitmap = 0;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@ -388,12 +387,10 @@ void update_bmc_sta(struct adapter *padapter)
psta->ieee8021x_blocked = false;
memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
memset(&psta->sta_stats, 0, sizeof(struct stainfo_stats));
/* prepare for add_ratid */
support_rate_num = rtw_get_rateset_len((u8 *)&pcur_network->supported_rates);
network_type = rtw_check_network_type((u8 *)&pcur_network->supported_rates,
support_rate_num,
pcur_network->configuration.ds_config
);
if (is_supported_tx_cck(network_type)) {
@ -545,7 +542,7 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta)
/* todo: init other variables */
memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
memset(&psta->sta_stats, 0, sizeof(struct stainfo_stats));
/* add ratid */
/* add_ratid(padapter, psta); move to ap_sta_info_defer_update() */
@ -800,7 +797,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
{
int ret = _SUCCESS;
u8 *p;
u8 *pHT_caps_ie = NULL;
u8 *ht_caps_ie = NULL;
u8 *pHT_info_ie = NULL;
struct sta_info *psta = NULL;
u16 cap, ht_cap = false;
@ -885,12 +882,10 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
WLAN_EID_EXT_SUPP_RATES,
&ie_len,
pbss_network->ie_length - _BEACON_IE_OFFSET_);
if (p) {
if (p)
memcpy(support_rate + support_rate_num, p + 2, ie_len);
support_rate_num += ie_len;
}
network_type = rtw_check_network_type(support_rate, support_rate_num, channel);
network_type = rtw_check_network_type(support_rate, channel);
rtw_set_supported_rate(pbss_network->supported_rates, network_type);
@ -1006,17 +1001,17 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
u8 max_rx_ampdu_factor = 0;
struct ieee80211_ht_cap *pht_cap = (struct ieee80211_ht_cap *)(p + 2);
pHT_caps_ie = p;
ht_caps_ie = p;
ht_cap = true;
network_type |= WIRELESS_11_24N;
rtw_ht_use_default_setting(padapter);
if (pmlmepriv->htpriv.sgi_20m == false)
if (!pmlmepriv->htpriv.sgi_20m)
pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_SGI_20));
if (pmlmepriv->htpriv.sgi_40m == false)
if (!pmlmepriv->htpriv.sgi_40m)
pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_SGI_40));
if (!TEST_FLAG(pmlmepriv->htpriv.ldpc_cap, LDPC_HT_ENABLE_RX))
@ -1094,7 +1089,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
if (pregistrypriv->ampdu_enable == 1)
pmlmepriv->htpriv.ampdu_enable = true;
HT_caps_handler(padapter, (struct ndis_80211_var_ie *)pHT_caps_ie);
HT_caps_handler(padapter, (struct ndis_80211_var_ie *)ht_caps_ie);
HT_info_handler(padapter, (struct ndis_80211_var_ie *)pHT_info_ie);
}
@ -1156,7 +1151,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr)
paclnode = list_entry(plist, struct rtw_wlan_acl_node, list);
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid == true) {
if (paclnode->valid) {
added = true;
break;
}
@ -1369,20 +1364,20 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter)
&len,
(pnetwork->ie_length - _BEACON_IE_OFFSET_));
if (p && len > 0) {
struct ndis_80211_var_ie *pIE = (struct ndis_80211_var_ie *)p;
struct ndis_80211_var_ie *ie = (struct ndis_80211_var_ie *)p;
if (pmlmepriv->num_sta_non_erp == 1)
pIE->data[0] |= RTW_ERP_INFO_NON_ERP_PRESENT | RTW_ERP_INFO_USE_PROTECTION;
ie->data[0] |= RTW_ERP_INFO_NON_ERP_PRESENT | RTW_ERP_INFO_USE_PROTECTION;
else
pIE->data[0] &= ~(RTW_ERP_INFO_NON_ERP_PRESENT |
ie->data[0] &= ~(RTW_ERP_INFO_NON_ERP_PRESENT |
RTW_ERP_INFO_USE_PROTECTION);
if (pmlmepriv->num_sta_no_short_preamble > 0)
pIE->data[0] |= RTW_ERP_INFO_BARKER_PREAMBLE_MODE;
ie->data[0] |= RTW_ERP_INFO_BARKER_PREAMBLE_MODE;
else
pIE->data[0] &= ~(RTW_ERP_INFO_BARKER_PREAMBLE_MODE);
ie->data[0] &= ~(RTW_ERP_INFO_BARKER_PREAMBLE_MODE);
ERP_IE_handler(padapter, pIE);
ERP_IE_handler(padapter, ie);
}
}
@ -1439,7 +1434,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)
remainder_ielen = ielen - wps_offset - wps_ielen;
if (premainder_ie && remainder_ielen)
if (remainder_ielen)
pbackup_remainder_ie = kmemdup(premainder_ie, remainder_ielen, GFP_ATOMIC);
wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
@ -1573,8 +1568,8 @@ static int rtw_ht_operation_update(struct adapter *padapter)
if (pmlmepriv->htpriv.ht_option)
return 0;
if (!(pmlmepriv->ht_op_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)
&& pmlmepriv->num_sta_ht_no_gf) {
if (!(pmlmepriv->ht_op_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT) &&
pmlmepriv->num_sta_ht_no_gf) {
pmlmepriv->ht_op_mode |=
IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT;
op_mode_changes++;
@ -1780,8 +1775,8 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
if (psta->no_short_preamble_set) {
psta->no_short_preamble_set = 0;
pmlmepriv->num_sta_no_short_preamble--;
if (pmlmeext->cur_wireless_mode > WIRELESS_11B
&& pmlmepriv->num_sta_no_short_preamble == 0){
if (pmlmeext->cur_wireless_mode > WIRELESS_11B &&
pmlmepriv->num_sta_no_short_preamble == 0){
beacon_updated = true;
update_beacon(padapter, 0xFF, NULL, true);
}
@ -1799,8 +1794,8 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
if (psta->no_short_slot_time_set) {
psta->no_short_slot_time_set = 0;
pmlmepriv->num_sta_no_short_slot_time--;
if (pmlmeext->cur_wireless_mode > WIRELESS_11B
&& pmlmepriv->num_sta_no_short_slot_time == 0){
if (pmlmeext->cur_wireless_mode > WIRELESS_11B &&
pmlmepriv->num_sta_no_short_slot_time == 0){
beacon_updated = true;
update_beacon(padapter, 0xFF, NULL, true);
}

View File

@ -54,7 +54,6 @@ void rtw_btcoex_LPS_Enter(struct adapter *padapter)
struct pwrctrl_priv *pwrpriv;
u8 lps_val;
pwrpriv = adapter_to_pwrctl(padapter);
pwrpriv->bpower_saving = true;

View File

@ -8,6 +8,7 @@
#include <hal_btcoex.h>
#include <linux/jiffies.h>
#include <linux/align.h>
#include <linux/delay.h>
static struct _cmd_callback rtw_cmd_callback[] = {
{GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/
@ -214,7 +215,7 @@ void _rtw_free_evt_priv(struct evt_priv *pevtpriv)
{
_cancel_workitem_sync(&pevtpriv->c2h_wk);
while (pevtpriv->c2h_wk_alive)
msleep(10);
fsleep(10 * USEC_PER_MSEC);
while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
@ -1125,14 +1126,18 @@ static void collect_traffic_statistics(struct adapter *padapter)
pdvobjpriv->traffic_stat.cur_rx_tp = (u32)(pdvobjpriv->traffic_stat.cur_rx_bytes * 8 / 2 / 1024 / 1024);
}
u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer)
bool traffic_status_watchdog(struct adapter *padapter, bool from_timer)
{
u8 bEnterPS = false;
u16 BusyThresholdHigh = 25;
u16 BusyThresholdLow = 10;
u16 BusyThreshold = BusyThresholdHigh;
u8 bBusyTraffic = false, bTxBusyTraffic = false, bRxBusyTraffic = false;
u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false, bHigherBusyTxTraffic = false;
bool should_enter_ps = false;
u16 busy_threshold_high = 25;
u16 busy_threshold_low = 10;
u16 busy_threshold = busy_threshold_high;
bool busy_traffic = false;
bool tx_busy_traffic = false;
bool rx_busy_traffic = false;
bool higher_busy_traffic = false;
bool higher_busy_rx_traffic = false;
bool higher_busy_tx_traffic = false;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
collect_traffic_statistics(padapter);
@ -1142,57 +1147,60 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer)
/* */
if ((check_fwstate(pmlmepriv, _FW_LINKED))
/*&& !MgntInitAdapterInProgress(pMgntInfo)*/) {
/* if we raise bBusyTraffic in last watchdog, using lower threshold. */
if (pmlmepriv->LinkDetectInfo.bBusyTraffic)
BusyThreshold = BusyThresholdLow;
/* if we raise busy_traffic in last watchdog, using lower threshold. */
if (pmlmepriv->link_detect_info.busy_traffic)
busy_threshold = busy_threshold_low;
if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > BusyThreshold ||
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold) {
bBusyTraffic = true;
if (pmlmepriv->link_detect_info.num_rx_ok_in_period > busy_threshold ||
pmlmepriv->link_detect_info.num_tx_ok_in_period > busy_threshold) {
busy_traffic = true;
if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > pmlmepriv->LinkDetectInfo.NumTxOkInPeriod)
bRxBusyTraffic = true;
if (pmlmepriv->link_detect_info.num_rx_ok_in_period >
pmlmepriv->link_detect_info.num_tx_ok_in_period)
rx_busy_traffic = true;
else
bTxBusyTraffic = true;
tx_busy_traffic = true;
}
/* Higher Tx/Rx data. */
if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 4000 ||
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 4000) {
bHigherBusyTraffic = true;
if (pmlmepriv->link_detect_info.num_rx_ok_in_period > 4000 ||
pmlmepriv->link_detect_info.num_tx_ok_in_period > 4000) {
higher_busy_traffic = true;
if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > pmlmepriv->LinkDetectInfo.NumTxOkInPeriod)
bHigherBusyRxTraffic = true;
if (pmlmepriv->link_detect_info.num_rx_ok_in_period >
pmlmepriv->link_detect_info.num_tx_ok_in_period)
higher_busy_rx_traffic = true;
else
bHigherBusyTxTraffic = true;
higher_busy_tx_traffic = true;
}
/* check traffic for powersaving. */
if (((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8) ||
(pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) {
bEnterPS = false;
if (((pmlmepriv->link_detect_info.num_rx_unicast_ok_in_period +
pmlmepriv->link_detect_info.num_tx_ok_in_period) > 8) ||
(pmlmepriv->link_detect_info.num_rx_unicast_ok_in_period > 2)) {
should_enter_ps = false;
if (bBusyTraffic) {
if (pmlmepriv->LinkDetectInfo.TrafficTransitionCount <= 4)
pmlmepriv->LinkDetectInfo.TrafficTransitionCount = 4;
if (busy_traffic) {
if (pmlmepriv->link_detect_info.traffic_transition_count <= 4)
pmlmepriv->link_detect_info.traffic_transition_count = 4;
pmlmepriv->LinkDetectInfo.TrafficTransitionCount++;
pmlmepriv->link_detect_info.traffic_transition_count++;
if (pmlmepriv->LinkDetectInfo.TrafficTransitionCount > 30/*TrafficTransitionLevel*/)
pmlmepriv->LinkDetectInfo.TrafficTransitionCount = 30;
if (pmlmepriv->link_detect_info.traffic_transition_count > 30)
pmlmepriv->link_detect_info.traffic_transition_count = 30;
}
} else {
if (pmlmepriv->LinkDetectInfo.TrafficTransitionCount >= 2)
pmlmepriv->LinkDetectInfo.TrafficTransitionCount -= 2;
if (pmlmepriv->link_detect_info.traffic_transition_count >= 2)
pmlmepriv->link_detect_info.traffic_transition_count -= 2;
else
pmlmepriv->LinkDetectInfo.TrafficTransitionCount = 0;
pmlmepriv->link_detect_info.traffic_transition_count = 0;
if (pmlmepriv->LinkDetectInfo.TrafficTransitionCount == 0)
bEnterPS = true;
if (pmlmepriv->link_detect_info.traffic_transition_count == 0)
should_enter_ps = true;
}
/* LeisurePS only work in infra mode. */
if (bEnterPS) {
if (should_enter_ps) {
if (!from_timer)
LPS_Enter(padapter, "TRAFFIC_IDLE");
} else {
@ -1212,17 +1220,17 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer)
LPS_Leave(padapter, "NON_LINKED");
}
pmlmepriv->LinkDetectInfo.NumRxOkInPeriod = 0;
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod = 0;
pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod = 0;
pmlmepriv->LinkDetectInfo.bBusyTraffic = bBusyTraffic;
pmlmepriv->LinkDetectInfo.bTxBusyTraffic = bTxBusyTraffic;
pmlmepriv->LinkDetectInfo.bRxBusyTraffic = bRxBusyTraffic;
pmlmepriv->LinkDetectInfo.bHigherBusyTraffic = bHigherBusyTraffic;
pmlmepriv->LinkDetectInfo.bHigherBusyRxTraffic = bHigherBusyRxTraffic;
pmlmepriv->LinkDetectInfo.bHigherBusyTxTraffic = bHigherBusyTxTraffic;
pmlmepriv->link_detect_info.num_rx_ok_in_period = 0;
pmlmepriv->link_detect_info.num_tx_ok_in_period = 0;
pmlmepriv->link_detect_info.num_rx_unicast_ok_in_period = 0;
pmlmepriv->link_detect_info.busy_traffic = busy_traffic;
pmlmepriv->link_detect_info.tx_busy_traffic = tx_busy_traffic;
pmlmepriv->link_detect_info.rx_busy_traffic = rx_busy_traffic;
pmlmepriv->link_detect_info.higher_busy_traffic = higher_busy_traffic;
pmlmepriv->link_detect_info.higher_busy_rx_traffic = higher_busy_rx_traffic;
pmlmepriv->link_detect_info.higher_busy_tx_traffic = higher_busy_tx_traffic;
return bEnterPS;
return should_enter_ps;
}
static void dynamic_chk_wk_hdl(struct adapter *padapter)
@ -1239,7 +1247,7 @@ static void dynamic_chk_wk_hdl(struct adapter *padapter)
/* if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING|_FW_UNDER_SURVEY) ==false) */
{
linked_status_chk(padapter);
traffic_status_watchdog(padapter, 0);
traffic_status_watchdog(padapter, false);
}
rtw_hal_dm_watchdog(padapter);
@ -1495,7 +1503,7 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &empty);
while (!empty && jiffies_to_msecs(jiffies - start) < g_wait_hiq_empty) {
msleep(100);
fsleep(100 * USEC_PER_MSEC);
rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &empty);
}
@ -1761,7 +1769,8 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf)
rtw_free_assoc_resources(padapter, 1);
break;
case C2H_WK_CID:
rtw_hal_set_hwreg_with_buf(padapter, HW_VAR_C2H_HANDLE, pdrvextra_cmd->pbuf, pdrvextra_cmd->size);
rtw_hal_set_hwreg_with_buf(padapter, HW_VAR_C2H_HANDLE,
pdrvextra_cmd->pbuf, pdrvextra_cmd->size);
break;
case DM_RA_MSK_WK_CID:
rtw_dm_ra_mask_hdl(padapter, (struct sta_info *)pdrvextra_cmd->pbuf);

View File

@ -8,24 +8,6 @@
#include <hal_data.h>
#include <linux/jiffies.h>
/* Define global variables */
u8 fakeEfuseBank;
u32 fakeEfuseUsedBytes;
u8 fakeEfuseContent[EFUSE_MAX_HW_SIZE] = {0};
u8 fakeEfuseInitMap[EFUSE_MAX_MAP_LEN] = {0};
u8 fakeEfuseModifiedMap[EFUSE_MAX_MAP_LEN] = {0};
u32 BTEfuseUsedBytes;
u8 BTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
u8 BTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN] = {0};
u8 BTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
u32 fakeBTEfuseUsedBytes;
u8 fakeBTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
u8 fakeBTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN] = {0};
u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
/* 11/16/2008 MH Add description. Get current efuse area enabled word!!. */
u8
Efuse_CalculateWordCnts(u8 word_en)
@ -69,7 +51,7 @@ u16 Address)
u32 k = 0;
u16 contentLen = 0;
Hal_GetEfuseDefinition(Adapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen);
Hal_GetEfuseDefinition(Adapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, &contentLen);
if (Address < contentLen) {/* E-fuse 512Byte */
/* Write E-fuse Register address bit0~7 */
@ -163,7 +145,7 @@ static void Efuse_ReadAllMap(struct adapter *padapter, u8 efuseType, u8 *Efuse)
Hal_EfusePowerSwitch(padapter, true);
Hal_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
Hal_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, &mapLen);
Hal_ReadEFuse(padapter, efuseType, 0, mapLen, Efuse);
@ -239,7 +221,7 @@ void EFUSE_ShadowMapUpdate(struct adapter *padapter, u8 efuseType)
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
u16 mapLen = 0;
Hal_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
Hal_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, &mapLen);
if (pEEPROM->bautoload_fail_flag)
memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);

View File

@ -94,7 +94,7 @@ bool rtw_is_cckratesonly_included(u8 *rate)
return true;
}
int rtw_check_network_type(unsigned char *rate, int ratelen, int channel)
int rtw_check_network_type(unsigned char *rate, int channel)
{
if (channel > 14)
return WIRELESS_INVALID;
@ -109,7 +109,7 @@ int rtw_check_network_type(unsigned char *rate, int ratelen, int channel)
u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char *source,
unsigned int *frlen)
{
memcpy((void *)pbuf, (void *)source, len);
memcpy(pbuf, source, len);
*frlen = *frlen + len;
return pbuf + len;
}
@ -126,7 +126,7 @@ u8 *rtw_set_ie(u8 *pbuf,
*(pbuf + 1) = (u8)len;
if (len > 0)
memcpy((void *)(pbuf + 2), (void *)source, len);
memcpy(pbuf + 2, source, len);
*frlen = *frlen + (len + 2);
@ -192,8 +192,8 @@ u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, u
if (cnt + 2 + ie_len > in_len)
break;
if (eid == in_ie[cnt]
&& (!oui || (ie_len >= oui_len && !memcmp(&in_ie[cnt + 2], oui, oui_len)))) {
if (eid == in_ie[cnt] &&
(!oui || (ie_len >= oui_len && !memcmp(&in_ie[cnt + 2], oui, oui_len)))) {
target_ie = &in_ie[cnt];
if (ie)
@ -291,7 +291,7 @@ uint rtw_get_rateset_len(u8 *rateset)
int rtw_generate_ie(struct registry_priv *pregistrypriv)
{
u8 wireless_mode;
int sz = 0, rateLen;
int sz = 0, rate_len;
struct wlan_bssid_ex *pdev_network = &pregistrypriv->dev_network;
u8 *ie = pdev_network->ies;
@ -326,13 +326,13 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
rtw_set_supported_rate(pdev_network->supported_rates, wireless_mode);
rateLen = rtw_get_rateset_len(pdev_network->supported_rates);
rate_len = rtw_get_rateset_len(pdev_network->supported_rates);
if (rateLen > 8) {
if (rate_len > 8) {
ie = rtw_set_ie(ie, WLAN_EID_SUPP_RATES, 8, pdev_network->supported_rates, &sz);
/* ie = rtw_set_ie(ie, WLAN_EID_EXT_SUPP_RATES, (rateLen - 8), (pdev_network->supported_rates + 8), &sz); */
/* ie = rtw_set_ie(ie, WLAN_EID_EXT_SUPP_RATES, (rate_len - 8), (pdev_network->supported_rates + 8), &sz); */
} else {
ie = rtw_set_ie(ie, WLAN_EID_SUPP_RATES, rateLen, pdev_network->supported_rates, &sz);
ie = rtw_set_ie(ie, WLAN_EID_SUPP_RATES, rate_len, pdev_network->supported_rates, &sz);
}
/* DS parameter set */
@ -342,8 +342,8 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
ie = rtw_set_ie(ie, WLAN_EID_IBSS_PARAMS, 2, (u8 *)&(pdev_network->configuration.atim_window), &sz);
if (rateLen > 8)
ie = rtw_set_ie(ie, WLAN_EID_EXT_SUPP_RATES, (rateLen - 8), (pdev_network->supported_rates + 8), &sz);
if (rate_len > 8)
ie = rtw_set_ie(ie, WLAN_EID_EXT_SUPP_RATES, (rate_len - 8), (pdev_network->supported_rates + 8), &sz);
/* HT Cap. */
if ((pregistrypriv->wireless_mode & WIRELESS_11_24N) &&
@ -455,10 +455,10 @@ int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis
return _FAIL;
}
if ((*wpa_ie != WLAN_EID_VENDOR_SPECIFIC) || (*(wpa_ie+1) != (u8)(wpa_ie_len - 2)) ||
(memcmp(wpa_ie+2, RTW_WPA_OUI_TYPE, WPA_SELECTOR_LEN))) {
if ((*wpa_ie != WLAN_EID_VENDOR_SPECIFIC) ||
(*(wpa_ie + 1) != (u8)(wpa_ie_len - 2)) ||
(memcmp(wpa_ie + 2, RTW_WPA_OUI_TYPE, WPA_SELECTOR_LEN)))
return _FAIL;
}
pos = wpa_ie;
@ -518,7 +518,7 @@ int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi
return _FAIL;
}
if ((*rsn_ie != WLAN_EID_RSN) || (*(rsn_ie+1) != (u8)(rsn_ie_len - 2)))
if ((*rsn_ie != WLAN_EID_RSN) || (*(rsn_ie + 1) != (u8)(rsn_ie_len - 2)))
return _FAIL;
pos = rsn_ie;
@ -585,19 +585,18 @@ int rtw_get_wapi_ie(u8 *in_ie, uint in_len, u8 *wapi_ie, u16 *wapi_len)
while (cnt < in_len) {
authmode = in_ie[cnt];
/* if (authmode == WLAN_EID_BSS_AC_ACCESS_DELAY) */
if (authmode == WLAN_EID_BSS_AC_ACCESS_DELAY && (!memcmp(&in_ie[cnt+6], wapi_oui1, 4) ||
!memcmp(&in_ie[cnt+6], wapi_oui2, 4))) {
if (authmode == WLAN_EID_BSS_AC_ACCESS_DELAY &&
(!memcmp(&in_ie[cnt + 6], wapi_oui1, 4) ||
!memcmp(&in_ie[cnt + 6], wapi_oui2, 4))) {
if (wapi_ie)
memcpy(wapi_ie, &in_ie[cnt], in_ie[cnt+1]+2);
memcpy(wapi_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
if (wapi_len)
*wapi_len = in_ie[cnt+1]+2;
*wapi_len = in_ie[cnt + 1] + 2;
cnt += in_ie[cnt+1]+2; /* get next */
} else {
cnt += in_ie[cnt+1]+2; /* get next */
}
cnt += in_ie[cnt + 1] + 2; /* get next */
}
if (wapi_len)
@ -619,23 +618,20 @@ void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 *wpa_ie
while (cnt < in_len) {
authmode = in_ie[cnt];
if ((authmode == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&in_ie[cnt+2], &wpa_oui[0], 4))) {
if ((authmode == WLAN_EID_VENDOR_SPECIFIC) &&
(!memcmp(&in_ie[cnt + 2], &wpa_oui[0], 4))) {
if (wpa_ie)
memcpy(wpa_ie, &in_ie[cnt], in_ie[cnt+1]+2);
memcpy(wpa_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
*wpa_len = in_ie[cnt + 1] + 2;
cnt += in_ie[cnt + 1] + 2; /* get next */
} else {
if (authmode == WLAN_EID_RSN) {
if (rsn_ie)
memcpy(rsn_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
} else if (authmode == WLAN_EID_RSN) {
if (rsn_ie)
memcpy(rsn_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
*rsn_len = in_ie[cnt+1]+2;
cnt += in_ie[cnt+1]+2; /* get next */
} else {
cnt += in_ie[cnt+1]+2; /* get next */
}
*rsn_len = in_ie[cnt + 1] + 2;
}
cnt += in_ie[cnt + 1] + 2; /* get next */
}
}
@ -665,20 +661,20 @@ u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen)
while (cnt < in_len) {
eid = in_ie[cnt];
if ((eid == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&in_ie[cnt+2], wps_oui, 4))) {
if ((eid == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&in_ie[cnt + 2], wps_oui, 4))) {
wpsie_ptr = &in_ie[cnt];
if (wps_ie)
memcpy(wps_ie, &in_ie[cnt], in_ie[cnt+1]+2);
memcpy(wps_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
if (wps_ielen)
*wps_ielen = in_ie[cnt+1]+2;
*wps_ielen = in_ie[cnt + 1] + 2;
cnt += in_ie[cnt+1]+2;
cnt += in_ie[cnt + 1] + 2;
break;
}
cnt += in_ie[cnt+1]+2; /* goto next */
cnt += in_ie[cnt + 1] + 2; /* goto next */
}
return wpsie_ptr;
@ -756,12 +752,12 @@ u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id, u8
if (attr_ptr && attr_len) {
if (buf_content)
memcpy(buf_content, attr_ptr+4, attr_len-4);
memcpy(buf_content, attr_ptr + 4, attr_len - 4);
if (len_content)
*len_content = attr_len-4;
*len_content = attr_len - 4;
return attr_ptr+4;
return attr_ptr + 4;
}
return NULL;
@ -851,9 +847,9 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen,
* @show_errors: Whether to show parsing errors in debug log
* Returns: Parsing result
*/
enum ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
struct rtw_ieee802_11_elems *elems,
int show_errors)
enum parse_result rtw_ieee802_11_parse_elems(u8 *start, uint len,
struct rtw_ieee802_11_elems *elems,
int show_errors)
{
uint left = len;
u8 *pos = start;
@ -869,7 +865,7 @@ enum ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
left -= 2;
if (elen > left)
return ParseFailed;
return PARSE_FAILED;
switch (id) {
case WLAN_EID_SSID:
@ -972,9 +968,9 @@ enum ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
}
if (left)
return ParseFailed;
return PARSE_FAILED;
return unknown ? ParseUnknown : ParseOK;
return unknown ? PARSE_UNKNOWN : PARSE_OK;
}
void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
@ -1012,20 +1008,25 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork)
int group_cipher = 0, pairwise_cipher = 0, is8021x = 0;
int ret = _FAIL;
pbuf = rtw_get_wpa_ie(&pnetwork->network.ies[12], &wpa_ielen, pnetwork->network.ie_length-12);
pbuf = rtw_get_wpa_ie(&pnetwork->network.ies[12],
&wpa_ielen,
pnetwork->network.ie_length - 12);
if (pbuf && (wpa_ielen > 0)) {
if (rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x) == _SUCCESS) {
if (rtw_parse_wpa_ie(pbuf, wpa_ielen + 2, &group_cipher,
&pairwise_cipher, &is8021x) == _SUCCESS) {
pnetwork->bcn_info.pairwise_cipher = pairwise_cipher;
pnetwork->bcn_info.group_cipher = group_cipher;
pnetwork->bcn_info.is_8021x = is8021x;
ret = _SUCCESS;
}
} else {
pbuf = rtw_get_wpa2_ie(&pnetwork->network.ies[12], &wpa_ielen, pnetwork->network.ie_length-12);
pbuf = rtw_get_wpa2_ie(&pnetwork->network.ies[12], &wpa_ielen,
pnetwork->network.ie_length - 12);
if (pbuf && (wpa_ielen > 0)) {
if (rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x) == _SUCCESS) {
if (rtw_parse_wpa2_ie(pbuf, wpa_ielen + 2, &group_cipher,
&pairwise_cipher, &is8021x) == _SUCCESS) {
pnetwork->bcn_info.pairwise_cipher = pairwise_cipher;
pnetwork->bcn_info.group_cipher = group_cipher;
pnetwork->bcn_info.is_8021x = is8021x;
@ -1094,21 +1095,21 @@ u16 rtw_mcs_rate(u8 bw_40MHz, u8 short_GI, unsigned char *MCS_rate)
u16 max_rate = 0;
if (MCS_rate[0] & BIT(7))
max_rate = (bw_40MHz) ? ((short_GI)?1500:1350):((short_GI)?722:650);
max_rate = (bw_40MHz) ? ((short_GI) ? 1500 : 1350) : ((short_GI) ? 722 : 650);
else if (MCS_rate[0] & BIT(6))
max_rate = (bw_40MHz) ? ((short_GI)?1350:1215):((short_GI)?650:585);
max_rate = (bw_40MHz) ? ((short_GI) ? 1350 : 1215) : ((short_GI) ? 650 : 585);
else if (MCS_rate[0] & BIT(5))
max_rate = (bw_40MHz) ? ((short_GI)?1200:1080):((short_GI)?578:520);
max_rate = (bw_40MHz) ? ((short_GI) ? 1200 : 1080) : ((short_GI) ? 578 : 520);
else if (MCS_rate[0] & BIT(4))
max_rate = (bw_40MHz) ? ((short_GI)?900:810):((short_GI)?433:390);
max_rate = (bw_40MHz) ? ((short_GI) ? 900 : 810) : ((short_GI) ? 433 : 390);
else if (MCS_rate[0] & BIT(3))
max_rate = (bw_40MHz) ? ((short_GI)?600:540):((short_GI)?289:260);
max_rate = (bw_40MHz) ? ((short_GI) ? 600 : 540) : ((short_GI) ? 289 : 260);
else if (MCS_rate[0] & BIT(2))
max_rate = (bw_40MHz) ? ((short_GI)?450:405):((short_GI)?217:195);
max_rate = (bw_40MHz) ? ((short_GI) ? 450 : 405) : ((short_GI) ? 217 : 195);
else if (MCS_rate[0] & BIT(1))
max_rate = (bw_40MHz) ? ((short_GI)?300:270):((short_GI)?144:130);
max_rate = (bw_40MHz) ? ((short_GI) ? 300 : 270) : ((short_GI) ? 144 : 130);
else if (MCS_rate[0] & BIT(0))
max_rate = (bw_40MHz) ? ((short_GI)?150:135):((short_GI)?72:65);
max_rate = (bw_40MHz) ? ((short_GI) ? 150 : 135) : ((short_GI) ? 72 : 65);
return max_rate;
}
@ -1122,11 +1123,9 @@ int rtw_action_frame_parse(const u8 *frame, u32 frame_len, u8 *category, u8 *act
fc = le16_to_cpu(((struct ieee80211_hdr_3addr *)frame)->frame_control);
if ((fc & (IEEE80211_FCTL_FTYPE|IEEE80211_FCTL_STYPE))
!= (IEEE80211_FTYPE_MGMT|IEEE80211_STYPE_ACTION)
) {
if ((fc & (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) !=
(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION))
return false;
}
c = frame_body[0];

View File

@ -75,6 +75,7 @@ int rtw_write8(struct adapter *adapter, u32 addr, u8 val)
return RTW_STATUS_CODE(ret);
}
int rtw_write16(struct adapter *adapter, u32 addr, u16 val)
{
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
@ -88,6 +89,7 @@ int rtw_write16(struct adapter *adapter, u32 addr, u16 val)
ret = _write16(pintfhdl, addr, val);
return RTW_STATUS_CODE(ret);
}
int rtw_write32(struct adapter *adapter, u32 addr, u32 val)
{
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
@ -114,7 +116,9 @@ u32 rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
return _write_port(pintfhdl, addr, cnt, pmem);
}
int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adapter *padapter, struct _io_ops *pops))
int rtw_init_io_priv(struct adapter *padapter,
void (*set_intf_ops)(struct adapter *padapter,
struct _io_ops *pops))
{
struct io_priv *piopriv = &padapter->iopriv;
struct intf_hdl *pintf = &piopriv->intf;
@ -132,7 +136,8 @@ int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adapt
}
/*
* Increase and check if the continual_io_error of this @param dvobjprive is larger than MAX_CONTINUAL_IO_ERR
* Increase and check if the continual_io_error of this @param dvobjprive
* is larger than MAX_CONTINUAL_IO_ERR
* @return true:
* @return false:
*/

View File

@ -11,12 +11,10 @@ u8 rtw_validate_bssid(u8 *bssid)
{
u8 ret = true;
if (is_zero_mac_addr(bssid)
|| is_broadcast_mac_addr(bssid)
|| is_multicast_mac_addr(bssid)
) {
if (is_zero_ether_addr(bssid) ||
is_broadcast_ether_addr(bssid) ||
is_multicast_ether_addr(bssid))
ret = false;
}
return ret;
}
@ -61,9 +59,7 @@ u8 rtw_do_join(struct adapter *padapter)
/* when set_ssid/set_bssid for rtw_do_join(), but scanning queue is empty */
/* we try to issue sitesurvey firstly */
if (pmlmepriv->LinkDetectInfo.bBusyTraffic == false
|| rtw_to_roam(padapter) > 0
) {
if (!pmlmepriv->link_detect_info.busy_traffic || rtw_to_roam(padapter) > 0) {
/* submit site_survey_cmd */
ret = rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0);
if (ret != _SUCCESS)
@ -113,9 +109,8 @@ u8 rtw_do_join(struct adapter *padapter)
/* when set_ssid/set_bssid for rtw_do_join(), but there are no desired bss in scanning queue */
/* we try to issue sitesurvey firstly */
if (pmlmepriv->LinkDetectInfo.bBusyTraffic == false
|| rtw_to_roam(padapter) > 0
) {
if (!pmlmepriv->link_detect_info.busy_traffic ||
rtw_to_roam(padapter) > 0) {
ret = rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0);
if (ret != _SUCCESS)
pmlmepriv->to_join = false;
@ -379,8 +374,8 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s
goto exit;
}
if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true) ||
(pmlmepriv->LinkDetectInfo.bBusyTraffic == true)) {
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING) ||
pmlmepriv->link_detect_info.busy_traffic) {
/* Scan or linking is in progress, do nothing. */
res = true;

View File

@ -262,17 +262,13 @@ void rtw_free_network_queue(struct adapter *padapter, u8 isfreeall)
spin_unlock_bh(&scanned_queue->lock);
}
signed int rtw_if_up(struct adapter *padapter)
bool rtw_if_up(struct adapter *padapter)
{
signed int res;
if (padapter->bDriverStopped || padapter->bSurpriseRemoved ||
!check_fwstate(&padapter->mlmepriv, _FW_LINKED))
res = false;
else
res = true;
return false;
return res;
return true;
}
void rtw_generate_random_ibss(u8 *pibss)
@ -330,21 +326,18 @@ struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr)
return pnetwork;
}
int rtw_is_same_ibss(struct adapter *adapter, struct wlan_network *pnetwork)
bool rtw_is_same_ibss(struct adapter *adapter, struct wlan_network *pnetwork)
{
int ret = true;
struct security_priv *psecuritypriv = &adapter->securitypriv;
if ((psecuritypriv->dot11PrivacyAlgrthm != _NO_PRIVACY_) &&
(pnetwork->network.privacy == 0))
ret = false;
return false;
else if ((psecuritypriv->dot11PrivacyAlgrthm == _NO_PRIVACY_) &&
(pnetwork->network.privacy == 1))
ret = false;
else
ret = true;
return false;
return ret;
return true;
}
inline int is_same_ess(struct wlan_bssid_ex *a, struct wlan_bssid_ex *b)
@ -595,15 +588,14 @@ void rtw_add_network(struct adapter *adapter, struct wlan_bssid_ex *pnetwork)
* (4) HT
* (5) others
*/
int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwork);
int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwork)
static bool rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwork)
{
struct security_priv *psecuritypriv = &adapter->securitypriv;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
u32 desired_encmode;
u32 privacy;
uint wps_ielen;
int bselected = true;
bool bselected = true;
desired_encmode = psecuritypriv->ndisencryptstatus;
privacy = pnetwork->network.privacy;
@ -877,11 +869,10 @@ void rtw_indicate_connect(struct adapter *padapter)
set_fwstate(pmlmepriv, _FW_LINKED);
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) ||
check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
check_fwstate(pmlmepriv, WIFI_ADHOC_STATE))
rtw_cfg80211_ibss_indicate_connect(padapter);
} else {
else
rtw_cfg80211_indicate_connect(padapter);
}
netif_carrier_on(padapter->pnetdev);
@ -1154,10 +1145,8 @@ void rtw_reset_securitypriv(struct adapter *adapter)
/* if join_res > 0, for (fw_state ==WIFI_ADHOC_STATE), we only check if "ptarget_wlan" exist. */
/* if join_res > 0, update "cur_network->network" from "pnetwork->network" if (ptarget_wlan != NULL). */
/* */
/* define REJOIN */
void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
{
static u8 __maybe_unused retry;
struct sta_info *ptarget_sta = NULL, *pcur_sta = NULL;
struct sta_priv *pstapriv = &adapter->stapriv;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
@ -1174,111 +1163,94 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
spin_lock_bh(&pmlmepriv->lock);
pmlmepriv->LinkDetectInfo.TrafficTransitionCount = 0;
pmlmepriv->LinkDetectInfo.LowPowerTransitionCount = 0;
pmlmepriv->link_detect_info.traffic_transition_count = 0;
pmlmepriv->link_detect_info.low_power_transition_count = 0;
if (pnetwork->join_res > 0) {
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
retry = 0;
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
/* s1. find ptarget_wlan */
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
if (the_same_macaddr) {
ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.mac_address);
} else {
pcur_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.mac_address);
if (pcur_wlan)
pcur_wlan->fixed = false;
pcur_sta = rtw_get_stainfo(pstapriv, cur_network->network.mac_address);
if (pcur_sta)
rtw_free_stainfo(adapter, pcur_sta);
ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->network.mac_address);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
if (ptarget_wlan)
ptarget_wlan->fixed = true;
}
}
} else {
ptarget_wlan = _rtw_find_same_network(&pmlmepriv->scanned_queue, pnetwork);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
if (ptarget_wlan)
ptarget_wlan->fixed = true;
}
}
/* s2. update cur_network */
if (ptarget_wlan) {
rtw_joinbss_update_network(adapter, ptarget_wlan, pnetwork);
} else {
netdev_dbg(adapter->pnetdev,
"Can't find ptarget_wlan when joinbss_event callback\n");
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
goto ignore_joinbss_callback;
}
/* s3. find ptarget_sta & update ptarget_sta after update cur_network only for station mode */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
ptarget_sta = rtw_joinbss_update_stainfo(adapter, pnetwork);
if (!ptarget_sta) {
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
goto ignore_joinbss_callback;
}
}
/* s4. indicate connect */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
pmlmepriv->cur_network_scanned = ptarget_wlan;
rtw_indicate_connect(adapter);
}
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
spin_unlock_bh(&pmlmepriv->lock);
/* s5. Cancel assoc_timer */
timer_delete_sync(&pmlmepriv->assoc_timer);
spin_lock_bh(&pmlmepriv->lock);
} else {
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
}
} else if (pnetwork->join_res == -4) {
if (pnetwork->join_res == -4) {
rtw_reset_securitypriv(adapter);
_set_timer(&pmlmepriv->assoc_timer, 1);
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
} else {/* if join_res < 0 (join fails), then try again */
#ifdef REJOIN
res = _FAIL;
if (retry < 2)
res = rtw_select_and_join_from_scanned_queue(pmlmepriv);
if (res == _SUCCESS) {
/* extend time of assoc_timer */
_set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT);
retry++;
} else if (res == 2) {/* there is no need to wait for join */
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
rtw_indicate_connect(adapter);
} else {
#endif
_set_timer(&pmlmepriv->assoc_timer, 1);
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
#ifdef REJOIN
retry = 0;
}
#endif
spin_unlock_bh(&pmlmepriv->lock);
return;
}
ignore_joinbss_callback:
if (pnetwork->join_res <= 0) { /* if join_res < 0 (join fails), then try again */
_set_timer(&pmlmepriv->assoc_timer, 1);
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
spin_unlock_bh(&pmlmepriv->lock);
return;
}
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
if (!check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
spin_unlock_bh(&pmlmepriv->lock);
return;
}
/* s1. find ptarget_wlan */
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
if (the_same_macaddr) {
ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.mac_address);
} else {
pcur_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.mac_address);
if (pcur_wlan)
pcur_wlan->fixed = false;
pcur_sta = rtw_get_stainfo(pstapriv, cur_network->network.mac_address);
if (pcur_sta)
rtw_free_stainfo(adapter, pcur_sta);
ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->network.mac_address);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
if (ptarget_wlan)
ptarget_wlan->fixed = true;
}
}
} else {
ptarget_wlan = _rtw_find_same_network(&pmlmepriv->scanned_queue, pnetwork);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
if (ptarget_wlan)
ptarget_wlan->fixed = true;
}
}
/* s2. update cur_network */
if (!ptarget_wlan) {
netdev_dbg(adapter->pnetdev,
"Can't find ptarget_wlan when joinbss_event callback\n");
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
spin_unlock_bh(&pmlmepriv->lock);
return;
}
rtw_joinbss_update_network(adapter, ptarget_wlan, pnetwork);
/* s3. find ptarget_sta & update ptarget_sta after update cur_network only for station mode */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
ptarget_sta = rtw_joinbss_update_stainfo(adapter, pnetwork);
if (!ptarget_sta) {
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
spin_unlock_bh(&pmlmepriv->lock);
return;
}
}
/* s4. indicate connect */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
pmlmepriv->cur_network_scanned = ptarget_wlan;
rtw_indicate_connect(adapter);
}
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
spin_unlock_bh(&pmlmepriv->lock);
/* s5. Cancel assoc_timer */
timer_delete_sync(&pmlmepriv->assoc_timer);
}
void rtw_joinbss_event_callback(struct adapter *adapter, u8 *pbuf)
@ -1615,7 +1587,7 @@ static void rtw_auto_scan_handler(struct adapter *padapter)
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING))
goto exit;
if (pmlmepriv->LinkDetectInfo.bBusyTraffic)
if (pmlmepriv->link_detect_info.busy_traffic)
goto exit;
}
@ -1643,12 +1615,12 @@ void rtw_dynamic_check_timer_handler(struct adapter *adapter)
if ((adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
&& !(hal_btcoex_IsBtControlLps(adapter))
) {
u8 bEnterPS;
bool should_enter_ps;
linked_status_chk(adapter);
bEnterPS = traffic_status_watchdog(adapter, 1);
if (bEnterPS) {
should_enter_ps = traffic_status_watchdog(adapter, true);
if (should_enter_ps) {
/* rtw_lps_ctrl_wk_cmd(adapter, LPS_CTRL_ENTER, 1); */
rtw_hal_dm_watchdog_in_lps(adapter);
} else {
@ -1703,7 +1675,7 @@ static int rtw_check_roaming_candidate(struct mlme_priv *mlme
goto exit;
/* got specific addr to roam */
if (!is_zero_mac_addr(mlme->roam_tgt_addr)) {
if (!is_zero_ether_addr(mlme->roam_tgt_addr)) {
if (!memcmp(mlme->roam_tgt_addr, competitor->network.mac_address, ETH_ALEN))
goto update;
else
@ -2507,8 +2479,7 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr
struct pkt_attrib *pattrib = &pxmitframe->attrib;
s32 bmcst = is_multicast_ether_addr(pattrib->ra);
/* if (bmcst || (padapter->mlmepriv.LinkDetectInfo.bTxBusyTraffic == false)) */
if (bmcst || (padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod < 100))
if (bmcst || (padapter->mlmepriv.link_detect_info.num_tx_ok_in_period < 100))
return;
priority = pattrib->priority;
@ -2595,7 +2566,7 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network)
}
}
signed int rtw_linked_check(struct adapter *padapter)
bool rtw_linked_check(struct adapter *padapter)
{
if (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) ||
check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE)) {

View File

@ -8,6 +8,7 @@
#include <rtw_wifi_regd.h>
#include <hal_btcoex.h>
#include <linux/kernel.h>
#include <linux/minmax.h>
#include <linux/unaligned.h>
static struct mlme_handler mlme_sta_tbl[] = {
@ -183,12 +184,12 @@ int rtw_ch_set_search_ch(struct rt_channel_info *ch_set, const u32 ch)
/* Following are the initialization functions for WiFi MLME */
int init_hw_mlme_ext(struct adapter *padapter)
void init_hw_mlme_ext(struct adapter *padapter)
{
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
return _SUCCESS;
set_channel_bwmode(padapter, pmlmeext->cur_channel,
pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
}
void init_mlme_default_rate_set(struct adapter *padapter)
@ -525,7 +526,7 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame)
if (is_valid_p2p_probereq)
goto _issue_probersp;
if ((ielen != 0 && false == !memcmp((void *)(p+2), (void *)cur->ssid.ssid, cur->ssid.ssid_length))
if ((ielen != 0 && false == !memcmp((p+2), cur->ssid.ssid, cur->ssid.ssid_length))
|| (ielen == 0 && pmlmeinfo->hidden_ssid_mode)
)
return _SUCCESS;
@ -791,7 +792,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame)
} else { /* shared system or auto authentication */
if (seq == 1) {
/* prepare for the challenging txt... */
memset((void *)pstat->chg_txt, 78, 128);
memset(pstat->chg_txt, 78, 128);
pstat->state &= ~WIFI_FW_AUTH_NULL;
pstat->state |= WIFI_FW_AUTH_STATE;
@ -806,7 +807,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame)
goto auth_fail;
}
if (!memcmp((void *)(p + 2), pstat->chg_txt, 128)) {
if (!memcmp((p + 2), pstat->chg_txt, 128)) {
pstat->state &= (~WIFI_FW_AUTH_STATE);
pstat->state |= WIFI_FW_AUTH_SUCCESS;
/* challenging txt is correct... */
@ -893,7 +894,7 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram
if (!p)
goto authclnt_fail;
memcpy((void *)(pmlmeinfo->chg_txt), (void *)(p + 2), len);
memcpy(pmlmeinfo->chg_txt, p + 2, len);
pmlmeinfo->auth_seq = 3;
issue_auth(padapter, NULL, 0);
set_link_timer(pmlmeext, REAUTH_TO);
@ -933,9 +934,10 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
struct sta_info *pstat;
unsigned char *p, *pos, *wpa_ie;
unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01};
int i, ie_len, wpa_ie_len, left;
int i, ie_len, left;
u8 wpa_ie_len;
unsigned char supportRate[16];
int supportRateNum;
int support_rate_num;
unsigned short status = WLAN_STATUS_SUCCESS;
unsigned short frame_type, ie_offset = 0;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@ -990,7 +992,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
pstat->capability = capab_info;
/* now parse all ieee802_11 ie to point to elems */
if (rtw_ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed ||
if (rtw_ieee802_11_parse_elems(pos, left, &elems, 1) == PARSE_FAILED ||
!elems.ssid) {
status = WLAN_STATUS_CHALLENGE_FAIL;
goto OnAssocReqFail;
@ -1007,7 +1009,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
goto OnAssocReqFail;
} else {
/* check if ssid match */
if (memcmp((void *)(p+2), cur->ssid.ssid, cur->ssid.ssid_length))
if (memcmp(p+2, cur->ssid.ssid, cur->ssid.ssid_length))
status = WLAN_STATUS_CHALLENGE_FAIL;
if (ie_len != cur->ssid.ssid_length)
@ -1022,7 +1024,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
if (!p) {
/* use our own rate set as statoin used */
/* memcpy(supportRate, AP_BSSRATE, AP_BSSRATE_LEN); */
/* supportRateNum = AP_BSSRATE_LEN; */
/* support_rate_num = AP_BSSRATE_LEN; */
status = WLAN_STATUS_CHALLENGE_FAIL;
goto OnAssocReqFail;
@ -1031,25 +1033,25 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
ie_len = sizeof(supportRate);
memcpy(supportRate, p+2, ie_len);
supportRateNum = ie_len;
support_rate_num = ie_len;
p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, WLAN_EID_EXT_SUPP_RATES, &ie_len,
pkt_len - WLAN_HDR_A3_LEN - ie_offset);
if (p) {
if (supportRateNum + ie_len <= sizeof(supportRate)) {
memcpy(supportRate+supportRateNum, p+2, ie_len);
supportRateNum += ie_len;
if (support_rate_num + ie_len <= sizeof(supportRate)) {
memcpy(supportRate + support_rate_num, p + 2, ie_len);
support_rate_num += ie_len;
}
}
}
/* todo: mask supportRate between AP & STA -> move to update raid */
/* get_matched_rate(pmlmeext, supportRate, &supportRateNum, 0); */
/* get_matched_rate(pmlmeext, supportRate, &support_rate_num, 0); */
/* update station supportRate */
pstat->bssratelen = supportRateNum;
memcpy(pstat->bssrateset, supportRate, supportRateNum);
pstat->bssratelen = support_rate_num;
memcpy(pstat->bssrateset, supportRate, support_rate_num);
update_basic_rate_table_soft_ap(pstat->bssrateset, pstat->bssratelen);
/* check RSN/WPA/WPS */
@ -1154,7 +1156,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
pstat->flags |= WLAN_STA_WPS;
copy_len = 0;
} else {
copy_len = ((wpa_ie_len+2) > sizeof(pstat->wpa_ie)) ? (sizeof(pstat->wpa_ie)):(wpa_ie_len+2);
copy_len = min(sizeof(pstat->wpa_ie), wpa_ie_len + 2u);
}
@ -1337,7 +1339,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
asoc_class2_error:
issue_deauth(padapter, (void *)GetAddr2Ptr(pframe), status);
issue_deauth(padapter, GetAddr2Ptr(pframe), status);
return _FAIL;
@ -1511,7 +1513,7 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame)
if (ignore_received_deauth == 0)
receive_disconnect(padapter, GetAddr3Ptr(pframe), reason);
pmlmepriv->LinkDetectInfo.bBusyTraffic = false;
pmlmepriv->link_detect_info.busy_traffic = false;
return _SUCCESS;
}
@ -1563,7 +1565,7 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame)
receive_disconnect(padapter, GetAddr3Ptr(pframe), reason);
pmlmepriv->LinkDetectInfo.bBusyTraffic = false;
pmlmepriv->link_detect_info.busy_traffic = false;
return _SUCCESS;
}
@ -2715,9 +2717,9 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i
fctrl = &(pwlanhdr->frame_control);
*(fctrl) = 0;
memcpy((void *)GetAddr1Ptr(pwlanhdr), pstat->hwaddr, ETH_ALEN);
memcpy((void *)GetAddr2Ptr(pwlanhdr), myid(&(padapter->eeprompriv)), ETH_ALEN);
memcpy((void *)GetAddr3Ptr(pwlanhdr), get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
memcpy(GetAddr1Ptr(pwlanhdr), pstat->hwaddr, ETH_ALEN);
memcpy(GetAddr2Ptr(pwlanhdr), myid(&(padapter->eeprompriv)), ETH_ALEN);
memcpy(GetAddr3Ptr(pwlanhdr), get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
@ -4756,9 +4758,8 @@ static void rtw_mlmeext_disconnect(struct adapter *padapter)
timer_delete_sync(&pmlmeext->link_timer);
/* pmlmepriv->LinkDetectInfo.TrafficBusyState = false; */
pmlmepriv->LinkDetectInfo.TrafficTransitionCount = 0;
pmlmepriv->LinkDetectInfo.LowPowerTransitionCount = 0;
pmlmepriv->link_detect_info.traffic_transition_count = 0;
pmlmepriv->link_detect_info.low_power_transition_count = 0;
}
@ -4885,7 +4886,7 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *p
rtw_hal_update_sta_rate_mask(padapter, psta);
/* ToDo: HT for Ad-hoc */
psta->wireless_mode = rtw_check_network_type(psta->bssrateset, psta->bssratelen, pmlmeext->cur_channel);
psta->wireless_mode = rtw_check_network_type(psta->bssrateset, pmlmeext->cur_channel);
psta->raid = networktype_to_raid_ex(padapter, psta);
/* rate radaptive */

View File

@ -29,14 +29,12 @@ void _ips_enter(struct adapter *padapter)
pwrpriv->rf_pwrstate = rf_off;
}
pwrpriv->bips_processing = false;
}
void ips_enter(struct adapter *padapter)
{
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
hal_btcoex_IpsNotify(padapter, pwrpriv->ips_mode_req);
mutex_lock(&pwrpriv->lock);
@ -84,7 +82,7 @@ int ips_leave(struct adapter *padapter)
static bool rtw_pwr_unassociated_idle(struct adapter *adapter)
{
struct adapter *buddy = adapter->pbuddy_adapter;
struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct xmit_priv *pxmit_priv = &adapter->xmitpriv;
bool ret = false;
@ -95,27 +93,27 @@ static bool rtw_pwr_unassociated_idle(struct adapter *adapter)
if (time_before(jiffies, adapter_to_pwrctl(adapter)->ips_deny_time))
goto exit;
if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE|WIFI_SITE_MONITOR)
|| check_fwstate(pmlmepriv, WIFI_UNDER_LINKING|WIFI_UNDER_WPS)
|| check_fwstate(pmlmepriv, WIFI_AP_STATE)
|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_ADHOC_STATE)
if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE | WIFI_SITE_MONITOR) ||
check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS) ||
check_fwstate(pmlmepriv, WIFI_AP_STATE) ||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE)
)
goto exit;
/* consider buddy, if exist */
if (buddy) {
struct mlme_priv *b_pmlmepriv = &(buddy->mlmepriv);
struct mlme_priv *b_pmlmepriv = &buddy->mlmepriv;
if (check_fwstate(b_pmlmepriv, WIFI_ASOC_STATE|WIFI_SITE_MONITOR)
|| check_fwstate(b_pmlmepriv, WIFI_UNDER_LINKING|WIFI_UNDER_WPS)
|| check_fwstate(b_pmlmepriv, WIFI_AP_STATE)
|| check_fwstate(b_pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_ADHOC_STATE)
if (check_fwstate(b_pmlmepriv, WIFI_ASOC_STATE | WIFI_SITE_MONITOR) ||
check_fwstate(b_pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS) ||
check_fwstate(b_pmlmepriv, WIFI_AP_STATE) ||
check_fwstate(b_pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE)
)
goto exit;
}
if (pxmit_priv->free_xmitbuf_cnt != NR_XMITBUFF ||
pxmit_priv->free_xmit_extbuf_cnt != NR_XMIT_EXTBUFF) {
pxmit_priv->free_xmit_extbuf_cnt != NR_XMIT_EXTBUFF) {
netdev_dbg(adapter->pnetdev,
"There are some pkts to transmit\n");
netdev_dbg(adapter->pnetdev,
@ -131,7 +129,6 @@ static bool rtw_pwr_unassociated_idle(struct adapter *adapter)
return ret;
}
/*
* ATTENTION:
*rtw_ps_processor() doesn't handle LPS.
@ -158,7 +155,7 @@ void rtw_ps_processor(struct adapter *padapter)
if (!rtw_pwr_unassociated_idle(padapter))
goto exit;
if ((pwrpriv->rf_pwrstate == rf_on) && ((pwrpriv->pwr_state_check_cnts%4) == 0)) {
if ((pwrpriv->rf_pwrstate == rf_on) && ((pwrpriv->pwr_state_check_cnts % 4) == 0)) {
pwrpriv->change_rfpwrstate = rf_off;
{
ips_enter(padapter);
@ -184,8 +181,6 @@ void traffic_check_for_leave_lps(struct adapter *padapter, u8 tx, u32 tx_packets
u8 bLeaveLPS = false;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
if (tx) { /* from tx */
xmit_cnt += tx_packets;
@ -194,9 +189,9 @@ void traffic_check_for_leave_lps(struct adapter *padapter, u8 tx, u32 tx_packets
if (jiffies_to_msecs(jiffies - start_time) > 2000) { /* 2 sec == watch dog timer */
if (xmit_cnt > 8) {
if (adapter_to_pwrctl(padapter)->bLeisurePs
&& (adapter_to_pwrctl(padapter)->pwr_mode != PS_MODE_ACTIVE)
&& !(hal_btcoex_IsBtControlLps(padapter))) {
if (adapter_to_pwrctl(padapter)->bLeisurePs &&
(adapter_to_pwrctl(padapter)->pwr_mode != PS_MODE_ACTIVE) &&
!(hal_btcoex_IsBtControlLps(padapter))) {
bLeaveLPS = true;
}
}
@ -206,17 +201,17 @@ void traffic_check_for_leave_lps(struct adapter *padapter, u8 tx, u32 tx_packets
}
} else { /* from rx path */
if (pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 4/*2*/) {
if (adapter_to_pwrctl(padapter)->bLeisurePs
&& (adapter_to_pwrctl(padapter)->pwr_mode != PS_MODE_ACTIVE)
&& !(hal_btcoex_IsBtControlLps(padapter)))
if (pmlmepriv->link_detect_info.num_rx_unicast_ok_in_period > 4) {
if (adapter_to_pwrctl(padapter)->bLeisurePs &&
(adapter_to_pwrctl(padapter)->pwr_mode != PS_MODE_ACTIVE) &&
!(hal_btcoex_IsBtControlLps(padapter)))
bLeaveLPS = true;
}
}
if (bLeaveLPS)
/* rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, 1); */
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, tx?0:1);
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_LEAVE, tx ? 0 : 1);
}
/*
@ -240,12 +235,10 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
if (pwrpriv->rpwm == pslv ||
(pwrpriv->rpwm >= PS_STATE_S2 && pslv >= PS_STATE_S2))
return;
}
if ((padapter->bSurpriseRemoved) || !(padapter->hw_init_completed)) {
pwrpriv->cpwm = PS_STATE_S4;
return;
}
@ -293,15 +286,16 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
break;
}
} while (1);
} else
} else {
pwrpriv->cpwm = pslv;
}
}
static u8 PS_RDY_CHECK(struct adapter *padapter)
{
unsigned long curr_time, delta_time;
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
if (pwrpriv->bInSuspend)
return false;
@ -313,11 +307,11 @@ static u8 PS_RDY_CHECK(struct adapter *padapter)
if (delta_time < LPS_DELAY_TIME)
return false;
if (check_fwstate(pmlmepriv, WIFI_SITE_MONITOR)
|| check_fwstate(pmlmepriv, WIFI_UNDER_LINKING|WIFI_UNDER_WPS)
|| check_fwstate(pmlmepriv, WIFI_AP_STATE)
|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_ADHOC_STATE)
|| rtw_is_scan_deny(padapter)
if (check_fwstate(pmlmepriv, WIFI_SITE_MONITOR) ||
check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS) ||
check_fwstate(pmlmepriv, WIFI_AP_STATE) ||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE) ||
rtw_is_scan_deny(padapter)
)
return false;
@ -331,7 +325,8 @@ static u8 PS_RDY_CHECK(struct adapter *padapter)
return true;
}
void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg)
void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode,
u8 smart_ps, u8 bcn_ant_mode, const char *msg)
{
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
@ -342,14 +337,13 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
if (ps_mode == PS_MODE_ACTIVE)
return;
mutex_lock(&pwrpriv->lock);
/* if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) */
if (ps_mode == PS_MODE_ACTIVE) {
if (!(hal_btcoex_IsBtControlLps(padapter))
|| (hal_btcoex_IsBtControlLps(padapter)
&& !(hal_btcoex_IsLpsOn(padapter)))) {
if (!(hal_btcoex_IsBtControlLps(padapter)) ||
(hal_btcoex_IsBtControlLps(padapter) &&
!(hal_btcoex_IsLpsOn(padapter)))) {
pwrpriv->pwr_mode = ps_mode;
rtw_set_rpwm(padapter, PS_STATE_S4);
@ -359,7 +353,8 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
hal_btcoex_LpsNotify(padapter, ps_mode);
}
} else {
if ((PS_RDY_CHECK(padapter) && check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE)) ||
if ((PS_RDY_CHECK(padapter) &&
check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE)) ||
((hal_btcoex_IsBtControlLps(padapter)) && (hal_btcoex_IsLpsOn(padapter)))
) {
u8 pslv;
@ -404,7 +399,6 @@ s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms)
u8 bAwake = false;
s32 err = 0;
start_time = jiffies;
while (1) {
rtw_hal_get_hwreg(padapter, HW_VAR_FWLPS_RF_ON, &bAwake);
@ -438,7 +432,7 @@ void LPS_Enter(struct adapter *padapter, const char *msg)
return;
/* Skip lps enter request if number of associated adapters is not 1 */
if (check_fwstate(&(dvobj->padapters->mlmepriv), WIFI_ASOC_STATE))
if (check_fwstate(&dvobj->padapters->mlmepriv, WIFI_ASOC_STATE))
n_assoc_iface++;
if (n_assoc_iface != 1)
return;
@ -452,10 +446,12 @@ void LPS_Enter(struct adapter *padapter, const char *msg)
if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) {
scnprintf(buf, sizeof(buf), "WIFI-%s", msg);
pwrpriv->bpower_saving = true;
rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, padapter->registrypriv.smart_ps, 0, buf);
rtw_set_ps_mode(padapter, pwrpriv->power_mgnt,
padapter->registrypriv.smart_ps, 0, buf);
}
} else
} else {
pwrpriv->LpsIdleCount++;
}
}
}
@ -487,7 +483,7 @@ void LPS_Leave(struct adapter *padapter, const char *msg)
void LeaveAllPowerSaveModeDirect(struct adapter *Adapter)
{
struct adapter *pri_padapter = GET_PRIMARY_ADAPTER(Adapter);
struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(Adapter);
if (Adapter->bSurpriseRemoved)
@ -527,7 +523,7 @@ void LeaveAllPowerSaveMode(struct adapter *Adapter)
if (Adapter->bSurpriseRemoved)
return;
if (check_fwstate(&(dvobj->padapters->mlmepriv), WIFI_ASOC_STATE))
if (check_fwstate(&dvobj->padapters->mlmepriv, WIFI_ASOC_STATE))
n_assoc_iface++;
if (n_assoc_iface) { /* connect */
@ -606,7 +602,6 @@ void cpwm_int_hdl(struct adapter *padapter, struct reportpwrstate_parm *preportp
exit:
mutex_unlock(&pwrpriv->lock);
}
static void cpwm_event_callback(struct work_struct *work)
@ -626,7 +621,6 @@ static void rpwmtimeout_workitem_callback(struct work_struct *work)
struct dvobj_priv *dvobj;
struct pwrctrl_priv *pwrpriv;
pwrpriv = container_of(work, struct pwrctrl_priv, rpwmtimeoutwi);
dvobj = pwrctl_to_dvobj(pwrpriv);
padapter = dvobj->if1;
@ -683,7 +677,6 @@ static inline void unregister_task_alive(struct pwrctrl_priv *pwrctrl, u32 tag)
pwrctrl->alives &= ~tag;
}
/*
* Description:
*Check if the fw_pwrstate is okay for I/O.
@ -762,10 +755,10 @@ void rtw_unregister_task_alive(struct adapter *padapter, u32 task)
unregister_task_alive(pwrctrl, task);
if ((pwrctrl->pwr_mode != PS_MODE_ACTIVE) && pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm > pslv)
if (pwrctrl->cpwm > pslv) {
if ((pslv >= PS_STATE_S2) || (pwrctrl->alives == 0))
rtw_set_rpwm(padapter, pslv);
}
}
mutex_unlock(&pwrctrl->lock);
@ -991,6 +984,7 @@ void rtw_free_pwrctrl_priv(struct adapter *adapter)
inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms)
{
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ms);
}
@ -1020,7 +1014,6 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal
if (time_before(pwrpriv->ips_deny_time, deny_time))
pwrpriv->ips_deny_time = deny_time;
if (pwrpriv->ps_processing)
while (pwrpriv->ps_processing && jiffies_to_msecs(jiffies - start) <= 3000)
mdelay(10);
@ -1068,7 +1061,6 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal
if (time_before(pwrpriv->ips_deny_time, deny_time))
pwrpriv->ips_deny_time = deny_time;
return ret;
}
int rtw_pm_set_lps(struct adapter *padapter, u8 mode)
@ -1087,8 +1079,9 @@ int rtw_pm_set_lps(struct adapter *padapter, u8 mode)
pwrctrlpriv->bLeisurePs =
pwrctrlpriv->power_mgnt != PS_MODE_ACTIVE;
}
} else
} else {
ret = -EINVAL;
}
return ret;
}
@ -1104,8 +1097,9 @@ int rtw_pm_set_ips(struct adapter *padapter, u8 mode)
rtw_ips_mode_req(pwrctrlpriv, mode);
if ((padapter->bSurpriseRemoved == 0) && (rtw_pwr_wakeup(padapter) == _FAIL))
return -EFAULT;
} else
} else {
return -EINVAL;
}
return 0;
}

View File

@ -322,7 +322,7 @@ static void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup)
} else {
cur_time = jiffies;
if (cur_time - psecuritypriv->last_mic_err_time < 60*HZ) {
if (cur_time - psecuritypriv->last_mic_err_time < 60 * HZ) {
psecuritypriv->btkip_countermeasure = true;
psecuritypriv->last_mic_err_time = 0;
psecuritypriv->btkip_countermeasure_time = cur_time;
@ -390,13 +390,13 @@ static signed int recvframe_chkmic(struct adapter *adapter, union recv_frame *p
mickey = &stainfo->dot11tkiprxmickey.skey[0];
}
datalen = precvframe->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len-prxattrib->icv_len-8;/* icv_len included the mic code */
datalen = precvframe->u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len - prxattrib->icv_len - 8;/* icv_len included the mic code */
pframe = precvframe->u.hdr.rx_data;
payload = pframe+prxattrib->hdrlen+prxattrib->iv_len;
payload = pframe + prxattrib->hdrlen + prxattrib->iv_len;
rtw_seccalctkipmic(mickey, pframe, payload, datalen, &miccode[0], (unsigned char)prxattrib->priority); /* care the length of the data */
pframemic = payload+datalen;
pframemic = payload + datalen;
bmic_err = false;
@ -444,9 +444,9 @@ static union recv_frame *decryptor(struct adapter *padapter, union recv_frame *p
u32 res = _SUCCESS;
if (prxattrib->encrypt > 0) {
u8 *iv = precv_frame->u.hdr.rx_data+prxattrib->hdrlen;
u8 *iv = precv_frame->u.hdr.rx_data + prxattrib->hdrlen;
prxattrib->key_index = (((iv[3])>>6)&0x3);
prxattrib->key_index = (((iv[3]) >> 6) & 0x3);
if (prxattrib->key_index > WEP_KEYS) {
switch (prxattrib->encrypt) {
@ -568,7 +568,7 @@ static signed int recv_decache(union recv_frame *precv_frame, u8 bretry, struct
{
signed int tid = precv_frame->u.hdr.attrib.priority;
u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num&0xffff) << 4) |
u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num & 0xffff) << 4) |
(precv_frame->u.hdr.attrib.frag_num & 0xf);
if (tid > 15)
@ -632,29 +632,29 @@ static void process_wmmps_data(struct adapter *padapter, union recv_frame *precv
if (!psta->qos_option)
return;
if (!(psta->qos_info&0xf))
if (!(psta->qos_info & 0xf))
return;
if (psta->state&WIFI_SLEEP_STATE) {
if (psta->state & WIFI_SLEEP_STATE) {
u8 wmmps_ac = 0;
switch (pattrib->priority) {
case 1:
case 2:
wmmps_ac = psta->uapsd_bk&BIT(1);
wmmps_ac = psta->uapsd_bk & BIT(1);
break;
case 4:
case 5:
wmmps_ac = psta->uapsd_vi&BIT(1);
wmmps_ac = psta->uapsd_vi & BIT(1);
break;
case 6:
case 7:
wmmps_ac = psta->uapsd_vo&BIT(1);
wmmps_ac = psta->uapsd_vo & BIT(1);
break;
case 0:
case 3:
default:
wmmps_ac = psta->uapsd_be&BIT(1);
wmmps_ac = psta->uapsd_be & BIT(1);
break;
}
@ -680,10 +680,10 @@ static void count_rx_stats(struct adapter *padapter, union recv_frame *prframe,
sz = get_recvframe_len(prframe);
precvpriv->rx_bytes += sz;
padapter->mlmepriv.LinkDetectInfo.NumRxOkInPeriod++;
padapter->mlmepriv.link_detect_info.num_rx_ok_in_period++;
if ((!is_broadcast_ether_addr(pattrib->dst)) && (!is_multicast_ether_addr(pattrib->dst)))
padapter->mlmepriv.LinkDetectInfo.NumRxUnicastOkInPeriod++;
padapter->mlmepriv.link_detect_info.num_rx_unicast_ok_in_period++;
if (sta)
psta = sta;
@ -979,20 +979,20 @@ static signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_
switch (pattrib->priority) {
case 1:
case 2:
wmmps_ac = psta->uapsd_bk&BIT(0);
wmmps_ac = psta->uapsd_bk & BIT(0);
break;
case 4:
case 5:
wmmps_ac = psta->uapsd_vi&BIT(0);
wmmps_ac = psta->uapsd_vi & BIT(0);
break;
case 6:
case 7:
wmmps_ac = psta->uapsd_vo&BIT(0);
wmmps_ac = psta->uapsd_vo & BIT(0);
break;
case 0:
case 3:
default:
wmmps_ac = psta->uapsd_be&BIT(0);
wmmps_ac = psta->uapsd_be & BIT(0);
break;
}
@ -1004,7 +1004,7 @@ static signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_
psta->state ^= WIFI_STA_ALIVE_CHK_STATE;
}
if ((psta->state&WIFI_SLEEP_STATE) && (pstapriv->sta_dz_bitmap&BIT(psta->aid))) {
if ((psta->state & WIFI_SLEEP_STATE) && (pstapriv->sta_dz_bitmap & BIT(psta->aid))) {
struct list_head *xmitframe_plist, *xmitframe_phead;
struct xmit_frame *pxmitframe = NULL;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@ -1048,7 +1048,7 @@ static signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_
/* spin_unlock_bh(&psta->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
if (pstapriv->tim_bitmap&BIT(psta->aid)) {
if (pstapriv->tim_bitmap & BIT(psta->aid)) {
if (psta->sleepq_len == 0) {
/* issue nulldata with More data bit = 0 to indicate we have no buffered packets */
issue_nulldata_in_interrupt(padapter, psta->hwaddr);
@ -1249,34 +1249,41 @@ static union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union re
static signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame)
{
/* struct mlme_priv *pmlmepriv = &adapter->mlmepriv; */
struct sta_info *psta;
precv_frame = recvframe_chk_defrag(padapter, precv_frame);
if (!precv_frame)
return _SUCCESS;
{
/* for rx pkt statistics */
struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(precv_frame->u.hdr.rx_data));
/* for rx pkt statistics */
psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(precv_frame->u.hdr.rx_data));
if (!psta)
goto exit;
if (psta) {
psta->sta_stats.rx_mgnt_pkts++;
if (GetFrameSubType(precv_frame->u.hdr.rx_data) == WIFI_BEACON)
psta->sta_stats.rx_beacon_pkts++;
else if (GetFrameSubType(precv_frame->u.hdr.rx_data) == WIFI_PROBEREQ)
psta->sta_stats.rx_probereq_pkts++;
else if (GetFrameSubType(precv_frame->u.hdr.rx_data) == WIFI_PROBERSP) {
if (!memcmp(padapter->eeprompriv.mac_addr, GetAddr1Ptr(precv_frame->u.hdr.rx_data), ETH_ALEN))
psta->sta_stats.rx_probersp_pkts++;
else if (is_broadcast_mac_addr(GetAddr1Ptr(precv_frame->u.hdr.rx_data)) ||
is_multicast_mac_addr(GetAddr1Ptr(precv_frame->u.hdr.rx_data)))
psta->sta_stats.rx_probersp_bm_pkts++;
else
psta->sta_stats.rx_probersp_uo_pkts++;
}
}
psta->sta_stats.rx_mgnt_pkts++;
switch (GetFrameSubType(precv_frame->u.hdr.rx_data)) {
case WIFI_BEACON:
psta->sta_stats.rx_beacon_pkts++;
break;
case WIFI_PROBEREQ:
psta->sta_stats.rx_probereq_pkts++;
break;
case WIFI_PROBERSP:
if (!memcmp(padapter->eeprompriv.mac_addr,
GetAddr1Ptr(precv_frame->u.hdr.rx_data),
ETH_ALEN))
psta->sta_stats.rx_probersp_pkts++;
else if (is_broadcast_ether_addr(GetAddr1Ptr(precv_frame->u.hdr.rx_data)) ||
is_multicast_ether_addr(GetAddr1Ptr(precv_frame->u.hdr.rx_data)))
psta->sta_stats.rx_probersp_bm_pkts++;
else
psta->sta_stats.rx_probersp_uo_pkts++;
break;
}
exit:
mgt_dispatcher(padapter, precv_frame);
return _SUCCESS;
@ -1339,11 +1346,8 @@ static signed int validate_recv_data_frame(struct adapter *adapter, union recv_f
}
if (ret == _FAIL) {
if (ret == _FAIL || ret == RTW_RX_HANDLED)
goto exit;
} else if (ret == RTW_RX_HANDLED) {
goto exit;
}
if (!psta) {
@ -1430,9 +1434,9 @@ static signed int validate_80211w_mgmt(struct adapter *adapter, union recv_frame
goto validate_80211w_fail;
precv_frame = decryptor(adapter, precv_frame);
/* save actual management data frame body */
memcpy(mgmt_DATA, ptr+pattrib->hdrlen+pattrib->iv_len, data_len);
memcpy(mgmt_DATA, ptr + pattrib->hdrlen + pattrib->iv_len, data_len);
/* overwrite the iv field */
memcpy(ptr+pattrib->hdrlen, mgmt_DATA, data_len);
memcpy(ptr + pattrib->hdrlen, mgmt_DATA, data_len);
/* remove the iv and icv length */
pattrib->pkt_len = pattrib->pkt_len - pattrib->iv_len - pattrib->icv_len;
kfree(mgmt_DATA);
@ -1488,7 +1492,7 @@ static signed int validate_recv_frame(struct adapter *adapter, union recv_frame
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
u8 *ptr = precv_frame->u.hdr.rx_data;
u8 ver = (unsigned char) (*ptr)&0x3;
u8 ver = (unsigned char) (*ptr) & 0x3;
/* add version chk */
if (ver != 0) {
@ -1526,7 +1530,7 @@ static signed int validate_recv_frame(struct adapter *adapter, union recv_frame
retval = _FAIL; /* only data frame return _SUCCESS */
break;
case WIFI_DATA_TYPE: /* data */
pattrib->qos = (subtype & BIT(7)) ? 1:0;
pattrib->qos = (subtype & BIT(7)) ? 1 : 0;
retval = validate_recv_data_frame(adapter, precv_frame);
if (retval == _FAIL) {
struct recv_priv *precvpriv = &adapter->recvpriv;
@ -1571,8 +1575,8 @@ static signed int wlanhdr_to_ethhdr(union recv_frame *precvframe)
if (pattrib->encrypt)
recvframe_pull_tail(precvframe, pattrib->icv_len);
psnap = (struct ieee80211_snap_hdr *)(ptr+pattrib->hdrlen + pattrib->iv_len);
psnap_type = ptr+pattrib->hdrlen + pattrib->iv_len+SNAP_SIZE;
psnap = (struct ieee80211_snap_hdr *)(ptr + pattrib->hdrlen + pattrib->iv_len);
psnap_type = ptr + pattrib->hdrlen + pattrib->iv_len + SNAP_SIZE;
/* convert hdr + possible LLC headers into Ethernet header */
/* eth_type = (psnap_type[0] << 8) | psnap_type[1]; */
if ((!memcmp(psnap, rfc1042_header, SNAP_SIZE) &&
@ -1586,37 +1590,37 @@ static signed int wlanhdr_to_ethhdr(union recv_frame *precvframe)
/* Leave Ethernet header part of hdr and full payload */
bsnaphdr = false;
rmv_len = pattrib->hdrlen + pattrib->iv_len + (bsnaphdr?SNAP_SIZE:0);
rmv_len = pattrib->hdrlen + pattrib->iv_len + (bsnaphdr ? SNAP_SIZE : 0);
len = precvframe->u.hdr.len - rmv_len;
memcpy(&be_tmp, ptr+rmv_len, 2);
memcpy(&be_tmp, ptr + rmv_len, 2);
eth_type = ntohs(be_tmp); /* pattrib->ether_type */
pattrib->eth_type = eth_type;
if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true)) {
ptr += rmv_len;
*ptr = 0x87;
*(ptr+1) = 0x12;
*(ptr + 1) = 0x12;
eth_type = 0x8712;
/* append rx status for mp test packets */
ptr = recvframe_pull(precvframe, (rmv_len-sizeof(struct ethhdr)+2)-24);
ptr = recvframe_pull(precvframe, (rmv_len - sizeof(struct ethhdr) + 2) - 24);
if (!ptr)
return _FAIL;
memcpy(ptr, get_rxmem(precvframe), 24);
ptr += 24;
} else {
ptr = recvframe_pull(precvframe, (rmv_len-sizeof(struct ethhdr) + (bsnaphdr?2:0)));
ptr = recvframe_pull(precvframe, (rmv_len - sizeof(struct ethhdr) + (bsnaphdr ? 2 : 0)));
if (!ptr)
return _FAIL;
}
memcpy(ptr, pattrib->dst, ETH_ALEN);
memcpy(ptr+ETH_ALEN, pattrib->src, ETH_ALEN);
memcpy(ptr + ETH_ALEN, pattrib->src, ETH_ALEN);
if (!bsnaphdr) {
be_tmp = htons(len);
memcpy(ptr+12, &be_tmp, 2);
memcpy(ptr + 12, &be_tmp, 2);
}
return _SUCCESS;
@ -1754,7 +1758,7 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe)
pdata += nSubframe_Length;
a_len -= nSubframe_Length;
if (a_len != 0) {
padding_len = 4 - ((nSubframe_Length + ETH_HLEN) & (4-1));
padding_len = 4 - ((nSubframe_Length + ETH_HLEN) & (4 - 1));
if (padding_len == 4)
padding_len = 0;
@ -2004,7 +2008,7 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *
rtw_recv_indicatepkt(padapter, prframe);
preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1)%4096;
preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1) % 4096;
return _SUCCESS;
}
@ -2014,7 +2018,7 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *
retval = amsdu_to_msdu(padapter, prframe);
preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1)%4096;
preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1) % 4096;
return retval;
}
@ -2200,7 +2204,7 @@ static int recv_func(struct adapter *padapter, union recv_frame *rframe)
!psecuritypriv->busetkipkey) {
rtw_enqueue_recvframe(rframe, &padapter->recvpriv.uc_swdec_pending_queue);
if (recvpriv->free_recvframe_cnt < NR_RECVFRAME/4) {
if (recvpriv->free_recvframe_cnt < NR_RECVFRAME / 4) {
/* to prevent from recvframe starvation, get recvframe from uc_swdec_pending_queue to free_recvframe_cnt */
rframe = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue);
if (rframe)
@ -2289,19 +2293,19 @@ static void rtw_signal_stat_timer_hdl(struct timer_list *t)
}
/* update value of signal_strength, rssi, signal_qual */
tmp_s = (avg_signal_strength+(_alpha-1)*recvpriv->signal_strength);
tmp_s = (avg_signal_strength + (_alpha - 1) * recvpriv->signal_strength);
if (tmp_s % _alpha)
tmp_s = tmp_s/_alpha + 1;
tmp_s = tmp_s / _alpha + 1;
else
tmp_s = tmp_s/_alpha;
tmp_s = tmp_s / _alpha;
if (tmp_s > 100)
tmp_s = 100;
tmp_q = (avg_signal_qual+(_alpha-1)*recvpriv->signal_qual);
tmp_q = (avg_signal_qual + (_alpha - 1) * recvpriv->signal_qual);
if (tmp_q % _alpha)
tmp_q = tmp_q/_alpha + 1;
tmp_q = tmp_q / _alpha + 1;
else
tmp_q = tmp_q/_alpha;
tmp_q = tmp_q / _alpha;
if (tmp_q > 100)
tmp_q = 100;

View File

@ -196,7 +196,6 @@ void rtw_secgetmic(struct mic_data *pmicdata, u8 *dst)
secmicclear(pmicdata);
}
void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_code, u8 pri)
{
@ -222,7 +221,6 @@ void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_cod
}
rtw_secmicappend(&micdata, &priority[0], 4);
rtw_secmicappend(&micdata, data, data_len);
rtw_secgetmic(&micdata, mic_code);
@ -282,7 +280,6 @@ static const unsigned short Sbox1[2][256] = { /* Sbox for hash (can be in R
0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A,
},
{ /* second half of table is unsigned char-reversed version of first! */
0xA5C6, 0x84F8, 0x99EE, 0x8DF6, 0x0DFF, 0xBDD6, 0xB1DE, 0x5491,
0x5060, 0x0302, 0xA9CE, 0x7D56, 0x19E7, 0x62B5, 0xE64D, 0x9AEC,
@ -357,7 +354,6 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32)
}
}
/*
* Routine: Phase 2 -- generate RC4KEY, given TK, P1K, IV16
*
@ -535,7 +531,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
if (start == 0)
start = jiffies;
if (is_broadcast_mac_addr(prxattrib->ra))
if (is_broadcast_ether_addr(prxattrib->ra))
no_gkey_bc_cnt++;
else
no_gkey_mc_cnt++;
@ -662,8 +658,8 @@ static void construct_mic_iv(u8 *mic_iv,
for (i = 8; i < 14; i++)
mic_iv[i] = pn_vector[13 - i]; /* mic_iv[8:13] = PN[5:0] */
#endif
mic_iv[14] = (unsigned char) (payload_length / 256);
mic_iv[15] = (unsigned char) (payload_length % 256);
mic_iv[14] = (unsigned char)(payload_length / 256);
mic_iv[15] = (unsigned char)(payload_length % 256);
}
/************************************************/
@ -785,8 +781,8 @@ static void construct_ctr_preload(u8 *ctr_preload,
for (i = 8; i < 14; i++)
ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */
#endif
ctr_preload[14] = (unsigned char) (c / 256); /* Ctr */
ctr_preload[15] = (unsigned char) (c % 256);
ctr_preload[14] = (unsigned char)(c / 256); /* Ctr */
ctr_preload[15] = (unsigned char)(c % 256);
}
static signed int aes_cipher(u8 *key, uint hdrlen,
@ -1091,7 +1087,7 @@ static signed int aes_decipher(u8 *key, uint hdrlen,
/* start to calculate the mic */
if ((hdrlen + plen + 8) <= MAX_MSG_SIZE)
memcpy((void *)message, pframe, (hdrlen + plen + 8)); /* 8 is for ext iv len */
memcpy(message, pframe, (hdrlen + plen + 8)); /* 8 is for ext iv len */
pn_vector[0] = pframe[hdrlen];
pn_vector[1] = pframe[hdrlen + 1];
@ -1213,69 +1209,67 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
pframe = (unsigned char *)((union recv_frame *)precvframe)->u.hdr.rx_data;
/* 4 start to encrypt each fragment */
if (prxattrib->encrypt == _AES_) {
stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]);
if (stainfo) {
if (is_multicast_ether_addr(prxattrib->ra)) {
static unsigned long start;
static u32 no_gkey_bc_cnt;
static u32 no_gkey_mc_cnt;
if (prxattrib->encrypt != _AES_)
return _SUCCESS;
stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]);
if (stainfo)
return _FAIL;
if (is_multicast_ether_addr(prxattrib->ra)) {
static unsigned long start;
static u32 no_gkey_bc_cnt;
static u32 no_gkey_mc_cnt;
if (!psecuritypriv->binstallGrpkey) {
res = _FAIL;
if (!psecuritypriv->binstallGrpkey) {
res = _FAIL;
if (start == 0)
start = jiffies;
if (start == 0)
start = jiffies;
if (is_broadcast_mac_addr(prxattrib->ra))
no_gkey_bc_cnt++;
else
no_gkey_mc_cnt++;
if (jiffies_to_msecs(jiffies - start) > 1000) {
if (no_gkey_bc_cnt || no_gkey_mc_cnt) {
netdev_dbg(padapter->pnetdev,
FUNC_ADPT_FMT " no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
FUNC_ADPT_ARG(padapter),
no_gkey_bc_cnt,
no_gkey_mc_cnt);
}
start = jiffies;
no_gkey_bc_cnt = 0;
no_gkey_mc_cnt = 0;
}
goto exit;
}
if (is_broadcast_ether_addr(prxattrib->ra))
no_gkey_bc_cnt++;
else
no_gkey_mc_cnt++;
if (jiffies_to_msecs(jiffies - start) > 1000) {
if (no_gkey_bc_cnt || no_gkey_mc_cnt) {
netdev_dbg(padapter->pnetdev,
FUNC_ADPT_FMT " gkey installed. no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
FUNC_ADPT_FMT " no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
FUNC_ADPT_ARG(padapter),
no_gkey_bc_cnt,
no_gkey_mc_cnt);
}
start = 0;
start = jiffies;
no_gkey_bc_cnt = 0;
no_gkey_mc_cnt = 0;
prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey;
if (psecuritypriv->dot118021XGrpKeyid != prxattrib->key_index) {
res = _FAIL;
goto exit;
}
} else {
prwskey = &stainfo->dot118021x_UncstKey.skey[0];
}
length = ((union recv_frame *)precvframe)->u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len;
res = aes_decipher(prwskey, prxattrib->hdrlen, pframe, length);
} else {
res = _FAIL;
goto exit;
}
if (no_gkey_bc_cnt || no_gkey_mc_cnt) {
netdev_dbg(padapter->pnetdev,
FUNC_ADPT_FMT " gkey installed. no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
FUNC_ADPT_ARG(padapter),
no_gkey_bc_cnt,
no_gkey_mc_cnt);
}
start = 0;
no_gkey_bc_cnt = 0;
no_gkey_mc_cnt = 0;
prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey;
if (psecuritypriv->dot118021XGrpKeyid != prxattrib->key_index) {
res = _FAIL;
goto exit;
}
} else {
prwskey = &stainfo->dot118021x_UncstKey.skey[0];
}
length = ((union recv_frame *)precvframe)->u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len;
res = aes_decipher(prwskey, prxattrib->hdrlen, pframe, length);
exit:
return res;
}
@ -1291,7 +1285,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
u8 mic[16];
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
__le16 le_tmp;
__le64 le_tmp64;
__le64 le_tmp64 = 0;
ori_len = pattrib->pkt_len - WLAN_HDR_A3_LEN + BIP_AAD_SIZE;
BIP_AAD = kzalloc(ori_len, GFP_KERNEL);
@ -1339,7 +1333,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
goto BIP_exit;
/* MIC field should be last 8 bytes of packet (packet without FCS) */
if (!memcmp(mic, pframe+pattrib->pkt_len-8, 8)) {
if (!memcmp(mic, pframe + pattrib->pkt_len - 8, 8)) {
pmlmeext->mgnt_80211w_IPN_rx = temp_ipn;
res = _SUCCESS;
} else {
@ -1462,7 +1456,7 @@ int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac)
/* Restore HW wep key setting according to key_mask */
void rtw_sec_restore_wep_key(struct adapter *adapter)
{
struct security_priv *securitypriv = &(adapter->securitypriv);
struct security_priv *securitypriv = &adapter->securitypriv;
signed int keyid;
if ((securitypriv->dot11PrivacyAlgrthm == _WEP40_) || (securitypriv->dot11PrivacyAlgrthm == _WEP104_)) {
@ -1479,7 +1473,7 @@ void rtw_sec_restore_wep_key(struct adapter *adapter)
u8 rtw_handle_tkip_countermeasure(struct adapter *adapter, const char *caller)
{
struct security_priv *securitypriv = &(adapter->securitypriv);
struct security_priv *securitypriv = &adapter->securitypriv;
u8 status = _SUCCESS;
if (securitypriv->btkip_countermeasure) {

View File

@ -79,7 +79,7 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
for (i = 0; i < NUM_STA; i++) {
_rtw_init_stainfo(psta);
INIT_LIST_HEAD(&(pstapriv->sta_hash[i]));
INIT_LIST_HEAD(&pstapriv->sta_hash[i]);
list_add_tail(&psta->list, get_list_head(&pstapriv->free_sta_queue));
@ -149,7 +149,7 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)
/*delete all reordering_ctrl_timer */
spin_lock_bh(&pstapriv->sta_hash_lock);
for (index = 0; index < NUM_STA; index++) {
phead = &(pstapriv->sta_hash[index]);
phead = &pstapriv->sta_hash[index];
list_for_each(plist, phead) {
int i;
@ -186,15 +186,15 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
pfree_sta_queue = &pstapriv->free_sta_queue;
/* spin_lock_bh(&(pfree_sta_queue->lock)); */
spin_lock_bh(&(pstapriv->sta_hash_lock));
spin_lock_bh(&pstapriv->sta_hash_lock);
if (list_empty(&pfree_sta_queue->queue)) {
/* spin_unlock_bh(&(pfree_sta_queue->lock)); */
spin_unlock_bh(&(pstapriv->sta_hash_lock));
spin_unlock_bh(&pstapriv->sta_hash_lock);
return NULL;
}
psta = container_of(get_next(&pfree_sta_queue->queue), struct sta_info, list);
list_del_init(&(psta->list));
list_del_init(&psta->list);
/* spin_unlock_bh(&(pfree_sta_queue->lock)); */
@ -207,11 +207,11 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
index = wifi_mac_hash(hwaddr);
if (index >= NUM_STA) {
spin_unlock_bh(&(pstapriv->sta_hash_lock));
spin_unlock_bh(&pstapriv->sta_hash_lock);
psta = NULL;
goto exit;
}
phash_list = &(pstapriv->sta_hash[index]);
phash_list = &pstapriv->sta_hash[index];
/* spin_lock_bh(&(pstapriv->sta_hash_lock)); */
@ -258,7 +258,7 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
/* init for the sequence number of received management frame */
psta->RxMgmtFrameSeqNum = 0xffff;
spin_unlock_bh(&(pstapriv->sta_hash_lock));
spin_unlock_bh(&pstapriv->sta_hash_lock);
/* alloc mac id for non-bc/mc station, */
rtw_alloc_macid(pstapriv->padapter, psta);
@ -300,7 +300,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
/* vo */
/* spin_lock_bh(&(pxmitpriv->vo_pending.lock)); */
rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vo_q.sta_pending);
list_del_init(&(pstaxmitpriv->vo_q.tx_pending));
list_del_init(&pstaxmitpriv->vo_q.tx_pending);
phwxmit = pxmitpriv->hwxmits;
phwxmit->accnt -= pstaxmitpriv->vo_q.qcnt;
pstaxmitpriv->vo_q.qcnt = 0;
@ -309,7 +309,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
/* vi */
/* spin_lock_bh(&(pxmitpriv->vi_pending.lock)); */
rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);
list_del_init(&(pstaxmitpriv->vi_q.tx_pending));
list_del_init(&pstaxmitpriv->vi_q.tx_pending);
phwxmit = pxmitpriv->hwxmits + 1;
phwxmit->accnt -= pstaxmitpriv->vi_q.qcnt;
pstaxmitpriv->vi_q.qcnt = 0;
@ -318,7 +318,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
/* be */
/* spin_lock_bh(&(pxmitpriv->be_pending.lock)); */
rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->be_q.sta_pending);
list_del_init(&(pstaxmitpriv->be_q.tx_pending));
list_del_init(&pstaxmitpriv->be_q.tx_pending);
phwxmit = pxmitpriv->hwxmits + 2;
phwxmit->accnt -= pstaxmitpriv->be_q.qcnt;
pstaxmitpriv->be_q.qcnt = 0;
@ -327,7 +327,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
/* bk */
/* spin_lock_bh(&(pxmitpriv->bk_pending.lock)); */
rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);
list_del_init(&(pstaxmitpriv->bk_q.tx_pending));
list_del_init(&pstaxmitpriv->bk_q.tx_pending);
phwxmit = pxmitpriv->hwxmits + 3;
phwxmit->accnt -= pstaxmitpriv->bk_q.qcnt;
pstaxmitpriv->bk_q.qcnt = 0;
@ -369,7 +369,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
plist = get_next(plist);
list_del_init(&(prframe->u.hdr.list));
list_del_init(&prframe->u.hdr.list);
rtw_free_recvframe(prframe, pfree_recv_queue);
}
@ -435,7 +435,7 @@ void rtw_free_all_stainfo(struct adapter *padapter)
spin_lock_bh(&pstapriv->sta_hash_lock);
for (index = 0; index < NUM_STA; index++) {
phead = &(pstapriv->sta_hash[index]);
phead = &pstapriv->sta_hash[index];
list_for_each_safe(plist, tmp, phead) {
psta = list_entry(plist, struct sta_info, hash_list);
@ -473,7 +473,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
spin_lock_bh(&pstapriv->sta_hash_lock);
phead = &(pstapriv->sta_hash[index]);
phead = &pstapriv->sta_hash[index];
list_for_each(plist, phead) {
psta = list_entry(plist, struct sta_info, hash_list);
@ -491,7 +491,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
u32 rtw_init_bcmc_stainfo(struct adapter *padapter)
{
struct sta_info *psta;
NDIS_802_11_MAC_ADDRESS bcast_addr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
u8 bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
struct sta_priv *pstapriv = &padapter->stapriv;
/* struct __queue *pstapending = &padapter->xmitpriv.bm_pending; */
@ -525,7 +525,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
struct __queue *pacl_node_q = &pacl_list->acl_node_q;
spin_lock_bh(&(pacl_node_q->lock));
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
list_for_each(plist, phead) {
paclnode = list_entry(plist, struct rtw_wlan_acl_node, list);
@ -536,7 +536,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
break;
}
}
spin_unlock_bh(&(pacl_node_q->lock));
spin_unlock_bh(&pacl_node_q->lock);
if (pacl_list->mode == 1) /* accept unless in deny list */
res = !match;

View File

@ -572,7 +572,7 @@ s16 rtw_camid_alloc(struct adapter *adapter, struct sta_info *sta, u8 kid)
if ((((mlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) || ((mlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE))
&& !sta) {
/* AP/Ad-hoc mode group key: static alloction to default key by key ID */
/* AP/Ad-hoc mode group key: static allocation to default key by key ID */
if (kid > 3) {
netdev_dbg(adapter->pnetdev,
FUNC_ADPT_FMT " group key with invalid key id:%u\n",
@ -597,7 +597,9 @@ s16 rtw_camid_alloc(struct adapter *adapter, struct sta_info *sta, u8 kid)
i = _rtw_camid_search(adapter, addr, kid);
if (i >= 0) {
/* Fix issue that pairwise and group key have same key id. Pairwise key first, group key can overwirte group only(ex: rekey) */
/* Fix issue that pairwise and group key have same key id.
* Pairwise key first, group key can overwrite group only(ex: rekey)
*/
if (sta || _rtw_camid_is_gk(adapter, i))
cam_id = i;
else
@ -704,7 +706,7 @@ static void sort_wmm_ac_params(u32 *inx, u32 *edca)
{
u32 i, j, change_inx = false;
/* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */
/* entry index: 0->vo, 1->vi, 2->be, 3->bk. */
for (i = 0; i < 4; i++) {
for (j = i + 1; j < 4; j++) {
/* compare CW and AIFS */
@ -1593,7 +1595,7 @@ int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, uint var_ie_l
{
unsigned int ie_len;
struct ndis_80211_var_ie *pIE;
int supportRateNum = 0;
int support_rate_num = 0;
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
@ -1604,11 +1606,11 @@ int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, uint var_ie_l
return _FAIL;
memcpy(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates, pIE->data, ie_len);
supportRateNum = ie_len;
support_rate_num = ie_len;
pIE = (struct ndis_80211_var_ie *)rtw_get_ie(pvar_ie, WLAN_EID_EXT_SUPP_RATES, &ie_len, var_ie_len);
if (pIE && (ie_len <= sizeof(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates) - supportRateNum))
memcpy((pmlmeinfo->FW_sta_info[cam_idx].SupportedRates + supportRateNum), pIE->data, ie_len);
if (pIE && (ie_len <= sizeof(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates) - support_rate_num))
memcpy((pmlmeinfo->FW_sta_info[cam_idx].SupportedRates + support_rate_num), pIE->data, ie_len);
return _SUCCESS;
}

View File

@ -5,6 +5,8 @@
*
******************************************************************************/
#include <drv_types.h>
#include <linux/delay.h>
#include <linux/if_ether.h>
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
@ -128,7 +130,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
/* Tx buf allocation may fail sometimes, so sleep and retry. */
res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, (MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ), true);
if (res == _FAIL) {
msleep(10);
fsleep(10 * USEC_PER_MSEC);
res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, (MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ), true);
if (res == _FAIL)
goto exit;
@ -1194,12 +1196,13 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s
pwlanhdr = (struct ieee80211_hdr *)pframe;
ori_len = BIP_AAD_SIZE + pattrib->pktlen;
tmp_buf = BIP_AAD = kzalloc(ori_len, GFP_ATOMIC);
subtype = GetFrameSubType(pframe); /* bit(7)~bit(2) */
BIP_AAD = kzalloc(ori_len, GFP_ATOMIC);
if (!BIP_AAD)
return _FAIL;
tmp_buf = BIP_AAD;
subtype = GetFrameSubType(pframe); /* bit(7)~bit(2) */
spin_lock_bh(&padapter->security_key_mutex);
/* only support station mode */
@ -1414,7 +1417,7 @@ void rtw_count_tx_stats(struct adapter *padapter, struct xmit_frame *pxmitframe,
if ((pxmitframe->frame_tag & 0x0f) == DATA_FRAMETAG) {
pkt_num = pxmitframe->agg_num;
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod += pkt_num;
pmlmepriv->link_detect_info.num_tx_ok_in_period += pkt_num;
pxmitpriv->tx_pkts += pkt_num;
@ -2026,8 +2029,8 @@ inline bool xmitframe_hiq_filter(struct xmit_frame *xmitframe)
if (registry->hiq_filter == RTW_HIQ_FILTER_ALLOW_SPECIAL) {
struct pkt_attrib *attrib = &xmitframe->attrib;
if (attrib->ether_type == 0x0806 ||
attrib->ether_type == 0x888e ||
if (attrib->ether_type == ETH_P_ARP ||
attrib->ether_type == ETH_P_PAE ||
attrib->dhcp_pkt
)
allow = true;

View File

@ -684,52 +684,22 @@ static void halbtc8723b1ant_CoexTableWithType(
struct btc_coexist *pBtCoexist, bool bForceExec, u8 type
)
{
static const u32 table[8][2] = {
{0x55555555, 0x55555555},
{0x55555555, 0x5a5a5a5a},
{0x5a5a5a5a, 0x5a5a5a5a},
{0xaaaa5555, 0xaaaa5a5a},
{0x55555555, 0xaaaa5a5a},
{0x5a5a5a5a, 0xaaaa5a5a},
{0x55555555, 0xaaaaaaaa},
{0xaaaaaaaa, 0xaaaaaaaa}
};
pCoexSta->nCoexTableType = type;
switch (type) {
case 0:
halbtc8723b1ant_CoexTable(
pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffffff, 0x3
);
break;
case 1:
halbtc8723b1ant_CoexTable(
pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3
);
break;
case 2:
halbtc8723b1ant_CoexTable(
pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3
);
break;
case 3:
halbtc8723b1ant_CoexTable(
pBtCoexist, bForceExec, 0xaaaa5555, 0xaaaa5a5a, 0xffffff, 0x3
);
break;
case 4:
halbtc8723b1ant_CoexTable(
pBtCoexist, bForceExec, 0x55555555, 0xaaaa5a5a, 0xffffff, 0x3
);
break;
case 5:
halbtc8723b1ant_CoexTable(
pBtCoexist, bForceExec, 0x5a5a5a5a, 0xaaaa5a5a, 0xffffff, 0x3
);
break;
case 6:
halbtc8723b1ant_CoexTable(
pBtCoexist, bForceExec, 0x55555555, 0xaaaaaaaa, 0xffffff, 0x3
);
break;
case 7:
halbtc8723b1ant_CoexTable(
pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffffff, 0x3
);
break;
default:
break;
}
if (type < 8)
halbtc8723b1ant_CoexTable(pBtCoexist, bForceExec, table[type][0],
table[type][1], 0xffffff, 0x3);
}
static void halbtc8723b1ant_SetFwIgnoreWlanAct(
@ -2316,7 +2286,7 @@ void EXhalbtc8723b1ant_ConnectNotify(struct btc_coexist *pBtCoexist, u8 type)
if (type == BTC_ASSOCIATE_START) {
pCoexSta->bWiFiIsHighPriTask = true;
pCoexDm->nArpCnt = 0;
pCoexDm->nArpCnt = 0;
} else {
pCoexSta->bWiFiIsHighPriTask = false;
/* pCoexDm->nArpCnt = 0; */

View File

@ -121,25 +121,15 @@ static void setIqkMatrix_8723B(
static void setCCKFilterCoefficient(struct dm_odm_t *pDM_Odm, u8 CCKSwingIndex)
{
if (!pDM_Odm->RFCalibrateInfo.bCCKinCH14) {
rtw_write8(pDM_Odm->Adapter, 0xa22, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][0]);
rtw_write8(pDM_Odm->Adapter, 0xa23, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][1]);
rtw_write8(pDM_Odm->Adapter, 0xa24, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][2]);
rtw_write8(pDM_Odm->Adapter, 0xa25, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][3]);
rtw_write8(pDM_Odm->Adapter, 0xa26, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][4]);
rtw_write8(pDM_Odm->Adapter, 0xa27, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][5]);
rtw_write8(pDM_Odm->Adapter, 0xa28, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][6]);
rtw_write8(pDM_Odm->Adapter, 0xa29, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][7]);
} else {
rtw_write8(pDM_Odm->Adapter, 0xa22, CCKSwingTable_Ch14_New[CCKSwingIndex][0]);
rtw_write8(pDM_Odm->Adapter, 0xa23, CCKSwingTable_Ch14_New[CCKSwingIndex][1]);
rtw_write8(pDM_Odm->Adapter, 0xa24, CCKSwingTable_Ch14_New[CCKSwingIndex][2]);
rtw_write8(pDM_Odm->Adapter, 0xa25, CCKSwingTable_Ch14_New[CCKSwingIndex][3]);
rtw_write8(pDM_Odm->Adapter, 0xa26, CCKSwingTable_Ch14_New[CCKSwingIndex][4]);
rtw_write8(pDM_Odm->Adapter, 0xa27, CCKSwingTable_Ch14_New[CCKSwingIndex][5]);
rtw_write8(pDM_Odm->Adapter, 0xa28, CCKSwingTable_Ch14_New[CCKSwingIndex][6]);
rtw_write8(pDM_Odm->Adapter, 0xa29, CCKSwingTable_Ch14_New[CCKSwingIndex][7]);
}
u8 (*swingtable)[8];
if (!pDM_Odm->RFCalibrateInfo.bCCKinCH14)
swingtable = CCKSwingTable_Ch1_Ch13_New;
else
swingtable = CCKSwingTable_Ch14_New;
for (int i = 0; i < 8; i++)
rtw_write8(pDM_Odm->Adapter, 0xa22 + i, swingtable[CCKSwingIndex][i]);
}
/*-----------------------------------------------------------------------------
@ -208,8 +198,6 @@ void ODM_TxPwrTrackSetPwr_8723B(
}
if (Method == TXAGC) {
struct adapter *Adapter = pDM_Odm->Adapter;
pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = pDM_Odm->Absolute_OFDMSwingIdx[RFPath];
pDM_Odm->Modify_TxAGC_Flag_PathA = true;
@ -1407,8 +1395,10 @@ static void phy_IQCalibrate_8723B(
PHY_SetBBReg(pDM_Odm->Adapter, rFPGA0_IQK, bMaskH3Bytes, 0x000000);
pDM_Odm->RFCalibrateInfo.TxLOK[RF_PATH_A] = PHY_QueryRFReg(pDM_Odm->Adapter, RF_PATH_A, 0x8, bRFRegOffsetMask);
result[t][0] = (PHY_QueryBBReg(pDM_Odm->Adapter, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16;
result[t][1] = (PHY_QueryBBReg(pDM_Odm->Adapter, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16;
result[t][0] = (PHY_QueryBBReg(pDM_Odm->Adapter, rTx_Power_Before_IQK_A,
bMaskDWord) & 0x3FF0000) >> 16;
result[t][1] = (PHY_QueryBBReg(pDM_Odm->Adapter, rTx_Power_After_IQK_A,
bMaskDWord) & 0x3FF0000) >> 16;
break;
}
}

View File

@ -167,7 +167,7 @@ static u8 halbtcoutsrc_IsWifiBusy(struct adapter *padapter)
if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE) == true) {
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
return true;
if (pmlmepriv->LinkDetectInfo.bBusyTraffic)
if (pmlmepriv->link_detect_info.busy_traffic)
return true;
}
@ -364,9 +364,10 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf)
case BTC_GET_U4_WIFI_TRAFFIC_DIRECTION:
{
struct rt_link_detect_t *plinkinfo;
plinkinfo = &padapter->mlmepriv.LinkDetectInfo;
if (plinkinfo->NumTxOkInPeriod > plinkinfo->NumRxOkInPeriod)
plinkinfo = &padapter->mlmepriv.link_detect_info;
if (plinkinfo->num_tx_ok_in_period > plinkinfo->num_rx_ok_in_period)
*pU4Tmp = BTC_WIFI_TRAFFIC_TX;
else
*pU4Tmp = BTC_WIFI_TRAFFIC_RX;

View File

@ -31,44 +31,44 @@ void rtw_hal_data_deinit(struct adapter *padapter)
}
void dump_chip_info(struct hal_version ChipVersion)
void dump_chip_info(struct hal_version chip_version)
{
char buf[128];
size_t cnt = 0;
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "Chip Version Info: CHIP_8723B_%s_",
IS_NORMAL_CHIP(ChipVersion) ? "Normal_Chip" : "Test_Chip");
IS_NORMAL_CHIP(chip_version) ? "Normal_Chip" : "Test_Chip");
if (IS_CHIP_VENDOR_TSMC(ChipVersion))
if (IS_CHIP_VENDOR_TSMC(chip_version))
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "TSMC_");
else if (IS_CHIP_VENDOR_UMC(ChipVersion))
else if (IS_CHIP_VENDOR_UMC(chip_version))
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "UMC_");
else if (IS_CHIP_VENDOR_SMIC(ChipVersion))
else if (IS_CHIP_VENDOR_SMIC(chip_version))
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "SMIC_");
if (IS_A_CUT(ChipVersion))
if (IS_A_CUT(chip_version))
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "A_CUT_");
else if (IS_B_CUT(ChipVersion))
else if (IS_B_CUT(chip_version))
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "B_CUT_");
else if (IS_C_CUT(ChipVersion))
else if (IS_C_CUT(chip_version))
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "C_CUT_");
else if (IS_D_CUT(ChipVersion))
else if (IS_D_CUT(chip_version))
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "D_CUT_");
else if (IS_E_CUT(ChipVersion))
else if (IS_E_CUT(chip_version))
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "E_CUT_");
else if (IS_I_CUT(ChipVersion))
else if (IS_I_CUT(chip_version))
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "I_CUT_");
else if (IS_J_CUT(ChipVersion))
else if (IS_J_CUT(chip_version))
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "J_CUT_");
else if (IS_K_CUT(ChipVersion))
else if (IS_K_CUT(chip_version))
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "K_CUT_");
else
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt,
"UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion);
"UNKNOWN_CUT(%d)_", chip_version.CUTVersion);
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "1T1R_");
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "RomVer(%d)\n", ChipVersion.ROMVer);
cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "RomVer(%d)\n", chip_version.ROMVer);
}
@ -86,7 +86,7 @@ void dump_chip_info(struct hal_version ChipVersion)
* BIT[6:0] Channel Plan
*sw_channel_plan channel plan from SW (registry/module param)
*def_channel_plan channel plan used when HW/SW both invalid
*AutoLoadFail efuse autoload fail or not
*auto_load_fail efuse autoload fail or not
*
* Return:
*Final channel plan decision
@ -97,7 +97,7 @@ u8 hal_com_config_channel_plan(
u8 hw_channel_plan,
u8 sw_channel_plan,
u8 def_channel_plan,
bool AutoLoadFail
bool auto_load_fail
)
{
struct hal_com_data *pHalData;
@ -108,9 +108,9 @@ u8 hal_com_config_channel_plan(
chnlPlan = def_channel_plan;
if (0xFF == hw_channel_plan)
AutoLoadFail = true;
auto_load_fail = true;
if (!AutoLoadFail) {
if (!auto_load_fail) {
u8 hw_chnlPlan;
hw_chnlPlan = hw_channel_plan & (~EEPROM_CHANNEL_PLAN_BY_HW_MASK);
@ -616,6 +616,7 @@ void SetHwReg(struct adapter *adapter, u8 variable, u8 *val)
case HW_VAR_DM_FUNC_SET:
if (*((u32 *)val) == DYNAMIC_ALL_FUNC_ENABLE) {
struct dm_priv *dm = &hal_data->dmpriv;
dm->DMFlag = dm->InitDMFlag;
odm->SupportAbility = dm->InitODMFlag;
} else {
@ -727,6 +728,7 @@ void SetHalODMVar(
case HAL_ODM_STA_INFO:
{
struct sta_info *psta = pValue1;
if (bSet) {
ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta);
} else {
@ -750,18 +752,6 @@ void SetHalODMVar(
}
bool eqNByte(u8 *str1, u8 *str2, u32 num)
{
if (num == 0)
return false;
while (num > 0) {
num--;
if (str1[num] != str2[num])
return false;
}
return true;
}
bool GetU1ByteIntegerFromStringInDecimal(char *Str, u8 *pInt)
{
u16 i = 0;

View File

@ -8,6 +8,7 @@
#include <drv_types.h>
#include <hal_data.h>
#include <linux/kernel.h>
#include <linux/string.h>
u8 PHY_GetTxPowerByRateBase(struct adapter *Adapter, u8 RfPath,
enum rate_section RateSection)
@ -423,6 +424,7 @@ void PHY_SetTxPowerIndexByRateSection(
if (RateSection == CCK) {
u8 cckRates[] = {MGN_1M, MGN_2M, MGN_5_5M, MGN_11M};
PHY_SetTxPowerIndexByRateArray(padapter, RFPath,
pHalData->CurrentChannelBW,
Channel, cckRates,
@ -430,6 +432,7 @@ void PHY_SetTxPowerIndexByRateSection(
} else if (RateSection == OFDM) {
u8 ofdmRates[] = {MGN_6M, MGN_9M, MGN_12M, MGN_18M, MGN_24M, MGN_36M, MGN_48M, MGN_54M};
PHY_SetTxPowerIndexByRateArray(padapter, RFPath,
pHalData->CurrentChannelBW,
Channel, ofdmRates,
@ -437,6 +440,7 @@ void PHY_SetTxPowerIndexByRateSection(
} else if (RateSection == HT_MCS0_MCS7) {
u8 htRates1T[] = {MGN_MCS0, MGN_MCS1, MGN_MCS2, MGN_MCS3, MGN_MCS4, MGN_MCS5, MGN_MCS6, MGN_MCS7};
PHY_SetTxPowerIndexByRateArray(padapter, RFPath,
pHalData->CurrentChannelBW,
Channel, htRates1T,
@ -500,6 +504,7 @@ s8 PHY_GetTxPowerTrackingOffset(struct adapter *padapter, u8 RFPath, u8 Rate)
u8 PHY_GetRateIndexOfTxPowerByRate(u8 Rate)
{
u8 index = 0;
switch (Rate) {
case MGN_1M:
index = 0;
@ -819,27 +824,27 @@ void PHY_SetTxPowerLimit(
powerLimit = powerLimit > MAX_POWER_INDEX ? MAX_POWER_INDEX : powerLimit;
if (eqNByte(Regulation, (u8 *)("FCC"), 3))
if (strcmp(Regulation, "FCC") == 0)
regulation = 0;
else if (eqNByte(Regulation, (u8 *)("MKK"), 3))
else if (strcmp(Regulation, "MKK") == 0)
regulation = 1;
else if (eqNByte(Regulation, (u8 *)("ETSI"), 4))
else if (strcmp(Regulation, "ETSI") == 0)
regulation = 2;
else if (eqNByte(Regulation, (u8 *)("WW13"), 4))
else if (strcmp(Regulation, "WW13") == 0)
regulation = 3;
if (eqNByte(RateSection, (u8 *)("CCK"), 3) && eqNByte(RfPath, (u8 *)("1T"), 2))
if (strcmp(RateSection, "CCK") == 0 && strcmp(RfPath, "1T") == 0)
rateSection = 0;
else if (eqNByte(RateSection, (u8 *)("OFDM"), 4) && eqNByte(RfPath, (u8 *)("1T"), 2))
else if (strcmp(RateSection, "OFDM") == 0 && strcmp(RfPath, "1T") == 0)
rateSection = 1;
else if (eqNByte(RateSection, (u8 *)("HT"), 2) && eqNByte(RfPath, (u8 *)("1T"), 2))
else if (strcmp(RateSection, "HT") == 0 && strcmp(RfPath, "1T") == 0)
rateSection = 2;
else
return;
if (eqNByte(Bandwidth, (u8 *)("20M"), 3))
if (strcmp(Bandwidth, "20M") == 0)
bandwidth = 0;
else if (eqNByte(Bandwidth, (u8 *)("40M"), 3))
else if (strcmp(Bandwidth, "40M") == 0)
bandwidth = 1;
channelIndex = phy_GetChannelIndexOfTxPowerLimit(channel);
@ -856,6 +861,7 @@ void PHY_SetTxPowerLimit(
void Hal_ChannelPlanToRegulation(struct adapter *Adapter, u16 ChannelPlan)
{
struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);
pHalData->Regulation2_4G = TXPWR_LMT_WW;
switch (ChannelPlan) {

View File

@ -131,8 +131,8 @@ u8 CCKSwingTable_Ch14_New[CCK_TABLE_SIZE][8] = {
static void odm_CommonInfoSelfInit(struct dm_odm_t *pDM_Odm)
{
pDM_Odm->bCckHighPower = (bool) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(CCK_RPT_FORMAT, pDM_Odm), ODM_BIT(CCK_RPT_FORMAT, pDM_Odm));
pDM_Odm->RFPathRxEnable = (u8) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(BB_RX_PATH, pDM_Odm), ODM_BIT(BB_RX_PATH, pDM_Odm));
pDM_Odm->bCckHighPower = (bool) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(CCK_RPT_FORMAT), ODM_BIT(CCK_RPT_FORMAT));
pDM_Odm->RFPathRxEnable = (u8) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(BB_RX_PATH), ODM_BIT(BB_RX_PATH));
pDM_Odm->TxRate = 0xFF;
}

View File

@ -202,14 +202,7 @@ struct odm_rate_adaptive {
/* */
/* Declare for common info */
/* */
#define MAX_PATH_NUM_92CS 2
#define MAX_PATH_NUM_8188E 1
#define MAX_PATH_NUM_8192E 2
#define MAX_PATH_NUM_8723B 1
#define MAX_PATH_NUM_8812A 2
#define MAX_PATH_NUM_8821A 1
#define MAX_PATH_NUM_8814A 4
#define MAX_PATH_NUM_8822B 2
#define IQK_THRESHOLD 8
#define DPK_THRESHOLD 4
@ -657,10 +650,6 @@ struct ant_detected_info {
/* 2011/09/22 MH Copy from SD4 defined structure. We use to support PHY DM integration. */
/* */
struct dm_odm_t { /* DM_Out_Source_Dynamic_Mechanism_Structure */
/* struct timer_list FastAntTrainingTimer; */
/* */
/* Add for different team use temporarily */
/* */
struct adapter *Adapter; /* For CE/NIC team */
/* WHen you use Adapter or priv pointer, you must make sure the pointer is ready. */
bool odm_ready;
@ -680,17 +669,6 @@ struct dm_odm_t { /* DM_Out_Source_Dynamic_Mechanism_Structure */
u8 ControlChannel;
/* ODM HANDLE, DRIVER NEEDS NOT TO HOOK------ */
/* REMOVED COMMON INFO---------- */
/* u8 PseudoMacPhyMode; */
/* bool *BTCoexist; */
/* bool PseudoBtCoexist; */
/* u8 OPMode; */
/* bool bAPMode; */
/* bool bClientMode; */
/* bool bAdHocMode; */
/* bool bSlaveOfDMSP; */
/* REMOVED COMMON INFO---------- */
/* 1 COMMON INFORMATION */
/* */
@ -773,7 +751,6 @@ struct dm_odm_t { /* DM_Out_Source_Dynamic_Mechanism_Structure */
u8 *pAntennaTest;
bool *pbNet_closed;
u8 *mp_mode;
/* u8 *pAidMap; */
u8 *pu1ForcedIgiLb;
/* For 8723B IQK----------- */
bool *pIs1Antenna;
@ -872,18 +849,9 @@ struct dm_odm_t { /* DM_Out_Source_Dynamic_Mechanism_Structure */
/* Latest packet phy info (ODM write) */
struct odm_phy_dbg_info PhyDbgInfo;
/* PHY_INFO_88E PhyInfo; */
/* Latest packet phy info (ODM write) */
struct odm_mac_status_info *pMacInfo;
/* MAC_INFO_88E MacInfo; */
/* Different Team independent structure?? */
/* */
/* TX_RTP_CMN TX_retrpo; */
/* TX_RTP_88E TX_retrpo; */
/* TX_RTP_8195 TX_retrpo; */
/* */
/* ODM Structure */
@ -909,15 +877,6 @@ struct dm_odm_t { /* DM_Out_Source_Dynamic_Mechanism_Structure */
/* */
/* common */
/* u8 DM_Type; */
/* u8 PSD_Report_RXHP[80]; Add By Gary */
/* u8 PSD_func_flag; Add By Gary */
/* for DIG */
/* u8 bDMInitialGainEnable; */
/* u8 binitialized; for dm_initial_gain_Multi_STA use. */
/* for Antenna diversity */
/* u8 AntDivCfg; 0:OFF , 1:ON, 2:by efuse */
/* PSTA_INFO_T RSSI_target; */
bool *pbDriverStopped;
bool *pbDriverIsGoingToPnpSetPowerSleep;
@ -985,7 +944,7 @@ struct dm_odm_t { /* DM_Out_Source_Dynamic_Mechanism_Structure */
#endif
};
enum odm_rf_content {
enum odm_rf_content {
odm_radioa_txt = 0x1000,
odm_radiob_txt = 0x1001,
odm_radioc_txt = 0x1002,

View File

@ -47,8 +47,8 @@ static void odm_SetATCStatus(void *pDM_VOID, bool ATCStatus)
PHY_SetBBReg(
pDM_Odm->Adapter,
ODM_REG(BB_ATC, pDM_Odm),
ODM_BIT(BB_ATC, pDM_Odm),
ODM_REG(BB_ATC),
ODM_BIT(BB_ATC),
ATCStatus
);
pCfoTrack->bATCStatus = ATCStatus;
@ -61,8 +61,8 @@ static bool odm_GetATCStatus(void *pDM_VOID)
ATCStatus = (bool)PHY_QueryBBReg(
pDM_Odm->Adapter,
ODM_REG(BB_ATC, pDM_Odm),
ODM_BIT(BB_ATC, pDM_Odm)
ODM_REG(BB_ATC),
ODM_BIT(BB_ATC)
);
return ATCStatus;
}

View File

@ -220,9 +220,8 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI)
s8 Diff, IGI_target;
bool EDCCA_State = false;
if (!(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY)) {
if (!(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY))
return;
}
if (*pDM_Odm->pBandWidth == ODM_BW20M) /* CHANNEL_WIDTH_20 */
IGI_target = pDM_Odm->IGI_Base;
@ -286,23 +285,21 @@ void ODM_Write_DIG(void *pDM_VOID, u8 CurrentIGI)
struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID;
struct dig_t *pDM_DigTable = &pDM_Odm->DM_DigTable;
if (pDM_DigTable->bStopDIG) {
if (pDM_DigTable->bStopDIG)
return;
}
if (pDM_DigTable->CurIGValue != CurrentIGI) {
/* 1 Check initial gain by upper bound */
if (!pDM_DigTable->bPSDInProgress) {
if (CurrentIGI > pDM_DigTable->rx_gain_range_max) {
if (CurrentIGI > pDM_DigTable->rx_gain_range_max)
CurrentIGI = pDM_DigTable->rx_gain_range_max;
}
}
/* 1 Set IGI value */
PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG(IGI_A, pDM_Odm), ODM_BIT(IGI, pDM_Odm), CurrentIGI);
PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG(IGI_A), ODM_BIT(IGI), CurrentIGI);
PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG(IGI_B, pDM_Odm), ODM_BIT(IGI, pDM_Odm), CurrentIGI);
PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG(IGI_B), ODM_BIT(IGI), CurrentIGI);
pDM_DigTable->CurIGValue = CurrentIGI;
}
@ -314,24 +311,20 @@ bool odm_DigAbort(void *pDM_VOID)
struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID;
/* SupportAbility */
if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) {
if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT))
return true;
}
/* SupportAbility */
if (!(pDM_Odm->SupportAbility & ODM_BB_DIG)) {
if (!(pDM_Odm->SupportAbility & ODM_BB_DIG))
return true;
}
/* ScanInProcess */
if (*(pDM_Odm->pbScanInProcess)) {
if (*(pDM_Odm->pbScanInProcess))
return true;
}
/* add by Neil Chen to avoid PSD is processing */
if (pDM_Odm->bDMInitialGainEnable == false) {
if (pDM_Odm->bDMInitialGainEnable == false)
return true;
}
return false;
}
@ -343,7 +336,7 @@ void odm_DIGInit(void *pDM_VOID)
pDM_DigTable->bStopDIG = false;
pDM_DigTable->bPSDInProgress = false;
pDM_DigTable->CurIGValue = (u8) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(IGI_A, pDM_Odm), ODM_BIT(IGI, pDM_Odm));
pDM_DigTable->CurIGValue = (u8) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(IGI_A), ODM_BIT(IGI));
pDM_DigTable->RssiLowThresh = DM_DIG_THRESH_LOW;
pDM_DigTable->RssiHighThresh = DM_DIG_THRESH_HIGH;
pDM_DigTable->FALowThresh = DMfalseALARM_THRESH_LOW;
@ -413,9 +406,9 @@ void odm_DIG(void *pDM_VOID)
if (pDM_Odm->bLinked && bPerformance) {
/* 2 Modify DIG upper bound */
/* 4 Modify DIG upper bound for 92E, 8723A\B, 8821 & 8812 BT */
if (pDM_Odm->bBtLimitedDig == 1) {
if (pDM_Odm->bBtLimitedDig == 1)
offset = 10;
} else
else
offset = 15;
if ((pDM_Odm->RSSI_Min + offset) > dm_dig_max)
@ -475,9 +468,8 @@ void odm_DIG(void *pDM_VOID)
}
/* 2 Abnormal lower bound case */
if (pDM_DigTable->rx_gain_range_min > pDM_DigTable->rx_gain_range_max) {
if (pDM_DigTable->rx_gain_range_min > pDM_DigTable->rx_gain_range_max)
pDM_DigTable->rx_gain_range_min = pDM_DigTable->rx_gain_range_max;
}
/* 1 False alarm threshold decision */
@ -814,7 +806,7 @@ void ODM_Write_CCK_CCA_Thres(void *pDM_VOID, u8 CurCCK_CCAThres)
/* modify by Guo.Mingzhi 2012-01-03 */
if (pDM_DigTable->CurCCK_CCAThres != CurCCK_CCAThres)
rtw_write8(pDM_Odm->Adapter, ODM_REG(CCK_CCA, pDM_Odm), CurCCK_CCAThres);
rtw_write8(pDM_Odm->Adapter, ODM_REG(CCK_CCA), CurCCK_CCAThres);
pDM_DigTable->PreCCK_CCAThres = pDM_DigTable->CurCCK_CCAThres;
pDM_DigTable->CurCCK_CCAThres = CurCCK_CCAThres;

View File

@ -125,9 +125,8 @@ void odm_ConfigBB_PHY_REG_PG_8723B(
{
if (Addr == 0xfe || Addr == 0xffe)
msleep(50);
else {
else
PHY_StoreTxPowerByRate(pDM_Odm->Adapter, RfPath, Addr, Bitmask, Data);
}
}
void odm_ConfigBB_PHY_8723B(
@ -149,9 +148,8 @@ void odm_ConfigBB_PHY_8723B(
udelay(5);
else if (Addr == 0xf9)
udelay(1);
else {
else
PHY_SetBBReg(pDM_Odm->Adapter, Addr, Bitmask, Data);
}
/* Add 1us delay between BB/RF register setting. */
udelay(1);

View File

@ -23,18 +23,18 @@
#define ODM_REG_DIG_11N 0xC50
#define ODM_REG_DIG_11AC 0xDDD
ODM_REG(DIG, _pDM_Odm)
ODM_REG(DIG)
=====================================*/
#define _reg_11N(_name) ODM_REG_##_name##_11N
#define _bit_11N(_name) ODM_BIT_##_name##_11N
#define _cat(_name, _ic_type, _func) _func##_11N(_name)
#define _cat(_name, _func) _func##_11N(_name)
/* _name: name of register or bit. */
/* Example: "ODM_REG(R_A_AGC_CORE1, pDM_Odm)" */
/* gets "ODM_R_A_AGC_CORE1" or "ODM_R_A_AGC_CORE1_8192C", depends on SupportICType. */
#define ODM_REG(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _reg)
#define ODM_BIT(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _bit)
/* Example: "ODM_REG(R_A_AGC_CORE1)" */
/* gets "ODM_R_A_AGC_CORE1" or "ODM_R_A_AGC_CORE1_8192C". */
#define ODM_REG(_name) _cat(_name, _reg)
#define ODM_BIT(_name) _cat(_name, _bit)
#endif /* __ODM_INTERFACE_H__ */

View File

@ -36,10 +36,6 @@ enum hal_status {
#define STA_INFO_T struct sta_info
#define PSTA_INFO_T struct sta_info *
#define SET_TX_DESC_ANTSEL_A_88E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 24, 1, __Value)
#define SET_TX_DESC_ANTSEL_B_88E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 25, 1, __Value)
#define SET_TX_DESC_ANTSEL_C_88E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 29, 1, __Value)
/* define useless flag to avoid compile warning */
#define USE_WORKITEM 0
#define FPGA_TWO_MAC_VERIFICATION 0

View File

@ -672,6 +672,7 @@ void rtl8723b_download_rsvd_page(struct adapter *padapter, u8 mstatus)
if (padapter->bSurpriseRemoved || padapter->bDriverStopped) {
} else {
struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter);
pwrctl->fw_psmode_iface_id = padapter->iface_id;
}
@ -935,6 +936,7 @@ void rtl8723b_download_BTCoex_AP_mode_rsvd_page(struct adapter *padapter)
if (bcn_valid) {
struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter);
pwrctl->fw_psmode_iface_id = padapter->iface_id;
}

View File

@ -1185,12 +1185,12 @@ void Hal_InitPGData(struct adapter *padapter, u8 *PROMContent)
if (!pEEPROM->EepromOrEfuse) {
/* Read EFUSE real map to shadow. */
EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI);
memcpy((void *)PROMContent, (void *)pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE_8723B);
memcpy(PROMContent, pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE_8723B);
}
} else {/* autoload fail */
if (!pEEPROM->EepromOrEfuse)
EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI);
memcpy((void *)PROMContent, (void *)pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE_8723B);
memcpy(PROMContent, pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE_8723B);
}
}
@ -1631,6 +1631,7 @@ static void rtl8723b_cal_txdesc_chksum(struct tx_desc *ptxdesc)
static u8 fill_txdesc_sectype(struct pkt_attrib *pattrib)
{
u8 sectype = 0;
if ((pattrib->encrypt > 0) && !pattrib->bswenc) {
switch (pattrib->encrypt) {
/* SEC_TYPE */
@ -2031,6 +2032,7 @@ static void hw_var_set_bcn_func(struct adapter *padapter, u8 variable, u8 *val)
rtw_write8(padapter, bcn_ctrl_reg, (EN_BCN_FUNCTION | EN_TXBCN_RPT));
else {
u8 val8;
val8 = rtw_read8(padapter, bcn_ctrl_reg);
val8 &= ~(EN_BCN_FUNCTION | EN_TXBCN_RPT);
@ -2225,6 +2227,7 @@ s32 c2h_id_filter_ccx_8723b(u8 *buf)
{
struct c2h_evt_hdr_88xx *c2h_evt = (struct c2h_evt_hdr_88xx *)buf;
s32 ret = false;
if (c2h_evt->id == C2H_CCX_TX_RPT)
ret = true;
@ -2314,6 +2317,7 @@ void C2HPacketHandler_8723B(struct adapter *padapter, u8 *pbuffer, u16 length)
{
struct c2h_evt_hdr_t C2hEvent;
u8 *tmpBuf = NULL;
C2hEvent.CmdID = pbuffer[0];
C2hEvent.CmdSeq = pbuffer[1];
C2hEvent.CmdLen = length-2;
@ -2397,6 +2401,7 @@ void SetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val)
case HW_VAR_CHECK_BSSID:
{
u32 val32;
val32 = rtw_read32(padapter, REG_RCR);
if (*val)
val32 |= RCR_CBSSID_DATA|RCR_CBSSID_BCN;

View File

@ -575,6 +575,7 @@ static void phy_SetRegBW_8723B(
)
{
u16 RegRfMod_BW, u2tmp = 0;
RegRfMod_BW = rtw_read16(Adapter, REG_TRXPTCL_CTL_8723B);
switch (CurrentBW) {

View File

@ -143,6 +143,7 @@ static void update_recvframe_phyinfo(union recv_frame *precvframe,
}
} else if (pkt_info.to_self || pkt_info.is_beacon) {
u32 adhoc_state = WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE;
if (check_fwstate(&padapter->mlmepriv, adhoc_state))
if (psta)
precvframe->u.hdr.psta = psta;

View File

@ -202,7 +202,7 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv
if (
(check_pending_xmitbuf(pxmitpriv)) &&
(padapter->mlmepriv.LinkDetectInfo.bHigherBusyTxTraffic)
(padapter->mlmepriv.link_detect_info.higher_busy_tx_traffic)
) {
if ((phwxmit->accnt > 0) && (phwxmit->accnt < 5)) {
err = -2;
@ -240,6 +240,7 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv
if (pxmitbuf->len > 0 &&
pxmitbuf->priv_data) {
struct xmit_frame *pframe;
pframe = (struct xmit_frame *)pxmitbuf->priv_data;
pframe->agg_num = k;
pxmitbuf->agg_num = k;
@ -324,6 +325,7 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv
if (pxmitbuf) {
if (pxmitbuf->len > 0) {
struct xmit_frame *pframe;
pframe = (struct xmit_frame *)pxmitbuf->priv_data;
pframe->agg_num = k;
pxmitbuf->agg_num = k;
@ -482,7 +484,7 @@ s32 rtl8723bs_hal_xmit(
(pxmitframe->attrib.ether_type != 0x888e) &&
(pxmitframe->attrib.dhcp_pkt != 1)
) {
if (padapter->mlmepriv.LinkDetectInfo.bBusyTraffic)
if (padapter->mlmepriv.link_detect_info.busy_traffic)
rtw_issue_addbareq_cmd(padapter, pxmitframe);
}

View File

@ -30,7 +30,7 @@ static u8 CardEnable(struct adapter *padapter)
ret = HalPwrSeqCmdParsing(padapter, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, rtl8723B_card_enable_flow);
if (ret == _SUCCESS) {
u8 bMacPwrCtrlOn = true;
bMacPwrCtrlOn = true;
rtw_hal_set_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn);
}
} else
@ -214,6 +214,7 @@ static void _InitNormalChipOneOutEpPriority(struct adapter *Adapter)
struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);
u16 value = 0;
switch (pHalData->OutEpQueueSel) {
case TX_SELE_HQ:
value = QUEUE_HIGH;
@ -341,6 +342,7 @@ static void _InitTransferPageSize(struct adapter *padapter)
/* Tx page size is always 128. */
u8 value8;
value8 = _PSRX(PBP_128) | _PSTX(PBP_128);
rtw_write8(padapter, REG_PBP, value8);
}
@ -388,7 +390,7 @@ static void _InitWMACSetting(struct adapter *padapter)
/* 2010.09.08 hpfan */
/* Since ADF is removed from RCR, ps-poll will not be indicate to driver, */
/* RxFilterMap should mask ps-poll to gurantee AP mode can rx ps-poll. */
/* RxFilterMap should mask ps-poll to guarantee AP mode can rx ps-poll. */
value16 = 0x400;
rtw_write16(padapter, REG_RXFLTMAP1, value16);
@ -606,7 +608,7 @@ u32 rtl8723bs_hal_init(struct adapter *padapter)
cpwm_orig = 0;
rtw_hal_get_hwreg(padapter, HW_VAR_CPWM, &cpwm_orig);
/* ser rpwm */
/* set rpwm */
val8 = rtw_read8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HRPWM1);
val8 &= 0x80;
val8 += 0x80;
@ -901,7 +903,7 @@ u32 rtl8723bs_hal_deinit(struct adapter *padapter)
} while (cnt < 100 && (val8 != 0));
/* H2C done, enter 32k */
if (val8 == 0) {
/* ser rpwm to enter 32k */
/* set rpwm to enter 32k */
val8 = rtw_read8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HRPWM1);
val8 += 0x80;
val8 |= BIT(0);
@ -1147,6 +1149,7 @@ void SetHwReg8723BS(struct adapter *padapter, u8 variable, u8 *val)
case HW_VAR_SET_REQ_FW_PS:
{
u8 req_fw_ps = 0;
req_fw_ps = rtw_read8(padapter, 0x8f);
req_fw_ps |= 0x10;
rtw_write8(padapter, 0x8f, req_fw_ps);

View File

@ -13,12 +13,8 @@
/* */
/* Creadted by Roger, 2011.01.31. */
/* */
static void hal_sdio_get_cmd_addr_8723b(
struct adapter *adapter,
u8 device_id,
u32 addr,
u32 *cmdaddr
)
static void hal_sdio_get_cmd_addr_8723b(struct adapter *adapter, u8 device_id,
u32 addr, u32 *cmdaddr)
{
switch (device_id) {
case SDIO_LOCAL_DEVICE_ID:
@ -583,12 +579,10 @@ s32 sdio_local_write(
)
return sd_cmd52_write(intfhdl, addr, cnt, buf);
tmpbuf = kmalloc(cnt, GFP_ATOMIC);
tmpbuf = kmemdup(buf, cnt, GFP_ATOMIC);
if (!tmpbuf)
return -ENOMEM;
memcpy(tmpbuf, buf, cnt);
err = sd_write(intfhdl, addr, cnt, tmpbuf);
kfree(tmpbuf);

View File

@ -7,7 +7,6 @@
#ifndef __BASIC_TYPES_H__
#define __BASIC_TYPES_H__
#define SUCCESS 0
#define FAIL (-1)
@ -42,31 +41,6 @@
#define EF4BYTE(_val) \
(le32_to_cpu(_val))
/* Read data from memory */
#define READEF1BYTE(_ptr) \
EF1BYTE(*((u8 *)(_ptr)))
/* Read le16 data from memory and convert to host ordering */
#define READEF2BYTE(_ptr) \
EF2BYTE(*(_ptr))
#define READEF4BYTE(_ptr) \
EF4BYTE(*(_ptr))
/* Write data to memory */
#define WRITEEF1BYTE(_ptr, _val) \
do { \
(*((u8 *)(_ptr))) = EF1BYTE(_val); \
} while (0)
/* Write le data to memory in host ordering */
#define WRITEEF2BYTE(_ptr, _val) \
do { \
(*((u16 *)(_ptr))) = EF2BYTE(_val); \
} while (0)
#define WRITEEF4BYTE(_ptr, _val) \
do { \
(*((u32 *)(_ptr))) = EF2BYTE(_val); \
} while (0)
/*
* Create a bit mask
* Examples:
@ -154,25 +128,25 @@
* Set subfield of little-endian 4-byte value to specified value.
*/
#define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
*((u32 *)(__pstart)) = \
(*((u32 *)(__pstart)) = \
( \
LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
)
))
#define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \
*((u16 *)(__pstart)) = \
(*((u16 *)(__pstart)) = \
( \
LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \
((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset)) \
)
))
#define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \
*((u8 *)(__pstart)) = EF1BYTE \
(*((u8 *)(__pstart)) = EF1BYTE \
( \
LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) | \
((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \
)
))
#define LE_BITS_CLEARED_TO_1BYTE_8BIT(__pStart, __BitOffset, __BitLen) \
(\

View File

@ -141,8 +141,6 @@ void rtw_hal_check_rxfifo_full(struct adapter *adapter);
u8 GetHalDefVar(struct adapter *adapter, enum hal_def_variable variable,
void *value);
bool eqNByte(u8 *str1, u8 *str2, u32 num);
bool GetU1ByteIntegerFromStringInDecimal(char *str, u8 *in);
#define HWSET_MAX_SIZE 512

View File

@ -385,7 +385,7 @@ struct hal_com_data {
struct dm_priv dmpriv;
struct dm_odm_t odmpriv;
/* For bluetooth co-existance */
/* For bluetooth co-existence */
struct bt_coexist bt_coexist;
/* Interrupt related register information. */

View File

@ -11,7 +11,6 @@
#define MGMT_QUEUE_NUM 5
#define ETH_ALEN 6
#define ETH_TYPE_LEN 2
#define PAYLOAD_TYPE_LEN 1
@ -508,23 +507,6 @@ Total: 28-2340 bytes
#define DEFAULT_FTS 2346
#define IP_ARG(x) (x)
static inline int is_multicast_mac_addr(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
static inline int is_broadcast_mac_addr(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
}
static inline int is_zero_mac_addr(const u8 *addr)
{
return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \
(addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
}
#define CFG_IEEE80211_RESERVE_FCS (1<<0)
#define CFG_IEEE80211_COMPUTE_FCS (1<<1)
@ -723,11 +705,15 @@ struct rtw_ieee802_11_elems {
u8 vht_op_mode_notify_len;
};
enum ParseRes { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 };
enum parse_result {
PARSE_OK = 0,
PARSE_UNKNOWN = 1,
PARSE_FAILED = -1
};
enum ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
struct rtw_ieee802_11_elems *elems,
int show_errors);
enum parse_result rtw_ieee802_11_parse_elems(u8 *start, uint len,
struct rtw_ieee802_11_elems *elems,
int show_errors);
u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char *source, unsigned int *frlen);
u8 *rtw_set_ie(u8 *pbuf, signed int index, uint len, u8 *source, uint *frlen);
@ -774,7 +760,7 @@ bool rtw_is_cckrates_included(u8 *rate);
bool rtw_is_cckratesonly_included(u8 *rate);
int rtw_check_network_type(unsigned char *rate, int ratelen, int channel);
int rtw_check_network_type(unsigned char *rate, int channel);
void rtw_get_bcn_info(struct wlan_network *pnetwork);

View File

@ -7,58 +7,6 @@
#ifndef __IOCTL_CFG80211_H__
#define __IOCTL_CFG80211_H__
struct rtw_wdev_invit_info {
u8 state; /* 0: req, 1:rep */
u8 peer_mac[ETH_ALEN];
u8 active;
u8 token;
u8 flags;
u8 status;
u8 req_op_ch;
u8 rsp_op_ch;
};
#define rtw_wdev_invit_info_init(invit_info) \
do { \
(invit_info)->state = 0xff; \
memset((invit_info)->peer_mac, 0, ETH_ALEN); \
(invit_info)->active = 0xff; \
(invit_info)->token = 0; \
(invit_info)->flags = 0x00; \
(invit_info)->status = 0xff; \
(invit_info)->req_op_ch = 0; \
(invit_info)->rsp_op_ch = 0; \
} while (0)
struct rtw_wdev_nego_info {
u8 state; /* 0: req, 1:rep, 2:conf */
u8 peer_mac[ETH_ALEN];
u8 active;
u8 token;
u8 status;
u8 req_intent;
u8 req_op_ch;
u8 req_listen_ch;
u8 rsp_intent;
u8 rsp_op_ch;
u8 conf_op_ch;
};
#define rtw_wdev_nego_info_init(nego_info) \
do { \
(nego_info)->state = 0xff; \
memset((nego_info)->peer_mac, 0, ETH_ALEN); \
(nego_info)->active = 0xff; \
(nego_info)->token = 0; \
(nego_info)->status = 0xff; \
(nego_info)->req_intent = 0xff; \
(nego_info)->req_op_ch = 0; \
(nego_info)->req_listen_ch = 0; \
(nego_info)->rsp_intent = 0xff; \
(nego_info)->rsp_op_ch = 0; \
(nego_info)->conf_op_ch = 0; \
} while (0)
struct rtw_wdev_priv {
struct wireless_dev *rtw_wdev;
@ -70,14 +18,6 @@ struct rtw_wdev_priv {
struct net_device *pmon_ndev;/* for monitor interface */
char ifname_mon[IFNAMSIZ + 1]; /* interface name for monitor interface */
u8 p2p_enabled;
u8 provdisc_req_issued;
struct rtw_wdev_invit_info invit_info;
struct rtw_wdev_nego_info nego_info;
u8 bandroid_scan;
bool block;
bool power_mgmt;
};

View File

@ -7,10 +7,6 @@
#ifndef _RTL8192C_RECV_H_
#define _RTL8192C_RECV_H_
#define RECV_BLK_SZ 512
#define RECV_BLK_CNT 16
#define RECV_BLK_TH RECV_BLK_CNT
#define MAX_RECVBUF_SZ (10240)
struct phy_stat {

View File

@ -236,8 +236,6 @@ int FirmwareDownloadBT(struct adapter *adapter, struct rt_firmware *firmware);
void CCX_FwC2HTxRpt_8723b(struct adapter *padapter, u8 *pdata, u8 len);
s32 c2h_id_filter_ccx_8723b(u8 *buf);
s32 c2h_handler_8723b(struct adapter *padapter, u8 *pC2hEvent);
u8 MRateToHwRate8723B(u8 rate);
u8 HwRateToMRate8723B(u8 rate);
void Hal_ReadRFGainOffset(struct adapter *padapter, u8 *hwinfo,
bool AutoLoadFail);

View File

@ -559,7 +559,7 @@ struct RunInThread_param {
Result:
0x00: success
0x01: success, and check Response.
0x02: cmd ignored due to duplicated sequcne number
0x02: cmd ignored due to duplicated sequence number
0x03: cmd dropped due to invalid cmd code
0x04: reserved.

View File

@ -68,25 +68,6 @@ struct efuse_hal {
u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN];
};
/*------------------------Export global variable----------------------------*/
extern u8 fakeEfuseBank;
extern u32 fakeEfuseUsedBytes;
extern u8 fakeEfuseContent[];
extern u8 fakeEfuseInitMap[];
extern u8 fakeEfuseModifiedMap[];
extern u32 BTEfuseUsedBytes;
extern u8 BTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
extern u8 BTEfuseInitMap[];
extern u8 BTEfuseModifiedMap[];
extern u32 fakeBTEfuseUsedBytes;
extern u8 fakeBTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
extern u8 fakeBTEfuseInitMap[];
extern u8 fakeBTEfuseModifiedMap[];
/*------------------------Export global variable----------------------------*/
u8 Efuse_CalculateWordCnts(u8 word_en);
u8 efuse_OneByteRead(struct adapter *padapter, u16 addr, u8 *data);

View File

@ -76,7 +76,7 @@ Each struct __queue has its own locks, already.
Other items in mlme_priv are protected by mlme_priv.lock, while items in
xmit_priv are protected by xmit_priv.lock.
To avoid possible dead lock, any thread trying to modifiying mlme_priv
To avoid possible dead lock, any thread trying to modifying mlme_priv
SHALL not lock up more than one locks at a time!
The only exception is that queue functions which take the __queue.lock
@ -93,18 +93,20 @@ struct sitesurvey_ctrl {
};
struct rt_link_detect_t {
u32 NumTxOkInPeriod;
u32 NumRxOkInPeriod;
u32 NumRxUnicastOkInPeriod;
bool bBusyTraffic;
bool bTxBusyTraffic;
bool bRxBusyTraffic;
bool bHigherBusyTraffic; /* For interrupt migration purpose. */
bool bHigherBusyRxTraffic; /* We may disable Tx interrupt according as Rx traffic. */
bool bHigherBusyTxTraffic; /* We may disable Tx interrupt according as Tx traffic. */
/* u8 TrafficBusyState; */
u8 TrafficTransitionCount;
u32 LowPowerTransitionCount;
u32 num_tx_ok_in_period;
u32 num_rx_ok_in_period;
u32 num_rx_unicast_ok_in_period;
bool busy_traffic;
bool tx_busy_traffic;
bool rx_busy_traffic;
/* For interrupt migration purpose. */
bool higher_busy_traffic;
/* We may disable Tx interrupt according as Rx traffic. */
bool higher_busy_rx_traffic;
/* We may disable Tx interrupt according as Tx traffic. */
bool higher_busy_tx_traffic;
u8 traffic_transition_count;
u32 low_power_transition_count;
};
/* used for mlme_priv.roam_flags */
@ -171,7 +173,7 @@ struct mlme_priv {
struct ht_priv htpriv;
struct rt_link_detect_t LinkDetectInfo;
struct rt_link_detect_t link_detect_info;
struct timer_list dynamic_chk_timer; /* dynamic/periodic check timer */
u8 acm_mask; /* for wmm acm mask */
@ -360,9 +362,9 @@ extern void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_ne
extern struct wlan_network *_rtw_find_network(struct __queue *scanned_queue, u8 *addr);
extern signed int rtw_if_up(struct adapter *padapter);
bool rtw_if_up(struct adapter *padapter);
signed int rtw_linked_check(struct adapter *padapter);
bool rtw_linked_check(struct adapter *padapter);
u8 *rtw_get_capability_from_ie(u8 *ie);
u8 *rtw_get_beacon_interval_from_ie(u8 *ie);
@ -377,7 +379,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len, u8 channe
void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitframe);
void rtw_append_exented_cap(struct adapter *padapter, u8 *out_ie, uint *pout_len);
int rtw_is_same_ibss(struct adapter *adapter, struct wlan_network *pnetwork);
bool rtw_is_same_ibss(struct adapter *adapter, struct wlan_network *pnetwork);
int is_same_network(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst, u8 feature);
#define rtw_roam_flags(adapter) ((adapter)->mlmepriv.roam_flags)

View File

@ -424,7 +424,7 @@ struct mlme_ext_priv {
void init_mlme_default_rate_set(struct adapter *padapter);
void init_mlme_ext_priv(struct adapter *padapter);
int init_hw_mlme_ext(struct adapter *padapter);
void init_hw_mlme_ext(struct adapter *padapter);
void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext);
extern struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv);
@ -615,7 +615,7 @@ extern void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr
extern void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len);
extern void correct_TSF(struct adapter *padapter, struct mlme_ext_priv *pmlmeext);
extern void adaptive_early_32k(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len);
extern u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer);
extern bool traffic_status_watchdog(struct adapter *padapter, bool from_timer);
int rtw_chk_start_clnt_join(struct adapter *padapter, u8 *ch, u8 *bw, u8 *offset);

View File

@ -15,7 +15,6 @@
#define NDIS_802_11_LENGTH_RATES 8
#define NDIS_802_11_LENGTH_RATES_EX 16
typedef unsigned char NDIS_802_11_MAC_ADDRESS[6];
typedef unsigned char NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; /* Set of 8 data rates */
typedef unsigned char NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; /* Set of 16 data rates */
@ -64,7 +63,7 @@ struct ndis_80211_var_ie {
};
/* Length is the 4 bytes multiples of the sum of
* sizeof (NDIS_802_11_MAC_ADDRESS) + 2 +
* ETH_ALEN + 2 +
* sizeof (struct ndis_802_11_ssid) + sizeof (u32) +
* sizeof (long) + sizeof (enum ndis_802_11_network_type) +
* sizeof (struct ndis_802_11_conf) + sizeof (NDIS_802_11_RATES_EX) + ie_length
@ -155,7 +154,7 @@ struct wlan_bcn_info {
*/
struct wlan_bssid_ex {
u32 length;
NDIS_802_11_MAC_ADDRESS mac_address;
u8 mac_address[ETH_ALEN];
u8 reserved[2];/* 0]: IS beacon frame */
struct ndis_802_11_ssid ssid;
u32 privacy;

View File

@ -93,7 +93,7 @@ static struct ieee80211_channel rtw_2ghz_channels[] = {
static void rtw_2g_channels_init(struct ieee80211_channel *channels)
{
memcpy((void *)channels, (void *)rtw_2ghz_channels,
memcpy(channels, rtw_2ghz_channels,
sizeof(struct ieee80211_channel) * RTW_2G_CHANNELS_NUM
);
}
@ -380,9 +380,9 @@ void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter)
rtw_warn_on(1);
return;
}
if (!memcmp(&(scanned->network.ssid), &(pnetwork->ssid), sizeof(struct ndis_802_11_ssid))
&& !memcmp(scanned->network.mac_address, pnetwork->mac_address, sizeof(NDIS_802_11_MAC_ADDRESS))
)
if (!memcmp(&scanned->network.ssid, &pnetwork->ssid,
sizeof(struct ndis_802_11_ssid)) &&
!memcmp(scanned->network.mac_address, pnetwork->mac_address, ETH_ALEN))
rtw_cfg80211_inform_bss(padapter, scanned);
else
rtw_warn_on(1);
@ -422,9 +422,9 @@ void rtw_cfg80211_indicate_connect(struct adapter *padapter)
goto check_bss;
}
if (!memcmp(scanned->network.mac_address, pnetwork->mac_address, sizeof(NDIS_802_11_MAC_ADDRESS))
&& !memcmp(&(scanned->network.ssid), &(pnetwork->ssid), sizeof(struct ndis_802_11_ssid))
)
if (!memcmp(scanned->network.mac_address, pnetwork->mac_address, ETH_ALEN) &&
!memcmp(&scanned->network.ssid, &pnetwork->ssid,
sizeof(struct ndis_802_11_ssid)))
rtw_cfg80211_inform_bss(padapter, scanned);
else
rtw_warn_on(1);
@ -896,7 +896,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct wireless_dev *wdev,
ret = rtw_cfg80211_set_encryption(ndev, param, param_len);
} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) {
if (mac_addr)
memcpy(param->sta_addr, (void *)mac_addr, ETH_ALEN);
memcpy(param->sta_addr, mac_addr, ETH_ALEN);
ret = rtw_cfg80211_ap_set_encryption(ndev, param, param_len);
} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true
@ -1233,7 +1233,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
goto check_need_indicate_scan_done;
}
if (pmlmepriv->LinkDetectInfo.bBusyTraffic == true) {
if (pmlmepriv->link_detect_info.busy_traffic) {
static unsigned long lastscantime;
unsigned long passtime;
@ -1432,14 +1432,12 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel
goto exit;
}
buf = kzalloc(ielen, GFP_KERNEL);
buf = kmemdup(pie, ielen, GFP_KERNEL);
if (!buf) {
ret = -ENOMEM;
goto exit;
}
memcpy(buf, pie, ielen);
if (ielen < RSN_HEADER_LEN) {
ret = -1;
goto exit;
@ -1737,7 +1735,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
pwep->key_index = wep_key_idx;
pwep->key_index |= 0x80000000;
memcpy(pwep->key_material, (void *)sme->key, pwep->key_length);
memcpy(pwep->key_material, sme->key, pwep->key_length);
if (rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL)
ret = -EOPNOTSUPP;
@ -2086,7 +2084,7 @@ static netdev_tx_t rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struc
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
memcpy(pframe, (void *)buf, len);
memcpy(pframe, buf, len);
pattrib->pktlen = len;
pwlanhdr = (struct ieee80211_hdr *)pframe;
@ -2261,8 +2259,8 @@ static int rtw_add_beacon(struct adapter *adapter, const u8 *head, size_t head_l
if (!pbuf)
return -ENOMEM;
memcpy(pbuf, (void *)head + 24, head_len - 24);/* 24 =beacon header len. */
memcpy(pbuf + head_len - 24, (void *)tail, tail_len);
memcpy(pbuf, head + 24, head_len - 24);/* 24 =beacon header len. */
memcpy(pbuf + head_len - 24, tail, tail_len);
len = head_len + tail_len - 24;
@ -2299,9 +2297,9 @@ static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev,
struct wlan_bssid_ex *pbss_network = &adapter->mlmepriv.cur_network.network;
struct wlan_bssid_ex *pbss_network_ext = &adapter->mlmeextpriv.mlmext_info.network;
memcpy(pbss_network->ssid.ssid, (void *)settings->ssid, settings->ssid_len);
memcpy(pbss_network->ssid.ssid, settings->ssid, settings->ssid_len);
pbss_network->ssid.ssid_length = settings->ssid_len;
memcpy(pbss_network_ext->ssid.ssid, (void *)settings->ssid, settings->ssid_len);
memcpy(pbss_network_ext->ssid.ssid, settings->ssid, settings->ssid_len);
pbss_network_ext->ssid.ssid_length = settings->ssid_len;
}
@ -2495,7 +2493,7 @@ static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *b
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
memcpy(pframe, (void *)buf, len);
memcpy(pframe, buf, len);
pattrib->pktlen = len;
pwlanhdr = (struct ieee80211_hdr *)pframe;
@ -2752,13 +2750,6 @@ int rtw_wdev_alloc(struct adapter *padapter, struct device *dev)
pwdev_priv->scan_request = NULL;
spin_lock_init(&pwdev_priv->scan_req_lock);
pwdev_priv->p2p_enabled = false;
pwdev_priv->provdisc_req_issued = false;
rtw_wdev_invit_info_init(&pwdev_priv->invit_info);
rtw_wdev_nego_info_init(&pwdev_priv->nego_info);
pwdev_priv->bandroid_scan = false;
if (padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE)
pwdev_priv->power_mgmt = true;
else

View File

@ -492,7 +492,7 @@ void rtw_stop_drv_threads(struct adapter *padapter)
{
rtw_stop_cmd_thread(padapter);
/* Below is to termindate tx_thread... */
/* Below is to terminate tx_thread... */
complete(&padapter->xmitpriv.xmit_comp);
wait_for_completion(&padapter->xmitpriv.terminate_xmitthread_comp);
@ -618,11 +618,10 @@ void rtw_reset_drv_sw(struct adapter *padapter)
padapter->xmitpriv.tx_pkts = 0;
padapter->recvpriv.rx_pkts = 0;
pmlmepriv->LinkDetectInfo.bBusyTraffic = false;
pmlmepriv->link_detect_info.busy_traffic = false;
/* pmlmepriv->LinkDetectInfo.TrafficBusyState = false; */
pmlmepriv->LinkDetectInfo.TrafficTransitionCount = 0;
pmlmepriv->LinkDetectInfo.LowPowerTransitionCount = 0;
pmlmepriv->link_detect_info.traffic_transition_count = 0;
pmlmepriv->link_detect_info.low_power_transition_count = 0;
_clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING);
@ -960,7 +959,6 @@ static int netdev_close(struct net_device *pnetdev)
}
rtw_scan_abort(padapter);
adapter_wdev_data(padapter)->bandroid_scan = false;
return 0;
}
@ -1137,10 +1135,10 @@ static int rtw_resume_process_normal(struct adapter *padapter)
pwrpriv = adapter_to_pwrctl(padapter);
pmlmepriv = &padapter->mlmepriv;
/* interface init */
/* if (sdio_init(adapter_to_dvobj(padapter)) != _SUCCESS) */
if ((padapter->intf_init) && (padapter->intf_init(adapter_to_dvobj(padapter)) != _SUCCESS)) {
ret = -1;
goto exit;
if (padapter->intf_init) {
ret = padapter->intf_init(adapter_to_dvobj(padapter));
if (ret)
goto exit;
}
rtw_hal_disable_interrupt(padapter);
/* if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) */

View File

@ -131,9 +131,7 @@ static u32 sdio_init(struct dvobj_priv *dvobj)
release:
sdio_release_host(func);
if (err)
return _FAIL;
return _SUCCESS;
return err;
}
static void sdio_deinit(struct dvobj_priv *dvobj)
@ -155,35 +153,32 @@ static void sdio_deinit(struct dvobj_priv *dvobj)
}
static struct dvobj_priv *sdio_dvobj_init(struct sdio_func *func)
{
int status = _FAIL;
struct dvobj_priv *dvobj = NULL;
struct sdio_data *psdio;
int ret;
dvobj = devobj_init();
if (!dvobj)
goto exit;
return NULL;
sdio_set_drvdata(func, dvobj);
psdio = &dvobj->intf_data;
psdio->func = func;
if (sdio_init(dvobj) != _SUCCESS)
ret = sdio_init(dvobj);
if (ret)
goto free_dvobj;
rtw_reset_continual_io_error(dvobj);
status = _SUCCESS;
return dvobj;
free_dvobj:
if (status != _SUCCESS && dvobj) {
sdio_set_drvdata(func, NULL);
sdio_set_drvdata(func, NULL);
devobj_deinit(dvobj);
devobj_deinit(dvobj);
dvobj = NULL;
}
exit:
return dvobj;
return NULL;
}
static void sdio_dvobj_deinit(struct sdio_func *func)

View File

@ -193,12 +193,9 @@ void _rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev)
rtw_check_xmit_resource(padapter, pkt);
if (!rtw_mc2u_disable
&& check_fwstate(pmlmepriv, WIFI_AP_STATE) == true
&& (IP_MCAST_MAC(pkt->data)
|| ICMPV6_MCAST_MAC(pkt->data)
)
&& padapter->registrypriv.wifi_spec == 0) {
if (!rtw_mc2u_disable && check_fwstate(pmlmepriv, WIFI_AP_STATE) &&
(IP_MCAST_MAC(pkt->data) || ICMPV6_MCAST_MAC(pkt->data)) &&
!padapter->registrypriv.wifi_spec) {
if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME / 4)) {
res = rtw_mlcst2unicst(padapter, pkt);
if (res)

View File

@ -74,7 +74,7 @@ display_control_adjust_SM750LE(struct mode_parameter *mode_param,
return disp_control;
}
/* only timing related registers will be programed */
/* only timing related registers will be programmed */
static void program_mode_registers(struct mode_parameter *mode_param,
struct pll_value *pll)
{

View File

@ -27,7 +27,7 @@
*
* I.e. the SCL may only be changed in section 1. and section 3. while
* the SDA may only be changed in section 2. and section 4. The table
* below gives the changes for these 2 lines in the varios sections.
* below gives the changes for these 2 lines in the various sections.
*
* Section changes Table:
* ======================

View File

@ -375,7 +375,6 @@ static int lynxfb_ops_set_par(struct fb_info *info)
line_length = var->xres_virtual * var->bits_per_pixel / 8;
line_length = ALIGN(line_length, crtc->line_pad);
fix->line_length = line_length;
pr_info("fix->line_length = %d\n", fix->line_length);
/*
* var->red,green,blue,transp are need to be set by driver
@ -389,7 +388,8 @@ static int lynxfb_ops_set_par(struct fb_info *info)
var->accel_flags = 0;/*FB_ACCELF_TEXT;*/
if (ret) {
pr_err("bpp %d not supported\n", var->bits_per_pixel);
dev_err(info->device, "bpp %d not supported\n",
var->bits_per_pixel);
return ret;
}
ret = hw_sm750_crtc_set_mode(crtc, var, fix);
@ -481,19 +481,18 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var,
struct lynxfb_crtc *crtc;
resource_size_t request;
if (!var->pixclock)
return -EINVAL;
ret = 0;
par = info->par;
crtc = &par->crtc;
pr_debug("check var:%dx%d-%d\n",
var->xres,
var->yres,
var->bits_per_pixel);
ret = lynxfb_set_color_offsets(info);
if (ret) {
pr_err("bpp %d not supported\n", var->bits_per_pixel);
dev_err(info->device, "bpp %d not supported\n",
var->bits_per_pixel);
return ret;
}
@ -508,7 +507,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var,
request = ALIGN(request, crtc->line_pad);
request = request * var->yres_virtual;
if (crtc->vidmem_size < request) {
pr_err("not enough video memory for mode\n");
dev_err(info->device, "not enough video memory for mode\n");
return -ENOMEM;
}
@ -533,7 +532,7 @@ static int lynxfb_ops_setcolreg(unsigned int regno,
ret = 0;
if (regno > 256) {
pr_err("regno = %d\n", regno);
dev_err(info->device, "regno = %d\n", regno);
return -EINVAL;
}
@ -580,7 +579,6 @@ static int lynxfb_ops_blank(int blank, struct fb_info *info)
struct lynxfb_par *par;
struct lynxfb_output *output;
pr_debug("blank = %d.\n", blank);
par = info->par;
output = &par->output;
sm750_dev = par->dev;
@ -625,7 +623,6 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
crtc->channel = sm750_primary;
crtc->o_screen = 0;
crtc->v_screen = sm750_dev->pvMem;
pr_info("use simul primary mode\n");
break;
case sm750_simul_sec:
output->paths = sm750_pnc;
@ -734,12 +731,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
lynx750_ext, NULL, vesa_modes,
};
int cdb[] = {ARRAY_SIZE(lynx750_ext), 0, VESA_MODEDB_SIZE};
static const char * const mdb_desc[] = {
"driver prepared modes",
"kernel prepared default modedb",
"kernel HELPERS prepared vesa_modes",
};
static const char *fix_id[2] = {
"sm750_fb1", "sm750_fb2",
};
@ -767,7 +758,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
crtc->cursor.mmio = sm750_dev->pvReg +
0x800f0 + (int)crtc->channel * 0x140;
pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
crtc->cursor.max_h = 64;
crtc->cursor.max_w = 64;
crtc->cursor.size = crtc->cursor.max_h * crtc->cursor.max_w * 2 / 8;
@ -801,47 +791,10 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
ret = fb_find_mode(var, info, g_fbmode[index],
pdb[i], cdb[i], NULL, 8);
if (ret == 1) {
pr_info("success! use specified mode:%s in %s\n",
g_fbmode[index],
mdb_desc[i]);
if (ret == 1 || ret == 2)
break;
} else if (ret == 2) {
pr_warn("use specified mode:%s in %s,with an ignored refresh rate\n",
g_fbmode[index],
mdb_desc[i]);
break;
} else if (ret == 3) {
pr_warn("wanna use default mode\n");
/*break;*/
} else if (ret == 4) {
pr_warn("fall back to any valid mode\n");
} else {
pr_warn("ret = %d,fb_find_mode failed,with %s\n",
ret,
mdb_desc[i]);
}
}
/* some member of info->var had been set by fb_find_mode */
pr_info("Member of info->var is :\n"
"xres=%d\n"
"yres=%d\n"
"xres_virtual=%d\n"
"yres_virtual=%d\n"
"xoffset=%d\n"
"yoffset=%d\n"
"bits_per_pixel=%d\n"
" ...\n",
var->xres,
var->yres,
var->xres_virtual,
var->yres_virtual,
var->xoffset,
var->yoffset,
var->bits_per_pixel);
/* set par */
par->info = info;
@ -851,7 +804,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
info->pseudo_palette = &par->pseudo_palette[0];
info->screen_base = crtc->v_screen;
pr_debug("screen_base vaddr = %p\n", info->screen_base);
info->screen_size = line_length * var->yres_virtual;
/* set info->fix */
@ -865,7 +817,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
strscpy(fix->id, fix_id[index], sizeof(fix->id));
fix->smem_start = crtc->o_screen + sm750_dev->vidmem_start;
pr_info("fix->smem_start = %lx\n", fix->smem_start);
/*
* according to mmap experiment from user space application,
* fix->mmio_len should not larger than virtual size
@ -874,13 +825,10 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
* data into the bound over virtual size
*/
fix->smem_len = crtc->vidmem_size;
pr_info("fix->smem_len = %x\n", fix->smem_len);
info->screen_size = fix->smem_len;
fix->line_length = line_length;
fix->mmio_start = sm750_dev->vidreg_start;
pr_info("fix->mmio_start = %lx\n", fix->mmio_start);
fix->mmio_len = sm750_dev->vidreg_size;
pr_info("fix->mmio_len = %x\n", fix->mmio_len);
lynxfb_set_visual_mode(info);
@ -889,22 +837,12 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
var->accel_flags = 0;
var->vmode = FB_VMODE_NONINTERLACED;
pr_debug("#1 show info->cmap :\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n",
info->cmap.start, info->cmap.len,
info->cmap.red, info->cmap.green, info->cmap.blue,
info->cmap.transp);
ret = fb_alloc_cmap(&info->cmap, 256, 0);
if (ret < 0) {
pr_err("Could not allocate memory for cmap.\n");
dev_err(info->device, "Could not allocate memory for cmap.\n");
goto exit;
}
pr_debug("#2 show info->cmap :\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n",
info->cmap.start, info->cmap.len,
info->cmap.red, info->cmap.green, info->cmap.blue,
info->cmap.transp);
exit:
lynxfb_ops_check_var(var, info);
return ret;
@ -1132,12 +1070,8 @@ static int __init lynxfb_setup(char *options)
int len;
char *opt, *tmp;
if (!options || !*options) {
pr_warn("no options.\n");
if (!options || !*options)
return 0;
}
pr_info("options:%s\n", options);
len = strlen(options) + 1;
g_settings = kzalloc(len, GFP_KERNEL);
@ -1174,7 +1108,6 @@ static int __init lynxfb_setup(char *options)
}
/* misc g_settings are transport to chip specific routines */
pr_info("parameter left for chip specific analysis:%s\n", g_settings);
return 0;
}

View File

@ -34,12 +34,10 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
sm750_dev->vidreg_start = pci_resource_start(pdev, 1);
sm750_dev->vidreg_size = SZ_2M;
pr_info("mmio phyAddr = %lx\n", sm750_dev->vidreg_start);
/* reserve the vidreg space of smi adaptor */
ret = pci_request_region(pdev, 1, "sm750fb");
if (ret) {
pr_err("Can not request PCI regions.\n");
dev_err(&pdev->dev, "Can not request PCI regions.\n");
return ret;
}
@ -47,11 +45,10 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
sm750_dev->pvReg =
ioremap(sm750_dev->vidreg_start, sm750_dev->vidreg_size);
if (!sm750_dev->pvReg) {
pr_err("mmio failed\n");
dev_err(&pdev->dev, "mmio failed\n");
ret = -EFAULT;
goto err_release_region;
}
pr_info("mmio virtual addr = %p\n", sm750_dev->pvReg);
sm750_dev->accel.dpr_base = sm750_dev->pvReg + DE_BASE_ADDR_TYPE1;
sm750_dev->accel.dp_port_base = sm750_dev->pvReg + DE_PORT_ADDR_TYPE1;
@ -67,18 +64,15 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
* @ddk750_get_vm_size function can be safe.
*/
sm750_dev->vidmem_size = ddk750_get_vm_size();
pr_info("video memory phyAddr = %lx, size = %u bytes\n",
sm750_dev->vidmem_start, sm750_dev->vidmem_size);
/* reserve the vidmem space of smi adaptor */
sm750_dev->pvMem =
ioremap_wc(sm750_dev->vidmem_start, sm750_dev->vidmem_size);
if (!sm750_dev->pvMem) {
pr_err("Map video memory failed\n");
dev_err(&pdev->dev, "Map video memory failed\n");
ret = -EFAULT;
goto err_unmap_reg;
}
pr_info("video memory vaddr = %p\n", sm750_dev->pvMem);
return 0;
@ -163,11 +157,9 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
* The following register values for CH7301 are from
* Chrontel app note and our experiment.
*/
pr_info("yes,CH7301 DVI chip found\n");
sm750_sw_i2c_write_reg(0xec, 0x1d, 0x16);
sm750_sw_i2c_write_reg(0xec, 0x21, 0x9);
sm750_sw_i2c_write_reg(0xec, 0x49, 0xC0);
pr_info("okay,CH7301 DVI chip setup done\n");
}
}
@ -192,14 +184,12 @@ int hw_sm750_output_set_mode(struct lynxfb_output *output,
if (sm750_get_chip_type() != SM750LE) {
if (channel == sm750_primary) {
pr_info("primary channel\n");
if (output->paths & sm750_panel)
disp_set |= do_LCD1_PRI;
if (output->paths & sm750_crt)
disp_set |= do_CRT_PRI;
} else {
pr_info("secondary channel\n");
if (output->paths & sm750_panel)
disp_set |= do_LCD1_SEC;
if (output->paths & sm750_crt)
@ -215,7 +205,6 @@ int hw_sm750_output_set_mode(struct lynxfb_output *output,
poke32(DISPLAY_CONTROL_750LE, reg);
}
pr_info("ddk setlogicdispout done\n");
return ret;
}
@ -232,10 +221,8 @@ int hw_sm750_crtc_check_mode(struct lynxfb_crtc *crtc,
case 16:
break;
case 32:
if (sm750_dev->revid == SM750LE_REVISION_ID) {
pr_debug("750le do not support 32bpp\n");
if (sm750_dev->revid == SM750LE_REVISION_ID)
return -EINVAL;
}
break;
default:
return -EINVAL;
@ -302,10 +289,9 @@ int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
else
clock = SECONDARY_PLL;
pr_debug("Request pixel clock = %lu\n", modparm.pixel_clock);
ret = ddk750_set_mode_timing(&modparm, clock);
if (ret) {
pr_err("Set mode timing failed\n");
dev_err(&sm750_dev->pdev->dev, "Set mode timing failed\n");
goto exit;
}
@ -431,12 +417,10 @@ int hw_sm750_set_blank(struct lynxfb_output *output, int blank)
switch (blank) {
case FB_BLANK_UNBLANK:
pr_debug("flag = FB_BLANK_UNBLANK\n");
dpms = SYSTEM_CTRL_DPMS_VPHP;
pps = PANEL_DISPLAY_CTRL_DATA;
break;
case FB_BLANK_NORMAL:
pr_debug("flag = FB_BLANK_NORMAL\n");
dpms = SYSTEM_CTRL_DPMS_VPHP;
crtdb = CRT_DISPLAY_CTRL_BLANK;
break;

View File

@ -14,11 +14,6 @@ struct vme_master {
__u32 aspace; /* Address Space */
__u32 cycle; /* Cycle properties */
__u32 dwidth; /* Maximum Data Width */
#if 0
char prefetchenable; /* Prefetch Read Enable State */
int prefetchsize; /* Prefetch Read Size (Cache Lines) */
char wrpostenable; /* Write Post State */
#endif
} __packed;
/*
@ -35,11 +30,6 @@ struct vme_slave {
__u64 size; /* Window Size */
__u32 aspace; /* Address Space */
__u32 cycle; /* Cycle properties */
#if 0
char wrpostenable; /* Write Post State */
char rmwlock; /* Lock PCI during RMW Cycles */
char data64bitcapable; /* non-VMEbus capable of 64-bit Data */
#endif
} __packed;
struct vme_irq_id {