[PATCH] netifd: allow to disable radio if reconf is enable

2023-08-17 Thread Prasun Maiti
From: "Prasun Maiti" 

radio is not down when reconf is enabled,
as not invoking __wireless_device_set_down()
and it is following reconf flow.

So, proceed if radio is not disabled for reconf

Signed-off-by: Prasun Maiti 
---
 wireless.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wireless.c b/wireless.c
index 873c437..898a012 100644
--- a/wireless.c
+++ b/wireless.c
@@ -681,7 +681,7 @@ wdev_set_config_state(struct wireless_device *wdev, enum 
interface_config_state
return;
 
wdev->config_update = false;
-   if (s == IFC_RELOAD && wdev->reconf && wdev->state == IFS_UP) {
+   if (!wdev->disabled && s == IFC_RELOAD && wdev->reconf && wdev->state 
== IFS_UP) {
wireless_device_reconf(wdev);
return;
}
-- 
2.17.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] scripts/feeds: remove target/linux/feeds dir if no target

2023-04-20 Thread Prasun Maiti
From: "Maiti, Prasun" 

If we uninstall last target from target/linux/feeds/
then feeds dir will be empty.

So, feeds dir is not needed anymore.

Signed-off-by: Maiti, Prasun 
---
 scripts/feeds | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/scripts/feeds b/scripts/feeds
index aee73e793f..5fca78fc8d 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -497,6 +497,12 @@ sub is_core_src($) {
return 0;
 }
 
+sub is_dir_empty {
+   my $dir = shift;
+   opendir(my $dh, $dir);
+   return scalar(grep { $_ ne "." && $_ ne ".." } readdir($dh));
+}
+
 sub install_target {
my $feed = shift;
my $name = shift;
@@ -771,6 +777,10 @@ sub uninstall {
system("rm -f ./package/feeds/*/$name");
$uninstall = 1;
}
+   my $count = is_dir_empty("target/linux/feeds");
+   if (!$count) {
+   system("rm -rvf ./target/linux/feeds");
+   }
}
$uninstall and refresh_config();
return 0;
-- 
2.17.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v2] build: fix for sourcing targets image config installed via feeds

2022-12-12 Thread Prasun Maiti
Hi  Petr Štetiar,

Thanks a lot for your review and acknowledgement.

Thanks,
Prasun

Thanks,
Prasun


On Fri, Dec 9, 2022 at 4:01 PM Petr Štetiar  wrote:
>
> Prasun Maiti  [2022-11-16 16:33:33]:
>
> Hi Christian,
>
> > Sourcing of image/Config.in will not happen
> > When a target is installed from target/linux/feeds/
> >
> > Signed-off-by: Prasun Maiti 
>
> I've build tested this on OpenWrt 22.03 and it seems to not break anything, so
> since you've this patch assigned here is my:
>
> Acked-by: Petr Štetiar 

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v2] build: fix for sourcing targets image config installed via feeds

2022-11-16 Thread Prasun Maiti
Sourcing of image/Config.in will not happen
When a target is installed from target/linux/feeds/

Signed-off-by: Prasun Maiti 
---
 config/Config-images.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/config/Config-images.in b/config/Config-images.in
index dcd7575c3e..abb43664af 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
@@ -286,6 +286,7 @@ menu "Target Images"
comment "Image Options"
 
source "target/linux/*/image/Config.in"
+   source "target/linux/*/*/image/Config.in"
 
config TARGET_KERNEL_PARTSIZE
int "Kernel partition size (in MiB)"
-- 
2.17.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] fix for sourcing target image config a when target is being replaced

2022-11-14 Thread Prasun Maiti
Hi Christian,
I think there is no target installed under feeds/ by default. right?
I will resend the patch.

Thanks,
Prasun

On Thu, Nov 10, 2022 at 7:44 PM Christian Marangi  wrote:
>
> On Wed, Oct 12, 2022 at 01:55:16PM +0530, Prasun Maiti wrote:
> > From: Prasun Maiti 
> >
> > Sourcing of image/Config.in will not happen
> > When a target is installed from target/linux/feeds/
> >
>
> Hi, this patch got reverted after it was merged in master as it cause
> wide buildbot compilation failure. This was an RFC and wasn't tested or
> we are missing other patch to make this work?
>
> It would be good if you can resubmit this in a v2 or with a RESEND tag.
>
> > Signed-off-by: Prasun Maiti 
> > ---
> >  config/Config-images.in | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/config/Config-images.in b/config/Config-images.in
> > index dcd7575..832e672 100644
> > --- a/config/Config-images.in
> > +++ b/config/Config-images.in
> > @@ -286,6 +286,7 @@ menu "Target Images"
> >   comment "Image Options"
> >
> >   source "target/linux/*/image/Config.in"
> > + source "target/linux/feeds/*/image/Config.in"
> >
> >   config TARGET_KERNEL_PARTSIZE
> >   int "Kernel partition size (in MiB)"
> > --
> > 2.17.1
> >
> >
> > ___
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
> --
> Ansuel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] netifd: add vif in ascending order instead of lexicographic

2022-10-19 Thread Prasun Maiti
We are using vif_idx for listing vif.
But wlan vif ordering is done in lexicographical manner by avl_strcmp()
which is casuing in bringing up vap with higher index added first.

Instead of using avl_strcmp(), we can use avl_vif_idx_cmp() for interfaces.

Signed-off-by: Prasun Maiti 
---
 wireless.c | 8 +++-
 wireless.h | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/wireless.c b/wireless.c
index bd847e7..b6b45bb 100644
--- a/wireless.c
+++ b/wireless.c
@@ -122,6 +122,12 @@ wireless_handler_stop(struct wireless_device *wdev)
}
 }
 
+int
+avl_vif_idx_cmp(const void *k1, const void *k2, void *ptr)
+{
+   return (atoi(k1) - atoi(k2));
+}
+
 static void
 put_container(struct blob_buf *buf, struct blob_attr *attr, const char *name)
 {
@@ -1045,7 +1051,7 @@ wireless_device_create(struct wireless_driver *drv, const 
char *name, struct blo
wdev->retry_setup_failed = false;
wdev->autostart = true;
INIT_LIST_HEAD(>script_proc);
-   vlist_init(>interfaces, avl_strcmp, vif_update);
+   vlist_init(>interfaces, avl_vif_idx_cmp, vif_update);
wdev->interfaces.keep_old = true;
vlist_init(>vlans, avl_strcmp, vlan_update);
wdev->vlans.keep_old = true;
diff --git a/wireless.h b/wireless.h
index 7b87611..9a2c0ee 100644
--- a/wireless.h
+++ b/wireless.h
@@ -146,5 +146,6 @@ int wireless_device_notify(struct wireless_device *wdev, 
struct blob_attr *data,
 void wireless_start_pending(void);
 void wireless_init(void);
 void wireless_device_hotplug_event(const char *name, bool add);
+int avl_vif_idx_cmp(const void *k1, const void *k2, void *ptr);
 
 #endif
-- 
2.17.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] netifd: add vif in ascending order instead of lexicographic

2022-10-19 Thread Prasun Maiti
We are using vif_idx for listing vif.
But wlan vif ordering is done in lexicographical manner by avl_strcmp()
which is casuing in bringing up vap with higher index added first.

Instead of using avl_strcmp(), we can use avl_vif_idx_cmp() for interfaces.

Signed-off-by: Prasun Maiti 
---
 wireless.c | 8 +++-
 wireless.h | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/wireless.c b/wireless.c
index bd847e7..b6b45bb 100644
--- a/wireless.c
+++ b/wireless.c
@@ -122,6 +122,12 @@ wireless_handler_stop(struct wireless_device *wdev)
}
 }
 
+int
+avl_vif_idx_cmp(const void *k1, const void *k2, void *ptr)
+{
+   return (*(int *)k1 - *(int *)k2);
+}
+
 static void
 put_container(struct blob_buf *buf, struct blob_attr *attr, const char *name)
 {
@@ -1045,7 +1051,7 @@ wireless_device_create(struct wireless_driver *drv, const 
char *name, struct blo
wdev->retry_setup_failed = false;
wdev->autostart = true;
INIT_LIST_HEAD(>script_proc);
-   vlist_init(>interfaces, avl_strcmp, vif_update);
+   vlist_init(>interfaces, avl_vif_idx_cmp, vif_update);
wdev->interfaces.keep_old = true;
vlist_init(>vlans, avl_strcmp, vlan_update);
wdev->vlans.keep_old = true;
diff --git a/wireless.h b/wireless.h
index 7b87611..9a2c0ee 100644
--- a/wireless.h
+++ b/wireless.h
@@ -146,5 +146,6 @@ int wireless_device_notify(struct wireless_device *wdev, 
struct blob_attr *data,
 void wireless_start_pending(void);
 void wireless_init(void);
 void wireless_device_hotplug_event(const char *name, bool add);
+int avl_vif_idx_cmp(const void *k1, const void *k2, void *ptr);
 
 #endif
-- 
2.17.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Handle target path located under target/linux/feeds/

2022-10-12 Thread Prasun Maiti
Hi Felix Fietkau,

Was there any mistake from my end while sending this patch? Due to the
fact that this patch was not reviewed?
But i can see still this patch is needed -
https://patchwork.ozlabs.org/project/openwrt/patch/20221012083243.1123-1-prasunmait...@gmail.com/

Thanks,
Prasun

Thanks,
Prasun


On Mon, Oct 3, 2022 at 11:09 PM Hauke Mehrtens  wrote:
>
> On 10/3/22 17:24, Hauke Mehrtens wrote:
> > On 5/31/22 07:23, Prasun Maiti wrote:
> >> When we are installing targets to target/linux/feeds,
> >> BOARD is not located under target/linux/
> >>
> >> So, we need to handle this scenario taking proper target path
> >
> > Does this change also fix your problem?
> > https://git.openwrt.org/3a8825ad6acbf18b2b472ace56be58868af78be7
> > It was also backported to 22.03:
> > https://git.openwrt.org/25d8b9cad6f141104a1065880efe21b8c292d8c6
> >
> > If this is not solving your problem please explain in more detail in the
> > commit message what problem you want to solve, for me it is not really
> > clear from the commit message.
> >
> > Hauke
>
> This commit also looks related to your problem:
> https://git.openwrt.org/00094efec33f07c9dc16cce23be492430c40b3cc
>
> Hauke

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] fix for sourcing target image config a when target is being replaced

2022-10-12 Thread Prasun Maiti
Sourcing of image/Config.in will not happen 
When a target is installed from target/linux/feeds/ 

Signed-off-by: Prasun Maiti 
---
 config/Config-images.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/config/Config-images.in b/config/Config-images.in
index dcd7575..832e672 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
@@ -286,6 +286,7 @@ menu "Target Images"
comment "Image Options"
 
source "target/linux/*/image/Config.in"
+   source "target/linux/feeds/*/image/Config.in"
 
config TARGET_KERNEL_PARTSIZE
int "Kernel partition size (in MiB)"
-- 
2.17.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] fix for sourcing target image config a when target is being replaced

2022-10-12 Thread Prasun Maiti
From: Prasun Maiti 

Sourcing of image/Config.in will not happen 
When a target is installed from target/linux/feeds/ 

Signed-off-by: Prasun Maiti 
---
 config/Config-images.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/config/Config-images.in b/config/Config-images.in
index dcd7575..832e672 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
@@ -286,6 +286,7 @@ menu "Target Images"
comment "Image Options"
 
source "target/linux/*/image/Config.in"
+   source "target/linux/feeds/*/image/Config.in"
 
config TARGET_KERNEL_PARTSIZE
int "Kernel partition size (in MiB)"
-- 
2.17.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Handle target path located under target/linux/feeds/

2022-05-30 Thread Prasun Maiti
When we are installing targets to target/linux/feeds,
BOARD is not located under target/linux/

So, we need to handle this scenario taking proper target path

Signed-off-by: Prasun Maiti 
---
 config/Config-images.in   | 1 +
 include/target.mk | 3 +++
 package/kernel/linux/Makefile | 4 ++--
 target/linux/Makefile | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/config/Config-images.in b/config/Config-images.in
index dcd7575..832e672 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
@@ -286,6 +286,7 @@ menu "Target Images"
comment "Image Options"
 
source "target/linux/*/image/Config.in"
+   source "target/linux/feeds/*/image/Config.in"
 
config TARGET_KERNEL_PARTSIZE
int "Kernel partition size (in MiB)"
diff --git a/include/target.mk b/include/target.mk
index f595de6..8917f71 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -70,6 +70,9 @@ endif
 target_conf=$(subst .,_,$(subst -,_,$(subst /,_,$(1
 ifeq ($(DUMP),)
   PLATFORM_DIR:=$(TOPDIR)/target/linux/$(BOARD)
+  ifeq ("$(wildcard $(PLATFORM_DIR))", "")
+PLATFORM_DIR:=$(TOPDIR)/target/linux/feeds/$(BOARD)
+  endif
   SUBTARGET:=$(strip $(foreach subdir,$(patsubst 
$(PLATFORM_DIR)/%/target.mk,%,$(wildcard $(PLATFORM_DIR)/*/target.mk)),$(if 
$(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(subdir))),$(subdir
 else
   PLATFORM_DIR:=${CURDIR}
diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile
index 9fa68d7..0cb2911 100644
--- a/package/kernel/linux/Makefile
+++ b/package/kernel/linux/Makefile
@@ -12,7 +12,7 @@ PKG_NAME:=kernel
 PKG_FLAGS:=hold
 
 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/packages
-SCAN_DEPS=modules/*.mk $(TOPDIR)/target/linux/*/modules.mk 
$(TOPDIR)/include/netfilter.mk
+SCAN_DEPS=modules/*.mk $(patsubst %/$(BOARD),%,$(PLATFORM_DIR))/*/modules.mk 
$(TOPDIR)/include/netfilter.mk
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=
@@ -63,4 +63,4 @@ endef
 $(eval $(if $(DUMP),,$(call BuildPackage,kernel)))
 
 include $(sort $(wildcard ./modules/*.mk))
--include $(TOPDIR)/target/linux/*/modules.mk
+-include $(patsubst %/$(BOARD),%,$(PLATFORM_DIR))/*/modules.mk
diff --git a/target/linux/Makefile b/target/linux/Makefile
index a939d42..a6ea788 100644
--- a/target/linux/Makefile
+++ b/target/linux/Makefile
@@ -8,4 +8,4 @@ include $(INCLUDE_DIR)/target.mk
 export TARGET_BUILD=1
 
 prereq clean download prepare compile install oldconfig menuconfig nconfig 
xconfig update refresh: FORCE
-   @+$(NO_TRACE_MAKE) -C $(BOARD) $@
+   @+$(NO_TRACE_MAKE) -C $(PLATFORM_DIR) $@
-- 
2.17.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Handle PLATFORM_DIR for target/linux/feeds/

2022-04-21 Thread Prasun Maiti
When we are installing targets to target/linux/feeds, BOARD is not available
under target/linux/.
Ref Commit: ebc36ebb2349ef5d492dd2bd5be962bac26bb19a

So, we need to handle this scenario by taking proper target path

Signed-off-by: Prasun Maiti 
---
 include/target.mk | 3 +++
 target/linux/Makefile | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/target.mk b/include/target.mk
index 64db3b0b..912f36d8 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -69,6 +69,9 @@ endif
 target_conf=$(subst .,_,$(subst -,_,$(subst /,_,$(1
 ifeq ($(DUMP),)
   PLATFORM_DIR:=$(TOPDIR)/target/linux/$(BOARD)
+  ifeq ("$(wildcard $(PLATFORM_DIR))", "")
+PLATFORM_DIR:=$(TOPDIR)/target/linux/feeds/$(BOARD)
+  endif
   SUBTARGET:=$(strip $(foreach subdir,$(patsubst 
$(PLATFORM_DIR)/%/target.mk,%,$(wildcard $(PLATFORM_DIR)/*/target.mk)),$(if 
$(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(subdir))),$(subdir
 else
   PLATFORM_DIR:=${CURDIR}
diff --git a/target/linux/Makefile b/target/linux/Makefile
index a939d42b..a6ea7886 100644
--- a/target/linux/Makefile
+++ b/target/linux/Makefile
@@ -8,4 +8,4 @@ include $(INCLUDE_DIR)/target.mk
 export TARGET_BUILD=1
 
 prereq clean download prepare compile install oldconfig menuconfig nconfig 
xconfig update refresh: FORCE
-   @+$(NO_TRACE_MAKE) -C $(BOARD) $@
+   @+$(NO_TRACE_MAKE) -C $(PLATFORM_DIR) $@
-- 
2.17.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Handle PLATFORM_DIR for target/linux/feeds/

2022-04-21 Thread Prasun Maiti
From: Prasun Maiti 

When we are installing targets to target/linux/feeds, BOARD is not available
under target/linux/.
Ref Commit: ebc36ebb2349ef5d492dd2bd5be962bac26bb19a

So, we need to handle this scenario by taking proper target path

Signed-off-by: Prasun Maiti 
---
 include/target.mk | 3 +++
 target/linux/Makefile | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/target.mk b/include/target.mk
index 64db3b0b..912f36d8 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -69,6 +69,9 @@ endif
 target_conf=$(subst .,_,$(subst -,_,$(subst /,_,$(1
 ifeq ($(DUMP),)
   PLATFORM_DIR:=$(TOPDIR)/target/linux/$(BOARD)
+  ifeq ("$(wildcard $(PLATFORM_DIR))", "")
+PLATFORM_DIR:=$(TOPDIR)/target/linux/feeds/$(BOARD)
+  endif
   SUBTARGET:=$(strip $(foreach subdir,$(patsubst 
$(PLATFORM_DIR)/%/target.mk,%,$(wildcard $(PLATFORM_DIR)/*/target.mk)),$(if 
$(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(subdir))),$(subdir
 else
   PLATFORM_DIR:=${CURDIR}
diff --git a/target/linux/Makefile b/target/linux/Makefile
index a939d42b..a6ea7886 100644
--- a/target/linux/Makefile
+++ b/target/linux/Makefile
@@ -8,4 +8,4 @@ include $(INCLUDE_DIR)/target.mk
 export TARGET_BUILD=1
 
 prereq clean download prepare compile install oldconfig menuconfig nconfig 
xconfig update refresh: FORCE
-   @+$(NO_TRACE_MAKE) -C $(BOARD) $@
+   @+$(NO_TRACE_MAKE) -C $(PLATFORM_DIR) $@
-- 
2.17.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel