On 03/25/2013 06:43 PM, Alexander Aring wrote: > Hi, > > On Mon, Mar 25, 2013 at 11:31:11PM +0100, Alexander Aring wrote: >> Hi, >> >> On Sun, Mar 24, 2013 at 01:40:31PM +0000, Stefan Schmidt wrote: >>> Implement the filter function to update short address, pan id and ieee >>> address on change. Allowing for hardware address filtering needed for >>> auto ACK. >>> >>> Signed-off-by: Stefan Schmidt <ste...@datenfreihafen.org> >>> --- >>> drivers/net/ieee802154/at86rf230.c | 45 >>> ++++++++++++++++++++++++++++++++++++ >>> 1 file changed, 45 insertions(+) >>> >>> diff --git a/drivers/net/ieee802154/at86rf230.c >>> b/drivers/net/ieee802154/at86rf230.c >>> index fc1687e..10e79a4 100644 >>> --- a/drivers/net/ieee802154/at86rf230.c >>> +++ b/drivers/net/ieee802154/at86rf230.c >>> @@ -619,6 +619,50 @@ err: >>> return -EINVAL; >>> } >>> >>> +static int >>> +at86rf230_set_hw_addr_filt(struct ieee802154_dev *dev, >>> + struct ieee802154_hw_addr_filt >>> *filt, >>> + unsigned long changed) >>> +{ >>> + struct at86rf230_local *lp = dev->priv; >>> + >>> + might_sleep(); >>> + >>> + if (changed & IEEE802515_AFILT_SADDR_CHANGED) { >>> + dev_info(&lp->spi->dev, "at86rf230_set_hw_addr_filt called for >>> saddr\n"); >> This will printout always this msg, maybe we can do it in dev_vdbg? >> >>> + __at86rf230_write(lp, RG_SHORT_ADDR_0, filt->short_addr & >>> 0xff); /* LSB */ >>> + __at86rf230_write(lp, RG_SHORT_ADDR_1, (filt->short_addr >> 8) >>> & 0xff); /* MSB */ >>> + } >>> + >>> + if (changed & IEEE802515_AFILT_PANID_CHANGED) { >>> + dev_info(&lp->spi->dev, "at86rf230_set_hw_addr_filt called for >>> pan id\n"); >>> + __at86rf230_write(lp, RG_PAN_ID_0, filt->pan_id & 0xff); /* LSB >>> */ >>> + __at86rf230_write(lp, RG_PAN_ID_1, (filt->pan_id >> 8) & 0xff); >>> /* MSB */ >>> + } >>> + >>> + if (changed & IEEE802515_AFILT_IEEEADDR_CHANGED) { >>> + dev_info(&lp->spi->dev, "at86rf230_set_hw_addr_filt called ieee >>> addr\n"); >>> + at86rf230_write_subreg(lp, SR_IEEE_ADDR_0, filt->ieee_addr[7]); >>> + at86rf230_write_subreg(lp, SR_IEEE_ADDR_1, filt->ieee_addr[6]); >>> + at86rf230_write_subreg(lp, SR_IEEE_ADDR_2, filt->ieee_addr[5]); >>> + at86rf230_write_subreg(lp, SR_IEEE_ADDR_3, filt->ieee_addr[4]); >>> + at86rf230_write_subreg(lp, SR_IEEE_ADDR_4, filt->ieee_addr[3]); >>> + at86rf230_write_subreg(lp, SR_IEEE_ADDR_5, filt->ieee_addr[2]); >>> + at86rf230_write_subreg(lp, SR_IEEE_ADDR_6, filt->ieee_addr[1]); >>> + at86rf230_write_subreg(lp, SR_IEEE_ADDR_7, filt->ieee_addr[0]); >>> + } >>> + >>> + if (changed & IEEE802515_AFILT_PANC_CHANGED) { >>> + dev_info(&lp->spi->dev, "at86rf230_set_hw_addr_filt called panc >>> change\n"); >>> + if (filt->pan_coord) >>> + at86rf230_write_subreg(lp, SR_AACK_I_AM_COORD, 1); >>> + else >>> + at86rf230_write_subreg(lp, SR_AACK_I_AM_COORD, 0); >>> + } >>> + >> maybe we can handle this in a switch-case state? >> default switch will return some errno, ENOSYS or something else. >> > I suppose here in this function call, only one change can be permit. I > found a solution with a switch-case state in a another ieee802154 driver > implementation.... > > I saw it in the serial driver. One of Tony's patches, this handle that in > a switch-case state. This driver isn't mainlained yet. Sorry. > > Alan, can you please remember that for tony's serial driver? Maybe this > is a important hint.
I guess I don't know what you mean. It's testing flags, so it should be a series of if-statements. This function hopefully isn't called very often, so any performance penalty should be negligible. Alan. ------------------------------------------------------------------------------ Own the Future-Intel® Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d _______________________________________________ Linux-zigbee-devel mailing list Linux-zigbee-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel