[PATCH 5/8] staging: rtl8192e: rename function DOT11D_ScanComplete to dot11d_scan_complete - style
Rename function DOT11D_ScanComplete to dot11d_scan_complete to fix checkpatch warning: Avoid CamelCase. Signed-off-by: Himadri Pandya --- drivers/staging/rtl8192e/dot11d.c | 2 +- drivers/staging/rtl8192e/dot11d.h | 2 +- drivers/staging/rtl8192e/rtllib_softmac.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c index 5e5d1b4bf33f..3e66e01138db 100644 --- a/drivers/staging/rtl8192e/dot11d.c +++ b/drivers/staging/rtl8192e/dot11d.c @@ -158,7 +158,7 @@ void dot11d_update_country(struct rtllib_device *dev, u8 *pTaddr, dot11d_info->state = DOT11D_STATE_LEARNED; } -void DOT11D_ScanComplete(struct rtllib_device *dev) +void dot11d_scan_complete(struct rtllib_device *dev) { struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(dev); diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index 9f0c2634520b..b0b5115bd4e2 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -86,6 +86,6 @@ void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee); void dot11d_reset(struct rtllib_device *dev); void dot11d_update_country(struct rtllib_device *dev, u8 *pTaddr, u16 CoutryIeLen, u8 *pCoutryIe); -void DOT11D_ScanComplete(struct rtllib_device *dev); +void dot11d_scan_complete(struct rtllib_device *dev); #endif diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 9752fda840d4..ee275857868f 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -564,7 +564,7 @@ static void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh) if (ieee->state >= RTLLIB_LINKED) { if (IS_DOT11D_ENABLE(ieee)) - DOT11D_ScanComplete(ieee); + dot11d_scan_complete(ieee); } mutex_unlock(&ieee->scan_mutex); @@ -623,7 +623,7 @@ static void rtllib_softmac_scan_wq(void *data) out: if (IS_DOT11D_ENABLE(ieee)) - DOT11D_ScanComplete(ieee); + dot11d_scan_complete(ieee); ieee->current_network.channel = last_channel; out1: -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 7/8] staging: rtl8192e: rename parameters of function dot11d_update_country - style
Rename following parameters of function dot11d_update_country to fix checkpatch warning: Avoid CamelCase and make the parameter names more readable, understandable. pTaddr -> address CoutryIeLen -> country_len pCoutryIe -> country Signed-off-by: Himadri Pandya --- drivers/staging/rtl8192e/dot11d.c | 14 +++--- drivers/staging/rtl8192e/dot11d.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c index fdf6d951384c..68f53013cb95 100644 --- a/drivers/staging/rtl8192e/dot11d.c +++ b/drivers/staging/rtl8192e/dot11d.c @@ -114,8 +114,8 @@ void dot11d_reset(struct rtllib_device *ieee) RESET_CIE_WATCHDOG(ieee); } -void dot11d_update_country(struct rtllib_device *dev, u8 *pTaddr, - u16 CoutryIeLen, u8 *pCoutryIe) +void dot11d_update_country(struct rtllib_device *dev, u8 *address, + u16 country_len, u8 *country) { struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(dev); u8 i, j, number_of_triples, max_channel_number; @@ -124,8 +124,8 @@ void dot11d_update_country(struct rtllib_device *dev, u8 *pTaddr, memset(dot11d_info->channel_map, 0, MAX_CHANNEL_NUMBER + 1); memset(dot11d_info->max_tx_power_list, 0xFF, MAX_CHANNEL_NUMBER + 1); max_channel_number = 0; - number_of_triples = (CoutryIeLen - 3) / 3; - triple = (struct chnl_txpow_triple *)(pCoutryIe + 3); + number_of_triples = (country_len - 3) / 3; + triple = (struct chnl_txpow_triple *)(country + 3); for (i = 0; i < number_of_triples; i++) { if (max_channel_number >= triple->first_channel) { netdev_info(dev->dev, @@ -151,10 +151,10 @@ void dot11d_update_country(struct rtllib_device *dev, u8 *pTaddr, triple = (struct chnl_txpow_triple *)((u8 *)triple + 3); } - UPDATE_CIE_SRC(dev, pTaddr); + UPDATE_CIE_SRC(dev, address); - dot11d_info->country_len = CoutryIeLen; - memcpy(dot11d_info->country_buffer, pCoutryIe, CoutryIeLen); + dot11d_info->country_len = country_len; + memcpy(dot11d_info->country_buffer, country, country_len); dot11d_info->state = DOT11D_STATE_LEARNED; } diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index b0b5115bd4e2..cbf6337193d6 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -84,8 +84,8 @@ static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev) void dot11d_init(struct rtllib_device *dev); void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee); void dot11d_reset(struct rtllib_device *dev); -void dot11d_update_country(struct rtllib_device *dev, u8 *pTaddr, - u16 CoutryIeLen, u8 *pCoutryIe); +void dot11d_update_country(struct rtllib_device *dev, u8 *address, + u16 country_len, u8 *country); void dot11d_scan_complete(struct rtllib_device *dev); #endif -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 8/8] staging: rtl8192e: rename macro arguments to avoid camel case - style
Rename following macro arguments to fix checkpatch warning: Avoid Camelcase and make the arguments more readable, understandable. __pIeeeDev -> __ieee_dev __pTa -> __address Signed-off-by: Himadri Pandya --- drivers/staging/rtl8192e/dot11d.h | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index cbf6337193d6..0637de1cca47 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -58,28 +58,28 @@ static inline void copy_mac_addr(unsigned char *des, unsigned char *src) memcpy(des, src, 6); } -#define GET_DOT11D_INFO(__pIeeeDev)\ -((struct rt_dot11d_info *)((__pIeeeDev)->dot11d_info)) +#define GET_DOT11D_INFO(__ieee_dev)\ +((struct rt_dot11d_info *)((__ieee_dev)->dot11d_info)) -#define IS_DOT11D_ENABLE(__pIeeeDev) \ -(GET_DOT11D_INFO(__pIeeeDev)->enabled) -#define IS_COUNTRY_IE_VALID(__pIeeeDev)\ - (GET_DOT11D_INFO(__pIeeeDev)->country_len > 0) +#define IS_DOT11D_ENABLE(__ieee_dev) \ +(GET_DOT11D_INFO(__ieee_dev)->enabled) +#define IS_COUNTRY_IE_VALID(__ieee_dev)\ + (GET_DOT11D_INFO(__ieee_dev)->country_len > 0) -#define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa)\ +#define IS_EQUAL_CIE_SRC(__ieee_dev, __address)\ ether_addr_equal_unaligned( \ - GET_DOT11D_INFO(__pIeeeDev)->country_src_addr, __pTa) -#define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \ - copy_mac_addr(GET_DOT11D_INFO(__pIeeeDev)->country_src_addr, __pTa) + GET_DOT11D_INFO(__ieee_dev)->country_src_addr, __address) +#define UPDATE_CIE_SRC(__ieee_dev, __address) \ + copy_mac_addr(GET_DOT11D_INFO(__ieee_dev)->country_src_addr, __address) -#define GET_CIE_WATCHDOG(__pIeeeDev) \ -(GET_DOT11D_INFO(__pIeeeDev)->country_watchdog) -static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev) +#define GET_CIE_WATCHDOG(__ieee_dev) \ +(GET_DOT11D_INFO(__ieee_dev)->country_watchdog) +static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__ieee_dev) { - GET_CIE_WATCHDOG(__pIeeeDev) = 0; + GET_CIE_WATCHDOG(__ieee_dev) = 0; } -#define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev)) +#define UPDATE_CIE_WATCHDOG(__ieee_dev) (++GET_CIE_WATCHDOG(__ieee_dev)) void dot11d_init(struct rtllib_device *dev); void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee); -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/8] staging: rtl8192e: rename function Dot11d_Reset to dot11d_reset - style
Rename function Dot11d_Reset to dot11d_reset to fix checkpatch warning: Avoid CamelCase. Signed-off-by: Himadri Pandya --- drivers/staging/rtl8192e/dot11d.c | 4 ++-- drivers/staging/rtl8192e/dot11d.h | 2 +- drivers/staging/rtl8192e/rtllib_softmac.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c index 594476693159..90bc30a04a96 100644 --- a/drivers/staging/rtl8192e/dot11d.c +++ b/drivers/staging/rtl8192e/dot11d.c @@ -98,7 +98,7 @@ void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee) } EXPORT_SYMBOL(dot11d_channel_map); -void Dot11d_Reset(struct rtllib_device *ieee) +void dot11d_reset(struct rtllib_device *ieee) { struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(ieee); u32 i; @@ -167,7 +167,7 @@ void DOT11D_ScanComplete(struct rtllib_device *dev) dot11d_info->state = DOT11D_STATE_DONE; break; case DOT11D_STATE_DONE: - Dot11d_Reset(dev); + dot11d_reset(dev); break; case DOT11D_STATE_NONE: break; diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index eb3a513d6826..42661dc913fc 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -83,7 +83,7 @@ static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev) void dot11d_init(struct rtllib_device *dev); void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee); -void Dot11d_Reset(struct rtllib_device *dev); +void dot11d_reset(struct rtllib_device *dev); void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, u16 CoutryIeLen, u8 *pCoutryIe); void DOT11D_ScanComplete(struct rtllib_device *dev); diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index f1023e21fb5c..9752fda840d4 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2759,7 +2759,7 @@ void rtllib_disassociate(struct rtllib_device *ieee) if (ieee->data_hard_stop) ieee->data_hard_stop(ieee->dev); if (IS_DOT11D_ENABLE(ieee)) - Dot11d_Reset(ieee); + dot11d_reset(ieee); ieee->state = RTLLIB_NOLINK; ieee->is_set_key = false; ieee->wap_set = 0; -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/8] staging: rtl8192e: rename function cpMacAddr to copy_mac_addr - style
Rename function cpMacAddr to copy_mac_addr in order to fix checkpatch warning:Avoid CamelCase and make the function name more readable, understandable. Signed-off-by: Himadri Pandya --- drivers/staging/rtl8192e/dot11d.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index 0394bb1c552e..afa95bf4e6ef 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -53,7 +53,7 @@ struct rt_dot11d_info { enum dot11d_state state; }; -static inline void cpMacAddr(unsigned char *des, unsigned char *src) +static inline void copy_mac_addr(unsigned char *des, unsigned char *src) { memcpy(des, src, 6); } @@ -70,7 +70,7 @@ static inline void cpMacAddr(unsigned char *des, unsigned char *src) ether_addr_equal_unaligned( \ GET_DOT11D_INFO(__pIeeeDev)->country_src_addr, __pTa) #define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \ - cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->country_src_addr, __pTa) + copy_mac_addr(GET_DOT11D_INFO(__pIeeeDev)->country_src_addr, __pTa) #define GET_CIE_WATCHDOG(__pIeeeDev) \ (GET_DOT11D_INFO(__pIeeeDev)->country_watchdog) -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/8] staging: rtl8192e: rename function Dot11d_Channelmap to dot11d_channel_map - style
Rename function Dot11d_Channelmap to dot11d_channel_map to fix checkpatch warning: Avoid CamelCase. Signed-off-by: Himadri Pandya --- drivers/staging/rtl8192e/dot11d.c| 4 ++-- drivers/staging/rtl8192e/dot11d.h| 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c index 6c26af3f377f..594476693159 100644 --- a/drivers/staging/rtl8192e/dot11d.c +++ b/drivers/staging/rtl8192e/dot11d.c @@ -56,7 +56,7 @@ void dot11d_init(struct rtllib_device *ieee) } EXPORT_SYMBOL(dot11d_init); -void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee) +void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee) { int i, max_chan = 14, min_chan = 1; @@ -96,7 +96,7 @@ void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee) break; } } -EXPORT_SYMBOL(Dot11d_Channelmap); +EXPORT_SYMBOL(dot11d_channel_map); void Dot11d_Reset(struct rtllib_device *ieee) { diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index afa95bf4e6ef..eb3a513d6826 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -82,7 +82,7 @@ static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev) #define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev)) void dot11d_init(struct rtllib_device *dev); -void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee); +void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee); void Dot11d_Reset(struct rtllib_device *dev); void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, u16 CoutryIeLen, u8 *pCoutryIe); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 7031f6833b8b..c145b689175c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1049,7 +1049,7 @@ static short _rtl92e_get_channel_map(struct net_device *dev) } RT_TRACE(COMP_INIT, "Channel plan is %d\n", priv->ChannelPlan); dot11d_init(priv->rtllib); - Dot11d_Channelmap(priv->ChannelPlan, priv->rtllib); + dot11d_channel_map(priv->ChannelPlan, priv->rtllib); for (i = 1; i <= 11; i++) (priv->rtllib->active_channel_map)[i] = 1; (priv->rtllib->active_channel_map)[12] = 2; -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/8] staging: rtl8192e: rename local variables of function dot11d_update_country - style
Rename following local variables of function dot11d_update_country to fix checkpatch warning: Avoid CamelCase and make the variable names more readable, understandable. NumTriples -> number_of_triples MaxChnlNum -> max_channel_number pTriple -> triple Signed-off-by: Himadri Pandya --- drivers/staging/rtl8192e/dot11d.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c index 3e66e01138db..fdf6d951384c 100644 --- a/drivers/staging/rtl8192e/dot11d.c +++ b/drivers/staging/rtl8192e/dot11d.c @@ -118,37 +118,37 @@ void dot11d_update_country(struct rtllib_device *dev, u8 *pTaddr, u16 CoutryIeLen, u8 *pCoutryIe) { struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(dev); - u8 i, j, NumTriples, MaxChnlNum; - struct chnl_txpow_triple *pTriple; + u8 i, j, number_of_triples, max_channel_number; + struct chnl_txpow_triple *triple; memset(dot11d_info->channel_map, 0, MAX_CHANNEL_NUMBER + 1); memset(dot11d_info->max_tx_power_list, 0xFF, MAX_CHANNEL_NUMBER + 1); - MaxChnlNum = 0; - NumTriples = (CoutryIeLen - 3) / 3; - pTriple = (struct chnl_txpow_triple *)(pCoutryIe + 3); - for (i = 0; i < NumTriples; i++) { - if (MaxChnlNum >= pTriple->first_channel) { + max_channel_number = 0; + number_of_triples = (CoutryIeLen - 3) / 3; + triple = (struct chnl_txpow_triple *)(pCoutryIe + 3); + for (i = 0; i < number_of_triples; i++) { + if (max_channel_number >= triple->first_channel) { netdev_info(dev->dev, "%s: Invalid country IE, skip it..1\n", __func__); return; } - if (MAX_CHANNEL_NUMBER < (pTriple->first_channel + - pTriple->num_channels)) { + if (MAX_CHANNEL_NUMBER < (triple->first_channel + + triple->num_channels)) { netdev_info(dev->dev, "%s: Invalid country IE, skip it..2\n", __func__); return; } - for (j = 0; j < pTriple->num_channels; j++) { - dot11d_info->channel_map[pTriple->first_channel + j] = 1; - dot11d_info->max_tx_power_list[pTriple->first_channel + j] = -pTriple->max_tx_power; - MaxChnlNum = pTriple->first_channel + j; + for (j = 0; j < triple->num_channels; j++) { + dot11d_info->channel_map[triple->first_channel + j] = 1; + dot11d_info->max_tx_power_list[triple->first_channel + j] = +triple->max_tx_power; + max_channel_number = triple->first_channel + j; } - pTriple = (struct chnl_txpow_triple *)((u8 *)pTriple + 3); + triple = (struct chnl_txpow_triple *)((u8 *)triple + 3); } UPDATE_CIE_SRC(dev, pTaddr); -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/8] staging: rtl8192e: rename function Dot11d_UpdateCountryIe to dot11d_update_country - style
Rename function Dot11d_UpdateCountryIe to dot11d_update_country to fix checkpatch warning: Avoid CamelCase. Signed-off-by: Himadri Pandya --- drivers/staging/rtl8192e/dot11d.c| 2 +- drivers/staging/rtl8192e/dot11d.h| 2 +- drivers/staging/rtl8192e/rtllib_rx.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c index 90bc30a04a96..5e5d1b4bf33f 100644 --- a/drivers/staging/rtl8192e/dot11d.c +++ b/drivers/staging/rtl8192e/dot11d.c @@ -114,7 +114,7 @@ void dot11d_reset(struct rtllib_device *ieee) RESET_CIE_WATCHDOG(ieee); } -void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, +void dot11d_update_country(struct rtllib_device *dev, u8 *pTaddr, u16 CoutryIeLen, u8 *pCoutryIe) { struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(dev); diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index 42661dc913fc..9f0c2634520b 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -84,7 +84,7 @@ static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev) void dot11d_init(struct rtllib_device *dev); void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee); void dot11d_reset(struct rtllib_device *dev); -void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, +void dot11d_update_country(struct rtllib_device *dev, u8 *pTaddr, u16 CoutryIeLen, u8 *pCoutryIe); void DOT11D_ScanComplete(struct rtllib_device *dev); diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 501ded929329..debc2e40af00 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1812,7 +1812,7 @@ static inline void rtllib_extract_country_ie( netdev_info(ieee->dev, "Received beacon ContryIE, SSID: <%s>\n", network->ssid); - Dot11d_UpdateCountryIe(ieee, addr2, + dot11d_update_country(ieee, addr2, info_element->len, info_element->data); } -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: mt7621-pci: update driver's TODO file
Some of the things included in driver's TODO file have been properly achieved. Update file accordly. Signed-off-by: Sergio Paracuellos --- Hi Neil, I've been looking through the code of this driver and pci-phy driver while thinking in what is missing already to get this mainlined out of staging. I don't really know what cleanups are missing here. The only thinkg is not clear yet is the thing with the clocks defined in device-tree. Should be just remove them and give this stuff a try to get feedback or what is missing? Can you please point me out in the right direction? Thanks in advance for your time. Best regards, Sergio Paracuellos drivers/staging/mt7621-pci/TODO | 8 1 file changed, 8 deletions(-) diff --git a/drivers/staging/mt7621-pci/TODO b/drivers/staging/mt7621-pci/TODO index cf30f629b9fd..ccfd266db4ca 100644 --- a/drivers/staging/mt7621-pci/TODO +++ b/drivers/staging/mt7621-pci/TODO @@ -1,12 +1,4 @@ - general code review and cleanup -- can this be converted to not require PCI_DRIVERS_LEGACY ?? -The irq returned by pcibios_map_irq is a "hwirq" (hardware irq number) -and pci_assign_irq() assigns this directly to dev->irq, which -expects a "virq" (virtual irq number). These numbers are different -on MIPS. There is a gross hack to make it work on one -specific platform, so it can be tested. -- Should this be merged with arch/mips/pci/pci-mt7620.c ?? -- ensure device-tree requirements are documented Cc: NeilBrown -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 04/16] net: dsa: Add setter for SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS
In preparation for removing SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT, add support for a function that processes the SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS attribute and returns not supported for any flag set, since DSA does not currently support toggling those bridge port attributes (yet). Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- net/dsa/dsa_priv.h | 3 +++ net/dsa/port.c | 10 ++ net/dsa/slave.c| 4 3 files changed, 17 insertions(+) diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 1f4972dab9f2..97594f0b6efb 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -150,6 +150,9 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering, struct switchdev_trans *trans); int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock, struct switchdev_trans *trans); +int dsa_port_bridge_port_flags_set(struct dsa_port *dp, + unsigned long brport_flags, + struct switchdev_trans *trans); int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr, u16 vid); int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr, diff --git a/net/dsa/port.c b/net/dsa/port.c index 2d7e01b23572..2ce3752203cf 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -177,6 +177,16 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock, return dsa_port_notify(dp, DSA_NOTIFIER_AGEING_TIME, &info); } +int dsa_port_bridge_port_flags_set(struct dsa_port *dp, + unsigned long brport_flags, + struct switchdev_trans *trans) +{ + if (brport_flags) + return -EOPNOTSUPP; + + return 0; +} + int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr, u16 vid) { diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 2e5e7c04821b..9b499ba88aa7 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -295,6 +295,10 @@ static int dsa_slave_port_attr_set(struct net_device *dev, case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME: ret = dsa_port_ageing_time(dp, attr->u.ageing_time, trans); break; + case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS: + ret = dsa_port_bridge_port_flags_set(dp, attr->u.brport_flags, +trans); + break; default: ret = -EOPNOTSUPP; break; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 00/16] net: Remove switchdev_ops
Hi all, This patch series finishes by the removal of switchdev_ops. To get there we need to do a few things: - get rid of the one and only call to switchdev_port_attr_get() which is used to fetch the device's bridge port flags capabilities, instead we can just check what flags are being programmed during the prepare phase - once we get rid of getting switchdev port attributes we convert the setting of such attributes using a blocking notifier And then remove switchdev_ops completely. Please review and let me know what you think! Changes in v2: - fixed bisectability issues in patch #15 - added Acked-by from Jiri where necessary - fixed a few minor issues according to Jiri's feedback: - rename port_attr_event -> port_attr_set_event - moved SWITCHDEV_PORT_ATTR_SET closer to other blocking events Florian Fainelli (16): Documentation: networking: switchdev: Update port parent ID section mlxsw: spectrum: Check bridge flags during prepare phase staging: fsl-dpaa2: ethsw: Check bridge port flags during set net: dsa: Add setter for SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS rocker: Check bridge flags during prepare phase net: bridge: Stop calling switchdev_port_attr_get() net: Remove SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT net: Get rid of switchdev_port_attr_get() switchdev: Add SWITCHDEV_PORT_ATTR_SET rocker: Handle SWITCHDEV_PORT_ATTR_SET net: dsa: Handle SWITCHDEV_PORT_ATTR_SET mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_SET net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_SET staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_SET net: switchdev: Replace port attr set SDO with a notification net: Remove switchdev_ops Documentation/networking/switchdev.txt| 15 ++- .../net/ethernet/mellanox/mlxsw/spectrum.c| 12 --- .../net/ethernet/mellanox/mlxsw/spectrum.h| 2 - .../mellanox/mlxsw/spectrum_switchdev.c | 69 -- drivers/net/ethernet/mscc/ocelot.c| 21 +++- drivers/net/ethernet/rocker/rocker_main.c | 95 --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 48 -- include/linux/netdevice.h | 3 - include/net/switchdev.h | 36 ++- net/bridge/br_switchdev.c | 20 +--- net/dsa/dsa_priv.h| 3 + net/dsa/port.c| 10 ++ net/dsa/slave.c | 40 net/switchdev/switchdev.c | 92 +- 14 files changed, 170 insertions(+), 296 deletions(-) -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 15/16] net: switchdev: Replace port attr set SDO with a notification
Drop switchdev_ops.switchdev_port_attr_set. Drop the uses of this field from all clients, which were migrated to use switchdev notification in the previous patches. Add a new function switchdev_port_attr_notify() that sends the switchdev notifications SWITCHDEV_PORT_ATTR_SET. Drop __switchdev_port_attr_set() and update switchdev_port_attr_set() likewise. Signed-off-by: Florian Fainelli --- net/switchdev/switchdev.c | 92 ++- 1 file changed, 22 insertions(+), 70 deletions(-) diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 7e1357db33d7..fab96d978924 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -174,81 +174,31 @@ static int switchdev_deferred_enqueue(struct net_device *dev, return 0; } -/** - * switchdev_port_attr_get - Get port attribute - * - * @dev: port device - * @attr: attribute to get - */ -int switchdev_port_attr_get(struct net_device *dev, struct switchdev_attr *attr) +static int switchdev_port_attr_notify(enum switchdev_notifier_type nt, + struct net_device *dev, + const struct switchdev_attr *attr, + struct switchdev_trans *trans) { - const struct switchdev_ops *ops = dev->switchdev_ops; - struct net_device *lower_dev; - struct list_head *iter; - struct switchdev_attr first = { - .id = SWITCHDEV_ATTR_ID_UNDEFINED - }; - int err = -EOPNOTSUPP; + int err; + int rc; - if (ops && ops->switchdev_port_attr_get) - return ops->switchdev_port_attr_get(dev, attr); + struct switchdev_notifier_port_attr_info attr_info = { + .attr = attr, + .trans = trans, + .handled = false, + }; - if (attr->flags & SWITCHDEV_F_NO_RECURSE) + rc = call_switchdev_blocking_notifiers(nt, dev, &attr_info.info, NULL); + err = notifier_to_errno(rc); + if (err) { + WARN_ON(!attr_info.handled); return err; - - /* Switch device port(s) may be stacked under -* bond/team/vlan dev, so recurse down to get attr on -* each port. Return -ENODATA if attr values don't -* compare across ports. -*/ - - netdev_for_each_lower_dev(dev, lower_dev, iter) { - err = switchdev_port_attr_get(lower_dev, attr); - if (err) - break; - if (first.id == SWITCHDEV_ATTR_ID_UNDEFINED) - first = *attr; - else if (memcmp(&first, attr, sizeof(*attr))) - return -ENODATA; } - return err; -} -EXPORT_SYMBOL_GPL(switchdev_port_attr_get); - -static int __switchdev_port_attr_set(struct net_device *dev, -const struct switchdev_attr *attr, -struct switchdev_trans *trans) -{ - const struct switchdev_ops *ops = dev->switchdev_ops; - struct net_device *lower_dev; - struct list_head *iter; - int err = -EOPNOTSUPP; - - if (ops && ops->switchdev_port_attr_set) { - err = ops->switchdev_port_attr_set(dev, attr, trans); - goto done; - } - - if (attr->flags & SWITCHDEV_F_NO_RECURSE) - goto done; - - /* Switch device port(s) may be stacked under -* bond/team/vlan dev, so recurse down to set attr on -* each port. -*/ - - netdev_for_each_lower_dev(dev, lower_dev, iter) { - err = __switchdev_port_attr_set(lower_dev, attr, trans); - if (err) - break; - } - -done: - if (err == -EOPNOTSUPP && attr->flags & SWITCHDEV_F_SKIP_EOPNOTSUPP) - err = 0; + if (!attr_info.handled) + return -EOPNOTSUPP; - return err; + return 0; } static int switchdev_port_attr_set_now(struct net_device *dev, @@ -267,7 +217,8 @@ static int switchdev_port_attr_set_now(struct net_device *dev, */ trans.ph_prepare = true; - err = __switchdev_port_attr_set(dev, attr, &trans); + err = switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_SET, dev, attr, +&trans); if (err) { /* Prepare phase failed: abort the transaction. Any * resources reserved in the prepare phase are @@ -286,7 +237,8 @@ static int switchdev_port_attr_set_now(struct net_device *dev, */ trans.ph_prepare = false; - err = __switchdev_port_attr_set(dev, attr, &trans); + err = switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_SET, dev, attr, +&trans); WARN(err, "%s: Commit of attribute (id=%d) failed.\n", dev->name, attr->id); switchdev_trans_items_warn_destroy(dev, &
[PATCH net-next v2 11/16] net: dsa: Handle SWITCHDEV_PORT_ATTR_SET
Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare DSA to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_SET and simply translate that into the existing dsa_slave_port_attr_set() call. Signed-off-by: Florian Fainelli --- net/dsa/slave.c | 16 1 file changed, 16 insertions(+) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index d8eb33979368..ee4b94c5e68e 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1547,6 +1547,20 @@ dsa_slave_switchdev_port_obj_event(unsigned long event, return notifier_from_errno(err); } +static int +dsa_slave_switchdev_port_attr_set_event(unsigned long event, + struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err; + + err = dsa_slave_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1559,6 +1573,8 @@ static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: /* fall through */ case SWITCHDEV_PORT_OBJ_DEL: return dsa_slave_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: + return dsa_slave_switchdev_port_attr_set_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 08/16] net: Get rid of switchdev_port_attr_get()
With the bridge no longer calling switchdev_port_attr_get() to obtain the supported bridge port flags from a driver but instead trying to set the bridge port flags directly and relying on driver to reject unsupported configurations, we can effectively get rid of switchdev_port_attr_get() entirely since this was the only place where it was called. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- Documentation/networking/switchdev.txt| 5 ++- .../mellanox/mlxsw/spectrum_switchdev.c | 32 --- drivers/net/ethernet/rocker/rocker_main.c | 30 - drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 19 --- include/net/switchdev.h | 8 - net/dsa/slave.c | 7 6 files changed, 2 insertions(+), 99 deletions(-) diff --git a/Documentation/networking/switchdev.txt b/Documentation/networking/switchdev.txt index ea90243340a9..327afe754230 100644 --- a/Documentation/networking/switchdev.txt +++ b/Documentation/networking/switchdev.txt @@ -233,9 +233,8 @@ the bridge's FDB. It's possible, but not optimal, to enable learning on the device port and on the bridge port, and disable learning_sync. To support learning and learning_sync port attributes, the driver implements -switchdev op switchdev_port_attr_get/set for -SWITCHDEV_ATTR_PORT_ID_BRIDGE_FLAGS. The driver should initialize the attributes -to the hardware defaults. +switchdev op switchdev_port_attr_set for SWITCHDEV_ATTR_PORT_ID_BRIDGE_FLAGS. +The driver should initialize the attributes to the hardware defaults. FDB Ageing ^^ diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 8242a373f6e7..6b09d68671cf 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -431,37 +431,6 @@ static void mlxsw_sp_bridge_vlan_put(struct mlxsw_sp_bridge_vlan *bridge_vlan) mlxsw_sp_bridge_vlan_destroy(bridge_vlan); } -static void mlxsw_sp_port_bridge_flags_get(struct mlxsw_sp_bridge *bridge, - struct net_device *dev, - unsigned long *brport_flags) -{ - struct mlxsw_sp_bridge_port *bridge_port; - - bridge_port = mlxsw_sp_bridge_port_find(bridge, dev); - if (WARN_ON(!bridge_port)) - return; - - memcpy(brport_flags, &bridge_port->flags, sizeof(*brport_flags)); -} - -static int mlxsw_sp_port_attr_get(struct net_device *dev, - struct switchdev_attr *attr) -{ - struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); - struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; - - switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS: - mlxsw_sp_port_bridge_flags_get(mlxsw_sp->bridge, attr->orig_dev, - &attr->u.brport_flags); - break; - default: - return -EOPNOTSUPP; - } - - return 0; -} - static int mlxsw_sp_port_bridge_vlan_stp_set(struct mlxsw_sp_port *mlxsw_sp_port, struct mlxsw_sp_bridge_vlan *bridge_vlan, @@ -1957,7 +1926,6 @@ static struct mlxsw_sp_port *mlxsw_sp_lag_rep_port(struct mlxsw_sp *mlxsw_sp, } static const struct switchdev_ops mlxsw_sp_port_switchdev_ops = { - .switchdev_port_attr_get= mlxsw_sp_port_attr_get, .switchdev_port_attr_set= mlxsw_sp_port_attr_set, }; diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 375c4c908bea..ff3f14504f4f 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -1606,17 +1606,6 @@ rocker_world_port_attr_bridge_flags_set(struct rocker_port *rocker_port, trans); } -static int -rocker_world_port_attr_bridge_flags_get(const struct rocker_port *rocker_port, - unsigned long *p_brport_flags) -{ - struct rocker_world_ops *wops = rocker_port->rocker->wops; - - if (!wops->port_attr_bridge_flags_get) - return -EOPNOTSUPP; - return wops->port_attr_bridge_flags_get(rocker_port, p_brport_flags); -} - static int rocker_world_port_attr_bridge_ageing_time_set(struct rocker_port *rocker_port, u32 ageing_time, @@ -2064,24 +2053,6 @@ static const struct net_device_ops rocker_port_netdev_ops = { * swdev interface / -static int rocker_port_attr_get(struct net_device *dev, - struct switchdev_attr *attr) -{ - const struct rocker_port *rocker_port = netdev_priv(dev); - int err = 0; - - switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLA
[PATCH net-next v2 06/16] net: bridge: Stop calling switchdev_port_attr_get()
Now that all switchdev drivers have been converted to checking the bridge port flags during the prepare phase of the switchdev_port_attr_set(), we can move straight to trying to set the desired flag through SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- net/bridge/br_switchdev.c | 20 +++- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index db9e8ab96d48..939f300522c5 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c @@ -64,29 +64,15 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p, { struct switchdev_attr attr = { .orig_dev = p->dev, - .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT, + .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS, + .flags = SWITCHDEV_F_DEFER, + .u.brport_flags = flags, }; int err; if (mask & ~BR_PORT_FLAGS_HW_OFFLOAD) return 0; - err = switchdev_port_attr_get(p->dev, &attr); - if (err == -EOPNOTSUPP) - return 0; - if (err) - return err; - - /* Check if specific bridge flag attribute offload is supported */ - if (!(attr.u.brport_flags_support & mask)) { - br_warn(p->br, "bridge flag offload is not supported %u(%s)\n", - (unsigned int)p->port_no, p->dev->name); - return -EOPNOTSUPP; - } - - attr.id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS; - attr.flags = SWITCHDEV_F_DEFER; - attr.u.brport_flags = flags; err = switchdev_port_attr_set(p->dev, &attr); if (err) { br_warn(p->br, "error setting offload flag on port %u(%s)\n", -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 14/16] staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_SET
Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare ethsw to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_SET and simply translate that into the existing swdev_port_attr_set() call. Signed-off-by: Florian Fainelli --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index b195b09e0d1d..8baa503d9a6a 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -1092,6 +1092,20 @@ ethsw_switchdev_port_obj_event(unsigned long event, struct net_device *netdev, return notifier_from_errno(err); } +static int +ethsw_switchdev_port_attr_set_event(unsigned long event, + struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err; + + err = swdev_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int port_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1104,6 +1118,8 @@ static int port_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: /* fall through */ case SWITCHDEV_PORT_OBJ_DEL: return ethsw_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: + return ethsw_switchdev_port_attr_set_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 12/16] mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_SET
Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare mlxsw to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_SET and simply translate that into the existing mlxsw_sp_port_attr_set() call. Signed-off-by: Florian Fainelli --- .../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 6b09d68671cf..39a99db040bd 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -3410,6 +3410,20 @@ mlxsw_sp_switchdev_handle_vxlan_obj_del(struct net_device *vxlan_dev, } } +static int +mlxsw_sp_switchdev_port_attr_set_event(unsigned long event, + struct net_device *dev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err; + + err = mlxsw_sp_port_attr_set(dev, port_attr_info->attr, +port_attr_info->trans); + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int mlxsw_sp_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -3433,6 +3447,8 @@ static int mlxsw_sp_switchdev_blocking_event(struct notifier_block *unused, mlxsw_sp_port_dev_check, mlxsw_sp_port_obj_del); return notifier_from_errno(err); + case SWITCHDEV_PORT_ATTR_SET: + return mlxsw_sp_switchdev_port_attr_set_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 10/16] rocker: Handle SWITCHDEV_PORT_ATTR_SET
Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare rocker to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_SET and simply translate that into the existing rocker_port_attr_set call. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/rocker/rocker_main.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index ff3f14504f4f..b94f940dc7b5 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -2811,6 +2811,20 @@ rocker_switchdev_port_obj_event(unsigned long event, struct net_device *netdev, return notifier_from_errno(err); } +static int +rocker_switchdev_port_attr_set_event(unsigned long event, struct net_device *netdev, +struct switchdev_notifier_port_attr_info +*port_attr_info) +{ + int err; + + err = rocker_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int rocker_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -2823,6 +2837,8 @@ static int rocker_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: case SWITCHDEV_PORT_OBJ_DEL: return rocker_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: + return rocker_switchdev_port_attr_set_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 07/16] net: Remove SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT
Now that we have converted the bridge code and the drivers to check for bridge port(s) flags at the time we try to set them, there is no need for a get() -> set() sequence anymore and SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT therefore becomes unused. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- .../net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 4 drivers/net/ethernet/rocker/rocker_main.c | 4 drivers/staging/fsl-dpaa2/ethsw/ethsw.c| 3 --- include/net/switchdev.h| 2 -- net/dsa/slave.c| 10 +- 5 files changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 468a6d513074..8242a373f6e7 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -455,10 +455,6 @@ static int mlxsw_sp_port_attr_get(struct net_device *dev, mlxsw_sp_port_bridge_flags_get(mlxsw_sp->bridge, attr->orig_dev, &attr->u.brport_flags); break; - case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT: - attr->u.brport_flags_support = BR_LEARNING | BR_FLOOD | - BR_MCAST_FLOOD; - break; default: return -EOPNOTSUPP; } diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 8657313b6f30..375c4c908bea 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -2075,10 +2075,6 @@ static int rocker_port_attr_get(struct net_device *dev, err = rocker_world_port_attr_bridge_flags_get(rocker_port, &attr->u.brport_flags); break; - case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT: - err = rocker_world_port_attr_bridge_flags_support_get(rocker_port, - &attr->u.brport_flags_support); - break; default: return -EOPNOTSUPP; } diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index 6228c4375835..79635d1091df 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -651,9 +651,6 @@ static int swdev_port_attr_get(struct net_device *netdev, (port_priv->ethsw_data->learning ? BR_LEARNING : 0) | (port_priv->flood ? BR_FLOOD : 0); break; - case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT: - attr->u.brport_flags_support = BR_LEARNING | BR_FLOOD; - break; default: return -EOPNOTSUPP; } diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 5e87b54c5dc5..e2083824e577 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -45,7 +45,6 @@ enum switchdev_attr_id { SWITCHDEV_ATTR_ID_UNDEFINED, SWITCHDEV_ATTR_ID_PORT_STP_STATE, SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS, - SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT, SWITCHDEV_ATTR_ID_PORT_MROUTER, SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME, SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING, @@ -62,7 +61,6 @@ struct switchdev_attr { union { u8 stp_state; /* PORT_STP_STATE */ unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */ - unsigned long brport_flags_support; /* PORT_BRIDGE_FLAGS_SUPPORT */ bool mrouter; /* PORT_MROUTER */ clock_t ageing_time;/* BRIDGE_AGEING_TIME */ bool vlan_filtering;/* BRIDGE_VLAN_FILTERING */ diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 9b499ba88aa7..7b33be6f1954 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -385,15 +385,7 @@ static int dsa_slave_get_port_parent_id(struct net_device *dev, static int dsa_slave_port_attr_get(struct net_device *dev, struct switchdev_attr *attr) { - switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT: - attr->u.brport_flags_support = 0; - break; - default: - return -EOPNOTSUPP; - } - - return 0; + return -EOPNOTSUPP; } static inline netdev_tx_t dsa_slave_netpoll_send_skb(struct net_device *dev, -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 03/16] staging: fsl-dpaa2: ethsw: Check bridge port flags during set
In preparation for removing SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT, have ethsw check that the bridge port flags that are being set are supported. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index e559f4c25cf7..6228c4375835 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -680,8 +680,11 @@ static int port_attr_br_flags_set(struct net_device *netdev, struct ethsw_port_priv *port_priv = netdev_priv(netdev); int err = 0; - if (switchdev_trans_ph_prepare(trans)) + if (switchdev_trans_ph_prepare(trans)) { + if (flags & ~(BR_LEARNING | BR_FLOOD)) + return -EOPNOTSUPP; return 0; + } /* Learning is enabled per switch */ err = ethsw_set_learning(port_priv->ethsw_data, flags & BR_LEARNING); -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 01/16] Documentation: networking: switchdev: Update port parent ID section
Update the section about switchdev drivers having to implement a switchdev_port_attr_get() function to return SWITCHDEV_ATTR_ID_PORT_PARENT_ID since that is no longer valid after commit bccb30254a4a ("net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID"). Fixes: bccb30254a4a ("net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID") Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- Documentation/networking/switchdev.txt | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/networking/switchdev.txt b/Documentation/networking/switchdev.txt index f3244d87512a..ea90243340a9 100644 --- a/Documentation/networking/switchdev.txt +++ b/Documentation/networking/switchdev.txt @@ -92,11 +92,11 @@ device. Switch ID ^ -The switchdev driver must implement the switchdev op switchdev_port_attr_get -for SWITCHDEV_ATTR_ID_PORT_PARENT_ID for each port netdev, returning the same -physical ID for each port of a switch. The ID must be unique between switches -on the same system. The ID does not need to be unique between switches on -different systems. +The switchdev driver must implement the net_device operation +ndo_get_port_parent_id for each port netdev, returning the same physical ID for +each port of a switch. The ID must be unique between switches on the same +system. The ID does not need to be unique between switches on different +systems. The switch ID is used to locate ports on a switch and to know if aggregated ports belong to the same switch. -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 02/16] mlxsw: spectrum: Check bridge flags during prepare phase
In preparation for getting rid of switchdev_port_attr_get(), have mlxsw check for the bridge flags being set through switchdev_port_attr_set() with the SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS attribute identifier. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 95e37de3e48f..468a6d513074 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -623,8 +623,11 @@ static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port, struct mlxsw_sp_bridge_port *bridge_port; int err; - if (switchdev_trans_ph_prepare(trans)) + if (switchdev_trans_ph_prepare(trans)) { + if (brport_flags & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD)) + return -EOPNOTSUPP; return 0; + } bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp_port->mlxsw_sp->bridge, orig_dev); -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 09/16] switchdev: Add SWITCHDEV_PORT_ATTR_SET
In preparation for allowing switchdev enabled drivers to veto specific attribute settings from within the context of the caller, introduce a new switchdev notifier type for port attributes. Suggested-by: Ido Schimmel Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- include/net/switchdev.h | 8 1 file changed, 8 insertions(+) diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 96cd3e795f7f..7bc6a004d32a 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -135,6 +135,7 @@ enum switchdev_notifier_type { SWITCHDEV_PORT_OBJ_ADD, /* Blocking. */ SWITCHDEV_PORT_OBJ_DEL, /* Blocking. */ + SWITCHDEV_PORT_ATTR_SET, /* Blocking. */ SWITCHDEV_VXLAN_FDB_ADD_TO_BRIDGE, SWITCHDEV_VXLAN_FDB_DEL_TO_BRIDGE, @@ -163,6 +164,13 @@ struct switchdev_notifier_port_obj_info { bool handled; }; +struct switchdev_notifier_port_attr_info { + struct switchdev_notifier_info info; /* must be first */ + const struct switchdev_attr *attr; + struct switchdev_trans *trans; + bool handled; +}; + static inline struct net_device * switchdev_notifier_info_to_dev(const struct switchdev_notifier_info *info) { -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 13/16] net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_SET
Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare ocelot to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_SET and simply translate that into the existing ocelot_port_attr_set() call. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/mscc/ocelot.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 195306d05bcd..1dda4dd4c073 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1582,6 +1582,20 @@ struct notifier_block ocelot_netdevice_nb __read_mostly = { }; EXPORT_SYMBOL(ocelot_netdevice_nb); +static int +ocelot_switchdev_port_attr_set_event(unsigned long event, + struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err; + + err = ocelot_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int ocelot_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1600,6 +1614,8 @@ static int ocelot_switchdev_blocking_event(struct notifier_block *unused, ocelot_netdevice_dev_check, ocelot_port_obj_del); return notifier_from_errno(err); + case SWITCHDEV_PORT_ATTR_SET: + return ocelot_switchdev_port_attr_set_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2 16/16] net: Remove switchdev_ops
Now that we have converted all possible callers to using a switchdev notifier for attributes we do not have a need for implementing switchdev_ops anymore, and this can be removed from all drivers the net_device structure. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 12 drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 -- .../mellanox/mlxsw/spectrum_switchdev.c| 12 drivers/net/ethernet/mscc/ocelot.c | 5 - drivers/net/ethernet/rocker/rocker_main.c | 5 - drivers/staging/fsl-dpaa2/ethsw/ethsw.c| 5 - include/linux/netdevice.h | 3 --- include/net/switchdev.h| 18 -- net/dsa/slave.c| 5 - 9 files changed, 67 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 7c9745cecbbd..619965abab43 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -3220,7 +3220,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, } mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan; - mlxsw_sp_port_switchdev_init(mlxsw_sp_port); mlxsw_sp->ports[local_port] = mlxsw_sp_port; err = register_netdev(dev); if (err) { @@ -3237,7 +3236,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, err_register_netdev: mlxsw_sp->ports[local_port] = NULL; - mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan); err_port_vlan_create: err_port_pvid_set: @@ -3280,7 +3278,6 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port) mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp); unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */ mlxsw_sp->ports[local_port] = NULL; - mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true); mlxsw_sp_port_nve_fini(mlxsw_sp_port); mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port); @@ -4001,12 +3998,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, goto err_span_init; } - err = mlxsw_sp_switchdev_init(mlxsw_sp); - if (err) { - dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize switchdev\n"); - goto err_switchdev_init; - } - err = mlxsw_sp_counter_pool_init(mlxsw_sp); if (err) { dev_err(mlxsw_sp->bus_info->dev, "Failed to init counter pool\n"); @@ -4077,8 +4068,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, err_afa_init: mlxsw_sp_counter_pool_fini(mlxsw_sp); err_counter_pool_init: - mlxsw_sp_switchdev_fini(mlxsw_sp); -err_switchdev_init: mlxsw_sp_span_fini(mlxsw_sp); err_span_init: mlxsw_sp_lag_fini(mlxsw_sp); @@ -4141,7 +4130,6 @@ static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core) mlxsw_sp_nve_fini(mlxsw_sp); mlxsw_sp_afa_fini(mlxsw_sp); mlxsw_sp_counter_pool_fini(mlxsw_sp); - mlxsw_sp_switchdev_fini(mlxsw_sp); mlxsw_sp_span_fini(mlxsw_sp); mlxsw_sp_lag_fini(mlxsw_sp); mlxsw_sp_buffers_fini(mlxsw_sp); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index ceebc91f4f1d..82e3e6dc81a1 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -375,8 +375,6 @@ u32 mlxsw_sp_bytes_cells(const struct mlxsw_sp *mlxsw_sp, u32 bytes); /* spectrum_switchdev.c */ int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp); void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp); -void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port); -void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port); int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, bool adding); void diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 39a99db040bd..a3a3c14c7886 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -1925,10 +1925,6 @@ static struct mlxsw_sp_port *mlxsw_sp_lag_rep_port(struct mlxsw_sp *mlxsw_sp, return NULL; } -static const struct switchdev_ops mlxsw_sp_port_switchdev_ops = { - .switchdev_port_attr_set= mlxsw_sp_port_attr_set, -}; - static int mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device, struct mlxsw_sp_bridge_port *bridge_port, @@ -3536,11 +3532,3 @@ void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp) kfree(mlxsw_sp->bridge);
[PATCH net-next v2 05/16] rocker: Check bridge flags during prepare phase
In preparation for getting rid of switchdev_port_attr_get(), have rocker check for the bridge flags being set through switchdev_port_attr_set() with the SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS attribute identifier. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- drivers/net/ethernet/rocker/rocker_main.c | 40 ++- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 66f72f8c46e5..8657313b6f30 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -1565,18 +1565,42 @@ static int rocker_world_port_attr_stp_state_set(struct rocker_port *rocker_port, return wops->port_attr_stp_state_set(rocker_port, state); } +static int +rocker_world_port_attr_bridge_flags_support_get(const struct rocker_port * + rocker_port, + unsigned long * + p_brport_flags_support) +{ + struct rocker_world_ops *wops = rocker_port->rocker->wops; + + if (!wops->port_attr_bridge_flags_support_get) + return -EOPNOTSUPP; + return wops->port_attr_bridge_flags_support_get(rocker_port, + p_brport_flags_support); +} + static int rocker_world_port_attr_bridge_flags_set(struct rocker_port *rocker_port, unsigned long brport_flags, struct switchdev_trans *trans) { struct rocker_world_ops *wops = rocker_port->rocker->wops; + unsigned long brport_flags_s; + int err; if (!wops->port_attr_bridge_flags_set) return -EOPNOTSUPP; - if (switchdev_trans_ph_prepare(trans)) + if (switchdev_trans_ph_prepare(trans)) { + err = rocker_world_port_attr_bridge_flags_support_get(rocker_port, + &brport_flags_s); + if (err) + return err; + + if (brport_flags & ~brport_flags_s) + return -EOPNOTSUPP; return 0; + } return wops->port_attr_bridge_flags_set(rocker_port, brport_flags, trans); @@ -1593,20 +1617,6 @@ rocker_world_port_attr_bridge_flags_get(const struct rocker_port *rocker_port, return wops->port_attr_bridge_flags_get(rocker_port, p_brport_flags); } -static int -rocker_world_port_attr_bridge_flags_support_get(const struct rocker_port * - rocker_port, - unsigned long * - p_brport_flags_support) -{ - struct rocker_world_ops *wops = rocker_port->rocker->wops; - - if (!wops->port_attr_bridge_flags_support_get) - return -EOPNOTSUPP; - return wops->port_attr_bridge_flags_support_get(rocker_port, - p_brport_flags_support); -} - static int rocker_world_port_attr_bridge_ageing_time_set(struct rocker_port *rocker_port, u32 ageing_time, -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v2 06/16] net: bridge: Stop calling switchdev_port_attr_get()
On Sun, Feb 10, 2019 at 09:50:55AM -0800, Florian Fainelli wrote: > Now that all switchdev drivers have been converted to checking the > bridge port flags during the prepare phase of the > switchdev_port_attr_set(), we can move straight to trying to set the > desired flag through SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS. > > Acked-by: Jiri Pirko > Signed-off-by: Florian Fainelli > --- > net/bridge/br_switchdev.c | 20 +++- > 1 file changed, 3 insertions(+), 17 deletions(-) > > diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c > index db9e8ab96d48..939f300522c5 100644 > --- a/net/bridge/br_switchdev.c > +++ b/net/bridge/br_switchdev.c > @@ -64,29 +64,15 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p, > { > struct switchdev_attr attr = { > .orig_dev = p->dev, > - .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT, > + .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS, > + .flags = SWITCHDEV_F_DEFER, How does this work? You defer the operation, so the driver cannot veto it. This is why we have SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT which is not deferred. > + .u.brport_flags = flags, > }; > int err; > > if (mask & ~BR_PORT_FLAGS_HW_OFFLOAD) > return 0; > > - err = switchdev_port_attr_get(p->dev, &attr); > - if (err == -EOPNOTSUPP) > - return 0; > - if (err) > - return err; > - > - /* Check if specific bridge flag attribute offload is supported */ > - if (!(attr.u.brport_flags_support & mask)) { > - br_warn(p->br, "bridge flag offload is not supported %u(%s)\n", > - (unsigned int)p->port_no, p->dev->name); > - return -EOPNOTSUPP; > - } > - > - attr.id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS; > - attr.flags = SWITCHDEV_F_DEFER; > - attr.u.brport_flags = flags; > err = switchdev_port_attr_set(p->dev, &attr); > if (err) { > br_warn(p->br, "error setting offload flag on port %u(%s)\n", > -- > 2.19.1 > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v2 06/16] net: bridge: Stop calling switchdev_port_attr_get()
Le 2/10/19 à 11:05 AM, Ido Schimmel a écrit : > On Sun, Feb 10, 2019 at 09:50:55AM -0800, Florian Fainelli wrote: >> Now that all switchdev drivers have been converted to checking the >> bridge port flags during the prepare phase of the >> switchdev_port_attr_set(), we can move straight to trying to set the >> desired flag through SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS. >> >> Acked-by: Jiri Pirko >> Signed-off-by: Florian Fainelli >> --- >> net/bridge/br_switchdev.c | 20 +++- >> 1 file changed, 3 insertions(+), 17 deletions(-) >> >> diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c >> index db9e8ab96d48..939f300522c5 100644 >> --- a/net/bridge/br_switchdev.c >> +++ b/net/bridge/br_switchdev.c >> @@ -64,29 +64,15 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p, >> { >> struct switchdev_attr attr = { >> .orig_dev = p->dev, >> -.id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT, >> +.id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS, >> +.flags = SWITCHDEV_F_DEFER, > > How does this work? You defer the operation, so the driver cannot veto > it. This is why we have SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT > which is not deferred. I missed that indeed, how would you feel about splitting the attribute setting into different phases: - checking that the attribute setting is supported (caller context, so possibly atomic) - allocating and committing resources (deferred context) For pretty much any DSA driver, we will have to be in sleepable context anyway because of MDIO, SPI, I2C, whatever transport layer. Not sure how to best approach this now... -- Florian ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v2 00/16] net: Remove switchdev_ops
Le 2/10/19 à 9:50 AM, Florian Fainelli a écrit : > Hi all, > > This patch series finishes by the removal of switchdev_ops. To get there > we need to do a few things: > > - get rid of the one and only call to switchdev_port_attr_get() which is > used to fetch the device's bridge port flags capabilities, instead we > can just check what flags are being programmed during the prepare > phase > > - once we get rid of getting switchdev port attributes we convert the > setting of such attributes using a blocking notifier > > And then remove switchdev_ops completely. > > Please review and let me know what you think! I am going to submit a v3 which moves the port_attr_{get,set} to a switchdev notifier, but does not yet get rid of switchdev_port_attr_get() entirely since there is not a clear path yet to split the setting between non-sleeping and sleeping context. > > Changes in v2: > - fixed bisectability issues in patch #15 > - added Acked-by from Jiri where necessary > - fixed a few minor issues according to Jiri's feedback: > - rename port_attr_event -> port_attr_set_event > - moved SWITCHDEV_PORT_ATTR_SET closer to other blocking events > > Florian Fainelli (16): > Documentation: networking: switchdev: Update port parent ID section > mlxsw: spectrum: Check bridge flags during prepare phase > staging: fsl-dpaa2: ethsw: Check bridge port flags during set > net: dsa: Add setter for SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS > rocker: Check bridge flags during prepare phase > net: bridge: Stop calling switchdev_port_attr_get() > net: Remove SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT > net: Get rid of switchdev_port_attr_get() > switchdev: Add SWITCHDEV_PORT_ATTR_SET > rocker: Handle SWITCHDEV_PORT_ATTR_SET > net: dsa: Handle SWITCHDEV_PORT_ATTR_SET > mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_SET > net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_SET > staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_SET > net: switchdev: Replace port attr set SDO with a notification > net: Remove switchdev_ops > > Documentation/networking/switchdev.txt| 15 ++- > .../net/ethernet/mellanox/mlxsw/spectrum.c| 12 --- > .../net/ethernet/mellanox/mlxsw/spectrum.h| 2 - > .../mellanox/mlxsw/spectrum_switchdev.c | 69 -- > drivers/net/ethernet/mscc/ocelot.c| 21 +++- > drivers/net/ethernet/rocker/rocker_main.c | 95 --- > drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 48 -- > include/linux/netdevice.h | 3 - > include/net/switchdev.h | 36 ++- > net/bridge/br_switchdev.c | 20 +--- > net/dsa/dsa_priv.h| 3 + > net/dsa/port.c| 10 ++ > net/dsa/slave.c | 40 > net/switchdev/switchdev.c | 92 +- > 14 files changed, 170 insertions(+), 296 deletions(-) > -- Florian ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v2 00/16] net: Remove switchdev_ops
From: Florian Fainelli Date: Sun, 10 Feb 2019 12:44:47 -0800 > I am going to submit a v3 which moves the port_attr_{get,set} to a > switchdev notifier, but does not yet get rid of > switchdev_port_attr_get() entirely since there is not a clear path yet > to split the setting between non-sleeping and sleeping context. Ok. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V3 1/3] x86/Hyper-V: Set x2apic destination mode to physical when x2apic is available
On Thu, 7 Feb 2019, lantianyu1...@gmail.com wrote: > From: Lan Tianyu > > Hyper-V doesn't provide irq remapping for IO-APIC. To enable x2apic, > set x2apic destination mode to physcial mode when x2apic is available > and Hyper-V IOMMU driver makes sure cpus assigned with IO-APIC irqs have > 8-bit APIC id. This looks good now. Can that be applied independent of the IOMMU stuff or should this go together. If the latter: Reviewed-by: Thomas Gleixner If not, I just queue if for 5.1. Let me know, Thanks, tglx ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 3/9] rocker: Handle SWITCHDEV_PORT_ATTR_GET/SET
Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare rocker to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing rocker_port_attr_{set,get} calls. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/rocker/rocker_main.c | 24 +++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 66f72f8c46e5..591008c8fa74 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -2835,6 +2835,27 @@ rocker_switchdev_port_obj_event(unsigned long event, struct net_device *netdev, return notifier_from_errno(err); } +static int +rocker_switchdev_port_attr_event(unsigned long event, struct net_device *netdev, +struct switchdev_notifier_port_attr_info +*port_attr_info) +{ + int err = -EOPNOTSUPP; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = rocker_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = rocker_port_attr_get(netdev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int rocker_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -2847,6 +2868,9 @@ static int rocker_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: case SWITCHDEV_PORT_OBJ_DEL: return rocker_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: + case SWITCHDEV_PORT_ATTR_GET: + return rocker_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 2/9] switchdev: Add SWITCHDEV_PORT_ATTR_SET, SWITCHDEV_PORT_ATTR_GET
In preparation for allowing switchdev enabled drivers to veto specific attribute settings from within the context of the caller, introduce a new switchdev notifier type for port attributes. Suggested-by: Ido Schimmel Signed-off-by: Florian Fainelli --- include/net/switchdev.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 5e87b54c5dc5..b8becabbef38 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -143,6 +143,9 @@ enum switchdev_notifier_type { SWITCHDEV_VXLAN_FDB_ADD_TO_DEVICE, SWITCHDEV_VXLAN_FDB_DEL_TO_DEVICE, SWITCHDEV_VXLAN_FDB_OFFLOADED, + + SWITCHDEV_PORT_ATTR_SET, /* Blocking. */ + SWITCHDEV_PORT_ATTR_GET, /* Blocking. */ }; struct switchdev_notifier_info { @@ -165,6 +168,13 @@ struct switchdev_notifier_port_obj_info { bool handled; }; +struct switchdev_notifier_port_attr_info { + struct switchdev_notifier_info info; /* must be first */ + struct switchdev_attr *attr; + struct switchdev_trans *trans; + bool handled; +}; + static inline struct net_device * switchdev_notifier_info_to_dev(const struct switchdev_notifier_info *info) { -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 0/9] net: Remove switchdev_ops
Hi all, This patch series finishes by the removal of switchdev_ops. To get there we need to do a few things: - get rid of the one and only call to switchdev_port_attr_get() which is used to fetch the device's bridge port flags capabilities, instead we can just check what flags are being programmed during the prepare phase - once we get rid of getting switchdev port attributes we convert the setting of such attributes using a blocking notifier And then remove switchdev_ops completely. Please review and let me know what you think! David, I would like to get Ido's feedback on this to make sure I did not miss something, thank you! Changes in v3: - dropped patches removing te need to get the attribute since we still need that in order to support different sleeping vs. non-sleeping contexts Changes in v2: - fixed bisectability issues in patch #15 - added Acked-by from Jiri where necessary - fixed a few minor issues according to Jiri's feedback: - rename port_attr_event -> port_attr_set_event - moved SWITCHDEV_PORT_ATTR_SET closer to other blocking events Florian Fainelli (9): Documentation: networking: switchdev: Update port parent ID section switchdev: Add SWITCHDEV_PORT_ATTR_SET, SWITCHDEV_PORT_ATTR_GET rocker: Handle SWITCHDEV_PORT_ATTR_GET/SET mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_GET/SET net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_GET/SET staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_GET/SET net: dsa: Handle SWITCHDEV_PORT_ATTR_GET/SET net: switchdev: Replace port attr get/set SDO with a notification net: Remove switchdev_ops Documentation/networking/switchdev.txt| 10 +- .../net/ethernet/mellanox/mlxsw/spectrum.c| 12 -- .../net/ethernet/mellanox/mlxsw/spectrum.h| 2 - .../mellanox/mlxsw/spectrum_switchdev.c | 36 +++--- drivers/net/ethernet/mscc/ocelot.c| 26 - drivers/net/ethernet/rocker/rocker_main.c | 30 - drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 30 - include/linux/netdevice.h | 3 - include/net/switchdev.h | 28 ++--- net/dsa/slave.c | 30 - net/switchdev/switchdev.c | 107 ++ 11 files changed, 168 insertions(+), 146 deletions(-) -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 4/9] mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_GET/SET
Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare mlxsw to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing mlxsw_sp_port_attr_{set,get} calls. Signed-off-by: Florian Fainelli --- .../mellanox/mlxsw/spectrum_switchdev.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 95e37de3e48f..c6d7bb70e8f2 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -3443,6 +3443,26 @@ mlxsw_sp_switchdev_handle_vxlan_obj_del(struct net_device *vxlan_dev, } } +static int +mlxsw_sp_switchdev_port_attr_event(unsigned long event, struct net_device *dev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err = -EOPNOTSUPP; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = mlxsw_sp_port_attr_set(dev, port_attr_info->attr, +port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = mlxsw_sp_port_attr_get(dev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int mlxsw_sp_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -3466,6 +3486,9 @@ static int mlxsw_sp_switchdev_blocking_event(struct notifier_block *unused, mlxsw_sp_port_dev_check, mlxsw_sp_port_obj_del); return notifier_from_errno(err); + case SWITCHDEV_PORT_ATTR_SET: + case SWITCHDEV_PORT_ATTR_GET: + return mlxsw_sp_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 9/9] net: Remove switchdev_ops
Now that we have converted all possible callers to using a switchdev notifier for attributes we do not have a need for implementing switchdev_ops anymore, and this can be removed from all drivers the net_device structure. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 12 drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 -- .../mellanox/mlxsw/spectrum_switchdev.c| 13 - drivers/net/ethernet/mscc/ocelot.c | 5 - drivers/net/ethernet/rocker/rocker_main.c | 6 -- drivers/staging/fsl-dpaa2/ethsw/ethsw.c| 6 -- include/linux/netdevice.h | 3 --- include/net/switchdev.h| 18 -- net/dsa/slave.c| 6 -- 9 files changed, 71 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 7c9745cecbbd..619965abab43 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -3220,7 +3220,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, } mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan; - mlxsw_sp_port_switchdev_init(mlxsw_sp_port); mlxsw_sp->ports[local_port] = mlxsw_sp_port; err = register_netdev(dev); if (err) { @@ -3237,7 +3236,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, err_register_netdev: mlxsw_sp->ports[local_port] = NULL; - mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan); err_port_vlan_create: err_port_pvid_set: @@ -3280,7 +3278,6 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port) mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp); unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */ mlxsw_sp->ports[local_port] = NULL; - mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true); mlxsw_sp_port_nve_fini(mlxsw_sp_port); mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port); @@ -4001,12 +3998,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, goto err_span_init; } - err = mlxsw_sp_switchdev_init(mlxsw_sp); - if (err) { - dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize switchdev\n"); - goto err_switchdev_init; - } - err = mlxsw_sp_counter_pool_init(mlxsw_sp); if (err) { dev_err(mlxsw_sp->bus_info->dev, "Failed to init counter pool\n"); @@ -4077,8 +4068,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, err_afa_init: mlxsw_sp_counter_pool_fini(mlxsw_sp); err_counter_pool_init: - mlxsw_sp_switchdev_fini(mlxsw_sp); -err_switchdev_init: mlxsw_sp_span_fini(mlxsw_sp); err_span_init: mlxsw_sp_lag_fini(mlxsw_sp); @@ -4141,7 +4130,6 @@ static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core) mlxsw_sp_nve_fini(mlxsw_sp); mlxsw_sp_afa_fini(mlxsw_sp); mlxsw_sp_counter_pool_fini(mlxsw_sp); - mlxsw_sp_switchdev_fini(mlxsw_sp); mlxsw_sp_span_fini(mlxsw_sp); mlxsw_sp_lag_fini(mlxsw_sp); mlxsw_sp_buffers_fini(mlxsw_sp); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index ceebc91f4f1d..82e3e6dc81a1 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -375,8 +375,6 @@ u32 mlxsw_sp_bytes_cells(const struct mlxsw_sp *mlxsw_sp, u32 bytes); /* spectrum_switchdev.c */ int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp); void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp); -void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port); -void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port); int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, bool adding); void diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index c6d7bb70e8f2..fafd582c2fdc 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -1957,11 +1957,6 @@ static struct mlxsw_sp_port *mlxsw_sp_lag_rep_port(struct mlxsw_sp *mlxsw_sp, return NULL; } -static const struct switchdev_ops mlxsw_sp_port_switchdev_ops = { - .switchdev_port_attr_get= mlxsw_sp_port_attr_get, - .switchdev_port_attr_set= mlxsw_sp_port_attr_set, -}; - static int mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device, struct mlxsw_sp_bridge_port *bridge_port, @@ -3576,11 +3571,3 @@ void mlxsw_sp_switc
[PATCH net-next v3 8/9] net: switchdev: Replace port attr get/set SDO with a notification
Drop switchdev_ops.switchdev_port_attr_get and _set. Drop the uses of this field from all clients, which were migrated to use switchdev notification in the previous patches. Add a new function switchdev_port_attr_notify() that sends the switchdev notifications SWITCHDEV_PORT_ATTR_GET and _SET. Update switchdev_port_attr_get() to dispatch to this new function. Drop __switchdev_port_attr_set() and update switchdev_port_attr_set() likewise. Signed-off-by: Florian Fainelli --- net/switchdev/switchdev.c | 107 +- 1 file changed, 37 insertions(+), 70 deletions(-) diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 7e1357db33d7..8fc3db2179f5 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -174,81 +174,31 @@ static int switchdev_deferred_enqueue(struct net_device *dev, return 0; } -/** - * switchdev_port_attr_get - Get port attribute - * - * @dev: port device - * @attr: attribute to get - */ -int switchdev_port_attr_get(struct net_device *dev, struct switchdev_attr *attr) +static int switchdev_port_attr_notify(enum switchdev_notifier_type nt, + struct net_device *dev, + struct switchdev_attr *attr, + struct switchdev_trans *trans) { - const struct switchdev_ops *ops = dev->switchdev_ops; - struct net_device *lower_dev; - struct list_head *iter; - struct switchdev_attr first = { - .id = SWITCHDEV_ATTR_ID_UNDEFINED - }; - int err = -EOPNOTSUPP; + int err; + int rc; - if (ops && ops->switchdev_port_attr_get) - return ops->switchdev_port_attr_get(dev, attr); + struct switchdev_notifier_port_attr_info attr_info = { + .attr = attr, + .trans = trans, + .handled = false, + }; - if (attr->flags & SWITCHDEV_F_NO_RECURSE) + rc = call_switchdev_blocking_notifiers(nt, dev, &attr_info.info, NULL); + err = notifier_to_errno(rc); + if (err) { + WARN_ON(!attr_info.handled); return err; - - /* Switch device port(s) may be stacked under -* bond/team/vlan dev, so recurse down to get attr on -* each port. Return -ENODATA if attr values don't -* compare across ports. -*/ - - netdev_for_each_lower_dev(dev, lower_dev, iter) { - err = switchdev_port_attr_get(lower_dev, attr); - if (err) - break; - if (first.id == SWITCHDEV_ATTR_ID_UNDEFINED) - first = *attr; - else if (memcmp(&first, attr, sizeof(*attr))) - return -ENODATA; - } - - return err; -} -EXPORT_SYMBOL_GPL(switchdev_port_attr_get); - -static int __switchdev_port_attr_set(struct net_device *dev, -const struct switchdev_attr *attr, -struct switchdev_trans *trans) -{ - const struct switchdev_ops *ops = dev->switchdev_ops; - struct net_device *lower_dev; - struct list_head *iter; - int err = -EOPNOTSUPP; - - if (ops && ops->switchdev_port_attr_set) { - err = ops->switchdev_port_attr_set(dev, attr, trans); - goto done; - } - - if (attr->flags & SWITCHDEV_F_NO_RECURSE) - goto done; - - /* Switch device port(s) may be stacked under -* bond/team/vlan dev, so recurse down to set attr on -* each port. -*/ - - netdev_for_each_lower_dev(dev, lower_dev, iter) { - err = __switchdev_port_attr_set(lower_dev, attr, trans); - if (err) - break; } -done: - if (err == -EOPNOTSUPP && attr->flags & SWITCHDEV_F_SKIP_EOPNOTSUPP) - err = 0; + if (!attr_info.handled) + return -EOPNOTSUPP; - return err; + return 0; } static int switchdev_port_attr_set_now(struct net_device *dev, @@ -267,7 +217,9 @@ static int switchdev_port_attr_set_now(struct net_device *dev, */ trans.ph_prepare = true; - err = __switchdev_port_attr_set(dev, attr, &trans); + err = switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_SET, +dev, (struct switchdev_attr *)attr, +&trans); if (err) { /* Prepare phase failed: abort the transaction. Any * resources reserved in the prepare phase are @@ -286,7 +238,9 @@ static int switchdev_port_attr_set_now(struct net_device *dev, */ trans.ph_prepare = false; - err = __switchdev_port_attr_set(dev, attr, &trans); + err = switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_SET, +dev, (struct switchdev
[PATCH net-next v3 1/9] Documentation: networking: switchdev: Update port parent ID section
Update the section about switchdev drivers having to implement a switchdev_port_attr_get() function to return SWITCHDEV_ATTR_ID_PORT_PARENT_ID since that is no longer valid after commit bccb30254a4a ("net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID"). Fixes: bccb30254a4a ("net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID") Signed-off-by: Florian Fainelli --- Documentation/networking/switchdev.txt | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/networking/switchdev.txt b/Documentation/networking/switchdev.txt index f3244d87512a..2842f63ad47b 100644 --- a/Documentation/networking/switchdev.txt +++ b/Documentation/networking/switchdev.txt @@ -92,11 +92,11 @@ device. Switch ID ^ -The switchdev driver must implement the switchdev op switchdev_port_attr_get -for SWITCHDEV_ATTR_ID_PORT_PARENT_ID for each port netdev, returning the same -physical ID for each port of a switch. The ID must be unique between switches -on the same system. The ID does not need to be unique between switches on -different systems. +The switchdev driver must implement the net_device operation +ndo_get_port_parent_id for each port netdev, returning the same physical ID +for each port of a switch. The ID must be unique between switches on the same +system. The ID does not need to be unique between switches on different +systems. The switch ID is used to locate ports on a switch and to know if aggregated ports belong to the same switch. -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 6/9] staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_GET/SET
Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare ethsw to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing swdev_port_attr_{set,get} calls. Signed-off-by: Florian Fainelli --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index e559f4c25cf7..bc9e7de07200 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -,6 +,27 @@ ethsw_switchdev_port_obj_event(unsigned long event, struct net_device *netdev, return notifier_from_errno(err); } +static int +ethsw_switchdev_port_attr_event(unsigned long event, + struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err = -EOPNOTSUPP; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = swdev_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = swdev_port_attr_get(netdev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int port_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1123,6 +1144,9 @@ static int port_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: /* fall through */ case SWITCHDEV_PORT_OBJ_DEL: return ethsw_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: + case SWITCHDEV_PORT_ATTR_GET: + return ethsw_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 7/9] net: dsa: Handle SWITCHDEV_PORT_ATTR_GET/SET
Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare DSA to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing dsa_slave_port_attr_{set,get} calls. Signed-off-by: Florian Fainelli --- net/dsa/slave.c | 24 1 file changed, 24 insertions(+) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 2e5e7c04821b..2a14a38f5f93 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1558,6 +1558,27 @@ dsa_slave_switchdev_port_obj_event(unsigned long event, return notifier_from_errno(err); } +static int +dsa_slave_switchdev_port_attr_event(unsigned long event, + struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err = -EOPNOTSUPP; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = dsa_slave_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = dsa_slave_port_attr_get(netdev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1570,6 +1591,9 @@ static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: /* fall through */ case SWITCHDEV_PORT_OBJ_DEL: return dsa_slave_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: /* fallthrough */ + case SWITCHDEV_PORT_ATTR_GET: + return dsa_slave_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 5/9] net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_GET/SET
Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare ocelot to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing ocelot_port_attr_{set,get} calls. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/mscc/ocelot.c | 21 + 1 file changed, 21 insertions(+) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 195306d05bcd..850a49033a30 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1582,6 +1582,24 @@ struct notifier_block ocelot_netdevice_nb __read_mostly = { }; EXPORT_SYMBOL(ocelot_netdevice_nb); +static int +ocelot_switchdev_port_attr_event(unsigned long event, + struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err = -EOPNOTSUPP; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = ocelot_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int ocelot_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1600,6 +1618,9 @@ static int ocelot_switchdev_blocking_event(struct notifier_block *unused, ocelot_netdevice_dev_check, ocelot_port_obj_del); return notifier_from_errno(err); + case SWITCHDEV_PORT_ATTR_SET: + case SWITCHDEV_PORT_ATTR_GET: /* fallthrough */ + return ocelot_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: mt7621-pci: update driver's TODO file
On Sun, Feb 10 2019, Sergio Paracuellos wrote: > Some of the things included in driver's TODO file have > been properly achieved. Update file accordly. > > Signed-off-by: Sergio Paracuellos > --- > Hi Neil, > > I've been looking through the code of this driver and pci-phy > driver while thinking in what is missing already to get this > mainlined out of staging. I don't really know what cleanups > are missing here. The only thinkg is not clear yet is the thing > with the clocks defined in device-tree. Should be just remove > them and give this stuff a try to get feedback or what is missing? > Can you please point me out in the right direction? Hi Sergio, thanks for persisting with this. I think the "right" thing to do with the clocks is to write a driver that support ralink,rt2880-clock, similar to the way arch/mips/ralink/reset.c supports ralink,rt2880-reset It would support clk_enable by setting the relevant bit in #define RALINK_CLKCFG1 0x30 and clk_disable by clearing it. The pci-mt7621.c (and pci-mt7620.c) could use this to enable/disable the clocks, rather than poking directly at the register. Also, pci-mt7621.c (maybe) shouldn't be poking RALINK_PCIE_RST directly. This is apparently another reset line the driver needs, so it should be described in devicetree. i.e add another reset-name "pcie". Also, #define RALINK_PCI_IO_MAP_BASE 0x1e16 duplicates info that is in devicetree: ranges = < 0x0200 0 0x 0x6000 0 0x1000 /* pci memory */ 0x0100 0 0x 0x1e16 0 0x0001 /* io space */ ^^HERE >; I wonder if that matter... A tiny thing: * 3'b100 0x x * 3'b101 1x 0 * 3'b110 10 x * 3'b111 21 0 There are two sets of 8 spaces in there, that should be a TAB, and there is a space before a TAB, that should be removed (yes, I do have x-ray vision). I really don't know how important all this is. Maybe it would be best to post the patch and see what people say. Thanks, NeilBrown > > Thanks in advance for your time. > > Best regards, > Sergio Paracuellos > drivers/staging/mt7621-pci/TODO | 8 > 1 file changed, 8 deletions(-) > > diff --git a/drivers/staging/mt7621-pci/TODO b/drivers/staging/mt7621-pci/TODO > index cf30f629b9fd..ccfd266db4ca 100644 > --- a/drivers/staging/mt7621-pci/TODO > +++ b/drivers/staging/mt7621-pci/TODO > @@ -1,12 +1,4 @@ > > - general code review and cleanup > -- can this be converted to not require PCI_DRIVERS_LEGACY ?? > -The irq returned by pcibios_map_irq is a "hwirq" (hardware irq number) > -and pci_assign_irq() assigns this directly to dev->irq, which > -expects a "virq" (virtual irq number). These numbers are different > -on MIPS. There is a gross hack to make it work on one > -specific platform, so it can be tested. > -- Should this be merged with arch/mips/pci/pci-mt7620.c ?? > -- ensure device-tree requirements are documented > > Cc: NeilBrown > -- > 2.19.1 signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 1/2] sched/wait: introduce wait_event_freezable_hrtimeout
* Hugo Lefeuvre wrote: > introduce wait_event_freezable_hrtimeout, an interruptible and freezable > version of wait_event_hrtimeout. > > This helper will allow for simplifications in staging/android/vsoc.c, among > others. > > Signed-off-by: Hugo Lefeuvre > --- > Changes in v2: > - No change. > > include/linux/wait.h | 25 + > 1 file changed, 21 insertions(+), 4 deletions(-) > > diff --git a/include/linux/wait.h b/include/linux/wait.h > index 5f3efabc36f4..c4cf5113f58a 100644 > --- a/include/linux/wait.h > +++ b/include/linux/wait.h > @@ -483,7 +483,7 @@ do { > \ > __ret; > \ > }) > > -#define __wait_event_hrtimeout(wq_head, condition, timeout, state) > \ > +#define __wait_event_hrtimeout(wq_head, condition, timeout, state, cmd) > \ > ({ > \ > int __ret = 0; > \ > struct hrtimer_sleeper __t; > \ > @@ -500,7 +500,7 @@ do { > \ > __ret = -ETIME; > \ > break; > \ > } > \ > - schedule()); > \ > + cmd); > \ > > \ > hrtimer_cancel(&__t.timer); > \ > destroy_hrtimer_on_stack(&__t.timer); > \ > @@ -529,7 +529,23 @@ do { > \ > might_sleep(); > \ > if (!(condition)) > \ > __ret = __wait_event_hrtimeout(wq_head, condition, timeout, > \ > -TASK_UNINTERRUPTIBLE); > \ > +TASK_UNINTERRUPTIBLE, > \ > +schedule()); > \ > + __ret; > \ > +}) > + > +/* > + * like wait_event_hrtimeout() -- except it uses TASK_INTERRUPTIBLE to avoid > + * increasing load and is freezable. > + */ > +#define wait_event_freezable_hrtimeout(wq_head, condition, timeout) > \ > +({ > \ > + int __ret = 0; > \ > + might_sleep(); > \ > + if (!(condition)) > \ > + __ret = __wait_event_hrtimeout(wq_head, condition, timeout, > \ > +TASK_INTERRUPTIBLE, > \ > +freezable_schedule()); > \ > __ret; > \ > }) > > @@ -555,7 +571,8 @@ do { > \ > might_sleep(); > \ > if (!(condition)) > \ > __ret = __wait_event_hrtimeout(wq, condition, timeout, > \ > -TASK_INTERRUPTIBLE); > \ > +TASK_INTERRUPTIBLE, > \ > +schedule()); > \ > __ret; > \ > }) Looks good to me - unless PeterZ objects I suspect this wants to go upstream via the driver tree, not the scheduler tree: Acked-by: Ingo Molnar Thanks, Ingo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel